Merge "Resolving potential memory leak vulnerability in QueryInterceptorStatement." into androidx-main
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..8a971d6
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,22 @@
+# Global owners:
+# Unless a later match takes precedence, global owners will be # requested for
+# review when someone opens a pull request.
+* @dlam @yigit
+
+# Owners for each library group:
+/activity* @sanura-njaka @jbw0033 @ianhanniballake
+/appcompat/* @alanv
+/biometric/* @dlam
+/collection/* @dlam
+/compose/compiler/* @jimgoog @lelandrichardson
+/compose/runtime/* @jimgoog @lelandrichardson
+/core/* @alanv
+/datastore/* @rohitsat13 @yigit
+/fragment/* @sanura-njaka @jbw0033 @ianhanniballake
+/lifecycle/* @jbw0033 @ianhanniballake
+/navigation/* @jbw0033 @ianhanniballake @claraf3
+/paging/* @claraf3 @ianhanniballake
+/room/* @droid-wan-kenobi @danysantiago @svasilinets
+/work/* @svasilinets @tikurahul
+
+
diff --git a/activity/activity-compose/samples/src/main/java/androidx/activity/compose/samples/RememberLauncherForActivityResult.kt b/activity/activity-compose/samples/src/main/java/androidx/activity/compose/samples/RememberLauncherForActivityResult.kt
index a30ef4b..75480ad 100644
--- a/activity/activity-compose/samples/src/main/java/androidx/activity/compose/samples/RememberLauncherForActivityResult.kt
+++ b/activity/activity-compose/samples/src/main/java/androidx/activity/compose/samples/RememberLauncherForActivityResult.kt
@@ -46,4 +46,4 @@
result.value?.let { image ->
Image(image.asImageBitmap(), null, modifier = Modifier.fillMaxWidth())
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/TestActivity.kt b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/TestActivity.kt
index 722f444..793e796 100644
--- a/activity/activity-compose/src/androidTest/java/androidx/activity/compose/TestActivity.kt
+++ b/activity/activity-compose/src/androidTest/java/androidx/activity/compose/TestActivity.kt
@@ -24,4 +24,4 @@
reportFullyDrawnCalled = true
super.reportFullyDrawn()
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultLauncherTest.kt b/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultLauncherTest.kt
index 5f110c5..43fe1608 100644
--- a/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultLauncherTest.kt
+++ b/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultLauncherTest.kt
@@ -60,4 +60,4 @@
launcher.launch()
assertThat(actualResult).isEqualTo(expectedResult)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultTest.kt b/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultTest.kt
index 7de8667..e6ba88e 100644
--- a/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultTest.kt
+++ b/activity/activity-ktx/src/androidTest/java/androidx/activity/result/ActivityResultTest.kt
@@ -36,4 +36,4 @@
assertThat(resultCode).isEqualTo(1)
assertThat(data).isSameInstanceAs(intent)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity-ktx/src/main/java/androidx/activity/result/ActivityResultLauncher.kt b/activity/activity-ktx/src/main/java/androidx/activity/result/ActivityResultLauncher.kt
index 69ec900..769ca68 100644
--- a/activity/activity-ktx/src/main/java/androidx/activity/result/ActivityResultLauncher.kt
+++ b/activity/activity-ktx/src/main/java/androidx/activity/result/ActivityResultLauncher.kt
@@ -31,4 +31,4 @@
@JvmName("launchUnit")
public fun ActivityResultLauncher<Unit>.launch(options: ActivityOptionsCompat? = null) {
launch(Unit, options)
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/BackEventCompatTest.kt b/activity/activity/src/androidTest/java/androidx/activity/BackEventCompatTest.kt
index e04d827..21fe6c9 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/BackEventCompatTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/BackEventCompatTest.kt
@@ -60,4 +60,4 @@
assertThat(event.progress).isEqualTo(3f)
assertThat(event.swipeEdge).isEqualTo(BackEventCompat.EDGE_LEFT)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityRunOnNextRecreateTest.kt b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityRunOnNextRecreateTest.kt
index 38fe672..4d81f44 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityRunOnNextRecreateTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityRunOnNextRecreateTest.kt
@@ -71,4 +71,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
index cd451a7..f770904 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
@@ -190,4 +190,4 @@
super.onResume()
viewModel = ViewModelProvider(this).get(TestViewModel::class.java)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt b/activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
index 41a173d..b914f18 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
@@ -244,4 +244,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/FullyDrawnReporterTest.kt b/activity/activity/src/androidTest/java/androidx/activity/FullyDrawnReporterTest.kt
index 3d303a23..955b8df 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/FullyDrawnReporterTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/FullyDrawnReporterTest.kt
@@ -301,4 +301,4 @@
fullyDrawnReported = true
super.reportFullyDrawn()
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/LeakInputMethodManagerTest.kt b/activity/activity/src/androidTest/java/androidx/activity/LeakInputMethodManagerTest.kt
index 19d07fd..ee4318b 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/LeakInputMethodManagerTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/LeakInputMethodManagerTest.kt
@@ -79,4 +79,4 @@
super.onDestroy()
latch.countDown()
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/ViewTreeOnBackPressedDispatcherTest.kt b/activity/activity/src/androidTest/java/androidx/activity/ViewTreeOnBackPressedDispatcherTest.kt
index 16430d7..004359f 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/ViewTreeOnBackPressedDispatcherTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/ViewTreeOnBackPressedDispatcherTest.kt
@@ -121,4 +121,4 @@
override val onBackPressedDispatcher
get() = throw UnsupportedOperationException("not a real OnBackPressedDispatcherOwner")
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/contextaware/ContextAwareHelperTest.kt b/activity/activity/src/androidTest/java/androidx/activity/contextaware/ContextAwareHelperTest.kt
index e579938..8cb9336 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/contextaware/ContextAwareHelperTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/contextaware/ContextAwareHelperTest.kt
@@ -166,4 +166,4 @@
fun clearAvailableContext() {
contextAwareHelper.clearAvailableContext()
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt b/activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt
index a6af035..1cc4c08 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt
@@ -506,4 +506,4 @@
assertThat(completedLaunch).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/androidTest/java/androidx/activity/result/PickVisualMediaRequestTest.kt b/activity/activity/src/androidTest/java/androidx/activity/result/PickVisualMediaRequestTest.kt
index fde1fa0..4d388bc 100644
--- a/activity/activity/src/androidTest/java/androidx/activity/result/PickVisualMediaRequestTest.kt
+++ b/activity/activity/src/androidTest/java/androidx/activity/result/PickVisualMediaRequestTest.kt
@@ -46,4 +46,4 @@
assertThat(request.mediaType).isEqualTo(ActivityResultContracts.PickVisualMedia.VideoOnly)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/BackEventCompat.kt b/activity/activity/src/main/java/androidx/activity/BackEventCompat.kt
index cbc3521..b850269 100644
--- a/activity/activity/src/main/java/androidx/activity/BackEventCompat.kt
+++ b/activity/activity/src/main/java/androidx/activity/BackEventCompat.kt
@@ -20,11 +20,9 @@
import android.window.BackEvent
import androidx.annotation.DoNotInline
import androidx.annotation.IntDef
-import androidx.annotation.OptIn
import androidx.annotation.RequiresApi
import androidx.annotation.RestrictTo
import androidx.annotation.VisibleForTesting
-import androidx.core.os.BuildCompat
/**
* Compat around the [BackEvent] class
@@ -49,7 +47,6 @@
) {
@RequiresApi(34)
- @OptIn(BuildCompat.PrereleaseSdkCheck::class)
constructor(backEvent: BackEvent) : this (
Api34Impl.touchX(backEvent),
Api34Impl.touchY(backEvent),
@@ -73,8 +70,6 @@
* @throws UnsupportedOperationException if this API is called on an API prior to 34.
*/
@RequiresApi(34)
- @OptIn(BuildCompat.PrereleaseSdkCheck::class)
- @Suppress("PrereleaseSdkCoreDependency")
fun toBackEvent(): BackEvent {
if (Build.VERSION.SDK_INT >= 34) {
return Api34Impl.createOnBackEvent(touchX, touchY, progress, swipeEdge)
@@ -114,4 +109,4 @@
@DoNotInline
fun swipeEdge(backEvent: BackEvent) = backEvent.swipeEdge
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/Cancellable.kt b/activity/activity/src/main/java/androidx/activity/Cancellable.kt
index 33af37c..84dec13 100644
--- a/activity/activity/src/main/java/androidx/activity/Cancellable.kt
+++ b/activity/activity/src/main/java/androidx/activity/Cancellable.kt
@@ -24,4 +24,4 @@
* call multiple times.
*/
fun cancel()
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/ComponentActivity.java b/activity/activity/src/main/java/androidx/activity/ComponentActivity.java
index db3b9b3..de67431 100644
--- a/activity/activity/src/main/java/androidx/activity/ComponentActivity.java
+++ b/activity/activity/src/main/java/androidx/activity/ComponentActivity.java
@@ -69,7 +69,6 @@
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
@@ -81,7 +80,6 @@
import androidx.core.content.ContextCompat;
import androidx.core.content.OnConfigurationChangedProvider;
import androidx.core.content.OnTrimMemoryProvider;
-import androidx.core.os.BuildCompat;
import androidx.core.util.Consumer;
import androidx.core.view.MenuHost;
import androidx.core.view.MenuHostHelper;
@@ -369,7 +367,6 @@
* If your ComponentActivity is annotated with {@link ContentView}, this will
* call {@link #setContentView(int)} for you.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
// Restore the Saved State first so that it is available to
@@ -378,7 +375,7 @@
mContextAwareHelper.dispatchOnContextAvailable(this);
super.onCreate(savedInstanceState);
ReportFragment.injectIfNeededIn(this);
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
mOnBackPressedDispatcher.setOnBackInvokedDispatcher(
Api33Impl.getOnBackInvokedDispatcher(this)
);
@@ -1100,8 +1097,6 @@
public void reportFullyDrawn() {
try {
if (Trace.isEnabled()) {
- // TODO: Ideally we'd include getComponentName() (as later versions of platform
- // do), but b/175345114 needs to be addressed.
Trace.beginSection("reportFullyDrawn() for ComponentActivity");
}
diff --git a/activity/activity/src/main/java/androidx/activity/ComponentDialog.kt b/activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
index 7f66ab7..f6d1c86 100644
--- a/activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
+++ b/activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
@@ -129,4 +129,4 @@
window!!.decorView.setViewTreeOnBackPressedDispatcherOwner(this)
window!!.decorView.setViewTreeSavedStateRegistryOwner(this)
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/FullyDrawnReporterOwner.kt b/activity/activity/src/main/java/androidx/activity/FullyDrawnReporterOwner.kt
index c594770..ec6af730 100644
--- a/activity/activity/src/main/java/androidx/activity/FullyDrawnReporterOwner.kt
+++ b/activity/activity/src/main/java/androidx/activity/FullyDrawnReporterOwner.kt
@@ -25,4 +25,4 @@
* that separately report that they are fully drawn.
*/
val fullyDrawnReporter: FullyDrawnReporter
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcher.kt b/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcher.kt
index bf638f2..cdeb8c6 100644
--- a/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcher.kt
+++ b/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcher.kt
@@ -426,4 +426,4 @@
addCallback(callback)
}
return callback
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.kt b/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.kt
index 21401c7..7feb42e 100644
--- a/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.kt
+++ b/activity/activity/src/main/java/androidx/activity/OnBackPressedDispatcherOwner.kt
@@ -31,4 +31,4 @@
* The [OnBackPressedDispatcher] that should handle the system back button.
*/
val onBackPressedDispatcher: OnBackPressedDispatcher
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/contextaware/ContextAware.kt b/activity/activity/src/main/java/androidx/activity/contextaware/ContextAware.kt
index 7f43714..866856d 100644
--- a/activity/activity/src/main/java/androidx/activity/contextaware/ContextAware.kt
+++ b/activity/activity/src/main/java/androidx/activity/contextaware/ContextAware.kt
@@ -90,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/contextaware/ContextAwareHelper.kt b/activity/activity/src/main/java/androidx/activity/contextaware/ContextAwareHelper.kt
index 0a76e42..7ef4f5c 100644
--- a/activity/activity/src/main/java/androidx/activity/contextaware/ContextAwareHelper.kt
+++ b/activity/activity/src/main/java/androidx/activity/contextaware/ContextAwareHelper.kt
@@ -92,4 +92,4 @@
fun clearAvailableContext() {
context = null
}
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/contextaware/OnContextAvailableListener.kt b/activity/activity/src/main/java/androidx/activity/contextaware/OnContextAvailableListener.kt
index e5e8f1f..726b2bb 100644
--- a/activity/activity/src/main/java/androidx/activity/contextaware/OnContextAvailableListener.kt
+++ b/activity/activity/src/main/java/androidx/activity/contextaware/OnContextAvailableListener.kt
@@ -31,4 +31,4 @@
* @param context The [Context] the [ContextAware] object is now associated with.
*/
fun onContextAvailable(context: Context)
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistryOwner.kt b/activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistryOwner.kt
index 9ce51d1..a617ff0 100644
--- a/activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistryOwner.kt
+++ b/activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistryOwner.kt
@@ -32,4 +32,4 @@
* @return The activity result registry of the provider.
*/
val activityResultRegistry: ActivityResultRegistry
-}
\ No newline at end of file
+}
diff --git a/activity/activity/src/main/java/androidx/activity/result/IntentSenderRequest.kt b/activity/activity/src/main/java/androidx/activity/result/IntentSenderRequest.kt
index 7da957a..002343a 100644
--- a/activity/activity/src/main/java/androidx/activity/result/IntentSenderRequest.kt
+++ b/activity/activity/src/main/java/androidx/activity/result/IntentSenderRequest.kt
@@ -173,4 +173,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/MainActivity.kt b/activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/MainActivity.kt
index 5fe827e..6c46125 100644
--- a/activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/MainActivity.kt
+++ b/activity/integration-tests/testapp/src/main/java/androidx/activity/integration/testapp/MainActivity.kt
@@ -224,4 +224,4 @@
text = txt
setOnClickListener(listener)
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/DateProviderKt.kt b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/DateProviderKt.kt
index 04269de..fcab6dc 100644
--- a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/DateProviderKt.kt
+++ b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/DateProviderKt.kt
@@ -21,4 +21,4 @@
fun getDate(): Int {
return -1
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/LocationProviderKt.kt b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/LocationProviderKt.kt
index 178bafd4..65501d2 100644
--- a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/LocationProviderKt.kt
+++ b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/LocationProviderKt.kt
@@ -21,4 +21,4 @@
fun getLocation(): Int {
return -1
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaExperimentalFromKt.kt b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaExperimentalFromKt.kt
index 6bb8823..f37544e 100644
--- a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaExperimentalFromKt.kt
+++ b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaExperimentalFromKt.kt
@@ -80,4 +80,4 @@
val locationProvider = LocationProvider()
return dateProvider.date + locationProvider.location
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaPackageFromKt.kt b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaPackageFromKt.kt
index 312c3a5..3358f23 100644
--- a/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaPackageFromKt.kt
+++ b/annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/experimental/UseJavaPackageFromKt.kt
@@ -58,4 +58,4 @@
fun callSelfUseExperimental() {
callPackageUseExperimental()
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/AnnotationRetentionDetectorTest.kt b/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/AnnotationRetentionDetectorTest.kt
index f6ee76c..3d8a337 100644
--- a/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/AnnotationRetentionDetectorTest.kt
+++ b/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/AnnotationRetentionDetectorTest.kt
@@ -100,4 +100,4 @@
check(*input).expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/TestUtils.kt b/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/TestUtils.kt
index 33989a9..58a351b 100644
--- a/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/TestUtils.kt
+++ b/annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/TestUtils.kt
@@ -39,4 +39,4 @@
"/java/${className.replace('.', '/')}.kt"
)!!.readText()
)
-}
\ No newline at end of file
+}
diff --git a/annotation/annotation-experimental/build.gradle b/annotation/annotation-experimental/build.gradle
index 0b75e9a..f5a50cb 100644
--- a/annotation/annotation-experimental/build.gradle
+++ b/annotation/annotation-experimental/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.KotlinTarget
import androidx.build.Publish
plugins {
@@ -31,6 +33,7 @@
name = "Experimental annotation"
publish = Publish.SNAPSHOT_AND_RELEASE
mavenVersion = LibraryVersions.ANNOTATION_EXPERIMENTAL
+ kotlinTarget = KotlinTarget.KOTLIN_1_7
inceptionYear = "2019"
description = "Java annotation for use on unstable Android API surfaces. When used in " +
"conjunction with the Experimental annotation lint checks, this annotation provides " +
diff --git a/annotation/annotation/build.gradle b/annotation/annotation/build.gradle
index 224bb34..c69b1ca 100644
--- a/annotation/annotation/build.gradle
+++ b/annotation/annotation/build.gradle
@@ -1,7 +1,7 @@
import androidx.build.KmpPlatformsKt
import androidx.build.LibraryType
import androidx.build.PlatformIdentifier
-import androidx.build.Publish
+import androidx.build.KotlinTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
@@ -72,6 +72,7 @@
name = "Annotation"
type = LibraryType.PUBLISHED_LIBRARY
mavenVersion = LibraryVersions.ANNOTATION
+ kotlinTarget = KotlinTarget.KOTLIN_1_7
inceptionYear = "2013"
description = "Provides source annotations for tooling and readability."
}
diff --git a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/ClockInteractionService.kt b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/ClockInteractionService.kt
index 2c4f855..f3a097a 100644
--- a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/ClockInteractionService.kt
+++ b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/ClockInteractionService.kt
@@ -127,4 +127,4 @@
.setPackageName(ASSISTANT_PACKAGE)
.build()
)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/MainActivity.kt b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/MainActivity.kt
index 4319682..ac9d5a9 100644
--- a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/MainActivity.kt
+++ b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/MainActivity.kt
@@ -109,4 +109,4 @@
val seconds = (milliseconds % 60000) / 1000
return String.format("%02d:%02d:%02d", hours, minutes, seconds)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/Signatures.kt b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/Signatures.kt
index 18c3b0a..2e3fea9 100644
--- a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/Signatures.kt
+++ b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/Signatures.kt
@@ -28,4 +28,4 @@
result[i] = parts[i].toInt(16).toByte()
}
return result
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmActivity.kt b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmActivity.kt
index 25ee1f2..974d92f 100644
--- a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmActivity.kt
+++ b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmActivity.kt
@@ -69,4 +69,4 @@
private const val TAG = "alarmclock.AlarmReceiver"
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmInteractionService.kt b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmInteractionService.kt
index b607d37..7f56057 100644
--- a/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmInteractionService.kt
+++ b/appactions/interaction/integration-tests/testapp/src/main/java/androidx/appactions/interaction/testapp/alarm/AlarmInteractionService.kt
@@ -142,4 +142,4 @@
)
override val allowedApps: List<AppVerificationInfo> = /* TODO */ listOf()
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Attendee.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Attendee.kt
index 5ebbc27..7616521 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Attendee.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Attendee.kt
@@ -32,4 +32,4 @@
if (asPerson != other.asPerson) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/CallFormat.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/CallFormat.kt
index a2ad59b..1615291 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/CallFormat.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/CallFormat.kt
@@ -29,4 +29,4 @@
)
abstract class CanonicalValue internal constructor(val textValue: String)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/EndDate.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/EndDate.kt
index 5c36634..db03a15 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/EndDate.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/EndDate.kt
@@ -34,4 +34,4 @@
if (asZonedDateTime != other.asZonedDateTime) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/ItemListElement.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/ItemListElement.kt
index 8f7803c..baff5d82 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/ItemListElement.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/ItemListElement.kt
@@ -28,4 +28,4 @@
if (asListItem != other.asListItem) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Name.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Name.kt
index b779c3d..bdd5983 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Name.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Name.kt
@@ -26,4 +26,4 @@
if (asText != other.asText) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Participant.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Participant.kt
index abb312b..5a46ae2 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Participant.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Participant.kt
@@ -31,4 +31,4 @@
if (asPerson != other.asPerson) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Recipient.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Recipient.kt
index 7663eb4..1e7b7e6 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Recipient.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Recipient.kt
@@ -32,4 +32,4 @@
if (asPerson != other.asPerson) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/StartDate.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/StartDate.kt
index 4328dd8..5915fee 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/StartDate.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/StartDate.kt
@@ -35,4 +35,4 @@
if (asZonedDateTime != other.asZonedDateTime) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Text.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Text.kt
index 371954a..c66dc1b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Text.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/properties/Text.kt
@@ -19,4 +19,4 @@
class Text(asText: String) {
@get:JvmName("asText")
val asText: String = asText
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionAlreadyInProgress.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionAlreadyInProgress.kt
index c3d868c..b88f275 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionAlreadyInProgress.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionAlreadyInProgress.kt
@@ -60,4 +60,4 @@
ActionAlreadyInProgressBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "ActionAlreadyInProgress"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionNotInProgress.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionNotInProgress.kt
index 90bf9a9..da7822d 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionNotInProgress.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ActionNotInProgress.kt
@@ -55,4 +55,4 @@
ActionNotInProgressBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "ActionNotInProgress"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Call.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Call.kt
index 2f0fd0d..8d690de 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Call.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Call.kt
@@ -110,4 +110,4 @@
.setName(name)
.setCallFormat(callFormat)
.addAllParticipant(participantList)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/GenericErrorStatus.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/GenericErrorStatus.kt
index ec5d954..6c8b17b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/GenericErrorStatus.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/GenericErrorStatus.kt
@@ -55,4 +55,4 @@
GenericErrorStatusBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "GenericErrorStatus"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ItemList.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ItemList.kt
index df7d88a..58cab34 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ItemList.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ItemList.kt
@@ -90,4 +90,4 @@
if (this.itemListElements != other.itemListElements) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ListItem.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ListItem.kt
index 65b4845..fba7511 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ListItem.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/ListItem.kt
@@ -65,4 +65,4 @@
if (this.identifier != other.identifier) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Message.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Message.kt
index 0ebf75d..3750db9 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Message.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Message.kt
@@ -84,4 +84,4 @@
.setName(name)
.setText(text)
.addRecipients(recipientList)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/NoInternetConnection.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/NoInternetConnection.kt
index b9ee7d7..334b2ce 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/NoInternetConnection.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/NoInternetConnection.kt
@@ -56,4 +56,4 @@
NoInternetConnectionBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "NoInternetConnection"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Person.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Person.kt
index 62a5892..178b06b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Person.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Person.kt
@@ -82,4 +82,4 @@
if (name != other.name) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SafetyCheck.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SafetyCheck.kt
index 7117296..4b4355e 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SafetyCheck.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SafetyCheck.kt
@@ -74,4 +74,4 @@
.setName(name)
.setDuration(duration)
.setCheckInTime(checkInTime)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SuccessStatus.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SuccessStatus.kt
index be0e15b..f06badd 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SuccessStatus.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/SuccessStatus.kt
@@ -55,4 +55,4 @@
SuccessStatusBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "SuccessStatus"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Thing.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Thing.kt
index 1051242..1fe28c8 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Thing.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/builtintypes/experimental/types/Thing.kt
@@ -74,4 +74,4 @@
if (this.identifier != other.identifier) return false
return true
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/CapabilityFactory.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/CapabilityFactory.kt
index d1d45ea..3c2ec4b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/CapabilityFactory.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/CapabilityFactory.kt
@@ -24,4 +24,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
-annotation class CapabilityFactory(val name: String)
\ No newline at end of file
+annotation class CapabilityFactory(val name: String)
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/ExecutionCallback.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/ExecutionCallback.kt
index 4ce3ac1..e003734 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/ExecutionCallback.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/ExecutionCallback.kt
@@ -45,4 +45,4 @@
override val uiHandle = this@toExecutionCallback
override suspend fun onExecute(arguments: ArgumentsT): ExecutionResult<OutputT> =
this@toExecutionCallback.onExecute(arguments).await()
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/LibInfo.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/LibInfo.kt
index dd84a19..52b238a 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/LibInfo.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/LibInfo.kt
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/SearchAction.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/SearchAction.kt
index 03648fd..cd3171d 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/SearchAction.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/SearchAction.kt
@@ -59,4 +59,4 @@
/** Builds and returns a [SearchAction]. */
fun build() = SearchAction(query, filter)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupCandidate.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupCandidate.kt
index 9fac8e1..d20b4e9 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupCandidate.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupCandidate.kt
@@ -46,4 +46,4 @@
fun build(): EntityLookupCandidate<T> = EntityLookupCandidate(
requireNotNull(candidate) { "Entity lookup candidate must be set." })
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupRequest.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupRequest.kt
index 6765053..34c3cc0 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupRequest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/entity/EntityLookupRequest.kt
@@ -70,4 +70,4 @@
pageToken
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt
index d001532..f85735f 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt
@@ -31,4 +31,4 @@
return RequestMetadata(requestType, syncStatus)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/FutureCallback.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/FutureCallback.kt
index e807783..bd063bb 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/FutureCallback.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/FutureCallback.kt
@@ -24,4 +24,4 @@
/** Called with the ListenableFuture's exception if it fails. */
fun onFailure(t: Throwable)
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/Futures.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/Futures.kt
index 0005982..1830574 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/Futures.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/concurrent/Futures.kt
@@ -220,4 +220,4 @@
)
"ListenableFutureHelper#convertToListenableFuture for '$tag'"
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt
index 9ca198c..490b74a 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt
@@ -34,4 +34,4 @@
return FieldBinding(name, valueGetter, valueSetter)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt
index 4392e73..50aa83d 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt
@@ -223,4 +223,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistry.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistry.kt
index 057aef0..662e2f1 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistry.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistry.kt
@@ -54,4 +54,4 @@
fun getActionSpecForOutput(output: Any): ActionSpec<*, Any>? {
return outputClassToActionSpec[output.javaClass]
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt
index f2463cd..638c212e 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt
@@ -37,4 +37,4 @@
fun ofFailure(currentValue: CurrentValue) =
AppGroundingResult(Kind.FAILURE, null, currentValue)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/utils/CallbackUtils.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/utils/CallbackUtils.kt
index edd0a30..2f27a8b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/utils/CallbackUtils.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/utils/CallbackUtils.kt
@@ -121,4 +121,4 @@
throw t
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/properties/StringValue.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/properties/StringValue.kt
index 6e9a319..550dbcf 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/properties/StringValue.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/properties/StringValue.kt
@@ -48,4 +48,4 @@
override fun toString(): String =
"StringValue(name='$name', alternateNames=[${alternateNames.joinToString(",")}])"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TextFilter.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TextFilter.kt
index f632cc8..3ff45db 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TextFilter.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TextFilter.kt
@@ -43,4 +43,4 @@
"at least one of 'startsWith' and 'contains' must be non-null"
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TimeFilter.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TimeFilter.kt
index 169bdb4..e72b003 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TimeFilter.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/filters/TimeFilter.kt
@@ -45,4 +45,4 @@
"at least one of 'minTime' and 'maxTime' must be non-null"
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/AlarmSerializer.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/AlarmSerializer.kt
index 2e46f1d..c1c1d7f 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/AlarmSerializer.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/AlarmSerializer.kt
@@ -67,4 +67,4 @@
Alarm.Builder<*>::setIdentifier
).bindIdentifier {
it.identifier
-}.build()
\ No newline at end of file
+}.build()
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializer.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializer.kt
index ad57f19..2872151 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializer.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializer.kt
@@ -40,4 +40,4 @@
"failed to deserialize DayOfWeek with canonicalUrl=$str"
)
}
-)
\ No newline at end of file
+)
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/LibInfoTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/LibInfoTest.kt
index f564983..f6e083e 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/LibInfoTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/LibInfoTest.kt
@@ -47,4 +47,4 @@
assertThat(version).isNull()
assertThat(exceptionMsg).isEqualTo("Can not parse version: 1A")
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/entity/AlarmProvider.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/entity/AlarmProvider.kt
index 901bf40..d5d6016 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/entity/AlarmProvider.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/entity/AlarmProvider.kt
@@ -26,4 +26,4 @@
) : EntityProvider<Alarm>(ALARM_TYPE_SPEC) {
override suspend fun lookup(request: EntityLookupRequest<Alarm>):
EntityLookupResponse<Alarm> = response
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/converters/UnionTypeSpecTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/converters/UnionTypeSpecTest.kt
index 1aaa4a3..f3e41f6 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/converters/UnionTypeSpecTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/converters/UnionTypeSpecTest.kt
@@ -57,4 +57,4 @@
assertThat(ALARM_OR_TIMER_TYPE_SPEC.getIdentifier(timerUnion)).isEqualTo("timerId")
assertThat(ALARM_OR_TIMER_TYPE_SPEC.getIdentifier(timerUnionWithoutId)).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistryTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistryTest.kt
index 6248ac0..85747d4 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistryTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecRegistryTest.kt
@@ -117,4 +117,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/properties/StringValueTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/properties/StringValueTest.kt
index d7a9d94..4bfeb8a 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/properties/StringValueTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/properties/StringValueTest.kt
@@ -50,4 +50,4 @@
"StringValue(name='abcd', alternateNames=[alt1])"
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Arguments.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Arguments.kt
index e700f8e..2cd52cd 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Arguments.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Arguments.kt
@@ -64,4 +64,4 @@
fun build(): Arguments =
Arguments(requiredStringField, optionalStringField, repeatedStringField)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
index a8f174c..3667ff4 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
@@ -90,4 +90,4 @@
)
.build()
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Confirmation.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Confirmation.kt
index c66fce5..a7834a5 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Confirmation.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Confirmation.kt
@@ -45,4 +45,4 @@
fun build(): Confirmation = Confirmation(optionalStringField)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt
index d150ee3..c91c594 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt
@@ -64,4 +64,4 @@
fun build(): GenericEntityArguments =
GenericEntityArguments(singularField, optionalField, repeatedField)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Output.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Output.kt
index 1cc424f..198a91b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Output.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/Output.kt
@@ -55,4 +55,4 @@
fun build(): Output = Output(optionalStringField, repeatedStringField)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/TestEntity.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/TestEntity.kt
index 62005c7..254552b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/TestEntity.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/TestEntity.kt
@@ -72,4 +72,4 @@
fun build(): TestEntity = TestEntity(id, name, duration, zonedDateTime, entity)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializerTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializerTest.kt
index 195b70e..2cd82d1 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializerTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/serializers/types/DayOfWeekSerializerTest.kt
@@ -32,4 +32,4 @@
assertThat(DAY_OF_WEEK_TYPE_SPEC.toValue(DayOfWeek.MONDAY)).isEqualTo(MONDAY_VALUE)
assertThat(DAY_OF_WEEK_TYPE_SPEC.fromValue(MONDAY_VALUE)).isSameInstanceAs(DayOfWeek.MONDAY)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/AlarmReference.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/AlarmReference.kt
index 4cfb585..6231c59 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/AlarmReference.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/AlarmReference.kt
@@ -65,4 +65,4 @@
.build()
internal val PARAM_VALUE_CONVERTER = ParamValueConverter.of(TYPE_SPEC)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarm.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarm.kt
index f783e57..61e677f 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarm.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarm.kt
@@ -252,4 +252,4 @@
ActionSpecRegistry.registerActionSpec(Arguments::class, Output::class, ACTION_SPEC)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarm.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarm.kt
index b649310..73d5d69 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarm.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarm.kt
@@ -162,4 +162,4 @@
ActionSpecRegistry.registerActionSpec(Arguments::class, Output::class, ACTION_SPEC)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/GetAlarm.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/GetAlarm.kt
index 344b3bb..42474ba 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/GetAlarm.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/GetAlarm.kt
@@ -99,4 +99,4 @@
ActionSpecRegistry.registerActionSpec(Arguments::class, Output::class, ACTION_SPEC)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarm.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarm.kt
index ab6c117..7f8fb62 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarm.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarm.kt
@@ -205,4 +205,4 @@
ActionSpecRegistry.registerActionSpec(Arguments::class, Output::class, ACTION_SPEC)
}
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarm.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarm.kt
index 82b6e40..ec5cae4 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarm.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarm.kt
@@ -553,4 +553,4 @@
companion object {
const val CAPABILITY_NAME = "actions.intent.UPDATE_ALARM"
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimer.kt
index 36f4a06..48e41df6 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimer.kt
@@ -806,4 +806,4 @@
companion object {
const val CAPABILITY_NAME = "actions.intent.UPDATE_TIMER"
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarmTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarmTest.kt
index 8afcf65..512fcba 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarmTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/CreateAlarmTest.kt
@@ -140,4 +140,4 @@
).build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarmTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarmTest.kt
index e61d69b..01315e6 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarmTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/DismissAlarmTest.kt
@@ -84,4 +84,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/GetAlarmTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/GetAlarmTest.kt
index ffb0700..6bd6cc3 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/GetAlarmTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/GetAlarmTest.kt
@@ -86,4 +86,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/PauseTimerTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/PauseTimerTest.kt
index 5fa08e8..60302a5 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/PauseTimerTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/PauseTimerTest.kt
@@ -108,4 +108,4 @@
).build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResetTimerTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResetTimerTest.kt
index e63f8c3..99764e7 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResetTimerTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResetTimerTest.kt
@@ -86,4 +86,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimerTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimerTest.kt
index 4ff0b72..e9871ad 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimerTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimerTest.kt
@@ -86,4 +86,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarmTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarmTest.kt
index 086babf..0097725 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarmTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/SnoozeAlarmTest.kt
@@ -88,4 +88,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/StopTimerTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/StopTimerTest.kt
index 8415191..ee0b6c2 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/StopTimerTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/StopTimerTest.kt
@@ -86,4 +86,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteAlarmScheduleTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteAlarmScheduleTest.kt
index 549a81e..4bb9bc6 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteAlarmScheduleTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteAlarmScheduleTest.kt
@@ -151,4 +151,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteNameTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteNameTest.kt
index 94b84ee..6f8083b 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteNameTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateAlarmOverwriteNameTest.kt
@@ -111,4 +111,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerIncrementRemainingDurationTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerIncrementRemainingDurationTest.kt
index 8a1ae83..59544fe 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerIncrementRemainingDurationTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerIncrementRemainingDurationTest.kt
@@ -118,4 +118,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteNameTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteNameTest.kt
index 32f4fda..0e55c0c 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteNameTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteNameTest.kt
@@ -118,4 +118,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteRemainingDurationTest.kt b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteRemainingDurationTest.kt
index 28519cc..a94c361 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteRemainingDurationTest.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/test/java/androidx/appactions/interaction/capabilities/productivity/UpdateTimerOverwriteRemainingDurationTest.kt
@@ -118,4 +118,4 @@
.build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/EmergencySharingInProgress.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/EmergencySharingInProgress.kt
index 4fc874c..0062e26 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/EmergencySharingInProgress.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/EmergencySharingInProgress.kt
@@ -61,4 +61,4 @@
EmergencySharingInProgressBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "EmergencySharingInProgress"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyAccountNotLoggedIn.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyAccountNotLoggedIn.kt
index fed52ff..048f0e4 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyAccountNotLoggedIn.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyAccountNotLoggedIn.kt
@@ -61,4 +61,4 @@
SafetyAccountNotLoggedInBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "SafetyAccountNotLoggedIn"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyFeatureNotOnboarded.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyFeatureNotOnboarded.kt
index 46d84ab..8c3474d 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyFeatureNotOnboarded.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/executionstatus/SafetyFeatureNotOnboarded.kt
@@ -61,4 +61,4 @@
SafetyFeatureNotOnboardedBuilderImpl().setIdentifier(identifier).setName(name)
override fun toString(): String = "SafetyFeatureNotOnboarded"
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityRequest.kt b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityRequest.kt
index 4dcf208..16e276d 100644
--- a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityRequest.kt
+++ b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityRequest.kt
@@ -43,4 +43,4 @@
).build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityResponse.kt b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityResponse.kt
index 17b40dc..36a0a88 100644
--- a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityResponse.kt
+++ b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityResponse.kt
@@ -28,4 +28,4 @@
constructor(
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
val fulfillmentResponse: FulfillmentResponse
-)
\ No newline at end of file
+)
diff --git a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityTestUtils.kt b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityTestUtils.kt
index b5f2589..c2e01c7 100644
--- a/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityTestUtils.kt
+++ b/appactions/interaction/interaction-capabilities-testing/src/main/java/androidx/appactions/interaction/capabilities/testing/CapabilityTestUtils.kt
@@ -62,4 +62,4 @@
).build()
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionGrpcMetadata.kt b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionGrpcMetadata.kt
index 9b81b60..6bdcb10 100644
--- a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionGrpcMetadata.kt
+++ b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionGrpcMetadata.kt
@@ -89,4 +89,4 @@
)
return metadata
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionServiceGrpcImpl.kt b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionServiceGrpcImpl.kt
index 4ad41c9..e8ffe9a 100644
--- a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionServiceGrpcImpl.kt
+++ b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/AppInteractionServiceGrpcImpl.kt
@@ -607,4 +607,4 @@
)
"executing action capability"
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/CapabilityExecutionException.kt b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/CapabilityExecutionException.kt
index 243c469..6f7b5ff 100644
--- a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/CapabilityExecutionException.kt
+++ b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/CapabilityExecutionException.kt
@@ -22,4 +22,4 @@
internal class CapabilityExecutionException(
val errorStatus: ErrorStatusInternal,
message: String?
-) : RuntimeException(message)
\ No newline at end of file
+) : RuntimeException(message)
diff --git a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/RemoteViewsInternal.kt b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/RemoteViewsInternal.kt
index 4f5cb78..7d300c3 100644
--- a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/RemoteViewsInternal.kt
+++ b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/RemoteViewsInternal.kt
@@ -29,4 +29,4 @@
val remoteViews: RemoteViews,
val size: SizeF,
val collectionViewFactories: Map<Int, RemoteViewsFactory> = mapOf()
-)
\ No newline at end of file
+)
diff --git a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/UiResponse.kt b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/UiResponse.kt
index 89290d3..ec2dded 100644
--- a/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/UiResponse.kt
+++ b/appactions/interaction/interaction-service/src/main/java/androidx/appactions/interaction/service/UiResponse.kt
@@ -83,4 +83,4 @@
RemoteViewsInternal(remoteViews!!, size!!, collectionViewFactories)
)
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAlarmEntityProvider.kt b/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAlarmEntityProvider.kt
index 27d4b5a..4e15652 100644
--- a/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAlarmEntityProvider.kt
+++ b/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAlarmEntityProvider.kt
@@ -38,4 +38,4 @@
EntityLookupResponse.SUCCESS
).build()
}
-}
\ No newline at end of file
+}
diff --git a/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAppInteractionService.kt b/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAppInteractionService.kt
index e4e6f44..64f145f 100644
--- a/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAppInteractionService.kt
+++ b/appactions/interaction/interaction-service/src/test/java/androidx/appactions/interaction/service/testing/internal/FakeAppInteractionService.kt
@@ -28,4 +28,4 @@
override var registeredEntityProviders: List<EntityProvider<*>> = listOf()
override val securityPolicy: SecurityPolicy = SecurityPolicies.internalOnly()
override val allowedApps: List<AppVerificationInfo> = listOf()
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-benchmark/src/androidTest/java/androidx/appcompat/benchmark/ViewInflationBenchmark.kt b/appcompat/appcompat-benchmark/src/androidTest/java/androidx/appcompat/benchmark/ViewInflationBenchmark.kt
index 24e689d..8a153fa 100644
--- a/appcompat/appcompat-benchmark/src/androidTest/java/androidx/appcompat/benchmark/ViewInflationBenchmark.kt
+++ b/appcompat/appcompat-benchmark/src/androidTest/java/androidx/appcompat/benchmark/ViewInflationBenchmark.kt
@@ -48,4 +48,4 @@
inflater.inflate(R.layout.twelve_key_entry, root, false)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/app/SetActionBarDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/app/SetActionBarDetector.kt
index af31239..a7508fe 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/app/SetActionBarDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/app/SetActionBarDetector.kt
@@ -46,4 +46,4 @@
Implementation(SetActionBarDetector::class.java, Scope.JAVA_FILE_SCOPE)
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListAlphaDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListAlphaDetector.kt
index d23391df..f178cf2 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListAlphaDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListAlphaDetector.kt
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListLoadingDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListLoadingDetector.kt
index 35a4b49..34e10b729 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListLoadingDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ColorStateListLoadingDetector.kt
@@ -56,4 +56,4 @@
Implementation(ColorStateListLoadingDetector::class.java, Scope.JAVA_FILE_SCOPE)
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/DrawableLoadingDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/DrawableLoadingDetector.kt
index 2a07c64..38e49b0 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/DrawableLoadingDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/DrawableLoadingDetector.kt
@@ -59,4 +59,4 @@
Implementation(DrawableLoadingDetector::class.java, Scope.JAVA_FILE_SCOPE)
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ImageViewTintDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ImageViewTintDetector.kt
index e397e71..1efd15b 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ImageViewTintDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/res/ImageViewTintDetector.kt
@@ -64,4 +64,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/SwitchUsageXmlDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/SwitchUsageXmlDetector.kt
index 21c9b96..ad7f027 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/SwitchUsageXmlDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/SwitchUsageXmlDetector.kt
@@ -49,4 +49,4 @@
"Use `SwitchCompat` from AppCompat or `SwitchMaterial` from Material library"
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesApiDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesApiDetector.kt
index 9446f05..da0acd9 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesApiDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesApiDetector.kt
@@ -60,4 +60,4 @@
Implementation(TextViewCompoundDrawablesApiDetector::class.java, Scope.JAVA_FILE_SCOPE)
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesXmlDetector.kt b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesXmlDetector.kt
index 6ba2361..cc03549 100644
--- a/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesXmlDetector.kt
+++ b/appcompat/appcompat-lint/src/main/kotlin/androidx/appcompat/widget/TextViewCompoundDrawablesXmlDetector.kt
@@ -82,4 +82,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/integ/IntegrationTestHelper.kt b/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/integ/IntegrationTestHelper.kt
index d7fa30d..f986b51 100644
--- a/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/integ/IntegrationTestHelper.kt
+++ b/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/integ/IntegrationTestHelper.kt
@@ -65,4 +65,4 @@
val url = TestFiles::class.java.getResource(path)
?: throw IllegalArgumentException("Failed to load source for $resName")
return TestFiles.xml(path, url.readText())
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/widget/SwitchUsageCodeDetectorTest.kt b/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/widget/SwitchUsageCodeDetectorTest.kt
index aeb8cc6..bd89439 100644
--- a/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/widget/SwitchUsageCodeDetectorTest.kt
+++ b/appcompat/appcompat-lint/src/test/kotlin/androidx/appcompat/lint/widget/SwitchUsageCodeDetectorTest.kt
@@ -92,4 +92,4 @@
)
/* ktlint-enable max-line-length */
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompatTest.kt b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompatTest.kt
index 1277cba..4b93f40 100644
--- a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompatTest.kt
+++ b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompatTest.kt
@@ -254,4 +254,4 @@
private val STATE_EMPTY = intArrayOf()
private val STATE_FOCUSED = intArrayOf(android.R.attr.state_focused)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/MyDrawable.kt b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/MyDrawable.kt
index baf764d..b439a7f 100644
--- a/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/MyDrawable.kt
+++ b/appcompat/appcompat-resources/src/androidTest/java/androidx/appcompat/graphics/drawable/MyDrawable.kt
@@ -56,4 +56,4 @@
override fun getOpacity(): Int {
return PixelFormat.OPAQUE
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/build.gradle b/appcompat/appcompat/build.gradle
index a8b7765..c6bedc2 100644
--- a/appcompat/appcompat/build.gradle
+++ b/appcompat/appcompat/build.gradle
@@ -29,9 +29,6 @@
implementation("androidx.resourceinspection:resourceinspection-annotation:1.0.1")
api("androidx.savedstate:savedstate:1.2.1")
- // Due to experimental annotations used in core.
- compileOnly(libs.kotlinStdlib)
-
kapt("androidx.resourceinspection:resourceinspection-processor:1.0.1")
androidTestImplementation(libs.kotlinStdlib)
@@ -110,8 +107,4 @@
description = "Provides backwards-compatible implementations of UI-related Android SDK " +
"functionality, including dark mode and Material theming."
failOnDeprecationWarnings = false
- deviceTests {
- // Temporarily disabled due to b/286161632
- enabled = false
- }
}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/Orientation.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/Orientation.kt
index c9461c5..fce0245 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/Orientation.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/Orientation.kt
@@ -31,4 +31,4 @@
} finally {
setOrientationNatural()
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatActivityViewTreeTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatActivityViewTreeTest.kt
index 050577f..c60faa2 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatActivityViewTreeTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatActivityViewTreeTest.kt
@@ -60,4 +60,4 @@
activityRule.activity.window.decorView.findViewTreeOnBackPressedDispatcherOwner()
assertThat(bpOwner).isEqualTo(activityRule.activity)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatDialogTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatDialogTest.kt
index c82b2ce..c77b374 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatDialogTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/AppCompatDialogTest.kt
@@ -64,4 +64,4 @@
.isNotSameInstanceAs(lifecycle)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/LocalesSetUsingFrameworkApiTestCase.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/LocalesSetUsingFrameworkApiTestCase.kt
index b0db522..4fb8011 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/LocalesSetUsingFrameworkApiTestCase.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/LocalesSetUsingFrameworkApiTestCase.kt
@@ -112,4 +112,4 @@
LocaleList.getEmptyLocaleList()
)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeLocalBeforeAttachBaseActivity.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeLocalBeforeAttachBaseActivity.kt
index ed85ada..549dcd1 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeLocalBeforeAttachBaseActivity.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeLocalBeforeAttachBaseActivity.kt
@@ -28,4 +28,4 @@
super.attachBaseContext(newBase)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoDisplayAppCompatTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoDisplayAppCompatTest.kt
index a5e2068..d40005a 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoDisplayAppCompatTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoDisplayAppCompatTest.kt
@@ -35,4 +35,4 @@
fail("launching AppCompatActivity with NoDisplay theme should not throw error")
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoThemeAppCompatTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoThemeAppCompatTest.kt
index 5614e37..e632e7a 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoThemeAppCompatTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NoThemeAppCompatTest.kt
@@ -35,4 +35,4 @@
fail("launching AppCompatActivity with no theme should not throw error")
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SupportActionBarTestCase.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SupportActionBarTestCase.kt
index e77dd7d..def7443 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SupportActionBarTestCase.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SupportActionBarTestCase.kt
@@ -58,4 +58,4 @@
val now: Long = SystemClock.uptimeMillis()
return MotionEvent.obtain(now, now, action, 0f, 0f, 0)
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SystemLocalesMaintainedOnAppLanguageChangeTestCase.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SystemLocalesMaintainedOnAppLanguageChangeTestCase.kt
index f439860..77bede1 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SystemLocalesMaintainedOnAppLanguageChangeTestCase.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/SystemLocalesMaintainedOnAppLanguageChangeTestCase.kt
@@ -29,6 +29,7 @@
import junit.framework.Assert.assertEquals
import org.junit.After
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -49,12 +50,14 @@
)
}
+ @Ignore
@Test
fun testGetSystemLocales_noAppLocalesSet_systemLocalesSameAsExpectedSystemLocales() {
val context = InstrumentationRegistry.getInstrumentation().context
assertEquals(expectedSystemLocales, LocaleManagerCompat.getSystemLocales(context))
}
+ @Ignore
@Test
fun testGetSystemLocales_afterAppLocalesSet_systemLocalesSameAsExpectedSystemLocales() {
LocalesUtils.setLocalesAndWaitForRecreate(rule.activity, LocalesUtils.CUSTOM_LOCALE_LIST)
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/NavDrawerActivityTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/NavDrawerActivityTest.kt
index c759808..ce19bae 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/NavDrawerActivityTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/NavDrawerActivityTest.kt
@@ -109,4 +109,4 @@
assertThat(UITestUtils.verifyPressBackAndExit()).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesActivityTestRule.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesActivityTestRule.kt
index 976fac7..70e2a6a 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesActivityTestRule.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesActivityTestRule.kt
@@ -41,4 +41,4 @@
// Reset locales persisted in static storage.
LocalesUpdateActivity.teardown()
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesUtils.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesUtils.kt
index 5b21295..f15815c 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesUtils.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/LocalesUtils.kt
@@ -170,4 +170,4 @@
) = AppCompatDelegate.setApplicationLocales(locales)
private fun getLocales(): LocaleListCompat = AppCompatDelegate.getApplicationLocales()
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/NightModeActivityTestRule.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/NightModeActivityTestRule.kt
index 1a9d477..8114dc3 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/NightModeActivityTestRule.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/testutils/NightModeActivityTestRule.kt
@@ -39,4 +39,4 @@
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAttributeTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAttributeTest.kt
index aa2e0f5..af93309 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAttributeTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatAttributeTest.kt
@@ -200,4 +200,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatIconsTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatIconsTest.kt
index 37a1584..b887bfd 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatIconsTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatIconsTest.kt
@@ -109,4 +109,4 @@
assertNotNull(drawableShare)
}
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/ToolbarMenuHostTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/ToolbarMenuHostTest.kt
index 547bc7c..48bccd6 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/ToolbarMenuHostTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/ToolbarMenuHostTest.kt
@@ -321,4 +321,4 @@
assertThat(toolbar.menu.findItem(R.id.item3)).isNotNull()
assertThat(toolbar.menu.findItem(R.id.item4)).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDialogFragment.java b/appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDialogFragment.java
index ceae6f6..ffa9967 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDialogFragment.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDialogFragment.java
@@ -38,12 +38,12 @@
*/
public class AppCompatDialogFragment extends DialogFragment {
- /** {@inheritDoc} **/
+ /** {@inheritDoc} */
public AppCompatDialogFragment() {
super();
}
- /** {@inheritDoc} **/
+ /** {@inheritDoc} */
public AppCompatDialogFragment(@LayoutRes int contentLayoutId) {
super(contentLayoutId);
}
diff --git a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
index c620b8d..1553ee8 100644
--- a/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
+++ b/appcompat/appcompat/src/main/java/androidx/appcompat/widget/DropDownListView.java
@@ -34,12 +34,10 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.appcompat.R;
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
import androidx.core.graphics.drawable.DrawableCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.view.ViewPropertyAnimatorCompat;
import androidx.core.widget.ListViewAutoScrollHelper;
@@ -128,19 +126,15 @@
mHijackFocus = hijackFocus;
setCacheColorHint(0); // Transparent, since the background drawable could be anything.
}
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
private boolean superIsSelectedChildViewEnabled() {
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.isSelectedChildViewEnabled(this);
} else {
return PreApi33Impl.isSelectedChildViewEnabled(this);
}
}
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
private void superSetSelectedChildViewEnabled(boolean enabled) {
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
Api33Impl.setSelectedChildViewEnabled(this, enabled);
} else {
PreApi33Impl.setSelectedChildViewEnabled(this, enabled);
diff --git a/appcompat/appcompat/src/main/res/values-ne/strings.xml b/appcompat/appcompat/src/main/res/values-ne/strings.xml
index 53454e6..5b4cc3c 100644
--- a/appcompat/appcompat/src/main/res/values-ne/strings.xml
+++ b/appcompat/appcompat/src/main/res/values-ne/strings.xml
@@ -21,7 +21,7 @@
<string name="abc_action_bar_up_description" msgid="8388173803310557296">"माथि नेभिगेट गर्नुहोस्"</string>
<string name="abc_action_menu_overflow_description" msgid="3937310113216875497">"थप विकल्पहरू"</string>
<string name="abc_toolbar_collapse_description" msgid="1656852541809559762">"संक्षिप्त गर्नुहोस्"</string>
- <string name="abc_searchview_description_search" msgid="3417662926640357176">"खोज"</string>
+ <string name="abc_searchview_description_search" msgid="3417662926640357176">"खोज्नुहोस्"</string>
<string name="abc_search_hint" msgid="7208076849092622260">"खोज्नुहोस्…"</string>
<string name="abc_searchview_description_query" msgid="693312494995508443">"खोज प्रश्न"</string>
<string name="abc_searchview_description_clear" msgid="3741173234950517107">"क्वेरी खाली गर्नुहोस्"</string>
diff --git a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchImplTest.java b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchImplTest.java
index 5413e66..9851266 100644
--- a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchImplTest.java
+++ b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchImplTest.java
@@ -719,6 +719,201 @@
}
@Test
+ public void testQueryInvalidPackages_withJoin() throws Exception {
+ // Make sure that local queries with joinspecs including package filters don't access
+ // other packages.
+
+ // Create a new mAppSearchImpl with a mock Visibility Checker
+ mAppSearchImpl.close();
+ File tempFolder = mTemporaryFolder.newFolder();
+ // We need to share across packages
+ VisibilityChecker mockVisibilityChecker =
+ (callerAccess, packageName, prefixedSchema, visibilityStore) -> true;
+ mAppSearchImpl = AppSearchImpl.create(
+ tempFolder,
+ new UnlimitedLimitConfig(),
+ new DefaultIcingOptionsConfig(),
+ /*initStatsBuilder=*/ null,
+ ALWAYS_OPTIMIZE,
+ mockVisibilityChecker);
+
+ AppSearchSchema.StringPropertyConfig personField =
+ new AppSearchSchema.StringPropertyConfig.Builder("personId")
+ .setJoinableValueType(
+ AppSearchSchema.StringPropertyConfig
+ .JOINABLE_VALUE_TYPE_QUALIFIED_ID)
+ .build();
+
+ // Insert package1 schema
+ List<AppSearchSchema> personAndCallSchema =
+ ImmutableList.of(new AppSearchSchema.Builder("personSchema").build(),
+ new AppSearchSchema.Builder("callSchema")
+ .addProperty(personField).build());
+ InternalSetSchemaResponse internalSetSchemaResponse = mAppSearchImpl.setSchema(
+ "package1",
+ "database1",
+ personAndCallSchema,
+ /*visibilityDocuments=*/ Collections.emptyList(),
+ /*forceOverride=*/ false,
+ /*version=*/ 0,
+ /* setSchemaStatsBuilder= */ null);
+ assertThat(internalSetSchemaResponse.isSuccess()).isTrue();
+
+ // Insert package2 schema
+ List<AppSearchSchema> callSchema =
+ ImmutableList.of(new AppSearchSchema.Builder("callSchema")
+ .addProperty(personField).build());
+ internalSetSchemaResponse = mAppSearchImpl.setSchema(
+ "package2",
+ "database2",
+ callSchema,
+ /*visibilityDocuments=*/ Collections.emptyList(),
+ /*forceOverride=*/ true,
+ /*version=*/ 0,
+ /* setSchemaStatsBuilder= */ null);
+ assertThat(internalSetSchemaResponse.isSuccess()).isTrue();
+
+ // Insert package1 document
+ GenericDocument person = new GenericDocument.Builder<>("namespace", "person",
+ "personSchema")
+ .build();
+ mAppSearchImpl.putDocument(
+ "package1",
+ "database1",
+ person,
+ /*sendChangeNotifications=*/ false,
+ /*logger=*/ null);
+
+ GenericDocument call1 = new GenericDocument.Builder<>("namespace", "id1", "callSchema")
+ .setPropertyString("personId", "package1$database1/namespace#person").build();
+ GenericDocument call2 = new GenericDocument.Builder<>("namespace", "id2", "callSchema")
+ .setPropertyString("personId", "package1$database1/namespace#person").build();
+
+ // Insert package1 action document
+ mAppSearchImpl.putDocument(
+ "package1",
+ "database1",
+ call1,
+ /*sendChangeNotifications=*/ false,
+ /*logger=*/ null);
+
+ // Insert package2 action document
+ mAppSearchImpl.putDocument(
+ "package2",
+ "database2",
+ call2,
+ /*sendChangeNotifications=*/ false,
+ /*logger=*/ null);
+
+ // Invalid parent spec filter
+ SearchSpec searchSpec = new SearchSpec.Builder()
+ .setTermMatch(TermMatchType.Code.PREFIX_VALUE)
+ .addFilterPackageNames("package1", "package2")
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .build();
+ SearchResultPage searchResultPage = mAppSearchImpl.query("package1", "database1", "",
+ searchSpec, /*logger=*/ null);
+ // Only package1 documents should be returned
+ assertThat(searchResultPage.getResults()).hasSize(2);
+ assertThat(searchResultPage.getResults().get(0).getGenericDocument()).isEqualTo(person);
+ assertThat(searchResultPage.getResults().get(1).getGenericDocument()).isEqualTo(call1);
+
+ // Valid parent spec filter with invalid child spec filter
+ SearchSpec nested = new SearchSpec.Builder()
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .addFilterPackageNames("package1", "package2")
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .build();
+ JoinSpec join = new JoinSpec.Builder("personId").setNestedSearch("", nested).build();
+ searchSpec = new SearchSpec.Builder()
+ .setTermMatch(TermMatchType.Code.PREFIX_VALUE)
+ .addFilterPackageNames("package1")
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .setJoinSpec(join)
+ .build();
+ searchResultPage = mAppSearchImpl.query("package1", "database1", "",
+ searchSpec, /*logger=*/ null);
+
+ // Only package1 documents should be returned, for both the outer and nested searches
+ assertThat(searchResultPage.getResults()).hasSize(2);
+ assertThat(searchResultPage.getResults().get(0).getGenericDocument()).isEqualTo(person);
+ assertThat(searchResultPage.getResults().get(1).getGenericDocument()).isEqualTo(call1);
+ SearchResult result = searchResultPage.getResults().get(0);
+ assertThat(result.getJoinedResults()).hasSize(1);
+ assertThat(result.getJoinedResults().get(0).getGenericDocument()).isEqualTo(call1);
+
+ // Valid parent spec, but child spec package filters only contain other packages
+ nested = new SearchSpec.Builder()
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .addFilterPackageNames("package2", "package3")
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .build();
+ join = new JoinSpec.Builder("personId").setNestedSearch("", nested).build();
+ searchSpec = new SearchSpec.Builder()
+ .setTermMatch(TermMatchType.Code.PREFIX_VALUE)
+ .addFilterPackageNames("package1")
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .setJoinSpec(join)
+ .build();
+ searchResultPage = mAppSearchImpl.query("package1", "database1", "",
+ searchSpec, /*logger=*/ null);
+
+ // Package1 documents should be returned, but no packages should be joined
+ assertThat(searchResultPage.getResults()).hasSize(2);
+ assertThat(searchResultPage.getResults().get(0).getGenericDocument()).isEqualTo(person);
+ assertThat(searchResultPage.getResults().get(1).getGenericDocument()).isEqualTo(call1);
+ result = searchResultPage.getResults().get(0);
+ assertThat(result.getJoinedResults()).isEmpty();
+
+ // Valid parent spec, empty child spec package filters
+ nested = new SearchSpec.Builder()
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .build();
+ join = new JoinSpec.Builder("personId").setNestedSearch("", nested).build();
+ searchSpec = new SearchSpec.Builder()
+ .setTermMatch(TermMatchType.Code.PREFIX_VALUE)
+ .addFilterPackageNames("package1")
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .setJoinSpec(join)
+ .build();
+ searchResultPage = mAppSearchImpl.query("package1", "database1", "",
+ searchSpec, /*logger=*/ null);
+
+ // Only package1 documents should be returned, for both the outer and nested searches
+ assertThat(searchResultPage.getResults()).hasSize(2);
+ assertThat(searchResultPage.getResults().get(0).getGenericDocument()).isEqualTo(person);
+ assertThat(searchResultPage.getResults().get(1).getGenericDocument()).isEqualTo(call1);
+ result = searchResultPage.getResults().get(0);
+ assertThat(result.getJoinedResults()).hasSize(1);
+ assertThat(result.getJoinedResults().get(0).getGenericDocument()).isEqualTo(call1);
+
+ // Valid parent spec filter with valid child spec filter
+ nested = new SearchSpec.Builder().build();
+ join = new JoinSpec.Builder("personId").setNestedSearch("", nested).build();
+ searchSpec = new SearchSpec.Builder()
+ .setTermMatch(TermMatchType.Code.PREFIX_VALUE)
+ .addFilterPackageNames("package1")
+ .setRankingStrategy(SearchSpec.RANKING_STRATEGY_CREATION_TIMESTAMP)
+ .setOrder(SearchSpec.ORDER_ASCENDING)
+ .setJoinSpec(join)
+ .build();
+ searchResultPage = mAppSearchImpl.query("package1", "database1", "",
+ searchSpec, /*logger=*/ null);
+ // Should work as expected
+ assertThat(searchResultPage.getResults()).hasSize(2);
+ assertThat(searchResultPage.getResults().get(0).getGenericDocument()).isEqualTo(person);
+ assertThat(searchResultPage.getResults().get(1).getGenericDocument()).isEqualTo(call1);
+ result = searchResultPage.getResults().get(0);
+ assertThat(result.getJoinedResults()).hasSize(1);
+ assertThat(result.getJoinedResults().get(0).getGenericDocument()).isEqualTo(call1);
+ }
+
+ @Test
public void testSearchSuggestion() throws Exception {
// Insert schema
List<AppSearchSchema> schemas = Collections.singletonList(
diff --git a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverterTest.java b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverterTest.java
index e848cc2..5c98d3e 100644
--- a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverterTest.java
+++ b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverterTest.java
@@ -20,6 +20,7 @@
import androidx.appsearch.app.AppSearchSchema;
+import com.google.android.icing.proto.DocumentIndexingConfig;
import com.google.android.icing.proto.JoinableConfig;
import com.google.android.icing.proto.PropertyConfigProto;
import com.google.android.icing.proto.SchemaTypeConfigProto;
@@ -187,4 +188,54 @@
assertThat(SchemaToProtoConverter.toAppSearchSchema(alternativeExpectedSchemaProto))
.isEqualTo(schema);
}
+
+ @Test
+ public void testGetProto_DocumentIndexingConfig() {
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new AppSearchSchema.StringPropertyConfig.Builder("name")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_REQUIRED)
+ .setIndexingType(
+ AppSearchSchema.StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(AppSearchSchema.StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new AppSearchSchema.DocumentPropertyConfig.Builder("worksFor",
+ "Organization")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("orgName", "notes")
+ .build())
+ .build();
+
+ DocumentIndexingConfig documentIndexingConfig = DocumentIndexingConfig.newBuilder()
+ .setIndexNestedProperties(false)
+ .addIndexableNestedPropertiesList("orgName")
+ .addIndexableNestedPropertiesList("notes")
+ .build();
+
+ SchemaTypeConfigProto expectedPersonProto = SchemaTypeConfigProto.newBuilder()
+ .setSchemaType("Person")
+ .setVersion(0)
+ .addProperties(
+ PropertyConfigProto.newBuilder()
+ .setPropertyName("name")
+ .setDataType(PropertyConfigProto.DataType.Code.STRING)
+ .setCardinality(PropertyConfigProto.Cardinality.Code.REQUIRED)
+ .setStringIndexingConfig(StringIndexingConfig.newBuilder()
+ .setTermMatchType(TermMatchType.Code.PREFIX)
+ .setTokenizerType(
+ StringIndexingConfig.TokenizerType.Code.PLAIN)))
+ .addProperties(
+ PropertyConfigProto.newBuilder()
+ .setPropertyName("worksFor")
+ .setDataType(PropertyConfigProto.DataType.Code.DOCUMENT)
+ .setSchemaType("Organization")
+ .setCardinality(PropertyConfigProto.Cardinality.Code.OPTIONAL)
+ .setDocumentIndexingConfig(documentIndexingConfig))
+ .build();
+
+ assertThat(SchemaToProtoConverter.toSchemaTypeConfigProto(personSchema, /*version=*/0))
+ .isEqualTo(expectedPersonProto);
+ assertThat(SchemaToProtoConverter.toAppSearchSchema(expectedPersonProto))
+ .isEqualTo(personSchema);
+ }
}
diff --git a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SearchSpecToProtoConverterTest.java b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SearchSpecToProtoConverterTest.java
index 9a19a6a..978b981 100644
--- a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SearchSpecToProtoConverterTest.java
+++ b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/converter/SearchSpecToProtoConverterTest.java
@@ -480,8 +480,6 @@
PrefixUtil.removePrefix(grouping2.getEntryGroupings(1).getNamespace()));
}
- // @exportToFramework:startStrip()
- // TODO(b/258715421) start exporting this when it is unhidden in framework
@Test
public void testToResultSpecProto_groupBySchema() throws Exception {
SearchSpec searchSpec = new SearchSpec.Builder()
@@ -528,7 +526,6 @@
.isEqualTo(
PrefixUtil.removePrefix(grouping2.getEntryGroupings(1).getSchema()));
}
- // @exportToFramework:endStrip()
@Test
public void testToResultSpecProto_groupByNamespaceAndPackage() throws Exception {
@@ -565,8 +562,6 @@
assertThat(resultSpecProto.getResultGroupings(3).getEntryGroupingsList()).hasSize(1);
}
- // @exportToFramework:startStrip()
- // TODO(b/258715421) start exporting this when it is unhidden in framework
@Test
public void testToResultSpecProto_groupBySchemaAndPackage() throws Exception {
SearchSpec searchSpec = new SearchSpec.Builder()
@@ -804,7 +799,6 @@
assertThat(grouping8.getEntryGroupings(0).getSchema())
.isEqualTo("package1$database/typeB");
}
- // @exportToFramework:endStrip()
@Test
public void testGetTargetNamespaceFilters_emptySearchingFilter() {
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AlwaysSupportedFeatures.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AlwaysSupportedFeatures.java
index bad10a1..120a025 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AlwaysSupportedFeatures.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AlwaysSupportedFeatures.java
@@ -65,6 +65,8 @@
case Features.SET_SCHEMA_CIRCULAR_REFERENCES:
// fall through
case Features.SCHEMA_ADD_PARENT_TYPE:
+ // fall through
+ case Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES:
return true;
default:
return false;
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchImpl.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchImpl.java
index f9f326e..55882b7 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchImpl.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchImpl.java
@@ -312,6 +312,8 @@
icingOptionsConfig.getAllowCircularSchemaDefinitions())
.setPreMappingFbv(icingOptionsConfig.getUsePreMappingWithFileBackedVector())
.setUsePersistentHashMap(icingOptionsConfig.getUsePersistentHashMap())
+ .setIntegerIndexBucketSplitThreshold(
+ icingOptionsConfig.getIntegerIndexBucketSplitThreshold())
.build();
LogUtil.piiTrace(TAG, "Constructing IcingSearchEngine, request", options);
mIcingSearchEngineLocked = new IcingSearchEngine(options);
@@ -1340,6 +1342,22 @@
return new SearchResultPage(Bundle.EMPTY);
}
+ if (searchSpec.getJoinSpec() != null) {
+ List<String> joinFilterPackages =
+ searchSpec.getJoinSpec().getNestedSearchSpec().getFilterPackageNames();
+
+ // Ensure the nested SearchSpec only filters on the package performing the query.
+ if (joinFilterPackages.isEmpty() || (joinFilterPackages.size() > 1
+ && joinFilterPackages.contains(packageName))) {
+ searchSpec.getJoinSpec().getNestedSearchSpec().getBundle()
+ .putStringArrayList("packageName",
+ new ArrayList<>(Collections.singleton(packageName)));
+ } else if (!joinFilterPackages.contains(packageName)) {
+ // Filter packages only contains other packages, remove the JoinSpec
+ searchSpec.getBundle().remove("joinSpec");
+ }
+ }
+
String prefix = createPrefix(packageName, databaseName);
SearchSpecToProtoConverter searchSpecToProtoConverter =
new SearchSpecToProtoConverter(queryExpression, searchSpec,
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/DefaultIcingOptionsConfig.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/DefaultIcingOptionsConfig.java
index 9de05a6..ac9742d 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/DefaultIcingOptionsConfig.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/DefaultIcingOptionsConfig.java
@@ -74,4 +74,8 @@
return DEFAULT_MAX_PAGE_BYTES_LIMIT;
}
+ @Override
+ public int getIntegerIndexBucketSplitThreshold() {
+ return DEFAULT_INTEGER_INDEX_BUCKET_SPLIT_THRESHOLD;
+ }
}
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/IcingOptionsConfig.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/IcingOptionsConfig.java
index 56b097d..0f929f4 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/IcingOptionsConfig.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/IcingOptionsConfig.java
@@ -51,6 +51,18 @@
int DEFAULT_MAX_PAGE_BYTES_LIMIT = Integer.MAX_VALUE;
/**
+ * The default threshold for integer index bucket split. 65536 is picked based on
+ * benchmark (Icing integer-index-storage_benchmark.cc).
+ * <ul>
+ * <li>There will be only 16 buckets when indexing 1M integers, which improves the
+ * performance of numeric search range query.
+ * <li>It also increases # of hits to read for numeric search exact query, but the overall
+ * query latency is still reasonable.
+ * </ul>
+ */
+ int DEFAULT_INTEGER_INDEX_BUCKET_SPLIT_THRESHOLD = 65536;
+
+ /**
* The maximum allowable token length. All tokens in excess of this size will be truncated to
* max_token_length before being indexed.
*
@@ -150,4 +162,17 @@
* result exceeds this limit.
*/
int getMaxPageBytesLimit();
+
+ /**
+ * Flag for {@link com.google.android.icing.proto.IcingSearchEngineOptions}.
+ *
+ * <p>Threshold for integer index bucket split. Integer index stores hits in several buckets,
+ * and splits if # of hits in a single bucket exceed the threshold. Splitting bucket accelerates
+ * numeric search exact query, but potentially downgrades the performance of range query.
+ *
+ * <p>This flag is for rolling out new threshold 65536. If identifying any issues, then change
+ * it back to 341 (the previous bucket split threshold, capacity of full max-sized posting
+ * list).
+ */
+ int getIntegerIndexBucketSplitThreshold();
}
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverter.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverter.java
index bf603a0..41cd770 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverter.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/converter/SchemaToProtoConverter.java
@@ -119,8 +119,11 @@
builder
.setSchemaType(documentProperty.getSchemaType())
.setDocumentIndexingConfig(
- DocumentIndexingConfig.newBuilder().setIndexNestedProperties(
- documentProperty.shouldIndexNestedProperties()));
+ DocumentIndexingConfig.newBuilder()
+ .setIndexNestedProperties(
+ documentProperty.shouldIndexNestedProperties())
+ .addAllIndexableNestedPropertiesList(
+ documentProperty.getIndexableNestedProperties()));
} else if (property instanceof AppSearchSchema.LongPropertyConfig) {
AppSearchSchema.LongPropertyConfig longProperty =
(AppSearchSchema.LongPropertyConfig) property;
@@ -210,12 +213,18 @@
@NonNull
private static AppSearchSchema.DocumentPropertyConfig toDocumentPropertyConfig(
@NonNull PropertyConfigProto proto) {
- return new AppSearchSchema.DocumentPropertyConfig.Builder(
- proto.getPropertyName(), proto.getSchemaType())
- .setCardinality(proto.getCardinality().getNumber())
- .setShouldIndexNestedProperties(
- proto.getDocumentIndexingConfig().getIndexNestedProperties())
- .build();
+ AppSearchSchema.DocumentPropertyConfig.Builder builder =
+ new AppSearchSchema.DocumentPropertyConfig.Builder(
+ proto.getPropertyName(), proto.getSchemaType())
+ .setCardinality(proto.getCardinality().getNumber())
+ .setShouldIndexNestedProperties(
+ proto.getDocumentIndexingConfig().getIndexNestedProperties());
+ List<String> indexableNestedPropertiesList =
+ proto.getDocumentIndexingConfig().getIndexableNestedPropertiesListList();
+ for (int i = 0; i < indexableNestedPropertiesList.size(); i++) {
+ builder.addIndexableNestedProperties(indexableNestedPropertiesList.get(i));
+ }
+ return builder.build();
}
@NonNull
diff --git a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/FeaturesImpl.java b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/FeaturesImpl.java
index 0d71589..794ed1f 100644
--- a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/FeaturesImpl.java
+++ b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/FeaturesImpl.java
@@ -63,14 +63,17 @@
// Beyond Android U features
case Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA:
- // TODO(b/258715421) : Update to reflect support in Android U+ once this feature is
- // synced over into service-appsearch.
+ // TODO(b/258715421): Update to reflect support in Android U+ once this feature has
+ // an extservices sdk that includes it.
// fall through
case Features.SCHEMA_SET_DELETION_PROPAGATION:
// TODO(b/268521214) : Update when feature is ready in service-appsearch.
// fall through
case Features.SCHEMA_ADD_PARENT_TYPE:
// TODO(b/269295094) : Update when feature is ready in service-appsearch.
+ // fall through
+ case Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES:
+ // TODO(b/289150947) : Update when feature is ready in service-appsearch.
return false;
default:
return false;
diff --git a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/SearchSessionImpl.java b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/SearchSessionImpl.java
index 3525c51..d0514b0 100644
--- a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/SearchSessionImpl.java
+++ b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/SearchSessionImpl.java
@@ -15,6 +15,7 @@
*/
package androidx.appsearch.platformstorage;
+import android.annotation.SuppressLint;
import android.app.appsearch.AppSearchResult;
import android.os.Build;
@@ -215,6 +216,7 @@
return future;
}
+ @SuppressLint("WrongConstant")
@Override
@NonNull
public ListenableFuture<Void> removeAsync(
diff --git a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/AppSearchResultToPlatformConverter.java b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/AppSearchResultToPlatformConverter.java
index 70bb21f..8642bff 100644
--- a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/AppSearchResultToPlatformConverter.java
+++ b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/AppSearchResultToPlatformConverter.java
@@ -71,6 +71,7 @@
* Uses the given {@link android.app.appsearch.AppSearchResult} to populate the given
* {@link ResolvableFuture}, transforming it using {@code valueMapper}.
*/
+ @SuppressLint("WrongConstant")
public static <PlatformType, JetpackType> void platformAppSearchResultToFuture(
@NonNull android.app.appsearch.AppSearchResult<PlatformType> platformResult,
@NonNull ResolvableFuture<JetpackType> future,
diff --git a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SchemaToPlatformConverter.java b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SchemaToPlatformConverter.java
index 5306cc8..098e849 100644
--- a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SchemaToPlatformConverter.java
+++ b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SchemaToPlatformConverter.java
@@ -153,6 +153,13 @@
} else if (jetpackProperty instanceof AppSearchSchema.DocumentPropertyConfig) {
AppSearchSchema.DocumentPropertyConfig documentProperty =
(AppSearchSchema.DocumentPropertyConfig) jetpackProperty;
+ if (!documentProperty.getIndexableNestedProperties().isEmpty()) {
+ // TODO(b/289150947): Update and set list once indexable-nested-properties-list is
+ // available.
+ throw new UnsupportedOperationException(
+ "DocumentPropertyConfig.addIndexableNestedProperties is not supported on "
+ + "this AppSearch implementation.");
+ }
return new android.app.appsearch.AppSearchSchema.DocumentPropertyConfig.Builder(
documentProperty.getName(), documentProperty.getSchemaType())
.setCardinality(documentProperty.getCardinality())
@@ -222,6 +229,8 @@
.setCardinality(documentProperty.getCardinality())
.setShouldIndexNestedProperties(documentProperty.shouldIndexNestedProperties())
.build();
+ // TODO(b/289150947): Add the indexable_nested_properties_list once it becomes
+ // available in platform.
} else {
throw new IllegalArgumentException(
"Invalid property type " + platformProperty.getClass()
diff --git a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SearchSpecToPlatformConverter.java b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SearchSpecToPlatformConverter.java
index a861ec8..4cb82c1 100644
--- a/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SearchSpecToPlatformConverter.java
+++ b/appsearch/appsearch-platform-storage/src/main/java/androidx/appsearch/platformstorage/converter/SearchSpecToPlatformConverter.java
@@ -77,8 +77,8 @@
.setSnippetCountPerProperty(jetpackSearchSpec.getSnippetCountPerProperty())
.setMaxSnippetSize(jetpackSearchSpec.getMaxSnippetSize());
if (jetpackSearchSpec.getResultGroupingTypeFlags() != 0) {
- // TODO(b/258715421): Add Build.VERSION.SDK_INT condition once
- // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is supported on Android U.
+ // TODO(b/258715421): Add Build.VERSION.SDK_INT condition once there is an extservices
+ // sdk that includes SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA.
if (true) {
if ((jetpackSearchSpec.getResultGroupingTypeFlags()
& SearchSpec.GROUPING_TYPE_PER_SCHEMA) != 0) {
diff --git a/appsearch/appsearch/api/current.txt b/appsearch/appsearch/api/current.txt
index 8d2e61c..77b9381 100644
--- a/appsearch/appsearch/api/current.txt
+++ b/appsearch/appsearch/api/current.txt
@@ -11,6 +11,9 @@
method public abstract boolean required() default false;
}
+ @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) public static @interface Document.BuilderProducer {
+ }
+
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.BytesProperty {
method public abstract String name() default "";
method public abstract boolean required() default false;
@@ -28,6 +31,12 @@
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.DoubleProperty {
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.DoubleProperty.DefaultSerializer.class;
+ }
+
+ public static final class Document.DoubleProperty.DefaultSerializer {
+ method public static double deserialize(double);
+ method public static double serialize(double);
}
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.Id {
@@ -37,6 +46,12 @@
method public abstract int indexingType() default androidx.appsearch.app.AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE;
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.LongProperty.DefaultSerializer.class;
+ }
+
+ public static final class Document.LongProperty.DefaultSerializer {
+ method public static long deserialize(long);
+ method public static long serialize(long);
}
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.Namespace {
@@ -50,9 +65,15 @@
method public abstract int joinableValueType() default androidx.appsearch.app.AppSearchSchema.StringPropertyConfig.JOINABLE_VALUE_TYPE_NONE;
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.StringProperty.DefaultSerializer.class;
method public abstract int tokenizerType() default androidx.appsearch.app.AppSearchSchema.StringPropertyConfig.TOKENIZER_TYPE_PLAIN;
}
+ public static final class Document.StringProperty.DefaultSerializer {
+ method public static String deserialize(String);
+ method public static String serialize(String);
+ }
+
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.TtlMillis {
}
@@ -126,12 +147,17 @@
}
public static final class AppSearchSchema.DocumentPropertyConfig extends androidx.appsearch.app.AppSearchSchema.PropertyConfig {
+ method public java.util.List<java.lang.String!> getIndexableNestedProperties();
method public String getSchemaType();
method public boolean shouldIndexNestedProperties();
}
public static final class AppSearchSchema.DocumentPropertyConfig.Builder {
ctor public AppSearchSchema.DocumentPropertyConfig.Builder(String, String);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties(java.lang.String!...);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties(java.util.Collection<java.lang.String!>);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(androidx.appsearch.app.PropertyPath!...);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(java.util.Collection<androidx.appsearch.app.PropertyPath!>);
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig build();
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder setCardinality(int);
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder setShouldIndexNestedProperties(boolean);
@@ -227,6 +253,7 @@
field public static final String JOIN_SPEC_AND_QUALIFIED_ID = "JOIN_SPEC_AND_QUALIFIED_ID";
field public static final String LIST_FILTER_QUERY_LANGUAGE = "LIST_FILTER_QUERY_LANGUAGE";
field public static final String NUMERIC_SEARCH = "NUMERIC_SEARCH";
+ field public static final String SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES = "SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES";
field public static final String SCHEMA_ADD_PARENT_TYPE = "SCHEMA_ADD_PARENT_TYPE";
field public static final String SCHEMA_SET_DELETION_PROPAGATION = "SCHEMA_SET_DELETION_PROPAGATION";
field public static final String SEARCH_RESULT_MATCH_INFO_SUBMATCH = "SEARCH_RESULT_MATCH_INFO_SUBMATCH";
@@ -234,6 +261,7 @@
field public static final String SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA = "SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA";
field public static final String SEARCH_SPEC_PROPERTY_WEIGHTS = "SEARCH_SPEC_PROPERTY_WEIGHTS";
field public static final String SEARCH_SUGGESTION = "SEARCH_SUGGESTION";
+ field public static final String SET_SCHEMA_CIRCULAR_REFERENCES = "SET_SCHEMA_CIRCULAR_REFERENCES";
field public static final String TOKENIZER_TYPE_RFC822 = "TOKENIZER_TYPE_RFC822";
field public static final String VERBATIM_SEARCH = "VERBATIM_SEARCH";
}
diff --git a/appsearch/appsearch/api/restricted_current.txt b/appsearch/appsearch/api/restricted_current.txt
index 8d2e61c..77b9381 100644
--- a/appsearch/appsearch/api/restricted_current.txt
+++ b/appsearch/appsearch/api/restricted_current.txt
@@ -11,6 +11,9 @@
method public abstract boolean required() default false;
}
+ @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) public static @interface Document.BuilderProducer {
+ }
+
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.BytesProperty {
method public abstract String name() default "";
method public abstract boolean required() default false;
@@ -28,6 +31,12 @@
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.DoubleProperty {
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.DoubleProperty.DefaultSerializer.class;
+ }
+
+ public static final class Document.DoubleProperty.DefaultSerializer {
+ method public static double deserialize(double);
+ method public static double serialize(double);
}
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.Id {
@@ -37,6 +46,12 @@
method public abstract int indexingType() default androidx.appsearch.app.AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE;
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.LongProperty.DefaultSerializer.class;
+ }
+
+ public static final class Document.LongProperty.DefaultSerializer {
+ method public static long deserialize(long);
+ method public static long serialize(long);
}
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.Namespace {
@@ -50,9 +65,15 @@
method public abstract int joinableValueType() default androidx.appsearch.app.AppSearchSchema.StringPropertyConfig.JOINABLE_VALUE_TYPE_NONE;
method public abstract String name() default "";
method public abstract boolean required() default false;
+ method public abstract Class<?> serializer() default androidx.appsearch.annotation.Document.StringProperty.DefaultSerializer.class;
method public abstract int tokenizerType() default androidx.appsearch.app.AppSearchSchema.StringPropertyConfig.TOKENIZER_TYPE_PLAIN;
}
+ public static final class Document.StringProperty.DefaultSerializer {
+ method public static String deserialize(String);
+ method public static String serialize(String);
+ }
+
@java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface Document.TtlMillis {
}
@@ -126,12 +147,17 @@
}
public static final class AppSearchSchema.DocumentPropertyConfig extends androidx.appsearch.app.AppSearchSchema.PropertyConfig {
+ method public java.util.List<java.lang.String!> getIndexableNestedProperties();
method public String getSchemaType();
method public boolean shouldIndexNestedProperties();
}
public static final class AppSearchSchema.DocumentPropertyConfig.Builder {
ctor public AppSearchSchema.DocumentPropertyConfig.Builder(String, String);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties(java.lang.String!...);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties(java.util.Collection<java.lang.String!>);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(androidx.appsearch.app.PropertyPath!...);
+ method @RequiresFeature(enforcement="androidx.appsearch.app.Features#isFeatureSupported", name=androidx.appsearch.app.Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES) public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(java.util.Collection<androidx.appsearch.app.PropertyPath!>);
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig build();
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder setCardinality(int);
method public androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig.Builder setShouldIndexNestedProperties(boolean);
@@ -227,6 +253,7 @@
field public static final String JOIN_SPEC_AND_QUALIFIED_ID = "JOIN_SPEC_AND_QUALIFIED_ID";
field public static final String LIST_FILTER_QUERY_LANGUAGE = "LIST_FILTER_QUERY_LANGUAGE";
field public static final String NUMERIC_SEARCH = "NUMERIC_SEARCH";
+ field public static final String SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES = "SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES";
field public static final String SCHEMA_ADD_PARENT_TYPE = "SCHEMA_ADD_PARENT_TYPE";
field public static final String SCHEMA_SET_DELETION_PROPAGATION = "SCHEMA_SET_DELETION_PROPAGATION";
field public static final String SEARCH_RESULT_MATCH_INFO_SUBMATCH = "SEARCH_RESULT_MATCH_INFO_SUBMATCH";
@@ -234,6 +261,7 @@
field public static final String SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA = "SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA";
field public static final String SEARCH_SPEC_PROPERTY_WEIGHTS = "SEARCH_SPEC_PROPERTY_WEIGHTS";
field public static final String SEARCH_SUGGESTION = "SEARCH_SUGGESTION";
+ field public static final String SET_SCHEMA_CIRCULAR_REFERENCES = "SET_SCHEMA_CIRCULAR_REFERENCES";
field public static final String TOKENIZER_TYPE_RFC822 = "TOKENIZER_TYPE_RFC822";
field public static final String VERBATIM_SEARCH = "VERBATIM_SEARCH";
}
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AnnotationProcessorTestBase.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AnnotationProcessorTestBase.java
index 83d9dcea..fb0160f 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AnnotationProcessorTestBase.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AnnotationProcessorTestBase.java
@@ -946,9 +946,41 @@
@Document.StringProperty
String getOrganizationDescription();
- static Organization createOrganization(String id, String namespace, long creationTimestamp,
- String organizationDescription) {
- return new OrganizationImpl(id, namespace, creationTimestamp, organizationDescription);
+ @Document.BuilderProducer
+ static OrganizationBuilder getBuilder() {
+ return new OrganizationBuilder();
+ }
+ }
+
+ static class OrganizationBuilder {
+ String mId;
+ String mNamespace;
+ long mCreationTimestamp;
+ String mOrganizationDescription;
+
+ public Organization build() {
+ return new OrganizationImpl(mId, mNamespace, mCreationTimestamp,
+ mOrganizationDescription);
+ }
+
+ public OrganizationBuilder setId(String id) {
+ mId = id;
+ return this;
+ }
+
+ public OrganizationBuilder setNamespace(String namespace) {
+ mNamespace = namespace;
+ return this;
+ }
+
+ public OrganizationBuilder setCreationTimestamp(long creationTimestamp) {
+ mCreationTimestamp = creationTimestamp;
+ return this;
+ }
+
+ public OrganizationBuilder setOrganizationDescription(String organizationDescription) {
+ mOrganizationDescription = organizationDescription;
+ return this;
}
}
@@ -1072,6 +1104,33 @@
}
@Test
+ public void testGenericDocumentConversion_AnnotatedBuilder() throws Exception {
+ // Create Organization document
+ Organization organization = Organization.getBuilder()
+ .setId("id")
+ .setNamespace("namespace")
+ .setCreationTimestamp(3000)
+ .setOrganizationDescription("organization_dec")
+ .build();
+
+ // Test the conversion from Organization to GenericDocument
+ GenericDocument genericDocument = GenericDocument.fromDocumentClass(organization);
+ assertThat(genericDocument.getId()).isEqualTo("id");
+ assertThat(genericDocument.getNamespace()).isEqualTo("namespace");
+ assertThat(genericDocument.getCreationTimestampMillis()).isEqualTo(3000);
+ assertThat(genericDocument.getSchemaType()).isEqualTo("Organization");
+ assertThat(genericDocument.getPropertyString("organizationDescription")).isEqualTo(
+ "organization_dec");
+
+ // Test the conversion from GenericDocument to Organization
+ Organization newOrganization = genericDocument.toDocumentClass(Organization.class);
+ assertThat(newOrganization.getId()).isEqualTo("id");
+ assertThat(newOrganization.getNamespace()).isEqualTo("namespace");
+ assertThat(newOrganization.getCreationTimestamp()).isEqualTo(3000);
+ assertThat(newOrganization.getOrganizationDescription()).isEqualTo("organization_dec");
+ }
+
+ @Test
public void testPolymorphismForInterface() throws Exception {
assumeTrue(mSession.getFeatures().isFeatureSupported(Features.SCHEMA_ADD_PARENT_TYPE));
@@ -1098,8 +1157,12 @@
assertThat(placeGeneric.getSchemaType()).isEqualTo("Place");
assertThat(placeGeneric.getPropertyString("location")).isEqualTo("place_loc");
- Organization organization = Organization.createOrganization("id2", "namespace", 3000,
- "organization_dec");
+ Organization organization = Organization.getBuilder()
+ .setId("id2")
+ .setNamespace("namespace")
+ .setCreationTimestamp(3000)
+ .setOrganizationDescription("organization_dec")
+ .build();
GenericDocument organizationGeneric = GenericDocument.fromDocumentClass(organization);
assertThat(organizationGeneric.getId()).isEqualTo("id2");
assertThat(organizationGeneric.getNamespace()).isEqualTo("namespace");
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchSessionInternalTestBase.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchSessionInternalTestBase.java
index c289e9e..b86fc5d 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchSessionInternalTestBase.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchSessionInternalTestBase.java
@@ -17,7 +17,6 @@
package androidx.appsearch.app;
import static androidx.appsearch.testutil.AppSearchTestUtils.checkIsBatchResultSuccess;
-import static androidx.appsearch.testutil.AppSearchTestUtils.convertSearchResultsToDocuments;
import static com.google.common.truth.Truth.assertThat;
@@ -28,7 +27,6 @@
import androidx.annotation.NonNull;
import androidx.appsearch.app.AppSearchSchema.PropertyConfig;
import androidx.appsearch.app.AppSearchSchema.StringPropertyConfig;
-import androidx.appsearch.testutil.AppSearchEmail;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture;
@@ -175,332 +173,6 @@
assertThat(suggestions).containsExactly(resultOne, resultThree, resultFour);
}
- // TODO(b/258715421): move this test to cts test once we un-hide schema type grouping API.
- @Test
- public void testQuery_ResultGroupingLimits_SchemaGroupingSupported() throws Exception {
- assumeTrue(mDb1.getFeatures()
- .isFeatureSupported(Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA));
- // Schema registration
- AppSearchSchema genericSchema = new AppSearchSchema.Builder("Generic")
- .addProperty(new StringPropertyConfig.Builder("foo")
- .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
- .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
- .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
- .build()
- ).build();
- mDb1.setSchemaAsync(new SetSchemaRequest.Builder()
- .addSchemas(AppSearchEmail.SCHEMA)
- .addSchemas(genericSchema)
- .build())
- .get();
-
- // Index four documents.
- AppSearchEmail inEmail1 =
- new AppSearchEmail.Builder("namespace1", "id1")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail1).build()));
- AppSearchEmail inEmail2 =
- new AppSearchEmail.Builder("namespace1", "id2")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail2).build()));
- AppSearchEmail inEmail3 =
- new AppSearchEmail.Builder("namespace2", "id3")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail3).build()));
- AppSearchEmail inEmail4 =
- new AppSearchEmail.Builder("namespace2", "id4")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail4).build()));
- AppSearchEmail inEmail5 =
- new AppSearchEmail.Builder("namespace2", "id5")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail5).build()));
- GenericDocument inDoc1 =
- new GenericDocument.Builder<>("namespace3", "id6", "Generic")
- .setPropertyString("foo", "body").build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inDoc1).build()));
- GenericDocument inDoc2 =
- new GenericDocument.Builder<>("namespace3", "id7", "Generic")
- .setPropertyString("foo", "body").build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inDoc2).build()));
- GenericDocument inDoc3 =
- new GenericDocument.Builder<>("namespace4", "id8", "Generic")
- .setPropertyString("foo", "body").build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inDoc3).build()));
-
- // Query with per package result grouping. Only the last document 'doc3' should be
- // returned.
- SearchResults searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
- .build());
- List<GenericDocument> documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3);
-
- // Query with per namespace result grouping. Only the last document in each namespace should
- // be returned ('doc3', 'doc2', 'email5' and 'email2').
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
-
- // Query with per namespace result grouping. Two of the last documents in each namespace
- // should be returned ('doc3', 'doc2', 'doc1', 'email5', 'email4', 'email2', 'email1')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
- inEmail1);
-
- // Query with per schema result grouping. Only the last document of each schema type should
- // be returned ('doc3', 'email5')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inEmail5);
-
- // Query with per schema result grouping. Only the last two documents of each schema type
- // should be returned ('doc3', 'doc2', 'email5', 'email4')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail4);
-
- // Query with per package and per namespace result grouping. Only the last document in each
- // namespace should be returned ('doc3', 'doc2', 'email5' and 'email2').
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
-
- // Query with per package and per namespace result grouping. Only the last two documents
- // in each namespace should be returned ('doc3', 'doc2', 'doc1', 'email5', 'email4',
- // 'email2', 'email1')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
- inEmail1);
-
- // Query with per package and per schema type result grouping. Only the last document in
- // each schema type should be returned. ('doc3', 'email5')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_SCHEMA
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inEmail5);
-
- // Query with per package and per schema type result grouping. Only the last two document in
- // each schema type should be returned. ('doc3', 'doc2', 'email5', 'email4')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_SCHEMA
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail4);
-
- // Query with per namespace and per schema type result grouping. Only the last document in
- // each namespace should be returned. ('doc3', 'doc2', 'email5' and 'email2').
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
-
- // Query with per namespace and per schema type result grouping. Only the last two documents
- // in each namespace should be returned. ('doc3', 'doc2', 'doc1', 'email5', 'email4',
- // 'email2', 'email1')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
- inEmail1);
-
- // Query with per namespace, per package and per schema type result grouping. Only the last
- // document in each namespace should be returned. ('doc3', 'doc2', 'email5' and 'email2')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE | SearchSpec.GROUPING_TYPE_PER_SCHEMA
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
-
- // Query with per namespace, per package and per schema type result grouping. Only the last
- // two documents in each namespace should be returned.('doc3', 'doc2', 'doc1', 'email5',
- // 'email4', 'email2', 'email1')
- searchResults = mDb1.search("body", new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(
- SearchSpec.GROUPING_TYPE_PER_NAMESPACE | SearchSpec.GROUPING_TYPE_PER_SCHEMA
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
- .build());
- documents = convertSearchResultsToDocuments(searchResults);
- assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
- inEmail1);
- }
-
- // TODO(b/258715421): move this test to cts test once we un-hide schema type grouping API.
- @Test
- public void testQuery_ResultGroupingLimits_SchemaGroupingNotSupported() throws Exception {
- assumeFalse(mDb1.getFeatures()
- .isFeatureSupported(Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA));
- // Schema registration
- mDb1.setSchemaAsync(new SetSchemaRequest.Builder()
- .addSchemas(AppSearchEmail.SCHEMA).build()).get();
-
- // Index four documents.
- AppSearchEmail inEmail1 =
- new AppSearchEmail.Builder("namespace1", "id1")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail1).build()));
- AppSearchEmail inEmail2 =
- new AppSearchEmail.Builder("namespace1", "id2")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail2).build()));
- AppSearchEmail inEmail3 =
- new AppSearchEmail.Builder("namespace2", "id3")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail3).build()));
- AppSearchEmail inEmail4 =
- new AppSearchEmail.Builder("namespace2", "id4")
- .setFrom("from@example.com")
- .setTo("to1@example.com", "to2@example.com")
- .setSubject("testPut example")
- .setBody("This is the body of the testPut email")
- .build();
- checkIsBatchResultSuccess(mDb1.putAsync(
- new PutDocumentsRequest.Builder().addGenericDocuments(inEmail4).build()));
-
- // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
- // UnsupportedOperationException will be thrown.
- SearchSpec searchSpec1 = new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
- .build();
- UnsupportedOperationException exception = assertThrows(UnsupportedOperationException.class,
- () -> mDb1.search("body", searchSpec1));
- assertThat(exception).hasMessageThat().contains(
- Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
- + " AppSearch implementation.");
-
- // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
- // UnsupportedOperationException will be thrown.
- SearchSpec searchSpec2 = new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_PACKAGE
- | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
- .build();
- exception = assertThrows(UnsupportedOperationException.class,
- () -> mDb1.search("body", searchSpec2));
- assertThat(exception).hasMessageThat().contains(
- Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
- + " AppSearch implementation.");
-
- // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
- // UnsupportedOperationException will be thrown.
- SearchSpec searchSpec3 = new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
- .build();
- exception = assertThrows(UnsupportedOperationException.class,
- () -> mDb1.search("body", searchSpec3));
- assertThat(exception).hasMessageThat().contains(
- Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
- + " AppSearch implementation.");
-
- // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
- // UnsupportedOperationException will be thrown.
- SearchSpec searchSpec4 = new SearchSpec.Builder()
- .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
- .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE
- | SearchSpec.GROUPING_TYPE_PER_SCHEMA
- | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
- .build();
- exception = assertThrows(UnsupportedOperationException.class,
- () -> mDb1.search("body", searchSpec4));
- assertThat(exception).hasMessageThat().contains(
- Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
- + " AppSearch implementation.");
- }
-
// TODO(b/268521214): Move test to cts once deletion propagation is available in framework.
@Test
public void testGetSchema_joinableValueType() throws Exception {
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSchemaCtsTest.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSchemaCtsTest.java
index f31e56b..76d7cdb 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSchemaCtsTest.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSchemaCtsTest.java
@@ -22,9 +22,11 @@
import static org.junit.Assert.assertThrows;
import androidx.appsearch.app.AppSearchSchema;
+import androidx.appsearch.app.AppSearchSchema.DocumentPropertyConfig;
import androidx.appsearch.app.AppSearchSchema.LongPropertyConfig;
import androidx.appsearch.app.AppSearchSchema.PropertyConfig;
import androidx.appsearch.app.AppSearchSchema.StringPropertyConfig;
+import androidx.appsearch.app.PropertyPath;
import androidx.appsearch.testutil.AppSearchEmail;
import org.junit.Test;
@@ -190,10 +192,16 @@
.setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
.build())
.addProperty(new AppSearchSchema.DocumentPropertyConfig.Builder(
- "document", AppSearchEmail.SCHEMA_TYPE)
+ "document1", AppSearchEmail.SCHEMA_TYPE)
.setCardinality(PropertyConfig.CARDINALITY_REPEATED)
.setShouldIndexNestedProperties(true)
.build())
+ .addProperty(new AppSearchSchema.DocumentPropertyConfig.Builder(
+ "document2", AppSearchEmail.SCHEMA_TYPE)
+ .setCardinality(PropertyConfig.CARDINALITY_REPEATED)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("path1", "path2", "path3")
+ .build())
.addProperty(new AppSearchSchema.StringPropertyConfig.Builder("qualifiedId1")
.setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
.setJoinableValueType(StringPropertyConfig.JOINABLE_VALUE_TYPE_QUALIFIED_ID)
@@ -206,7 +214,7 @@
assertThat(schema.getSchemaType()).isEqualTo("Test");
List<PropertyConfig> properties = schema.getProperties();
- assertThat(properties).hasSize(9);
+ assertThat(properties).hasSize(10);
assertThat(properties.get(0).getName()).isEqualTo("string");
assertThat(properties.get(0).getCardinality())
@@ -243,7 +251,7 @@
.isEqualTo(PropertyConfig.CARDINALITY_OPTIONAL);
assertThat(properties.get(5)).isInstanceOf(AppSearchSchema.BytesPropertyConfig.class);
- assertThat(properties.get(6).getName()).isEqualTo("document");
+ assertThat(properties.get(6).getName()).isEqualTo("document1");
assertThat(properties.get(6).getCardinality())
.isEqualTo(PropertyConfig.CARDINALITY_REPEATED);
assertThat(((AppSearchSchema.DocumentPropertyConfig) properties.get(6)).getSchemaType())
@@ -251,16 +259,26 @@
assertThat(((AppSearchSchema.DocumentPropertyConfig) properties.get(6))
.shouldIndexNestedProperties()).isEqualTo(true);
- assertThat(properties.get(7).getName()).isEqualTo("qualifiedId1");
+ assertThat(properties.get(7).getName()).isEqualTo("document2");
assertThat(properties.get(7).getCardinality())
+ .isEqualTo(PropertyConfig.CARDINALITY_REPEATED);
+ assertThat(((AppSearchSchema.DocumentPropertyConfig) properties.get(7)).getSchemaType())
+ .isEqualTo(AppSearchEmail.SCHEMA_TYPE);
+ assertThat(((AppSearchSchema.DocumentPropertyConfig) properties.get(7))
+ .shouldIndexNestedProperties()).isEqualTo(false);
+ assertThat(((AppSearchSchema.DocumentPropertyConfig) properties.get(7))
+ .getIndexableNestedProperties()).containsExactly("path1", "path2", "path3");
+
+ assertThat(properties.get(8).getName()).isEqualTo("qualifiedId1");
+ assertThat(properties.get(8).getCardinality())
.isEqualTo(PropertyConfig.CARDINALITY_OPTIONAL);
- assertThat(((StringPropertyConfig) properties.get(7)).getJoinableValueType())
+ assertThat(((StringPropertyConfig) properties.get(8)).getJoinableValueType())
.isEqualTo(StringPropertyConfig.JOINABLE_VALUE_TYPE_QUALIFIED_ID);
- assertThat(properties.get(8).getName()).isEqualTo("qualifiedId2");
- assertThat(properties.get(8).getCardinality())
+ assertThat(properties.get(9).getName()).isEqualTo("qualifiedId2");
+ assertThat(properties.get(9).getCardinality())
.isEqualTo(PropertyConfig.CARDINALITY_REQUIRED);
- assertThat(((StringPropertyConfig) properties.get(8)).getJoinableValueType())
+ assertThat(((StringPropertyConfig) properties.get(9)).getJoinableValueType())
.isEqualTo(StringPropertyConfig.JOINABLE_VALUE_TYPE_QUALIFIED_ID);
}
@@ -284,6 +302,61 @@
}
@Test
+ public void testDocumentPropertyConfig_indexableNestedPropertyStrings() {
+ DocumentPropertyConfig documentPropertyConfig =
+ new DocumentPropertyConfig.Builder("property", "Schema")
+ .addIndexableNestedProperties("prop1", "prop2", "prop1.prop2")
+ .build();
+ assertThat(documentPropertyConfig.getIndexableNestedProperties())
+ .containsExactly("prop1", "prop2", "prop1.prop2");
+ }
+
+ @Test
+ public void testDocumentPropertyConfig_indexableNestedPropertyPropertyPaths() {
+ DocumentPropertyConfig documentPropertyConfig =
+ new DocumentPropertyConfig.Builder("property", "Schema")
+ .addIndexableNestedPropertyPaths(new PropertyPath("prop1"),
+ new PropertyPath("prop1.prop2"))
+ .build();
+ assertThat(documentPropertyConfig.getIndexableNestedProperties())
+ .containsExactly("prop1", "prop1.prop2");
+ }
+
+ @Test
+ public void testDocumentPropertyConfig_indexableNestedPropertyProperty_duplicatePaths() {
+ DocumentPropertyConfig documentPropertyConfig =
+ new DocumentPropertyConfig.Builder("property", "Schema")
+ .addIndexableNestedPropertyPaths(new PropertyPath("prop1"),
+ new PropertyPath("prop1.prop2"))
+ .addIndexableNestedProperties("prop1")
+ .build();
+ assertThat(documentPropertyConfig.getIndexableNestedProperties())
+ .containsExactly("prop1", "prop1.prop2");
+ }
+
+ @Test
+ public void testDocumentPropertyConfig_reusingBuilderDoesNotAffectPreviouslyBuiltConfigs() {
+ DocumentPropertyConfig.Builder builder =
+ new DocumentPropertyConfig.Builder("property", "Schema")
+ .addIndexableNestedProperties("prop1");
+ DocumentPropertyConfig config1 = builder.build();
+ assertThat(config1.getIndexableNestedProperties()).containsExactly("prop1");
+
+ builder.addIndexableNestedProperties("prop2");
+ DocumentPropertyConfig config2 = builder.build();
+ assertThat(config2.getIndexableNestedProperties()).containsExactly("prop1", "prop2");
+ assertThat(config1.getIndexableNestedProperties()).containsExactly("prop1");
+
+ builder.addIndexableNestedPropertyPaths(new PropertyPath("prop3"));
+ DocumentPropertyConfig config3 = builder.build();
+ assertThat(config3.getIndexableNestedProperties()).containsExactly("prop1", "prop2",
+ "prop3");
+ assertThat(config2.getIndexableNestedProperties()).containsExactly("prop1", "prop2");
+ assertThat(config1.getIndexableNestedProperties()).containsExactly("prop1");
+ }
+
+
+ @Test
public void testInvalidStringPropertyConfigsTokenizerNone() {
// Everything should work fine with the defaults.
final StringPropertyConfig.Builder builder =
@@ -369,6 +442,26 @@
}
@Test
+ public void testInvalidDocumentPropertyConfig_indexableNestedProperties() {
+ // Adding indexableNestedProperties with shouldIndexNestedProperties=true should fail.
+ DocumentPropertyConfig.Builder builder =
+ new DocumentPropertyConfig.Builder("prop1", "Schema1")
+ .setShouldIndexNestedProperties(true)
+ .addIndexableNestedProperties("prop1");
+ IllegalArgumentException e =
+ assertThrows(IllegalArgumentException.class, () -> builder.build());
+ assertThat(e).hasMessageThat().contains(
+ "DocumentIndexingConfig#shouldIndexNestedProperties is required to be false when "
+ + "one or more indexableNestedProperties are provided.");
+
+ builder.addIndexableNestedPropertyPaths(new PropertyPath("prop1.prop2"));
+ e = assertThrows(IllegalArgumentException.class, () -> builder.build());
+ assertThat(e).hasMessageThat().contains(
+ "DocumentIndexingConfig#shouldIndexNestedProperties is required to be false when "
+ + "one or more indexableNestedProperties are provided.");
+ }
+
+ @Test
public void testAppSearchSchema_toString() {
AppSearchSchema schema = new AppSearchSchema.Builder("testSchema")
.addProperty(new StringPropertyConfig.Builder("string1")
@@ -446,6 +539,7 @@
+ " {\n"
+ " name: \"document\",\n"
+ " shouldIndexNestedProperties: true,\n"
+ + " indexableNestedProperties: [],\n"
+ " schemaType: \"builtin:Email\",\n"
+ " cardinality: CARDINALITY_REPEATED,\n"
+ " dataType: DATA_TYPE_DOCUMENT,\n"
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionCtsTestBase.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionCtsTestBase.java
index be2b72c..2d0c1af 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionCtsTestBase.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionCtsTestBase.java
@@ -343,6 +343,521 @@
assertThat(exception).hasMessageThat().containsMatch("Invalid cycle|Infinite loop");
}
+ @Test
+ public void testSetSchema_indexableNestedPropsList() throws Exception {
+ assumeTrue(mDb1.getFeatures().isFeatureSupported(
+ Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES));
+
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("worksFor", "Organization")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name")
+ .build())
+ .build();
+ AppSearchSchema organizationSchema = new AppSearchSchema.Builder("Organization")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_REQUIRED)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("notes")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .build();
+
+ mDb1.setSchemaAsync(
+ new SetSchemaRequest.Builder().addSchemas(personSchema, organizationSchema)
+ .build()).get();
+
+ // Test that properties in Person's indexable_nested_properties_list are indexed and
+ // searchable
+ GenericDocument org1 = new GenericDocument.Builder<>("namespace", "org1", "Organization")
+ .setPropertyString("name", "Org1")
+ .setPropertyString("notes", "Some notes")
+ .build();
+ GenericDocument person1 = new GenericDocument.Builder<>("namespace", "person1", "Person")
+ .setPropertyString("name", "Jane")
+ .setPropertyDocument("worksFor", org1)
+ .build();
+
+ AppSearchBatchResult<String, Void> putResult =
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder()
+ .addGenericDocuments(person1, org1)
+ .build()));
+ assertThat(putResult.getSuccesses()).containsExactly("person1", null, "org1", null);
+ assertThat(putResult.getFailures()).isEmpty();
+
+ GetByDocumentIdRequest getByDocumentIdRequest =
+ new GetByDocumentIdRequest.Builder("namespace")
+ .addIds("person1", "org1")
+ .build();
+ List<GenericDocument> outDocuments = doGet(mDb1, getByDocumentIdRequest);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person1, org1);
+
+ // Both org1 and person should be returned for query "Org1"
+ // For org1 this matches the 'name' property and for person1 this matches the
+ // 'worksFor.name' property.
+ SearchResults searchResults = mDb1.search("Org1", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person1, org1);
+
+ // Only org1 should be returned for query "notes", since 'worksFor.notes' is not indexed
+ // for the Person-type.
+ searchResults = mDb1.search("notes", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(1);
+ assertThat(outDocuments).containsExactly(org1);
+ }
+
+ @Test
+ public void testSetSchema_indexableNestedPropsList_notSupported() throws Exception {
+ assumeFalse(mDb1.getFeatures().isFeatureSupported(
+ Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES));
+
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("worksFor", "Organization")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name")
+ .build())
+ .build();
+ AppSearchSchema organizationSchema = new AppSearchSchema.Builder("Organization")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_REQUIRED)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("notes")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .build();
+
+ SetSchemaRequest setSchemaRequest = new SetSchemaRequest.Builder()
+ .addSchemas(personSchema, organizationSchema)
+ .build();
+ UnsupportedOperationException e = assertThrows(UnsupportedOperationException.class, () ->
+ mDb1.setSchemaAsync(setSchemaRequest).get());
+ assertThat(e).hasMessageThat().contains(
+ "DocumentPropertyConfig.addIndexableNestedProperties is not supported on this "
+ + "AppSearch implementation.");
+ }
+
+ @Test
+ public void testSetSchema_indexableNestedPropsList_nonIndexableProp() throws Exception {
+ assumeTrue(mDb1.getFeatures().isFeatureSupported(
+ Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES));
+
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("worksFor", "Organization")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name")
+ .build())
+ .build();
+ AppSearchSchema organizationSchema = new AppSearchSchema.Builder("Organization")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_REQUIRED)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("notes")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_NONE)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_NONE)
+ .build())
+ .build();
+
+ mDb1.setSchemaAsync(
+ new SetSchemaRequest.Builder().addSchemas(personSchema, organizationSchema)
+ .build()).get();
+
+ // Test that Person's nested properties are indexed correctly.
+ GenericDocument org1 = new GenericDocument.Builder<>("namespace", "org1", "Organization")
+ .setPropertyString("name", "Org1")
+ .setPropertyString("notes", "Some notes")
+ .build();
+ GenericDocument person1 = new GenericDocument.Builder<>("namespace", "person1", "Person")
+ .setPropertyString("name", "Jane")
+ .setPropertyDocument("worksFor", org1)
+ .build();
+
+ AppSearchBatchResult<String, Void> putResult =
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder()
+ .addGenericDocuments(person1, org1)
+ .build()));
+ assertThat(putResult.getSuccesses()).containsExactly("person1", null, "org1", null);
+ assertThat(putResult.getFailures()).isEmpty();
+
+ GetByDocumentIdRequest getByDocumentIdRequest =
+ new GetByDocumentIdRequest.Builder("namespace")
+ .addIds("person1", "org1")
+ .build();
+ List<GenericDocument> outDocuments = doGet(mDb1, getByDocumentIdRequest);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person1, org1);
+
+ // Both org1 and person should be returned for query "Org1"
+ // For org1 this matches the 'name' property and for person1 this matches the
+ // 'worksFor.name' property.
+ SearchResults searchResults = mDb1.search("Org1", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person1, org1);
+
+ // No documents should match for "notes", since both 'Organization:notes'
+ // and 'Person:worksFor.notes' are non-indexable.
+ searchResults = mDb1.search("notes", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(0);
+ }
+
+ @Test
+ public void testSetSchema_indexableNestedPropsList_multipleNestedLevels() throws Exception {
+ assumeTrue(mDb1.getFeatures().isFeatureSupported(
+ Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES));
+
+ AppSearchSchema emailSchema = new AppSearchSchema.Builder("Email")
+ .addProperty(new StringPropertyConfig.Builder("subject")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("sender", "Person")
+ .setCardinality(PropertyConfig.CARDINALITY_REPEATED)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name", "worksFor.name", "worksFor.notes")
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("recipient", "Person")
+ .setCardinality(PropertyConfig.CARDINALITY_REPEATED)
+ .setShouldIndexNestedProperties(true)
+ .build())
+ .build();
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("age")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("worksFor", "Organization")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name", "id")
+ .build())
+ .build();
+ AppSearchSchema organizationSchema = new AppSearchSchema.Builder("Organization")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_REQUIRED)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("notes")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("id")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .build();
+
+ mDb1.setSchemaAsync(
+ new SetSchemaRequest.Builder()
+ .addSchemas(emailSchema, personSchema, organizationSchema)
+ .build()).get();
+
+ // Test that Email and Person's nested properties are indexed correctly.
+ GenericDocument org1 = new GenericDocument.Builder<>("namespace", "org1", "Organization")
+ .setPropertyString("name", "Org1")
+ .setPropertyString("notes", "Some notes")
+ .setPropertyString("id", "1234")
+ .build();
+ GenericDocument person1 = new GenericDocument.Builder<>("namespace", "person1", "Person")
+ .setPropertyString("name", "Jane")
+ .setPropertyString("age", "20")
+ .setPropertyDocument("worksFor", org1)
+ .build();
+ GenericDocument person2 = new GenericDocument.Builder<>("namespace", "person2", "Person")
+ .setPropertyString("name", "John")
+ .setPropertyString("age", "30")
+ .setPropertyDocument("worksFor", org1)
+ .build();
+ GenericDocument email1 = new GenericDocument.Builder<>("namespace", "email1", "Email")
+ .setPropertyString("subject", "Greetings!")
+ .setPropertyDocument("sender", person1)
+ .setPropertyDocument("recipient", person2)
+ .build();
+ AppSearchBatchResult<String, Void> putResult =
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder()
+ .addGenericDocuments(person1, org1, person2, email1)
+ .build()));
+ assertThat(putResult.getSuccesses()).containsExactly("person1", null, "org1", null,
+ "person2", null, "email1", null);
+ assertThat(putResult.getFailures()).isEmpty();
+
+ GetByDocumentIdRequest getByDocumentIdRequest =
+ new GetByDocumentIdRequest.Builder("namespace")
+ .addIds("person1", "org1", "person2", "email1")
+ .build();
+ List<GenericDocument> outDocuments = doGet(mDb1, getByDocumentIdRequest);
+ assertThat(outDocuments).hasSize(4);
+ assertThat(outDocuments).containsExactly(person1, org1, person2, email1);
+
+ // Indexed properties:
+ // Email: 'subject', 'sender.name', 'sender.worksFor.name', 'sender.worksFor.notes',
+ // 'recipient.name', 'recipient.age', 'recipient.worksFor.name',
+ // 'recipient.worksFor.id'
+ // (Email:recipient sets index_nested_props=true, so it follows the same indexing
+ // configs as the next schema-type level (person))
+ // Person: 'name', 'age', 'worksFor.name', 'worksFor.id'
+ // Organization: 'name', 'notes', 'id'
+ //
+ // All documents should be returned for query 'Org1' because all schemaTypes index the
+ // 'Organization:name' property.
+ SearchResults searchResults = mDb1.search("Org1", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(4);
+ assertThat(outDocuments).containsExactly(person1, org1, person2, email1);
+
+ // org1 and email1 should be returned for query 'notes'
+ searchResults = mDb1.search("notes", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(org1, email1);
+
+ // all docs should be returned for query "1234"
+ searchResults = mDb1.search("1234", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(4);
+ assertThat(outDocuments).containsExactly(person1, org1, person2, email1);
+
+ // email1 should be returned for query "30", but not for "20" since sender.age is not
+ // indexed, but recipient.age is.
+ // For query "30", person2 should also be returned
+ // For query "20, person1 should be returned.
+ searchResults = mDb1.search("30", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person2, email1);
+
+ searchResults = mDb1.search("20", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(1);
+ assertThat(outDocuments).containsExactly(person1);
+ }
+
+ @Test
+ public void testSetSchema_indexableNestedPropsList_circularRefs() throws Exception {
+ assumeTrue(mDb1.getFeatures().isFeatureSupported(
+ Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES));
+ assumeTrue(mDb1.getFeatures().isFeatureSupported(Features.SET_SCHEMA_CIRCULAR_REFERENCES));
+
+ // Create schema with valid cycle: Person -> Organization -> Person...
+ AppSearchSchema personSchema = new AppSearchSchema.Builder("Person")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("address")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("worksFor", "Organization")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name", "notes", "funder.name")
+ .build())
+ .build();
+ AppSearchSchema organizationSchema = new AppSearchSchema.Builder("Organization")
+ .addProperty(new StringPropertyConfig.Builder("name")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new StringPropertyConfig.Builder("notes")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_EXACT_TERMS)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .build())
+ .addProperty(new DocumentPropertyConfig.Builder("funder", "Person")
+ .setCardinality(PropertyConfig.CARDINALITY_REPEATED)
+ .setShouldIndexNestedProperties(false)
+ .addIndexableNestedProperties("name", "worksFor.name",
+ "worksFor.funder.address", "worksFor.funder.worksFor.notes")
+ .build())
+ .build();
+ mDb1.setSchemaAsync(
+ new SetSchemaRequest.Builder().addSchemas(personSchema, organizationSchema)
+ .build()).get();
+
+ // Test that documents following the circular schema are indexed correctly, and that its
+ // sections are searchable
+ GenericDocument person1 = new GenericDocument.Builder<>("namespace", "person1", "Person")
+ .setPropertyString("name", "Person1")
+ .setPropertyString("address", "someAddress")
+ .build();
+ GenericDocument org1 = new GenericDocument.Builder<>("namespace", "org1", "Organization")
+ .setPropertyString("name", "Org1")
+ .setPropertyString("notes", "someNote")
+ .setPropertyDocument("funder", person1)
+ .build();
+ GenericDocument person2 = new GenericDocument.Builder<>("namespace", "person2", "Person")
+ .setPropertyString("name", "Person2")
+ .setPropertyString("address", "anotherAddress")
+ .setPropertyDocument("worksFor", org1)
+ .build();
+ GenericDocument org2 = new GenericDocument.Builder<>("namespace", "org2", "Organization")
+ .setPropertyString("name", "Org2")
+ .setPropertyString("notes", "anotherNote")
+ .setPropertyDocument("funder", person2)
+ .build();
+
+ AppSearchBatchResult<String, Void> putResult =
+ checkIsBatchResultSuccess(
+ mDb1.putAsync(new PutDocumentsRequest.Builder()
+ .addGenericDocuments(person1, org1, person2, org2)
+ .build()));
+ assertThat(putResult.getSuccesses()).containsExactly("person1", null, "org1", null,
+ "person2", null, "org2", null);
+ assertThat(putResult.getFailures()).isEmpty();
+
+ GetByDocumentIdRequest getByDocumentIdRequest =
+ new GetByDocumentIdRequest.Builder("namespace")
+ .addIds("person1", "person2", "org1", "org2")
+ .build();
+ List<GenericDocument> outDocuments = doGet(mDb1, getByDocumentIdRequest);
+ assertThat(outDocuments).hasSize(4);
+ assertThat(outDocuments).containsExactly(person1, person2, org1, org2);
+
+ // Indexed properties:
+ // Person: 'name', 'address', 'worksFor.name', 'worksFor.notes', 'worksFor.funder.name'
+ // Organization: 'name', 'notes', 'funder.name', 'funder.worksFor.name',
+ // 'funder.worksFor.funder.address', 'funder.worksFor.funder.worksFor.notes'
+ //
+ // "Person1" should match person1 (name), org1 (funder.name) and person2
+ // (worksFor.funder.name)
+ SearchResults searchResults = mDb1.search("Person1",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(3);
+ assertThat(outDocuments).containsExactly(person1, org1, person2);
+
+ // "someAddress" should match person1 (address) and org2 (funder.worksFor.funder.address)
+ searchResults = mDb1.search("someAddress",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person1, org2);
+
+ // "Org1" should match org1 (name), person2 (worksFor.name) and org2 (funder.worksFor.name)
+ searchResults = mDb1.search("Org1",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(3);
+ assertThat(outDocuments).containsExactly(org1, person2, org2);
+
+ // "someNote" should match org1 (notes) and person2 (worksFor.notes)
+ searchResults = mDb1.search("someNote",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(org1, person2);
+
+ // "Person2" should match person2 (name), org2 (funder.name)
+ searchResults = mDb1.search("Person2",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(2);
+ assertThat(outDocuments).containsExactly(person2, org2);
+
+ // "anotherAddress" should match only person2 (address)
+ searchResults = mDb1.search("anotherAddress",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(1);
+ assertThat(outDocuments).containsExactly(person2);
+
+ // "Org2" and "anotherNote" should both match only org2 (name, notes)
+ searchResults = mDb1.search("Org2",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(1);
+ assertThat(outDocuments).containsExactly(org2);
+
+ searchResults = mDb1.search("anotherNote",
+ new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .build());
+ outDocuments = convertSearchResultsToDocuments(searchResults);
+ assertThat(outDocuments).hasSize(1);
+ assertThat(outDocuments).containsExactly(org2);
+ }
+
// @exportToFramework:startStrip()
@Test
@@ -4297,6 +4812,326 @@
}
@Test
+ public void testQuery_ResultGroupingLimits_SchemaGroupingSupported() throws Exception {
+ assumeTrue(mDb1.getFeatures()
+ .isFeatureSupported(Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA));
+ // Schema registration
+ AppSearchSchema genericSchema = new AppSearchSchema.Builder("Generic")
+ .addProperty(new StringPropertyConfig.Builder("foo")
+ .setCardinality(PropertyConfig.CARDINALITY_OPTIONAL)
+ .setTokenizerType(StringPropertyConfig.TOKENIZER_TYPE_PLAIN)
+ .setIndexingType(StringPropertyConfig.INDEXING_TYPE_PREFIXES)
+ .build()
+ ).build();
+ mDb1.setSchemaAsync(new SetSchemaRequest.Builder()
+ .addSchemas(AppSearchEmail.SCHEMA)
+ .addSchemas(genericSchema)
+ .build())
+ .get();
+
+ // Index four documents.
+ AppSearchEmail inEmail1 =
+ new AppSearchEmail.Builder("namespace1", "id1")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail1).build()));
+ AppSearchEmail inEmail2 =
+ new AppSearchEmail.Builder("namespace1", "id2")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail2).build()));
+ AppSearchEmail inEmail3 =
+ new AppSearchEmail.Builder("namespace2", "id3")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail3).build()));
+ AppSearchEmail inEmail4 =
+ new AppSearchEmail.Builder("namespace2", "id4")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail4).build()));
+ AppSearchEmail inEmail5 =
+ new AppSearchEmail.Builder("namespace2", "id5")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail5).build()));
+ GenericDocument inDoc1 =
+ new GenericDocument.Builder<>("namespace3", "id6", "Generic")
+ .setPropertyString("foo", "body").build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inDoc1).build()));
+ GenericDocument inDoc2 =
+ new GenericDocument.Builder<>("namespace3", "id7", "Generic")
+ .setPropertyString("foo", "body").build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inDoc2).build()));
+ GenericDocument inDoc3 =
+ new GenericDocument.Builder<>("namespace4", "id8", "Generic")
+ .setPropertyString("foo", "body").build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inDoc3).build()));
+
+ // Query with per package result grouping. Only the last document 'doc3' should be
+ // returned.
+ SearchResults searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
+ .build());
+ List<GenericDocument> documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3);
+
+ // Query with per namespace result grouping. Only the last document in each namespace should
+ // be returned ('doc3', 'doc2', 'email5' and 'email2').
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
+
+ // Query with per namespace result grouping. Two of the last documents in each namespace
+ // should be returned ('doc3', 'doc2', 'doc1', 'email5', 'email4', 'email2', 'email1')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
+ inEmail1);
+
+ // Query with per schema result grouping. Only the last document of each schema type should
+ // be returned ('doc3', 'email5')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inEmail5);
+
+ // Query with per schema result grouping. Only the last two documents of each schema type
+ // should be returned ('doc3', 'doc2', 'email5', 'email4')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail4);
+
+ // Query with per package and per namespace result grouping. Only the last document in each
+ // namespace should be returned ('doc3', 'doc2', 'email5' and 'email2').
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
+
+ // Query with per package and per namespace result grouping. Only the last two documents
+ // in each namespace should be returned ('doc3', 'doc2', 'doc1', 'email5', 'email4',
+ // 'email2', 'email1')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
+ inEmail1);
+
+ // Query with per package and per schema type result grouping. Only the last document in
+ // each schema type should be returned. ('doc3', 'email5')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_SCHEMA
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inEmail5);
+
+ // Query with per package and per schema type result grouping. Only the last two document in
+ // each schema type should be returned. ('doc3', 'doc2', 'email5', 'email4')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_SCHEMA
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail4);
+
+ // Query with per namespace and per schema type result grouping. Only the last document in
+ // each namespace should be returned. ('doc3', 'doc2', 'email5' and 'email2').
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
+
+ // Query with per namespace and per schema type result grouping. Only the last two documents
+ // in each namespace should be returned. ('doc3', 'doc2', 'doc1', 'email5', 'email4',
+ // 'email2', 'email1')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
+ inEmail1);
+
+ // Query with per namespace, per package and per schema type result grouping. Only the last
+ // document in each namespace should be returned. ('doc3', 'doc2', 'email5' and 'email2')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE | SearchSpec.GROUPING_TYPE_PER_SCHEMA
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inEmail5, inEmail2);
+
+ // Query with per namespace, per package and per schema type result grouping. Only the last
+ // two documents in each namespace should be returned.('doc3', 'doc2', 'doc1', 'email5',
+ // 'email4', 'email2', 'email1')
+ searchResults = mDb1.search("body", new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(
+ SearchSpec.GROUPING_TYPE_PER_NAMESPACE | SearchSpec.GROUPING_TYPE_PER_SCHEMA
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 2)
+ .build());
+ documents = convertSearchResultsToDocuments(searchResults);
+ assertThat(documents).containsExactly(inDoc3, inDoc2, inDoc1, inEmail5, inEmail4, inEmail2,
+ inEmail1);
+ }
+
+ @Test
+ public void testQuery_ResultGroupingLimits_SchemaGroupingNotSupported() throws Exception {
+ assumeFalse(mDb1.getFeatures()
+ .isFeatureSupported(Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA));
+ // Schema registration
+ mDb1.setSchemaAsync(new SetSchemaRequest.Builder()
+ .addSchemas(AppSearchEmail.SCHEMA).build()).get();
+
+ // Index four documents.
+ AppSearchEmail inEmail1 =
+ new AppSearchEmail.Builder("namespace1", "id1")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail1).build()));
+ AppSearchEmail inEmail2 =
+ new AppSearchEmail.Builder("namespace1", "id2")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail2).build()));
+ AppSearchEmail inEmail3 =
+ new AppSearchEmail.Builder("namespace2", "id3")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail3).build()));
+ AppSearchEmail inEmail4 =
+ new AppSearchEmail.Builder("namespace2", "id4")
+ .setFrom("from@example.com")
+ .setTo("to1@example.com", "to2@example.com")
+ .setSubject("testPut example")
+ .setBody("This is the body of the testPut email")
+ .build();
+ checkIsBatchResultSuccess(mDb1.putAsync(
+ new PutDocumentsRequest.Builder().addGenericDocuments(inEmail4).build()));
+
+ // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
+ // UnsupportedOperationException will be thrown.
+ SearchSpec searchSpec1 = new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
+ .build();
+ UnsupportedOperationException exception = assertThrows(UnsupportedOperationException.class,
+ () -> mDb1.search("body", searchSpec1));
+ assertThat(exception).hasMessageThat().contains(
+ Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
+ + " AppSearch implementation.");
+
+ // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
+ // UnsupportedOperationException will be thrown.
+ SearchSpec searchSpec2 = new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_PACKAGE
+ | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
+ .build();
+ exception = assertThrows(UnsupportedOperationException.class,
+ () -> mDb1.search("body", searchSpec2));
+ assertThat(exception).hasMessageThat().contains(
+ Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
+ + " AppSearch implementation.");
+
+ // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
+ // UnsupportedOperationException will be thrown.
+ SearchSpec searchSpec3 = new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_SCHEMA, /*resultLimit=*/ 1)
+ .build();
+ exception = assertThrows(UnsupportedOperationException.class,
+ () -> mDb1.search("body", searchSpec3));
+ assertThat(exception).hasMessageThat().contains(
+ Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
+ + " AppSearch implementation.");
+
+ // SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA is not supported.
+ // UnsupportedOperationException will be thrown.
+ SearchSpec searchSpec4 = new SearchSpec.Builder()
+ .setTermMatch(SearchSpec.TERM_MATCH_EXACT_ONLY)
+ .setResultGrouping(SearchSpec.GROUPING_TYPE_PER_NAMESPACE
+ | SearchSpec.GROUPING_TYPE_PER_SCHEMA
+ | SearchSpec.GROUPING_TYPE_PER_PACKAGE, /*resultLimit=*/ 1)
+ .build();
+ exception = assertThrows(UnsupportedOperationException.class,
+ () -> mDb1.search("body", searchSpec4));
+ assertThat(exception).hasMessageThat().contains(
+ Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA + " is not available on this"
+ + " AppSearch implementation.");
+ }
+
+ @Test
public void testIndexNestedDocuments() throws Exception {
// Schema registration
mDb1.setSchemaAsync(new SetSchemaRequest.Builder()
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionPlatformCtsTest.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionPlatformCtsTest.java
index 5e3e88a..8d8d2cb 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionPlatformCtsTest.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/cts/app/AppSearchSessionPlatformCtsTest.java
@@ -37,7 +37,6 @@
import androidx.appsearch.app.SetSchemaRequest;
import androidx.appsearch.platformstorage.PlatformStorage;
import androidx.appsearch.testutil.AppSearchEmail;
-import androidx.core.os.BuildCompat;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.filters.SdkSuppress;
@@ -73,19 +72,19 @@
new PlatformStorage.SearchContext.Builder(context, DB_NAME_2).build()).get();
assertThat(db2.getFeatures().isFeatureSupported(
Features.SEARCH_RESULT_MATCH_INFO_SUBMATCH))
- .isEqualTo(BuildCompat.isAtLeastT());
+ .isEqualTo(Build.VERSION.SDK_INT >= 33);
assertThat(db2.getFeatures().isFeatureSupported(
Features.GLOBAL_SEARCH_SESSION_REGISTER_OBSERVER_CALLBACK))
- .isEqualTo(BuildCompat.isAtLeastT());
+ .isEqualTo(Build.VERSION.SDK_INT >= 33);
assertThat(db2.getFeatures().isFeatureSupported(
Features.GLOBAL_SEARCH_SESSION_GET_SCHEMA))
- .isEqualTo(BuildCompat.isAtLeastT());
+ .isEqualTo(Build.VERSION.SDK_INT >= 33);
assertThat(db2.getFeatures().isFeatureSupported(
Features.GLOBAL_SEARCH_SESSION_GET_BY_ID))
- .isEqualTo(BuildCompat.isAtLeastT());
+ .isEqualTo(Build.VERSION.SDK_INT >= 33);
assertThat(db2.getFeatures().isFeatureSupported(
Features.ADD_PERMISSIONS_AND_GET_VISIBILITY))
- .isEqualTo(BuildCompat.isAtLeastT());
+ .isEqualTo(Build.VERSION.SDK_INT >= 33);
}
@Test
@@ -140,7 +139,7 @@
@Test
public void testPutLargeDocumentBatch() throws Exception {
// b/185441119 was fixed in Android T, this test will fail on S_V2 devices and below.
- assumeTrue(BuildCompat.isAtLeastT());
+ assumeTrue(Build.VERSION.SDK_INT >= 33);
super.testPutLargeDocumentBatch();
}
@@ -150,7 +149,7 @@
// TODO(b/230879098) This bug was fixed in Android T, but will currently fail on S_V2
// devices and below. However, we could implement a workaround in platform-storage.
// Implement that workaround and enable on S and S_V2.
- assumeTrue(BuildCompat.isAtLeastT());
+ assumeTrue(Build.VERSION.SDK_INT >= 33);
super.testSetSchemaWithIncompatibleNestedSchema();
}
@@ -158,7 +157,7 @@
@Test
public void testEmojiSnippet() throws Exception {
// b/229770338 was fixed in Android T, this test will fail on S_V2 devices and below.
- assumeTrue(BuildCompat.isAtLeastT());
+ assumeTrue(Build.VERSION.SDK_INT >= 33);
super.testEmojiSnippet();
}
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/annotation/Document.java b/appsearch/appsearch/src/main/java/androidx/appsearch/annotation/Document.java
index 8066b39..e4b390d 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/annotation/Document.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/annotation/Document.java
@@ -16,6 +16,7 @@
// @exportToFramework:skipFile()
package androidx.appsearch.annotation;
+import androidx.annotation.NonNull;
import androidx.appsearch.app.AppSearchSchema;
import java.lang.annotation.Documented;
@@ -253,6 +254,47 @@
default AppSearchSchema.StringPropertyConfig.JOINABLE_VALUE_TYPE_NONE;
/**
+ * Configures how a property should be converted to and from a {@link String}.
+ *
+ * <p>Useful for representing properties using rich types that boil down to simple string
+ * values in the database.
+ *
+ * <p>The referenced class must satisfy the following:
+ *
+ * <ol>
+ * <li>
+ * Have a static method called {@code serialize} that converts the property's Java
+ * type to a {@link String}.
+ * </li>
+ * <li>
+ * Have a static method called {@code deserialize} that converts a {@link String} to
+ * the property's Java type or returns null if deserialization failed.
+ * </li>
+ * </ol>
+ *
+ * <p>For example:
+ *
+ * <pre>
+ * {@code
+ * @Document("Entity")
+ * public final class MyEntity {
+ *
+ * @Document.StringProperty(serializer = SomeRichTypeSerializer.class)
+ * public SomeRichType getMyProperty();
+ *
+ * public final class SomeRichTypeSerializer {
+ * public static String serialize(SomeRichType instance) {...}
+ *
+ * @Nullable
+ * public static SomeRichType deserialize(String string) {...}
+ * }
+ * }
+ * }
+ * </pre>
+ */
+ Class<?> serializer() default DefaultSerializer.class;
+
+ /**
* Configures whether this property must be specified for the document to be valid.
*
* <p>This attribute does not apply to properties of a repeated type (e.g. a list).
@@ -262,6 +304,20 @@
* this attribute to {@code true}.
*/
boolean required() default false;
+
+ final class DefaultSerializer {
+ private DefaultSerializer() {}
+
+ @NonNull
+ public static String serialize(@NonNull String value) {
+ return value;
+ }
+
+ @NonNull
+ public static String deserialize(@NonNull String string) {
+ return string;
+ }
+ }
}
/**
@@ -326,6 +382,29 @@
default AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE;
/**
+ * Configures how a property should be converted to and from a {@link Long}.
+ *
+ * <p>Useful for representing properties using rich types that boil down to simple 64-bit
+ * integer values in the database.
+ *
+ * <p>The referenced class must satisfy the following:
+ *
+ * <ol>
+ * <li>
+ * Have a static method called {@code serialize} that converts the property's Java
+ * type to a {@link Long}.
+ * </li>
+ * <li>
+ * Have a static method called {@code deserialize} that converts a {@link Long} to
+ * the property's Java type or returns null if deserialization failed.
+ * </li>
+ * </ol>
+ *
+ * <p>See {@link StringProperty#serializer()} for an example of a serializer.
+ */
+ Class<?> serializer() default DefaultSerializer.class;
+
+ /**
* Configures whether this property must be specified for the document to be valid.
*
* <p>This attribute does not apply to properties of a repeated type (e.g. a list).
@@ -335,6 +414,18 @@
* this attribute to {@code true}.
*/
boolean required() default false;
+
+ final class DefaultSerializer {
+ private DefaultSerializer() {}
+
+ public static long serialize(long value) {
+ return value;
+ }
+
+ public static long deserialize(long l) {
+ return l;
+ }
+ }
}
/**
@@ -353,6 +444,29 @@
String name() default "";
/**
+ * Configures how a property should be converted to and from a {@link Double}.
+ *
+ * <p>Useful for representing properties using rich types that boil down to simple
+ * double-precision decimal values in the database.
+ *
+ * <p>The referenced class must satisfy the following:
+ *
+ * <ol>
+ * <li>
+ * Have a static method called {@code serialize} that converts the property's Java
+ * type to a {@link Double}.
+ * </li>
+ * <li>
+ * Have a static method called {@code deserialize} that converts a {@link Double} to
+ * the property's Java type or returns null if deserialization failed.
+ * </li>
+ * </ol>
+ *
+ * <p>See {@link StringProperty#serializer()} for an example of a serializer.
+ */
+ Class<?> serializer() default DefaultSerializer.class;
+
+ /**
* Configures whether this property must be specified for the document to be valid.
*
* <p>This attribute does not apply to properties of a repeated type (e.g. a list).
@@ -362,6 +476,18 @@
* this attribute to {@code true}.
*/
boolean required() default false;
+
+ final class DefaultSerializer {
+ private DefaultSerializer() {}
+
+ public static double serialize(double value) {
+ return value;
+ }
+
+ public static double deserialize(double d) {
+ return d;
+ }
+ }
}
/** Configures a boolean member field of a class as a property known to AppSearch. */
@@ -411,4 +537,17 @@
*/
boolean required() default false;
}
+
+ /**
+ * Marks a method as a builder producer.
+ *
+ * <p>A builder producer is a static method that returns a builder, which contains a "build()"
+ * method to construct the AppSearch document object and setter methods to set field values.
+ * Once a builder producer is specified, AppSearch will be forced to use the builder pattern to
+ * construct the document object.
+ */
+ @Documented
+ @Retention(RetentionPolicy.CLASS)
+ @Target(ElementType.METHOD)
+ @interface BuilderProducer {}
}
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchResult.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchResult.java
index a88bfe1..d8c79a5 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchResult.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchResult.java
@@ -53,6 +53,7 @@
RESULT_INVALID_SCHEMA,
RESULT_SECURITY_ERROR,
RESULT_DENIED,
+ RESULT_RATE_LIMITED,
})
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Retention(RetentionPolicy.SOURCE)
@@ -105,6 +106,14 @@
// TODO(b/279047435): unhide this the next time we can make API changes
public static final int RESULT_DENIED = 9;
+ /**
+ * The caller has hit AppSearch's rate limit and the requested operation has been rejected.
+ * <!--@exportToFramework:hide-->
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ // TODO(b/279047435): unhide this the next time we can make API changes
+ public static final int RESULT_RATE_LIMITED = 10;
+
private final @ResultCode int mResultCode;
@Nullable private final ValueType mResultValue;
@Nullable private final String mErrorMessage;
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchSchema.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchSchema.java
index 50d91b7..8548810 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchSchema.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchSchema.java
@@ -16,6 +16,7 @@
package androidx.appsearch.app;
+import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.annotation.IntDef;
@@ -36,6 +37,7 @@
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -1181,6 +1183,8 @@
public static final class DocumentPropertyConfig extends PropertyConfig {
private static final String SCHEMA_TYPE_FIELD = "schemaType";
private static final String INDEX_NESTED_PROPERTIES_FIELD = "indexNestedProperties";
+ private static final String INDEXABLE_NESTED_PROPERTIES_LIST_FIELD =
+ "indexableNestedPropertiesList";
DocumentPropertyConfig(@NonNull Bundle bundle) {
super(bundle);
@@ -1193,22 +1197,37 @@
}
/**
- * Returns whether fields in the nested document should be indexed according to that
+ * Returns whether properties in the nested document should be indexed according to that
* document's schema.
*
* <p>If false, the nested document's properties are not indexed regardless of its own
* schema.
+ *
+ * @see DocumentPropertyConfig.Builder#addIndexableNestedProperties(String...) for
+ * indexing a subset of properties from the nested document.
*/
public boolean shouldIndexNestedProperties() {
return mBundle.getBoolean(INDEX_NESTED_PROPERTIES_FIELD);
}
+ /** Returns the list of indexable nested properties for the nested document. */
+ @NonNull
+ public List<String> getIndexableNestedProperties() {
+ List<String> indexableNestedPropertiesList =
+ mBundle.getStringArrayList(INDEXABLE_NESTED_PROPERTIES_LIST_FIELD);
+ if (indexableNestedPropertiesList == null) {
+ return Collections.emptyList();
+ }
+ return Collections.unmodifiableList(indexableNestedPropertiesList);
+ }
+
/** Builder for {@link DocumentPropertyConfig}. */
public static final class Builder {
private final String mPropertyName;
private final String mSchemaType;
@Cardinality private int mCardinality = CARDINALITY_OPTIONAL;
private boolean mShouldIndexNestedProperties = false;
+ private final Set<String> mIndexableNestedPropertiesList = new ArraySet<>();
/**
* Creates a new {@link DocumentPropertyConfig.Builder}.
@@ -1242,11 +1261,14 @@
}
/**
- * Configures whether fields in the nested document should be indexed according to that
- * document's schema.
+ * Configures whether properties in the nested document should be indexed according to
+ * that document's schema.
*
* <p>If false, the nested document's properties are not indexed regardless of its own
* schema.
+ *
+ * <p>To index a subset of properties from the nested document, set this to false and
+ * use {@link #addIndexableNestedProperties(String...)}.
*/
@CanIgnoreReturnValue
@NonNull
@@ -1256,14 +1278,131 @@
return this;
}
- /** Constructs a new {@link PropertyConfig} from the contents of this builder. */
+ /**
+ * Adds one or more properties for indexing from the nested document. The added property
+ * will be indexed according to that property's indexing configurations in the
+ * document's schema definition. All properties in this list will consume a sectionId
+ * regardless of its actual indexing config -- this includes properties added that
+ * do not actually exist, as well as properties that are not set as indexable in the
+ * nested schema type.
+ *
+ * <p>Input strings should follow the format of the property path for the nested
+ * property, with '.' as the path separator. This nested document's property name
+ * should not be included in the property path.
+ *
+ * <p>Ex. Consider an 'Organization' schema type which defines a nested document
+ * property 'address' (Address schema type), where Address has a nested document
+ * property 'country' (Country schema type with string 'name' property), and a string
+ * 'street' property. The 'street' and 'country's name' properties from the 'address'
+ * document property can be indexed for the 'Organization' schema type by calling:
+ * <pre>{@code
+ * OrganizationSchema.addProperty(
+ * new DocumentPropertyConfig.Builder("address", "Address")
+ * .addIndexableNestedProperties("street", "country.name")
+ * .build()).
+ * }</pre>
+ *
+ * <p>{@link DocumentPropertyConfig.Builder#setShouldIndexNestedProperties} is
+ * required to be false if any indexable nested property is added this way for the
+ * document property. Attempting to build a DocumentPropertyConfig when this is not
+ * true throws {@link IllegalArgumentException}.
+ */
+ @CanIgnoreReturnValue
+ @NonNull
+ // @exportToFramework:startStrip()
+ @RequiresFeature(
+ enforcement = "androidx.appsearch.app.Features#isFeatureSupported",
+ name = Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES)
+ // @exportToFramework:endStrip()
+ public DocumentPropertyConfig.Builder addIndexableNestedProperties(
+ @NonNull String... indexableNestedProperties) {
+ Preconditions.checkNotNull(indexableNestedProperties);
+ return addIndexableNestedProperties(Arrays.asList(indexableNestedProperties));
+ }
+
+ /**
+ * Adds one or more property paths for indexing from the nested document property.
+ *
+ * @see #addIndexableNestedProperties(String...)
+ */
+ @CanIgnoreReturnValue
+ @SuppressLint("MissingGetterMatchingBuilder")
+ @NonNull
+ // @exportToFramework:startStrip()
+ @RequiresFeature(
+ enforcement = "androidx.appsearch.app.Features#isFeatureSupported",
+ name = Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES)
+ // @exportToFramework:endStrip()
+ public DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(
+ @NonNull PropertyPath... indexableNestedPropertyPaths) {
+ Preconditions.checkNotNull(indexableNestedPropertyPaths);
+ return addIndexableNestedPropertyPaths(Arrays.asList(indexableNestedPropertyPaths));
+ }
+
+ /**
+ * Adds one or more properties for indexing from the nested document property.
+ *
+ * @see #addIndexableNestedProperties(String...)
+ */
+ @CanIgnoreReturnValue
+ @NonNull
+ // @exportToFramework:startStrip()
+ @RequiresFeature(
+ enforcement = "androidx.appsearch.app.Features#isFeatureSupported",
+ name = Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES)
+ // @exportToFramework:endStrip()
+ public DocumentPropertyConfig.Builder addIndexableNestedProperties(
+ @NonNull Collection<String> indexableNestedProperties) {
+ Preconditions.checkNotNull(indexableNestedProperties);
+ mIndexableNestedPropertiesList.addAll(indexableNestedProperties);
+ return this;
+ }
+
+ /**
+ * Adds one or more property paths for indexing from the nested document property.
+ *
+ * @see #addIndexableNestedProperties(String...)
+ */
+ @CanIgnoreReturnValue
+ @SuppressLint("MissingGetterMatchingBuilder")
+ @NonNull
+ // @exportToFramework:startStrip()
+ @RequiresFeature(
+ enforcement = "androidx.appsearch.app.Features#isFeatureSupported",
+ name = Features.SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES)
+ // @exportToFramework:endStrip()
+ public DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths(
+ @NonNull Collection<PropertyPath> indexableNestedPropertyPaths) {
+ Preconditions.checkNotNull(indexableNestedPropertyPaths);
+ List<PropertyPath> propertyPathList = new ArrayList<>(indexableNestedPropertyPaths);
+ for (int i = 0; i < indexableNestedPropertyPaths.size(); i++) {
+ mIndexableNestedPropertiesList.add(propertyPathList.get(i).toString());
+ }
+ return this;
+ }
+
+ /**
+ * Constructs a new {@link PropertyConfig} from the contents of this builder.
+ *
+ * @throws IllegalArgumentException if the provided PropertyConfig sets
+ * {@link #shouldIndexNestedProperties()} to true and has one or more properties
+ * defined for {@link #getIndexableNestedProperties()}.
+ */
@NonNull
public DocumentPropertyConfig build() {
+ if (mShouldIndexNestedProperties && !mIndexableNestedPropertiesList.isEmpty()) {
+ throw new IllegalArgumentException(
+ "DocumentIndexingConfig#shouldIndexNestedProperties is required "
+ + "to be false when one or more indexableNestedProperties are "
+ + "provided.");
+ }
Bundle bundle = new Bundle();
bundle.putString(NAME_FIELD, mPropertyName);
bundle.putInt(DATA_TYPE_FIELD, DATA_TYPE_DOCUMENT);
bundle.putInt(CARDINALITY_FIELD, mCardinality);
bundle.putBoolean(INDEX_NESTED_PROPERTIES_FIELD, mShouldIndexNestedProperties);
+ bundle.putStringArrayList(INDEXABLE_NESTED_PROPERTIES_LIST_FIELD,
+ new ArrayList<>(mIndexableNestedPropertiesList));
bundle.putString(SCHEMA_TYPE_FIELD, mSchemaType);
return new DocumentPropertyConfig(bundle);
}
@@ -1283,6 +1422,10 @@
.append(shouldIndexNestedProperties())
.append(",\n");
+ builder.append("indexableNestedProperties: ")
+ .append(getIndexableNestedProperties())
+ .append(",\n");
+
builder.append("schemaType: \"").append(getSchemaType()).append("\",\n");
}
}
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/Features.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/Features.java
index 6309e87..6a198be 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/Features.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/Features.java
@@ -16,7 +16,6 @@
package androidx.appsearch.app;
import androidx.annotation.NonNull;
-import androidx.annotation.RestrictTo;
/**
* A class that encapsulates all features that are only supported in certain cases (e.g. only on
@@ -143,12 +142,8 @@
/**
* Feature for {@link #isFeatureSupported(String)}. This feature covers setting schemas with
- * circular references for {@link AppSearchSession#setSchemaAsync}
- *
- * @exportToFramework:hide
- * TODO(b/280698121): Unhide and request jetpack API approval after this is synced to framework.
+ * circular references for {@link AppSearchSession#setSchemaAsync}.
*/
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
String SET_SCHEMA_CIRCULAR_REFERENCES = "SET_SCHEMA_CIRCULAR_REFERENCES";
/**
@@ -158,6 +153,13 @@
String SCHEMA_ADD_PARENT_TYPE = "SCHEMA_ADD_PARENT_TYPE";
/**
+ * Feature for {@link #isFeatureSupported(String)}. This feature covers
+ * {@link
+ * AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(String...)}
+ */
+ String SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES = "SCHEMA_ADD_INDEXABLE_NESTED_PROPERTIES";
+
+ /**
* Returns whether a feature is supported at run-time. Feature support depends on the
* feature in question, the AppSearch backend being used and the Android version of the
* device.
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/PropertyPath.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/PropertyPath.java
index b23e46e..6fb1440 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/PropertyPath.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/PropertyPath.java
@@ -30,14 +30,15 @@
/**
* Represents a property path returned from searching the AppSearch Database.
*
- * <p> When searching the AppSearch Database, you will get back {@link SearchResult.MatchInfo}
- * objects that contain a property path signifying the location of a match within the database.
- * This is a string that may look something like "foo.bar[0]". {@link PropertyPath} parses this
- * string and breaks it up into a List of {@link PathSegment}s. These may represent either a
- * property or a property and a 0-based index into the property. For instance, "foo.bar[1]" would
- * be parsed into a {@link PathSegment} with a property name of foo and a {@link PathSegment}
- * with a property name of bar and an index of 1. This allows for easier manipulation of the
- * property path.
+ * <p> One of the use cases for this class is when searching the AppSearch Database for the snippet
+ * matching use case. In this case you will get back {@link SearchResult.MatchInfo} objects that
+ * contain a property path signifying the location of a match within the database. This is a
+ * string that may look something like "foo.bar[0]". {@link PropertyPath} parses this string and
+ * breaks it up into a List of {@link PathSegment}s. These may represent either a property or a
+ * property and a 0-based index into the property. For instance, "foo.bar[1]" would be parsed
+ * into a {@link PathSegment} with a property name of foo and a {@link PathSegment} with a
+ * property name of bar and an index of 1. This allows for easier manipulation of the property
+ * path.
*
* <p> This class won't perform any retrievals, it will only parse the path string. As such, it
* may not necessarily refer to a valid path in the database.
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/SearchSpec.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/SearchSpec.java
index 919cf29..c1b7ade 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/SearchSpec.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/SearchSpec.java
@@ -214,10 +214,8 @@
/**
* Results should be grouped together by schema type for the purpose of enforcing a limit on the
* number of results returned per schema type.
- * <!--@exportToFramework:hide-->
*/
// @exportToFramework:startStrip()
- // TODO(b/258715421) start exporting this when it is unhidden in framework
@RequiresFeature(
enforcement = "androidx.appsearch.app.Features#isFeatureSupported",
name = Features.SEARCH_SPEC_GROUPING_TYPE_PER_SCHEMA)
diff --git a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/DocumentModel.java b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/DocumentModel.java
index 70780ce..226156f 100644
--- a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/DocumentModel.java
+++ b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/DocumentModel.java
@@ -15,6 +15,7 @@
*/
package androidx.appsearch.compiler;
+import static androidx.appsearch.compiler.IntrospectionHelper.BUILDER_PRODUCER_CLASS;
import static androidx.appsearch.compiler.IntrospectionHelper.DOCUMENT_ANNOTATION_CLASS;
import static androidx.appsearch.compiler.IntrospectionHelper.generateClassHierarchy;
import static androidx.appsearch.compiler.IntrospectionHelper.getDocumentAnnotation;
@@ -46,7 +47,6 @@
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
@@ -76,11 +76,14 @@
// The name of the original class annotated with @Document
private final String mQualifiedDocumentClassName;
private String mSchemaName;
- private Set<TypeElement> mParentTypes = new LinkedHashSet<>();
+ private final Set<TypeElement> mParentTypes = new LinkedHashSet<>();
+ // All methods in the current @Document annotated class/interface, or in the generated class
+ // for AutoValue document.
// Warning: if you change this to a HashSet, we may choose different getters or setters from
// run to run, causing the generated code to bounce.
private final Set<ExecutableElement> mAllMethods = new LinkedHashSet<>();
- private final boolean mIsAutoValueDocument;
+ // All methods in the builder class, if a builder producer is provided.
+ private final Set<ExecutableElement> mAllBuilderMethods = new LinkedHashSet<>();
// Key: Name of the element which is accessed through the getter method.
// Value: ExecutableElement of the getter method.
private final Map<String, ExecutableElement> mGetterMethods = new HashMap<>();
@@ -105,6 +108,8 @@
new HashMap<>();
private ExecutableElement mChosenCreationMethod = null;
private List<String> mChosenCreationMethodParams = null;
+ private TypeElement mBuilderClass = null;
+ private ExecutableElement mBuilderProducer = null;
private DocumentModel(
@NonNull ProcessingEnvironment env,
@@ -119,37 +124,80 @@
mClass = clazz;
mTypeUtil = env.getTypeUtils();
mElementUtil = env.getElementUtils();
+ mQualifiedDocumentClassName = generatedAutoValueElement != null
+ ? generatedAutoValueElement.getQualifiedName().toString()
+ : clazz.getQualifiedName().toString();
- if (generatedAutoValueElement != null) {
- mIsAutoValueDocument = true;
- // Scan factory methods from AutoValue class.
- Set<ExecutableElement> creationMethods = new LinkedHashSet<>();
- for (Element child : ElementFilter.methodsIn(mClass.getEnclosedElements())) {
- ExecutableElement method = (ExecutableElement) child;
- if (isFactoryMethod(method)) {
- creationMethods.add(method);
+ // Scan methods and constructors. We will need this info when processing fields to
+ // make sure the fields can be get and set.
+ Set<ExecutableElement> potentialCreationMethods = extractCreationMethods(clazz);
+ addAllMethods(mClass, mAllMethods);
+ if (mBuilderClass != null) {
+ addAllMethods(mBuilderClass, mAllBuilderMethods);
+ }
+ scanFields(mClass);
+ chooseCreationMethod(potentialCreationMethods);
+ }
+
+ /**
+ * Scans all the elements in typeElement to find a builder producer. If found, set
+ * mBuilderProducer and mBuilderClass to the builder producer and the return type
+ * respectively.
+ *
+ * @throws ProcessingException if there are more than one elements annotated with
+ * {@code @Document.BuilderProducer}, or if the builder producer element is not a visible static
+ * method.
+ */
+ // TODO(b/285149515): Other than using a static method, we should support builder constructor
+ // as well to create builder instances, as this is the right pattern compliant with Android
+ // API guidelines.
+ // go/android-api-guidelines#builder-constructor
+ private void extractBuilderProducer(TypeElement typeElement)
+ throws ProcessingException {
+ for (Element child : typeElement.getEnclosedElements()) {
+ boolean isAnnotated = false;
+ for (AnnotationMirror annotation : child.getAnnotationMirrors()) {
+ if (annotation.getAnnotationType().toString().equals(
+ IntrospectionHelper.BUILDER_PRODUCER_CLASS)) {
+ isAnnotated = true;
+ break;
}
}
- mAllMethods.addAll(
- ElementFilter.methodsIn(generatedAutoValueElement.getEnclosedElements()));
+ if (!isAnnotated) {
+ continue;
+ }
+ if (child.getKind() != ElementKind.METHOD) {
+ // Since @Document.BuilderProducer is configured with @Target(ElementType.METHOD),
+ // it's not possible to reach here.
+ throw new ProcessingException("Builder producer must be a method", child);
+ }
+ ExecutableElement method = (ExecutableElement) child;
+ Set<Modifier> methodModifiers = method.getModifiers();
+ if (!methodModifiers.contains(Modifier.STATIC)) {
+ throw new ProcessingException("Builder producer must be static", method);
+ }
+ if (methodModifiers.contains(Modifier.PRIVATE)) {
+ throw new ProcessingException("Builder producer cannot be private", method);
+ }
- mQualifiedDocumentClassName = generatedAutoValueElement.getQualifiedName().toString();
- scanFields(generatedAutoValueElement);
- scanCreationMethods(creationMethods);
- } else {
- mIsAutoValueDocument = false;
- // Scan methods and constructors. We will need this info when processing fields to
- // make sure the fields can be get and set.
- Set<ExecutableElement> creationMethods = extractCreationMethods(mClass);
- addAllMethods(mClass, mAllMethods);
-
- mQualifiedDocumentClassName = clazz.getQualifiedName().toString();
- scanFields(mClass);
- scanCreationMethods(creationMethods);
+ if (mBuilderProducer == null) {
+ mBuilderProducer = method;
+ mBuilderClass = (TypeElement) mTypeUtil.asElement(mBuilderProducer.getReturnType());
+ } else {
+ throw new ProcessingException("Found duplicated builder producer", method);
+ }
}
}
- private Set<ExecutableElement> extractCreationMethods(TypeElement typeElement) {
+ private Set<ExecutableElement> extractCreationMethods(TypeElement typeElement)
+ throws ProcessingException {
+ extractBuilderProducer(typeElement);
+ // If a builder producer is provided, then only the builder can be used as a creation
+ // method.
+ if (mBuilderProducer != null) {
+ return Collections.singleton(mBuilderProducer);
+ }
+
Set<ExecutableElement> creationMethods = new LinkedHashSet<>();
for (Element child : typeElement.getEnclosedElements()) {
if (child.getKind() == ElementKind.CONSTRUCTOR) {
@@ -161,7 +209,7 @@
}
}
}
- return creationMethods;
+ return Collections.unmodifiableSet(creationMethods);
}
private void addAllMethods(TypeElement typeElement, Set<ExecutableElement> allMethods) {
@@ -298,9 +346,6 @@
public AnnotationMirror getPropertyAnnotation(@NonNull Element element)
throws ProcessingException {
Objects.requireNonNull(element);
- if (mIsAutoValueDocument) {
- element = getGetterForElement(element.getSimpleName().toString());
- }
Set<String> propertyClassPaths = new HashSet<>();
for (PropertyClass propertyClass : PropertyClass.values()) {
propertyClassPaths.add(propertyClass.getClassFullPath());
@@ -324,6 +369,11 @@
return Collections.unmodifiableList(mChosenCreationMethodParams);
}
+ @Nullable
+ public TypeElement getBuilderClass() {
+ return mBuilderClass;
+ }
+
private boolean isFactoryMethod(ExecutableElement method) {
Set<Modifier> methodModifiers = method.getModifiers();
return methodModifiers.contains(Modifier.STATIC)
@@ -334,12 +384,9 @@
/**
* Scan the annotations of a field to determine the fields type and handle it accordingly
*
- * @param classElements all the field elements of a class, annotated and non-annotated
* @param childElement the member of class elements currently being scanned
- * @throws ProcessingException
*/
- private void scanAnnotatedField(@NonNull List<? extends Element> classElements,
- @NonNull Element childElement) throws ProcessingException {
+ private void scanAnnotatedField(@NonNull Element childElement) throws ProcessingException {
String fieldName = childElement.getSimpleName().toString();
// a property field shouldn't be able to override a special field
@@ -352,25 +399,20 @@
// no annotation mirrors -> non-indexable field
for (AnnotationMirror annotation : childElement.getAnnotationMirrors()) {
String annotationFq = annotation.getAnnotationType().toString();
- if (!annotationFq.startsWith(DOCUMENT_ANNOTATION_CLASS)) {
+ if (!annotationFq.startsWith(DOCUMENT_ANNOTATION_CLASS) || annotationFq.equals(
+ BUILDER_PRODUCER_CLASS)) {
continue;
}
- Element child;
- if (mIsAutoValueDocument) {
- child = findFieldForFunctionWithSameName(classElements, childElement);
- } else {
- if (childElement.getKind() == ElementKind.CLASS) {
- continue;
- } else {
- child = childElement;
- }
+ if (childElement.getKind() == ElementKind.CLASS) {
+ continue;
}
switch (annotationFq) {
case IntrospectionHelper.ID_CLASS:
if (mSpecialFieldNames.containsKey(SpecialField.ID)) {
throw new ProcessingException(
- "Class hierarchy contains multiple fields annotated @Id", child);
+ "Class hierarchy contains multiple fields annotated @Id",
+ childElement);
}
mSpecialFieldNames.put(SpecialField.ID, fieldName);
break;
@@ -378,14 +420,14 @@
if (mSpecialFieldNames.containsKey(SpecialField.NAMESPACE)) {
throw new ProcessingException(
"Class hierarchy contains multiple fields annotated @Namespace",
- child);
+ childElement);
}
mSpecialFieldNames.put(SpecialField.NAMESPACE, fieldName);
break;
case IntrospectionHelper.CREATION_TIMESTAMP_MILLIS_CLASS:
if (mSpecialFieldNames.containsKey(SpecialField.CREATION_TIMESTAMP_MILLIS)) {
throw new ProcessingException("Class hierarchy contains multiple fields "
- + "annotated @CreationTimestampMillis", child);
+ + "annotated @CreationTimestampMillis", childElement);
}
mSpecialFieldNames.put(
SpecialField.CREATION_TIMESTAMP_MILLIS, fieldName);
@@ -394,14 +436,15 @@
if (mSpecialFieldNames.containsKey(SpecialField.TTL_MILLIS)) {
throw new ProcessingException(
"Class hierarchy contains multiple fields annotated @TtlMillis",
- child);
+ childElement);
}
mSpecialFieldNames.put(SpecialField.TTL_MILLIS, fieldName);
break;
case IntrospectionHelper.SCORE_CLASS:
if (mSpecialFieldNames.containsKey(SpecialField.SCORE)) {
throw new ProcessingException(
- "Class hierarchy contains multiple fields annotated @Score", child);
+ "Class hierarchy contains multiple fields annotated @Score",
+ childElement);
}
mSpecialFieldNames.put(SpecialField.SCORE, fieldName);
break;
@@ -412,7 +455,7 @@
// 1. be unique
// 2. override a property from the Java parent while maintaining the same
// AppSearch property name
- checkFieldTypeForPropertyAnnotation(child, propertyClass);
+ checkFieldTypeForPropertyAnnotation(childElement, propertyClass);
// It's assumed that parent types, in the context of Java's type system,
// are always visited before child types, so existingProperty must come
// from the parent type. To make this assumption valid, the result
@@ -420,20 +463,24 @@
// types.
Element existingProperty = mPropertyElements.get(fieldName);
if (existingProperty != null) {
- if (!mTypeUtil.isSameType(existingProperty.asType(), child.asType())) {
+ if (!mTypeUtil.isSameType(
+ existingProperty.asType(), childElement.asType())) {
throw new ProcessingException(
- "Cannot override a property with a different type", child);
+ "Cannot override a property with a different type",
+ childElement);
}
- if (!getPropertyName(existingProperty).equals(getPropertyName(child))) {
+ if (!getPropertyName(existingProperty).equals(getPropertyName(
+ childElement))) {
throw new ProcessingException(
- "Cannot override a property with a different name", child);
+ "Cannot override a property with a different name",
+ childElement);
}
}
- mPropertyElements.put(fieldName, child);
+ mPropertyElements.put(fieldName, childElement);
}
}
- mAllAppSearchElements.put(fieldName, child);
+ mAllAppSearchElements.put(fieldName, childElement);
}
}
@@ -463,20 +510,12 @@
}
}
- List<TypeElement> hierarchy = generateClassHierarchy(element, mIsAutoValueDocument);
+ List<TypeElement> hierarchy = generateClassHierarchy(element);
for (TypeElement clazz : hierarchy) {
List<? extends Element> enclosedElements = clazz.getEnclosedElements();
- for (int i = 0; i < enclosedElements.size(); i++) {
- Element childElement = enclosedElements.get(i);
-
- // The only fields relevant to @Document in an AutoValue class are the abstract
- // accessor methods
- if (mIsAutoValueDocument && childElement.getKind() != ElementKind.METHOD) {
- continue;
- }
-
- scanAnnotatedField(enclosedElements, childElement);
+ for (Element childElement : enclosedElements) {
+ scanAnnotatedField(childElement);
}
}
@@ -501,21 +540,6 @@
}
}
- @NonNull
- private Element findFieldForFunctionWithSameName(
- @NonNull List<? extends Element> elements,
- @NonNull Element functionElement) throws ProcessingException {
- String fieldName = functionElement.getSimpleName().toString();
- for (Element field : ElementFilter.fieldsIn(elements)) {
- if (fieldName.equals(field.getSimpleName().toString())) {
- return field;
- }
- }
- throw new ProcessingException(
- "Cannot find the corresponding field for the annotated function",
- functionElement);
- }
-
/**
* Checks whether property's data type matches the {@code androidx.appsearch.annotation
* .Document} property annotation's requirement.
@@ -608,7 +632,8 @@
// Choose set access
if (modifiers.contains(Modifier.PRIVATE) || modifiers.contains(Modifier.FINAL)
- || modifiers.contains(Modifier.STATIC) || field.getKind() == ElementKind.METHOD) {
+ || modifiers.contains(Modifier.STATIC) || field.getKind() == ElementKind.METHOD
+ || mBuilderClass != null) {
// Try to find a setter. If we can't find one, mark the WriteKind as {@code
// CREATION_METHOD}. We don't know if this is true yet, the creation methods will be
// inspected in a subsequent pass.
@@ -627,7 +652,7 @@
}
}
- private void scanCreationMethods(Set<ExecutableElement> creationMethods)
+ private void chooseCreationMethod(Set<ExecutableElement> creationMethods)
throws ProcessingException {
// Maps field name to Element.
// If this is changed to a HashSet, we might report errors to the developer in a different
@@ -784,7 +809,9 @@
// We can't report setter failure until we've searched the creation methods, so this
// message is anticipatory and should be buffered by the caller.
String error;
- if (element.getKind() == ElementKind.METHOD) {
+ if (mBuilderClass != null) {
+ error = "Element cannot be written directly because a builder producer is provided";
+ } else if (element.getKind() == ElementKind.METHOD) {
error = "Element cannot be written directly because it is an annotated getter";
} else {
error = "Field cannot be written directly because it is private, final, or static";
@@ -794,7 +821,14 @@
ProcessingException e = new ProcessingException(error,
mAllAppSearchElements.get(elementName));
- for (ExecutableElement method : mAllMethods) {
+ // When using the builder pattern, setters can only come from the builder.
+ Set<ExecutableElement> methods;
+ if (mBuilderClass != null) {
+ methods = mAllBuilderMethods;
+ } else {
+ methods = mAllMethods;
+ }
+ for (ExecutableElement method : methods) {
String methodName = method.getSimpleName().toString();
String normalizedElementName = getNormalizedElementName(element);
if (methodName.equals(normalizedElementName)
diff --git a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/FromGenericDocumentCodeGenerator.java b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/FromGenericDocumentCodeGenerator.java
index 9ec0386..f63c8b8 100644
--- a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/FromGenericDocumentCodeGenerator.java
+++ b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/FromGenericDocumentCodeGenerator.java
@@ -39,6 +39,7 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind;
@@ -90,7 +91,13 @@
}
// Create an instance of the document class via the chosen create method.
- if (mModel.getChosenCreationMethod().getKind() == ElementKind.CONSTRUCTOR) {
+ TypeElement builderClass = mModel.getBuilderClass();
+ if (mModel.getBuilderClass() != null) {
+ methodBuilder.addStatement(
+ "$T builder = $T.$L($L)", builderClass, classType,
+ mModel.getChosenCreationMethod().getSimpleName().toString(),
+ getCreationMethodParams());
+ } else if (mModel.getChosenCreationMethod().getKind() == ElementKind.CONSTRUCTOR) {
methodBuilder.addStatement(
"$T document = new $T($L)", classType, classType, getCreationMethodParams());
} else {
@@ -107,8 +114,11 @@
methodBuilder.addStatement(fieldWrite);
}
}
-
- methodBuilder.addStatement("return document");
+ if (mModel.getBuilderClass() != null) {
+ methodBuilder.addStatement("return builder.build()");
+ } else {
+ methodBuilder.addStatement("return document");
+ }
return methodBuilder.build();
}
@@ -803,8 +813,14 @@
case FIELD:
return CodeBlock.of("document.$N = $NConv", fieldName, fieldName);
case SETTER:
+ String target;
+ if (mModel.getBuilderClass() == null) {
+ target = "document";
+ } else {
+ target = "builder";
+ }
String setter = mModel.getSetterForElement(fieldName).getSimpleName().toString();
- return CodeBlock.of("document.$N($NConv)", setter, fieldName);
+ return CodeBlock.of("$N.$N($NConv)", target, setter, fieldName);
default:
return null; // Constructor params should already have been set
}
diff --git a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/IntrospectionHelper.java b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/IntrospectionHelper.java
index f289cb3..ad2e92e 100644
--- a/appsearch/compiler/src/main/java/androidx/appsearch/compiler/IntrospectionHelper.java
+++ b/appsearch/compiler/src/main/java/androidx/appsearch/compiler/IntrospectionHelper.java
@@ -15,12 +15,13 @@
*/
package androidx.appsearch.compiler;
+import static com.google.auto.common.MoreTypes.asTypeElement;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
-import com.google.auto.common.MoreTypes;
import com.google.auto.value.AutoValue;
import com.squareup.javapoet.ClassName;
@@ -69,6 +70,8 @@
"androidx.appsearch.annotation.Document.CreationTimestampMillis";
static final String TTL_MILLIS_CLASS = "androidx.appsearch.annotation.Document.TtlMillis";
static final String SCORE_CLASS = "androidx.appsearch.annotation.Document.Score";
+ static final String BUILDER_PRODUCER_CLASS =
+ "androidx.appsearch.annotation.Document.BuilderProducer";
final TypeMirror mCollectionType;
final TypeMirror mListType;
final TypeMirror mStringType;
@@ -237,17 +240,14 @@
*/
@NonNull
public static List<TypeElement> generateClassHierarchy(
- @NonNull TypeElement element, boolean isAutoValueDocument)
- throws ProcessingException {
+ @NonNull TypeElement element) throws ProcessingException {
Deque<TypeElement> hierarchy = new ArrayDeque<>();
- if (isAutoValueDocument) {
+ if (element.getAnnotation(AutoValue.class) != null) {
// We don't allow classes annotated with both Document and AutoValue to extend classes.
// Because of how AutoValue is set up, there is no way to add a constructor to
// populate fields of super classes.
// There should just be the generated class and the original annotated class
- TypeElement superClass = MoreTypes.asTypeElement(
- MoreTypes.asTypeElement(element.getSuperclass()).getSuperclass());
-
+ TypeElement superClass = asTypeElement(element.getSuperclass());
if (!superClass.getQualifiedName().contentEquals(Object.class.getCanonicalName())) {
throw new ProcessingException(
"A class annotated with AutoValue and Document cannot have a superclass",
@@ -289,11 +289,11 @@
TypeMirror superclass = currentClass.getSuperclass();
// If currentClass is an interface, then superclass could be NONE.
if (superclass.getKind() != TypeKind.NONE) {
- generateClassHierarchyHelper(leafElement, MoreTypes.asTypeElement(superclass),
+ generateClassHierarchyHelper(leafElement, asTypeElement(superclass),
hierarchy, visited);
}
for (TypeMirror implementedInterface : currentClass.getInterfaces()) {
- generateClassHierarchyHelper(leafElement, MoreTypes.asTypeElement(implementedInterface),
+ generateClassHierarchyHelper(leafElement, asTypeElement(implementedInterface),
hierarchy, visited);
}
}
diff --git a/appsearch/compiler/src/test/java/androidx/appsearch/compiler/AppSearchCompilerTest.java b/appsearch/compiler/src/test/java/androidx/appsearch/compiler/AppSearchCompilerTest.java
index 2ba8875..222f3aa 100644
--- a/appsearch/compiler/src/test/java/androidx/appsearch/compiler/AppSearchCompilerTest.java
+++ b/appsearch/compiler/src/test/java/androidx/appsearch/compiler/AppSearchCompilerTest.java
@@ -2177,6 +2177,367 @@
"classSet.add(Gift.class);\n return classSet;");
}
+ @Test
+ public void testCreationByBuilder() throws Exception {
+ // Once @Document.BuilderProducer is found, AppSearch compiler will no longer consider other
+ // creation method, so "create" will not be used.
+ Compilation compilation = compile(
+ "@Document\n"
+ + "public interface Gift {\n"
+ + " @Document.Namespace public String getNamespace();\n"
+ + " @Document.Id public String getId();\n"
+ + " @Document.LongProperty public int getPrice();\n"
+ + " public static Gift create(String id, String namespace, int price) {\n"
+ + " return new GiftImpl(id, namespace, price);\n"
+ + " }\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftImpl implements Gift {\n"
+ + " public GiftImpl(String id, String namespace, int price) {\n"
+ + " this.id = id;\n"
+ + " this.namespace = namespace;\n"
+ + " this.price = price;\n"
+ + " }\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public String getNamespace() { return namespace; }\n"
+ + " public String getId() { return id; }\n"
+ + " public int getPrice() { return price; }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setPrice(int price) {\n"
+ + " this.price = price;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new GiftImpl(this.id, this.namespace, this.price);\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).succeededWithoutWarnings();
+ checkResultContains("Gift.java",
+ "GiftBuilder builder = Gift.getBuilder()");
+ checkResultContains("Gift.java", "builder.setNamespace(getNamespaceConv)");
+ checkResultContains("Gift.java", "builder.setId(getIdConv)");
+ checkResultContains("Gift.java", "builder.setPrice(getPriceConv)");
+ checkResultContains("Gift.java", "builder.build()");
+ checkEqualsGolden("Gift.java");
+ }
+
+ @Test
+ public void testCreationByBuilderWithParameter() throws Exception {
+ Compilation compilation = compile(
+ "@Document\n"
+ + "public interface Gift {\n"
+ + " @Document.Namespace public String getNamespace();\n"
+ + " @Document.Id public String getId();\n"
+ + " @Document.LongProperty public int getPrice();\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder(int price) {\n"
+ + " return new GiftBuilder().setPrice(price);\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftImpl implements Gift{\n"
+ + " public GiftImpl(String id, String namespace, int price) {\n"
+ + " this.id = id;\n"
+ + " this.namespace = namespace;\n"
+ + " this.price = price;\n"
+ + " }\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public String getNamespace() { return namespace; }\n"
+ + " public String getId() { return id; }\n"
+ + " public int getPrice() { return price; }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setPrice(int price) {\n"
+ + " this.price = price;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new GiftImpl(this.id, this.namespace, this.price);\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).succeededWithoutWarnings();
+ checkResultContains("Gift.java",
+ "GiftBuilder builder = Gift.getBuilder(getPriceConv)");
+ checkResultContains("Gift.java", "builder.setNamespace(getNamespaceConv)");
+ checkResultContains("Gift.java", "builder.setId(getIdConv)");
+ checkResultContains("Gift.java", "builder.build()");
+ checkEqualsGolden("Gift.java");
+ }
+
+ @Test
+ public void testCreationByBuilderOnly() throws Exception {
+ // Once a builder producer is provided, AppSearch will only use the builder pattern, even
+ // if another creation method is available.
+ Compilation compilation = compile(
+ "@Document\n"
+ + "public class Gift {\n"
+ + " @Document.Namespace String namespace;\n"
+ + " @Document.Id String id;\n"
+ + " @Document.LongProperty int price;\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setPrice(int price) {\n"
+ + " this.price = price;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new Gift();\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).succeededWithoutWarnings();
+ checkResultContains("Gift.java", "GiftBuilder builder = Gift.getBuilder()");
+ checkResultContains("Gift.java", "builder.setNamespace(namespaceConv)");
+ checkResultContains("Gift.java", "builder.setId(idConv)");
+ checkResultContains("Gift.java", "builder.setPrice(priceConv)");
+ checkResultContains("Gift.java", "builder.build()");
+ checkEqualsGolden("Gift.java");
+ }
+
+ @Test
+ public void testCreationByBuilderWithAutoValue() throws IOException {
+ Compilation compilation = compile(
+ "import com.google.auto.value.AutoValue;\n"
+ + "import com.google.auto.value.AutoValue.*;\n"
+ + "@Document\n"
+ + "@AutoValue\n"
+ + "public abstract class Gift {\n"
+ + " @CopyAnnotations @Document.Id abstract String id();\n"
+ + " @CopyAnnotations @Document.Namespace abstract String namespace();\n"
+ + " @CopyAnnotations @Document.LongProperty abstract int price();\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setPrice(int price) {\n"
+ + " this.price = price;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new AutoValue_Gift(id, namespace, price);\n"
+ + " }\n"
+ + "}\n");
+
+ assertThat(compilation).succeededWithoutWarnings();
+ checkResultContains("AutoValue_Gift.java", "GiftBuilder builder = Gift.getBuilder()");
+ checkResultContains("AutoValue_Gift.java", "builder.setNamespace(namespaceConv)");
+ checkResultContains("AutoValue_Gift.java", "builder.setId(idConv)");
+ checkResultContains("AutoValue_Gift.java", "builder.setPrice(priceConv)");
+ checkResultContains("AutoValue_Gift.java", "builder.build()");
+ checkEqualsGolden("AutoValue_Gift.java");
+ }
+
+ @Test
+ public void testCreationByBuilderErrors() throws Exception {
+ // Cannot have multiple builder producer
+ Compilation compilation = compile(
+ "@Document\n"
+ + "public interface Gift {\n"
+ + " @Document.Namespace public String getNamespace();\n"
+ + " @Document.Id public String getId();\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder1() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder2() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftImpl implements Gift{\n"
+ + " public GiftImpl(String id, String namespace) {\n"
+ + " this.id = id;\n"
+ + " this.namespace = namespace;\n"
+ + " }\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public String getNamespace() { return namespace; }\n"
+ + " public String getId() { return id; }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new GiftImpl(this.id, this.namespace);\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).hadErrorContaining("Found duplicated builder producer");
+
+ // Builder producer must be static
+ compilation = compile(
+ "@Document\n"
+ + "public interface Gift {\n"
+ + " @Document.Namespace public String getNamespace();\n"
+ + " @Document.Id public String getId();\n"
+ + " @Document.BuilderProducer GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftImpl implements Gift{\n"
+ + " public GiftImpl(String id, String namespace) {\n"
+ + " this.id = id;\n"
+ + " this.namespace = namespace;\n"
+ + " }\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public String getNamespace() { return namespace; }\n"
+ + " public String getId() { return id; }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new GiftImpl(this.id, this.namespace);\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).hadErrorContaining("Builder producer must be static");
+
+ // Builder producer cannot be private
+ compilation = compile(
+ "@Document\n"
+ + "public interface Gift {\n"
+ + " @Document.Namespace public String getNamespace();\n"
+ + " @Document.Id public String getId();\n"
+ + " @Document.BuilderProducer private static GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftImpl implements Gift{\n"
+ + " public GiftImpl(String id, String namespace) {\n"
+ + " this.id = id;\n"
+ + " this.namespace = namespace;\n"
+ + " }\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public String getNamespace() { return namespace; }\n"
+ + " public String getId() { return id; }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new GiftImpl(this.id, this.namespace);\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).hadErrorContaining("Builder producer cannot be private");
+
+ // Builder producer must be a method
+ compilation = compile(
+ "@Document\n"
+ + "public class Gift {\n"
+ + " @Document.Namespace public String namespace;\n"
+ + " @Document.Id public String id;\n"
+ + " @Document.BuilderProducer int getBuilder;\n"
+ + "}\n");
+ assertThat(compilation).hadErrorContaining(
+ "annotation type not applicable to this kind of declaration");
+
+ // Missing a setter in the builder
+ compilation = compile(
+ "@Document\n"
+ + "public class Gift {\n"
+ + " @Document.Namespace String namespace;\n"
+ + " @Document.Id String id;\n"
+ + " @Document.LongProperty int price;\n"
+ + " @Document.BuilderProducer static GiftBuilder getBuilder() {\n"
+ + " return new GiftBuilder();\n"
+ + " }\n"
+ + "}\n"
+ + "class GiftBuilder {\n"
+ + " private String namespace;\n"
+ + " private String id;\n"
+ + " private int price;\n"
+ + " public GiftBuilder setNamespace(String namespace) {\n"
+ + " this.namespace = namespace;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public GiftBuilder setId(String id) {\n"
+ + " this.id = id;\n"
+ + " return this;\n"
+ + " }\n"
+ + " public Gift build() {\n"
+ + " return new Gift();\n"
+ + " }\n"
+ + "}\n");
+ assertThat(compilation).hadWarningContaining(
+ "Element cannot be written directly because a builder producer is provided, and "
+ + "we failed to find a suitable setter");
+ }
+
private Compilation compile(String classBody) {
return compile("Gift", classBody);
}
diff --git a/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilder.JAVA b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilder.JAVA
new file mode 100644
index 0000000..a2cc31e
--- /dev/null
+++ b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilder.JAVA
@@ -0,0 +1,57 @@
+package com.example.appsearch;
+
+import androidx.appsearch.app.AppSearchSchema;
+import androidx.appsearch.app.DocumentClassFactory;
+import androidx.appsearch.app.GenericDocument;
+import androidx.appsearch.exceptions.AppSearchException;
+import java.lang.Class;
+import java.lang.Override;
+import java.lang.String;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.processing.Generated;
+
+@Generated("androidx.appsearch.compiler.AppSearchCompiler")
+public final class $$__AppSearch__Gift implements DocumentClassFactory<Gift> {
+ public static final String SCHEMA_NAME = "Gift";
+
+ @Override
+ public String getSchemaName() {
+ return SCHEMA_NAME;
+ }
+
+ @Override
+ public AppSearchSchema getSchema() throws AppSearchException {
+ return new AppSearchSchema.Builder(SCHEMA_NAME)
+ .addProperty(new AppSearchSchema.LongPropertyConfig.Builder("price")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE)
+ .build())
+ .build();
+ }
+
+ @Override
+ public List<Class<?>> getDependencyDocumentClasses() throws AppSearchException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public GenericDocument toGenericDocument(Gift document) throws AppSearchException {
+ GenericDocument.Builder<?> builder =
+ new GenericDocument.Builder<>(document.getNamespace(), document.getId(), SCHEMA_NAME);
+ builder.setPropertyLong("price", document.getPrice());
+ return builder.build();
+ }
+
+ @Override
+ public Gift fromGenericDocument(GenericDocument genericDoc) throws AppSearchException {
+ String getIdConv = genericDoc.getId();
+ String getNamespaceConv = genericDoc.getNamespace();
+ int getPriceConv = (int) genericDoc.getPropertyLong("price");
+ GiftBuilder builder = Gift.getBuilder();
+ builder.setNamespace(getNamespaceConv);
+ builder.setId(getIdConv);
+ builder.setPrice(getPriceConv);
+ return builder.build();
+ }
+}
diff --git a/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderOnly.JAVA b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderOnly.JAVA
new file mode 100644
index 0000000..34b0096
--- /dev/null
+++ b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderOnly.JAVA
@@ -0,0 +1,57 @@
+package com.example.appsearch;
+
+import androidx.appsearch.app.AppSearchSchema;
+import androidx.appsearch.app.DocumentClassFactory;
+import androidx.appsearch.app.GenericDocument;
+import androidx.appsearch.exceptions.AppSearchException;
+import java.lang.Class;
+import java.lang.Override;
+import java.lang.String;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.processing.Generated;
+
+@Generated("androidx.appsearch.compiler.AppSearchCompiler")
+public final class $$__AppSearch__Gift implements DocumentClassFactory<Gift> {
+ public static final String SCHEMA_NAME = "Gift";
+
+ @Override
+ public String getSchemaName() {
+ return SCHEMA_NAME;
+ }
+
+ @Override
+ public AppSearchSchema getSchema() throws AppSearchException {
+ return new AppSearchSchema.Builder(SCHEMA_NAME)
+ .addProperty(new AppSearchSchema.LongPropertyConfig.Builder("price")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE)
+ .build())
+ .build();
+ }
+
+ @Override
+ public List<Class<?>> getDependencyDocumentClasses() throws AppSearchException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public GenericDocument toGenericDocument(Gift document) throws AppSearchException {
+ GenericDocument.Builder<?> builder =
+ new GenericDocument.Builder<>(document.namespace, document.id, SCHEMA_NAME);
+ builder.setPropertyLong("price", document.price);
+ return builder.build();
+ }
+
+ @Override
+ public Gift fromGenericDocument(GenericDocument genericDoc) throws AppSearchException {
+ String idConv = genericDoc.getId();
+ String namespaceConv = genericDoc.getNamespace();
+ int priceConv = (int) genericDoc.getPropertyLong("price");
+ GiftBuilder builder = Gift.getBuilder();
+ builder.setNamespace(namespaceConv);
+ builder.setId(idConv);
+ builder.setPrice(priceConv);
+ return builder.build();
+ }
+}
diff --git a/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithAutoValue.JAVA b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithAutoValue.JAVA
new file mode 100644
index 0000000..cb72117
--- /dev/null
+++ b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithAutoValue.JAVA
@@ -0,0 +1,57 @@
+package com.example.appsearch;
+
+import androidx.appsearch.app.AppSearchSchema;
+import androidx.appsearch.app.DocumentClassFactory;
+import androidx.appsearch.app.GenericDocument;
+import androidx.appsearch.exceptions.AppSearchException;
+import java.lang.Class;
+import java.lang.Override;
+import java.lang.String;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.processing.Generated;
+
+@Generated("androidx.appsearch.compiler.AppSearchCompiler")
+public final class $$__AppSearch__AutoValue_Gift implements DocumentClassFactory<Gift> {
+ public static final String SCHEMA_NAME = "Gift";
+
+ @Override
+ public String getSchemaName() {
+ return SCHEMA_NAME;
+ }
+
+ @Override
+ public AppSearchSchema getSchema() throws AppSearchException {
+ return new AppSearchSchema.Builder(SCHEMA_NAME)
+ .addProperty(new AppSearchSchema.LongPropertyConfig.Builder("price")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE)
+ .build())
+ .build();
+ }
+
+ @Override
+ public List<Class<?>> getDependencyDocumentClasses() throws AppSearchException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public GenericDocument toGenericDocument(Gift document) throws AppSearchException {
+ GenericDocument.Builder<?> builder =
+ new GenericDocument.Builder<>(document.namespace(), document.id(), SCHEMA_NAME);
+ builder.setPropertyLong("price", document.price());
+ return builder.build();
+ }
+
+ @Override
+ public Gift fromGenericDocument(GenericDocument genericDoc) throws AppSearchException {
+ String idConv = genericDoc.getId();
+ String namespaceConv = genericDoc.getNamespace();
+ int priceConv = (int) genericDoc.getPropertyLong("price");
+ GiftBuilder builder = Gift.getBuilder();
+ builder.setId(idConv);
+ builder.setNamespace(namespaceConv);
+ builder.setPrice(priceConv);
+ return builder.build();
+ }
+}
diff --git a/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithParameter.JAVA b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithParameter.JAVA
new file mode 100644
index 0000000..1733d8a
--- /dev/null
+++ b/appsearch/compiler/src/test/resources/androidx/appsearch/compiler/goldens/testCreationByBuilderWithParameter.JAVA
@@ -0,0 +1,56 @@
+package com.example.appsearch;
+
+import androidx.appsearch.app.AppSearchSchema;
+import androidx.appsearch.app.DocumentClassFactory;
+import androidx.appsearch.app.GenericDocument;
+import androidx.appsearch.exceptions.AppSearchException;
+import java.lang.Class;
+import java.lang.Override;
+import java.lang.String;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.processing.Generated;
+
+@Generated("androidx.appsearch.compiler.AppSearchCompiler")
+public final class $$__AppSearch__Gift implements DocumentClassFactory<Gift> {
+ public static final String SCHEMA_NAME = "Gift";
+
+ @Override
+ public String getSchemaName() {
+ return SCHEMA_NAME;
+ }
+
+ @Override
+ public AppSearchSchema getSchema() throws AppSearchException {
+ return new AppSearchSchema.Builder(SCHEMA_NAME)
+ .addProperty(new AppSearchSchema.LongPropertyConfig.Builder("price")
+ .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
+ .setIndexingType(AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_NONE)
+ .build())
+ .build();
+ }
+
+ @Override
+ public List<Class<?>> getDependencyDocumentClasses() throws AppSearchException {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public GenericDocument toGenericDocument(Gift document) throws AppSearchException {
+ GenericDocument.Builder<?> builder =
+ new GenericDocument.Builder<>(document.getNamespace(), document.getId(), SCHEMA_NAME);
+ builder.setPropertyLong("price", document.getPrice());
+ return builder.build();
+ }
+
+ @Override
+ public Gift fromGenericDocument(GenericDocument genericDoc) throws AppSearchException {
+ String getIdConv = genericDoc.getId();
+ String getNamespaceConv = genericDoc.getNamespace();
+ int getPriceConv = (int) genericDoc.getPropertyLong("price");
+ GiftBuilder builder = Gift.getBuilder(getPriceConv);
+ builder.setNamespace(getNamespaceConv);
+ builder.setId(getIdConv);
+ return builder.build();
+ }
+}
diff --git a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPlugin.kt b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPlugin.kt
index 4573d0f..ab5bffc 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPlugin.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPlugin.kt
@@ -38,6 +38,7 @@
import androidx.baselineprofile.gradle.utils.camelCase
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.LibraryExtension
+import com.android.build.api.variant.ApplicationVariant
import com.android.build.api.variant.Variant
import org.gradle.api.GradleException
import org.gradle.api.Plugin
@@ -79,9 +80,6 @@
// Manages r8 properties
private val r8Utils = R8Utils(project)
- // Keeps track of the benchmark variants to add src sets to
- private val variantToBlockMap: MutableMap<String, (Variant) -> (Unit)> = mutableMapOf()
-
// Global baseline profile configuration. Note that created here it can be directly consumed
// in the dependencies block.
private val mainBaselineProfileConfiguration = configurationManager.maybeCreate(
@@ -151,14 +149,6 @@
@Suppress("UnstableApiUsage")
override fun onVariants(variant: Variant) {
- // Check if some work was already scheduled for this variant. This is only for benchmark
- // variants that needs src sets to be set but this information is known only after the
- // baseline profile variant has been processed.
- variantToBlockMap[variant.name]?.let { block ->
- block(variant)
- return
- }
-
// Process only the non debuggable build types we previously selected.
if (variant.buildType !in nonDebuggableBuildTypes) return
@@ -390,24 +380,17 @@
// Apply the source sets to the variant.
applySourceSetsFunc(variant)
- // Apply the source sets to the benchmark variant if supported.
- if (supportsFeature(AgpFeature.TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES)) {
+ // Apply the source sets to the benchmark variant if supported and this the
+ // consumer is an app (libraries don't have benchmark type).
+ if (isApplicationModule() &&
+ supportsFeature(AgpFeature.TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES)
+ ) {
- // Note that there is no way to access directly a specific variant and, at this
- // point, we're too late in the configuration flow schedule another onVariants
- // callback. So we store the variants name to modify and we expect to receive
- // it later in this method.
- if (variant.benchmarkVariantName in variantToBlockMap) {
-
- // Note that this cannot happen but checking anyway to avoid possible weird
- // bugs in future.
- throw IllegalStateException(
- """
- Another block was already scheduled for `${variant.benchmarkVariantName}`.
- """.trimIndent()
- )
- }
- variantToBlockMap[variant.benchmarkVariantName] = { v ->
+ // Note that there is no way to access directly a specific variant, so we
+ // schedule a callback for later, when the variant is processed. Note that
+ // because the benchmark build type is created after the baseline profile
+ // build type, its variants will also come after the ones for baseline profile.
+ onVariant(variant.benchmarkVariantName) { v: ApplicationVariant ->
applySourceSetsFunc(v)
}
}
diff --git a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPlugin.kt b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPlugin.kt
index 408c9fc..38f762b 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPlugin.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPlugin.kt
@@ -19,7 +19,8 @@
import androidx.baselineprofile.gradle.configuration.ConfigurationManager
import androidx.baselineprofile.gradle.producer.tasks.CollectBaselineProfileTask
import androidx.baselineprofile.gradle.producer.tasks.InstrumentationTestTaskWrapper
-import androidx.baselineprofile.gradle.utils.AgpFeature
+import androidx.baselineprofile.gradle.utils.AgpFeature.TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES
+import androidx.baselineprofile.gradle.utils.AgpFeature.TEST_VARIANT_SUPPORTS_INSTRUMENTATION_RUNNER_ARGUMENTS
import androidx.baselineprofile.gradle.utils.AgpPlugin
import androidx.baselineprofile.gradle.utils.AgpPluginId
import androidx.baselineprofile.gradle.utils.AndroidTestModuleWrapper
@@ -27,6 +28,10 @@
import androidx.baselineprofile.gradle.utils.BUILD_TYPE_BENCHMARK_PREFIX
import androidx.baselineprofile.gradle.utils.CONFIGURATION_ARTIFACT_TYPE
import androidx.baselineprofile.gradle.utils.CONFIGURATION_NAME_BASELINE_PROFILES
+import androidx.baselineprofile.gradle.utils.INSTRUMENTATION_ARG_ENABLED_RULES
+import androidx.baselineprofile.gradle.utils.INSTRUMENTATION_ARG_ENABLED_RULES_BASELINE_PROFILE
+import androidx.baselineprofile.gradle.utils.INSTRUMENTATION_ARG_ENABLED_RULES_BENCHMARK
+import androidx.baselineprofile.gradle.utils.InstrumentationTestRunnerArgumentsAgp82
import androidx.baselineprofile.gradle.utils.MAX_AGP_VERSION_REQUIRED
import androidx.baselineprofile.gradle.utils.MIN_AGP_VERSION_REQUIRED
import androidx.baselineprofile.gradle.utils.RELEASE
@@ -166,7 +171,7 @@
// Similarly to baseline profile build types we also create benchmark build types if this
// version of AGP has the support for it.
- if (supportsFeature(AgpFeature.TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES)) {
+ if (supportsFeature(TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES)) {
createExtendedBuildTypes(
project = project,
extensionBuildTypes = extension.buildTypes,
@@ -212,27 +217,55 @@
// api so the actual creation of the tasks is postponed to be executed when all the
// agp tasks have been created, using the old api.
- // Creating configurations only for the extended build types.
- if (variant.buildType !in baselineProfileExtendedToOriginalTypeMap.keys) {
- return
+ // If this is a benchmark variant sets the instrumentation runner argument to run only
+ // tests with MacroBenchmark rules.
+ if (variant.buildType in benchmarkExtendedToOriginalTypeMap.keys) {
+ if (supportsFeature(TEST_VARIANT_SUPPORTS_INSTRUMENTATION_RUNNER_ARGUMENTS)) {
+ InstrumentationTestRunnerArgumentsAgp82.set(
+ variant = variant,
+ arguments = listOf(
+ INSTRUMENTATION_ARG_ENABLED_RULES
+ to INSTRUMENTATION_ARG_ENABLED_RULES_BENCHMARK
+ )
+ )
+ }
}
- // Creates the configuration to handle this variant. Note that in the attributes
- // to match the configuration we use the original build type without `nonObfuscated`.
- val configuration = createConfigurationForVariant(
- variant = variant,
- originalBuildTypeName = baselineProfileExtendedToOriginalTypeMap[variant.buildType]
- ?: "",
- )
+ // If this is a baseline profile variant sets the instrumentation runner argument to run
+ // only tests with BaselineProfileRule, create the consumable configurations to expose
+ // the baseline profile artifacts and the tasks to generate the baseline profile artifacts.
+ // Configuration and tasks are created only for baseline profile variants.
+ if (variant.buildType in baselineProfileExtendedToOriginalTypeMap.keys) {
- // Prepares a block to execute later that creates the tasks for this variant
- afterVariants {
- createTasksForVariant(
- project = project,
+ // If this is a benchmark variant sets the instrumentation runner argument to run only
+ // tests with MacroBenchmark rules.
+ if (supportsFeature(TEST_VARIANT_SUPPORTS_INSTRUMENTATION_RUNNER_ARGUMENTS)) {
+ InstrumentationTestRunnerArgumentsAgp82.set(
+ variant = variant,
+ arguments = listOf(
+ INSTRUMENTATION_ARG_ENABLED_RULES
+ to INSTRUMENTATION_ARG_ENABLED_RULES_BASELINE_PROFILE
+ )
+ )
+ }
+
+ // Creates the configuration to handle this variant. Note that in the attributes
+ // to match the configuration we use the original build type without `nonObfuscated`.
+ val configuration = createConfigurationForVariant(
variant = variant,
- configurationName = configuration.name,
- baselineProfileExtension = baselineProfileExtension
+ originalBuildTypeName = baselineProfileExtendedToOriginalTypeMap[variant.buildType]
+ ?: "",
)
+
+ // Prepares a block to execute later that creates the tasks for this variant
+ afterVariants {
+ createTasksForVariant(
+ project = project,
+ variant = variant,
+ configurationName = configuration.name,
+ baselineProfileExtension = baselineProfileExtension
+ )
+ }
}
}
diff --git a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Agp.kt b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Agp.kt
index 1d95920..5a5d75a 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Agp.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Agp.kt
@@ -18,6 +18,8 @@
import com.android.build.api.AndroidPluginVersion
import com.android.build.api.variant.AndroidComponentsExtension
+import com.android.build.api.variant.TestVariant
+import kotlin.reflect.full.memberFunctions
import org.gradle.api.GradleException
import org.gradle.api.Project
@@ -36,9 +38,54 @@
)
}
-internal enum class AgpFeature(internal val version: AndroidPluginVersion) {
+internal enum class AgpFeature(
+ internal val version: AndroidPluginVersion
+) {
TEST_MODULE_SUPPORTS_MULTIPLE_BUILD_TYPES(
AndroidPluginVersion(8, 1, 0).alpha(7)
- );
-}
\ No newline at end of file
+ ),
+ TEST_VARIANT_SUPPORTS_INSTRUMENTATION_RUNNER_ARGUMENTS(
+ AndroidPluginVersion(8, 2, 0).alpha(3)
+ )
+}
+
+/**
+ * This class should be referenced only in AGP 8.2, as the utilized api doesn't exist in
+ * previous versions. Keeping it as a separate class instead of accessing the api directly
+ * allows previous version of AGP to be compatible with this code base.
+ */
+internal object InstrumentationTestRunnerArgumentsAgp82 {
+ fun set(variant: TestVariant, arguments: List<Pair<String, String>>) {
+ arguments.forEach { (k, v) ->
+
+ // What follows here is some reflection code to achieve the following:
+ // `variant.instrumentationRunnerArguments.put(k, v)`
+ // Note that once androidx is on Agp 8.2 this reflection code can be substituted with
+ // the above line.
+
+ val instrumentationRunnerArgumentsFieldMember = variant::class
+ .members
+ .firstOrNull { it.name == "instrumentationRunnerArguments" }
+ ?: throw IllegalStateException(
+ "`TestVariant#instrumentationRunnerArguments` not found."
+ )
+ val instrumentationRunnerArgumentsMap = instrumentationRunnerArgumentsFieldMember
+ .call(variant)
+ ?: throw IllegalStateException(
+ "Failed to acquire `TestVariant#instrumentationRunnerArguments`."
+ )
+ val putMethod = instrumentationRunnerArgumentsMap::class
+ .memberFunctions
+ .firstOrNull {
+ it.name == "put" &&
+ it.parameters[1].name == "key" &&
+ it.parameters[2].name == "value"
+ }
+ ?: throw IllegalStateException(
+ "`instrumentationRunnerArguments` does not have a `put(key, value)` method."
+ )
+ putMethod.call(instrumentationRunnerArgumentsMap, k, v)
+ }
+ }
+}
diff --git a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/AgpPlugin.kt b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/AgpPlugin.kt
index 19d2d8d..cd584ea 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/AgpPlugin.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/AgpPlugin.kt
@@ -53,7 +53,18 @@
protected val logger: Logger
get() = project.logger
- private val afterVariantBlocks = mutableListOf<() -> (Unit)>()
+ // Defines a list of block to be executed after all the onVariants callback
+ private val afterVariantsBlocks = mutableListOf<() -> (Unit)>()
+
+ // Callback schedulers for each variant type
+ private val onVariantBlockScheduler =
+ OnVariantBlockScheduler<Variant>("common")
+ private val onAppVariantBlockScheduler =
+ OnVariantBlockScheduler<ApplicationVariant>("application")
+ private val onLibraryVariantBlockScheduler =
+ OnVariantBlockScheduler<LibraryVariant>("library")
+ private val onTestVariantBlockScheduler =
+ OnVariantBlockScheduler<TestVariant>("test")
fun onApply() {
@@ -89,25 +100,37 @@
testAndroidComponentExtension()?.let { testComponent ->
testComponent.finalizeDsl { onTestFinalizeDsl(it) }
testComponent.beforeVariants { onTestBeforeVariants(it) }
- testComponent.onVariants { onTestVariants(it) }
+ testComponent.onVariants {
+ onTestVariantBlockScheduler.onVariant(it)
+ onTestVariants(it)
+ }
}
applicationAndroidComponentsExtension()?.let { applicationComponent ->
applicationComponent.finalizeDsl { onApplicationFinalizeDsl(it) }
applicationComponent.beforeVariants { onApplicationBeforeVariants(it) }
- applicationComponent.onVariants { onApplicationVariants(it) }
+ applicationComponent.onVariants {
+ onAppVariantBlockScheduler.onVariant(it)
+ onApplicationVariants(it)
+ }
}
libraryAndroidComponentsExtension()?.let { libraryComponent ->
libraryComponent.finalizeDsl { onLibraryFinalizeDsl(it) }
libraryComponent.beforeVariants { onLibraryBeforeVariants(it) }
- libraryComponent.onVariants { onLibraryVariants(it) }
+ libraryComponent.onVariants {
+ onLibraryVariantBlockScheduler.onVariant(it)
+ onLibraryVariants(it)
+ }
}
androidComponentsExtension()?.let { commonComponent ->
commonComponent.finalizeDsl { onFinalizeDsl(commonComponent) }
commonComponent.beforeVariants { onBeforeVariants(it) }
- commonComponent.onVariants { onVariants(it) }
+ commonComponent.onVariants {
+ onVariantBlockScheduler.onVariant(it)
+ onVariants(it)
+ }
}
// Runs the after variants callback that is module type dependent
@@ -143,10 +166,24 @@
applied = true
// Execute all the scheduled variant blocks
- afterVariantBlocks.forEach { it() }
+ afterVariantsBlocks.forEach { it() }
+ afterVariantsBlocks.clear()
// Execute the after variant callback if scheduled.
onAfterVariants()
+
+ // Throw an exception if a scheduled callback was not executed
+ if (afterVariantsBlocks.isNotEmpty()) {
+ throw IllegalStateException(
+ "After variants blocks cannot be scheduled in the `onAfterVariants` callback."
+ )
+ }
+
+ // Ensure no scheduled callbacks is skipped.
+ onAppVariantBlockScheduler.assertBlockMapEmpty()
+ onTestVariantBlockScheduler.assertBlockMapEmpty()
+ onLibraryVariantBlockScheduler.assertBlockMapEmpty()
+ onVariantBlockScheduler.assertBlockMapEmpty()
}
}
@@ -167,7 +204,23 @@
protected fun isGradleSyncRunning() = project.isGradleSyncRunning()
- protected fun afterVariants(block: () -> (Unit)) = afterVariantBlocks.add(block)
+ protected fun afterVariants(block: () -> (Unit)) = afterVariantsBlocks.add(block)
+
+ @JvmName("onVariant")
+ protected fun onVariant(variantName: String, block: (Variant) -> (Unit)) =
+ onVariantBlockScheduler.executeOrScheduleOnVariantBlock(variantName, block)
+
+ @JvmName("onApplicationVariant")
+ protected fun onVariant(variantName: String, block: (ApplicationVariant) -> (Unit)) =
+ onAppVariantBlockScheduler.executeOrScheduleOnVariantBlock(variantName, block)
+
+ @JvmName("onLibraryVariant")
+ protected fun onVariant(variantName: String, block: (LibraryVariant) -> (Unit)) =
+ onLibraryVariantBlockScheduler.executeOrScheduleOnVariantBlock(variantName, block)
+
+ @JvmName("onTestVariant")
+ protected fun onVariant(variantName: String, block: (TestVariant) -> (Unit)) =
+ onTestVariantBlockScheduler.executeOrScheduleOnVariantBlock(variantName, block)
protected fun agpVersion() = project.agpVersion()
@@ -285,3 +338,57 @@
ID_ANDROID_LIBRARY_PLUGIN("com.android.library"),
ID_ANDROID_TEST_PLUGIN("com.android.test")
}
+
+/**
+ * This class is basically an help to manage executing callbacks on a variant. Because of how
+ * agp variants are published, there is no way to directly access it. This class stores a callback
+ * and executes it when the variant is published in the agp onVariants callback.
+ */
+private class OnVariantBlockScheduler<T : Variant>(private val variantTypeName: String) {
+
+ // Stores the current published variants
+ val publishedVariants = mutableMapOf<String, T>()
+
+ // Defines a list of block to be executed for a certain variant when it gets published
+ val onVariantBlocks = mutableMapOf<String, MutableList<(T) -> (Unit)>>()
+
+ fun executeOrScheduleOnVariantBlock(variantName: String, block: (T) -> (Unit)) {
+ if (variantName in publishedVariants) {
+ publishedVariants[variantName]?.let { block(it) }
+ } else {
+ onVariantBlocks.computeIfAbsent(variantName) { mutableListOf() } += block
+ }
+ }
+
+ fun onVariant(variant: T) {
+
+ // This error cannot be thrown because of a user configuration but only an error when
+ // extending AgpPlugin.
+ if (variant.name in publishedVariants) throw IllegalStateException(
+ """
+ A variant was published more than once. This can only happen if the AgpPlugin base
+ class is used and an additional onVariants callback is directly registered with the
+ base components.
+ """.trimIndent()
+ )
+
+ // Stores the published variant
+ publishedVariants[variant.name] = variant
+
+ // Executes all the callbacks previously scheduled for this variant.
+ onVariantBlocks.remove(variant.name)?.apply {
+ forEach { b ->
+ b(variant)
+ }
+ clear()
+ }
+ }
+
+ fun assertBlockMapEmpty() {
+ if (onVariantBlocks.isEmpty()) return
+ val variantNames = "[`${onVariantBlocks.toList().joinToString("`, `") { it.first }}`]"
+ throw IllegalStateException(
+ "Callbacks for $variantTypeName variants $variantNames were not executed."
+ )
+ }
+}
diff --git a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
index 1afa832..923ba03 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
@@ -49,4 +49,9 @@
internal const val RELEASE = "release"
// Kotlin Multiplatform Plugin ID
-internal const val KOTLIN_MULTIPLATFORM_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform"
\ No newline at end of file
+internal const val KOTLIN_MULTIPLATFORM_PLUGIN_ID = "org.jetbrains.kotlin.multiplatform"
+
+// Instrumentation runner arguments
+internal const val INSTRUMENTATION_ARG_ENABLED_RULES = "androidx.benchmark.enabledRules"
+internal const val INSTRUMENTATION_ARG_ENABLED_RULES_BASELINE_PROFILE = "baselineprofile"
+internal const val INSTRUMENTATION_ARG_ENABLED_RULES_BENCHMARK = "macrobenchmark"
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
index 78d35c1..92660a3 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
@@ -66,7 +66,7 @@
""".trimIndent()
@RunWith(Parameterized::class)
-class BaselineProfileAppTargetPluginTest(agpVersion: String) {
+class BaselineProfileAppTargetPluginTest(agpVersion: String?) {
@get:Rule
val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion)
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt
index 4fbe5ec..7f6b19aa 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt
@@ -32,6 +32,7 @@
import androidx.baselineprofile.gradle.utils.require
import androidx.baselineprofile.gradle.utils.requireInOrder
import com.google.common.truth.Truth.assertThat
+import com.google.common.truth.Truth.assertWithMessage
import java.io.File
import org.junit.Rule
import org.junit.Test
@@ -99,7 +100,7 @@
gradleRunner.build("generateBaselineProfile") {
val notFound = it.lines().requireInOrder(
"A baseline profile was generated for the variant `release`:",
- baselineProfileFile("main").absolutePath
+ baselineProfileFile("main").canonicalPath
)
assertThat(notFound).isEmpty()
}
@@ -138,9 +139,9 @@
gradleRunner.build("generateBaselineProfile") {
val notFound = it.lines().requireInOrder(
"A baseline profile was generated for the variant `release`:",
- baselineProfileFile("release").absolutePath,
+ baselineProfileFile("release").canonicalPath,
"A startup profile was generated for the variant `release`:",
- startupProfileFile("release").absolutePath
+ startupProfileFile("release").canonicalPath
)
assertThat(notFound).isEmpty()
}
@@ -198,6 +199,8 @@
projectSetup.producer.setupWithFreeAndPaidFlavors(
freeReleaseProfileLines = listOf(Fixtures.CLASS_1_METHOD_1, Fixtures.CLASS_1),
paidReleaseProfileLines = listOf(Fixtures.CLASS_2_METHOD_1, Fixtures.CLASS_2),
+ freeReleaseStartupProfileLines = listOf(Fixtures.CLASS_3_METHOD_1, Fixtures.CLASS_3),
+ paidReleaseStartupProfileLines = listOf(Fixtures.CLASS_4_METHOD_1, Fixtures.CLASS_4),
)
// Asserts that all per-variant, per-flavor and per-build type tasks are being generated.
@@ -208,16 +211,28 @@
}
gradleRunner.build("generateReleaseBaselineProfile") {
- val expected = arrayOf("freeRelease", "paidRelease").flatMap { variantName ->
- listOf(
+ arrayOf(
+ "freeRelease",
+ "paidRelease"
+ ).forEach { variantName ->
+
+ val notFound = it.lines().requireInOrder(
"A baseline profile was generated for the variant `$variantName`:",
- baselineProfileFile(variantName).absolutePath,
+ baselineProfileFile(variantName).canonicalPath,
"A startup profile was generated for the variant `$variantName`:",
- startupProfileFile(variantName).absolutePath
+ startupProfileFile(variantName).canonicalPath
)
+
+ assertWithMessage(
+ """
+ |The following lines in gradle output were not found:
+ |${notFound.joinToString("\n")}
+ |
+ |Full gradle output:
+ |$it
+ """.trimMargin()
+ ).that(notFound).isEmpty()
}
- val notFound = it.lines().requireInOrder(*expected.toTypedArray())
- assertThat(notFound).isEmpty()
}
assertThat(readBaselineProfileFileContent("freeRelease"))
@@ -607,24 +622,30 @@
projectSetup.producer.setupWithFreeAndPaidFlavors(
freeReleaseProfileLines = listOf(Fixtures.CLASS_1_METHOD_1, Fixtures.CLASS_1),
paidReleaseProfileLines = listOf(Fixtures.CLASS_2_METHOD_1, Fixtures.CLASS_2),
+ freeReleaseStartupProfileLines = listOf(Fixtures.CLASS_3_METHOD_1, Fixtures.CLASS_3),
+ paidReleaseStartupProfileLines = listOf(Fixtures.CLASS_4_METHOD_1, Fixtures.CLASS_4),
)
// Asserts that assembling release triggers generation of profile
- gradleRunner.buildAndAssertThatOutput("assembleFreeRelease", "--dry-run") {
- arrayOf(
- "mergeFreeReleaseBaselineProfile",
- "mergeFreeReleaseArtProfile",
- "compileFreeReleaseArtProfile",
- "assembleFreeRelease"
- ).forEach { contains(":${projectSetup.consumer.name}:$it") }
- doesNotContain(
+ gradleRunner.build("assembleFreeRelease", "--dry-run") {
+
+ // Assert sequence of tasks is found
+ val notFound = it.lines().requireInOrder(
+ ":${projectSetup.consumer.name}:mergeFreeReleaseBaselineProfile",
+ ":${projectSetup.consumer.name}:mergeFreeReleaseArtProfile",
+ ":${projectSetup.consumer.name}:compileFreeReleaseArtProfile",
+ ":${projectSetup.consumer.name}:assembleFreeRelease"
+ )
+ assertThat(notFound).isEmpty()
+
+ // Asserts that the copy task is disabled, because of `saveInSrc` set to false.
+ assertThat(it).doesNotContain(
":${projectSetup.consumer.name}:copyFreeReleaseBaselineProfileIntoSrc"
)
}
// Asserts that the profile is not generated in the src folder
gradleRunner.build("generateFreeReleaseBaselineProfile") {
-
// Note that here the profiles are generated in the intermediates so the output does
// not matter.
val notFound = it.lines().requireInOrder(
@@ -765,7 +786,7 @@
paidReleaseProfileLines = listOf(Fixtures.CLASS_2_METHOD_1, Fixtures.CLASS_2),
)
projectSetup.consumer.setup(
- androidPlugin = ANDROID_LIBRARY_PLUGIN,
+ androidPlugin = ANDROID_APPLICATION_PLUGIN,
flavors = true,
baselineProfileBlock = """
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt
index c411a3d..edb912c2 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt
@@ -19,9 +19,11 @@
import androidx.baselineprofile.gradle.utils.BaselineProfileProjectSetupRule
import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_0_0
import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_1_0
+import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_2_0
import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_ALL
import androidx.baselineprofile.gradle.utils.VariantProfile
import androidx.baselineprofile.gradle.utils.build
+import androidx.baselineprofile.gradle.utils.buildAndAssertThatOutput
import androidx.baselineprofile.gradle.utils.buildAndFailAndAssertThatOutput
import androidx.baselineprofile.gradle.utils.require
import com.google.common.truth.Truth.assertThat
@@ -96,6 +98,60 @@
}
}
+@RunWith(JUnit4::class)
+class BaselineProfileProducerPluginTestWithAgp82 {
+
+ @get:Rule
+ val projectSetup = BaselineProfileProjectSetupRule(
+ forceAgpVersion = TEST_AGP_VERSION_8_2_0
+ )
+
+ private val emptyReleaseVariantProfile = VariantProfile(
+ flavor = null,
+ buildType = "release",
+ profileFileLines = mapOf()
+ )
+
+ @Test
+ fun verifyInstrumentationRunnerArgumentsAreSet() {
+ projectSetup.appTarget.setup()
+ projectSetup.producer.setup(
+ variantProfiles = listOf(emptyReleaseVariantProfile),
+ targetProject = projectSetup.appTarget,
+ additionalGradleCodeBlock = """
+ abstract class PrintArgsTask extends DefaultTask {
+ @Input abstract MapProperty<String, String> getProperties()
+ @TaskAction void exec() {
+ for (Map.Entry<String, String> e : getProperties().get().entrySet()) {
+ println(e.key + "=" + e.value)
+ }
+ }
+ }
+ androidComponents {
+ onVariants(selector()) { variant ->
+ tasks.register(variant.name + "Arguments", PrintArgsTask) { t ->
+ t.properties.set(variant.instrumentationRunnerArguments)
+ }
+ }
+ }
+ """.trimIndent()
+ )
+
+ projectSetup
+ .producer
+ .gradleRunner
+ .buildAndAssertThatOutput("benchmarkReleaseArguments") {
+ contains("androidx.benchmark.enabledRules=macrobenchmark")
+ }
+ projectSetup
+ .producer
+ .gradleRunner
+ .buildAndAssertThatOutput("nonMinifiedReleaseArguments") {
+ contains("androidx.benchmark.enabledRules=baselineprofile")
+ }
+ }
+}
+
@RunWith(Parameterized::class)
class BaselineProfileProducerPluginTest(agpVersion: String?) {
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
index 57ab0d0..220b1d2 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt
@@ -17,9 +17,13 @@
package androidx.baselineprofile.gradle.utils
internal const val TEST_AGP_VERSION_8_0_0 = "8.0.0-beta03"
-internal const val TEST_AGP_VERSION_8_1_0 = "8.1.0-alpha11"
+internal const val TEST_AGP_VERSION_8_1_0 = "8.1.0-beta05"
+internal const val TEST_AGP_VERSION_8_2_0 = "8.2.0-alpha04"
+internal val TEST_AGP_VERSION_CURRENT = null
-internal val TEST_AGP_VERSION_ALL = arrayOf(
+internal val TEST_AGP_VERSION_ALL = arrayOf<String?>(
TEST_AGP_VERSION_8_0_0,
TEST_AGP_VERSION_8_1_0,
+ TEST_AGP_VERSION_8_2_0,
+ TEST_AGP_VERSION_CURRENT,
)
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/TestUtils.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/TestUtils.kt
index 4e1cfb0..cff743e 100644
--- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/TestUtils.kt
+++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/TestUtils.kt
@@ -71,13 +71,13 @@
}
internal fun List<String>.requireInOrder(
- vararg strings: String,
- evaluate: (String, String) -> (Boolean) = { line, nextToFind -> line.startsWith(nextToFind) },
+ vararg toFind: String,
+ predicate: (String, String) -> (Boolean) = { line, nextToFind -> line.startsWith(nextToFind) }
): List<String> {
- val remaining = mutableListOf(*strings)
- for (string in strings) {
- val next = remaining.firstOrNull() ?: break
- if (evaluate(string, next)) remaining.remove(next)
+ var remaining = toFind.filter { it.isNotBlank() }.toMutableList()
+ for (line in this) {
+ val next = remaining.firstOrNull() ?: return emptyList()
+ if (predicate(line, next)) remaining.removeFirst()
}
return remaining
}
@@ -87,13 +87,13 @@
evaluate: (String, String) -> (Boolean) = { line, nextToFind -> line.startsWith(nextToFind) },
): Set<String> {
val remaining = mutableSetOf(*strings)
- for (string in strings) {
- if (remaining.isEmpty()) break
- val iter = remaining.iterator()
- while (iter.hasNext()) iter.next().run {
- if (evaluate(string, this)) {
- iter.remove()
- return@run
+ val iterator = remaining.iterator()
+ while (iterator.hasNext()) {
+ val next = iterator.next()
+ for (string in this) {
+ if (evaluate(string, next)) {
+ iterator.remove()
+ break
}
}
}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/Allocator.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/Allocator.kt
index 0b312c7..f865453 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/Allocator.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/Allocator.kt
@@ -41,4 +41,4 @@
*/
fun allocate(objectsToAllocate: Int) {
Allocator.allocate(objectsToAllocate)
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ArgumentInjectingApplication.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ArgumentInjectingApplication.kt
index 99f775b..7931916 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ArgumentInjectingApplication.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ArgumentInjectingApplication.kt
@@ -63,4 +63,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricNameUtilsTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricNameUtilsTest.kt
index 605df73..9a67dde 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricNameUtilsTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricNameUtilsTest.kt
@@ -45,4 +45,4 @@
"frameTime90thPercentileMs".toOutputMetricName()
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricsContainerTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricsContainerTest.kt
index 81efcfa..fbcffdc 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricsContainerTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/MetricsContainerTest.kt
@@ -104,4 +104,4 @@
container.captureFinished(2) // divide measurements by 2
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/OutputsTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/OutputsTest.kt
index 1ffe3b6..439a395 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/OutputsTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/OutputsTest.kt
@@ -183,4 +183,4 @@
file.delete()
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/PerfettoHelperTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/PerfettoHelperTest.kt
index 7aa7c6e..4df7561 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/PerfettoHelperTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/PerfettoHelperTest.kt
@@ -82,4 +82,4 @@
validateStopAllPerfettoProcesses(unbundled = true)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ShellBehaviorTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ShellBehaviorTest.kt
index 493611c..43be7a1 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ShellBehaviorTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/ShellBehaviorTest.kt
@@ -135,4 +135,4 @@
*/
val psLabelRowRegex = Regex("USER\\s+PID.+NAME\\s*")
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/UserspaceTracingTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/UserspaceTracingTest.kt
index 8b8bfb0..20f264f 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/UserspaceTracingTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/UserspaceTracingTest.kt
@@ -124,4 +124,4 @@
.open(prefix + suffix)
.copyTo(file.outputStream())
return file
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/perfetto/AtraceTagTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/perfetto/AtraceTagTest.kt
index 749c4f5..8377e85 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/perfetto/AtraceTagTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/perfetto/AtraceTagTest.kt
@@ -87,4 +87,4 @@
fun shellSession_unroot() {
Assume.assumeFalse(shellSessionRooted)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Api24.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Api24.kt
index 78184d0..a8577d6 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Api24.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Api24.kt
@@ -31,4 +31,4 @@
internal fun Activity.setSustainedPerformanceMode(enable: Boolean) {
window.setSustainedPerformanceMode(enable)
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkResult.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkResult.kt
index b2119a7..d7ce206 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkResult.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkResult.kt
@@ -23,7 +23,6 @@
*
* Each field directly corresponds to JSON output, though not every JSON object may be
* represented directly here.
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public data class BenchmarkResult(
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkState.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkState.kt
index 152df9f..22c18e8 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkState.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkState.kt
@@ -110,8 +110,8 @@
*/
private val simplifiedTimingOnlyMode = phaseConfig.simplifiedTimingOnlyMode
- /** @suppress */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ @get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ @set:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
var traceUniqueName: String = "benchmark"
internal var warmupRepeats = 0 // number of warmup repeats that occurred
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ConfigurationError.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ConfigurationError.kt
index 1576062..dc95687 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ConfigurationError.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ConfigurationError.kt
@@ -20,8 +20,6 @@
/**
* Represents an error in configuration of a benchmark.
- *
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
data class ConfigurationError(
@@ -79,7 +77,6 @@
)
}
-/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun conditionalError(
hasError: Boolean,
@@ -103,8 +100,6 @@
/**
* Throw an AssertionError if the list contains an unsuppressed error, and return either a
* SuppressionState if errors are suppressed, or null otherwise.
- *
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun List<ConfigurationError>.checkAndGetSuppressionState(
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
index 81cad8c..9b81627 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
@@ -134,4 +134,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ExperimentalBenchmarkStateApi.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ExperimentalBenchmarkStateApi.kt
index 33eca57..8ea9d01 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ExperimentalBenchmarkStateApi.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ExperimentalBenchmarkStateApi.kt
@@ -22,4 +22,4 @@
*/
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
-public annotation class ExperimentalBenchmarkStateApi
\ No newline at end of file
+public annotation class ExperimentalBenchmarkStateApi
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/InstrumentationResults.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/InstrumentationResults.kt
index da6485b..d778a9f 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/InstrumentationResults.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/InstrumentationResults.kt
@@ -42,7 +42,6 @@
/**
* Provides a way to capture all the instrumentation results which needs to be reported.
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
class InstrumentationResultScope(val bundle: Bundle = Bundle()) {
@@ -102,7 +101,6 @@
/**
* Provides way to report additional results via `Instrumentation.sendStatus()` / `addResult()`.
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
object InstrumentationResults {
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/IsolationActivity.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/IsolationActivity.kt
index 0f716e2..14f048c 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/IsolationActivity.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/IsolationActivity.kt
@@ -42,7 +42,6 @@
* - status bar repaints
* - running in background (some cores may be foreground-app only)
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class IsolationActivity : android.app.Activity() {
@@ -196,4 +195,4 @@
override fun onActivityResumed(activity: Activity) {}
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MemInfo.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MemInfo.kt
index b644bbe..d301877 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MemInfo.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MemInfo.kt
@@ -26,4 +26,4 @@
val memTotalLine = memInfo.readLines().firstOrNull { it.matches(Regex("MemTotal:.*")) }
memTotalBytes = memTotalLine?.split(Regex("\\s+"))?.get(1)?.toLong()?.times(1024) ?: -1
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricNameUtils.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricNameUtils.kt
index 438812f..cd1ed74 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricNameUtils.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricNameUtils.kt
@@ -32,4 +32,4 @@
internal fun String.toOutputMetricName() = this
.toSnakeCase()
.replace(Regex("_ns$"), "_nanos")
- .replace(Regex("_ms$"), "_millis")
\ No newline at end of file
+ .replace(Regex("_ms$"), "_millis")
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricResult.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricResult.kt
index 19c34ca..3af2d32 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricResult.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/MetricResult.kt
@@ -24,8 +24,6 @@
/**
* Results for a given metric from a benchmark, including each measurement made and general stats
* for those measurements (min/median/max).
- *
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class MetricResult(
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/PropOverride.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/PropOverride.kt
index bf57294..cb587de 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/PropOverride.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/PropOverride.kt
@@ -56,4 +56,4 @@
Log.d(BenchmarkState.TAG, "resetting $propName to $resetValue")
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ResultWriter.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ResultWriter.kt
index cce06ae..873ead3 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ResultWriter.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ResultWriter.kt
@@ -25,7 +25,6 @@
import java.io.File
import java.io.IOException
-/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public object ResultWriter {
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Shell.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Shell.kt
index bcdd92e..faabcf9 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Shell.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Shell.kt
@@ -37,7 +37,6 @@
* Wrappers for UiAutomation.executeShellCommand to handle compat behavior, and add additional
* features like script execution (with piping), stdin/stderr.
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
object Shell {
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThreadPriority.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThreadPriority.kt
index a4e1cd2..3d1b9f1 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThreadPriority.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThreadPriority.kt
@@ -166,4 +166,4 @@
fun get(): Int {
return Process.getThreadPriority(Process.myTid())
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/UserspaceTracing.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/UserspaceTracing.kt
index 78c224d..5972a77 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/UserspaceTracing.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/UserspaceTracing.kt
@@ -32,7 +32,6 @@
* benchmark) can be added to the trace by calling [commitToTrace], and appending that to the
* trace on-disk.
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
object UserspaceTracing {
@@ -125,7 +124,6 @@
}
}
-/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
inline fun <T> userspaceTrace(label: String, block: () -> T): T {
UserspaceTracing.beginSection(label)
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/AtraceTag.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/AtraceTag.kt
index d897d5d..ecfdba3 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/AtraceTag.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/AtraceTag.kt
@@ -90,4 +90,4 @@
return values().toSet() - supported(api, rooted)
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/ExperimentalPerfettoCaptureApi.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/ExperimentalPerfettoCaptureApi.kt
index 28d3e1f..7981803 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/ExperimentalPerfettoCaptureApi.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/ExperimentalPerfettoCaptureApi.kt
@@ -22,4 +22,4 @@
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
-public annotation class ExperimentalPerfettoCaptureApi
\ No newline at end of file
+public annotation class ExperimentalPerfettoCaptureApi
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCapture.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCapture.kt
index e4e627f..d6c81da3 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCapture.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCapture.kt
@@ -38,7 +38,6 @@
/**
* Enables capturing a Perfetto trace
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@RequiresApi(23)
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoConfig.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoConfig.kt
index 6d6ddb8..a671b1a 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoConfig.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoConfig.kt
@@ -317,8 +317,6 @@
* Config for perfetto.
*
* Eventually, this should be more configurable.
- *
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
internal fun perfettoConfig(
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoHelper.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoHelper.kt
index a2e8f73..dd2f36e 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoHelper.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoHelper.kt
@@ -34,7 +34,6 @@
* PerfettoHelper is used to start and stop the perfetto tracing and move the
* output perfetto trace file to destination folder.
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@RequiresApi(23)
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoTrace.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoTrace.kt
index 411db99..3b98d0f 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoTrace.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoTrace.kt
@@ -172,4 +172,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-darwin-core/src/darwinMain/kotlin/androidx/benchmark/darwin/Placeholder.kt b/benchmark/benchmark-darwin-core/src/darwinMain/kotlin/androidx/benchmark/darwin/Placeholder.kt
index fe52a27..1810071 100644
--- a/benchmark/benchmark-darwin-core/src/darwinMain/kotlin/androidx/benchmark/darwin/Placeholder.kt
+++ b/benchmark/benchmark-darwin-core/src/darwinMain/kotlin/androidx/benchmark/darwin/Placeholder.kt
@@ -16,4 +16,4 @@
package androidx.benchmark.darwin
// empty file to trigger klib creation
-// see: https://youtrack.jetbrains.com/issue/KT-52344
\ No newline at end of file
+// see: https://youtrack.jetbrains.com/issue/KT-52344
diff --git a/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/ArgumentInjectingApplication.kt b/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/ArgumentInjectingApplication.kt
index 9f3e849..0757b67 100644
--- a/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/ArgumentInjectingApplication.kt
+++ b/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/ArgumentInjectingApplication.kt
@@ -52,4 +52,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/BenchmarkRuleNotUsedTest.kt b/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/BenchmarkRuleNotUsedTest.kt
index 4100a22..fc57f68 100644
--- a/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/BenchmarkRuleNotUsedTest.kt
+++ b/benchmark/benchmark-junit4/src/androidTest/java/androidx/benchmark/junit4/BenchmarkRuleNotUsedTest.kt
@@ -37,4 +37,4 @@
@Test
public fun testWithoutMeasurement() {
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/AndroidBenchmarkRunner.kt b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/AndroidBenchmarkRunner.kt
index 9ad9b62..76e1ede 100644
--- a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/AndroidBenchmarkRunner.kt
+++ b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/AndroidBenchmarkRunner.kt
@@ -95,4 +95,4 @@
super.waitForActivitiesToComplete()
super.onDestroy()
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/BenchmarkRule.kt b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/BenchmarkRule.kt
index b0fc66f..024b80e 100644
--- a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/BenchmarkRule.kt
+++ b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/BenchmarkRule.kt
@@ -131,8 +131,7 @@
internal // synthetic access
var applied = false
- /** @suppress */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @get:RestrictTo(RestrictTo.Scope.LIBRARY)
public val scope: Scope = Scope()
/**
@@ -292,4 +291,4 @@
internal inline fun Statement(crossinline evaluate: () -> Unit) = object : Statement() {
override fun evaluate() = evaluate()
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/InstrumentationResultsRunListener.kt b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/InstrumentationResultsRunListener.kt
index db192f8..32837e2 100644
--- a/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/InstrumentationResultsRunListener.kt
+++ b/benchmark/benchmark-junit4/src/main/java/androidx/benchmark/junit4/InstrumentationResultsRunListener.kt
@@ -39,4 +39,4 @@
) {
resultBundle.putAll(InstrumentationResults.runEndResultBundle)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/api/restricted_current.txt b/benchmark/benchmark-macro/api/restricted_current.txt
index 152e73e..32628f3 100644
--- a/benchmark/benchmark-macro/api/restricted_current.txt
+++ b/benchmark/benchmark-macro/api/restricted_current.txt
@@ -35,6 +35,7 @@
}
@RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final class CompilationMode.Interpreted extends androidx.benchmark.macro.CompilationMode {
+ field public static final androidx.benchmark.macro.CompilationMode.Interpreted INSTANCE;
}
@RequiresApi(24) public static final class CompilationMode.None extends androidx.benchmark.macro.CompilationMode {
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkTest.kt
index 337128e..03de19f 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/MacrobenchmarkTest.kt
@@ -159,4 +159,4 @@
companion object {
const val TRACE_LABEL = "MacrobencharkTestTraceLabel"
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/Packages.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/Packages.kt
index 3580685..65ada92 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/Packages.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/Packages.kt
@@ -30,4 +30,4 @@
* Preferably use this app/package if not killing/compiling target.
*/
const val TEST = "androidx.benchmark.macro.test"
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PerfettoTraceRuleTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PerfettoTraceRuleTest.kt
index 6c10384..b8b2819 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PerfettoTraceRuleTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PerfettoTraceRuleTest.kt
@@ -82,4 +82,4 @@
trace(UNIQUE_SLICE_NAME) {}
throw IllegalStateException()
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerMetricTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerMetricTest.kt
index ccefa64..7f1fa9a 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerMetricTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerMetricTest.kt
@@ -171,4 +171,4 @@
threshold = 0.1
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/AudioUnderrunQueryTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/AudioUnderrunQueryTest.kt
index 2588611..d3990f2 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/AudioUnderrunQueryTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/AudioUnderrunQueryTest.kt
@@ -46,4 +46,4 @@
assertEquals(expectedMetrics, subMetrics)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/BatteryDischargeQueryTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/BatteryDischargeQueryTest.kt
index 59411dc..db3bea2 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/BatteryDischargeQueryTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/BatteryDischargeQueryTest.kt
@@ -61,4 +61,4 @@
)
), actualMetrics)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/FrameTimingQueryTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/FrameTimingQueryTest.kt
index 6dfc931..be313c4 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/FrameTimingQueryTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/FrameTimingQueryTest.kt
@@ -153,4 +153,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/PerfettoTraceProcessorTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/PerfettoTraceProcessorTest.kt
index 385b460..e772ff9 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/PerfettoTraceProcessorTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/PerfettoTraceProcessorTest.kt
@@ -274,4 +274,4 @@
getTraceMetrics("android_startup")
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/RowTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/RowTest.kt
index c5007eb..d40ccf9 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/RowTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/perfetto/RowTest.kt
@@ -61,4 +61,4 @@
assertNull(row.nullableDouble("null"))
assertNull(row.nullableLong("null"))
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Api29.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Api29.kt
index 2acdf10..bd8350e 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Api29.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Api29.kt
@@ -23,4 +23,4 @@
internal fun ApplicationInfo.isNotProfileableByShell(): Boolean {
return !isProfileableByShell
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BaselineProfiles.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BaselineProfiles.kt
index 4382f0d..cc75044 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BaselineProfiles.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BaselineProfiles.kt
@@ -28,13 +28,11 @@
import androidx.benchmark.Outputs
import androidx.benchmark.Shell
import androidx.benchmark.userspaceTrace
-import androidx.core.os.BuildCompat
import java.io.File
/**
* Collects baseline profiles using a given [profileBlock], while additionally
* waiting until they are stable.
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@RequiresApi(28)
@@ -237,7 +235,6 @@
* Does not require root.
*/
@RequiresApi(33)
-@androidx.annotation.OptIn(BuildCompat.PrereleaseSdkCheck::class)
private fun extractProfile(packageName: String): String {
val dumpCommand = "pm dump-profiles --dump-classes-and-methods $packageName"
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BatteryCharge.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BatteryCharge.kt
index fbec844..63072a2 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BatteryCharge.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/BatteryCharge.kt
@@ -45,4 +45,4 @@
return false
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/CompilationMode.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/CompilationMode.kt
index 8a73eea..a0dc54a 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/CompilationMode.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/CompilationMode.kt
@@ -29,7 +29,6 @@
import androidx.benchmark.macro.CompilationMode.None
import androidx.benchmark.macro.CompilationMode.Partial
import androidx.benchmark.userspaceTrace
-import androidx.core.os.BuildCompat
import androidx.profileinstaller.ProfileInstallReceiver
import org.junit.AssumptionViolatedException
@@ -73,7 +72,6 @@
* to compile the target app).
*/
sealed class CompilationMode {
- @androidx.annotation.OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
internal fun resetAndCompile(
packageName: String,
allowCompilationSkipping: Boolean = true,
@@ -91,7 +89,7 @@
// The flag `enablePackageReset` can be set to `true` on `userdebug` builds in
// order to speed-up the profile reset. When set to false, reset is performed
// uninstalling and reinstalling the app.
- if (BuildCompat.isAtLeastU() || Shell.isSessionRooted()) {
+ if (Build.VERSION.SDK_INT >= 34 || Shell.isSessionRooted()) {
// Package reset enabled
Log.d(TAG, "Re-compiling $packageName")
// cmd package compile --reset returns a "Success" or a "Failure" to stdout.
@@ -384,7 +382,6 @@
*
* TODO: migrate this to an internal-only flag on [None] instead
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
object Interpreted : CompilationMode() {
@@ -445,7 +442,6 @@
*
* Used by jetpack-internal benchmarks to skip CompilationModes that would self-suppress.
*
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
fun CompilationMode.isSupportedWithVmSettings(): Boolean {
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt
index 43d2172..75d5df8 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Macrobenchmark.kt
@@ -375,8 +375,6 @@
/**
* Run a macrobenchmark with the specified StartupMode
- *
- * @suppress
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun macrobenchmarkWithStartupMode(
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MetricResultExtensions.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MetricResultExtensions.kt
index dee66797..d0add4f 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MetricResultExtensions.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/MetricResultExtensions.kt
@@ -161,4 +161,4 @@
iterationData = values
)
}.sortedBy { it.name }
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerCategoryDisplayLevel.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerCategoryDisplayLevel.kt
index 03060cf..f73c926 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerCategoryDisplayLevel.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerCategoryDisplayLevel.kt
@@ -20,4 +20,4 @@
enum class PowerCategoryDisplayLevel {
BREAKDOWN,
TOTAL
-}
\ No newline at end of file
+}
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 f81127b..4997763 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
@@ -218,4 +218,4 @@
packageName,
"DROP_SHADER_CACHE"
)
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/StartupMode.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/StartupMode.kt
index 12f33d6..6c4574f 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/StartupMode.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/StartupMode.kt
@@ -42,4 +42,4 @@
* [Hot startup documentation](https://developer.android.com/topic/performance/vitals/launch-time#hot)
*/
HOT
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Tag.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Tag.kt
index bf742ce..5536ca7 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Tag.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Tag.kt
@@ -16,4 +16,4 @@
package androidx.benchmark.macro
-internal const val TAG: String = "Benchmark"
\ No newline at end of file
+internal const val TAG: String = "Benchmark"
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/AudioUnderrunQuery.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/AudioUnderrunQuery.kt
index cdb0f15..692175f 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/AudioUnderrunQuery.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/AudioUnderrunQuery.kt
@@ -78,4 +78,4 @@
private const val VAL_VALUE = "value"
private const val VAL_TS = "ts"
private const val EXPECTED_COLUMN_COUNT = 3
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/BatteryDischargeQuery.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/BatteryDischargeQuery.kt
index 00973a0..ffad47c 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/BatteryDischargeQuery.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/BatteryDischargeQuery.kt
@@ -70,4 +70,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/FrameTimingQuery.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/FrameTimingQuery.kt
index d0446bc..624fe55 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/FrameTimingQuery.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/FrameTimingQuery.kt
@@ -237,4 +237,4 @@
map { frame -> frame.get(subMetric) }
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/PowerQuery.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/PowerQuery.kt
index b1f47b9..5f1d9c9 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/PowerQuery.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/PowerQuery.kt
@@ -195,4 +195,4 @@
"Missing power categories in categoryToSubsystem"
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StartupTimingQuery.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StartupTimingQuery.kt
index 4ac199d..13876b5 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StartupTimingQuery.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StartupTimingQuery.kt
@@ -196,4 +196,4 @@
fullDisplayTs = reportFullyDrawnEndTs,
)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StringHelper.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StringHelper.kt
index cb268cc..667a76c 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StringHelper.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/StringHelper.kt
@@ -37,4 +37,4 @@
}
}
return case
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/server/PerfettoHttpServer.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/server/PerfettoHttpServer.kt
index e62dbec..2f74b4c 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/server/PerfettoHttpServer.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/perfetto/server/PerfettoHttpServer.kt
@@ -300,4 +300,4 @@
@DoNotInline
fun isCleartextTrafficPermittedForLocalhost() =
NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted("localhost")
-}
\ No newline at end of file
+}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/perfetto/Slice.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/perfetto/Slice.kt
index 1a45d7d..fd823e9 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/perfetto/Slice.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/perfetto/Slice.kt
@@ -39,4 +39,4 @@
internal fun Sequence<Row>.toSlices(): List<Slice> =
map {
Slice(name = it.string("name"), ts = it.long("ts"), dur = it.long("dur"))
- }.toList()
\ No newline at end of file
+ }.toList()
diff --git a/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/Adb.kt b/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/Adb.kt
index e78a7a0..813406f 100644
--- a/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/Adb.kt
+++ b/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/Adb.kt
@@ -101,4 +101,4 @@
return ProcessResult(process.exitValue(), stdout, stderr)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/java/androidx/benchmark/integration/baselineprofile/flavors/producer/MacrobenchmarkTest.kt b/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/java/androidx/benchmark/integration/baselineprofile/flavors/producer/MacrobenchmarkTest.kt
new file mode 100644
index 0000000..d9d8bb3
--- /dev/null
+++ b/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/java/androidx/benchmark/integration/baselineprofile/flavors/producer/MacrobenchmarkTest.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.benchmark.integration.baselineprofile.flavors.producer
+
+import androidx.benchmark.macro.CompilationMode
+import androidx.benchmark.macro.StartupMode
+import androidx.benchmark.macro.StartupTimingMetric
+import androidx.benchmark.macro.junit4.MacrobenchmarkRule
+import androidx.test.filters.LargeTest
+import org.junit.Rule
+import org.junit.Test
+
+@LargeTest
+class MacrobenchmarkTest {
+
+ @get:Rule
+ val benchmarkRule = MacrobenchmarkRule()
+
+ @Test
+ fun startupMacrobenchmark() = benchmarkRule.measureRepeated(
+ packageName = PACKAGE_NAME,
+ metrics = listOf(StartupTimingMetric()),
+ compilationMode = CompilationMode.DEFAULT,
+ iterations = 10,
+ startupMode = StartupMode.COLD,
+ setupBlock = { pressHome() },
+ measureBlock = { startActivityAndWait { } }
+ )
+
+ companion object {
+ private const val PACKAGE_NAME =
+ "androidx.benchmark.integration.baselineprofile.flavors.consumer.free"
+ private const val ACTION =
+ "androidx.benchmark.integration.baselineprofile.flavors.consumer.free.EMPTY_ACTIVITY"
+ }
+}
diff --git a/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/ArgumentInjectingApplication.kt b/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/ArgumentInjectingApplication.kt
index 6059c07..9b49833 100644
--- a/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/ArgumentInjectingApplication.kt
+++ b/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/ArgumentInjectingApplication.kt
@@ -46,4 +46,4 @@
putString("androidx.benchmark.profiling.mode", "none") // noop, tests "none" arg parsing
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/DryRunBenchmark.kt b/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/DryRunBenchmark.kt
index ffed91e..d0454fb 100644
--- a/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/DryRunBenchmark.kt
+++ b/benchmark/integration-tests/dry-run-benchmark/src/androidTest/java/androidx/benchmark/integration/dryrun/benchmark/DryRunBenchmark.kt
@@ -51,4 +51,4 @@
// dry run mode always runs 1 loops
assertEquals(1, iterationCount)
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/AudioActivity.kt b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/AudioActivity.kt
index 752e908..0fd36d9 100644
--- a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/AudioActivity.kt
+++ b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/AudioActivity.kt
@@ -97,4 +97,4 @@
return buffer
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/NoOpWorker.kt b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/NoOpWorker.kt
index 37e868f..6a7bf51 100644
--- a/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/NoOpWorker.kt
+++ b/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/benchmark/integration/macrobenchmark/target/NoOpWorker.kt
@@ -28,4 +28,4 @@
override suspend fun doWork(): Result {
return Result.success()
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/AudioUnderrunBenchmark.kt b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/AudioUnderrunBenchmark.kt
index 3da5875..80ae058 100644
--- a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/AudioUnderrunBenchmark.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/AudioUnderrunBenchmark.kt
@@ -72,4 +72,4 @@
private const val ACTION = "$PACKAGE_NAME.AUDIO_ACTIVITY"
private const val DURATION_MS = 2000
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/SingleColorPowerBenchmark.kt b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/SingleColorPowerBenchmark.kt
index daff320..96a9ea5 100644
--- a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/SingleColorPowerBenchmark.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/SingleColorPowerBenchmark.kt
@@ -92,4 +92,4 @@
private const val ACTION = "$PACKAGE_NAME.SINGLE_COLOR_ACTIVITY"
private const val DURATION_MS = 5000
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt
index abd49e50..fcf6522 100644
--- a/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt
+++ b/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt
@@ -222,4 +222,4 @@
private const val ACTION = "$PACKAGE_NAME.BACKGROUND_WORK_ACTIVITY"
private const val DURATION_MS = 5000
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/ArgumentInjectingApplication.kt b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/ArgumentInjectingApplication.kt
index f4317b0..a3f0914 100644
--- a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/ArgumentInjectingApplication.kt
+++ b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/ArgumentInjectingApplication.kt
@@ -42,4 +42,4 @@
putString("androidx.benchmark.startupMode.enable", "true")
}
}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/EmptyTest.kt b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/EmptyTest.kt
index 675ff5e..6d2a332 100644
--- a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/EmptyTest.kt
+++ b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/EmptyTest.kt
@@ -25,4 +25,4 @@
*/
@Test
fun emptyTest() {}
-}
\ No newline at end of file
+}
diff --git a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/StartupBenchmark.kt b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/StartupBenchmark.kt
index 1e0525f..7802afc 100644
--- a/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/StartupBenchmark.kt
+++ b/benchmark/integration-tests/startup-benchmark/src/androidTest/java/androidx/benchmark/integration/startup/benchmark/StartupBenchmark.kt
@@ -48,4 +48,4 @@
// startup mode always runs 10 loops
assertEquals(10, iterationCount)
}
-}
\ No newline at end of file
+}
diff --git a/biometric/biometric-ktx/src/main/java/androidx/biometric/auth/CredentialAuthExtensions.kt b/biometric/biometric-ktx/src/main/java/androidx/biometric/auth/CredentialAuthExtensions.kt
index d37eb21..e3a8124 100755
--- a/biometric/biometric-ktx/src/main/java/androidx/biometric/auth/CredentialAuthExtensions.kt
+++ b/biometric/biometric-ktx/src/main/java/androidx/biometric/auth/CredentialAuthExtensions.kt
@@ -204,4 +204,4 @@
description: CharSequence?
): CredentialAuthPrompt = CredentialAuthPrompt.Builder(title)
.apply { description?.let { setDescription(it) } }
- .build()
\ No newline at end of file
+ .build()
diff --git a/biometric/biometric/src/main/res/values-uk/strings.xml b/biometric/biometric/src/main/res/values-uk/strings.xml
index 66996ca..85ac863 100644
--- a/biometric/biometric/src/main/res/values-uk/strings.xml
+++ b/biometric/biometric/src/main/res/values-uk/strings.xml
@@ -31,11 +31,11 @@
<string name="generic_error_no_keyguard" msgid="1807436368654974044">"Пристрій не підтримує PIN-код, ключ або пароль."</string>
<string name="fingerprint_dialog_icon_description" msgid="5462024216548165325">"Значок відбитка пальця"</string>
<string name="use_fingerprint_label" msgid="6961788485681412417">"Використовувати відбиток пальця"</string>
- <string name="use_face_label" msgid="6533512708069459542">"Використовувати фейсконтроль"</string>
+ <string name="use_face_label" msgid="6533512708069459542">"Використовувати фейс-контроль"</string>
<string name="use_biometric_label" msgid="6524145989441579428">"Використовувати біометрію"</string>
<string name="use_screen_lock_label" msgid="5459869335976243512">"Використовувати дані для розблокування екрана"</string>
<string name="use_fingerprint_or_screen_lock_label" msgid="7577690399303139443">"Використовувати відбиток пальця або дані для розблокування екрана"</string>
- <string name="use_face_or_screen_lock_label" msgid="2116180187159450292">"Використовувати фейсконтроль або дані для розблокування екрана"</string>
+ <string name="use_face_or_screen_lock_label" msgid="2116180187159450292">"Використовувати фейс-контроль або дані для розблокування екрана"</string>
<string name="use_biometric_or_screen_lock_label" msgid="5385448280139639016">"Використовувати біометрію або дані для розблокування екрана"</string>
<string name="fingerprint_prompt_message" msgid="7449360011861769080">"Щоб продовжити, скористайтеся відбитком пальця"</string>
<string name="face_prompt_message" msgid="2282389249605674226">"Щоб продовжити, скористайтеся фейсконтролем"</string>
diff --git a/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/BiometricPromptEnrolledTest.kt b/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/BiometricPromptEnrolledTest.kt
index 86a3a81..2faa940 100644
--- a/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/BiometricPromptEnrolledTest.kt
+++ b/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/BiometricPromptEnrolledTest.kt
@@ -151,4 +151,4 @@
onView(withId(R.id.allow_device_credential_checkbox)).perform(click())
testBiometricOnlyAuth_SendsError_WhenActivityBackgrounded()
}
-}
\ No newline at end of file
+}
diff --git a/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/TestUtils.kt b/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/TestUtils.kt
index 6b82eaa..a7b40a2 100644
--- a/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/TestUtils.kt
+++ b/biometric/integration-tests/testapp/src/androidTest/java/androidx/biometric/integration/testapp/TestUtils.kt
@@ -103,4 +103,4 @@
internal fun navigateToHomeScreen(device: UiDevice) {
device.pressHome()
device.waitForIdle(IDLE_TIMEOUT_MS)
-}
\ No newline at end of file
+}
diff --git a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/AuthPromptTestActivity.kt b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/AuthPromptTestActivity.kt
index ef20273..ac89d6f 100755
--- a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/AuthPromptTestActivity.kt
+++ b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/AuthPromptTestActivity.kt
@@ -311,4 +311,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/CryptoUtils.kt b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/CryptoUtils.kt
index 1eb141d..a9da761 100644
--- a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/CryptoUtils.kt
+++ b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/CryptoUtils.kt
@@ -177,4 +177,4 @@
fun buildKeyGenParameterSpec(builder: KeyGenParameterSpec.Builder): KeyGenParameterSpec {
return builder.build()
}
-}
\ No newline at end of file
+}
diff --git a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/LoggingUtils.kt b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/LoggingUtils.kt
index 8ba8acb..c74ec4e 100644
--- a/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/LoggingUtils.kt
+++ b/biometric/integration-tests/testapp/src/main/java/androidx/biometric/integration/testapp/LoggingUtils.kt
@@ -64,4 +64,4 @@
@SuppressLint("SetTextI18n")
internal fun TextView.prependLogMessage(message: CharSequence) {
text = "$message\n$text"
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricAdvertiseTest.kt b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricAdvertiseTest.kt
index 2a60f6f..8fb6552 100644
--- a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricAdvertiseTest.kt
+++ b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricAdvertiseTest.kt
@@ -63,4 +63,4 @@
Assert.assertEquals(AdvertiseResult.ADVERTISE_FAILED_DATA_TOO_LARGE, result)
}
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricScanTest.kt b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricScanTest.kt
index b1201c1..283bc1d 100644
--- a/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricScanTest.kt
+++ b/bluetooth/bluetooth-testing/src/test/kotlin/androidx/bluetooth/testing/RobolectricScanTest.kt
@@ -18,6 +18,7 @@
import android.content.Context
import androidx.bluetooth.BluetoothLe
+import androidx.bluetooth.ScanFilter
import junit.framework.TestCase.fail
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.test.runTest
@@ -40,7 +41,7 @@
fun scanTest() = runTest {
try {
withTimeout(TIMEOUT_MS) {
- bluetoothLe.scan(listOf()).collect {
+ bluetoothLe.scan(listOf(ScanFilter())).collect {
// Should not find any device
fail()
}
@@ -50,4 +51,4 @@
// expected
}
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/api/current.txt b/bluetooth/bluetooth/api/current.txt
index 319528d..c549d1d 100644
--- a/bluetooth/bluetooth/api/current.txt
+++ b/bluetooth/bluetooth/api/current.txt
@@ -51,7 +51,7 @@
public final class BluetoothLe {
ctor public BluetoothLe(android.content.Context context);
method @RequiresPermission("android.permission.BLUETOOTH_ADVERTISE") public kotlinx.coroutines.flow.Flow<java.lang.Integer> advertise(androidx.bluetooth.AdvertiseParams advertiseParams);
- method @RequiresPermission("android.permission.BLUETOOTH_SCAN") public kotlinx.coroutines.flow.Flow<androidx.bluetooth.ScanResult> scan(optional java.util.List<android.bluetooth.le.ScanFilter> filters);
+ method @RequiresPermission("android.permission.BLUETOOTH_SCAN") public kotlinx.coroutines.flow.Flow<androidx.bluetooth.ScanResult> scan(optional java.util.List<androidx.bluetooth.ScanFilter> filters);
}
public final class ScanFilter {
diff --git a/bluetooth/bluetooth/api/restricted_current.txt b/bluetooth/bluetooth/api/restricted_current.txt
index 319528d..c549d1d 100644
--- a/bluetooth/bluetooth/api/restricted_current.txt
+++ b/bluetooth/bluetooth/api/restricted_current.txt
@@ -51,7 +51,7 @@
public final class BluetoothLe {
ctor public BluetoothLe(android.content.Context context);
method @RequiresPermission("android.permission.BLUETOOTH_ADVERTISE") public kotlinx.coroutines.flow.Flow<java.lang.Integer> advertise(androidx.bluetooth.AdvertiseParams advertiseParams);
- method @RequiresPermission("android.permission.BLUETOOTH_SCAN") public kotlinx.coroutines.flow.Flow<androidx.bluetooth.ScanResult> scan(optional java.util.List<android.bluetooth.le.ScanFilter> filters);
+ method @RequiresPermission("android.permission.BLUETOOTH_SCAN") public kotlinx.coroutines.flow.Flow<androidx.bluetooth.ScanResult> scan(optional java.util.List<androidx.bluetooth.ScanFilter> filters);
}
public final class ScanFilter {
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothAddressTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothAddressTest.kt
index e2984ae..beaa6f1 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothAddressTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothAddressTest.kt
@@ -80,4 +80,4 @@
BluetoothAddress(invalidAddress, BluetoothAddress.ADDRESS_TYPE_UNKNOWN)
}
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothDeviceTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothDeviceTest.kt
index f182513..98eeb61 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothDeviceTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/BluetoothDeviceTest.kt
@@ -60,4 +60,4 @@
assertEquals(bluetoothDevice.bondState, fwkBluetoothDevice.bondState)
assertEquals(bluetoothDevice.name, fwkBluetoothDevice.name)
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattCharacteristicTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattCharacteristicTest.kt
index 0dbc5e5..5ec0dbd 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattCharacteristicTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattCharacteristicTest.kt
@@ -99,4 +99,4 @@
Assert.assertEquals(properties, characteristic.properties)
Assert.assertEquals(permissions, characteristic.permissions)
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattServiceTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattServiceTest.kt
index 319e72d..bd40614 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattServiceTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/GattServiceTest.kt
@@ -17,7 +17,7 @@
package androidx.bluetooth
import android.bluetooth.BluetoothGattCharacteristic as FwkBluetoothGattCharacteristic
-import android.bluetooth.BluetoothGattService as FwkBluetoothGattService
+import android.bluetooth.BluetoothGattService as FwkGattService
import android.bluetooth.BluetoothGattService.SERVICE_TYPE_PRIMARY
import java.util.UUID
import org.junit.Assert.assertEquals
@@ -32,19 +32,19 @@
@Test
fun constructorWithFwkInstance() {
val serviceUuid = UUID.randomUUID()
- val fwkBluetoothGattService = FwkBluetoothGattService(serviceUuid, SERVICE_TYPE_PRIMARY)
+ val fwkGattService = FwkGattService(serviceUuid, SERVICE_TYPE_PRIMARY)
val charUuid1 = UUID.randomUUID()
val fwkCharacteristic1 = FwkBluetoothGattCharacteristic(charUuid1, 0, 0)
- fwkBluetoothGattService.addCharacteristic(fwkCharacteristic1)
+ fwkGattService.addCharacteristic(fwkCharacteristic1)
val charUuid2 = UUID.randomUUID()
val fwkCharacteristic2 = FwkBluetoothGattCharacteristic(charUuid2, 0, 0)
- fwkBluetoothGattService.addCharacteristic(fwkCharacteristic2)
+ fwkGattService.addCharacteristic(fwkCharacteristic2)
- val gattService = GattService(fwkBluetoothGattService)
+ val gattService = GattService(fwkGattService)
- assertEquals(fwkBluetoothGattService.uuid, gattService.uuid)
+ assertEquals(fwkGattService.uuid, gattService.uuid)
assertEquals(2, gattService.characteristics.size)
assertEquals(charUuid1, gattService.characteristics[0].uuid)
assertEquals(charUuid2, gattService.characteristics[1].uuid)
@@ -76,4 +76,4 @@
characteristics.add(char3)
assertEquals(2, gattService.characteristics.size)
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanFilterTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanFilterTest.kt
index 0280ca3..920eb02 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanFilterTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanFilterTest.kt
@@ -134,4 +134,4 @@
ScanFilter(serviceUuidMask = serviceUuidMask)
}
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanResultTest.kt b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanResultTest.kt
index b687e5a..9df2442 100644
--- a/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanResultTest.kt
+++ b/bluetooth/bluetooth/src/androidTest/java/androidx/bluetooth/ScanResultTest.kt
@@ -64,4 +64,4 @@
assertEquals(scanResult.serviceUuids, emptyList<UUID>())
assertEquals(scanResult.getServiceData(serviceUuid), null)
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/AttributeMap.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/AttributeMap.kt
new file mode 100644
index 0000000..b035666
--- /dev/null
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/AttributeMap.kt
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth
+
+import android.bluetooth.BluetoothGattCharacteristic as FwkCharacteristic
+import android.bluetooth.BluetoothGattService as FwkService
+
+internal class AttributeMap {
+ val services: MutableMap<FwkService, GattService> = mutableMapOf()
+ val characteristics: MutableMap<FwkCharacteristic, GattCharacteristic> =
+ mutableMapOf()
+ fun updateWithFrameworkServices(services: List<FwkService>) {
+ this.services.clear()
+ characteristics.clear()
+
+ services.forEach { serv ->
+ this.services[serv] = GattService(serv)
+ serv.characteristics.forEach { char ->
+ characteristics[char] = GattCharacteristic(char)
+ }
+ }
+ }
+
+ fun updateWithServices(services: List<GattService>) {
+ this.services.clear()
+ characteristics.clear()
+
+ services.forEach { serv ->
+ this.services[serv.fwkService] = serv
+ serv.characteristics.forEach { char ->
+ characteristics[char.fwkCharacteristic] = char
+ }
+ }
+ }
+
+ fun getServices(): List<GattService> {
+ return services.values.toList()
+ }
+
+ fun fromFwkService(service: FwkService): GattService? {
+ return services[service]
+ }
+
+ fun fromFwkCharacteristic(characteristic: FwkCharacteristic): GattCharacteristic? {
+ return characteristics[characteristic]
+ }
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothAddress.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothAddress.kt
index ce16ba3..c289bdb 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothAddress.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothAddress.kt
@@ -68,4 +68,4 @@
else -> ADDRESS_TYPE_UNKNOWN
}
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothDevice.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothDevice.kt
index 3ee9cb4..2cc4340 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothDevice.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothDevice.kt
@@ -57,4 +57,4 @@
)
val bondState: Int
get() = fwkDevice.bondState
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothLe.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothLe.kt
index a3ee79b..1c06b6e 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothLe.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/BluetoothLe.kt
@@ -21,7 +21,6 @@
import android.bluetooth.le.AdvertiseData
import android.bluetooth.le.AdvertiseSettings
import android.bluetooth.le.ScanCallback
-import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanResult as FwkScanResult
import android.bluetooth.le.ScanSettings
import android.content.Context
@@ -47,85 +46,85 @@
}
private val bluetoothManager =
- context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
+ context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?
+ private val bluetoothAdapter = bluetoothManager?.adapter
+ private val serverImpl = GattServerImpl(context)
/**
- * Returns a [Flow] to start Bluetooth LE Advertising. When the flow is successfully collected,
+ * Returns a _cold_ [Flow] to start Bluetooth LE Advertising. When the flow is successfully collected,
* the operation status [AdvertiseResult] will be delivered via the
* flow [kotlinx.coroutines.channels.Channel].
*
* @param advertiseParams [AdvertiseParams] for Bluetooth LE advertising.
- * @return A [Flow] with [AdvertiseResult] status in the data stream.
+ * @return A _cold_ [Flow] with [AdvertiseResult] status in the data stream.
*/
@RequiresPermission("android.permission.BLUETOOTH_ADVERTISE")
- fun advertise(advertiseParams: AdvertiseParams): Flow<Int> =
- callbackFlow {
- val callback = object : AdvertiseCallback() {
- override fun onStartFailure(errorCode: Int) {
- Log.d(TAG, "onStartFailure() called with: errorCode = $errorCode")
+ fun advertise(advertiseParams: AdvertiseParams): Flow<Int> = callbackFlow {
+ val callback = object : AdvertiseCallback() {
+ override fun onStartFailure(errorCode: Int) {
+ Log.d(TAG, "onStartFailure() called with: errorCode = $errorCode")
- when (errorCode) {
- AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE ->
- trySend(AdvertiseResult.ADVERTISE_FAILED_DATA_TOO_LARGE)
+ when (errorCode) {
+ AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE ->
+ trySend(AdvertiseResult.ADVERTISE_FAILED_DATA_TOO_LARGE)
- AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED ->
- trySend(AdvertiseResult.ADVERTISE_FAILED_FEATURE_UNSUPPORTED)
+ AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED ->
+ trySend(AdvertiseResult.ADVERTISE_FAILED_FEATURE_UNSUPPORTED)
- AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR ->
- trySend(AdvertiseResult.ADVERTISE_FAILED_INTERNAL_ERROR)
+ AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR ->
+ trySend(AdvertiseResult.ADVERTISE_FAILED_INTERNAL_ERROR)
- AdvertiseCallback.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS ->
- trySend(AdvertiseResult.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS)
- }
- }
-
- override fun onStartSuccess(settingsInEffect: AdvertiseSettings) {
- Log.d(TAG, "onStartSuccess() called with: settingsInEffect = $settingsInEffect")
-
- trySend(AdvertiseResult.ADVERTISE_STARTED)
+ AdvertiseCallback.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS ->
+ trySend(AdvertiseResult.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS)
}
}
- val bluetoothAdapter = bluetoothManager.adapter
- val bleAdvertiser = bluetoothAdapter.bluetoothLeAdvertiser
+ override fun onStartSuccess(settingsInEffect: AdvertiseSettings) {
+ Log.d(TAG, "onStartSuccess() called with: settingsInEffect = $settingsInEffect")
- val advertiseSettings = with(AdvertiseSettings.Builder()) {
- advertiseParams.isConnectable.let { setConnectable(it) }
- advertiseParams.timeoutMillis.let { setTimeout(it) }
- // TODO(ofy) Add when AndroidX is targeting Android U
-// advertiseParams.isDiscoverable.let { setDiscoverable(it) }
- build()
- }
-
- val advertiseData = with(AdvertiseData.Builder()) {
- advertiseParams.shouldIncludeDeviceName.let { setIncludeDeviceName(it) }
- advertiseParams.serviceData.forEach {
- addServiceData(ParcelUuid(it.key), it.value)
- }
- advertiseParams.manufacturerData.forEach {
- addManufacturerData(it.key, it.value)
- }
- advertiseParams.serviceUuids.forEach {
- addServiceUuid(ParcelUuid(it))
- }
- build()
- }
-
- Log.d(TAG, "bleAdvertiser.startAdvertising($advertiseSettings, $advertiseData) called")
- bleAdvertiser.startAdvertising(advertiseSettings, advertiseData, callback)
-
- awaitClose {
- Log.d(TAG, "bleAdvertiser.stopAdvertising() called")
- bleAdvertiser.stopAdvertising(callback)
+ trySend(AdvertiseResult.ADVERTISE_STARTED)
}
}
+ val bleAdvertiser = bluetoothAdapter?.bluetoothLeAdvertiser
+
+ val advertiseSettings = with(AdvertiseSettings.Builder()) {
+ setConnectable(advertiseParams.isConnectable)
+ setTimeout(advertiseParams.timeoutMillis)
+ // TODO(b/290697177) Add when AndroidX is targeting Android U
+// setDiscoverable(advertiseParams.isDiscoverable)
+ build()
+ }
+
+ val advertiseData = with(AdvertiseData.Builder()) {
+ setIncludeDeviceName(advertiseParams.shouldIncludeDeviceName)
+ advertiseParams.serviceData.forEach {
+ addServiceData(ParcelUuid(it.key), it.value)
+ }
+ advertiseParams.manufacturerData.forEach {
+ addManufacturerData(it.key, it.value)
+ }
+ advertiseParams.serviceUuids.forEach {
+ addServiceUuid(ParcelUuid(it))
+ }
+ build()
+ }
+
+ Log.d(TAG, "bleAdvertiser.startAdvertising($advertiseSettings, $advertiseData) called")
+ bleAdvertiser?.startAdvertising(advertiseSettings, advertiseData, callback)
+
+ awaitClose {
+ Log.d(TAG, "bleAdvertiser.stopAdvertising() called")
+ bleAdvertiser?.stopAdvertising(callback)
+ }
+ }
+
/**
- * Returns a cold [Flow] to start Bluetooth LE scanning. Scanning is used to
+ * Returns a _cold_ [Flow] to start Bluetooth LE scanning. Scanning is used to
* discover advertising devices nearby.
*
* @param filters [ScanFilter]s for finding exact Bluetooth LE devices.
*
- * @return A cold [Flow] of [ScanResult] that matches with the given scan filter.
+ * @return A _cold_ [Flow] of [ScanResult] that matches with the given scan filter.
*/
@RequiresPermission("android.permission.BLUETOOTH_SCAN")
fun scan(filters: List<ScanFilter> = emptyList()): Flow<ScanResult> = callbackFlow {
@@ -140,14 +139,12 @@
}
}
- val bluetoothAdapter = bluetoothManager.adapter
val bleScanner = bluetoothAdapter?.bluetoothLeScanner
+ val fwkFilters = filters.map { it.fwkScanFilter }
val scanSettings = ScanSettings.Builder().build()
-
- bleScanner?.startScan(filters, scanSettings, callback)
+ bleScanner?.startScan(fwkFilters, scanSettings, callback)
awaitClose {
- Log.d(TAG, "awaitClose() called")
bleScanner?.stopScan(callback)
}
}
@@ -178,9 +175,6 @@
*
* @param characteristic a remote [GattCharacteristic] to read
* @return The value of the characteristic
- *
- * @throws IllegalArgumentException If [GattCharacteristic#PROPERTY_READ] is not set
- * for the characteristic.
*/
suspend fun readCharacteristic(characteristic: GattCharacteristic):
Result<ByteArray>
@@ -194,9 +188,6 @@
* [GattCharacteristic.WRITE_TYPE_NO_RESPONSE], or
* [GattCharacteristic.WRITE_TYPE_SIGNED].
* @return the result of the write operation
- *
- * @throws IllegalArgumentException If [GattCharacteristic#PROPERTY_WRITE] is not set
- * for the characteristic.
*/
suspend fun writeCharacteristic(
characteristic: GattCharacteristic,
@@ -224,12 +215,92 @@
*
* @param device a [BluetoothDevice] to connect to
* @param block a block of code that is invoked after the connection is made.
+ *
+ * @return a result returned by the given block if the connection was successfully finished
+ * or an failure with the corresponding reason.
+ *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
suspend fun <R> connectGatt(
device: BluetoothDevice,
block: suspend GattClientScope.() -> R
- ): R? {
- return GattClientImpl().connect(context, device, block)
+ ): Result<R> {
+ return GattClient().connect(context, device, block)
+ }
+
+ /**
+ * Represents a client connection request from a remote device.
+ *
+ * @property device The remote device connecting to the server.
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ class GattServerConnectionRequest internal constructor(
+ val device: BluetoothDevice,
+ private val serverImpl: GattServerImpl,
+ internal val session: GattServerImpl.Session,
+ ) {
+ /**
+ * Accepts the connection request and handles incoming requests after that.
+ *
+ * Requests before calling this should be saved.
+ *
+ * @see GattServerScope
+ */
+ suspend fun accept(block: GattServerScope.() -> Unit) {
+ return serverImpl.acceptConnection(this, block)
+ }
+
+ /**
+ * Rejects the connection request.
+ */
+ fun reject() {
+ return serverImpl.rejectConnection(this)
+ }
+ }
+
+ /**
+ * A scope for operations as a GATT server role.
+ *
+ * Collect [requests] to respond with requests from the client.
+ *
+ * @see GattServerConnectionRequest#accept()
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ interface GattServerScope {
+ /**
+ * A client device connected to the server.
+ */
+ val device: BluetoothDevice
+
+ /**
+ * A _hot_ [Flow] of incoming requests from the client.
+ *
+ * A request is either [GattServerRequest.ReadCharacteristicRequest] or
+ * [GattServerRequest.WriteCharacteristicRequest]
+ */
+ val requests: Flow<GattServerRequest>
+
+ /**
+ * Notifies a client of a characteristic value change.
+ *
+ * @param characteristic the updated characteristic.
+ * @param value the new value of the characteristic.
+ */
+ fun notify(characteristic: GattCharacteristic, value: ByteArray)
+ }
+
+ /**
+ * Opens a GATT server.
+ *
+ * It returns a _cold_ [Flow] of connection requests.
+ * If the flow is cancelled, the server will be closed.
+ *
+ * Only one server at a time can be opened.
+ *
+ * @see GattServerConnectionRequest
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ fun openGattServer(services: List<GattService>): Flow<GattServerConnectionRequest> {
+ return serverImpl.open(services)
}
}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattCharacteristic.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattCharacteristic.kt
index e31b651..c198dc9 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattCharacteristic.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattCharacteristic.kt
@@ -115,4 +115,4 @@
fun GattCharacteristic(uuid: UUID, properties: Int, permissions: Int): GattCharacteristic {
val fwkCharacteristic = BluetoothGattCharacteristic(uuid, properties, permissions)
return GattCharacteristic(fwkCharacteristic)
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClientImpl.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClient.kt
similarity index 63%
rename from bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClientImpl.kt
rename to bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClient.kt
index 7d8acf4..ab2b0df 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClientImpl.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattClient.kt
@@ -16,18 +16,20 @@
package androidx.bluetooth
+import android.Manifest.permission.BLUETOOTH_CONNECT
import android.annotation.SuppressLint
+import android.bluetooth.BluetoothDevice as FwkDevice
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattCallback
import android.bluetooth.BluetoothGattCharacteristic as FwkCharacteristic
import android.bluetooth.BluetoothGattDescriptor as FwkDescriptor
import android.bluetooth.BluetoothGattService as FwkService
import android.content.Context
-import android.util.Log
+import android.os.Build
+import androidx.annotation.RequiresPermission
import java.util.UUID
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
-import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.coroutineScope
@@ -46,9 +48,30 @@
/**
* A class for handling operations as a GATT client role.
*/
-internal class GattClientImpl {
+internal class GattClient {
+ private interface GattClientImpl {
+ fun connectGatt(
+ context: Context,
+ device: FwkDevice,
+ callback: BluetoothGattCallback
+ ): Boolean
+
+ fun getServices(): List<FwkService>
+ fun getService(uuid: UUID): FwkService?
+ fun readCharacteristic(characteristic: FwkCharacteristic)
+ fun writeCharacteristic(
+ characteristic: FwkCharacteristic,
+ value: ByteArray,
+ writeType: Int
+ )
+
+ fun writeDescriptor(descriptor: FwkDescriptor, value: ByteArray)
+
+ fun setCharacteristicNotification(characteristic: FwkCharacteristic, enable: Boolean)
+ }
+
private companion object {
- private const val TAG = "GattClientImpl"
+ private const val TAG = "GattClient"
/**
* The maximum ATT size(512) + header(3)
@@ -57,6 +80,11 @@
private val CCCD_UID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
}
+ @SuppressLint("ObsoleteSdkInt")
+ private val impl: GattClientImpl =
+ if (Build.VERSION.SDK_INT >= 33) GattClientImplApi33()
+ else BaseGattClientImpl()
+
private sealed interface CallbackResult {
class OnCharacteristicRead(
val characteristic: GattCharacteristic,
@@ -86,46 +114,13 @@
fun finish()
}
- /**
- * A mapping from framework instances to BluetoothX instances.
- */
- private class AttributeMap {
- val services: MutableMap<FwkService, GattService> = mutableMapOf()
- val characteristics: MutableMap<FwkCharacteristic, GattCharacteristic> =
- mutableMapOf()
- fun update(services: List<FwkService>) {
- this.services.clear()
- characteristics.clear()
-
- services.forEach { serv ->
- this.services[serv] = GattService(serv)
- serv.characteristics.forEach { char ->
- characteristics[char] = GattCharacteristic(char)
- }
- }
- }
-
- fun getServices(): List<GattService> {
- return services.values.toList()
- }
-
- fun fromFwkService(service: FwkService): GattService? {
- return services[service]
- }
-
- fun fromFwkCharacteristic(characteristic: FwkCharacteristic): GattCharacteristic? {
- return characteristics[characteristic]
- }
- }
-
@SuppressLint("MissingPermission")
suspend fun <R> connect(
context: Context,
device: BluetoothDevice,
block: suspend BluetoothLe.GattClientScope.() -> R
- ): R? = coroutineScope {
- val connectResult = CompletableDeferred<Boolean>(parent = coroutineContext.job)
- val finished = Job(parent = coroutineContext.job)
+ ): Result<R> = coroutineScope {
+ val connectResult = CompletableDeferred<Unit>(parent = coroutineContext.job)
val callbackResultsFlow =
MutableSharedFlow<CallbackResult>(extraBufferCapacity = Int.MAX_VALUE)
val subscribeMap: MutableMap<FwkCharacteristic, SubscribeListener> = mutableMapOf()
@@ -137,9 +132,7 @@
if (newState == BluetoothGatt.STATE_CONNECTED) {
gatt?.requestMtu(GATT_MAX_MTU)
} else {
- connectResult.complete(false)
- // TODO(b/270492198): throw precise exception
- finished.completeExceptionally(IllegalStateException("connect failed"))
+ connectResult.cancel("connect failed")
}
}
@@ -147,17 +140,16 @@
if (status == BluetoothGatt.GATT_SUCCESS) {
gatt?.discoverServices()
} else {
- connectResult.complete(false)
- // TODO(b/270492198): throw precise exception
- finished.completeExceptionally(IllegalStateException("mtu request failed"))
+ connectResult.cancel("mtu request failed")
}
}
override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
gatt?.let {
- attributeMap.update(it.services)
+ attributeMap.updateWithFrameworkServices(it.services)
}
- connectResult.complete(status == BluetoothGatt.GATT_SUCCESS)
+ if (status == BluetoothGatt.GATT_SUCCESS) connectResult.complete(Unit)
+ else connectResult.cancel("service discover failed")
}
override fun onCharacteristicRead(
@@ -166,11 +158,11 @@
value: ByteArray,
status: Int
) {
- attributeMap.fromFwkCharacteristic(characteristic)?.let {
- callbackResultsFlow.tryEmit(
- CallbackResult.OnCharacteristicRead(it, value, status)
- )
- }
+ attributeMap.fromFwkCharacteristic(characteristic)?.let {
+ callbackResultsFlow.tryEmit(
+ CallbackResult.OnCharacteristicRead(it, value, status)
+ )
+ }
}
override fun onCharacteristicWrite(
@@ -192,7 +184,8 @@
value: ByteArray
) {
callbackResultsFlow.tryEmit(
- CallbackResult.OnDescriptorRead(descriptor, value, status))
+ CallbackResult.OnDescriptorRead(descriptor, value, status)
+ )
}
override fun onDescriptorWrite(
@@ -215,15 +208,18 @@
}
}
}
- val bluetoothGatt = device.fwkDevice.connectGatt(context, /*autoConnect=*/false, callback)
+ if (!impl.connectGatt(context, device.fwkDevice, callback)) {
+ return@coroutineScope Result.failure(CancellationException("failed to connect"))
+ }
- if (!connectResult.await()) {
- Log.w(TAG, "Failed to connect to the remote GATT server")
- return@coroutineScope null
+ try {
+ connectResult.await()
+ } catch (e: Throwable) {
+ return@coroutineScope Result.failure(e)
}
val gattScope = object : BluetoothLe.GattClientScope {
val taskMutex = Mutex()
- suspend fun<R> runTask(block: suspend () -> R): R {
+ suspend fun <R> runTask(block: suspend () -> R): R {
taskMutex.withLock {
return block()
}
@@ -234,7 +230,7 @@
}
override fun getService(uuid: UUID): GattService? {
- return bluetoothGatt.getService(uuid)?.let { attributeMap.fromFwkService(it) }
+ return impl.getService(uuid)?.let { attributeMap.fromFwkService(it) }
}
override suspend fun readCharacteristic(characteristic: GattCharacteristic):
@@ -243,14 +239,16 @@
return Result.failure(IllegalArgumentException("can't read the characteristic"))
}
return runTask {
- bluetoothGatt.readCharacteristic(characteristic.fwkCharacteristic)
+ impl.readCharacteristic(characteristic.fwkCharacteristic)
val res = takeMatchingResult<CallbackResult.OnCharacteristicRead>(
- callbackResultsFlow) {
+ callbackResultsFlow
+ ) {
it.characteristic == characteristic
}
if (res.status == BluetoothGatt.GATT_SUCCESS) Result.success(res.value)
- else Result.failure(RuntimeException("fail"))
+ // TODO: throw precise reason if we can gather the info
+ else Result.failure(CancellationException("fail"))
}
}
@@ -261,17 +259,19 @@
): Result<Unit> {
if (characteristic.properties and GattCharacteristic.PROPERTY_WRITE == 0) {
return Result.failure(
- IllegalArgumentException("can't write to the characteristic"))
+ IllegalArgumentException("can't write to the characteristic")
+ )
}
return runTask {
- bluetoothGatt.writeCharacteristic(
- characteristic.fwkCharacteristic, value, writeType)
+ impl.writeCharacteristic(characteristic.fwkCharacteristic, value, writeType)
val res = takeMatchingResult<CallbackResult.OnCharacteristicWrite>(
- callbackResultsFlow) {
+ callbackResultsFlow
+ ) {
it.characteristic == characteristic
}
if (res.status == BluetoothGatt.GATT_SUCCESS) Result.success(Unit)
- else Result.failure(RuntimeException("fail"))
+ // TODO: throw precise reason if we can gather the info
+ else Result.failure(CancellationException("fail"))
}
}
@@ -288,27 +288,28 @@
override fun onCharacteristicNotification(value: ByteArray) {
trySend(value)
}
+
override fun finish() {
- cancel("finished")
+ close()
}
}
if (!registerSubscribeListener(characteristic.fwkCharacteristic, listener)) {
- cancel("already subscribed")
+ throw IllegalStateException("already subscribed")
}
runTask {
- bluetoothGatt.setCharacteristicNotification(
- characteristic.fwkCharacteristic, /*enable=*/true)
- bluetoothGatt.writeDescriptor(
- cccd,
- FwkDescriptor.ENABLE_NOTIFICATION_VALUE
+ impl.setCharacteristicNotification(
+ characteristic.fwkCharacteristic, /*enable=*/true
)
+
+ impl.writeDescriptor(cccd, FwkDescriptor.ENABLE_NOTIFICATION_VALUE)
val res = takeMatchingResult<CallbackResult.OnDescriptorWrite>(
- callbackResultsFlow) {
+ callbackResultsFlow
+ ) {
it.descriptor == cccd
}
if (res.status != BluetoothGatt.GATT_SUCCESS) {
- cancel(CancellationException("failed to set notification"))
+ cancel("failed to set notification")
}
}
@@ -316,12 +317,11 @@
launch {
unregisterSubscribeListener(characteristic.fwkCharacteristic)
}
- bluetoothGatt.setCharacteristicNotification(
- characteristic.fwkCharacteristic, /*enable=*/false)
- bluetoothGatt.writeDescriptor(
- cccd,
- FwkDescriptor.DISABLE_NOTIFICATION_VALUE
+ impl.setCharacteristicNotification(
+ characteristic.fwkCharacteristic, /*enable=*/false
)
+
+ impl.writeDescriptor(cccd, FwkDescriptor.DISABLE_NOTIFICATION_VALUE)
}
}
}
@@ -360,13 +360,89 @@
}
}
}
- gattScope.block()
+ try {
+ Result.success(gattScope.block())
+ } catch (e: CancellationException) {
+ Result.failure(e)
+ }
}
- private suspend inline fun<reified R : CallbackResult> takeMatchingResult(
+ private suspend inline fun <reified R : CallbackResult> takeMatchingResult(
flow: SharedFlow<CallbackResult>,
crossinline predicate: (R) -> Boolean
): R {
return flow.filter { it is R && predicate(it) }.first() as R
}
+
+ private open class BaseGattClientImpl : GattClientImpl {
+ var bluetoothGatt: BluetoothGatt? = null
+
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun connectGatt(
+ context: Context,
+ device: FwkDevice,
+ callback: BluetoothGattCallback
+ ): Boolean {
+ bluetoothGatt = device.connectGatt(context, /*autoConnect=*/false, callback)
+ return bluetoothGatt != null
+ }
+
+ override fun getServices(): List<FwkService> {
+ return bluetoothGatt?.services ?: listOf()
+ }
+
+ override fun getService(uuid: UUID): FwkService? {
+ return bluetoothGatt?.getService(uuid)
+ }
+
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun readCharacteristic(characteristic: FwkCharacteristic) {
+ bluetoothGatt?.readCharacteristic(characteristic)
+ }
+
+ @Suppress("DEPRECATION")
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun writeCharacteristic(
+ characteristic: FwkCharacteristic,
+ value: ByteArray,
+ writeType: Int
+ ) {
+ characteristic.value = value
+ bluetoothGatt?.writeCharacteristic(characteristic)
+ }
+
+ @Suppress("DEPRECATION")
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun writeDescriptor(descriptor: FwkDescriptor, value: ByteArray) {
+ descriptor.value = value
+ bluetoothGatt?.writeDescriptor(descriptor)
+ }
+
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun setCharacteristicNotification(
+ characteristic: FwkCharacteristic,
+ enable: Boolean
+ ) {
+ bluetoothGatt?.setCharacteristicNotification(characteristic, enable)
+ }
+ }
+
+ private open class GattClientImplApi33 : BaseGattClientImpl() {
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun writeCharacteristic(
+ characteristic: FwkCharacteristic,
+ value: ByteArray,
+ writeType: Int
+ ) {
+ bluetoothGatt?.writeCharacteristic(characteristic, value, writeType)
+ }
+
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ override fun writeDescriptor(
+ descriptor: FwkDescriptor,
+ value: ByteArray
+ ) {
+ bluetoothGatt?.writeDescriptor(descriptor, value)
+ }
+ }
}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerImpl.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerImpl.kt
new file mode 100644
index 0000000..5e1c21f
--- /dev/null
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerImpl.kt
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth
+
+import android.annotation.SuppressLint
+import android.bluetooth.BluetoothDevice as FwkDevice
+import android.bluetooth.BluetoothGatt
+import android.bluetooth.BluetoothGattCharacteristic as FwkCharacteristic
+import android.bluetooth.BluetoothGattServer
+import android.bluetooth.BluetoothGattServerCallback
+import android.bluetooth.BluetoothManager
+import android.bluetooth.BluetoothProfile
+import android.content.Context
+import java.util.concurrent.atomic.AtomicReference
+import kotlinx.coroutines.channels.Channel
+import kotlinx.coroutines.channels.awaitClose
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.callbackFlow
+import kotlinx.coroutines.flow.receiveAsFlow
+
+/**
+ * Class for handling operations as a GATT server role
+ */
+internal class GattServerImpl(private val context: Context) {
+ private companion object {
+ private const val TAG = "GattServerImpl"
+ }
+
+ internal class Session {
+ enum class State {
+ DISCONNECTED,
+ CONNECTING,
+ CONNECTED,
+ }
+
+ var state: AtomicReference<State> = AtomicReference(State.CONNECTING)
+ val requestChannel = Channel<GattServerRequest>(Channel.UNLIMITED)
+ }
+
+ // Should be accessed only from the callback thread
+ private val sessions: MutableMap<FwkDevice, Session> = mutableMapOf()
+ private var gattServer: BluetoothGattServer? = null
+ private val attributeMap = AttributeMap()
+
+ @SuppressLint("MissingPermission")
+ fun open(services: List<GattService>):
+ Flow<BluetoothLe.GattServerConnectionRequest> = callbackFlow {
+ if (gattServer != null) {
+ throw IllegalStateException("GATT server is already opened")
+ }
+ attributeMap.updateWithServices(services)
+ val callback = object : BluetoothGattServerCallback() {
+ override fun onConnectionStateChange(
+ device: FwkDevice,
+ status: Int,
+ newState: Int
+ ) {
+ if (newState == BluetoothProfile.STATE_CONNECTED) {
+ val session = addSession(device)
+ trySend(
+ BluetoothLe.GattServerConnectionRequest(
+ BluetoothDevice.of(device),
+ this@GattServerImpl,
+ session
+ )
+ )
+ }
+ if (newState == BluetoothProfile.STATE_DISCONNECTED) {
+ removeSession(device)
+ }
+ }
+
+ override fun onCharacteristicReadRequest(
+ device: FwkDevice,
+ requestId: Int,
+ offset: Int,
+ characteristic: FwkCharacteristic
+ ) {
+ attributeMap.fromFwkCharacteristic(characteristic)?.let {
+ findActiveSessionWithDevice(device)?.requestChannel?.trySend(
+ GattServerRequest.ReadCharacteristicRequest(
+ this@GattServerImpl, device, requestId, offset, it
+ )
+ )
+ } ?: run {
+ sendResponse(device, requestId, BluetoothGatt.GATT_READ_NOT_PERMITTED, offset,
+ /*value=*/null)
+ }
+ }
+
+ override fun onCharacteristicWriteRequest(
+ device: FwkDevice,
+ requestId: Int,
+ characteristic: FwkCharacteristic,
+ preparedWrite: Boolean,
+ responseNeeded: Boolean,
+ offset: Int,
+ value: ByteArray?
+ ) {
+ attributeMap.fromFwkCharacteristic(characteristic)?.let {
+ findActiveSessionWithDevice(device)?.requestChannel?.trySend(
+ GattServerRequest.WriteCharacteristicRequest(
+ this@GattServerImpl,
+ device,
+ requestId,
+ it,
+ preparedWrite,
+ responseNeeded,
+ offset,
+ value
+ )
+ )
+ } ?: run {
+ sendResponse(device, requestId, BluetoothGatt.GATT_WRITE_NOT_PERMITTED,
+ offset, /*value=*/null)
+ }
+ }
+ }
+ val bluetoothManager = context.getSystemService(BluetoothManager::class.java)
+ gattServer = bluetoothManager?.openGattServer(context, callback)
+ services.forEach { gattServer?.addService(it.fwkService) }
+
+ awaitClose {
+ gattServer?.close()
+ gattServer = null
+ }
+ }
+
+ @SuppressLint("MissingPermission")
+ suspend fun<R> acceptConnection(
+ request: BluetoothLe.GattServerConnectionRequest,
+ block: BluetoothLe.GattServerScope.() -> R
+ ) = coroutineScope {
+ val session = request.session
+ if (!session.state.compareAndSet(Session.State.CONNECTING, Session.State.CONNECTED)) {
+ throw IllegalStateException("the request is already handled")
+ }
+ val scope = object : BluetoothLe.GattServerScope {
+ override val device: BluetoothDevice
+ get() = request.device
+ override val requests = session.requestChannel.receiveAsFlow()
+
+ override fun notify(
+ characteristic: GattCharacteristic,
+ value: ByteArray
+ ) {
+ gattServer?.notifyCharacteristicChanged(
+ request.device.fwkDevice, characteristic.fwkCharacteristic, false, value)
+ }
+ }
+ scope.block()
+ }
+
+ @SuppressLint("MissingPermission")
+ fun rejectConnection(request: BluetoothLe.GattServerConnectionRequest) {
+ if (!request.session.state.compareAndSet(
+ Session.State.CONNECTING, Session.State.DISCONNECTED)) {
+ throw IllegalStateException("the request is already handled")
+ }
+ }
+
+ internal fun findActiveSessionWithDevice(device: FwkDevice): Session? {
+ return sessions[device]?.takeIf {
+ it.state.get() != Session.State.DISCONNECTED
+ }
+ }
+
+ internal fun addSession(device: FwkDevice): Session {
+ return Session().apply {
+ sessions[device] = this
+ }
+ }
+
+ internal fun removeSession(device: FwkDevice) {
+ sessions.remove(device)
+ }
+
+ @SuppressLint("MissingPermission")
+ internal fun sendResponse(
+ device: FwkDevice,
+ requestId: Int,
+ status: Int,
+ offset: Int,
+ value: ByteArray?
+ ) {
+ gattServer?.sendResponse(device, requestId, status, offset, value)
+ }
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerRequest.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerRequest.kt
new file mode 100644
index 0000000..8f42e118
--- /dev/null
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattServerRequest.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth
+
+import android.bluetooth.BluetoothDevice
+import android.bluetooth.BluetoothGatt.GATT_READ_NOT_PERMITTED
+import android.bluetooth.BluetoothGatt.GATT_SUCCESS
+import android.bluetooth.BluetoothGatt.GATT_WRITE_NOT_PERMITTED
+import androidx.annotation.RestrictTo
+
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+interface GattServerRequest {
+ class ReadCharacteristicRequest internal constructor(
+ private val serverImpl: GattServerImpl,
+ internal val device: BluetoothDevice,
+ private val requestId: Int,
+ val offset: Int,
+ val characteristic: GattCharacteristic
+ ) : GattServerRequest {
+ fun sendResponse(success: Boolean, value: ByteArray?) {
+ serverImpl.sendResponse(
+ device,
+ requestId,
+ if (success) GATT_SUCCESS else GATT_READ_NOT_PERMITTED,
+ offset,
+ value
+ )
+ }
+ }
+
+ class WriteCharacteristicRequest internal constructor(
+ private val serverImpl: GattServerImpl,
+ internal val device: BluetoothDevice,
+ private val requestId: Int,
+ val characteristic: GattCharacteristic,
+ val isPreparedWrite: Boolean,
+ val shouldResponse: Boolean,
+ val offset: Int,
+ val value: ByteArray?
+ ) : GattServerRequest {
+ fun sendResponse(success: Boolean) {
+ serverImpl.sendResponse(
+ device,
+ requestId,
+ if (success) GATT_SUCCESS else GATT_WRITE_NOT_PERMITTED,
+ offset,
+ value
+ )
+ }
+ }
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattService.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattService.kt
index 5676953..6a8407f 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattService.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/GattService.kt
@@ -47,4 +47,4 @@
val fwkService = BluetoothGattService(uuid, BluetoothGattService.SERVICE_TYPE_PRIMARY)
characteristics.forEach { fwkService.addCharacteristic(it.fwkCharacteristic) }
return GattService(fwkService, characteristics)
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanFilter.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanFilter.kt
index 8969db2..74eb868 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanFilter.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanFilter.kt
@@ -16,6 +16,10 @@
package androidx.bluetooth
+import android.annotation.SuppressLint
+import android.bluetooth.le.ScanFilter as FwkScanFilter
+import android.os.Build
+import android.os.ParcelUuid
import java.util.UUID
/**
@@ -23,31 +27,31 @@
* scan results to only those that are of interest to them.
*/
class ScanFilter(
- /* The scan filter for the remote device address. Null if filter is not set. */
+ /** The scan filter for the remote device address. `null` if filter is not set. */
val deviceAddress: BluetoothAddress? = null,
- /* The scan filter for manufacturer id. MANUFACTURER_FILTER_NONE if filter is not set. */
+ /** The scan filter for manufacturer id. [MANUFACTURER_FILTER_NONE] if filter is not set. */
val manufacturerId: Int = MANUFACTURER_FILTER_NONE,
- /* The scan filter for manufacturer data. Null if filter is not set. */
+ /** The scan filter for manufacturer data. `null` if filter is not set. */
val manufacturerData: ByteArray? = null,
- /* The partial filter on manufacturerData. Null if filter is not set. */
+ /** The partial filter on manufacturerData. `null` if filter is not set. */
val manufacturerDataMask: ByteArray? = null,
- /* The scan filter for service data uuid. Null if filter is not set. */
+ /** The scan filter for service data uuid. `null` if filter is not set. */
val serviceDataUuid: UUID? = null,
- /* The scan filter for service data. Null if filter is not set. */
+ /** The scan filter for service data. `null` if filter is not set. */
val serviceData: ByteArray? = null,
- /* The partial filter on service data. Null if filter is not set. */
+ /** The partial filter on service data. `null` if filter is not set. */
val serviceDataMask: ByteArray? = null,
- /* The scan filter for service uuid. Null if filter is not set. */
+ /** The scan filter for service uuid. `null` if filter is not set. */
val serviceUuid: UUID? = null,
- /* The partial filter on service uuid. Null if filter is not set. */
+ /** The partial filter on service uuid. `null` if filter is not set. */
val serviceUuidMask: UUID? = null
) {
companion object {
@@ -56,35 +60,75 @@
init {
if (manufacturerId < 0 && manufacturerId != MANUFACTURER_FILTER_NONE) {
- throw IllegalArgumentException("invalid manufacturerId")
+ throw IllegalArgumentException("Invalid manufacturerId")
}
if (manufacturerDataMask != null) {
if (manufacturerData == null) {
throw IllegalArgumentException(
- "manufacturerData is null while manufacturerDataMask is not null")
+ "ManufacturerData is null while manufacturerDataMask is not null")
}
if (manufacturerData.size != manufacturerDataMask.size) {
throw IllegalArgumentException(
- "size mismatch for manufacturerData and manufacturerDataMask")
+ "Size mismatch for manufacturerData and manufacturerDataMask")
}
}
if (serviceDataMask != null) {
if (serviceData == null) {
throw IllegalArgumentException(
- "serviceData is null while serviceDataMask is not null")
+ "ServiceData is null while serviceDataMask is not null")
}
if (serviceData.size != serviceDataMask.size) {
throw IllegalArgumentException(
- "size mismatch for service data and service data mask")
+ "Size mismatch for service data and service data mask")
}
}
- if (serviceUuidMask != null && serviceUuid == null) {
- throw IllegalArgumentException("uuid is null while uuidMask is not null")
+ if (serviceUuid == null && serviceUuidMask != null) {
+ throw IllegalArgumentException("ServiceUuid is null while ServiceUuidMask is not null")
}
}
-}
\ No newline at end of file
+
+ @delegate:SuppressLint("ObsoleteSdkInt")
+ internal val fwkScanFilter: FwkScanFilter by lazy(LazyThreadSafetyMode.PUBLICATION) {
+ FwkScanFilter.Builder().run {
+ deviceAddress?.let { setDeviceAddress(it.address) }
+
+ if (manufacturerId != MANUFACTURER_FILTER_NONE && manufacturerData != null) {
+ if (Build.VERSION.SDK_INT >= 33) {
+ setManufacturerData(
+ manufacturerId,
+ manufacturerData,
+ manufacturerDataMask
+ )
+ } else {
+ setManufacturerData(manufacturerId, manufacturerData)
+ }
+ }
+
+ if (serviceDataUuid != null) {
+ if (Build.VERSION.SDK_INT >= 33) {
+ setServiceData(ParcelUuid(
+ serviceDataUuid),
+ serviceData,
+ serviceDataMask
+ )
+ } else {
+ setServiceData(ParcelUuid(serviceDataUuid), serviceData)
+ }
+ }
+
+ serviceUuid?.let {
+ if (Build.VERSION.SDK_INT >= 33) {
+ setServiceUuid(ParcelUuid(it), ParcelUuid(serviceUuidMask))
+ } else {
+ setServiceUuid(ParcelUuid(it))
+ }
+ }
+ build()
+ }
+ }
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanResult.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanResult.kt
index dc2dd2f..f98714b 100644
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanResult.kt
+++ b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanResult.kt
@@ -21,12 +21,12 @@
import java.util.UUID
/**
- * ScanResult for Bluetooth LE scan.
+ * Represents a scan result for Bluetooth LE scan.
*
* The ScanResult class is used by Bluetooth LE applications to scan for and discover Bluetooth LE
- * devices. When a Bluetooth LE application scans for devices, it will receive a list of ScanResult
- * objects that contain information about the scanned devices. The application can then use this
- * information to determine which devices it wants to connect to.
+ * devices. When a Bluetooth LE application scans for devices, it will receive a list of
+ * [ScanResult] objects that contain information about the scanned devices. The application can
+ * then use this information to determine which devices it wants to connect to.
*
* @property device Remote device found
* @property deviceAddress Bluetooth address for the remote device found
@@ -36,6 +36,7 @@
*
*/
class ScanResult internal constructor(private val fwkScanResult: FwkScanResult) {
+
/** Remote Bluetooth device found. */
val device: BluetoothDevice
get() = BluetoothDevice.of(fwkScanResult.device)
@@ -54,8 +55,8 @@
* Returns the manufacturer specific data associated with the manufacturer id.
*
* @param manufacturerId The manufacturer id of the scanned device
- * @return the manufacturer specific data associated with the manufacturer id, or null if the
- * manufacturer specific data is not present
+ * @return the manufacturer specific data associated with the manufacturer id, or @{code null}
+ * if the manufacturer specific data is not present
*/
fun getManufacturerSpecificData(manufacturerId: Int): ByteArray? {
return fwkScanResult.scanRecord?.getManufacturerSpecificData(manufacturerId)
@@ -72,19 +73,19 @@
* Returns the service data associated with the service UUID.
*
* @param serviceUuid The service UUID of the service data
- * @return the service data associated with the specified service UUID, or null if the service
- * UUID is not found
+ * @return the service data associated with the specified service UUID, or `null`
+ * if the service UUID is not found
*/
fun getServiceData(serviceUuid: UUID): ByteArray? {
return fwkScanResult.scanRecord?.getServiceData(ParcelUuid(serviceUuid))
}
/**
- * Checks if this object represents connectable scan result.
+ * Checks if this object represents a connectable scan result.
*
- * @return true if the scanned device is connectable; false otherwise
+ * @return {@code true} if the scanned device is connectable.
*/
fun isConnectable(): Boolean {
return fwkScanResult.isConnectable
}
-}
\ No newline at end of file
+}
diff --git a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanType.kt b/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanType.kt
deleted file mode 100644
index e26a338..0000000
--- a/bluetooth/bluetooth/src/main/java/androidx/bluetooth/ScanType.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.bluetooth
-
-import android.bluetooth.le.ScanSettings
-import androidx.annotation.IntDef
-import androidx.annotation.RestrictTo
-
-/**
- * Bluetooth LE scan type that defines which scan results to send into the scan flow.
- */
-@RestrictTo(RestrictTo.Scope.LIBRARY)
-@Retention(AnnotationRetention.SOURCE)
-@IntDef(
- ScanType.ALL_MATCHES,
- ScanType.FIRST_MATCH,
- ScanType.MATCH_LOST
-)
-public annotation class ScanType {
- companion object {
- /* Send scan result for every Bluetooth advertisement that matches the filter criteria. */
- public const val ALL_MATCHES: Int = ScanSettings.CALLBACK_TYPE_ALL_MATCHES
-
- /**
- * Send scan result for only the first advertisement packet received that matches the filter
- * criteria.
- */
- public const val FIRST_MATCH: Int = ScanSettings.CALLBACK_TYPE_FIRST_MATCH
-
- /**
- * Send scan result when advertisements are no longer received from a device that has been
- * previously reported by a first match scan type.
- */
- public const val MATCH_LOST: Int = ScanSettings.CALLBACK_TYPE_MATCH_LOST
- }
-}
\ No newline at end of file
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserFragment.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserFragment.kt
index bef5649..cb5658e 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserFragment.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserFragment.kt
@@ -16,11 +16,8 @@
package androidx.bluetooth.integration.testapp.ui.advertiser
-// TODO(ofy) Migrate to androidx.bluetooth.BluetoothLe once Gatt Server API is in place
import android.Manifest
import android.annotation.SuppressLint
-import android.bluetooth.BluetoothGattCharacteristic
-import android.bluetooth.BluetoothGattService
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.pm.PackageManager
@@ -29,14 +26,19 @@
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.CheckBox
import android.widget.EditText
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.PopupMenu
import androidx.bluetooth.AdvertiseResult
import androidx.bluetooth.BluetoothLe
+import androidx.bluetooth.GattCharacteristic
+import androidx.bluetooth.GattCharacteristic.Companion.PERMISSION_READ
+import androidx.bluetooth.GattCharacteristic.Companion.PROPERTY_READ
+import androidx.bluetooth.GattServerRequest
+import androidx.bluetooth.GattService
import androidx.bluetooth.integration.testapp.R
import androidx.bluetooth.integration.testapp.databinding.FragmentAdvertiserBinding
-import androidx.bluetooth.integration.testapp.experimental.BluetoothLe as BluetoothLeExperimental
import androidx.bluetooth.integration.testapp.ui.common.getColor
import androidx.bluetooth.integration.testapp.ui.common.setViewEditText
import androidx.bluetooth.integration.testapp.ui.common.toast
@@ -44,7 +46,10 @@
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
+import androidx.recyclerview.widget.DividerItemDecoration
+import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.tabs.TabLayout
+import java.nio.ByteBuffer
import java.util.UUID
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -61,9 +66,6 @@
private lateinit var bluetoothLe: BluetoothLe
- // TODO(ofy) Migrate to androidx.bluetooth.BluetoothLe once scan API is in place
- private lateinit var bluetoothLeExperimental: BluetoothLeExperimental
-
private var advertiseDataAdapter: AdvertiseDataAdapter? = null
private val advertiseScope = CoroutineScope(Dispatchers.Main + Job())
@@ -91,6 +93,8 @@
_binding?.viewRecyclerViewOverlay?.isVisible = value
}
+ private var gattServerServicesAdapter: GattServerServicesAdapter? = null
+
private var isGattServerOpen: Boolean = false
set(value) {
field = value
@@ -136,8 +140,6 @@
): View {
bluetoothLe = BluetoothLe(requireContext())
- bluetoothLeExperimental = BluetoothLeExperimental(requireContext())
-
_binding = FragmentAdvertiserBinding.inflate(inflater, container, false)
binding.tabLayout.addOnTabSelectedListener(onTabSelectedListener)
@@ -182,6 +184,20 @@
}
}
+ binding.buttonAddService.setOnClickListener {
+ onAddGattService()
+ }
+
+ gattServerServicesAdapter =
+ GattServerServicesAdapter(
+ viewModel.gattServerServices,
+ ::onAddGattCharacteristic
+ )
+ binding.recyclerViewGattServerServices.adapter = gattServerServicesAdapter
+ binding.recyclerViewGattServerServices.addItemDecoration(
+ DividerItemDecoration(context, LinearLayoutManager.VERTICAL)
+ )
+
binding.buttonGattServer.setOnClickListener {
if (gattServerJob?.isActive == true) {
isGattServerOpen = false
@@ -340,25 +356,139 @@
}
}
+ private fun onAddGattService() {
+ val editTextUuid = EditText(requireActivity())
+ editTextUuid.hint = getString(R.string.service_uuid)
+
+ AlertDialog.Builder(requireContext())
+ .setTitle(getString(R.string.add_service))
+ .setViewEditText(editTextUuid)
+ .setPositiveButton(getString(R.string.add)) { _, _ ->
+ val editTextInput = editTextUuid.text.toString()
+ try {
+ val uuid = UUID.fromString(
+ when (editTextInput.length) {
+ 4 -> "0000$editTextInput-0000-1000-8000-00805F9B34FB"
+ 8 -> "$editTextInput-0000-1000-8000-00805F9B34FB"
+ else -> editTextInput
+ }
+ )
+ val service = GattService(uuid, listOf())
+ viewModel.addGattService(service)
+ gattServerServicesAdapter
+ ?.notifyItemInserted(viewModel.gattServerServices.size - 1)
+ } catch (e: Exception) {
+ Log.d(TAG, e.toString())
+ toast(getString(R.string.invalid_uuid)).show()
+ }
+ }
+ .setNegativeButton(getString(R.string.cancel), null)
+ .create()
+ .show()
+ }
+
+ private fun onAddGattCharacteristic(bluetoothGattService: GattService) {
+ val view = layoutInflater.inflate(R.layout.dialog_add_characteristic, null)
+ val editTextUuid = view.findViewById<EditText>(R.id.edit_text_uuid)
+
+ val checkBoxPropertiesBroadcast =
+ view.findViewById<CheckBox>(R.id.check_box_properties_broadcast)
+ val checkBoxPropertiesIndicate =
+ view.findViewById<CheckBox>(R.id.check_box_properties_indicate)
+ val checkBoxPropertiesNotify = view.findViewById<CheckBox>(R.id.check_box_properties_notify)
+ val checkBoxPropertiesRead = view.findViewById<CheckBox>(R.id.check_box_properties_read)
+ val checkBoxPropertiesSignedWrite =
+ view.findViewById<CheckBox>(R.id.check_box_properties_signed_write)
+ val checkBoxPropertiesWrite = view.findViewById<CheckBox>(R.id.check_box_properties_write)
+ val checkBoxPropertiesWriteNoResponse =
+ view.findViewById<CheckBox>(R.id.check_box_properties_write_no_response)
+
+ AlertDialog.Builder(requireContext())
+ .setTitle(getString(R.string.add_characteristic))
+ .setView(view)
+ .setPositiveButton(getString(R.string.add)) { _, _ ->
+ val uuidText = editTextUuid.text.toString()
+
+ var properties = 0
+ var permissions = 0
+ if (checkBoxPropertiesBroadcast.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_BROADCAST
+ }
+ if (checkBoxPropertiesIndicate.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_INDICATE
+ }
+ if (checkBoxPropertiesNotify.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_NOTIFY
+ }
+ if (checkBoxPropertiesRead.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_READ
+ permissions = permissions or GattCharacteristic.PERMISSION_READ
+ }
+ if (checkBoxPropertiesSignedWrite.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_SIGNED_WRITE
+ permissions = permissions or GattCharacteristic.PERMISSION_WRITE_SIGNED
+ }
+ if (checkBoxPropertiesWrite.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_WRITE
+ permissions = permissions or GattCharacteristic.PERMISSION_WRITE
+ }
+ if (checkBoxPropertiesWriteNoResponse.isChecked) {
+ properties = properties or GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE
+ permissions = permissions or GattCharacteristic.PERMISSION_WRITE
+ }
+
+ try {
+ val uuid = UUID.fromString(
+ when (uuidText.length) {
+ 4 -> "0000$uuidText-0000-1000-8000-00805F9B34FB"
+ 8 -> "$uuidText-0000-1000-8000-00805F9B34FB"
+ else -> uuidText
+ }
+ )
+ val sampleCharacteristic = GattCharacteristic(
+ uuid,
+ properties,
+ permissions
+ )
+
+ val index = viewModel.gattServerServices.indexOf(bluetoothGattService)
+ viewModel.addGattCharacteristic(bluetoothGattService, sampleCharacteristic)
+
+ gattServerServicesAdapter?.notifyItemChanged(index)
+ } catch (e: Exception) {
+ toast(getString(R.string.invalid_uuid)).show()
+ }
+ }
+ .setNegativeButton(getString(R.string.cancel), null)
+ .create()
+ .show()
+ }
+
private fun openGattServer() {
Log.d(TAG, "openGattServer() called")
- val sampleService =
- BluetoothGattService(UUID.randomUUID(), BluetoothGattService.SERVICE_TYPE_PRIMARY)
- val sampleCharacteristic = BluetoothGattCharacteristic(
- UUID.randomUUID(),
- BluetoothGattCharacteristic.PROPERTY_READ,
- BluetoothGattCharacteristic.PERMISSION_READ
- )
- sampleService.addCharacteristic(sampleCharacteristic)
-
- val services = listOf(sampleService)
-
gattServerJob = gattServerScope.launch {
isGattServerOpen = true
- bluetoothLeExperimental.openGattServer(services).collect { gattServerCallback ->
- Log.d(TAG, "openGattServer() called with: gattServerCallback = $gattServerCallback")
+ bluetoothLe.openGattServer(viewModel.gattServerServices).collect {
+ launch {
+ it.accept {
+ launch {
+ requests.collect {
+ when (it) {
+ is GattServerRequest.ReadCharacteristicRequest ->
+ it.sendResponse(/*success=*/true,
+ ByteBuffer.allocate(Int.SIZE_BYTES).putInt(1).array())
+
+ is GattServerRequest.WriteCharacteristicRequest ->
+ it.sendResponse(/*success=*/true)
+
+ else -> throw NotImplementedError("unknown request")
+ }
+ }
+ }
+ }
+ }
}
}
}
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserViewModel.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserViewModel.kt
index f0e4cdd..ba55df3 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserViewModel.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/AdvertiserViewModel.kt
@@ -17,6 +17,8 @@
package androidx.bluetooth.integration.testapp.ui.advertiser
import androidx.bluetooth.AdvertiseParams
+import androidx.bluetooth.GattCharacteristic
+import androidx.bluetooth.GattService
import androidx.lifecycle.ViewModel
import java.util.UUID
@@ -60,6 +62,9 @@
serviceUuids
)
+ private val _gattServerServices = mutableListOf<GattService>()
+ val gattServerServices: List<GattService> = _gattServerServices
+
fun removeAdvertiseDataAtIndex(index: Int) {
val manufacturerDataSize = manufacturerDatas.size
val serviceDataSize = serviceDatas.size
@@ -72,4 +77,18 @@
serviceUuids.removeAt(index - manufacturerDataSize - serviceDataSize)
}
}
+
+ fun addGattService(gattService: GattService) {
+ _gattServerServices.add(gattService)
+ }
+
+ fun addGattCharacteristic(service: GattService, characteristic: GattCharacteristic) {
+ val index = _gattServerServices.indexOf(service)
+ if (index < 0) return;
+ _gattServerServices[index] = GattService(service.uuid,
+ service.characteristics.toMutableList().apply {
+ add(characteristic)
+ }
+ )
+ }
}
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerCharacteristicsAdapter.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerCharacteristicsAdapter.kt
new file mode 100644
index 0000000..9d9f2ba
--- /dev/null
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerCharacteristicsAdapter.kt
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth.integration.testapp.ui.advertiser
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.bluetooth.GattCharacteristic
+import androidx.bluetooth.integration.testapp.R
+import androidx.recyclerview.widget.RecyclerView
+
+class GattServerCharacteristicsAdapter(
+ private val characteristics: List<GattCharacteristic>
+) : RecyclerView.Adapter<GattServerCharacteristicsAdapter.ViewHolder>() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val view = LayoutInflater.from(parent.context)
+ .inflate(R.layout.item_gatt_server_characteristic, parent, false)
+ return ViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ holder.bind(characteristics[position])
+ }
+
+ override fun getItemCount(): Int {
+ return characteristics.size
+ }
+
+ inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+ private val textViewUuid: TextView = itemView.findViewById(R.id.text_view_uuid)
+ private val textViewProperties: TextView = itemView.findViewById(R.id.text_view_properties)
+
+ fun bind(characteristic: GattCharacteristic) {
+ textViewUuid.text = characteristic.uuid.toString()
+
+ val properties = characteristic.properties
+ val context = itemView.context
+ val propertiesList = mutableListOf<String>()
+
+ if (properties.and(GattCharacteristic.PROPERTY_BROADCAST) != 0) {
+ propertiesList.add(context.getString(R.string.broadcast))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_INDICATE) != 0) {
+ propertiesList.add(context.getString(R.string.indicate))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_NOTIFY) != 0) {
+ propertiesList.add(context.getString(R.string.notify))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_READ) != 0) {
+ propertiesList.add(context.getString(R.string.read))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_SIGNED_WRITE) != 0) {
+ propertiesList.add(context.getString(R.string.signed_write))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_WRITE) != 0) {
+ propertiesList.add(context.getString(R.string.write))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0) {
+ propertiesList.add(context.getString(R.string.write_no_response))
+ }
+ textViewProperties.text = propertiesList.joinToString()
+ }
+ }
+}
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerServicesAdapter.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerServicesAdapter.kt
new file mode 100644
index 0000000..26d662d
--- /dev/null
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/advertiser/GattServerServicesAdapter.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.bluetooth.integration.testapp.ui.advertiser
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.TextView
+import androidx.bluetooth.GattService
+import androidx.bluetooth.integration.testapp.R
+import androidx.recyclerview.widget.RecyclerView
+
+class GattServerServicesAdapter(
+ private val services: List<GattService>,
+ private val onClickAddCharacteristic: (GattService) -> Unit
+) : RecyclerView.Adapter<GattServerServicesAdapter.ViewHolder>() {
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val view = LayoutInflater.from(parent.context)
+ .inflate(R.layout.item_gatt_server_service, parent, false)
+ return ViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ holder.bind(services[position])
+ }
+
+ override fun getItemCount(): Int {
+ return services.size
+ }
+
+ inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+
+ private val textViewUuid: TextView = itemView.findViewById(R.id.text_view_uuid)
+ private val buttonAddCharacteristic: Button =
+ itemView.findViewById(R.id.button_add_characteristic)
+
+ private val recyclerViewServiceCharacteristic: RecyclerView =
+ itemView.findViewById(R.id.recycler_view_service_characteristic)
+
+ private var currentGattService: GattService? = null
+
+ init {
+ buttonAddCharacteristic.setOnClickListener {
+ currentGattService?.let(onClickAddCharacteristic)
+ }
+ }
+
+ fun bind(gattService: GattService) {
+ currentGattService = gattService
+
+ textViewUuid.text = gattService.uuid.toString()
+
+ recyclerViewServiceCharacteristic.adapter = GattServerCharacteristicsAdapter(
+ gattService.characteristics
+ )
+ }
+ }
+}
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/DeviceServiceCharacteristicsAdapter.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/DeviceServiceCharacteristicsAdapter.kt
index c0fc9b93..7dc418f 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/DeviceServiceCharacteristicsAdapter.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/DeviceServiceCharacteristicsAdapter.kt
@@ -99,27 +99,35 @@
val properties = characteristic.properties
val context = itemView.context
-
val propertiesList = mutableListOf<String>()
- // TODO(ofy) Update these with BluetoothGattCharacteristic.isReadable, isWriteable, ...
+
+ if (properties.and(GattCharacteristic.PROPERTY_BROADCAST) != 0) {
+ propertiesList.add(context.getString(R.string.broadcast))
+ }
if (properties.and(GattCharacteristic.PROPERTY_INDICATE) != 0) {
propertiesList.add(context.getString(R.string.indicate))
}
if (properties.and(GattCharacteristic.PROPERTY_NOTIFY) != 0) {
propertiesList.add(context.getString(R.string.notify))
}
- val isReadable = properties.and(GattCharacteristic.PROPERTY_READ) != 0
- if (isReadable) {
+ if (properties.and(GattCharacteristic.PROPERTY_READ) != 0) {
propertiesList.add(context.getString(R.string.read))
}
- val isWriteable = (properties.and(GattCharacteristic.PROPERTY_WRITE) != 0 ||
- properties.and(GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0 ||
- properties.and(GattCharacteristic.PROPERTY_SIGNED_WRITE) != 0)
- if (isWriteable) {
+ if (properties.and(GattCharacteristic.PROPERTY_SIGNED_WRITE) != 0) {
+ propertiesList.add(context.getString(R.string.signed_write))
+ }
+ if (properties.and(GattCharacteristic.PROPERTY_WRITE) != 0) {
propertiesList.add(context.getString(R.string.write))
}
+ if (properties.and(GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0) {
+ propertiesList.add(context.getString(R.string.write_no_response))
+ }
textViewProperties.text = propertiesList.joinToString()
+ val isReadable = properties.and(GattCharacteristic.PROPERTY_READ) != 0
+ val isWriteable = properties.and(GattCharacteristic.PROPERTY_WRITE) != 0 ||
+ properties.and(GattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) != 0 ||
+ properties.and(GattCharacteristic.PROPERTY_SIGNED_WRITE) != 0
buttonReadCharacteristic.isVisible = isReadable
buttonWriteCharacteristic.isVisible = isWriteable
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
index ca23455..27ffe00 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
@@ -16,7 +16,6 @@
package androidx.bluetooth.integration.testapp.ui.scanner
-// TODO(ofy) Migrate to androidx.bluetooth.AdvertiseParams
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
diff --git a/bluetooth/integration-tests/testapp/src/main/res/layout/dialog_add_characteristic.xml b/bluetooth/integration-tests/testapp/src/main/res/layout/dialog_add_characteristic.xml
new file mode 100644
index 0000000..939ac7d
--- /dev/null
+++ b/bluetooth/integration-tests/testapp/src/main/res/layout/dialog_add_characteristic.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingStart="16dp"
+ android:paddingTop="8dp"
+ android:paddingEnd="16dp"
+ android:paddingBottom="8dp">
+
+ <EditText
+ android:id="@+id/edit_text_uuid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/uuid"
+ android:inputType="text"
+ android:textAllCaps="true" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/properties"
+ android:textColor="@color/black"
+ android:textStyle="bold" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_broadcast"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/broadcast" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_indicate"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/indicate" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_notify"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/notify" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_read"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/read" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_signed_write"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/signed_write" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_write"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/write" />
+
+ <CheckBox
+ android:id="@+id/check_box_properties_write_no_response"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="16dp"
+ android:text="@string/write_no_response" />
+
+ </LinearLayout>
+
+</ScrollView>
diff --git a/bluetooth/integration-tests/testapp/src/main/res/layout/fragment_advertiser.xml b/bluetooth/integration-tests/testapp/src/main/res/layout/fragment_advertiser.xml
index 024d732..4181f87 100644
--- a/bluetooth/integration-tests/testapp/src/main/res/layout/fragment_advertiser.xml
+++ b/bluetooth/integration-tests/testapp/src/main/res/layout/fragment_advertiser.xml
@@ -164,6 +164,37 @@
app:layout_constraintTop_toBottomOf="@+id/tab_layout"
tools:visibility="visible">
+ <androidx.core.widget.NestedScrollView
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ app:layout_constraintTop_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recycler_view_gatt_server_services"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layoutManager="LinearLayoutManager"
+ tools:itemCount="1"
+ tools:listitem="@layout/item_gatt_server_service" />
+
+ <Button
+ android:id="@+id/button_add_service"
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ android:text="@string/add_service" />
+
+ </LinearLayout>
+
+ </androidx.core.widget.NestedScrollView>
+
<Button
android:id="@+id/button_gatt_server"
android:layout_width="wrap_content"
diff --git a/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_characteristic.xml b/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_characteristic.xml
new file mode 100644
index 0000000..64bb680
--- /dev/null
+++ b/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_characteristic.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="8dp">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/uuid"
+ android:textAllCaps="true" />
+
+ <TextView
+ android:id="@+id/text_view_uuid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ android:textColor="@color/black"
+ tools:text="0x1800" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/properties" />
+
+ <TextView
+ android:id="@+id/text_view_properties"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ android:textAllCaps="true"
+ android:textColor="@color/black"
+ tools:text="@string/read" />
+
+ </LinearLayout>
+
+ <!-- TODO(ofy) Add Descriptor -->
+
+ <!-- <Button-->
+ <!-- android:id="@+id/button_add_descriptor"-->
+ <!-- style="@style/Widget.MaterialComponents.Button.TextButton"-->
+ <!-- android:layout_width="wrap_content"-->
+ <!-- android:layout_height="wrap_content"-->
+ <!-- android:layout_marginStart="16dp"-->
+ <!-- android:text="@string/add_descriptor" />-->
+
+</LinearLayout>
diff --git a/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_service.xml b/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_service.xml
new file mode 100644
index 0000000..bbb6557
--- /dev/null
+++ b/bluetooth/integration-tests/testapp/src/main/res/layout/item_gatt_server_service.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="8dp">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/generic_attribute"
+ android:textColor="@color/black"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/uuid"
+ android:textAllCaps="true" />
+
+ <TextView
+ android:id="@+id/text_view_uuid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ android:textColor="@color/black"
+ tools:text="0x1800" />
+
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/primary_service"
+ android:textAllCaps="true" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recycler_view_service_characteristic"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ app:layoutManager="LinearLayoutManager"
+ tools:itemCount="3"
+ tools:listitem="@layout/item_gatt_server_characteristic" />
+
+ <Button
+ android:id="@+id/button_add_characteristic"
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:text="@string/add_characteristic" />
+
+</LinearLayout>
diff --git a/bluetooth/integration-tests/testapp/src/main/res/values/donottranslate-strings.xml b/bluetooth/integration-tests/testapp/src/main/res/values/donottranslate-strings.xml
index 06dffe7..780de09 100644
--- a/bluetooth/integration-tests/testapp/src/main/res/values/donottranslate-strings.xml
+++ b/bluetooth/integration-tests/testapp/src/main/res/values/donottranslate-strings.xml
@@ -36,13 +36,19 @@
<string name="connecting">Connecting…</string>
<string name="connected">Connected</string>
<string name="generic_attribute">Generic Attribute</string>
- <string name="uuid">uuid</string>
- <string name="properties">Properties</string>
+
+ <!-- Service & Characteristic -->
<string name="primary_service">Primary Service</string>
+ <string name="uuid">Uuid</string>
+ <string name="permissions">Permissions</string>
+ <string name="properties">Properties</string>
+ <string name="broadcast">Broadcast</string>
<string name="indicate">Indicate</string>
<string name="notify">Notify</string>
<string name="read">Read</string>
+ <string name="signed_write">Signed Write</string>
<string name="write">Write</string>
+ <string name="write_no_response">Write No Response</string>
<string name="value">Value</string>
<!-- Advertiser -->
@@ -67,6 +73,10 @@
<!-- GATT Server -->
<string name="gatt_server">Gatt Server</string>
+ <string name="add_service">Add Service</string>
+ <string name="add_characteristic">Add Characteristic</string>
+ <string name="add_descriptor">Add Descriptor</string>
<string name="open_gatt_server">Open Gatt Server</string>
<string name="stop_gatt_server">Stop Gatt Server</string>
+ <string name="invalid_uuid">Invalid UUID</string>
</resources>
diff --git a/buildSrc-tests/build.gradle b/buildSrc-tests/build.gradle
index 81ab23a..5a72509 100644
--- a/buildSrc-tests/build.gradle
+++ b/buildSrc-tests/build.gradle
@@ -101,6 +101,15 @@
t.overrideSubdirectories = subdirs
})
+tasks["ktCheck"].configure({ t ->
+ t.overrideDirectory = ktlintDir
+ t.overrideSubdirectories = subdirs
+})
+tasks["ktFormat"].configure({ t ->
+ t.overrideDirectory = ktlintDir
+ t.overrideSubdirectories = subdirs
+})
+
// Broken in AGP 7.0-alpha15 due to b/180408027
tasks["lint"].configure { t ->
t.enabled = false
diff --git a/buildSrc-tests/src/test/java/androidx/build/SdkResourceGeneratorTest.kt b/buildSrc-tests/src/test/java/androidx/build/SdkResourceGeneratorTest.kt
index 69b663e..fb02b79 100644
--- a/buildSrc-tests/src/test/java/androidx/build/SdkResourceGeneratorTest.kt
+++ b/buildSrc-tests/src/test/java/androidx/build/SdkResourceGeneratorTest.kt
@@ -21,17 +21,24 @@
import java.util.Properties
import net.saff.checkmark.Checkmark.Companion.check
import org.gradle.api.plugins.ExtraPropertiesExtension
+import org.gradle.api.provider.Provider
import org.gradle.testfixtures.ProjectBuilder
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.junit.Test
class SdkResourceGeneratorTest {
@Test
fun `All SDK properties are resolved`() {
androidx.build.dependencies.agpVersion = "1.2.3"
- androidx.build.dependencies.kotlinVersion = "2.3.4"
androidx.build.dependencies.kspVersion = "3.4.5"
val project = ProjectBuilder.builder().build()
+ project.extensions.create(
+ "androidXConfiguration",
+ AndroidXConfigImpl::class.java,
+ project.provider { KotlinVersion.KOTLIN_1_7 },
+ project.provider { "1.7.10" }
+ )
project.setSupportRootFolder(File("files/support"))
val extension = project.rootProject.property("ext") as ExtraPropertiesExtension
@@ -57,4 +64,9 @@
assertThat(propertyValue.toString()).doesNotMatch("task '.+?' property '.+?'")
}
}
-}
\ No newline at end of file
+
+ internal open class AndroidXConfigImpl(
+ override val kotlinApiVersion: Provider<KotlinVersion>,
+ override val kotlinBomVersion: Provider<String>
+ ) : AndroidXConfiguration
+}
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
index 3a6f4b3..361dc3e 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXComposePlugin.kt
@@ -19,9 +19,7 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
-/**
- * Plugin to apply common configuration for Compose projects.
- */
+/** Plugin to apply common configuration for Compose projects. */
class AndroidXComposePlugin : Plugin<Project> {
override fun apply(project: Project) {
val supportRoot = project.getSupportRootFolder()
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPaparazziPlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPaparazziPlugin.kt
index f327627..090d9b6 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPaparazziPlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPaparazziPlugin.kt
@@ -28,9 +28,7 @@
override fun apply(project: Project) {
val supportRoot = project.getSupportRootFolder()
project.apply(
- mapOf(
- "from" to "$supportRoot/buildSrc/apply/applyAndroidXPaparazziImplPlugin.gradle"
- )
+ mapOf("from" to "$supportRoot/buildSrc/apply/applyAndroidXPaparazziImplPlugin.gradle")
)
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlaygroundRootPlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlaygroundRootPlugin.kt
index ea2b6ca..622ea2a 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlaygroundRootPlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlaygroundRootPlugin.kt
@@ -23,9 +23,9 @@
* This plugin is used in Playground projects and adds functionality like resolving to snapshot
* artifacts instead of projects or allowing access to public maven repositories.
*
- * The actual implementation is in AndroidXRootImplPlugin.
- * This extracts this logic out of the classpath so that individual tasks can't access this logic
- * so Gradle can know that changes to this logic doesn't need to automatically invalidate every task
+ * The actual implementation is in AndroidXRootImplPlugin. This extracts this logic out of the
+ * classpath so that individual tasks can't access this logic so Gradle can know that changes to
+ * this logic doesn't need to automatically invalidate every task
*/
@Suppress("unused") // used in Playground Projects
class AndroidXPlaygroundRootPlugin : Plugin<Project> {
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlugin.kt
index f389d94..9314cf0 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXPlugin.kt
@@ -20,12 +20,12 @@
import org.gradle.api.Project
/**
- * A plugin which enables all of the Gradle customizations for AndroidX.
- * This plugin reacts to other plugins being added and adds required and optional functionality.
+ * A plugin which enables all of the Gradle customizations for AndroidX. This plugin reacts to other
+ * plugins being added and adds required and optional functionality.
*
- * The actual implementation is in AndroidXImplPlugin.
- * This extracts this logic out of the classpath so that individual tasks can't access this logic
- * so Gradle can know that changes to this logic doesn't need to automatically invalidate every task
+ * The actual implementation is in AndroidXImplPlugin. This extracts this logic out of the classpath
+ * so that individual tasks can't access this logic so Gradle can know that changes to this logic
+ * doesn't need to automatically invalidate every task
*/
class AndroidXPlugin : Plugin<Project> {
override fun apply(project: Project) {
@@ -38,9 +38,7 @@
}
companion object {
- /**
- * @return `true` if running in a Playground (Github) setup, `false` otherwise.
- */
+ /** @return `true` if running in a Playground (Github) setup, `false` otherwise. */
@JvmStatic
fun isPlayground(project: Project): Boolean {
return ProjectLayoutType.isPlayground(project)
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
index 1ff2c7c..ba7f350 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/AndroidXRootPlugin.kt
@@ -22,9 +22,9 @@
/**
* This plugin needs to be applied to the root of an AndroidX build
*
- * The actual implementation is in AndroidXRootImplPlugin.
- * This extracts this logic out of the classpath so that individual tasks can't access this logic
- * so Gradle can know that changes to this logic doesn't need to automatically invalidate every task
+ * The actual implementation is in AndroidXRootImplPlugin. This extracts this logic out of the
+ * classpath so that individual tasks can't access this logic so Gradle can know that changes to
+ * this logic doesn't need to automatically invalidate every task
*/
abstract class AndroidXRootPlugin : Plugin<Project> {
override fun apply(project: Project) {
diff --git a/buildSrc/plugins/src/main/kotlin/androidx/build/docs/AndroidXDocsPlugin.kt b/buildSrc/plugins/src/main/kotlin/androidx/build/docs/AndroidXDocsPlugin.kt
index e19153f..fdb3768 100644
--- a/buildSrc/plugins/src/main/kotlin/androidx/build/docs/AndroidXDocsPlugin.kt
+++ b/buildSrc/plugins/src/main/kotlin/androidx/build/docs/AndroidXDocsPlugin.kt
@@ -23,9 +23,9 @@
/**
* Plugin that allows to build documentation for a given set of prebuilt and tip of tree projects.
*
- * The actual implementation is in AndroidXDocsImplPlugin.
- * This extracts this logic out of the classpath so that individual tasks can't access this logic
- * so Gradle can know that changes to this logic doesn't need to automatically invalidate every task
+ * The actual implementation is in AndroidXDocsImplPlugin. This extracts this logic out of the
+ * classpath so that individual tasks can't access this logic so Gradle can know that changes to
+ * this logic doesn't need to automatically invalidate every task
*/
class AndroidXDocsPlugin : Plugin<Project> {
override fun apply(project: Project) {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AarManifestTransformerTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/AarManifestTransformerTask.kt
index c816ee4..6dde7c7 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AarManifestTransformerTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AarManifestTransformerTask.kt
@@ -31,17 +31,14 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Transforms an AAR by removing the `android:targetSdkVersion` element from the manifest.
- */
+/** Transforms an AAR by removing the `android:targetSdkVersion` element from the manifest. */
@CacheableTask
abstract class AarManifestTransformerTask : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val aarFile: RegularFileProperty
- @get:OutputFile
- abstract val updatedAarFile: RegularFileProperty
+ @get:OutputFile abstract val updatedAarFile: RegularFileProperty
@TaskAction
fun taskAction() {
@@ -50,9 +47,7 @@
val tempDir = Files.createTempDirectory("${name}Unzip").toFile()
tempDir.deleteOnExit()
- ZipFile(aar).use { aarFile ->
- aarFile.unzipTo(tempDir)
- }
+ ZipFile(aar).use { aarFile -> aarFile.unzipTo(tempDir) }
val manifestFile = File(tempDir, "AndroidManifest.xml")
manifestFile.writeText(removeTargetSdkVersion(manifestFile.readText()))
@@ -62,13 +57,9 @@
}
}
-/**
- * Removes the `android:targetSdkVersion` element from the [manifest].
- */
-fun removeTargetSdkVersion(manifest: String): String = manifest.replace(
- "\\s*android:targetSdkVersion=\".+?\"".toRegex(),
- ""
-)
+/** Removes the `android:targetSdkVersion` element from the [manifest]. */
+fun removeTargetSdkVersion(manifest: String): String =
+ manifest.replace("\\s*android:targetSdkVersion=\".+?\"".toRegex(), "")
private fun ZipFile.unzipTo(tempDir: File) {
entries.iterator().forEach { entry ->
@@ -77,18 +68,14 @@
} else {
val file = File(tempDir, entry.name)
file.parentFile.mkdirs()
- getInputStream(entry).use { stream ->
- file.writeBytes(stream.readBytes())
- }
+ getInputStream(entry).use { stream -> file.writeBytes(stream.readBytes()) }
}
}
}
private fun File.zipTo(outZip: File) {
ZipOutputStream(outZip.outputStream()).use { stream ->
- listFiles()!!.forEach { file ->
- stream.addFileRecursive(null, file)
- }
+ listFiles()!!.forEach { file -> stream.addFileRecursive(null, file) }
}
}
@@ -102,18 +89,14 @@
if (file.isFile) {
putNextEntry(entry)
- file.inputStream().use { stream ->
- stream.copyTo(this)
- }
+ file.inputStream().use { stream -> stream.copyTo(this) }
closeEntry()
} else if (file.isDirectory) {
val listFiles = file.listFiles()
if (!listFiles.isNullOrEmpty()) {
putNextEntry(entry)
closeEntry()
- listFiles.forEach { containedFile ->
- addFileRecursive(entryPath, containedFile)
- }
+ listFiles.forEach { containedFile -> addFileRecursive(entryPath, containedFile) }
}
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AgpExtensions.kt b/buildSrc/private/src/main/kotlin/androidx/build/AgpExtensions.kt
index ca65e22..357b46d 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AgpExtensions.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AgpExtensions.kt
@@ -24,23 +24,21 @@
import org.gradle.api.Project
@Suppress("DEPRECATION") // BaseVariant
-val BaseExtension.variants: DomainObjectSet<
- out com.android.build.gradle.api.BaseVariant>
- get() = when (this) {
- is AppExtension -> applicationVariants
- is LibraryExtension -> libraryVariants
- is TestExtension -> applicationVariants
- else -> error("Unhandled plugin ${this::class.java}")
- }
+val BaseExtension.variants: DomainObjectSet<out com.android.build.gradle.api.BaseVariant>
+ get() =
+ when (this) {
+ is AppExtension -> applicationVariants
+ is LibraryExtension -> libraryVariants
+ is TestExtension -> applicationVariants
+ else -> error("Unhandled plugin ${this::class.java}")
+ }
@Suppress("DEPRECATION") // BaseVariant
-val Project.agpVariants: DomainObjectSet<
- out com.android.build.gradle.api.BaseVariant>
+val Project.agpVariants: DomainObjectSet<out com.android.build.gradle.api.BaseVariant>
get() {
- val extension = checkNotNull(
- project.extensions.findByType(BaseExtension::class.java)
- ) {
- "${project.name} has no BaseExtension"
- }
+ val extension =
+ checkNotNull(project.extensions.findByType(BaseExtension::class.java)) {
+ "${project.name} has no BaseExtension"
+ }
return extension.variants
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
index 6576681..282bd32 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
@@ -54,26 +54,24 @@
const val enableMetricsArg = "androidx.enableComposeCompilerMetrics"
const val enableReportsArg = "androidx.enableComposeCompilerReports"
-/**
- * Plugin to apply common configuration for Compose projects.
- */
+/** Plugin to apply common configuration for Compose projects. */
class AndroidXComposeImplPlugin : Plugin<Project> {
override fun apply(project: Project) {
- val extension = project.extensions.create<AndroidXComposeExtension>(
- "androidxCompose",
- project
- )
+ val extension =
+ project.extensions.create<AndroidXComposeExtension>("androidxCompose", project)
project.plugins.all { plugin ->
when (plugin) {
is LibraryPlugin -> {
- val library = project.extensions.findByType(LibraryExtension::class.java)
- ?: throw Exception("Failed to find Android extension")
+ val library =
+ project.extensions.findByType(LibraryExtension::class.java)
+ ?: throw Exception("Failed to find Android extension")
project.configureAndroidCommonOptions(library)
}
is AppPlugin -> {
- val app = project.extensions.findByType(AppExtension::class.java)
- ?: throw Exception("Failed to find Android extension")
+ val app =
+ project.extensions.findByType(AppExtension::class.java)
+ ?: throw Exception("Failed to find Android extension")
project.configureAndroidCommonOptions(app)
}
@@ -89,21 +87,19 @@
}
companion object {
- private fun Project.androidxExtension(): AndroidXExtension? {
- return extensions.findByType(AndroidXExtension::class.java)
- }
-
private fun Project.configureAndroidCommonOptions(testedExtension: TestedExtension) {
testedExtension.defaultConfig.minSdk = 21
extensions.findByType(AndroidComponentsExtension::class.java)!!.finalizeDsl {
- val isPublished = androidxExtension()?.shouldPublish() ?: false
+ val isPublished = androidXExtension.shouldPublish()
it.lint {
- // Too many Kotlin features require synthetic accessors - we want to rely on R8 to
+ // Too many Kotlin features require synthetic accessors - we want to rely on R8
+ // to
// remove these accessors
disable.add("SyntheticAccessor")
- // These lint checks are normally a warning (or lower), but we ignore (in AndroidX)
+ // These lint checks are normally a warning (or lower), but we ignore (in
+ // AndroidX)
// warnings in Lint, so we make it an error here so it will fail the build.
// Note that this causes 'UnknownIssueId' lint warnings in the build log when
// Lint tries to apply this rule to modules that do not have this lint check, so
@@ -114,27 +110,24 @@
// Paths we want to enable ListIterator checks for - for higher level
// libraries it won't have a noticeable performance impact, and we don't want
// developers reading high level library code to worry about this.
- val listIteratorPaths = listOf(
- "compose:foundation",
- "compose:runtime",
- "compose:ui",
- "text"
- )
+ val listIteratorPaths =
+ listOf("compose:foundation", "compose:runtime", "compose:ui", "text")
// Paths we want to disable ListIteratorChecks for - these are not runtime
// libraries and so Iterator allocation is not relevant.
- val ignoreListIteratorFilter = listOf(
- "compose:ui:ui-test",
- "compose:ui:ui-tooling",
- "compose:ui:ui-inspection",
- )
+ val ignoreListIteratorFilter =
+ listOf(
+ "compose:ui:ui-test",
+ "compose:ui:ui-tooling",
+ "compose:ui:ui-inspection",
+ )
// Disable ListIterator if we are not in a matching path, or we are in an
// unpublished project
if (
listIteratorPaths.none { path.contains(it) } ||
- ignoreListIteratorFilter.any { path.contains(it) } ||
- !isPublished
+ ignoreListIteratorFilter.any { path.contains(it) } ||
+ !isPublished
) {
disable.add("ListIterator")
}
@@ -158,18 +151,21 @@
/**
* General configuration for MPP projects. In the future, these workarounds should either be
- * generified and added to AndroidXPlugin, or removed as/when the underlying issues have been
- * resolved.
+ * generified and added to AndroidXPlugin, or removed as/when the underlying issues have
+ * been resolved.
*/
private fun Project.configureForMultiplatform() {
// This is to allow K/N not matching the kotlinVersion
- (this.rootProject.property("ext") as ExtraPropertiesExtension)
- .set("kotlin.native.version", KOTLIN_NATIVE_VERSION)
+ (this.rootProject.property("ext") as ExtraPropertiesExtension).set(
+ "kotlin.native.version",
+ KOTLIN_NATIVE_VERSION
+ )
- val multiplatformExtension = checkNotNull(multiplatformExtension) {
- "Unable to configureForMultiplatform() when " +
- "multiplatformExtension is null (multiplatform plugin not enabled?)"
- }
+ val multiplatformExtension =
+ checkNotNull(multiplatformExtension) {
+ "Unable to configureForMultiplatform() when " +
+ "multiplatformExtension is null (multiplatform plugin not enabled?)"
+ }
/*
The following configures source sets - note:
@@ -188,9 +184,7 @@
*/
multiplatformExtension.sourceSets.all {
// Allow all experimental APIs, since MPP projects are themselves experimental
- it.languageSettings.apply {
- optIn("kotlin.ExperimentalMultiplatform")
- }
+ it.languageSettings.apply { optIn("kotlin.ExperimentalMultiplatform") }
}
configureLintForMultiplatformLibrary(multiplatformExtension)
@@ -209,16 +203,14 @@
private const val COMPILER_PLUGIN_CONFIGURATION = "kotlinPlugin"
-private fun configureComposeCompilerPlugin(
- project: Project,
- extension: AndroidXComposeExtension
-) {
+private fun configureComposeCompilerPlugin(project: Project, extension: AndroidXComposeExtension) {
project.afterEvaluate {
// If a project has opted-out of Compose compiler plugin, don't add it
if (!extension.composeCompilerPluginEnabled) return@afterEvaluate
- val androidXExtension = project.extensions.findByType(AndroidXExtension::class.java)
- ?: throw Exception("You have applied AndroidXComposePlugin without AndroidXPlugin")
+ val androidXExtension =
+ project.extensions.findByType(AndroidXExtension::class.java)
+ ?: throw Exception("You have applied AndroidXComposePlugin without AndroidXPlugin")
val shouldPublish = androidXExtension.shouldPublish()
// Create configuration that we'll use to load Compose compiler plugin
@@ -236,14 +228,17 @@
project.rootProject.resolveProject(":compose:compiler:compiler")
}
)
- val kotlinPlugin = configuration.incoming.artifactView { view ->
- view.attributes { attributes ->
- attributes.attribute(
- Attribute.of("artifactType", String::class.java),
- ArtifactTypeDefinition.JAR_TYPE
- )
- }
- }.files
+ val kotlinPlugin =
+ configuration.incoming
+ .artifactView { view ->
+ view.attributes { attributes ->
+ attributes.attribute(
+ Attribute.of("artifactType", String::class.java),
+ ArtifactTypeDefinition.JAR_TYPE
+ )
+ }
+ }
+ .files
val enableMetricsProvider = project.providers.gradleProperty(enableMetricsArg)
val enableReportsProvider = project.providers.gradleProperty(enableReportsArg)
@@ -252,7 +247,8 @@
val libraryReportsDirectory = project.rootProject.getLibraryReportsDirectory()
project.tasks.withType(KotlinCompile::class.java).configureEach { compile ->
// Append inputs to KotlinCompile so tasks get invalidated if any of these values change
- compile.inputs.files({ kotlinPlugin })
+ compile.inputs
+ .files({ kotlinPlugin })
.withPropertyName("composeCompilerExtension")
.withNormalizer(ClasspathNormalizer::class.java)
compile.inputs.property("composeMetricsEnabled", enableMetricsProvider).optional(true)
@@ -266,22 +262,15 @@
if (enableMetricsProvider.orNull == "true") {
val metricsDest = File(libraryMetricsDirectory, "compose")
compile.kotlinOptions.freeCompilerArgs +=
- listOf(
- "-P",
- "$composeMetricsOption=${metricsDest.absolutePath}"
- )
+ listOf("-P", "$composeMetricsOption=${metricsDest.absolutePath}")
}
if ((enableReportsProvider.orNull == "true")) {
val reportsDest = File(libraryReportsDirectory, "compose")
compile.kotlinOptions.freeCompilerArgs +=
- listOf(
- "-P",
- "$composeReportsOption=${reportsDest.absolutePath}"
- )
+ listOf("-P", "$composeReportsOption=${reportsDest.absolutePath}")
}
if (shouldPublish) {
- compile.kotlinOptions.freeCompilerArgs +=
- listOf("-P", composeSourceOption)
+ compile.kotlinOptions.freeCompilerArgs += listOf("-P", composeSourceOption)
}
}
}
@@ -291,12 +280,11 @@
/**
* Adds missing MPP sourcesets (such as commonMain) to the Lint tasks
*
- * TODO: b/195329463
- * Lint is not aware of MPP, and MPP doesn't configure Lint. There is no built-in
- * API to adjust the default Lint task's sources, so we use this hack to manually
- * add sources for MPP source sets. In the future with the new Kotlin Project Model
- * (https://youtrack.jetbrains.com/issue/KT-42572) and an AGP / MPP integration
- * plugin this will no longer be needed.
+ * TODO: b/195329463 Lint is not aware of MPP, and MPP doesn't configure Lint. There is no built-in
+ * API to adjust the default Lint task's sources, so we use this hack to manually add sources for
+ * MPP source sets. In the future with the new Kotlin Project Model
+ * (https://youtrack.jetbrains.com/issue/KT-42572) and an AGP / MPP integration plugin this will
+ * no longer be needed.
*/
private fun Project.configureLintForMultiplatformLibrary(
multiplatformExtension: KotlinMultiplatformExtension
@@ -305,16 +293,13 @@
// This workaround only works for libraries (apps would require changes to a different
// task). Given that we currently do not have any MPP app projects, this should never
// happen.
- project.extensions.findByType<LibraryExtension>()
- ?: return@afterEvaluate
- val androidMain = multiplatformExtension.sourceSets.findByName("androidMain")
- ?: return@afterEvaluate
+ project.extensions.findByType<LibraryExtension>() ?: return@afterEvaluate
+ val androidMain =
+ multiplatformExtension.sourceSets.findByName("androidMain") ?: return@afterEvaluate
// Get all the sourcesets androidMain transitively / directly depends on
val dependencies = androidMain.withClosure(KotlinSourceSet::dependsOn)
- /**
- * Helper function to add the missing sourcesets to this [VariantInputs]
- */
+ /** Helper function to add the missing sourcesets to this [VariantInputs] */
fun VariantInputs.addSourceSets() {
// Each variant has a source provider for the variant (such as debug) and the 'main'
// variant. The actual files that Lint will run on is both of these providers
@@ -333,9 +318,7 @@
it.variantInputs.addSourceSets()
}
- project.tasks.withType<AndroidLintTask>().configureEach {
- it.variantInputs.addSourceSets()
- }
+ project.tasks.withType<AndroidLintTask>().configureEach { it.variantInputs.addSourceSets() }
// Also configure the model writing task, so that we don't run into mismatches between
// analyzed sources in one module and a downstream module
@@ -348,8 +331,8 @@
/**
* Lint uses [ConfigurableFileCollection.disallowChanges] during initialization, which prevents
* modifying the file collection separately (there is no time to configure it before AGP has
- * initialized and disallowed changes). This uses reflection to temporarily allow changes, and
- * apply [block].
+ * initialized and disallowed changes). This uses reflection to temporarily allow changes, and apply
+ * [block].
*/
private fun ConfigurableFileCollection.withChangesAllowed(
block: ConfigurableFileCollection.() -> Unit
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeLintIssues.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeLintIssues.kt
index 4f039ec..174a675 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeLintIssues.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeLintIssues.kt
@@ -18,28 +18,29 @@
/**
* These lint checks are normally a warning (or lower), but in AndroidX we ignore warnings in Lint.
- * We want these errors to be reported, so they'll be promoted from a warning to an error in
- * modules that use the [AndroidXComposeImplPlugin].
+ * We want these errors to be reported, so they'll be promoted from a warning to an error in modules
+ * that use the [AndroidXComposeImplPlugin].
*/
-internal val ComposeLintWarningIdsToTreatAsErrors = listOf(
- "ComposableNaming",
- "ComposableLambdaParameterNaming",
- "ComposableLambdaParameterPosition",
- "CompositionLocalNaming",
- "ComposableModifierFactory",
- "AutoboxingStateCreation",
- "AutoboxingStateValueProperty",
- "InvalidColorHexValue",
- "MissingColorAlphaChannel",
- "ModifierFactoryReturnType",
- "ModifierFactoryExtensionFunction",
- "ModifierNodeInspectableProperties",
- "ModifierParameter",
- "MutableCollectionMutableState",
- "OpaqueUnitKey",
- "UnnecessaryComposedModifier",
- "FrequentlyChangedStateReadInComposition",
- "ReturnFromAwaitPointerEventScope",
- "UseOfNonLambdaOffsetOverload",
- "MultipleAwaitPointerEventScopes",
-)
\ No newline at end of file
+internal val ComposeLintWarningIdsToTreatAsErrors =
+ listOf(
+ "ComposableNaming",
+ "ComposableLambdaParameterNaming",
+ "ComposableLambdaParameterPosition",
+ "CompositionLocalNaming",
+ "ComposableModifierFactory",
+ "AutoboxingStateCreation",
+ "AutoboxingStateValueProperty",
+ "InvalidColorHexValue",
+ "MissingColorAlphaChannel",
+ "ModifierFactoryReturnType",
+ "ModifierFactoryExtensionFunction",
+ "ModifierNodeInspectableProperties",
+ "ModifierParameter",
+ "MutableCollectionMutableState",
+ "OpaqueUnitKey",
+ "UnnecessaryComposedModifier",
+ "FrequentlyChangedStateReadInComposition",
+ "ReturnFromAwaitPointerEventScope",
+ "UseOfNonLambdaOffsetOverload",
+ "MultipleAwaitPointerEventScopes",
+ )
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXExtension.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXExtension.kt
index d08325e..cdd9add 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXExtension.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXExtension.kt
@@ -27,17 +27,14 @@
import org.gradle.api.plugins.ExtensionContainer
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
-/**
- * Extension for [AndroidXImplPlugin] that's responsible for holding configuration options.
- */
-abstract class AndroidXExtension(val project: Project) : ExtensionAware {
+/** Extension for [AndroidXImplPlugin] that's responsible for holding configuration options. */
+abstract class AndroidXExtension(val project: Project) : ExtensionAware, AndroidXConfiguration {
- @JvmField
- val LibraryVersions: Map<String, Version>
+ @JvmField val LibraryVersions: Map<String, Version>
- @JvmField
- val AllLibraryGroups: List<LibraryGroup>
+ @JvmField val AllLibraryGroups: List<LibraryGroup>
val libraryGroupsByGroupId: Map<String, LibraryGroup>
val overrideLibraryGroupsByProjectPath: Map<String, LibraryGroup>
@@ -58,19 +55,21 @@
// These parameters are only expected to be compatible with :compose:compiler:compiler .
// To use them may require specifying specific projects and disabling some checks
// like this:
- // `./gradlew :compose:compiler:compiler:publishToMavenLocal -Pandroidx.versionExtraCheckEnabled=false`
+ // `./gradlew :compose:compiler:compiler:publishToMavenLocal
+ // -Pandroidx.versionExtraCheckEnabled=false`
val composeCustomVersion = project.providers.environmentVariable("COMPOSE_CUSTOM_VERSION")
val composeCustomGroup = project.providers.environmentVariable("COMPOSE_CUSTOM_GROUP")
// service that can compute group/version for a project
- versionService = project.gradle.sharedServices.registerIfAbsent(
- "libraryVersionsService",
- LibraryVersionsService::class.java
- ) { spec ->
- spec.parameters.tomlFileName = tomlFileName
- spec.parameters.tomlFileContents = toml
- spec.parameters.composeCustomVersion = composeCustomVersion
- spec.parameters.composeCustomGroup = composeCustomGroup
- }.get()
+ versionService =
+ project.gradle.sharedServices
+ .registerIfAbsent("libraryVersionsService", LibraryVersionsService::class.java) {
+ spec ->
+ spec.parameters.tomlFileName = tomlFileName
+ spec.parameters.tomlFileContents = toml
+ spec.parameters.composeCustomVersion = composeCustomVersion
+ spec.parameters.composeCustomGroup = composeCustomGroup
+ }
+ .get()
AllLibraryGroups = versionService.libraryGroups.values.toList()
LibraryVersions = versionService.libraryVersions
libraryGroupsByGroupId = versionService.libraryGroupsByGroupId
@@ -81,15 +80,19 @@
// service that can compute full list of projects in settings.gradle
val settings = lazyReadFile("settings.gradle")
- listProjectsService = project.gradle.sharedServices.registerIfAbsent(
- "listProjectsService",
- ListProjectsService::class.java
- ) { spec ->
- spec.parameters.settingsFile = settings
- }
+ listProjectsService =
+ project.gradle.sharedServices.registerIfAbsent(
+ "listProjectsService",
+ ListProjectsService::class.java
+ ) { spec ->
+ spec.parameters.settingsFile = settings
+ }
+
+ kotlinTarget.set(KotlinTarget.DEFAULT)
}
var name: Property<String?> = project.objects.property(String::class.java)
+
fun setName(newName: String) {
name.set(newName)
}
@@ -110,21 +113,19 @@
fun getOtherProjectsInSameGroup(): List<SettingsParser.IncludedProject> {
val allProjects = listProjectsService.get().allPossibleProjects
val ourGroup = chooseLibraryGroup()
- if (ourGroup == null)
- return listOf()
- val otherProjectsInSameGroup = allProjects.filter { otherProject ->
- if (otherProject.gradlePath == project.path) {
- false
- } else {
- getLibraryGroupFromProjectPath(otherProject.gradlePath) == ourGroup
+ if (ourGroup == null) return listOf()
+ val otherProjectsInSameGroup =
+ allProjects.filter { otherProject ->
+ if (otherProject.gradlePath == project.path) {
+ false
+ } else {
+ getLibraryGroupFromProjectPath(otherProject.gradlePath) == ourGroup
+ }
}
- }
return otherProjectsInSameGroup
}
- /**
- * Returns a string explaining the value of mavenGroup
- */
+ /** Returns a string explaining the value of mavenGroup */
fun explainMavenGroup(): List<String> {
val explanationBuilder = mutableListOf<String>()
chooseLibraryGroup(explanationBuilder)
@@ -132,9 +133,8 @@
}
private fun lazyReadFile(fileName: String): Provider<String> {
- val fileProperty = project.objects.fileProperty().fileValue(
- File(project.getSupportRootFolder(), fileName)
- )
+ val fileProperty =
+ project.objects.fileProperty().fileValue(File(project.getSupportRootFolder(), fileName))
return project.providers.fileContents(fileProperty).asText
}
@@ -157,12 +157,10 @@
"Library group (in libraryversions.toml) having" +
" overrideInclude=[\"$projectPath\"] is $overridden"
)
- if (overridden != null)
- return overridden
+ if (overridden != null) return overridden
val result = getStandardLibraryGroupFromProjectPath(projectPath, explanationBuilder)
- if (result != null)
- return result
+ if (result != null) return result
// samples are allowed to be nested deeper
if (projectPath.contains("samples")) {
@@ -185,11 +183,12 @@
return null
}
// convert parent project path to groupId
- val groupIdText = if (projectPath.startsWith(":external")) {
- projectPath.replace(":external:", "")
- } else {
- "androidx.${parentPath.substring(1).replace(':', '.')}"
- }
+ val groupIdText =
+ if (projectPath.startsWith(":external")) {
+ projectPath.replace(":external:", "")
+ } else {
+ "androidx.${parentPath.substring(1).replace(':', '.')}"
+ }
// get the library group having that text
val result = libraryGroupsByGroupId[groupIdText]
@@ -208,9 +207,12 @@
projectDirectlySpecifiesMavenVersion = true
if (groupVersion != null && !isGroupVersionOverrideAllowed()) {
throw GradleException(
- "Cannot set mavenVersion (" + mavenVersion +
- ") for a project (" + project +
- ") whose mavenGroup already specifies forcedVersion (" + groupVersion +
+ "Cannot set mavenVersion (" +
+ mavenVersion +
+ ") for a project (" +
+ project +
+ ") whose mavenGroup already specifies forcedVersion (" +
+ groupVersion +
")"
)
} else {
@@ -241,9 +243,7 @@
if (ALLOWED_EXTRA_PREFIXES.any { extra.startsWith(it) }) {
for (potentialPrefix in ALLOWED_EXTRA_PREFIXES) {
if (extra.startsWith(potentialPrefix)) {
- val secondExtraPart = extra.removePrefix(
- potentialPrefix
- )
+ val secondExtraPart = extra.removePrefix(potentialPrefix)
if (secondExtraPart.toIntOrNull() == null) {
throw IllegalArgumentException(
"Version $version is not" +
@@ -268,11 +268,15 @@
// Grant an exception to the same-version-group policy for artifacts that haven't shipped a
// stable API surface, e.g. 1.0.0-alphaXX, to allow for rapid early-stage development.
val version = mavenVersion
- return version != null && version.major == 1 && version.minor == 0 && version.patch == 0 &&
+ return version != null &&
+ version.major == 1 &&
+ version.minor == 0 &&
+ version.patch == 0 &&
version.isAlpha()
}
private var versionIsSet = false
+
fun isVersionSet(): Boolean {
return versionIsSet
}
@@ -281,18 +285,18 @@
var inceptionYear: String? = null
/**
- * targetsJavaConsumers = true, if project is intended to be accessed from Java-language
- * source code.
+ * targetsJavaConsumers = true, if project is intended to be accessed from Java-language source
+ * code.
*/
var targetsJavaConsumers = true
get() {
when (project.path) {
- // add per-project overrides here
- // for example
- // the following project is intended to be accessed from Java
- // ":compose:lint:internal-lint-checks" -> return true
- // the following project is not intended to be accessed from Java
- // ":annotation:annotation" -> return false
+ // add per-project overrides here
+ // for example
+ // the following project is intended to be accessed from Java
+ // ":compose:lint:internal-lint-checks" -> return true
+ // the following project is not intended to be accessed from Java
+ // ":annotation:annotation" -> return false
}
// TODO: rework this to use LibraryType. Fork Library and KolinOnlyLibrary?
if (project.path.contains("-ktx")) return false
@@ -301,6 +305,7 @@
if (project.path.startsWith(":text:text")) return false
return field
}
+
private var licenses: MutableCollection<License> = ArrayList()
// Should only be used to override LibraryType.publish, if a library isn't ready to publish yet
@@ -332,10 +337,8 @@
}
}
- internal fun isPublishConfigured(): Boolean = (
- publish != Publish.UNSET ||
- type.publish != Publish.UNSET
- )
+ internal fun isPublishConfigured(): Boolean =
+ (publish != Publish.UNSET || type.publish != Publish.UNSET)
fun shouldPublishSbom(): Boolean {
// IDE plugins are used by and ship inside Studio
@@ -350,6 +353,7 @@
// @Deprecated("Replaced with AndroidXExtension.type: LibraryType.runApiTasks")
var runApiTasks: RunApiTasks = RunApiTasks.Auto
get() = if (field == RunApiTasks.Auto && type != LibraryType.UNSET) type.checkApi else field
+
var type: LibraryType = LibraryType.UNSET
var failOnDeprecationWarnings = true
@@ -370,8 +374,7 @@
}
fun shouldEnforceKotlinStrictApiMode(): Boolean {
- return !legacyDisableKotlinStrictApiMode &&
- shouldConfigureApiTasks()
+ return !legacyDisableKotlinStrictApiMode && shouldConfigureApiTasks()
}
fun license(closure: Closure<Any>): License {
@@ -389,11 +392,24 @@
}
fun getReferenceSha(): Provider<String> {
- return project.providers.provider {
- project.getFrameworksSupportCommitShaAtHead()
- }
+ return project.providers.provider { project.getFrameworksSupportCommitShaAtHead() }
}
+ /**
+ * Specify the version for Kotlin API compatibility mode used during Kotlin compilation.
+ *
+ * Changing this value will force clients to update their Kotlin compiler version, which may be
+ * disruptive. Library developers should only change this value if there is a strong reason to
+ * upgrade their Kotlin API version ahead of the rest of Jetpack.
+ */
+ abstract val kotlinTarget: Property<KotlinTarget>
+
+ override val kotlinApiVersion: Provider<KotlinVersion>
+ get() = kotlinTarget.map { it.apiVersion }
+
+ override val kotlinBomVersion: Provider<String>
+ get() = kotlinTarget.map { project.getVersionByName(it.catalogVersion) }
+
companion object {
const val DEFAULT_UNSPECIFIED_VERSION = "unspecified"
}
@@ -408,6 +424,7 @@
companion object {
private const val EXTENSION_NAME = "deviceTests"
+
internal fun register(extensions: ExtensionContainer): DeviceTests {
return extensions.findByType(DeviceTests::class.java)
?: extensions.create(EXTENSION_NAME, DeviceTests::class.java)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
index 32a3574..24e34dc 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
@@ -24,44 +24,33 @@
/**
* Whether to enable constraints for projects in same-version groups
*
- * This is expected to be true during builds that publish artifacts externally
- * This is expected to be false during most other builds because:
- * Developers may be interested in including only a subset of projects in ANDROIDX_PROJECTS to
- * make Studio run more quickly.
- * If a build contains only a subset of projects, we cannot necessarily add constraints between
- * all pairs of projects in the same group.
- * We want most builds to have high remote cache usage, so we want constraints to be
- * similar across most builds
- * See go/androidx-group-constraints for more information
+ * This is expected to be true during builds that publish artifacts externally This is expected to
+ * be false during most other builds because: Developers may be interested in including only a
+ * subset of projects in ANDROIDX_PROJECTS to make Studio run more quickly. If a build contains only
+ * a subset of projects, we cannot necessarily add constraints between all pairs of projects in the
+ * same group. We want most builds to have high remote cache usage, so we want constraints to be
+ * similar across most builds See go/androidx-group-constraints for more information
*/
const val ADD_GROUP_CONSTRAINTS = "androidx.constraints"
/**
- * Setting this property makes Test tasks succeed even if there
- * are some failing tests. Useful when running tests in CI where build
- * passes test results as XML to test reporter.
+ * Setting this property makes Test tasks succeed even if there are some failing tests. Useful when
+ * running tests in CI where build passes test results as XML to test reporter.
*/
const val TEST_FAILURES_DO_NOT_FAIL_TEST_TASK = "androidx.ignoreTestFailures"
-/**
- * Setting this property to false makes test tasks not display detailed output to stdout.
- */
+/** Setting this property to false makes test tasks not display detailed output to stdout. */
const val DISPLAY_TEST_OUTPUT = "androidx.displayTestOutput"
-/**
- * Setting this property changes "url" property in publishing maven artifact metadata
- */
+/** Setting this property changes "url" property in publishing maven artifact metadata */
const val ALTERNATIVE_PROJECT_URL = "androidx.alternativeProjectUrl"
/**
- * Check that version extra meets the specified rules
- * (version is in format major.minor.patch-extra)
+ * Check that version extra meets the specified rules (version is in format major.minor.patch-extra)
*/
const val VERSION_EXTRA_CHECK_ENABLED = "androidx.versionExtraCheckEnabled"
-/**
- * Validate the project structure against Jetpack guidelines
- */
+/** Validate the project structure against Jetpack guidelines */
const val VALIDATE_PROJECT_STRUCTURE = "androidx.validateProjectStructure"
/**
@@ -76,14 +65,10 @@
*/
const val ENABLE_COMPOSE_COMPILER_REPORTS = "androidx.enableComposeCompilerReports"
-/**
- * Returns whether the project should generate documentation.
- */
+/** Returns whether the project should generate documentation. */
const val ENABLE_DOCUMENTATION = "androidx.enableDocumentation"
-/**
- * Setting this property puts a summary of the relevant failure messages into standard error
- */
+/** Setting this property puts a summary of the relevant failure messages into standard error */
const val SUMMARIZE_STANDARD_ERROR = "androidx.summarizeStderr"
/**
@@ -92,9 +77,7 @@
*/
const val USE_MAX_DEP_VERSIONS = "androidx.useMaxDepVersions"
-/**
- * Setting this property enables writing versioned API files
- */
+/** Setting this property enables writing versioned API files */
const val WRITE_VERSIONED_API_FILES = "androidx.writeVersionedApiFiles"
/**
@@ -102,38 +85,36 @@
*/
const val PLAYGROUND_SNAPSHOT_BUILD_ID = "androidx.playground.snapshotBuildId"
-/**
- * Build Id used to pull SNAPSHOT version of Metalava for Playground projects
- */
+/** Build Id used to pull SNAPSHOT version of Metalava for Playground projects */
const val PLAYGROUND_METALAVA_BUILD_ID = "androidx.playground.metalavaBuildId"
/**
- * Filepath to the java agent of YourKit for profiling
- * If this value is set, profiling via YourKit will automatically be enabled
+ * Filepath to the java agent of YourKit for profiling If this value is set, profiling via YourKit
+ * will automatically be enabled
*/
const val PROFILE_YOURKIT_AGENT_PATH = "androidx.profile.yourkitAgentPath"
/**
- * Specifies to validate that the build doesn't generate any unrecognized messages
- * This prevents developers from inadvertently adding new warnings to the build output
+ * Specifies to validate that the build doesn't generate any unrecognized messages This prevents
+ * developers from inadvertently adding new warnings to the build output
*/
const val VALIDATE_NO_UNRECOGNIZED_MESSAGES = "androidx.validateNoUnrecognizedMessages"
/**
- * Specifies to run the build twice and validate that the second build doesn't run more
- * tasks than expected.
+ * Specifies to run the build twice and validate that the second build doesn't run more tasks than
+ * expected.
*/
const val VERIFY_UP_TO_DATE = "androidx.verifyUpToDate"
/**
- * If true, we are building in GitHub and should enable build features related to KMP.
- * If false, we are in AOSP, where not all KMP features are enabled.
+ * If true, we are building in GitHub and should enable build features related to KMP. If false, we
+ * are in AOSP, where not all KMP features are enabled.
*/
const val KMP_GITHUB_BUILD = "androidx.github.build"
/**
- * If true, don't require lint-checks project to exist. This should only be set in
- * integration tests, to allow them to save time by not configuring extra projects.
+ * If true, don't require lint-checks project to exist. This should only be set in integration
+ * tests, to allow them to save time by not configuring extra projects.
*/
const val ALLOW_MISSING_LINT_CHECKS_PROJECT = "androidx.allow.missing.lint"
@@ -143,14 +124,10 @@
*/
const val XCODEGEN_DOWNLOAD_URI = "androidx.benchmark.darwin.xcodeGenDownloadUri"
-/**
- * If true, don't restrict usage of compileSdk property.
- */
+/** If true, don't restrict usage of compileSdk property. */
const val ALLOW_CUSTOM_COMPILE_SDK = "androidx.allowCustomCompileSdk"
-/**
- * Whether to update gradle signature verification metadata
- */
+/** Whether to update gradle signature verification metadata */
const val UPDATE_SIGNATURES = "androidx.update.signatures"
/**
@@ -165,51 +142,53 @@
*/
const val SUPPRESS_COMPATIBILITY_OPT_IN = "androidx.suppress.compatibility.optin"
-val ALL_ANDROIDX_PROPERTIES = setOf(
- ADD_GROUP_CONSTRAINTS,
- ALTERNATIVE_PROJECT_URL,
- VERSION_EXTRA_CHECK_ENABLED,
- VALIDATE_PROJECT_STRUCTURE,
- ENABLE_COMPOSE_COMPILER_METRICS,
- ENABLE_COMPOSE_COMPILER_REPORTS,
- DISPLAY_TEST_OUTPUT,
- ENABLE_DOCUMENTATION,
- STUDIO_TYPE,
- SUMMARIZE_STANDARD_ERROR,
- USE_MAX_DEP_VERSIONS,
- TEST_FAILURES_DO_NOT_FAIL_TEST_TASK,
- VALIDATE_NO_UNRECOGNIZED_MESSAGES,
- VERIFY_UP_TO_DATE,
- WRITE_VERSIONED_API_FILES,
- AffectedModuleDetector.ENABLE_ARG,
- AffectedModuleDetector.BASE_COMMIT_ARG,
- PLAYGROUND_SNAPSHOT_BUILD_ID,
- PLAYGROUND_METALAVA_BUILD_ID,
- PROFILE_YOURKIT_AGENT_PATH,
- KMP_GITHUB_BUILD,
- ENABLED_KMP_TARGET_PLATFORMS,
- ALLOW_MISSING_LINT_CHECKS_PROJECT,
- XCODEGEN_DOWNLOAD_URI,
- ALLOW_CUSTOM_COMPILE_SDK,
- UPDATE_SIGNATURES,
- FilteredAnchorTask.PROP_TASK_NAME,
- FilteredAnchorTask.PROP_PATH_PREFIX,
-) + AndroidConfigImpl.GRADLE_PROPERTIES
+val ALL_ANDROIDX_PROPERTIES =
+ setOf(
+ ADD_GROUP_CONSTRAINTS,
+ ALTERNATIVE_PROJECT_URL,
+ VERSION_EXTRA_CHECK_ENABLED,
+ VALIDATE_PROJECT_STRUCTURE,
+ ENABLE_COMPOSE_COMPILER_METRICS,
+ ENABLE_COMPOSE_COMPILER_REPORTS,
+ DISPLAY_TEST_OUTPUT,
+ ENABLE_DOCUMENTATION,
+ STUDIO_TYPE,
+ SUMMARIZE_STANDARD_ERROR,
+ USE_MAX_DEP_VERSIONS,
+ TEST_FAILURES_DO_NOT_FAIL_TEST_TASK,
+ VALIDATE_NO_UNRECOGNIZED_MESSAGES,
+ VERIFY_UP_TO_DATE,
+ WRITE_VERSIONED_API_FILES,
+ AffectedModuleDetector.ENABLE_ARG,
+ AffectedModuleDetector.BASE_COMMIT_ARG,
+ PLAYGROUND_SNAPSHOT_BUILD_ID,
+ PLAYGROUND_METALAVA_BUILD_ID,
+ PROFILE_YOURKIT_AGENT_PATH,
+ KMP_GITHUB_BUILD,
+ ENABLED_KMP_TARGET_PLATFORMS,
+ ALLOW_MISSING_LINT_CHECKS_PROJECT,
+ XCODEGEN_DOWNLOAD_URI,
+ ALLOW_CUSTOM_COMPILE_SDK,
+ UPDATE_SIGNATURES,
+ FilteredAnchorTask.PROP_TASK_NAME,
+ FilteredAnchorTask.PROP_PATH_PREFIX,
+ ) + AndroidConfigImpl.GRADLE_PROPERTIES
-val PREFIXED_ANDROIDX_PROPERTIES = setOf(
- SUPPRESS_COMPATIBILITY_OPT_OUT,
- SUPPRESS_COMPATIBILITY_OPT_IN,
-)
+val PREFIXED_ANDROIDX_PROPERTIES =
+ setOf(
+ SUPPRESS_COMPATIBILITY_OPT_OUT,
+ SUPPRESS_COMPATIBILITY_OPT_IN,
+ )
/**
- * Whether to enable constraints for projects in same-version groups
- * See the property definition for more details
+ * Whether to enable constraints for projects in same-version groups See the property definition for
+ * more details
*/
fun Project.shouldAddGroupConstraints() = booleanPropertyProvider(ADD_GROUP_CONSTRAINTS)
/**
- * Returns alternative project url that will be used as "url" property
- * in publishing maven artifact metadata.
+ * Returns alternative project url that will be used as "url" property in publishing maven artifact
+ * metadata.
*
* Returns null if there is no alternative project url.
*/
@@ -217,15 +196,12 @@
project.findProperty(ALTERNATIVE_PROJECT_URL) as? String
/**
- * Check that version extra meets the specified rules
- * (version is in format major.minor.patch-extra)
+ * Check that version extra meets the specified rules (version is in format major.minor.patch-extra)
*/
fun Project.isVersionExtraCheckEnabled(): Boolean =
findBooleanProperty(VERSION_EXTRA_CHECK_ENABLED) ?: true
-/**
- * Validate the project structure against Jetpack guidelines
- */
+/** Validate the project structure against Jetpack guidelines */
fun Project.isValidateProjectStructureEnabled(): Boolean =
findBooleanProperty(VALIDATE_PROJECT_STRUCTURE) ?: true
@@ -235,15 +211,19 @@
fun Project.validateAllAndroidxArgumentsAreRecognized() {
for (propertyName in project.properties.keys) {
if (propertyName.startsWith("androidx")) {
- if (!ALL_ANDROIDX_PROPERTIES.contains(propertyName) &&
- PREFIXED_ANDROIDX_PROPERTIES.none { propertyName.startsWith(it) }) {
- val message = "Unrecognized Androidx property '$propertyName'.\n" +
- "\n" +
- "Is this a misspelling? All recognized Androidx properties:\n" +
- ALL_ANDROIDX_PROPERTIES.joinToString("\n") + "\n" +
- "\n" +
- "See AndroidXGradleProperties.kt if you need to add this property to " +
- "the list of known properties."
+ if (
+ !ALL_ANDROIDX_PROPERTIES.contains(propertyName) &&
+ PREFIXED_ANDROIDX_PROPERTIES.none { propertyName.startsWith(it) }
+ ) {
+ val message =
+ "Unrecognized Androidx property '$propertyName'.\n" +
+ "\n" +
+ "Is this a misspelling? All recognized Androidx properties:\n" +
+ ALL_ANDROIDX_PROPERTIES.joinToString("\n") +
+ "\n" +
+ "\n" +
+ "See AndroidXGradleProperties.kt if you need to add this property to " +
+ "the list of known properties."
throw GradleException(message)
}
}
@@ -251,15 +231,16 @@
}
/**
- * Returns whether tests in the project should display output.
- * Build server scripts generally set displayTestOutput to false so that their failing test
- * results aren't considered build failures, and instead pass their test failures on via build
- * artifacts to be tracked and displayed on test dashboards in a different format
+ * Returns whether tests in the project should display output. Build server scripts generally set
+ * displayTestOutput to false so that their failing test results aren't considered build failures,
+ * and instead pass their test failures on via build artifacts to be tracked and displayed on test
+ * dashboards in a different format
*/
fun Project.isDisplayTestOutput(): Boolean = findBooleanProperty(DISPLAY_TEST_OUTPUT) ?: true
/**
* Returns whether the project should write versioned API files, e.g. `1.1.0-alpha01.txt`.
+ *
* <p>
* When set to `true`, the `updateApi` task will write the current API surface to both `current.txt`
* and `<version>.txt`. When set to `false`, only `current.txt` will be written. The default value
@@ -268,9 +249,7 @@
fun Project.isWriteVersionedApiFilesEnabled(): Boolean =
findBooleanProperty(WRITE_VERSIONED_API_FILES) ?: true
-/**
- * Returns whether the project should generate documentation.
- */
+/** Returns whether the project should generate documentation. */
fun Project.isDocumentationEnabled(): Boolean {
if (System.getenv().containsKey("ANDROIDX_PROJECTS")) {
val projects = System.getenv()["ANDROIDX_PROJECTS"] as String
@@ -279,32 +258,26 @@
return (project.findProperty(ENABLE_DOCUMENTATION) as? String)?.toBoolean() ?: true
}
-/**
- * Returns whether the build is for checking forward compatibility across projects
- */
+/** Returns whether the build is for checking forward compatibility across projects */
fun Project.usingMaxDepVersions(): Boolean {
return project.hasProperty(USE_MAX_DEP_VERSIONS)
}
/**
- * Returns whether this is an integration test that is allowing lint checks to be skipped to
- * save configuration time.
+ * Returns whether this is an integration test that is allowing lint checks to be skipped to save
+ * configuration time.
*/
fun Project.allowMissingLintProject() =
findBooleanProperty(ALLOW_MISSING_LINT_CHECKS_PROJECT) ?: false
-/**
- * Whether libraries are allowed to customize the value of the compileSdk property.
- */
+/** Whether libraries are allowed to customize the value of the compileSdk property. */
fun Project.isCustomCompileSdkAllowed(): Boolean =
findBooleanProperty(ALLOW_CUSTOM_COMPILE_SDK) ?: true
fun Project.findBooleanProperty(propName: String) = (findProperty(propName) as? String)?.toBoolean()
fun Project.booleanPropertyProvider(propName: String): Provider<Boolean> {
- return project.providers.gradleProperty(propName).map { s ->
- s.toBoolean()
- }.orElse(false)
+ return project.providers.gradleProperty(propName).map { s -> s.toBoolean() }.orElse(false)
}
/**
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
index f6c5532..2b8e4e7 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
@@ -24,7 +24,6 @@
import androidx.build.checkapi.KmpApiTaskConfig
import androidx.build.checkapi.LibraryApiTaskConfig
import androidx.build.checkapi.configureProjectForApiTasks
-import androidx.build.dependencies.KOTLIN_VERSION
import androidx.build.gradle.isRoot
import androidx.build.license.configureExternalDependencyLicenseCheck
import androidx.build.resources.configurePublicResourcesStub
@@ -61,6 +60,7 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
import org.gradle.api.component.SoftwareComponentFactory
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.JavaPlugin
@@ -77,35 +77,39 @@
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.KotlinClosure1
import org.gradle.kotlin.dsl.create
+import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
+import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests
import org.jetbrains.kotlin.gradle.tasks.CInteropProcess
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
/**
- * A plugin which enables all of the Gradle customizations for AndroidX.
- * This plugin reacts to other plugins being added and adds required and optional functionality.
+ * A plugin which enables all of the Gradle customizations for AndroidX. This plugin reacts to other
+ * plugins being added and adds required and optional functionality.
*/
-
-class AndroidXImplPlugin @Inject constructor(
- private val componentFactory: SoftwareComponentFactory
-) : Plugin<Project> {
+class AndroidXImplPlugin
+@Inject
+constructor(private val componentFactory: SoftwareComponentFactory) : Plugin<Project> {
override fun apply(project: Project) {
if (project.isRoot)
throw Exception("Root project should use AndroidXRootImplPlugin instead")
val extension = project.extensions.create<AndroidXExtension>(EXTENSION_NAME, project)
- val kmpExtension = project.extensions.create<AndroidXMultiplatformExtension>(
- AndroidXMultiplatformExtension.EXTENSION_NAME,
- project
- )
+ val kmpExtension =
+ project.extensions.create<AndroidXMultiplatformExtension>(
+ AndroidXMultiplatformExtension.EXTENSION_NAME,
+ project
+ )
project.tasks.register(BUILD_ON_SERVER_TASK, DefaultTask::class.java)
// Perform different actions based on which plugins have been applied to the project.
@@ -121,19 +125,17 @@
}
project.configureKtlint()
- project.configureKotlinStdlibVersion()
+ project.configureKotlinVersion()
// Configure all Jar-packing tasks for hermetic builds.
project.tasks.withType(Zip::class.java).configureEach { it.configureForHermeticBuild() }
project.tasks.withType(Copy::class.java).configureEach { it.configureForHermeticBuild() }
// copy host side test results to DIST
- project.tasks.withType(AbstractTestTask::class.java) {
- task -> configureTestTask(project, task)
+ project.tasks.withType(AbstractTestTask::class.java) { task ->
+ configureTestTask(project, task)
}
- project.tasks.withType(Test::class.java) {
- task -> configureJvmTestTask(project, task)
- }
+ project.tasks.withType(Test::class.java) { task -> configureJvmTestTask(project, task) }
project.configureTaskTimeouts()
project.configureMavenArtifactUpload(extension, kmpExtension, componentFactory)
@@ -223,9 +225,8 @@
}
private fun configureTestTask(project: Project, task: AbstractTestTask) {
- val ignoreFailuresProperty = project.providers.gradleProperty(
- TEST_FAILURES_DO_NOT_FAIL_TEST_TASK
- )
+ val ignoreFailuresProperty =
+ project.providers.gradleProperty(TEST_FAILURES_DO_NOT_FAIL_TEST_TASK)
val ignoreFailures = ignoreFailuresProperty.isPresent
if (ignoreFailures) {
task.ignoreFailures = true
@@ -239,9 +240,8 @@
it.testModules.add(
TestModule(
name = testName,
- path = listOf(
- project.projectDir.toRelativeString(project.getSupportRootFolder())
- )
+ path =
+ listOf(project.projectDir.toRelativeString(project.getSupportRootFolder()))
)
)
}
@@ -249,10 +249,13 @@
if (project.isDisplayTestOutput()) {
// Enable tracing to see results in command line
task.testLogging.apply {
- events = hashSetOf(
- TestLogEvent.FAILED, TestLogEvent.PASSED,
- TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT
- )
+ events =
+ hashSetOf(
+ TestLogEvent.FAILED,
+ TestLogEvent.PASSED,
+ TestLogEvent.SKIPPED,
+ TestLogEvent.STANDARD_OUT
+ )
showExceptions = true
showCauses = true
showStackTraces = true
@@ -267,24 +270,70 @@
minGranularity = 1000
}
val testTaskName = task.name
- val capitalizedTestTaskName = testTaskName.replaceFirstChar {
- if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
- }
+ val capitalizedTestTaskName =
+ testTaskName.replaceFirstChar {
+ if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
+ }
val xmlReport = task.reports.junitXml
if (xmlReport.required.get()) {
- val zipXmlTask = project.tasks.register(
- "zipXmlResultsOf$capitalizedTestTaskName",
- Zip::class.java
- ) {
- it.destinationDirectory.set(xmlReportDestDir)
- it.archiveFileName.set(archiveName)
- it.from(project.file(xmlReport.outputLocation))
- }
+ val zipXmlTask =
+ project.tasks.register(
+ "zipXmlResultsOf$capitalizedTestTaskName",
+ Zip::class.java
+ ) {
+ it.destinationDirectory.set(xmlReportDestDir)
+ it.archiveFileName.set(archiveName)
+ it.from(project.file(xmlReport.outputLocation))
+ }
task.finalizedBy(zipXmlTask)
}
}
}
+ /** Configures the project to use the Kotlin version specified by `androidx.kotlinTarget`. */
+ private fun Project.configureKotlinVersion() {
+ val kotlinVersionStringProvider = androidXConfiguration.kotlinBomVersion
+
+ // Resolve Kotlin versions to the target version or higher.
+ configurations.all { configuration ->
+ configuration.resolutionStrategy { strategy ->
+ strategy.eachDependency { details ->
+ if (details.requested.group == "org.jetbrains.kotlin") {
+ val requestedVersion =
+ if (details.requested.version.isNullOrEmpty()) {
+ null
+ } else {
+ Version(details.requested.version!!)
+ }
+ val bomVersion = kotlinVersionStringProvider.get()
+ if (requestedVersion == null || requestedVersion < Version(bomVersion)) {
+ details.useVersion(bomVersion)
+ }
+ }
+ }
+ }
+ }
+
+ // Set the Kotlin compiler's API and language version to ensure bytecode is compatible.
+ val kotlinVersionProvider =
+ kotlinVersionStringProvider.map { version ->
+ KotlinVersion.fromVersion(version.substringBeforeLast('.'))
+ }
+ tasks.configureEach { task ->
+ (task as? KotlinCompilationTask<*>)?.apply {
+ compilerOptions.apiVersion.set(kotlinVersionProvider)
+ compilerOptions.languageVersion.set(kotlinVersionProvider)
+ }
+ }
+
+ // Specify coreLibrariesVersion for consumption by Kotlin Gradle Plugin.
+ afterEvaluate { evaluatedProject ->
+ evaluatedProject.kotlinExtensionOrNull?.let { kotlinExtension ->
+ kotlinExtension.coreLibrariesVersion = kotlinVersionStringProvider.get()
+ }
+ }
+ }
+
private fun configureWithKotlinPlugin(
project: Project,
extension: AndroidXExtension,
@@ -294,19 +343,20 @@
project.afterEvaluate {
project.tasks.withType(KotlinCompile::class.java).configureEach { task ->
-
if (extension.type == LibraryType.COMPILER_PLUGIN) {
task.kotlinOptions.jvmTarget = "11"
- } else if (extension.type.compilationTarget == CompilationTarget.HOST &&
- extension.type != LibraryType.ANNOTATION_PROCESSOR_UTILS
+ } else if (
+ extension.type.compilationTarget == CompilationTarget.HOST &&
+ extension.type != LibraryType.ANNOTATION_PROCESSOR_UTILS
) {
task.kotlinOptions.jvmTarget = "17"
} else {
task.kotlinOptions.jvmTarget = "1.8"
}
- val kotlinCompilerArgs = mutableListOf(
- "-Xskip-metadata-version-check",
- )
+ val kotlinCompilerArgs =
+ mutableListOf(
+ "-Xskip-metadata-version-check",
+ )
// TODO (b/259578592): enable -Xjvm-default=all for camera-camera2-pipe projects
if (!project.name.contains("camera-camera2-pipe")) {
kotlinCompilerArgs += "-Xjvm-default=all"
@@ -319,17 +369,19 @@
// Additional Context:
// https://github.com/JetBrains/kotlin/blob/master/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt#L239
// b/280633711
- kotlinCompilerArgs += listOf(
- "-Xno-param-assertions",
- "-Xno-call-assertions",
- "-Xno-receiver-assertions"
- )
+ kotlinCompilerArgs +=
+ listOf(
+ "-Xno-param-assertions",
+ "-Xno-call-assertions",
+ "-Xno-receiver-assertions"
+ )
}
task.kotlinOptions.freeCompilerArgs += kotlinCompilerArgs
}
- val isAndroidProject = project.plugins.hasPlugin(LibraryPlugin::class.java) ||
- project.plugins.hasPlugin(AppPlugin::class.java)
+ val isAndroidProject =
+ project.plugins.hasPlugin(LibraryPlugin::class.java) ||
+ project.plugins.hasPlugin(AppPlugin::class.java)
// Explicit API mode is broken for Android projects
// https://youtrack.jetbrains.com/issue/KT-37652
if (extension.shouldEnforceKotlinStrictApiMode() && !isAndroidProject) {
@@ -386,10 +438,7 @@
}
}
- private fun configureWithTestPlugin(
- project: Project,
- androidXExtension: AndroidXExtension
- ) {
+ private fun configureWithTestPlugin(project: Project, androidXExtension: AndroidXExtension) {
project.extensions.getByType<TestExtension>().apply {
configureAndroidBaseOptions(project, androidXExtension)
project.addAppApkToTestConfigGeneration(androidXExtension)
@@ -408,17 +457,15 @@
@Suppress("UnstableApiUsage") // usage of experimentalProperties
private fun Variant.artRewritingWorkaround() {
// b/279234807
- experimentalProperties.put(
- "android.experimental.art-profile-r8-rewriting",
- false
- )
+ experimentalProperties.put("android.experimental.art-profile-r8-rewriting", false)
}
private fun HasAndroidTest.configureLicensePackaging() {
androidTest?.packaging?.resources?.apply {
// Workaround a limitation in AGP that fails to merge these META-INF license files.
pickFirsts.add("/META-INF/AL2.0")
- // In addition to working around the above issue, we exclude the LGPL2.1 license as we're
+ // In addition to working around the above issue, we exclude the LGPL2.1 license as
+ // we're
// approved to distribute code via AL2.0 and the only dependencies which pull in LGPL2.1
// are currently dual-licensed with AL2.0 and LGPL2.1. The affected dependencies are:
// - net.java.dev.jna:jna:5.5.0
@@ -427,73 +474,58 @@
}
/**
- * Excludes files telling which versions of androidx libraries were used in test apks
- * to avoid invalidating the build cache as often
+ * Excludes files telling which versions of androidx libraries were used in test apks to avoid
+ * invalidating the build cache as often
*/
private fun HasAndroidTest.excludeVersionFilesFromTestApks() {
- androidTest?.packaging?.resources?.apply {
- excludes.add("/META-INF/androidx*.version")
- }
- }
-
- private fun Project.configureKotlinStdlibVersion() {
- project.configurations.all { configuration ->
- configuration.resolutionStrategy { strategy ->
- strategy.eachDependency { details ->
- if (details.requested.group == "org.jetbrains.kotlin" &&
- (details.requested.name == "kotlin-stdlib-jdk7" ||
- details.requested.name == "kotlin-stdlib-jdk8")) {
- details.useVersion(KOTLIN_VERSION)
- }
- }
- }
- }
+ androidTest?.packaging?.resources?.apply { excludes.add("/META-INF/androidx*.version") }
}
@Suppress("DEPRECATION") // AGP DSL APIs
- private fun configureWithLibraryPlugin(
- project: Project,
- androidXExtension: AndroidXExtension
- ) {
- val libraryExtension = project.extensions.getByType<LibraryExtension>().apply {
- configureAndroidBaseOptions(project, androidXExtension)
- project.addAppApkToTestConfigGeneration(androidXExtension)
- configureAndroidLibraryOptions(project, androidXExtension)
+ private fun configureWithLibraryPlugin(project: Project, androidXExtension: AndroidXExtension) {
+ val libraryExtension =
+ project.extensions.getByType<LibraryExtension>().apply {
+ configureAndroidBaseOptions(project, androidXExtension)
+ project.addAppApkToTestConfigGeneration(androidXExtension)
+ configureAndroidLibraryOptions(project, androidXExtension)
- // Make sure the main Kotlin source set doesn't contain anything under src/main/kotlin.
- val mainKotlinSrcDir = (sourceSets.findByName("main")?.kotlin
- as com.android.build.gradle.api.AndroidSourceDirectorySet)
- .srcDirs
- .filter { it.name == "kotlin" }
- .getOrNull(0)
- if (mainKotlinSrcDir?.isDirectory == true) {
- throw GradleException(
- "Invalid project structure! AndroidX does not support \"kotlin\" as a " +
- "top-level source directory for libraries, use \"java\" instead: " +
- mainKotlinSrcDir.path
- )
+ // Make sure the main Kotlin source set doesn't contain anything under
+ // src/main/kotlin.
+ val mainKotlinSrcDir =
+ (sourceSets.findByName("main")?.kotlin
+ as com.android.build.gradle.api.AndroidSourceDirectorySet)
+ .srcDirs
+ .filter { it.name == "kotlin" }
+ .getOrNull(0)
+ if (mainKotlinSrcDir?.isDirectory == true) {
+ throw GradleException(
+ "Invalid project structure! AndroidX does not support \"kotlin\" as a " +
+ "top-level source directory for libraries, use \"java\" instead: " +
+ mainKotlinSrcDir.path
+ )
+ }
}
- }
// Remove the android:targetSdkVersion element from the manifest used for AARs.
project.extensions.getByType<LibraryAndroidComponentsExtension>().onVariants { variant ->
- project.tasks.register(
- variant.name + "AarManifestTransformer",
- AarManifestTransformerTask::class.java
- ).let { taskProvider ->
- variant.artifacts.use(taskProvider)
- .wiredWithFiles(
- AarManifestTransformerTask::aarFile,
- AarManifestTransformerTask::updatedAarFile
- )
- .toTransform(SingleArtifact.AAR)
- }
+ project.tasks
+ .register(
+ variant.name + "AarManifestTransformer",
+ AarManifestTransformerTask::class.java
+ )
+ .let { taskProvider ->
+ variant.artifacts
+ .use(taskProvider)
+ .wiredWithFiles(
+ AarManifestTransformerTask::aarFile,
+ AarManifestTransformerTask::updatedAarFile
+ )
+ .toTransform(SingleArtifact.AAR)
+ }
}
project.extensions.getByType<com.android.build.api.dsl.LibraryExtension>().apply {
- publishing {
- singleVariant(DEFAULT_PUBLISH_CONFIG)
- }
+ publishing { singleVariant(DEFAULT_PUBLISH_CONFIG) }
}
project.extensions.getByType<LibraryAndroidComponentsExtension>().apply {
@@ -527,9 +559,7 @@
libraryExtension.defaultPublishVariant { libraryVariant ->
reportLibraryMetrics.configure {
it.jarFiles.from(
- libraryVariant.packageLibraryProvider.map { zip ->
- zip.inputs.files
- }
+ libraryVariant.packageLibraryProvider.map { zip -> zip.inputs.files }
)
}
}
@@ -554,8 +584,9 @@
sourceCompatibility = VERSION_11
targetCompatibility = VERSION_11
}
- } else if (extension.type.compilationTarget == CompilationTarget.HOST &&
- extension.type != LibraryType.ANNOTATION_PROCESSOR_UTILS
+ } else if (
+ extension.type.compilationTarget == CompilationTarget.HOST &&
+ extension.type != LibraryType.ANNOTATION_PROCESSOR_UTILS
) {
javaExtension.apply {
sourceCompatibility = VERSION_17
@@ -586,11 +617,12 @@
if (project.multiplatformExtension == null) {
project.configureNonAndroidProjectForLint(extension)
}
- val apiTaskConfig = if (project.multiplatformExtension != null) {
- KmpApiTaskConfig
- } else {
- JavaApiTaskConfig
- }
+ val apiTaskConfig =
+ if (project.multiplatformExtension != null) {
+ KmpApiTaskConfig
+ } else {
+ JavaApiTaskConfig
+ }
project.configureProjectForApiTasks(apiTaskConfig, extension)
project.afterEvaluate {
@@ -608,14 +640,13 @@
project.addToProjectMap(extension)
}
- private fun Project.configureProjectStructureValidation(
- extension: AndroidXExtension
- ) {
+ private fun Project.configureProjectStructureValidation(extension: AndroidXExtension) {
// AndroidXExtension.mavenGroup is not readable until afterEvaluate.
afterEvaluate {
val mavenGroup = extension.mavenGroup
- val isProbablyPublished = extension.type == LibraryType.PUBLISHED_LIBRARY ||
- extension.type == LibraryType.UNSET
+ val isProbablyPublished =
+ extension.type == LibraryType.PUBLISHED_LIBRARY ||
+ extension.type == LibraryType.UNSET
if (mavenGroup != null && isProbablyPublished && extension.shouldPublish()) {
validateProjectStructure(mavenGroup.group)
validateProjectMavenName(extension.name.get(), mavenGroup.group)
@@ -623,13 +654,9 @@
}
}
- private fun Project.configureProjectVersionValidation(
- extension: AndroidXExtension
- ) {
+ private fun Project.configureProjectVersionValidation(extension: AndroidXExtension) {
// AndroidXExtension.mavenGroup is not readable until afterEvaluate.
- afterEvaluate {
- extension.validateMavenVersion()
- }
+ afterEvaluate { extension.validateMavenVersion() }
}
private fun BaseExtension.configureAndroidBaseOptions(
@@ -661,11 +688,12 @@
testOptions.unitTests.isReturnDefaultValues = true
testOptions.unitTests.all { task ->
// https://github.com/robolectric/robolectric/issues/7456
- task.jvmArgs = listOf(
- "--add-opens=java.base/java.lang=ALL-UNNAMED",
- "--add-opens=java.base/java.util=ALL-UNNAMED",
- "--add-opens=java.base/java.io=ALL-UNNAMED",
- )
+ task.jvmArgs =
+ listOf(
+ "--add-opens=java.base/java.lang=ALL-UNNAMED",
+ "--add-opens=java.base/java.util=ALL-UNNAMED",
+ "--add-opens=java.base/java.io=ALL-UNNAMED",
+ )
// Robolectric 1.7 increased heap size requirements, see b/207169653.
task.maxHeapSize = "3g"
}
@@ -678,8 +706,8 @@
check(minSdkVersion >= defaultMinSdkVersion) {
"minSdkVersion $minSdkVersion lower than the default of $defaultMinSdkVersion"
}
- check(compileSdkVersion == defaultCompileSdkVersion ||
- project.isCustomCompileSdkAllowed()
+ check(
+ compileSdkVersion == defaultCompileSdkVersion || project.isCustomCompileSdkAllowed()
) {
"compileSdkVersion must not be explicitly specified, was \"$compileSdkVersion\""
}
@@ -691,8 +719,10 @@
// Note: In playground, this ban is exempted to allow unresolvable prebuilts
// to automatically get bumped to snapshot versions via version range
// substitution.
- if (version != null && Version.isDependencyRange(version) &&
- project.rootProject.rootDir == project.getSupportRootFolder()
+ if (
+ version != null &&
+ Version.isDependencyRange(version) &&
+ project.rootProject.rootDir == project.getSupportRootFolder()
) {
throw IllegalArgumentException(
"Dependency ${dep.target} declares its version as " +
@@ -749,24 +779,41 @@
// this API takes an integer and we are unable to set it to a
// pre-release SDK.
defaultConfig.aarMetadata.minCompileSdk = project.defaultAndroidConfig.targetSdk
- project.configurations.all { config ->
- val isTestConfig = config.name.lowercase(Locale.US).contains("test")
- config.dependencyConstraints.configureEach { dependencyConstraint ->
- dependencyConstraint.apply {
- // Clear strict constraints on test dependencies and listenablefuture:1.0
- // Don't clear non-strict constraints because they might refer to projects,
- // and clearing their versions might be unsupported and unnecessary
- if (versionConstraint.strictVersion != "") {
- if (isTestConfig ||
- (group == "com.google.guava" &&
- name == "listenablefuture" &&
- version == "1.0")
- ) {
- version { versionConstraint ->
- versionConstraint.strictly("")
- }
- }
+ // The full Guava artifact is very large, so they split off a special artifact containing a
+ // standalone version of the commonly-used ListenableFuture interface. However, they also
+ // structured the artifacts in a way that causes dependency resolution conflicts:
+ // - `com.google.guava:listenablefuture:1.0` contains only ListenableFuture
+ // - `com.google.guava:listenablefuture:9999.0` contains nothing
+ // - `com.google.guava:guava` contains all of Guava, including ListenableFuture
+ // If a transitive dependency includes `guava` as implementation-type and we have a direct
+ // API-type dependency on `listenablefuture:1.0`, then we'll get `listenablefuture:9999.0`
+ // on the compilation classpath -- which does not have the ListenableFuture class. However,
+ // if we tell Gradle to upgrade all LF dependencies to Guava then we'll get `guava` as an
+ // API-type dependency. See b/274621238 for more details.
+ project.dependencies {
+ modules { moduleHandler ->
+ moduleHandler.module("com.google.guava:listenablefuture") { module ->
+ module.replacedBy("com.google.guava:guava")
+ }
+ }
+ }
+
+ // Gradle inserts strict version constraints to ensure that dependency versions are
+ // identical across main and test source sets. For normal projects, this ensures
+ // that test bytecode is binary- and behavior-compatible with the main source set's
+ // bytecode. For AndroidX, though, we require backward compatibility and therefore
+ // don't need to enforce such constraints.
+ project.configurations.all { configuration ->
+ if (!configuration.isTest()) return@all
+
+ configuration.dependencyConstraints.configureEach { dependencyConstraint ->
+ val strictVersion = dependencyConstraint.versionConstraint.strictVersion
+ if (strictVersion != "") {
+ // Migrate strict-type version constraints to required-type to allow upgrades.
+ dependencyConstraint.version { versionConstraint ->
+ versionConstraint.strictly("")
+ versionConstraint.require(strictVersion)
}
}
}
@@ -793,13 +840,13 @@
private fun TestedExtension.configureAndroidLibraryWithMultiplatformPluginOptions() {
sourceSets.findByName("main")!!.manifest.srcFile("src/androidMain/AndroidManifest.xml")
- sourceSets.findByName("androidTest")!!
- .manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
+ sourceSets
+ .findByName("androidTest")!!
+ .manifest
+ .srcFile("src/androidAndroidTest/AndroidManifest.xml")
}
- /**
- * Sets the konan distribution url to the prebuilts directory.
- */
+ /** Sets the konan distribution url to the prebuilts directory. */
private fun Project.configureKonanDirectory() {
if (ProjectLayoutType.isPlayground(this)) {
return // playground does not use prebuilts
@@ -814,36 +861,31 @@
val relativeRootPath = konanPrebuiltsFolder.relativeTo(rootProject.projectDir).path
val relativeProjectPath = konanPrebuiltsFolder.relativeTo(projectDir).path
tasks.withType(KotlinNativeCompile::class.java).configureEach {
- it.kotlinOptions.freeCompilerArgs += listOf(
- "-Xoverride-konan-properties=dependenciesUrl=file:$relativeRootPath"
- )
+ it.kotlinOptions.freeCompilerArgs +=
+ listOf("-Xoverride-konan-properties=dependenciesUrl=file:$relativeRootPath")
}
tasks.withType(CInteropProcess::class.java).configureEach {
- it.settings.extraOpts += listOf(
- "-Xoverride-konan-properties",
- "dependenciesUrl=file:$relativeProjectPath"
- )
+ it.settings.extraOpts +=
+ listOf("-Xoverride-konan-properties", "dependenciesUrl=file:$relativeProjectPath")
}
}
private fun Project.overrideKotlinNativeDistributionUrlToLocalDirectory() {
- val relativePath = getKonanPrebuiltsFolder()
- .resolve("nativeCompilerPrebuilts")
- .relativeTo(projectDir)
- .path
+ val relativePath =
+ getKonanPrebuiltsFolder().resolve("nativeCompilerPrebuilts").relativeTo(projectDir).path
val url = "file:$relativePath"
extensions.extraProperties["kotlin.native.distribution.baseDownloadUrl"] = url
}
private fun Project.configureKmpTests() {
- val kmpExtension = checkNotNull(
- project.extensions.findByType<KotlinMultiplatformExtension>()
- ) {
- """
+ val kmpExtension =
+ checkNotNull(project.extensions.findByType<KotlinMultiplatformExtension>()) {
+ """
Project ${project.path} applies kotlin multiplatform plugin but we cannot find the
KotlinMultiplatformExtension.
- """.trimIndent()
- }
+ """
+ .trimIndent()
+ }
kmpExtension.testableTargets.all { kotlinTarget ->
if (kotlinTarget is KotlinNativeTargetWithSimulatorTests) {
kotlinTarget.binaries.all {
@@ -884,9 +926,7 @@
// If this project wants other project in the same group to have the same version,
// this function configures those constraints.
- private fun Project.configureConstraintsWithinGroup(
- extension: AndroidXExtension
- ) {
+ private fun Project.configureConstraintsWithinGroup(extension: AndroidXExtension) {
if (!project.shouldAddGroupConstraints().get()) {
return
}
@@ -904,8 +944,10 @@
projectGroup.atomicGroupVersion ?: return@afterEvaluate
// We don't want to emit the same constraint into our .module file more than once,
- // and we don't want to try to apply a constraint to a configuration that doesn't accept them,
- // so we create a configuration to hold the constraints and make each other constraint extend it
+ // and we don't want to try to apply a constraint to a configuration that doesn't accept
+ // them,
+ // so we create a configuration to hold the constraints and make each other constraint
+ // extend it
val constraintConfiguration = project.configurations.create("groupConstraints")
project.configurations.configureEach { configuration ->
if (configuration != constraintConfiguration)
@@ -916,7 +958,7 @@
val constraints = project.dependencies.constraints
val allProjectsExist = buildContainsAllStandardProjects()
for (otherProject in otherProjectsInSameGroup) {
- val otherGradlePath = otherProject.gradlePath
+ val otherGradlePath = otherProject.gradlePath
if (otherGradlePath == ":compose:ui:ui-android-stubs") {
// exemption for library that doesn't truly get published: b/168127161
continue
@@ -952,14 +994,18 @@
continue
}
val dependencyConstraint = project(otherGradlePath)
- constraints.add(
- constraintConfiguration.name,
- dependencyConstraint
- )
+ constraints.add(constraintConfiguration.name, dependencyConstraint) {
+ it.because("${project.name} is in atomic group ${projectGroup.group}")
+ }
}
// disallow duplicate constraints
project.configurations.all { config ->
+ // Allow duplicate constraints in test configurations. This is partially a
+ // workaround for duplication due to downgrading strict-type dependencies to
+ // required-type, but also we don't care if tests have duplicate constraints.
+ if (config.isTest()) return@all
+
// find all constraints contributed by this Configuration and its ancestors
val configurationConstraints: MutableSet<String> = mutableSetOf()
config.hierarchy.forEach { parentConfig ->
@@ -967,18 +1013,19 @@
dependencyConstraint.apply {
if (
versionConstraint.requiredVersion != "" &&
- versionConstraint.requiredVersion != "unspecified"
+ versionConstraint.requiredVersion != "unspecified"
) {
val key =
"${dependencyConstraint.group}:${dependencyConstraint.name}"
if (configurationConstraints.contains(key)) {
throw GradleException(
"Constraint on $key was added multiple times in " +
- "$config (version = " +
- "${versionConstraint.requiredVersion}).\n\n" +
- "This is unnecessary and can also trigger " +
- "https://github.com/gradle/gradle/issues/24037 in " +
- "builds trying to use the resulting artifacts.")
+ "$config (version = " +
+ "${versionConstraint.requiredVersion}).\n\n" +
+ "This is unnecessary and can also trigger " +
+ "https://github.com/gradle/gradle/issues/24037 in " +
+ "builds trying to use the resulting artifacts."
+ )
}
configurationConstraints.add(key)
}
@@ -994,10 +1041,8 @@
* Sometimes developers request to include fewer projects because this may run more quickly
*/
private fun Project.buildContainsAllStandardProjects(): Boolean {
- if (getProjectSubset() != null)
- return false
- if (ProjectLayoutType.isPlayground(this))
- return false
+ if (getProjectSubset() != null) return false
+ if (ProjectLayoutType.isPlayground(this)) return false
return true
}
@@ -1010,9 +1055,7 @@
const val EXTENSION_NAME = "androidx"
- /**
- * Fail the build if a non-Studio task runs longer than expected
- */
+ /** Fail the build if a non-Studio task runs longer than expected */
const val TASK_TIMEOUT_MINUTES = 60L
}
}
@@ -1020,6 +1063,9 @@
private const val PROJECTS_MAP_KEY = "projects"
private const val ACCESSED_PROJECTS_MAP_KEY = "accessedProjectsMap"
+/** Returns whether the configuration is used for testing. */
+private fun Configuration.isTest(): Boolean = name.lowercase().contains("test")
+
/**
* Hides a project's Javadoc tasks from the output of `./gradlew tasks` by setting their group to
* `null`.
@@ -1050,8 +1096,9 @@
)
}
@Suppress("UNCHECKED_CAST")
- val projectModules = project.rootProject.extra.get(PROJECTS_MAP_KEY)
- as ConcurrentHashMap<String, String>
+ val projectModules =
+ project.rootProject.extra.get(PROJECTS_MAP_KEY)
+ as ConcurrentHashMap<String, String>
projectModules[module] = path
}
}
@@ -1061,6 +1108,12 @@
val Project.multiplatformExtension
get() = extensions.findByType(KotlinMultiplatformExtension::class.java)
+val Project.kotlinExtensionOrNull: KotlinProjectExtension?
+ get() = extensions.findByType()
+
+val Project.androidXExtension: AndroidXExtension
+ get() = extensions.getByType()
+
@Suppress("UNCHECKED_CAST")
fun Project.getProjectsMap(): ConcurrentHashMap<String, String> {
project.rootProject.extra.set(ACCESSED_PROJECTS_MAP_KEY, true)
@@ -1101,26 +1154,22 @@
}
/**
- * Returns a string that is a valid filename and loosely based on the project name
- * The value returned for each project will be distinct
+ * Returns a string that is a valid filename and loosely based on the project name The value
+ * returned for each project will be distinct
*/
fun String.asFilenamePrefix(): String {
return this.substring(1).replace(':', '-')
}
/**
- * Sets the specified [task] as a dependency of the top-level `check` task, ensuring that it runs
- * as part of `./gradlew check`.
+ * Sets the specified [task] as a dependency of the top-level `check` task, ensuring that it runs as
+ * part of `./gradlew check`.
*/
fun <T : Task> Project.addToCheckTask(task: TaskProvider<T>) {
- project.tasks.named("check").configure {
- it.dependsOn(task)
- }
+ project.tasks.named("check").configure { it.dependsOn(task) }
}
-/**
- * Expected to be called in afterEvaluate when all extensions are available
- */
+/** Expected to be called in afterEvaluate when all extensions are available */
internal fun Project.hasAndroidTestSourceCode(): Boolean {
// com.android.test modules keep test code in main sourceset
extensions.findByType(TestExtension::class.java)?.let { extension ->
@@ -1128,16 +1177,18 @@
if (!sourceSet.java.getSourceFiles().isEmpty) return true
}
// check kotlin-android main source set
- extensions.findByType(KotlinAndroidProjectExtension::class.java)
- ?.sourceSets?.findByName("main")?.let {
- if (it.kotlin.files.isNotEmpty()) return true
- }
+ extensions
+ .findByType(KotlinAndroidProjectExtension::class.java)
+ ?.sourceSets
+ ?.findByName("main")
+ ?.let { if (it.kotlin.files.isNotEmpty()) return true }
// Note, don't have to check for kotlin-multiplatform as it is not compatible with
// com.android.test modules
}
// check Java androidTest source set
- extensions.findByType(TestedExtension::class.java)
+ extensions
+ .findByType(TestedExtension::class.java)
?.sourceSets
?.findByName("androidTest")
?.let { sourceSet ->
@@ -1146,10 +1197,11 @@
}
// check kotlin-android androidTest source set
- extensions.findByType(KotlinAndroidProjectExtension::class.java)
- ?.sourceSets?.findByName("androidTest")?.let {
- if (it.kotlin.files.isNotEmpty()) return true
- }
+ extensions
+ .findByType(KotlinAndroidProjectExtension::class.java)
+ ?.sourceSets
+ ?.findByName("androidTest")
+ ?.let { if (it.kotlin.files.isNotEmpty()) return true }
// check kotlin-multiplatform androidAndroidTest source set
multiplatformExtension?.apply {
@@ -1169,11 +1221,11 @@
}
}
-/**
- * Verifies that ProjectParser computes the correct values for this project
- */
+/** Verifies that ProjectParser computes the correct values for this project */
fun Project.validateProjectParser(extension: AndroidXExtension) {
- project.afterEvaluate {
+ // If configuration fails, we don't want to validate the ProjectParser
+ // (otherwise it could report a confusing, unnecessary error)
+ project.gradle.taskGraph.whenReady {
val parsed = project.parse()
check(extension.type == parsed.libraryType) {
"ProjectParser incorrectly computed libraryType = ${parsed.libraryType} " +
@@ -1198,9 +1250,7 @@
}
}
-/**
- * Validates the Maven version against Jetpack guidelines.
- */
+/** Validates the Maven version against Jetpack guidelines. */
fun AndroidXExtension.validateMavenVersion() {
val mavenGroup = mavenGroup
val mavenVersion = mavenVersion
@@ -1215,17 +1265,14 @@
To fix this error, remove "mavenVersion = ..." from your build.gradle
configuration.
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
-/**
- * Removes the line and column attributes from the [baseline].
- */
-fun removeLineAndColumnAttributes(baseline: String): String = baseline.replace(
- "\\s*(line|column)=\"\\d+?\"".toRegex(),
- ""
-)
+/** Removes the line and column attributes from the [baseline]. */
+fun removeLineAndColumnAttributes(baseline: String): String =
+ baseline.replace("\\s*(line|column)=\"\\d+?\"".toRegex(), "")
const val PROJECT_OR_ARTIFACT_EXT_NAME = "projectOrArtifact"
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
index 488a5a6..b036cde 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
@@ -34,10 +34,10 @@
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
/**
- * [AndroidXMultiplatformExtension] is an extension that wraps specific functionality of the Kotlin
- * multiplatform extension, and applies the Kotlin multiplatform plugin when it is used. The
- * purpose of wrapping is to prevent targets from being added when the platform has not been
- * enabled. e.g. the `macosX64` target is gated on a `project.enableMac` check.
+ * [AndroidXMultiplatformExtension] is an extension that wraps specific functionality of the Kotlin
+ * multiplatform extension, and applies the Kotlin multiplatform plugin when it is used. The purpose
+ * of wrapping is to prevent targets from being added when the platform has not been enabled. e.g.
+ * the `macosX64` target is gated on a `project.enableMac` check.
*/
open class AndroidXMultiplatformExtension(val project: Project) {
@@ -65,44 +65,48 @@
* have requested `mac()` but this is not available when building on Linux.
*/
val targetPlatforms: List<String>
- get() = if (kotlinExtensionDelegate.isInitialized()) {
- kotlinExtension.targets.mapNotNull {
- if (it.targetName != "metadata") {
- it.targetName
- } else {
- null
+ get() =
+ if (kotlinExtensionDelegate.isInitialized()) {
+ kotlinExtension.targets.mapNotNull {
+ if (it.targetName != "metadata") {
+ it.targetName
+ } else {
+ null
+ }
}
+ } else {
+ throw GradleException("Kotlin multi-platform extension has not been initialized")
}
- } else {
- throw GradleException("Kotlin multi-platform extension has not been initialized")
- }
/**
* Default platform identifier used for specifying POM dependencies.
*
* This platform will be added as a dependency to the multi-platform anchor artifact's POM
- * publication. For example, if the anchor artifact is `collection` and the default platform
- * is `jvm`, then the POM for `collection` will express a dependency on `collection-jvm`. This
+ * publication. For example, if the anchor artifact is `collection` and the default platform is
+ * `jvm`, then the POM for `collection` will express a dependency on `collection-jvm`. This
* ensures that developers who are silently upgrade to KMP artifacts but are not using Gradle
* still see working artifacts.
*
- * If no default was specified and a single platform is requested (ex. using [jvm]), returns
- * the identifier for that platform.
+ * If no default was specified and a single platform is requested (ex. using [jvm]), returns the
+ * identifier for that platform.
*/
var defaultPlatform: String? = null
get() = field ?: requestedPlatforms.singleOrNull()?.id
-
set(value) {
if (value != null) {
if (requestedPlatforms.none { it.id == value }) {
- throw GradleException("Platform $value has not been requested as a target. " +
- "Available platforms are: " +
- requestedPlatforms.joinToString(", ") { it.id })
+ throw GradleException(
+ "Platform $value has not been requested as a target. " +
+ "Available platforms are: " +
+ requestedPlatforms.joinToString(", ") { it.id }
+ )
}
if (targetPlatforms.none { it == value }) {
- throw GradleException("Platform $value is not available in this build " +
- "environment. Available platforms are: " +
- targetPlatforms.joinToString(", "))
+ throw GradleException(
+ "Platform $value is not available in this build " +
+ "environment. Available platforms are: " +
+ targetPlatforms.joinToString(", ")
+ )
}
}
field = value
@@ -110,15 +114,16 @@
val presets: NamedDomainObjectCollection<KotlinTargetPreset<*>>
get() = kotlinExtension.presets
+
val targets: NamedDomainObjectCollection<KotlinTarget>
get() = kotlinExtension.targets
internal fun hasNativeTarget(): Boolean {
// it is important to check initialized here not to trigger initialization
- return kotlinExtensionDelegate.isInitialized() && targets.any {
- it.platformType == KotlinPlatformType.native
- }
+ return kotlinExtensionDelegate.isInitialized() &&
+ targets.any { it.platformType == KotlinPlatformType.native }
}
+
fun sourceSets(closure: Closure<*>) {
if (kotlinExtensionDelegate.isInitialized()) {
kotlinExtension.sourceSets.configure(closure)
@@ -139,9 +144,7 @@
}
@JvmOverloads
- fun jvm(
- block: Action<KotlinJvmTarget>? = null
- ): KotlinJvmTarget? {
+ fun jvm(block: Action<KotlinJvmTarget>? = null): KotlinJvmTarget? {
requestedPlatforms.add(PlatformIdentifier.JVM)
return if (project.enableJvm()) {
kotlinExtension.jvm {
@@ -153,149 +156,115 @@
withJava()
}
}
- } else { null }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun android(
- block: Action<KotlinAndroidTarget>? = null
- ): KotlinAndroidTarget? {
+ fun android(block: Action<KotlinAndroidTarget>? = null): KotlinAndroidTarget? {
requestedPlatforms.add(PlatformIdentifier.ANDROID)
return if (project.enableJvm()) {
- kotlinExtension.android {
- block?.execute(this)
- }
- } else { null }
+ kotlinExtension.android { block?.execute(this) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun desktop(
- block: Action<KotlinJvmTarget>? = null
- ): KotlinJvmTarget? {
+ fun desktop(block: Action<KotlinJvmTarget>? = null): KotlinJvmTarget? {
requestedPlatforms.add(PlatformIdentifier.DESKTOP)
return if (project.enableDesktop()) {
- kotlinExtension.jvm("desktop") {
- block?.execute(this)
- }
- } else { null }
+ kotlinExtension.jvm("desktop") { block?.execute(this) }
+ } else {
+ null
+ }
}
- /**
- * Configures all mac targets supported by AndroidX.
- */
+ /** Configures all mac targets supported by AndroidX. */
@JvmOverloads
- fun mac(
- block: Action<KotlinNativeTarget>? = null
- ): List<KotlinNativeTarget> {
- return listOfNotNull(
- macosX64(block),
- macosArm64(block)
- )
+ fun mac(block: Action<KotlinNativeTarget>? = null): List<KotlinNativeTarget> {
+ return listOfNotNull(macosX64(block), macosArm64(block))
}
@JvmOverloads
- fun macosX64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTargetWithHostTests? {
+ fun macosX64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTargetWithHostTests? {
requestedPlatforms.add(PlatformIdentifier.MAC_OSX_64)
return if (project.enableMac()) {
- kotlinExtension.macosX64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.macosX64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun macosArm64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTargetWithHostTests? {
+ fun macosArm64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTargetWithHostTests? {
requestedPlatforms.add(PlatformIdentifier.MAC_ARM_64)
return if (project.enableMac()) {
- kotlinExtension.macosArm64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.macosArm64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun iosArm64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTarget? {
+ fun iosArm64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTarget? {
requestedPlatforms.add(PlatformIdentifier.IOS_ARM_64)
return if (project.enableMac()) {
- kotlinExtension.iosArm64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.iosArm64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
- /**
- * Configures all ios targets supported by AndroidX.
- */
+ /** Configures all ios targets supported by AndroidX. */
@JvmOverloads
- fun ios(
- block: Action<KotlinNativeTarget>? = null
- ): List<KotlinNativeTarget> {
- return listOfNotNull(
- iosX64(block),
- iosArm64(block),
- iosSimulatorArm64(block)
- )
+ fun ios(block: Action<KotlinNativeTarget>? = null): List<KotlinNativeTarget> {
+ return listOfNotNull(iosX64(block), iosArm64(block), iosSimulatorArm64(block))
}
+
@JvmOverloads
- fun iosX64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTarget? {
+ fun iosX64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTarget? {
requestedPlatforms.add(PlatformIdentifier.IOS_X_64)
return if (project.enableMac()) {
- kotlinExtension.iosX64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.iosX64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun iosSimulatorArm64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTarget? {
+ fun iosSimulatorArm64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTarget? {
requestedPlatforms.add(PlatformIdentifier.IOS_SIMULATOR_ARM_64)
return if (project.enableMac()) {
- kotlinExtension.iosSimulatorArm64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.iosSimulatorArm64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun linux(
- block: Action<KotlinNativeTarget>? = null
- ): List<KotlinNativeTarget> {
+ fun linux(block: Action<KotlinNativeTarget>? = null): List<KotlinNativeTarget> {
return listOfNotNull(
linuxX64(block),
)
}
@JvmOverloads
- fun linuxX64(
- block: Action<KotlinNativeTarget>? = null
- ): KotlinNativeTargetWithHostTests? {
+ fun linuxX64(block: Action<KotlinNativeTarget>? = null): KotlinNativeTargetWithHostTests? {
requestedPlatforms.add(PlatformIdentifier.LINUX_64)
return if (project.enableLinux()) {
- kotlinExtension.linuxX64().also {
- block?.execute(it)
- }
- } else { null }
+ kotlinExtension.linuxX64().also { block?.execute(it) }
+ } else {
+ null
+ }
}
@JvmOverloads
- fun js(
- block: Action<KotlinJsTargetDsl>? = null
- ): KotlinJsTargetDsl? {
+ fun js(block: Action<KotlinJsTargetDsl>? = null): KotlinJsTargetDsl? {
requestedPlatforms.add(PlatformIdentifier.JS)
return if (project.enableJs()) {
- kotlinExtension.js().also {
- block?.execute(it)
- }
+ kotlinExtension.js().also { block?.execute(it) }
} else {
null
}
@@ -310,17 +279,20 @@
* Returns a provider that is set to true if and only if this project has at least 1 kotlin native
* target (mac, linux, ios).
*/
-internal fun Project.hasKotlinNativeTarget(): Provider<Boolean> = project.provider {
- project.extensions.getByType(AndroidXMultiplatformExtension::class.java).hasNativeTarget()
-}
+internal fun Project.hasKotlinNativeTarget(): Provider<Boolean> =
+ project.provider {
+ project.extensions.getByType(AndroidXMultiplatformExtension::class.java).hasNativeTarget()
+ }
fun Project.validatePublishedMultiplatformHasDefault() {
val extension = project.extensions.getByType(AndroidXMultiplatformExtension::class.java)
if (extension.defaultPlatform == null && extension.requestedPlatforms.isNotEmpty()) {
- throw GradleException("Project is published and multiple platforms are requested. You " +
- "must explicitly specify androidXMultiplatform.defaultPlatform as one of: " +
- extension.targetPlatforms.joinToString(", ") {
- "PlatformIdentifier.${PlatformIdentifier.fromId(it)!!.name}"
- })
+ throw GradleException(
+ "Project is published and multiple platforms are requested. You " +
+ "must explicitly specify androidXMultiplatform.defaultPlatform as one of: " +
+ extension.targetPlatforms.joinToString(", ") {
+ "PlatformIdentifier.${PlatformIdentifier.fromId(it)!!.name}"
+ }
+ )
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXPlaygroundRootImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXPlaygroundRootImplPlugin.kt
index 299c81c..755c76b 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXPlaygroundRootImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXPlaygroundRootImplPlugin.kt
@@ -33,14 +33,10 @@
class AndroidXPlaygroundRootImplPlugin : Plugin<Project> {
private lateinit var rootProject: Project
- /**
- * List of snapshot repositories to fetch AndroidX artifacts
- */
+ /** List of snapshot repositories to fetch AndroidX artifacts */
private lateinit var repos: PlaygroundRepositories
- /**
- * The configuration for the plugin read from the gradle properties
- */
+ /** The configuration for the plugin read from the gradle properties */
private lateinit var config: PlaygroundProperties
override fun apply(target: Project) {
@@ -57,9 +53,7 @@
repos = PlaygroundRepositories(config)
rootProject.repositories.addPlaygroundRepositories()
GradleTransformWorkaround.maybeApply(rootProject)
- rootProject.subprojects {
- configureSubProject(it)
- }
+ rootProject.subprojects { configureSubProject(it) }
}
private fun configureSubProject(project: Project) {
@@ -78,14 +72,13 @@
/**
* Finds the snapshot version from the AndroidX snapshot repository.
*
- * This is initially done by reading the maven-metadata from the snapshot repository.
- * The result of that query is cached in the build file so that subsequent build requests will
- * not need to access the network.
+ * This is initially done by reading the maven-metadata from the snapshot repository. The result
+ * of that query is cached in the build file so that subsequent build requests will not need to
+ * access the network.
*/
private fun findSnapshotVersion(group: String, module: String): String {
- val snapshotVersionCache = rootProject.buildDir.resolve(
- "snapshot-version-cache/${config.snapshotBuildId}"
- )
+ val snapshotVersionCache =
+ rootProject.buildDir.resolve("snapshot-version-cache/${config.snapshotBuildId}")
val groupPath = group.replace('.', '/')
val modulePath = module.replace('.', '/')
val metadataCacheFile = snapshotVersionCache.resolve("$groupPath/$modulePath/version.txt")
@@ -134,31 +127,35 @@
gradlePluginPortal()
}
- private class PlaygroundRepositories(
- props: PlaygroundProperties
- ) {
- val sonatypeSnapshot = PlaygroundRepository(
- url = "https://oss.sonatype.org/content/repositories/snapshots",
- includeGroupRegex = """com\.pinterest.*""",
- includeModuleRegex = """ktlint.*"""
- )
- val snapshots = PlaygroundRepository(
- "https://androidx.dev/snapshots/builds/${props.snapshotBuildId}/artifacts/repository",
- includeGroupRegex = """androidx\..*"""
- )
- val metalava = PlaygroundRepository(
- "https://androidx.dev/metalava/builds/${props.metalavaBuildId}/artifacts" +
- "/repo/m2repository",
- includeGroupRegex = """com\.android\.tools\.metalava"""
- )
- val prebuilts = PlaygroundRepository(
- INTERNAL_PREBUILTS_REPO_URL,
- includeGroupRegex = """androidx\..*"""
- )
- val dokka = PlaygroundRepository(
- "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev",
- includeGroupRegex = """org\.jetbrains\.dokka"""
- )
+ private class PlaygroundRepositories(props: PlaygroundProperties) {
+ val sonatypeSnapshot =
+ PlaygroundRepository(
+ url = "https://oss.sonatype.org/content/repositories/snapshots",
+ includeGroupRegex = """com\.pinterest.*""",
+ includeModuleRegex = """ktlint.*"""
+ )
+ val snapshots =
+ PlaygroundRepository(
+ "https://androidx.dev/snapshots/builds/${props.snapshotBuildId}/artifacts" +
+ "/repository",
+ includeGroupRegex = """androidx\..*"""
+ )
+ val metalava =
+ PlaygroundRepository(
+ "https://androidx.dev/metalava/builds/${props.metalavaBuildId}/artifacts" +
+ "/repo/m2repository",
+ includeGroupRegex = """com\.android\.tools\.metalava"""
+ )
+ val prebuilts =
+ PlaygroundRepository(
+ INTERNAL_PREBUILTS_REPO_URL,
+ includeGroupRegex = """androidx\..*"""
+ )
+ val dokka =
+ PlaygroundRepository(
+ "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev",
+ includeGroupRegex = """org\.jetbrains\.dokka"""
+ )
val all = listOf(sonatypeSnapshot, snapshots, metalava, dokka, prebuilts)
}
@@ -182,8 +179,9 @@
private fun Project.requireProperty(name: String): String {
return checkNotNull(findProperty(name)) {
- "missing $name property. It must be defined in the gradle.properties file"
- }.toString()
+ "missing $name property. It must be defined in the gradle.properties file"
+ }
+ .toString()
}
}
}
@@ -195,8 +193,8 @@
* This can be used for optional dependencies in the playground settings.gradle files.
*
* @param path The project path
- * @return A Project instance if it exists or coordinates of the artifact if the project is not
- * included in this build.
+ * @return A Project instance if it exists or coordinates of the artifact if the project is
+ * not included in this build.
*/
fun projectOrArtifact(rootProject: Project, path: String): Any {
val requested = rootProject.findProject(path)
@@ -213,18 +211,20 @@
// Typically androidx projects have 3 sections, compose has 4.
if (sections.size >= 3) {
- val group = sections
- // Filter empty sections as many declarations start with ':'
- .filter { it.isNotBlank() }
- // Last element is the artifact.
- .dropLast(1)
- .joinToString(".")
+ val group =
+ sections
+ // Filter empty sections as many declarations start with ':'
+ .filter { it.isNotBlank() }
+ // Last element is the artifact.
+ .dropLast(1)
+ .joinToString(".")
return "androidx.$group:${sections.last()}:$SNAPSHOT_MARKER"
}
throw GradleException("projectOrArtifact cannot find/replace project $path")
}
}
+
const val SNAPSHOT_MARKER = "REPLACE_WITH_SNAPSHOT"
const val INTERNAL_PREBUILTS_REPO_URL =
"https://androidx.dev/storage/prebuilts/androidx/internal/repository"
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
index 9f71c14..506a116 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
@@ -46,8 +46,7 @@
import org.gradle.kotlin.dsl.extra
abstract class AndroidXRootImplPlugin : Plugin<Project> {
- @get:javax.inject.Inject
- abstract val registry: BuildEventsListenerRegistry
+ @get:javax.inject.Inject abstract val registry: BuildEventsListenerRegistry
override fun apply(project: Project) {
if (!project.isRoot) {
@@ -80,15 +79,13 @@
Expected AGP version \"$expectedAgpVersion\" does not match actual AGP version
\"$ANDROID_GRADLE_PLUGIN_VERSION\". This happens when AGP is updated while
Studio is running and can be fixed by restarting Studio.
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
- val buildOnServerTask = tasks.create(
- BUILD_ON_SERVER_TASK,
- BuildOnServerTask::class.java
- )
+ val buildOnServerTask = tasks.create(BUILD_ON_SERVER_TASK, BuildOnServerTask::class.java)
buildOnServerTask.cacheEvenIfNoOutputs()
buildOnServerTask.distributionDirectory = getDistributionDirectory()
buildOnServerTask.dependsOn(
@@ -97,9 +94,7 @@
CreateAggregateLibraryBuildInfoFileTask::class.java
)
)
- buildOnServerTask.dependsOn(
- tasks.register(CREATE_LIBRARY_BUILD_INFO_FILES_TASK)
- )
+ buildOnServerTask.dependsOn(tasks.register(CREATE_LIBRARY_BUILD_INFO_FILES_TASK))
VerifyPlaygroundGradleConfigurationTask.createIfNecessary(project)?.let {
buildOnServerTask.dependsOn(it)
@@ -108,8 +103,9 @@
extra.set("projects", ConcurrentHashMap<String, String>())
subprojects { project ->
project.afterEvaluate {
- if (project.plugins.hasPlugin(LibraryPlugin::class.java) ||
- project.plugins.hasPlugin(AppPlugin::class.java)
+ if (
+ project.plugins.hasPlugin(LibraryPlugin::class.java) ||
+ project.plugins.hasPlugin(AppPlugin::class.java)
) {
buildOnServerTask.dependsOn("${project.path}:assembleRelease")
@@ -118,7 +114,8 @@
// in AndroidX, release and debug variants are essentially the same,
// so we don't run the lintRelease task on the build server
if (!variant.name.lowercase(Locale.getDefault()).contains("release")) {
- val taskName = "lint${variant.name.replaceFirstChar {
+ val taskName =
+ "lint${variant.name.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(Locale.getDefault())
} else {
@@ -138,9 +135,7 @@
// NOTE: this task is used by the Github CI as well. If you make any changes here,
// please update the .github/workflows files as well, if necessary.
- project.tasks.register(
- ZIP_TEST_CONFIGS_WITH_APKS_TASK, Zip::class.java
- ) {
+ project.tasks.register(ZIP_TEST_CONFIGS_WITH_APKS_TASK, Zip::class.java) {
it.destinationDirectory.set(project.getDistributionDirectory())
it.archiveFileName.set("androidTest.zip")
it.from(project.getTestConfigDirectory())
@@ -169,19 +164,18 @@
val projectModules = getProjectsMap()
subprojects { subproject ->
// TODO(153485458) remove most of these exceptions
- if (!subproject.name.contains("hilt") &&
- subproject.name != "docs-public" &&
- subproject.name != "docs-tip-of-tree" &&
- subproject.name != "camera-testapp-timing" &&
- subproject.name != "room-testapp" &&
- !(
- subproject.path.contains
- ("media2:media2-session:version-compat-tests:client-previous")
- ) &&
- !(
- subproject.path.contains
- ("media2:media2-session:version-compat-tests:service-previous")
- )
+ if (
+ !subproject.name.contains("hilt") &&
+ subproject.name != "docs-public" &&
+ subproject.name != "docs-tip-of-tree" &&
+ subproject.name != "camera-testapp-timing" &&
+ subproject.name != "room-testapp" &&
+ !(subproject.path.contains(
+ "media2:media2-session:version-compat-tests:client-previous"
+ )) &&
+ !(subproject.path.contains(
+ "media2:media2-session:version-compat-tests:service-previous"
+ ))
) {
subproject.configurations.all { configuration ->
configuration.resolutionStrategy.dependencySubstitution.apply {
@@ -208,13 +202,16 @@
task.setOutput(File(project.getDistributionDirectory(), "task_outputs.txt"))
task.removePrefix(project.getCheckoutRoot().path)
}
- tasks.matching { it.name == "commonizeNativeDistribution" }.configureEach {
- it.notCompatibleWithConfigurationCache("https://youtrack.jetbrains.com/issue/KT-54627")
- }
+ tasks
+ .matching { it.name == "commonizeNativeDistribution" }
+ .configureEach {
+ it.notCompatibleWithConfigurationCache(
+ "https://youtrack.jetbrains.com/issue/KT-54627"
+ )
+ }
}
private fun Project.setDependencyVersions() {
- androidx.build.dependencies.kotlinVersion = getVersionByName("kotlin")
androidx.build.dependencies.kotlinNativeVersion = getVersionByName("kotlinNative")
androidx.build.dependencies.kspVersion = getVersionByName("ksp")
androidx.build.dependencies.agpVersion = getVersionByName("androidGradlePlugin")
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/BuildOnServerTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/BuildOnServerTask.kt
index 5af1390..af6831a 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/BuildOnServerTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/BuildOnServerTask.kt
@@ -30,8 +30,8 @@
* Task for building all of Androidx libraries and documentation
*
* AndroidXImplPlugin configuration adds dependencies to BuildOnServer for all of the tasks that
- * produce artifacts that we want to build on server builds
- * When BuildOnServer executes, it double-checks that all expected artifacts were built
+ * produce artifacts that we want to build on server builds When BuildOnServer executes, it
+ * double-checks that all expected artifacts were built
*/
@CacheableTask
open class BuildOnServerTask : DefaultTask() {
@@ -41,14 +41,15 @@
description = "Builds all of the Androidx libraries and documentation"
}
- @Internal
- lateinit var distributionDirectory: File
+ @Internal lateinit var distributionDirectory: File
- @InputFiles @PathSensitive(PathSensitivity.RELATIVE)
+ @InputFiles
+ @PathSensitive(PathSensitivity.RELATIVE)
fun getRequiredFiles(): List<File> {
return mutableListOf(
- "androidx_aggregate_build_info.txt",
- ).map { fileName -> File(distributionDirectory, fileName) }
+ "androidx_aggregate_build_info.txt",
+ )
+ .map { fileName -> File(distributionDirectory, fileName) }
}
@TaskAction
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
index 3ccfbcb..8a3fbfd 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
@@ -79,7 +79,8 @@
if (variant.buildType.name == BuilderConstants.RELEASE) {
val task = variant.javaCompileProvider
(variant as com.android.build.gradle.api.BaseVariant)
- .annotationProcessorConfiguration.extendsFrom(errorProneConfiguration)
+ .annotationProcessorConfiguration
+ .extendsFrom(errorProneConfiguration)
log.info("Configuring error-prone for ${variant.name}'s java compile")
makeErrorProneTask(task) { javaCompile ->
@@ -92,10 +93,8 @@
}
}
-class CommandLineArgumentProviderAdapter(
- @get:Input
- val arguments: Provider<Map<String, String>>
-) : CommandLineArgumentProvider {
+class CommandLineArgumentProviderAdapter(@get:Input val arguments: Provider<Map<String, String>>) :
+ CommandLineArgumentProvider {
override fun asArguments(): MutableIterable<String> {
return mutableListOf<String>().also {
for ((key, value) in arguments.get()) {
@@ -106,12 +105,13 @@
}
private fun Project.createErrorProneConfiguration(): Configuration {
- val errorProneConfiguration = configurations.create(ERROR_PRONE_CONFIGURATION) {
- it.isVisible = false
- it.isCanBeConsumed = false
- it.isCanBeResolved = true
- it.exclude(group = "com.google.errorprone", module = "javac")
- }
+ val errorProneConfiguration =
+ configurations.create(ERROR_PRONE_CONFIGURATION) {
+ it.isVisible = false
+ it.isCanBeConsumed = false
+ it.isCanBeResolved = true
+ it.exclude(group = "com.google.errorprone", module = "javac")
+ }
dependencies.add(ERROR_PRONE_CONFIGURATION, ERROR_PRONE_VERSION)
return errorProneConfiguration
}
@@ -119,149 +119,153 @@
// Given an existing JavaCompile task, reconfigures the task to use the ErrorProne compiler plugin
private fun JavaCompile.configureWithErrorProne() {
options.isFork = true
- options.forkOptions.jvmArgs!!.addAll(listOf(
- "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
- "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
- "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
- "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"
+ options.forkOptions.jvmArgs!!.addAll(
+ listOf(
+ "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
+ "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+ "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
+ "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"
)
)
val compilerArgs = this.options.compilerArgs
- compilerArgs += listOf(
- // Tell error-prone that we are running it on android compatible libraries
- "-XDandroidCompatible=true",
-
- "-XDcompilePolicy=simple", // Workaround for b/36098770
+ compilerArgs +=
listOf(
- "-Xplugin:ErrorProne",
+ // Tell error-prone that we are running it on android compatible libraries
+ "-XDandroidCompatible=true",
+ "-XDcompilePolicy=simple", // Workaround for b/36098770
+ listOf(
+ "-Xplugin:ErrorProne",
- // Ignore intermediate build output, generated files, and external sources. Also sources
- // imported from Android Studio and IntelliJ which are used in the lint-checks project.
- "-XepExcludedPaths:.*/(build/generated|build/errorProne|external|" +
- "compileTransaction/compile-output|lint-checks/src/main/java/androidx/com)/.*",
+ // Ignore intermediate build output, generated files, and external sources. Also
+ // sources
+ // imported from Android Studio and IntelliJ which are used in the lint-checks
+ // project.
+ "-XepExcludedPaths:.*/(build/generated|build/errorProne|external|" +
+ "compileTransaction/compile-output|" +
+ "lint-checks/src/main/java/androidx/com)/.*",
- // Consider re-enabling the following checks. Disabled as part of
- // error-prone upgrade
- "-Xep:InlineMeSuggester:OFF",
- "-Xep:NarrowCalculation:OFF",
- "-Xep:LongDoubleConversion:OFF",
- "-Xep:UnicodeEscape:OFF",
- "-Xep:JavaUtilDate:OFF",
- "-Xep:UnrecognisedJavadocTag:OFF",
- "-Xep:ObjectEqualsForPrimitives:OFF",
- "-Xep:DoNotCallSuggester:OFF",
- "-Xep:EqualsNull:OFF",
- "-Xep:MalformedInlineTag:OFF",
- "-Xep:MissingSuperCall:OFF",
- "-Xep:ToStringReturnsNull:OFF",
- "-Xep:ReturnValueIgnored:OFF",
- "-Xep:MissingImplementsComparable:OFF",
- "-Xep:EmptyTopLevelDeclaration:OFF",
- "-Xep:InvalidThrowsLink:OFF",
- "-Xep:StaticAssignmentOfThrowable:OFF",
- "-Xep:DoNotClaimAnnotations:OFF",
- "-Xep:AlreadyChecked:OFF",
- "-Xep:StringSplitter:OFF",
+ // Consider re-enabling the following checks. Disabled as part of
+ // error-prone upgrade
+ "-Xep:InlineMeSuggester:OFF",
+ "-Xep:NarrowCalculation:OFF",
+ "-Xep:LongDoubleConversion:OFF",
+ "-Xep:UnicodeEscape:OFF",
+ "-Xep:JavaUtilDate:OFF",
+ "-Xep:UnrecognisedJavadocTag:OFF",
+ "-Xep:ObjectEqualsForPrimitives:OFF",
+ "-Xep:DoNotCallSuggester:OFF",
+ "-Xep:EqualsNull:OFF",
+ "-Xep:MalformedInlineTag:OFF",
+ "-Xep:MissingSuperCall:OFF",
+ "-Xep:ToStringReturnsNull:OFF",
+ "-Xep:ReturnValueIgnored:OFF",
+ "-Xep:MissingImplementsComparable:OFF",
+ "-Xep:EmptyTopLevelDeclaration:OFF",
+ "-Xep:InvalidThrowsLink:OFF",
+ "-Xep:StaticAssignmentOfThrowable:OFF",
+ "-Xep:DoNotClaimAnnotations:OFF",
+ "-Xep:AlreadyChecked:OFF",
+ "-Xep:StringSplitter:OFF",
- // We allow inter library RestrictTo usage.
- "-Xep:RestrictTo:OFF",
+ // We allow inter library RestrictTo usage.
+ "-Xep:RestrictTo:OFF",
- // Disable the following checks.
- "-Xep:UnescapedEntity:OFF",
- "-Xep:MissingSummary:OFF",
- "-Xep:StaticAssignmentInConstructor:OFF",
- "-Xep:InvalidLink:OFF",
- "-Xep:InvalidInlineTag:OFF",
- "-Xep:EmptyBlockTag:OFF",
- "-Xep:EmptyCatch:OFF",
- "-Xep:JdkObsolete:OFF",
- "-Xep:PublicConstructorForAbstractClass:OFF",
- "-Xep:MutablePublicArray:OFF",
- "-Xep:NonCanonicalType:OFF",
- "-Xep:ModifyCollectionInEnhancedForLoop:OFF",
- "-Xep:InheritDoc:OFF",
- "-Xep:InvalidParam:OFF",
- "-Xep:InlineFormatString:OFF",
- "-Xep:InvalidBlockTag:OFF",
- "-Xep:ProtectedMembersInFinalClass:OFF",
- "-Xep:SameNameButDifferent:OFF",
- "-Xep:AnnotateFormatMethod:OFF",
- "-Xep:ReturnFromVoid:OFF",
- "-Xep:AlmostJavadoc:OFF",
- "-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:OFF",
- "-Xep:InvalidThrows:OFF",
+ // Disable the following checks.
+ "-Xep:UnescapedEntity:OFF",
+ "-Xep:MissingSummary:OFF",
+ "-Xep:StaticAssignmentInConstructor:OFF",
+ "-Xep:InvalidLink:OFF",
+ "-Xep:InvalidInlineTag:OFF",
+ "-Xep:EmptyBlockTag:OFF",
+ "-Xep:EmptyCatch:OFF",
+ "-Xep:JdkObsolete:OFF",
+ "-Xep:PublicConstructorForAbstractClass:OFF",
+ "-Xep:MutablePublicArray:OFF",
+ "-Xep:NonCanonicalType:OFF",
+ "-Xep:ModifyCollectionInEnhancedForLoop:OFF",
+ "-Xep:InheritDoc:OFF",
+ "-Xep:InvalidParam:OFF",
+ "-Xep:InlineFormatString:OFF",
+ "-Xep:InvalidBlockTag:OFF",
+ "-Xep:ProtectedMembersInFinalClass:OFF",
+ "-Xep:SameNameButDifferent:OFF",
+ "-Xep:AnnotateFormatMethod:OFF",
+ "-Xep:ReturnFromVoid:OFF",
+ "-Xep:AlmostJavadoc:OFF",
+ "-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:OFF",
+ "-Xep:InvalidThrows:OFF",
- // Disable checks which are already enforced by lint.
- "-Xep:PrivateConstructorForUtilityClass:OFF",
+ // Disable checks which are already enforced by lint.
+ "-Xep:PrivateConstructorForUtilityClass:OFF",
- // Enforce the following checks.
- "-Xep:JavaTimeDefaultTimeZone:ERROR",
- "-Xep:ParameterNotNullable:ERROR",
- "-Xep:MissingOverride:ERROR",
- "-Xep:EqualsHashCode:ERROR",
- "-Xep:NarrowingCompoundAssignment:ERROR",
- "-Xep:ClassNewInstance:ERROR",
- "-Xep:ClassCanBeStatic:ERROR",
- "-Xep:SynchronizeOnNonFinalField:ERROR",
- "-Xep:OperatorPrecedence:ERROR",
- "-Xep:IntLongMath:ERROR",
- "-Xep:MissingFail:ERROR",
- "-Xep:JavaLangClash:ERROR",
- "-Xep:TypeParameterUnusedInFormals:ERROR",
- // "-Xep:StringSplitter:ERROR", // disabled with upgrade to 2.14.0
- "-Xep:ReferenceEquality:ERROR",
- "-Xep:AssertionFailureIgnored:ERROR",
- "-Xep:UnnecessaryParentheses:ERROR",
- "-Xep:EqualsGetClass:ERROR",
- "-Xep:UnusedVariable:ERROR",
- "-Xep:UnusedMethod:ERROR",
- "-Xep:UndefinedEquals:ERROR",
- "-Xep:ThreadLocalUsage:ERROR",
- "-Xep:FutureReturnValueIgnored:ERROR",
- "-Xep:ArgumentSelectionDefectChecker:ERROR",
- "-Xep:HidingField:ERROR",
- "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
- "-Xep:Finally:ERROR",
- "-Xep:ThreadPriorityCheck:ERROR",
- "-Xep:AutoValueFinalMethods:ERROR",
- "-Xep:ImmutableEnumChecker:ERROR",
- "-Xep:UnsafeReflectiveConstructionCast:ERROR",
- "-Xep:LockNotBeforeTry:ERROR",
- "-Xep:DoubleCheckedLocking:ERROR",
- "-Xep:InconsistentCapitalization:ERROR",
- "-Xep:ModifiedButNotUsed:ERROR",
- "-Xep:AmbiguousMethodReference:ERROR",
- "-Xep:EqualsIncompatibleType:ERROR",
- "-Xep:ParameterName:ERROR",
- "-Xep:RxReturnValueIgnored:ERROR",
- "-Xep:BadImport:ERROR",
- "-Xep:MissingCasesInEnumSwitch:ERROR",
- "-Xep:ObjectToString:ERROR",
- "-Xep:CatchAndPrintStackTrace:ERROR",
- "-Xep:MixedMutabilityReturnType:ERROR",
+ // Enforce the following checks.
+ "-Xep:JavaTimeDefaultTimeZone:ERROR",
+ "-Xep:ParameterNotNullable:ERROR",
+ "-Xep:MissingOverride:ERROR",
+ "-Xep:EqualsHashCode:ERROR",
+ "-Xep:NarrowingCompoundAssignment:ERROR",
+ "-Xep:ClassNewInstance:ERROR",
+ "-Xep:ClassCanBeStatic:ERROR",
+ "-Xep:SynchronizeOnNonFinalField:ERROR",
+ "-Xep:OperatorPrecedence:ERROR",
+ "-Xep:IntLongMath:ERROR",
+ "-Xep:MissingFail:ERROR",
+ "-Xep:JavaLangClash:ERROR",
+ "-Xep:TypeParameterUnusedInFormals:ERROR",
+ // "-Xep:StringSplitter:ERROR", // disabled with upgrade to 2.14.0
+ "-Xep:ReferenceEquality:ERROR",
+ "-Xep:AssertionFailureIgnored:ERROR",
+ "-Xep:UnnecessaryParentheses:ERROR",
+ "-Xep:EqualsGetClass:ERROR",
+ "-Xep:UnusedVariable:ERROR",
+ "-Xep:UnusedMethod:ERROR",
+ "-Xep:UndefinedEquals:ERROR",
+ "-Xep:ThreadLocalUsage:ERROR",
+ "-Xep:FutureReturnValueIgnored:ERROR",
+ "-Xep:ArgumentSelectionDefectChecker:ERROR",
+ "-Xep:HidingField:ERROR",
+ "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
+ "-Xep:Finally:ERROR",
+ "-Xep:ThreadPriorityCheck:ERROR",
+ "-Xep:AutoValueFinalMethods:ERROR",
+ "-Xep:ImmutableEnumChecker:ERROR",
+ "-Xep:UnsafeReflectiveConstructionCast:ERROR",
+ "-Xep:LockNotBeforeTry:ERROR",
+ "-Xep:DoubleCheckedLocking:ERROR",
+ "-Xep:InconsistentCapitalization:ERROR",
+ "-Xep:ModifiedButNotUsed:ERROR",
+ "-Xep:AmbiguousMethodReference:ERROR",
+ "-Xep:EqualsIncompatibleType:ERROR",
+ "-Xep:ParameterName:ERROR",
+ "-Xep:RxReturnValueIgnored:ERROR",
+ "-Xep:BadImport:ERROR",
+ "-Xep:MissingCasesInEnumSwitch:ERROR",
+ "-Xep:ObjectToString:ERROR",
+ "-Xep:CatchAndPrintStackTrace:ERROR",
+ "-Xep:MixedMutabilityReturnType:ERROR",
- // Nullaway
- "-XepIgnoreUnknownCheckNames", // https://github.com/uber/NullAway/issues/25
- "-Xep:NullAway:ERROR",
- "-XepOpt:NullAway:AnnotatedPackages=android.arch,android.support,androidx"
- ).joinToString(" ")
- )
+ // Nullaway
+ "-XepIgnoreUnknownCheckNames", // https://github.com/uber/NullAway/issues/25
+ "-Xep:NullAway:ERROR",
+ "-XepOpt:NullAway:AnnotatedPackages=android.arch,android.support,androidx"
+ )
+ .joinToString(" ")
+ )
}
/**
* Given a [JavaCompile] task, creates a task that runs the ErrorProne compiler with the same
* settings, including any kotlin source provided by [jvmCompileInputs].
*
- * Note: Since ErrorProne only understands Java files which may be dependent on Kotlin source,
- * using this method to register ErrorProne task causes it to be dependent on jvmJar task.
+ * Note: Since ErrorProne only understands Java files which may be dependent on Kotlin source, using
+ * this method to register ErrorProne task causes it to be dependent on jvmJar task.
*
-
* @param jvmCompileInputs [JavaCompileInputs] that specifies jvm source including Kotlin sources.
*/
private fun Project.makeKmpErrorProneTask(
@@ -273,18 +277,18 @@
// ErrorProne doesn't understand Kotlin source, so first let kotlinCompile finish, then
// take the resulting jar and add it to the classpath.
val jvmJarTask = jvmJarTaskProvider.get()
- val jvmJarFileCollection = files(
- provider { jvmJarTask.archiveFile.get().asFile }
- )
+ val jvmJarFileCollection = files(provider { jvmJarTask.archiveFile.get().asFile })
errorProneTask.dependsOn(jvmJarTaskProvider.name)
errorProneTask.classpath = jvmCompileInputs.dependencyClasspath.plus(jvmJarFileCollection)
- errorProneTask.source = jvmCompileInputs.sourcePaths
- // flatMap src dirs into src files so we can read the extensions.
- .asFileTree
- // ErrorProne normally skips non-java source, but we need to explicitly filter for it
- // since non-empty list with no java source will throw an exception.
- .filter { it.extension.equals("java", ignoreCase = true) }
- .asFileTree
+ errorProneTask.source =
+ jvmCompileInputs.sourcePaths
+ // flatMap src dirs into src files so we can read the extensions.
+ .asFileTree
+ // ErrorProne normally skips non-java source, but we need to explicitly filter for
+ // it
+ // since non-empty list with no java source will throw an exception.
+ .filter { it.extension.equals("java", ignoreCase = true) }
+ .asFileTree
}
}
@@ -292,33 +296,32 @@
* Given a [JavaCompile] task, creates a task that runs the ErrorProne compiler with the same
* settings.
*
- * @param onConfigure optional callback which lazily evaluates on task configuration. Use this to
- * do any additional configuration such as overriding default settings.
+ * @param onConfigure optional callback which lazily evaluates on task configuration. Use this to do
+ * any additional configuration such as overriding default settings.
*/
private fun Project.makeErrorProneTask(
compileTaskProvider: TaskProvider<JavaCompile>,
- onConfigure: (errorProneTask: JavaCompile) -> Unit = { }
+ onConfigure: (errorProneTask: JavaCompile) -> Unit = {}
) {
- val errorProneTaskProvider = maybeRegister<JavaCompile>(
- name = ERROR_PRONE_TASK,
- onConfigure = {
- val compileTask = compileTaskProvider.get()
- it.classpath = compileTask.classpath
- it.source = compileTask.source
- it.destinationDirectory.set(file(buildDir.resolve("errorProne")))
- it.options.compilerArgs = compileTask.options.compilerArgs.toMutableList()
- it.options.annotationProcessorPath = compileTask.options.annotationProcessorPath
- it.options.bootstrapClasspath = compileTask.options.bootstrapClasspath
- it.sourceCompatibility = compileTask.sourceCompatibility
- it.targetCompatibility = compileTask.targetCompatibility
- it.configureWithErrorProne()
- it.dependsOn(compileTask.dependsOn)
+ val errorProneTaskProvider =
+ maybeRegister<JavaCompile>(
+ name = ERROR_PRONE_TASK,
+ onConfigure = {
+ val compileTask = compileTaskProvider.get()
+ it.classpath = compileTask.classpath
+ it.source = compileTask.source
+ it.destinationDirectory.set(layout.buildDirectory.dir("errorProne"))
+ it.options.compilerArgs = compileTask.options.compilerArgs.toMutableList()
+ it.options.annotationProcessorPath = compileTask.options.annotationProcessorPath
+ it.options.bootstrapClasspath = compileTask.options.bootstrapClasspath
+ it.sourceCompatibility = compileTask.sourceCompatibility
+ it.targetCompatibility = compileTask.targetCompatibility
+ it.configureWithErrorProne()
+ it.dependsOn(compileTask.dependsOn)
- onConfigure(it)
- },
- onRegister = { errorProneProvider ->
- project.addToCheckTask(errorProneProvider)
- }
- )
+ onConfigure(it)
+ },
+ onRegister = { errorProneProvider -> project.addToCheckTask(errorProneProvider) }
+ )
addToBuildOnServer(errorProneTaskProvider)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/FilteredAnchorTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/FilteredAnchorTask.kt
index d4fa963..a8bfddc 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/FilteredAnchorTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/FilteredAnchorTask.kt
@@ -31,21 +31,22 @@
abstract class FilteredAnchorTask : DefaultTask() {
init {
group = "Help"
- description = "Runs tasks with a name specified by -P$PROP_TASK_NAME= for projects with " +
- "a path prefix specified by -P$PROP_PATH_PREFIX="
+ description =
+ "Runs tasks with a name specified by -P$PROP_TASK_NAME= for projects with " +
+ "a path prefix specified by -P$PROP_PATH_PREFIX="
}
- @get:Input
- abstract var pathPrefix: String
+ @get:Input abstract var pathPrefix: String
- @get:Input
- abstract var taskName: String
+ @get:Input abstract var taskName: String
@TaskAction
fun exec() {
if (dependsOn.isEmpty()) {
- throw GradleException("Failed to find any filterable tasks with name \"$taskName\" " +
- "and path prefixed with \"$pathPrefix\"")
+ throw GradleException(
+ "Failed to find any filterable tasks with name \"$taskName\" " +
+ "and path prefixed with \"$pathPrefix\""
+ )
}
}
@@ -57,21 +58,21 @@
}
/**
- * Offers the specified [taskProviders] to the global [FilteredAnchorTask], adding them if they match
- * the requested path prefix and task name.
+ * Offers the specified [taskProviders] to the global [FilteredAnchorTask], adding them if they
+ * match the requested path prefix and task name.
*/
internal fun Project.addFilterableTasks(vararg taskProviders: TaskProvider<*>?) {
if (hasProperty(PROP_PATH_PREFIX) && hasProperty(PROP_TASK_NAME)) {
val pathPrefixes = (properties[PROP_PATH_PREFIX] as String).split(",")
if (pathPrefixes.any { pathPrefix -> relativePathForFiltering().startsWith(pathPrefix) }) {
val taskName = properties[PROP_TASK_NAME] as String
- taskProviders.find { taskProvider ->
- taskName == taskProvider?.name
- }?.let { taskProvider ->
- rootProject.tasks.named(GLOBAL_TASK_NAME).configure { task ->
- task.dependsOn(taskProvider)
+ taskProviders
+ .find { taskProvider -> taskName == taskProvider?.name }
+ ?.let { taskProvider ->
+ rootProject.tasks.named(GLOBAL_TASK_NAME).configure { task ->
+ task.dependsOn(taskProvider)
+ }
}
- }
}
}
}
@@ -79,8 +80,8 @@
/**
* Registers the global [FilteredAnchorTask] if the required command-line properties are set.
*
- * For example, to run `checkApi` for all projects under `core/core/`:
- * ./gradlew filterTasks -Pandroidx.taskName=checkApi -Pandroidx.pathPrefix=core/core/
+ * For example, to run `checkApi` for all projects under `core/core/`: ./gradlew filterTasks
+ * -Pandroidx.taskName=checkApi -Pandroidx.pathPrefix=core/core/
*/
internal fun Project.maybeRegisterFilterableTask() {
if (hasProperty(PROP_TASK_NAME) && hasProperty(PROP_PATH_PREFIX)) {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/FtlRunner.kt b/buildSrc/private/src/main/kotlin/androidx/build/FtlRunner.kt
index d2c8f17..cbb9237 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/FtlRunner.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/FtlRunner.kt
@@ -47,26 +47,22 @@
description = "Runs devices tests in Firebase Test Lab filtered by --className"
}
- @get:Inject
- abstract val execOperations: ExecOperations
+ @get:Inject abstract val execOperations: ExecOperations
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val testFolder: DirectoryProperty
- @get:Internal
- abstract val testLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val testLoader: Property<BuiltArtifactsLoader>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:Optional
abstract val appFolder: DirectoryProperty
- @get:Internal
- abstract val appLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val appLoader: Property<BuiltArtifactsLoader>
- @get:Input
- abstract val apkPackageName: Property<String>
+ @get:Input abstract val apkPackageName: Property<String>
@get:Optional
@get:Input
@@ -91,40 +87,44 @@
)
abstract val instrumentationArgs: Property<String>
- @get:Input
- abstract val device: Property<String>
+ @get:Input abstract val device: Property<String>
@TaskAction
fun execThings() {
if (!System.getenv().containsKey("GOOGLE_APPLICATION_CREDENTIALS")) {
- throw Exception("Running tests in FTL requires credentials, you have not set up " +
- "GOOGLE_APPLICATION_CREDENTIALS, follow go/androidx-dev#remote-build-cache")
+ throw Exception(
+ "Running tests in FTL requires credentials, you have not set up " +
+ "GOOGLE_APPLICATION_CREDENTIALS, follow go/androidx-dev#remote-build-cache"
+ )
}
- val testApk = testLoader.get().load(testFolder.get())
- ?: throw RuntimeException("Cannot load required APK for task: $name")
- val testApkPath = testApk.elements.single().outputFile
- val appApkPath = if (appLoader.isPresent) {
- val appApk = appLoader.get().load(appFolder.get())
+ val testApk =
+ testLoader.get().load(testFolder.get())
?: throw RuntimeException("Cannot load required APK for task: $name")
- appApk.elements.single().outputFile
- } else {
- "gs://androidx-ftl-test-results/github-ci-action/placeholderApp/" +
- "37728671722adb4f49b23ed2f0edb0b4def51c841b0735fdd1648942ff1e9090.apk"
- }
- try {
- execOperations.exec {
- it.commandLine("gcloud", "--version")
+ val testApkPath = testApk.elements.single().outputFile
+ val appApkPath =
+ if (appLoader.isPresent) {
+ val appApk =
+ appLoader.get().load(appFolder.get())
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
+ appApk.elements.single().outputFile
+ } else {
+ "gs://androidx-ftl-test-results/github-ci-action/placeholderApp/" +
+ "37728671722adb4f49b23ed2f0edb0b4def51c841b0735fdd1648942ff1e9090.apk"
}
+ try {
+ execOperations.exec { it.commandLine("gcloud", "--version") }
} catch (exception: Exception) {
throw Exception(
"Missing gcloud, please follow go/androidx-dev#remote-build-cache to set it up"
)
}
val hasFilters = className.isPresent || packageName.isPresent
- val filters = listOfNotNull(
- if (className.isPresent) "class ${className.get()}" else null,
- if (packageName.isPresent) "package ${packageName.get()}" else null,
- ).joinToString(separator = ",")
+ val filters =
+ listOfNotNull(
+ if (className.isPresent) "class ${className.get()}" else null,
+ if (packageName.isPresent) "package ${packageName.get()}" else null,
+ )
+ .joinToString(separator = ",")
val shouldPull = pullScreenshots.isPresent && pullScreenshots.get() == "true"
@@ -162,13 +162,14 @@
}
}
-private val devicesToRunOn = listOf(
- "ftlpixel2api33" to "Pixel2.arm,version=33",
- "ftlpixel2api30" to "Pixel2.arm,version=30",
- "ftlpixel2api28" to "Pixel2.arm,version=28",
- "ftlpixel2api26" to "Pixel2.arm,version=26",
- "ftlnexus4api21" to "Nexus4,version=21",
-)
+private val devicesToRunOn =
+ listOf(
+ "ftlpixel2api33" to "Pixel2.arm,version=33",
+ "ftlpixel2api30" to "Pixel2.arm,version=30",
+ "ftlpixel2api28" to "Pixel2.arm,version=28",
+ "ftlpixel2api26" to "Pixel2.arm,version=26",
+ "ftlnexus4api21" to "Nexus4,version=21",
+ )
fun Project.configureFtlRunner() {
extensions.getByType(AndroidComponentsExtension::class.java).apply {
@@ -182,7 +183,6 @@
artifacts = variant.androidTest?.artifacts
apkPackageName = variant.androidTest?.namespace
}
-
project.plugins.hasPlugin("com.android.test") -> {
name = variant.name
artifacts = variant.artifacts
@@ -216,4 +216,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/GradleTransformWorkaround.kt b/buildSrc/private/src/main/kotlin/androidx/build/GradleTransformWorkaround.kt
index 421f0a7..5435c53 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/GradleTransformWorkaround.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/GradleTransformWorkaround.kt
@@ -23,37 +23,35 @@
* Creates a dependency substitution rule to workaround
* [a Gradle bug](https://github.com/gradle/gradle/issues/20778).
*
- * The root cause of the bug is a mix of external and project coordinates existing
- * simultaneously in the dependency graph. A Gradle optimization attempts to simplify/minimize
- * this graph to allow artifact transforms to being executing as soon as possible, but the
- * optimization was too aggressive in the Androidx case.
+ * The root cause of the bug is a mix of external and project coordinates existing simultaneously in
+ * the dependency graph. A Gradle optimization attempts to simplify/minimize this graph to allow
+ * artifact transforms to being executing as soon as possible, but the optimization was too
+ * aggressive in the Androidx case.
*
* This workaround creates a no-op/unmatching rule which invalidates the above optimization and
* prevents transformations from executing too eagerly.
*
- * This is necessary for Gradle 7.5-rc-1, but should be fixed in Gradle 7.5.1 or 7.6, at which
- * point this class can be removed.
+ * This is necessary for Gradle 7.5-rc-1, but should be fixed in Gradle 7.5.1 or 7.6, at which point
+ * this class can be removed.
*/
object GradleTransformWorkaround {
/**
- * This function applies the [GradleTransformWorkaround] to the given root project, if
- * necessary (if it includes lifecycle-common).
+ * This function applies the [GradleTransformWorkaround] to the given root project, if necessary
+ * (if it includes lifecycle-common).
*
- * @param rootProject The root project whose sub-projects will be updated with the
- * workaround.
+ * @param rootProject The root project whose sub-projects will be updated with the workaround.
*/
fun maybeApply(rootProject: Project) {
check(rootProject.isRoot) {
"""
GradleTransformWorkaround must be invoked with the root project
because it needs to be applied to all sub-projects.
- """.trimIndent()
+ """
+ .trimIndent()
}
rootProject.subprojects { subProject ->
if (subProject.path == ":lifecycle:lifecycle-common") {
- rootProject.subprojects {
- it.applyArtifactTransformWorkaround()
- }
+ rootProject.subprojects { it.applyArtifactTransformWorkaround() }
}
}
}
@@ -61,10 +59,13 @@
private fun Project.applyArtifactTransformWorkaround() {
this.configurations.all { c ->
c.resolutionStrategy.dependencySubstitution { selector ->
- selector.substitute(selector.module("unmatched:unmatched"))
+ selector
+ .substitute(selector.module("unmatched:unmatched"))
.using(selector.project(":lifecycle:lifecycle-common"))
- .because("workaround gradle/gradle#20778 with intentionally unmatching " +
- "substitution rule")
+ .because(
+ "workaround gradle/gradle#20778 with intentionally unmatching " +
+ "substitution rule"
+ )
}
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/InspectionRelease.kt b/buildSrc/private/src/main/kotlin/androidx/build/InspectionRelease.kt
index 0db92e6..effe3e9 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/InspectionRelease.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/InspectionRelease.kt
@@ -25,8 +25,8 @@
import org.gradle.api.tasks.Sync
/**
- * Copies artifacts prepared by InspectionPlugin into $destDir/inspection
- * and $destDir/inspection-nondexed
+ * Copies artifacts prepared by InspectionPlugin into $destDir/inspection and
+ * $destDir/inspection-nondexed
*/
fun Project.publishInspectionArtifacts() {
publishInspectionConfiguration(
@@ -55,10 +55,11 @@
}
}
- val sync = tasks.register(name, Sync::class.java) {
- it.dependsOn(configuration)
- it.from(configuration)
- it.destinationDir = File(getDistributionDirectory(), dirName)
- }
+ val sync =
+ tasks.register(name, Sync::class.java) {
+ it.dependsOn(configuration)
+ it.from(configuration)
+ it.destinationDir = File(getDistributionDirectory(), dirName)
+ }
addToBuildOnServer(sync)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/Ktfmt.kt b/buildSrc/private/src/main/kotlin/androidx/build/Ktfmt.kt
index 07f00a5..cf30835 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/Ktfmt.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/Ktfmt.kt
@@ -17,65 +17,46 @@
package androidx.build
import androidx.build.uptodatedness.cacheEvenIfNoOutputs
-import java.io.ByteArrayOutputStream
+import com.facebook.ktfmt.format.Formatter
+import com.facebook.ktfmt.format.Formatter.format
import java.io.File
import javax.inject.Inject
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.runBlocking
import org.gradle.api.DefaultTask
import org.gradle.api.Project
-import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileTree
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.CacheableTask
-import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFiles
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-import org.gradle.process.ExecOperations
+import org.intellij.lang.annotations.Language
fun Project.configureKtfmt() {
- tasks.register("ktFormat", KtfmtFormatTask::class.java) { task ->
- task.ktfmtClasspath.from(getKtfmtConfiguration())
- }
- tasks.register("ktCheck", KtfmtCheckTask::class.java) { task ->
- task.ktfmtClasspath.from(getKtfmtConfiguration())
- task.cacheEvenIfNoOutputs()
- }
+ tasks.register("ktFormat", KtfmtFormatTask::class.java)
+ tasks.register("ktCheck", KtfmtCheckTask::class.java) { task -> task.cacheEvenIfNoOutputs() }
}
-private val ExcludedDirectories = listOf(
- "test-data",
- "external",
-)
+private val ExcludedDirectories =
+ listOf(
+ "test-data",
+ "external",
+ )
private val ExcludedDirectoryGlobs = ExcludedDirectories.map { "**/$it/**/*.kt" }
-private const val MainClass = "com.facebook.ktfmt.cli.Main"
private const val InputDir = "src"
private const val IncludedFiles = "**/*.kt"
-private fun Project.getKtfmtConfiguration(): ConfigurableFileCollection {
- return files(
- configurations.findByName("ktfmt") ?: configurations.create("ktfmt") {
- val version = getVersionByName("ktfmt")
- val dependency = dependencies.create("com.facebook:ktfmt:$version")
- it.dependencies.add(dependency)
- it.attributes.attribute(bundlingAttribute, "external")
- }
- )
-}
-
@CacheableTask
abstract class BaseKtfmtTask : DefaultTask() {
- @get:Inject
- abstract val execOperations: ExecOperations
-
- @get:Classpath
- abstract val ktfmtClasspath: ConfigurableFileCollection
-
- @get:Inject
- abstract val objects: ObjectFactory
+ @get:Inject abstract val objects: ObjectFactory
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getInputFiles(): FileTree {
@@ -89,33 +70,68 @@
}
}
return objects.fileTree().setDir(projectDirectory).apply {
- subdirectories.forEach {
- include("$it/src/**/*.kt")
+ subdirectories.forEach { include("$it/src/**/*.kt") }
+ }
+ }
+
+ /** Allows overriding to use a custom directory instead of default [Project.getProjectDir]. */
+ @get:Internal var overrideDirectory: File? = null
+
+ /**
+ * Used together with [overrideDirectory] to specify which specific subdirectories should be
+ * analyzed.
+ */
+ @get:Internal var overrideSubdirectories: List<String>? = null
+
+ protected fun runKtfmt(format: Boolean) {
+ if (getInputFiles().files.isEmpty()) return
+ runBlocking(Dispatchers.IO) {
+ val result = processInputFiles()
+ val incorrectlyFormatted = result.filter { !it.isCorrectlyFormatted }
+ if (incorrectlyFormatted.isNotEmpty()) {
+ if (format) {
+ incorrectlyFormatted.forEach { it.input.writeText(it.formattedCode) }
+ } else {
+ error(
+ "Found ${incorrectlyFormatted.size} files that are not correctly " +
+ "formatted:\n" +
+ incorrectlyFormatted.map { it.input }.joinToString("\n")
+ )
+ }
}
}
}
- /**
- * Allows overriding to use a custom directory instead of default [Project.getProjectDir].
- */
- @get:Internal
- var overrideDirectory: File? = null
+ /** Run ktfmt on all the files in [getInputFiles] in parallel. */
+ private suspend fun processInputFiles(): List<KtfmtResult> {
+ return coroutineScope { getInputFiles().files.map { async { processFile(it) } }.awaitAll() }
+ }
- /**
- * Used together with [overrideDirectory] to specify which specific subdirectories should
- * be analyzed.
- */
- @get:Internal
- var overrideSubdirectories: List<String>? = null
-
- protected fun getArgsList(dryRun: Boolean): List<String> {
- val arguments = mutableListOf("--kotlinlang-style")
- if (dryRun) arguments.add("--dry-run")
- arguments.addAll(getInputFiles().files.map { it.absolutePath })
- return arguments
+ /** Run ktfmt on the [input] file. */
+ private fun processFile(input: File): KtfmtResult {
+ // To hack around https://github.com/facebook/ktfmt/issues/406 we rewrite all the
+ // @sample tags to @sample so that ktfmt would not move them around. We then
+ // rewrite it back when returning the formatted code.
+ val originCode = input.readText().replace(SAMPLE, PLACEHOLDER)
+ val formattedCode = format(Formatter.KOTLINLANG_FORMAT, originCode)
+ return KtfmtResult(
+ input = input,
+ isCorrectlyFormatted = originCode == formattedCode,
+ formattedCode = formattedCode.replace(PLACEHOLDER, SAMPLE)
+ )
}
}
+// Keep two of them the same length to make sure line wrapping works as expected
+private const val SAMPLE = "@sample"
+private const val PLACEHOLDER = "@sample"
+
+internal data class KtfmtResult(
+ val input: File,
+ val isCorrectlyFormatted: Boolean,
+ @Language("kotlin") val formattedCode: String,
+)
+
@CacheableTask
abstract class KtfmtFormatTask : BaseKtfmtTask() {
init {
@@ -124,19 +140,11 @@
}
// Format task rewrites inputs, so the outputs are the same as inputs.
- @OutputFiles
- fun getRewrittenFiles(): FileTree = getInputFiles()
+ @OutputFiles fun getRewrittenFiles(): FileTree = getInputFiles()
@TaskAction
fun runFormat() {
- if (getInputFiles().files.isEmpty()) return
- execOperations.javaexec { javaExecSpec ->
- javaExecSpec.mainClass.set(MainClass)
- javaExecSpec.classpath = ktfmtClasspath
- javaExecSpec.args = getArgsList(dryRun = false)
- javaExecSpec.jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
- overrideDirectory?.let { javaExecSpec.workingDir = it }
- }
+ runKtfmt(format = true)
}
}
@@ -149,19 +157,6 @@
@TaskAction
fun runCheck() {
- if (getInputFiles().files.isEmpty()) return
- val outputStream = ByteArrayOutputStream()
- execOperations.javaexec { javaExecSpec ->
- javaExecSpec.standardOutput = outputStream
- javaExecSpec.mainClass.set(MainClass)
- javaExecSpec.classpath = ktfmtClasspath
- javaExecSpec.args = getArgsList(dryRun = true)
- javaExecSpec.jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
- overrideDirectory?.let { javaExecSpec.workingDir = it }
- }
- val output = outputStream.toString()
- if (output.isNotEmpty()) {
- throw Exception("Failed check for the following files:\n$output")
- }
+ runKtfmt(format = false)
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/Ktlint.kt b/buildSrc/private/src/main/kotlin/androidx/build/Ktlint.kt
index 111b4d1..fffddc1 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/Ktlint.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/Ktlint.kt
@@ -26,6 +26,7 @@
import org.gradle.api.attributes.Attribute
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileTree
+import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
@@ -41,61 +42,60 @@
import org.gradle.process.ExecOperations
val bundlingAttribute: Attribute<String> =
- Attribute.of(
- "org.gradle.dependency.bundling",
- String::class.java
- )
+ Attribute.of("org.gradle.dependency.bundling", String::class.java)
private fun Project.getKtlintConfiguration(): ConfigurableFileCollection {
return files(
- configurations.findByName("ktlint") ?: configurations.create("ktlint") {
- val version = getVersionByName("ktlint")
- val dependency = dependencies.create("com.pinterest:ktlint:$version")
- it.dependencies.add(dependency)
- it.attributes.attribute(bundlingAttribute, "external")
- }
+ configurations.findByName("ktlint")
+ ?: configurations.create("ktlint") {
+ val version = getVersionByName("ktlint")
+ val dependency = dependencies.create("com.pinterest:ktlint:$version")
+ it.dependencies.add(dependency)
+ it.attributes.attribute(bundlingAttribute, "external")
+ }
)
}
-private val DisabledRules = listOf(
- // not useful for our projects
- "final-newline",
- // TODO: reenable when https://github.com/pinterest/ktlint/issues/1221 is resolved
- "indent",
- // TODO: reenable when 'indent' is also enabled, meanwhile its to keep the status-quo
- // see: https://github.com/pinterest/ktlint/releases/tag/0.45.0
- "wrapping",
- // Upgrade to 0.49.1 introduced new checks. TODO: fix and re-enable them.
- "trailing-comma-on-call-site",
- "trailing-comma-on-declaration-site",
- "argument-list-wrapping",
- "kdoc-wrapping",
- "comment-wrapping",
- "property-wrapping",
- "no-empty-first-line-in-method-block",
- "multiline-if-else",
- "annotation",
- "spacing-between-declarations-with-annotations",
- "spacing-between-declarations-with-comments",
- "spacing-around-angle-brackets",
- "annotation-spacing",
- "modifier-list-spacing",
- "double-colon-spacing",
- "fun-keyword-spacing",
- "function-return-type-spacing",
- "unary-op-spacing",
- "function-type-reference-spacing",
- "block-comment-initial-star-alignment",
- "package-name",
- "class-naming",
- "no-semi",
- "filename",
-).joinToString(",")
+private val DisabledRules =
+ listOf(
+ // TODO: reenable when https://github.com/pinterest/ktlint/issues/1221 is resolved
+ "indent",
+ // TODO: reenable when 'indent' is also enabled, meanwhile its to keep the status-quo
+ // see: https://github.com/pinterest/ktlint/releases/tag/0.45.0
+ "wrapping",
+ // Upgrade to 0.49.1 introduced new checks. TODO: fix and re-enable them.
+ "trailing-comma-on-call-site",
+ "trailing-comma-on-declaration-site",
+ "argument-list-wrapping",
+ "kdoc-wrapping",
+ "comment-wrapping",
+ "property-wrapping",
+ "no-empty-first-line-in-method-block",
+ "multiline-if-else",
+ "annotation",
+ "spacing-between-declarations-with-annotations",
+ "spacing-between-declarations-with-comments",
+ "spacing-around-angle-brackets",
+ "annotation-spacing",
+ "modifier-list-spacing",
+ "double-colon-spacing",
+ "fun-keyword-spacing",
+ "function-return-type-spacing",
+ "unary-op-spacing",
+ "function-type-reference-spacing",
+ "block-comment-initial-star-alignment",
+ "package-name",
+ "class-naming",
+ "no-semi",
+ "filename",
+ )
+ .joinToString(",")
-private val ExcludedDirectories = listOf(
- "test-data",
- "external",
-)
+private val ExcludedDirectories =
+ listOf(
+ "test-data",
+ "external",
+ )
private val ExcludedDirectoryGlobs = ExcludedDirectories.map { "**/$it/**/*.kt" }
private const val MainClass = "com.pinterest.ktlint.Main"
@@ -103,13 +103,13 @@
private const val IncludedFiles = "**/*.kt"
fun Project.configureKtlint() {
- val outputDir = "${buildDir.relativeTo(projectDir)}/reports/ktlint/"
- val lintProvider = tasks.register("ktlint", KtlintCheckTask::class.java) { task ->
- task.report = File("${outputDir}ktlint-checkstyle-report.xml")
- task.ktlintClasspath.from(getKtlintConfiguration())
- }
+ val lintProvider =
+ tasks.register("ktlint", KtlintCheckTask::class.java) { task ->
+ task.report.set(layout.buildDirectory.file("reports/ktlint/report.xml"))
+ task.ktlintClasspath.from(getKtlintConfiguration())
+ }
tasks.register("ktlintFormat", KtlintFormatTask::class.java) { task ->
- task.report = File("${outputDir}ktlint-format-checkstyle-report.xml")
+ task.report.set(layout.buildDirectory.file("reports/ktlint/format-report.xml"))
task.ktlintClasspath.from(getKtlintConfiguration())
}
// afterEvaluate because Gradle's default "check" task doesn't exist yet
@@ -125,14 +125,11 @@
@CacheableTask
abstract class BaseKtlintTask : DefaultTask() {
- @get:Inject
- abstract val execOperations: ExecOperations
+ @get:Inject abstract val execOperations: ExecOperations
- @get:Classpath
- abstract val ktlintClasspath: ConfigurableFileCollection
+ @get:Classpath abstract val ktlintClasspath: ConfigurableFileCollection
- @get:Inject
- abstract val objects: ObjectFactory
+ @get:Inject abstract val objects: ObjectFactory
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getInputFiles(): FileTree? {
@@ -146,27 +143,20 @@
}
}
return objects.fileTree().setDir(projectDirectory).apply {
- subdirectories.forEach {
- include("$it/src/**/*.kt")
- }
+ subdirectories.forEach { include("$it/src/**/*.kt") }
}
}
- /**
- * Allows overriding to use a custom directory instead of default [Project.getProjectDir].
- */
- @get:Internal
- var overrideDirectory: File? = null
+ /** Allows overriding to use a custom directory instead of default [Project.getProjectDir]. */
+ @get:Internal var overrideDirectory: File? = null
/**
- * Used together with [overrideDirectory] to specify which specific subdirectories should
- * be analyzed.
+ * Used together with [overrideDirectory] to specify which specific subdirectories should be
+ * analyzed.
*/
- @get:Internal
- var overrideSubdirectories: List<String>? = null
+ @get:Internal var overrideSubdirectories: List<String>? = null
- @get:OutputFile
- lateinit var report: File
+ @get:OutputFile abstract val report: RegularFileProperty
protected fun getArgsList(shouldFormat: Boolean): List<String> {
val arguments = mutableListOf("--code-style=android_studio")
@@ -175,13 +165,14 @@
arguments.add("--disabled_rules")
arguments.add(DisabledRules)
arguments.add("--reporter=plain")
- arguments.add("--reporter=checkstyle,output=$report")
+ arguments.add("--reporter=checkstyle,output=${report.get().asFile.absolutePath}")
overrideDirectory?.let {
val subdirectories = overrideSubdirectories
if (subdirectories.isNullOrEmpty()) return@let
subdirectories.map { arguments.add("$it/$InputDir/$IncludedFiles") }
- } ?: arguments.add("$InputDir/$IncludedFiles")
+ }
+ ?: arguments.add("$InputDir/$IncludedFiles")
ExcludedDirectoryGlobs.mapTo(arguments) { "!$InputDir/$it" }
return arguments
@@ -195,26 +186,28 @@
group = "Verification"
}
- @get:Internal
- val projectPath: String = project.path
+ @get:Internal val projectPath: String = project.path
@TaskAction
fun runCheck() {
- val result = execOperations.javaexec { javaExecSpec ->
- javaExecSpec.mainClass.set(MainClass)
- javaExecSpec.classpath = ktlintClasspath
- javaExecSpec.args = getArgsList(shouldFormat = false)
- overrideDirectory?.let { javaExecSpec.workingDir = it }
- javaExecSpec.isIgnoreExitValue = true
- }
+ val result =
+ execOperations.javaexec { javaExecSpec ->
+ javaExecSpec.mainClass.set(MainClass)
+ javaExecSpec.classpath = ktlintClasspath
+ javaExecSpec.args = getArgsList(shouldFormat = false)
+ overrideDirectory?.let { javaExecSpec.workingDir = it }
+ javaExecSpec.isIgnoreExitValue = true
+ }
if (result.exitValue != 0) {
- println("""
+ println(
+ """
********************************************************************************
${TERMINAL_RED}You can attempt to automatically fix these issues with:
./gradlew $projectPath:ktlintFormat$TERMINAL_RESET
********************************************************************************
- """.trimIndent()
+ """
+ .trimIndent()
)
result.assertNormalExitValue()
}
@@ -250,60 +243,60 @@
@get:Input
@set:Option(
option = "file",
- description = "File to check. This option can be used multiple times: --file file1.kt " +
- "--file file2.kt"
+ description =
+ "File to check. This option can be used multiple times: --file file1.kt " +
+ "--file file2.kt"
)
var files: List<String> = emptyList()
@get:Input
@set:Option(
option = "format",
- description = "Use --format to auto-correct style violations (if some errors cannot be " +
- "fixed automatically they will be printed to stderr)"
+ description =
+ "Use --format to auto-correct style violations (if some errors cannot be " +
+ "fixed automatically they will be printed to stderr)"
)
var format = false
- @get:Inject
- abstract val execOperations: ExecOperations
+ @get:Inject abstract val execOperations: ExecOperations
- @get:Classpath
- abstract val ktlintClasspath: ConfigurableFileCollection
+ @get:Classpath abstract val ktlintClasspath: ConfigurableFileCollection
@TaskAction
fun runKtlint() {
if (files.isEmpty()) throw StopExecutionException()
- val kotlinFiles = files.filter { file ->
- val isKotlinFile = file.endsWith(".kt") || file.endsWith(".ktx")
- val inExcludedDir =
- Paths.get(file).any { subPath ->
- ExcludedDirectories.contains(subPath.toString())
- }
+ val kotlinFiles =
+ files.filter { file ->
+ val isKotlinFile = file.endsWith(".kt") || file.endsWith(".ktx")
+ val inExcludedDir =
+ Paths.get(file).any { subPath ->
+ ExcludedDirectories.contains(subPath.toString())
+ }
- isKotlinFile && !inExcludedDir
- }
+ isKotlinFile && !inExcludedDir
+ }
if (kotlinFiles.isEmpty()) throw StopExecutionException()
- val result = execOperations.javaexec { javaExecSpec ->
- javaExecSpec.mainClass.set(MainClass)
- javaExecSpec.classpath = ktlintClasspath
- val args = mutableListOf(
- "--android",
- "--disabled_rules",
- DisabledRules
- )
- args.addAll(kotlinFiles)
- if (format) args.add("-F")
+ val result =
+ execOperations.javaexec { javaExecSpec ->
+ javaExecSpec.mainClass.set(MainClass)
+ javaExecSpec.classpath = ktlintClasspath
+ val args = mutableListOf("--android", "--disabled_rules", DisabledRules)
+ args.addAll(kotlinFiles)
+ if (format) args.add("-F")
- javaExecSpec.args = args
- javaExecSpec.isIgnoreExitValue = true
- }
+ javaExecSpec.args = args
+ javaExecSpec.isIgnoreExitValue = true
+ }
if (result.exitValue != 0) {
- println("""
+ println(
+ """
********************************************************************************
${TERMINAL_RED}You can attempt to automatically fix these issues with:
./gradlew :ktlintCheckFile --format ${kotlinFiles.joinToString { "--file $it" }}$TERMINAL_RESET
********************************************************************************
- """.trimIndent()
+ """
+ .trimIndent()
)
result.assertNormalExitValue()
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/LibraryVersionsService.kt b/buildSrc/private/src/main/kotlin/androidx/build/LibraryVersionsService.kt
index d886eca..e4b6d89 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/LibraryVersionsService.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/LibraryVersionsService.kt
@@ -24,9 +24,7 @@
import org.tomlj.TomlParseResult
import org.tomlj.TomlTable
-/**
- * Loads Library groups and versions from a specified TOML file.
- */
+/** Loads Library groups and versions from a specified TOML file. */
abstract class LibraryVersionsService : BuildService<LibraryVersionsService.Parameters> {
interface Parameters : BuildServiceParameters {
var tomlFileName: String
@@ -38,9 +36,10 @@
private val parsedTomlFile: TomlParseResult by lazy {
val result = Toml.parse(parameters.tomlFileContents.get())
if (result.hasErrors()) {
- val issues = result.errors().joinToString(separator = "\n") {
- "${parameters.tomlFileName}:${it.position()}: ${it.message}"
- }
+ val issues =
+ result.errors().joinToString(separator = "\n") {
+ "${parameters.tomlFileName}:${it.position()}: ${it.message}"
+ }
throw Exception("${parameters.tomlFileName} file has issues.\n$issues")
}
result
@@ -56,8 +55,8 @@
val versions = getTable("versions")
versions.keySet().associateWith { versionName ->
val versionValue =
- if (versionName.startsWith("COMPOSE") &&
- parameters.composeCustomVersion.isPresent
+ if (
+ versionName.startsWith("COMPOSE") && parameters.composeCustomVersion.isPresent
) {
parameters.composeCustomVersion.get()
} else {
@@ -90,9 +89,10 @@
if (association.overrideIncludeInProjectPaths.isEmpty()) {
throw GradleException(
"Duplicate library group $groupId defined in " +
- "${association.declarationName} does not set overrideInclude. " +
- "Declarations beyond the first can only have an effect if they set " +
- "overrideInclude")
+ "${association.declarationName} does not set overrideInclude. " +
+ "Declarations beyond the first can only have an effect if they set " +
+ "overrideInclude"
+ )
}
} else {
result[groupId] = association.libraryGroup
@@ -103,13 +103,13 @@
// map from project name to group override if applicable
val overrideLibraryGroupsByProjectPath: Map<String, LibraryGroup> by lazy {
- val result = mutableMapOf<String, LibraryGroup>()
- for (association in libraryGroupAssociations) {
- for (overridePath in association.overrideIncludeInProjectPaths) {
- result[overridePath] = association.libraryGroup
- }
- }
- result
+ val result = mutableMapOf<String, LibraryGroup>()
+ for (association in libraryGroupAssociations) {
+ for (overridePath in association.overrideIncludeInProjectPaths) {
+ result[overridePath] = association.libraryGroup
+ }
+ }
+ result
}
private val libraryGroupAssociations: List<LibraryGroupAssociation> by lazy {
@@ -123,34 +123,34 @@
)
}
// name without `versions.`
- val atomicGroupVersionName = versionRef.removePrefix(
- VersionReferencePrefix
- )
- return libraryVersions[atomicGroupVersionName] ?: error(
- "Group entry $groupName specifies $atomicGroupVersionName, but such version " +
- "doesn't exist"
- )
+ val atomicGroupVersionName = versionRef.removePrefix(VersionReferencePrefix)
+ return libraryVersions[atomicGroupVersionName]
+ ?: error(
+ "Group entry $groupName specifies $atomicGroupVersionName, but such version " +
+ "doesn't exist"
+ )
}
val result = mutableListOf<LibraryGroupAssociation>()
for (name in groups.keySet()) {
// get group name
val groupDefinition = groups.getTable(name)!!
val groupName = groupDefinition.getString("group")!!
- val finalGroupName = if (name.startsWith("COMPOSE") &&
- parameters.composeCustomGroup.isPresent
- ) {
- groupName.replace("androidx.compose", parameters.composeCustomGroup.get())
- } else groupName
+ val finalGroupName =
+ if (name.startsWith("COMPOSE") && parameters.composeCustomGroup.isPresent) {
+ groupName.replace("androidx.compose", parameters.composeCustomGroup.get())
+ } else groupName
// get group version, if any
- val atomicGroupVersion = readGroupVersion(
- groupDefinition = groupDefinition,
- groupName = groupName,
- key = AtomicGroupVersion
- )
- val overrideApplyToProjects = (
- groupDefinition.getArray("overrideInclude")?.toList() ?: listOf()
- ).map { it as String }
+ val atomicGroupVersion =
+ readGroupVersion(
+ groupDefinition = groupDefinition,
+ groupName = groupName,
+ key = AtomicGroupVersion
+ )
+ val overrideApplyToProjects =
+ (groupDefinition.getArray("overrideInclude")?.toList() ?: listOf()).map {
+ it as String
+ }
val group = LibraryGroup(finalGroupName, atomicGroupVersion)
val association = LibraryGroupAssociation(name, group, overrideApplyToProjects)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
index 753d7bc..8d1ccc2 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/LintConfiguration.kt
@@ -42,9 +42,7 @@
it.dependsOn(lintTask)
it.enabled = false
}
- tasks.register("lintAnalyzeDebug") {
- it.enabled = false
- }
+ tasks.register("lintAnalyzeDebug") { it.enabled = false }
tasks.register("lintRelease") {
it.dependsOn(lintTask)
it.enabled = false
@@ -65,9 +63,7 @@
// makes sure that the lintDebug task will exist, so we can find it by name
setUpLintDebugIfNeeded()
}
- tasks.register("lintAnalyze") {
- it.enabled = false
- }
+ tasks.register("lintAnalyze") { it.enabled = false }
configureLint(lint, extension, isLibrary)
tasks.named("lint").configure { task ->
// We already run lintDebug, we don't need to run lint which lints the release variant
@@ -111,18 +107,14 @@
val mainAidl = extension.sourceSets.getByName("main").aidl.getSourceFiles()
- /**
- * Helper function to add the missing sourcesets to this [VariantInputs]
- */
+ /** Helper function to add the missing sourcesets to this [VariantInputs] */
fun VariantInputs.addSourceSets() {
// Each variant has a source provider for the variant (such as debug) and the 'main'
// variant. The actual files that Lint will run on is both of these providers
// combined - so we can just add the dependencies to the first we see.
val variantAidl = extension.sourceSets.getByName(name.get()).aidl.getSourceFiles()
val sourceProvider = sourceProviders.get().firstOrNull() ?: return
- sourceProvider.javaDirectories.withChangesAllowed {
- from(mainAidl, variantAidl)
- }
+ sourceProvider.javaDirectories.withChangesAllowed { from(mainAidl, variantAidl) }
}
// Lint for libraries is split into two tasks - analysis, and reporting. We need to
@@ -131,9 +123,7 @@
it.variantInputs.addSourceSets()
}
- project.tasks.withType<AndroidLintTask>().configureEach {
- it.variantInputs.addSourceSets()
- }
+ project.tasks.withType<AndroidLintTask>().configureEach { it.variantInputs.addSourceSets() }
// Also configure the model writing task, so that we don't run into mismatches between
// analyzed sources in one module and a downstream module
@@ -144,12 +134,13 @@
}
fun Project.configureLint(lint: Lint, extension: AndroidXExtension, isLibrary: Boolean) {
- val lintChecksProject = project.rootProject.findProject(":lint-checks")
- ?: if (allowMissingLintProject()) {
- return
- } else {
- throw GradleException("Project :lint-checks does not exist")
- }
+ val lintChecksProject =
+ project.rootProject.findProject(":lint-checks")
+ ?: if (allowMissingLintProject()) {
+ return
+ } else {
+ throw GradleException("Project :lint-checks does not exist")
+ }
project.dependencies.add("lintChecks", lintChecksProject)
@@ -246,8 +237,8 @@
// Some Kotlin projects may wish to disable this.
if (
isLibrary &&
- !disable.contains("SyntheticAccessor") &&
- extension.type != LibraryType.SAMPLES
+ !disable.contains("SyntheticAccessor") &&
+ extension.type != LibraryType.SAMPLES
) {
fatal.add("SyntheticAccessor")
}
@@ -284,11 +275,12 @@
// If the project has not overridden the lint config, set the default one.
if (lintConfig == null) {
- val lintXmlPath = if (extension.type == LibraryType.SAMPLES) {
- "buildSrc/lint_samples.xml"
- } else {
- "buildSrc/lint.xml"
- }
+ val lintXmlPath =
+ if (extension.type == LibraryType.SAMPLES) {
+ "buildSrc/lint_samples.xml"
+ } else {
+ "buildSrc/lint.xml"
+ }
// suppress warnings more specifically than issue-wide severity (regexes)
// Currently suppresses warnings from baseline files working as intended
lintConfig = File(project.getSupportRootFolder(), lintXmlPath)
@@ -299,35 +291,30 @@
}
/**
- * Lint on multiplatform projects is only applied to Java code and android source sets. To force it
+ * Lint on multiplatform projects is only applied to Java code and android source sets. To force it
* to run on JVM code, we add the java source sets that lint looks for, but use the sources
* directories of the JVM source sets if they exist.
*/
fun Project.configureLintForMultiplatform(extension: AndroidXExtension) = afterEvaluate {
// if lint has been applied through some other mechanism, this step is unnecessary
- runCatching { project.tasks.named("lint") }.onSuccess { return@afterEvaluate }
- val jvmTarget = project.multiplatformExtension?.targets?.findByName("jvm")
- ?: return@afterEvaluate
- val runtimeConfiguration = project.configurations.findByName("jvmRuntimeElements")
- ?: return@afterEvaluate
- val apiConfiguration = project.configurations.findByName("jvmApiElements")
- ?: return@afterEvaluate
- val javaExtension = project.extensions.findByType(JavaPluginExtension::class.java)
- ?: return@afterEvaluate
+ runCatching { project.tasks.named("lint") }
+ .onSuccess {
+ return@afterEvaluate
+ }
+ val jvmTarget =
+ project.multiplatformExtension?.targets?.findByName("jvm") ?: return@afterEvaluate
+ val runtimeConfiguration =
+ project.configurations.findByName("jvmRuntimeElements") ?: return@afterEvaluate
+ val apiConfiguration =
+ project.configurations.findByName("jvmApiElements") ?: return@afterEvaluate
+ val javaExtension =
+ project.extensions.findByType(JavaPluginExtension::class.java) ?: return@afterEvaluate
project.configurations.maybeCreate("runtimeElements").apply {
extendsFrom(runtimeConfiguration)
}
- project.configurations.maybeCreate("apiElements").apply {
- extendsFrom(apiConfiguration)
- }
- val mainSourceSets = jvmTarget
- .compilations
- .getByName("main")
- .kotlinSourceSets
- val testSourceSets = jvmTarget
- .compilations
- .getByName("test")
- .kotlinSourceSets
+ project.configurations.maybeCreate("apiElements").apply { extendsFrom(apiConfiguration) }
+ val mainSourceSets = jvmTarget.compilations.getByName("main").kotlinSourceSets
+ val testSourceSets = jvmTarget.compilations.getByName("test").kotlinSourceSets
javaExtension.sourceSets.maybeCreate("main").apply {
java.setSrcDirs(mainSourceSets.flatMap { it.kotlin.srcDirs })
java.classesDirectory
@@ -346,8 +333,8 @@
/**
* Lint uses [ConfigurableFileCollection.disallowChanges] during initialization, which prevents
* modifying the file collection separately (there is no time to configure it before AGP has
- * initialized and disallowed changes). This uses reflection to temporarily allow changes, and
- * apply [block].
+ * initialized and disallowed changes). This uses reflection to temporarily allow changes, and apply
+ * [block].
*/
private fun ConfigurableFileCollection.withChangesAllowed(
block: ConfigurableFileCollection.() -> Unit
@@ -359,5 +346,5 @@
disallowChanges.set(this, true)
}
-val Project.lintBaseline: RegularFileProperty get() =
- project.objects.fileProperty().fileValue(File(projectDir, "/lint-baseline.xml"))
+val Project.lintBaseline: RegularFileProperty
+ get() = project.objects.fileProperty().fileValue(File(projectDir, "/lint-baseline.xml"))
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ListAndroidXPropertiesTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/ListAndroidXPropertiesTask.kt
index 08bb1d7..330ddec 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ListAndroidXPropertiesTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ListAndroidXPropertiesTask.kt
@@ -20,9 +20,7 @@
import org.gradle.api.tasks.TaskAction
import org.gradle.work.DisableCachingByDefault
-/**
- * Lists recognized properties whose names start with "androidx"
- */
+/** Lists recognized properties whose names start with "androidx" */
@DisableCachingByDefault(because = "Too many inputs to cache, and runs quickly anyway")
abstract class ListAndroidXPropertiesTask : DefaultTask() {
init {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ListProjectsService.kt b/buildSrc/private/src/main/kotlin/androidx/build/ListProjectsService.kt
index d84efcb6..1e8f45f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ListProjectsService.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ListProjectsService.kt
@@ -20,9 +20,7 @@
import org.gradle.api.services.BuildService
import org.gradle.api.services.BuildServiceParameters
-/**
- * Lists projects as specified by settings.gradle
- */
+/** Lists projects as specified by settings.gradle */
abstract class ListProjectsService : BuildService<ListProjectsService.Parameters> {
interface Parameters : BuildServiceParameters {
var settingsFile: Provider<String>
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ListTaskOutputsTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/ListTaskOutputsTask.kt
index a3e2917..07d5c42 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ListTaskOutputsTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ListTaskOutputsTask.kt
@@ -27,20 +27,14 @@
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
-/**
- * Finds the outputs of every task and saves this mapping into a file
- */
+/** Finds the outputs of every task and saves this mapping into a file */
@CacheableTask
abstract class ListTaskOutputsTask : DefaultTask() {
- @OutputFile
- val outputFile: Property<File> = project.objects.property(File::class.java)
- @Input
- val removePrefixes: MutableList<String> = mutableListOf()
- @Input
- val tasks: MutableList<Task> = mutableListOf()
+ @OutputFile val outputFile: Property<File> = project.objects.property(File::class.java)
+ @Input val removePrefixes: MutableList<String> = mutableListOf()
+ @Input val tasks: MutableList<Task> = mutableListOf()
- @get:Input
- val outputText by lazy { computeOutputText() }
+ @get:Input val outputText by lazy { computeOutputText() }
init {
group = "Help"
@@ -82,11 +76,12 @@
val components = mutableListOf<String>()
var textLength = 0
for (column in columns) {
- val roundedTextLength = if (textLength == 0) {
- textLength
- } else {
- ((textLength / 32) + 1) * 32
- }
+ val roundedTextLength =
+ if (textLength == 0) {
+ textLength
+ } else {
+ ((textLength / 32) + 1) * 32
+ }
val extraSpaces = " ".repeat(roundedTextLength - textLength)
components.add(extraSpaces)
textLength = roundedTextLength
@@ -109,15 +104,16 @@
}
// TODO(149103692): remove all elements of this set
-val taskNamesKnownToDuplicateOutputs = setOf(
- "kotlinSourcesJar",
- "releaseSourcesJar",
- "sourceJarRelease",
- "sourceJar",
- // The following tests intentionally have the same output of golden images
- "updateGoldenDesktopTest",
- "updateGoldenDebugUnitTest"
-)
+val taskNamesKnownToDuplicateOutputs =
+ setOf(
+ "kotlinSourcesJar",
+ "releaseSourcesJar",
+ "sourceJarRelease",
+ "sourceJar",
+ // The following tests intentionally have the same output of golden images
+ "updateGoldenDesktopTest",
+ "updateGoldenDebugUnitTest"
+ )
fun shouldValidateTaskOutput(task: Task): Boolean {
if (!task.enabled) {
@@ -126,14 +122,13 @@
return !taskNamesKnownToDuplicateOutputs.contains(task.name)
}
-// For this project and all subprojects, collects all tasks and creates a map keyed by their output files
+// For this project and all subprojects, collects all tasks and creates a map keyed by their output
+// files
fun Project.findAllTasksByOutput(): Map<File, Task> {
// find list of all tasks
val allTasks = mutableListOf<Task>()
project.allprojects { otherProject ->
- otherProject.tasks.forEach { task ->
- allTasks.add(task)
- }
+ otherProject.tasks.forEach { task -> allTasks.add(task) }
}
// group tasks by their outputs
@@ -144,13 +139,18 @@
if (existingTask != null) {
if (shouldValidateTaskOutput(existingTask) && shouldValidateTaskOutput(otherTask)) {
throw GradleException(
- "Output file " + otherTaskOutput + " was declared as an output of " +
- "multiple tasks: " + otherTask + " and " + existingTask
+ "Output file " +
+ otherTaskOutput +
+ " was declared as an output of " +
+ "multiple tasks: " +
+ otherTask +
+ " and " +
+ existingTask
)
}
- // if there is an exempt conflict, keep the alphabetically earlier task to ensure consistency
- if (existingTask.path > otherTask.path)
- continue
+ // if there is an exempt conflict, keep the alphabetically earlier task to ensure
+ // consistency
+ if (existingTask.path > otherTask.path) continue
}
tasksByOutput[otherTaskOutput] = otherTask
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
index a047538..cd60cc3 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt
@@ -79,22 +79,26 @@
gradle.taskGraph.whenReady {
if (releaseTaskShouldBeRegistered(extension)) {
tasks.findByName(Release.PROJECT_ARCHIVE_ZIP_TASK_NAME)
- ?: throw GradleException("Project $name is configured for publishing, but a " +
- "'createProjectZip' task was never registered. This is likely a bug in" +
- "AndroidX plugin configuration")
+ ?: throw GradleException(
+ "Project $name is configured for publishing, but a " +
+ "'createProjectZip' task was never registered. This is likely a bug in" +
+ "AndroidX plugin configuration"
+ )
}
}
}
private fun Project.releaseTaskShouldBeRegistered(extension: AndroidXExtension): Boolean {
- if (plugins.hasPlugin(AppPlugin::class.java)) { return false }
- if (!extension.shouldRelease() && !isSnapshotBuild()) { return false }
+ if (plugins.hasPlugin(AppPlugin::class.java)) {
+ return false
+ }
+ if (!extension.shouldRelease() && !isSnapshotBuild()) {
+ return false
+ }
return extension.shouldPublish()
}
-/**
- * Configure publishing for a [SoftwareComponent].
- */
+/** Configure publishing for a [SoftwareComponent]. */
private fun Project.configureComponentPublishing(
extension: AndroidXExtension,
kmpExtension: AndroidXMultiplatformExtension,
@@ -102,10 +106,8 @@
componentFactory: SoftwareComponentFactory
) {
val androidxGroup = validateCoordinatesAndGetGroup(extension)
- val projectArchiveDir = File(
- getRepositoryDirectory(),
- "${androidxGroup.group.replace('.', '/')}/$name"
- )
+ val projectArchiveDir =
+ File(getRepositoryDirectory(), "${androidxGroup.group.replace('.', '/')}/$name")
group = androidxGroup.group
/*
@@ -132,11 +134,7 @@
}
configure<PublishingExtension> {
- repositories {
- it.maven { repo ->
- repo.setUrl(getRepositoryDirectory())
- }
- }
+ repositories { it.maven { repo -> repo.setUrl(getRepositoryDirectory()) } }
publications {
if (appliesJavaGradlePluginPlugin()) {
// The 'java-gradle-plugin' will also add to the 'pluginMaven' publication
@@ -148,9 +146,7 @@
if (project.isMultiplatformPublicationEnabled()) {
configureMultiplatformPublication(componentFactory)
} else {
- it.create<MavenPublication>("maven") {
- from(component)
- }
+ it.create<MavenPublication>("maven") { from(component) }
tasks.getByName("publishMavenPublicationToMavenRepository").doFirst {
removePreviouslyUploadedArchives(projectArchiveDir)
}
@@ -160,8 +156,13 @@
publications.withType(MavenPublication::class.java).all { publication ->
publication.pom { pom ->
addInformativeMetadata(extension, pom)
- tweakDependenciesMetadata(androidxGroup, pom, androidLibrariesSetProvider,
- publication.name == KMP_ANCHOR_PUBLICATION_NAME, kmpExtension.defaultPlatform)
+ tweakDependenciesMetadata(
+ androidxGroup,
+ pom,
+ androidLibrariesSetProvider,
+ publication.name == KMP_ANCHOR_PUBLICATION_NAME,
+ kmpExtension.defaultPlatform
+ )
}
}
}
@@ -196,44 +197,37 @@
val metadata = task.outputFile.asFile.get()
val text = metadata.readText()
metadata.writeText(
- text.replace(
- "\"buildId\": .*".toRegex(),
- "\"buildId:\": \"${getBuildId()}\""
- )
+ text.replace("\"buildId\": .*".toRegex(), "\"buildId:\": \"${getBuildId()}\"")
)
}
}
}
-/**
- * Looks for a dependencies XML element within [pom] and sorts its contents.
- */
+/** Looks for a dependencies XML element within [pom] and sorts its contents. */
fun sortPomDependencies(pom: String): String {
// Workaround for using the default namespace in dom4j.
val namespaceUris = mapOf("ns" to "http://maven.apache.org/POM/4.0.0")
val document = parseXml(pom, namespaceUris)
// For each <dependencies> element, sort the contained elements in-place.
- document.rootElement
- .selectNodes("ns:dependencies")
- .filterIsInstance<Element>()
- .forEach { element ->
- val deps = element.elements()
- val sortedDeps = deps.toSortedSet(compareBy { it.stringValue }).toList()
+ document.rootElement.selectNodes("ns:dependencies").filterIsInstance<Element>().forEach {
+ element ->
+ val deps = element.elements()
+ val sortedDeps = deps.toSortedSet(compareBy { it.stringValue }).toList()
- // Content contains formatting nodes, so to avoid modifying those we replace
- // each element with the sorted element from its respective index. Note this
- // will not move adjacent elements, so any comments would remain in their
- // original order.
- element.content().replaceAll {
- val index = deps.indexOf(it)
- if (index >= 0) {
- sortedDeps[index]
- } else {
- it
- }
+ // Content contains formatting nodes, so to avoid modifying those we replace
+ // each element with the sorted element from its respective index. Note this
+ // will not move adjacent elements, so any comments would remain in their
+ // original order.
+ element.content().replaceAll {
+ val index = deps.indexOf(it)
+ if (index >= 0) {
+ sortedDeps[index]
+ } else {
+ it
}
}
+ }
// Write to string. Note that this does not preserve the original indent level, but it
// does preserve line breaks -- not that any of this matters for client XML parsing.
@@ -247,9 +241,7 @@
return stringWriter.toString()
}
-/**
- * Looks for a dependencies JSON element within [metadata] and sorts its contents.
- */
+/** Looks for a dependencies JSON element within [metadata] and sorts its contents. */
fun sortGradleMetadataDependencies(metadata: String): String {
val gson = GsonBuilder().create()
val jsonObj = gson.fromJson(metadata, JsonObject::class.java)!!
@@ -277,9 +269,7 @@
multiplatformExtension.targets.all { target ->
if (target is KotlinAndroidTarget) {
- target.publishLibraryVariants(
- Release.DEFAULT_PUBLISH_CONFIG
- )
+ target.publishLibraryVariants(Release.DEFAULT_PUBLISH_CONFIG)
}
}
@@ -288,8 +278,8 @@
/**
* KMP does not include a sources configuration (b/235486368), so we replace it with our own
- * publication that includes it. This uses internal API as a workaround while waiting for a fix
- * on the original bug.
+ * publication that includes it. This uses internal API as a workaround while waiting for a fix on
+ * the original bug.
*/
private fun Project.replaceBaseMultiplatformPublication(
componentFactory: SoftwareComponentFactory
@@ -308,24 +298,26 @@
// https://youtrack.jetbrains.com/issue/KT-36943 is fixed
(this as MavenPublicationInternal).publishWithOriginalFileName()
- from(object : ComponentWithVariants, SoftwareComponentInternal {
- override fun getName(): String {
- return KMP_ANCHOR_PUBLICATION_NAME
- }
+ from(
+ object : ComponentWithVariants, SoftwareComponentInternal {
+ override fun getName(): String {
+ return KMP_ANCHOR_PUBLICATION_NAME
+ }
- override fun getUsages(): MutableSet<out UsageContext> {
- // Include sources artifact we built and root artifacts from kotlin plugin.
- return (
- sourcesComponents.flatMap { it.usages } +
- kotlinComponent.usages
- ).toMutableSet()
- }
+ override fun getUsages(): MutableSet<out UsageContext> {
+ // Include sources artifact we built and root artifacts from kotlin
+ // plugin.
+ return (sourcesComponents.flatMap { it.usages } +
+ kotlinComponent.usages)
+ .toMutableSet()
+ }
- override fun getVariants(): MutableSet<out SoftwareComponent> {
- // Include all target-based variants from kotlin plugin.
- return (kotlinComponent as ComponentWithVariants).variants
+ override fun getVariants(): MutableSet<out SoftwareComponent> {
+ // Include all target-based variants from kotlin plugin.
+ return (kotlinComponent as ComponentWithVariants).variants
+ }
}
- })
+ )
}
// mark original publication as an alias, so we do not try to publish it.
@@ -341,8 +333,8 @@
}
/**
- * If source configurations with the given names are currently in the project, or if they
- * eventually gets added, run the given [action] with those configurations as software components.
+ * If source configurations with the given names are currently in the project, or if they eventually
+ * gets added, run the given [action] with those configurations as software components.
*/
private fun Project.withSourcesComponents(
componentFactory: SoftwareComponentFactory,
@@ -368,15 +360,17 @@
/**
* Now that we have created our own publication that we want published, prevent the base publication
- * from being published using the roll-up tasks. We should be able to remove this workaround when
+ * from being published using the roll-up tasks. We should be able to remove this workaround when
* b/235486368 is fixed.
*/
private fun Project.disableBaseKmpPublications() {
listOf("publish", "publishToMavenLocal").forEach { taskName ->
tasks.named(taskName).configure { publishTask ->
- publishTask.setDependsOn(publishTask.dependsOn.filterNot {
- (it as String).startsWith("publishKotlinMultiplatform")
- })
+ publishTask.setDependsOn(
+ publishTask.dependsOn.filterNot {
+ (it as String).startsWith("publishKotlinMultiplatform")
+ }
+ )
}
}
}
@@ -384,11 +378,12 @@
private fun Project.isValidReleaseComponent(component: SoftwareComponent) =
component.name == releaseComponentName()
-private fun Project.releaseComponentName() = when {
- plugins.hasPlugin(KotlinMultiplatformPluginWrapper::class.java) -> "kotlin"
- plugins.hasPlugin(JavaPlugin::class.java) -> "java"
- else -> "release"
-}
+private fun Project.releaseComponentName() =
+ when {
+ plugins.hasPlugin(KotlinMultiplatformPluginWrapper::class.java) -> "kotlin"
+ plugins.hasPlugin(JavaPlugin::class.java) -> "java"
+ else -> "release"
+ }
private fun Project.validateCoordinatesAndGetGroup(extension: AndroidXExtension): LibraryGroup {
val mavenGroup = extension.mavenGroup
@@ -399,8 +394,8 @@
val strippedGroupId = mavenGroup.group.substringAfterLast(".")
if (
!extension.bypassCoordinateValidation &&
- mavenGroup.group.startsWith("androidx") &&
- !name.startsWith(strippedGroupId)
+ mavenGroup.group.startsWith("androidx") &&
+ !name.startsWith(strippedGroupId)
) {
throw Exception("Your artifactId must start with '$strippedGroupId'. (currently is $name)")
}
@@ -408,10 +403,9 @@
}
/**
- * Delete any existing archives, so that developers don't get
- * confused/surprised by the presence of old versions.
- * Additionally, deleting old versions makes it more convenient to iterate
- * over all existing archives without visiting archives having old versions too
+ * Delete any existing archives, so that developers don't get confused/surprised by the presence of
+ * old versions. Additionally, deleting old versions makes it more convenient to iterate over all
+ * existing archives without visiting archives having old versions too
*/
private fun removePreviouslyUploadedArchives(projectArchiveDir: File) {
projectArchiveDir.deleteRecursively()
@@ -422,10 +416,11 @@
pom.description.set(provider { extension.description })
pom.url.set(
provider {
- fun defaultUrl() = "https://developer.android.com/jetpack/androidx/releases/" +
- extension.mavenGroup!!.group.removePrefix("androidx.")
- .replace(".", "-") +
- "#" + extension.project.version()
+ fun defaultUrl() =
+ "https://developer.android.com/jetpack/androidx/releases/" +
+ extension.mavenGroup!!.group.removePrefix("androidx.").replace(".", "-") +
+ "#" +
+ extension.project.version()
getAlternativeProjectUrl() ?: defaultUrl()
}
)
@@ -449,9 +444,7 @@
scm.connection.set(ANDROID_GIT_URL)
}
pom.developers { devs ->
- devs.developer { dev ->
- dev.name.set("The Android Open Source Project")
- }
+ devs.developer { dev -> dev.name.set("The Android Open Source Project") }
}
}
@@ -480,42 +473,39 @@
// TODO(aurimas): remove this when Gradle bug is fixed.
// https://github.com/gradle/gradle/issues/3170
-fun assignAarTypes(
- xml: XmlProvider,
- androidLibrariesSet: Set<String>
-) {
+fun assignAarTypes(xml: XmlProvider, androidLibrariesSet: Set<String>) {
val xmlElement = xml.asElement()
- val dependencies = xmlElement.find {
- it.nodeName == "dependencies"
- } as? org.w3c.dom.Element
+ val dependencies = xmlElement.find { it.nodeName == "dependencies" } as? org.w3c.dom.Element
dependencies?.getElementsByTagName("dependency")?.forEach { dependency ->
- val groupId = dependency.find { it.nodeName == "groupId" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate groupId node")
- val artifactId = dependency.find { it.nodeName == "artifactId" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate artifactId node")
+ val groupId =
+ dependency.find { it.nodeName == "groupId" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate groupId node")
+ val artifactId =
+ dependency.find { it.nodeName == "artifactId" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate artifactId node")
if (androidLibrariesSet.contains("$groupId:$artifactId")) {
dependency.appendElement("type", "aar")
}
}
}
-fun insertDefaultMultiplatformDependencies(
- xml: XmlProvider,
- platformId: String
-) {
+fun insertDefaultMultiplatformDependencies(xml: XmlProvider, platformId: String) {
val xmlElement = xml.asElement()
- val groupId = xmlElement.find { it.nodeName == "groupId" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate groupId node")
- val artifactId = xmlElement.find { it.nodeName == "artifactId" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate artifactId node")
- val version = xmlElement.find { it.nodeName == "version" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate version node")
+ val groupId =
+ xmlElement.find { it.nodeName == "groupId" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate groupId node")
+ val artifactId =
+ xmlElement.find { it.nodeName == "artifactId" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate artifactId node")
+ val version =
+ xmlElement.find { it.nodeName == "version" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate version node")
// Find the top-level <dependencies> element or add one if there are no other dependencies.
- val dependencies = xmlElement.find {
- it.nodeName == "dependencies"
- } ?: xmlElement.appendElement("dependencies")
+ val dependencies =
+ xmlElement.find { it.nodeName == "dependencies" }
+ ?: xmlElement.appendElement("dependencies")
dependencies.appendElement("dependency").apply {
appendElement("groupId", groupId)
appendElement("artifactId", "$artifactId-$platformId")
@@ -539,9 +529,7 @@
return element
}
-private fun org.w3c.dom.Node.find(
- predicate: (org.w3c.dom.Node) -> Boolean
-): org.w3c.dom.Node? {
+private fun org.w3c.dom.Node.find(predicate: (org.w3c.dom.Node) -> Boolean): org.w3c.dom.Node? {
val iterator = childrenIterator()
while (iterator.hasNext()) {
val node = iterator.next()
@@ -554,30 +542,28 @@
/**
* Modifies the given .pom to specify that every dependency in <group> refers to a single version
- * and can't be automatically promoted to a new version.
- * This will replace, for example, a version string of "1.0" with a version string of "[1.0]"
+ * and can't be automatically promoted to a new version. This will replace, for example, a version
+ * string of "1.0" with a version string of "[1.0]"
*
* Note: this is not enforced in Gradle nor in plain Maven (without the Enforcer plugin)
* (https://github.com/gradle/gradle/issues/8297)
*/
-fun assignSingleVersionDependenciesInGroupForPom(
- xml: XmlProvider,
- mavenGroup: LibraryGroup
-) {
+fun assignSingleVersionDependenciesInGroupForPom(xml: XmlProvider, mavenGroup: LibraryGroup) {
if (!mavenGroup.requireSameVersion) {
return
}
- val dependencies = xml.asElement().find {
- it.nodeName == "dependencies"
- } as? org.w3c.dom.Element ?: return
+ val dependencies =
+ xml.asElement().find { it.nodeName == "dependencies" } as? org.w3c.dom.Element ?: return
dependencies.getElementsByTagName("dependency").forEach { dependency ->
- val groupId = dependency.find { it.nodeName == "groupId" }?.textContent
- ?: throw IllegalArgumentException("Failed to locate groupId node")
+ val groupId =
+ dependency.find { it.nodeName == "groupId" }?.textContent
+ ?: throw IllegalArgumentException("Failed to locate groupId node")
if (groupId == mavenGroup.group) {
- val versionNode = dependency.find { it.nodeName == "version" }
- ?: throw IllegalArgumentException("Failed to locate version node")
+ val versionNode =
+ dependency.find { it.nodeName == "version" }
+ ?: throw IllegalArgumentException("Failed to locate version node")
val version = versionNode.textContent
if (isVersionRange(version)) {
throw GradleException("Unsupported version '$version': already is a version range")
@@ -597,19 +583,17 @@
}
/**
- * Ensures that artifactIds are consistent when using configuration caching.
- * A workaround for https://github.com/gradle/gradle/issues/18369
+ * Ensures that artifactIds are consistent when using configuration caching. A workaround for
+ * https://github.com/gradle/gradle/issues/18369
*/
-fun ensureConsistentJvmSuffix(
- xml: XmlProvider
-) {
- val dependencies = xml.asElement().find {
- it.nodeName == "dependencies"
- } as? org.w3c.dom.Element ?: return
+fun ensureConsistentJvmSuffix(xml: XmlProvider) {
+ val dependencies =
+ xml.asElement().find { it.nodeName == "dependencies" } as? org.w3c.dom.Element ?: return
dependencies.getElementsByTagName("dependency").forEach { dependency ->
- val artifactId = dependency.find { it.nodeName == "artifactId" }
- ?: throw IllegalArgumentException("Failed to locate artifactId node")
+ val artifactId =
+ dependency.find { it.nodeName == "artifactId" }
+ ?: throw IllegalArgumentException("Failed to locate artifactId node")
// kotlinx-coroutines-core is only a .pom and only depends on kotlinx-coroutines-core-jvm,
// so the two artifacts should be approximately equivalent. However,
// when loading from configuration cache, Gradle often returns a different resolution.
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/PrintProjectCoordinatesTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/PrintProjectCoordinatesTask.kt
index 03d56e2..d780793 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/PrintProjectCoordinatesTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/PrintProjectCoordinatesTask.kt
@@ -64,15 +64,12 @@
}
val groupExplanation = groupExplanation!!
- val lines = mutableListOf(
- listOf("filepath: $projectDir/build.gradle ", "(from settings.gradle)")
- )
+ val lines =
+ mutableListOf(listOf("filepath: $projectDir/build.gradle ", "(from settings.gradle)"))
// put each component of the explanation on its own line
groupExplanation.forEachIndexed { i, component ->
- if (i == 0)
- lines.add(listOf("group : ${projectGroup?.group} ", component))
- else
- lines.add(listOf("", component))
+ if (i == 0) lines.add(listOf("group : ${projectGroup?.group} ", component))
+ else lines.add(listOf("", component))
}
lines.add(listOf("artifact: $projectName ", "(from project name)"))
lines.add(listOf("version : $version ", "(from $versionFrom)"))
@@ -92,10 +89,7 @@
val word = line[i]
val columnSize = columnSizes[i]
// only have to pad columns before the last column
- result += if (i != line.size - 1)
- word.padEnd(columnSize)
- else
- word
+ result += if (i != line.size - 1) word.padEnd(columnSize) else word
}
return result
}
@@ -105,10 +99,8 @@
for (line in lines) {
for (i in line.indices) {
val word = line[i]
- if (maxLengths.size <= i)
- maxLengths.add(0)
- if (maxLengths[i] < word.length)
- maxLengths[i] = word.length
+ if (maxLengths.size <= i) maxLengths.add(0)
+ if (maxLengths[i] < word.length) maxLengths[i] = word.length
}
}
return maxLengths
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ProjectConfigValidators.kt b/buildSrc/private/src/main/kotlin/androidx/build/ProjectConfigValidators.kt
index bbe7f2a..42a0035 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ProjectConfigValidators.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ProjectConfigValidators.kt
@@ -21,70 +21,78 @@
import org.gradle.api.Project
// Translate common phrases and marketing names into Maven name component equivalents.
-private val mavenNameMap = mapOf(
- "android for cars" to "car",
- "android wear" to "wear",
- "internationalization" to "i18n",
- "kotlin extensions" to "ktx",
- "lint checks" to "lint",
- "material components" to "material",
- "material3 components" to "material3",
- "workmanager" to "work",
- "windowmanager" to "window",
-)
+private val mavenNameMap =
+ mapOf(
+ "android for cars" to "car",
+ "android wear" to "wear",
+ "internationalization" to "i18n",
+ "kotlin extensions" to "ktx",
+ "lint checks" to "lint",
+ "material components" to "material",
+ "material3 components" to "material3",
+ "workmanager" to "work",
+ "windowmanager" to "window",
+ )
// Allow a small set of common Maven name components that don't need to appear in the project name.
-private val mavenNameAllowlist = setOf(
- "extension",
- "extensions",
- "for",
- "integration",
- "with",
-)
+private val mavenNameAllowlist =
+ setOf(
+ "extension",
+ "extensions",
+ "for",
+ "integration",
+ "with",
+ )
-/**
- * Validates the project's Maven name against Jetpack guidelines.
- */
+/** Validates the project's Maven name against Jetpack guidelines. */
fun Project.validateProjectMavenName(mavenName: String?, groupId: String) {
if (mavenName == null) return
// Tokenize the Maven name into components. This is *very* permissive regarding separators, and
// we may want to revisit that policy in the future.
- val nameComponents = mavenName.lowercase().let { name ->
- mavenNameMap.entries.fold(name) { newName, entry ->
- newName.replace(entry.key, entry.value)
- }
- }.split(" ", ",", ":", "-").toMutableList() - mavenNameAllowlist
+ val nameComponents =
+ mavenName
+ .lowercase()
+ .let { name ->
+ mavenNameMap.entries.fold(name) { newName, entry ->
+ newName.replace(entry.key, entry.value)
+ }
+ }
+ .split(" ", ",", ":", "-")
+ .toMutableList() - mavenNameAllowlist
// Remaining components *must* appear in the Maven coordinate. Shortening long (>10 char) words
// to five letters or more is allowed, as is changing the pluralization of words.
- nameComponents.find { nameComponent ->
- !name.contains(nameComponent) && !groupId.contains(nameComponent) &&
- !(nameComponent.length > 10 && name.contains(nameComponent.substring(0, 5))) &&
- !(nameComponent.endsWith("s") && name.contains(nameComponent.dropLast(1)))
- }?.let { missingComponent ->
- throw GradleException(
- "Invalid Maven name! Found \"$missingComponent\" in Maven name for $displayName, but " +
- "not project name.\n\nConsider removing \"$missingComponent\" from \"$mavenName\"."
- )
- }
+ nameComponents
+ .find { nameComponent ->
+ !name.contains(nameComponent) &&
+ !groupId.contains(nameComponent) &&
+ !(nameComponent.length > 10 && name.contains(nameComponent.substring(0, 5))) &&
+ !(nameComponent.endsWith("s") && name.contains(nameComponent.dropLast(1)))
+ }
+ ?.let { missingComponent ->
+ throw GradleException(
+ "Invalid Maven name! Found \"$missingComponent\" in Maven name for $displayName, " +
+ "but not project name.\n\nConsider removing \"$missingComponent\" from" +
+ "\"$mavenName\"."
+ )
+ }
}
private const val GROUP_PREFIX = "androidx."
-/**
- * Validates the project structure against Jetpack guidelines.
- */
+/** Validates the project structure against Jetpack guidelines. */
fun Project.validateProjectStructure(groupId: String) {
if (!project.isValidateProjectStructureEnabled()) {
return
}
- val shortGroupId = if (groupId.startsWith(GROUP_PREFIX)) {
- groupId.substring(GROUP_PREFIX.length)
- } else {
- groupId
- }
+ val shortGroupId =
+ if (groupId.startsWith(GROUP_PREFIX)) {
+ groupId.substring(GROUP_PREFIX.length)
+ } else {
+ groupId
+ }
// Fully-qualified Gradle project name should match the Maven coordinate.
val expectName = ":${shortGroupId.replace(".",":")}:${project.name}"
@@ -96,8 +104,7 @@
}
// Project directory should match the Maven coordinate.
- val expectDir = shortGroupId.replace(".", File.separator) +
- "${File.separator}${project.name}"
+ val expectDir = shortGroupId.replace(".", File.separator) + "${File.separator}${project.name}"
// Canonical projectDir is needed because sometimes, at least in tests, on OSX, supportRoot
// starts with /var, and projectDir starts with /private/var (which are the same thing)
val canonicalProjectDir = project.projectDir.canonicalFile
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ProjectExt.kt b/buildSrc/private/src/main/kotlin/androidx/build/ProjectExt.kt
index 5c6a88c..274498d 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ProjectExt.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ProjectExt.kt
@@ -1,17 +1,15 @@
/**
* Copyright 2018 The Android Open Source Project
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT 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.build
@@ -22,9 +20,7 @@
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider
-/**
- * Holder class used for lazily registering tasks using the new Lazy task execution API.
- */
+/** Holder class used for lazily registering tasks using the new Lazy task execution API. */
data class LazyTaskRegistry(
private val names: MutableSet<String> = Collections.synchronizedSet(mutableSetOf())
) {
@@ -38,6 +34,7 @@
companion object {
private const val KEY = "AndroidXAutoRegisteredTasks"
private val lock = ReentrantLock()
+
fun get(project: Project): LazyTaskRegistry {
val existing = project.extensions.findByName(KEY) as? LazyTaskRegistry
if (existing != null) {
@@ -45,9 +42,7 @@
}
return lock.withLock {
project.extensions.findByName(KEY) as? LazyTaskRegistry
- ?: LazyTaskRegistry().also {
- project.extensions.add(KEY, it)
- }
+ ?: LazyTaskRegistry().also { project.extensions.add(KEY, it) }
}
}
}
@@ -60,8 +55,7 @@
): TaskProvider<T> {
@Suppress("UNCHECKED_CAST")
return LazyTaskRegistry.get(project).once(name) {
- tasks.register(name, T::class.java) {
- onConfigure(it)
- }.also(onRegister)
- } ?: tasks.named(name) as TaskProvider<T>
-}
\ No newline at end of file
+ tasks.register(name, T::class.java) { onConfigure(it) }.also(onRegister)
+ }
+ ?: tasks.named(name) as TaskProvider<T>
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ProjectParser.kt b/buildSrc/private/src/main/kotlin/androidx/build/ProjectParser.kt
index 836d7f0..9d0c0fe 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ProjectParser.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ProjectParser.kt
@@ -23,13 +23,10 @@
import org.gradle.api.services.BuildServiceParameters
abstract class ProjectParser : BuildService<BuildServiceParameters.None> {
- @Transient
- val cache: MutableMap<File, ParsedProject> = ConcurrentHashMap()
+ @Transient val cache: MutableMap<File, ParsedProject> = ConcurrentHashMap()
fun get(buildFile: File): ParsedProject {
- return cache.getOrPut(
- key = buildFile
- ) {
+ return cache.getOrPut(key = buildFile) {
val text = buildFile.readLines()
parseProject(text)
}
@@ -40,12 +37,9 @@
var publish: String? = null
var specifiesVersion = false
fileLines.forEach { line ->
- if (libraryType == null)
- libraryType = line.extractVariableValue(" type = LibraryType.")
- if (publish == null)
- publish = line.extractVariableValue(" publish = Publish.")
- if (line.contains("mavenVersion ="))
- specifiesVersion = true
+ if (libraryType == null) libraryType = line.extractVariableValue(" type = LibraryType.")
+ if (publish == null) publish = line.extractVariableValue(" publish = Publish.")
+ if (line.contains("mavenVersion =")) specifiesVersion = true
}
val libraryTypeEnum = libraryType?.let { LibraryType.valueOf(it) } ?: LibraryType.UNSET
val publishEnum = publish?.let { Publish.valueOf(it) } ?: Publish.UNSET
@@ -86,8 +80,7 @@
if (declarationIndex >= 0) {
val suffix = this.substring(declarationIndex + prefix.length)
val spaceIndex = suffix.indexOf(" ")
- if (spaceIndex > 0)
- return suffix.substring(0, spaceIndex)
+ if (spaceIndex > 0) return suffix.substring(0, spaceIndex)
return suffix
}
return null
@@ -104,11 +97,11 @@
File(buildFile.parentFile.parentFile, "material-icons-extended/generate.gradle")
)
}
- val parserProvider = project.rootProject.gradle.sharedServices.registerIfAbsent(
- "ProjectParser",
- ProjectParser::class.java
- ) {
- }
+ val parserProvider =
+ project.rootProject.gradle.sharedServices.registerIfAbsent(
+ "ProjectParser",
+ ProjectParser::class.java
+ ) {}
val parser = parserProvider.get()
return parser.get(buildFile)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ProjectResolver.kt b/buildSrc/private/src/main/kotlin/androidx/build/ProjectResolver.kt
index a28ad23..4a092a1 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ProjectResolver.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ProjectResolver.kt
@@ -26,11 +26,12 @@
return project.project(projectSpecification)
} catch (e: UnknownProjectException) {
val subset = project.getProjectSubset()
- val subsetDescription = if (subset == null) {
- ""
- } else {
- " in subset $subset"
- }
+ val subsetDescription =
+ if (subset == null) {
+ ""
+ } else {
+ " in subset $subset"
+ }
throw UnknownProjectException(
"Project $projectSpecification not found$subsetDescription",
e
@@ -41,8 +42,8 @@
/**
* Returns the name of the subset of projects participating in the build.
*
- * Project subsets are defined in settings.gradle and allow including only a subset of projects
- * in the build, to make project configuration run more quickly.
+ * Project subsets are defined in settings.gradle and allow including only a subset of projects in
+ * the build, to make project configuration run more quickly.
*/
fun Project.getProjectSubset(): String? {
val envProp = project.providers.environmentVariable("ANDROIDX_PROJECTS")
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/PublishingHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/PublishingHelper.kt
index cdc48b0..3ecf59d 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/PublishingHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/PublishingHelper.kt
@@ -24,11 +24,11 @@
// Android Library project 'release' component
val release = components.findByName("release")
if (release is AdhocComponentWithVariants) {
- release.addVariantsFromConfiguration(gradleVariant) { }
+ release.addVariantsFromConfiguration(gradleVariant) {}
}
// Java Library project 'java' component
val javaComponent = components.findByName("java")
if (javaComponent is AdhocComponentWithVariants) {
- javaComponent.addVariantsFromConfiguration(gradleVariant) { }
+ javaComponent.addVariantsFromConfiguration(gradleVariant) {}
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/Release.kt b/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
index 24d1dae..8aab95b 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/Release.kt
@@ -34,25 +34,19 @@
import org.gradle.plugin.devel.GradlePluginDevelopmentExtension
import org.gradle.work.DisableCachingByDefault
-/**
- * Simple description for an artifact that is released from this project.
- */
+/** Simple description for an artifact that is released from this project. */
data class Artifact(
- @get:Input
- val mavenGroup: String,
- @get:Input
- val projectName: String,
- @get:Input
- val version: String
+ @get:Input val mavenGroup: String,
+ @get:Input val projectName: String,
+ @get:Input val version: String
) {
override fun toString() = "$mavenGroup:$projectName:$version"
}
-/**
- * Zip task that zips all artifacts from given candidates.
- */
+/** Zip task that zips all artifacts from given candidates. */
@DisableCachingByDefault(because = "Zip tasks are not worth caching according to Gradle")
-// See https://github.com/gradle/gradle/commit/7e5c5bc9b2c23d872e1c45c855f07ca223f6c270#diff-ce55b0f0cdcf2174eb47d333d348ff6fbd9dbe5cd8c3beeeaf633ea23b74ed9eR38
+// See
+// https://github.com/gradle/gradle/commit/7e5c5bc9b2c23d872e1c45c855f07ca223f6c270#diff-ce55b0f0cdcf2174eb47d333d348ff6fbd9dbe5cd8c3beeeaf633ea23b74ed9eR38
open class GMavenZipTask : Zip() {
init {
@@ -60,28 +54,20 @@
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
- /**
- * Set to true to include maven-metadata.xml
- */
- @get:Input
- var includeMetadata: Boolean = false
+ /** Set to true to include maven-metadata.xml */
+ @get:Input var includeMetadata: Boolean = false
- /**
- * Repository containing artifacts to include
- */
- @get:Internal
- lateinit var androidxRepoOut: File
+ /** Repository containing artifacts to include */
+ @get:Internal lateinit var androidxRepoOut: File
fun addCandidate(artifact: Artifact) {
val groupSubdir = artifact.mavenGroup.replace('.', '/')
val projectSubdir = File("$groupSubdir/${artifact.projectName}")
- val includes = listOfNotNull(
- "${artifact.version}/**",
- if (includeMetadata)
- "maven-metadata.*"
- else
- null
- )
+ val includes =
+ listOfNotNull(
+ "${artifact.version}/**",
+ if (includeMetadata) "maven-metadata.*" else null
+ )
// We specifically pass the subdirectory into 'from' so that changes in other artifacts
// won't cause this task to become out of date
val fromDir = project.file("$androidxRepoOut/$projectSubdir")
@@ -92,34 +78,20 @@
}
}
}
- /**
- * Config action that configures the task when necessary.
- */
+ /** Config action that configures the task when necessary. */
class ConfigAction(private val params: Params) : Action<GMavenZipTask> {
data class Params(
- /**
- * Maven group for the task. "" if multiple groups or only one project
- */
+ /** Maven group for the task. "" if multiple groups or only one project */
val mavenGroup: String,
- /**
- * Set to true to include maven-metadata.xml
- */
+ /** Set to true to include maven-metadata.xml */
var includeMetadata: Boolean,
- /**
- * The root of the repository where built libraries can be found
- */
+ /** The root of the repository where built libraries can be found */
val androidxRepoOut: File,
- /**
- * The out folder where the zip will be created
- */
+ /** The out folder where the zip will be created */
val distDir: File,
- /**
- * Prefix of file name to create
- */
+ /** Prefix of file name to create */
val fileNamePrefix: String,
- /**
- * The build number specified by the server
- */
+ /** The build number specified by the server */
val buildNumber: String
)
@@ -130,7 +102,8 @@
Creates a maven repository that includes just the libraries compiled in
this project.
Group: ${if (mavenGroup != "") mavenGroup else "All"}
- """.trimIndent()
+ """
+ .trimIndent()
task.androidxRepoOut = androidxRepoOut
task.destinationDirectory.set(distDir)
task.includeMetadata = params.includeMetadata
@@ -140,9 +113,7 @@
}
}
-/**
- * Handles creating various release tasks that create zips for the maven upload and local use.
- */
+/** Handles creating various release tasks that create zips for the maven upload and local use. */
object Release {
@Suppress("MemberVisibilityCanBePrivate")
const val PROJECT_ARCHIVE_ZIP_TASK_NAME = "createProjectZip"
@@ -184,9 +155,11 @@
return
}
- val mavenGroup = extension.mavenGroup?.group ?: throw IllegalArgumentException(
- "Cannot register a project to release if it does not have a mavenGroup set up"
- )
+ val mavenGroup =
+ extension.mavenGroup?.group
+ ?: throw IllegalArgumentException(
+ "Cannot register a project to release if it does not have a mavenGroup set up"
+ )
if (!extension.isVersionSet()) {
throw IllegalArgumentException(
"Cannot register a project to release if it does not have a mavenVersion set up"
@@ -195,11 +168,12 @@
val version = project.version
val projectZipTask = getProjectZipTask(project)
- val zipTasks = listOf(
- projectZipTask,
- getGroupReleaseZipTask(project, mavenGroup),
- getGlobalFullZipTask(project)
- )
+ val zipTasks =
+ listOf(
+ projectZipTask,
+ getGroupReleaseZipTask(project, mavenGroup),
+ getGlobalFullZipTask(project)
+ )
val artifacts = extension.publishedArtifacts
val publishTask = project.tasks.named("publish")
@@ -209,17 +183,18 @@
// Add additional artifacts needed for Gradle Plugins
if (extension.type == LibraryType.GRADLE_PLUGIN) {
- project.extensions.getByType(
- GradlePluginDevelopmentExtension::class.java
- ).plugins.forEach { plugin ->
- zipTask.addCandidate(
- Artifact(
- mavenGroup = plugin.id,
- projectName = "${plugin.id}.gradle.plugin",
- version = version.toString()
+ project.extensions
+ .getByType(GradlePluginDevelopmentExtension::class.java)
+ .plugins
+ .forEach { plugin ->
+ zipTask.addCandidate(
+ Artifact(
+ mavenGroup = plugin.id,
+ projectName = "${plugin.id}.gradle.plugin",
+ version = version.toString()
+ )
)
- )
- }
+ }
}
zipTask.dependsOn(publishTask)
@@ -229,16 +204,12 @@
val verifyInputs = getVerifyProjectZipInputsTask(project)
verifyInputs.configure { verifyTask ->
verifyTask.dependsOn(publishTask)
- artifacts.forEach { artifact ->
- verifyTask.addCandidate(artifact)
- }
+ artifacts.forEach { artifact -> verifyTask.addCandidate(artifact) }
}
val verifyOutputs = getVerifyProjectZipOutputsTask(project)
verifyOutputs.configure { verifyTask ->
verifyTask.dependsOn(projectZipTask)
- artifacts.forEach { artifact ->
- verifyTask.addCandidate(artifact)
- }
+ artifacts.forEach { artifact -> verifyTask.addCandidate(artifact) }
}
projectZipTask.configure { zipTask ->
zipTask.dependsOn(verifyInputs)
@@ -249,8 +220,8 @@
}
/**
- * Create config action parameters for the project and group. If group is `null`, parameters
- * are created for the global tasks.
+ * Create config action parameters for the project and group. If group is `null`, parameters are
+ * created for the global tasks.
*/
private fun getParams(
project: Project,
@@ -259,16 +230,17 @@
group: String? = null
): GMavenZipTask.ConfigAction.Params {
// Make base params or reuse if already created
- val params = configActionParams ?: GMavenZipTask.ConfigAction.Params(
- mavenGroup = "",
- includeMetadata = false,
- androidxRepoOut = project.getRepositoryDirectory(),
- distDir = distDir,
- fileNamePrefix = fileNamePrefix,
- buildNumber = getBuildId()
- ).also {
- configActionParams = it
- }
+ val params =
+ configActionParams
+ ?: GMavenZipTask.ConfigAction.Params(
+ mavenGroup = "",
+ includeMetadata = false,
+ androidxRepoOut = project.getRepositoryDirectory(),
+ distDir = distDir,
+ fileNamePrefix = fileNamePrefix,
+ buildNumber = getBuildId()
+ )
+ .also { configActionParams = it }
distDir.mkdirs()
// Copy base params and apply any specific differences
@@ -279,24 +251,19 @@
)
}
- /**
- * Registers an archive task as a dependency of the anchor task
- */
+ /** Registers an archive task as a dependency of the anchor task */
private fun Project.addToAnchorTask(task: TaskProvider<GMavenZipTask>) {
val archiveAnchorTask: TaskProvider<VerifyVersionFilesTask> =
- project.rootProject.maybeRegister(
- name = ALL_ARCHIVES_TASK_NAME,
- onConfigure = { archiveTask: VerifyVersionFilesTask ->
- archiveTask.group = "Distribution"
- archiveTask.description = "Builds all archives for publishing"
- archiveTask.repositoryDirectory = project.rootProject.getRepositoryDirectory()
- },
- onRegister = {
- }
- )
- archiveAnchorTask.configure {
- it.dependsOn(task)
- }
+ project.rootProject.maybeRegister(
+ name = ALL_ARCHIVES_TASK_NAME,
+ onConfigure = { archiveTask: VerifyVersionFilesTask ->
+ archiveTask.group = "Distribution"
+ archiveTask.description = "Builds all archives for publishing"
+ archiveTask.repositoryDirectory = project.rootProject.getRepositoryDirectory()
+ },
+ onRegister = {}
+ )
+ archiveAnchorTask.configure { it.dependsOn(task) }
}
/**
@@ -307,14 +274,14 @@
name = FULL_ARCHIVE_TASK_NAME,
onConfigure = {
GMavenZipTask.ConfigAction(
- getParams(
- project,
- project.getDistributionDirectory(),
- fileNamePrefix = GLOBAL_ZIP_PREFIX
- ).copy(
- includeMetadata = true
+ getParams(
+ project,
+ project.getDistributionDirectory(),
+ fileNamePrefix = GLOBAL_ZIP_PREFIX
+ )
+ .copy(includeMetadata = true)
)
- ).execute(it)
+ .execute(it)
},
onRegister = { taskProvider: TaskProvider<GMavenZipTask> ->
project.addToAnchorTask(taskProvider)
@@ -322,9 +289,7 @@
)
}
- /**
- * Creates and returns the zip task that includes artifacts only in the given maven group.
- */
+ /** Creates and returns the zip task that includes artifacts only in the given maven group. */
private fun getGroupReleaseZipTask(
project: Project,
group: String
@@ -333,44 +298,39 @@
name = "${DIFF_TASK_PREFIX}For${groupToTaskNameSuffix(group)}",
onConfigure = { task: GMavenZipTask ->
GMavenZipTask.ConfigAction(
- getParams(
- project = project,
- distDir = File(project.getDistributionDirectory(), GROUP_ZIPS_FOLDER),
- fileNamePrefix = GROUP_ZIP_PREFIX,
- group = group
+ getParams(
+ project = project,
+ distDir = File(project.getDistributionDirectory(), GROUP_ZIPS_FOLDER),
+ fileNamePrefix = GROUP_ZIP_PREFIX,
+ group = group
+ )
)
- ).execute(task)
+ .execute(task)
},
- onRegister = { taskProvider ->
- project.addToAnchorTask(taskProvider)
- }
+ onRegister = { taskProvider -> project.addToAnchorTask(taskProvider) }
)
}
- private fun getProjectZipTask(
- project: Project
- ): TaskProvider<GMavenZipTask> {
- val taskProvider = project.tasks.register(
- PROJECT_ARCHIVE_ZIP_TASK_NAME,
- GMavenZipTask::class.java
- ) { task: GMavenZipTask ->
- GMavenZipTask.ConfigAction(
- getParams(
- project = project,
- distDir = File(project.getDistributionDirectory(), PROJECT_ZIPS_FOLDER),
- fileNamePrefix = project.projectZipPrefix()
- ).copy(
- includeMetadata = true
- )
- ).execute(task)
- }
+ private fun getProjectZipTask(project: Project): TaskProvider<GMavenZipTask> {
+ val taskProvider =
+ project.tasks.register(PROJECT_ARCHIVE_ZIP_TASK_NAME, GMavenZipTask::class.java) {
+ task: GMavenZipTask ->
+ GMavenZipTask.ConfigAction(
+ getParams(
+ project = project,
+ distDir =
+ File(project.getDistributionDirectory(), PROJECT_ZIPS_FOLDER),
+ fileNamePrefix = project.projectZipPrefix()
+ )
+ .copy(includeMetadata = true)
+ )
+ .execute(task)
+ }
project.addToAnchorTask(taskProvider)
return taskProvider
}
- private fun getVerifyProjectZipInputsTask(
- project: Project
- ): TaskProvider<VerifyGMavenZipTask> {
+ private fun getVerifyProjectZipInputsTask(project: Project): TaskProvider<VerifyGMavenZipTask> {
return project.tasks.register(
"verifyInputs$PROJECT_ARCHIVE_ZIP_TASK_NAME",
VerifyGMavenZipTask::class.java
@@ -392,14 +352,10 @@
because = "This task only checks the existence of files and isn't worth caching"
)
open class VerifyGMavenZipTask : DefaultTask() {
- @Input
- val filesToVerify = mutableListOf<File>()
+ @Input val filesToVerify = mutableListOf<File>()
- /**
- * Whether this build adds automatic constraints between projects in the same group
- */
- @get:Input
- val shouldAddGroupConstraints: Provider<Boolean>
+ /** Whether this build adds automatic constraints between projects in the same group */
+ @get:Input val shouldAddGroupConstraints: Provider<Boolean>
init {
cacheEvenIfNoOutputs()
@@ -435,7 +391,8 @@
(but this property can reduce remote cache usage so it is disabled by default)
See AndroidXGradleProperties.kt for more information about this property
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
@@ -468,9 +425,7 @@
}
}
-/**
- * Let you configure a library variant associated with [Release.DEFAULT_PUBLISH_CONFIG]
- */
+/** Let you configure a library variant associated with [Release.DEFAULT_PUBLISH_CONFIG] */
@Suppress("DEPRECATION") // LibraryVariant
fun LibraryExtension.defaultPublishVariant(
config: (com.android.build.gradle.api.LibraryVariant) -> Unit
@@ -486,46 +441,44 @@
get() {
val groupString = mavenGroup?.group!!
val versionString = project.version.toString()
- val artifacts = mutableListOf(
- Artifact(
- mavenGroup = groupString,
- projectName = project.name,
- version = versionString
+ val artifacts =
+ mutableListOf(
+ Artifact(
+ mavenGroup = groupString,
+ projectName = project.name,
+ version = versionString
+ )
)
- )
// Add platform-specific artifacts, if necessary.
- artifacts += publishPlatforms.map { suffix ->
- Artifact(
- mavenGroup = groupString,
- projectName = "${project.name}-$suffix",
- version = versionString
- )
- }
+ artifacts +=
+ publishPlatforms.map { suffix ->
+ Artifact(
+ mavenGroup = groupString,
+ projectName = "${project.name}-$suffix",
+ version = versionString
+ )
+ }
return artifacts
}
private val AndroidXExtension.publishPlatforms: List<String>
get() {
- val potentialTargets = project.multiplatformExtension?.targets?.asMap?.keys?.map {
- it.lowercase()
- } ?: emptySet()
+ val potentialTargets =
+ project.multiplatformExtension?.targets?.asMap?.keys?.map { it.lowercase() }
+ ?: emptySet()
val declaredTargets = potentialTargets.filter { it != "metadata" }
return declaredTargets.toList()
}
-/**
- * Converts the maven group into a readable task name.
- */
+/** Converts the maven group into a readable task name. */
private fun groupToTaskNameSuffix(group: String): String {
- return group
- .split('.')
- .joinToString("") {
- it.replaceFirstChar { char ->
- if (char.isLowerCase()) char.titlecase(Locale.getDefault()) else char.toString()
- }
+ return group.split('.').joinToString("") {
+ it.replaceFirstChar { char ->
+ if (char.isLowerCase()) char.titlecase(Locale.getDefault()) else char.toString()
}
+ }
}
private fun Project.projectZipPrefix(): String {
@@ -533,26 +486,29 @@
}
private fun getZipName(fileNamePrefix: String, mavenGroup: String): String {
- val fileSuffix = if (mavenGroup == "") {
- "all"
- } else {
- mavenGroup
- .split(".")
- .joinToString("-")
- } + "-${getBuildId()}"
+ val fileSuffix =
+ if (mavenGroup == "") {
+ "all"
+ } else {
+ mavenGroup.split(".").joinToString("-")
+ } + "-${getBuildId()}"
return "$fileNamePrefix-$fileSuffix"
}
fun Project.getProjectZipPath(): String {
- return Release.PROJECT_ZIPS_FOLDER + "/" +
+ return Release.PROJECT_ZIPS_FOLDER +
+ "/" +
// We pass in a "" because that mimics not passing the group to getParams() inside
// the getProjectZipTask function
- getZipName(projectZipPrefix(), "") + "-${project.version}.zip"
+ getZipName(projectZipPrefix(), "") +
+ "-${project.version}.zip"
}
fun Project.getGroupZipPath(): String {
- return Release.GROUP_ZIPS_FOLDER + "/" +
- getZipName(Release.GROUP_ZIP_PREFIX, project.group.toString()) + ".zip"
+ return Release.GROUP_ZIPS_FOLDER +
+ "/" +
+ getZipName(Release.GROUP_ZIP_PREFIX, project.group.toString()) +
+ ".zip"
}
fun Project.getGlobalZipFile(): File {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/ReportLibraryMetricsTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/ReportLibraryMetricsTask.kt
index 4b5556e..880fa5d 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/ReportLibraryMetricsTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/ReportLibraryMetricsTask.kt
@@ -44,14 +44,11 @@
description = "Task for reporting build time library metrics. Currently gathers .aar sizes."
}
- /**
- * The variants we are interested in gathering metrics for.
- */
+ /** The variants we are interested in gathering metrics for. */
@get:[InputFiles Classpath]
abstract val jarFiles: ConfigurableFileCollection
- @get:OutputFile
- abstract val outputFile: Property<File>
+ @get:OutputFile abstract val outputFile: Property<File>
@TaskAction
fun reportLibraryMetrics() {
@@ -100,9 +97,7 @@
task.configure {
val outputDir = project.rootProject.getLibraryMetricsDirectory()
it.outputFile.set(
- task.map {
- File(outputDir, "${project.group}_${project.name}$JSON_FILE_EXTENSION")
- }
+ task.map { File(outputDir, "${project.group}_${project.name}$JSON_FILE_EXTENSION") }
)
}
return task
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/SettingsParser.kt b/buildSrc/private/src/main/kotlin/androidx/build/SettingsParser.kt
index e317c61..23a04db 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/SettingsParser.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/SettingsParser.kt
@@ -22,7 +22,8 @@
* Helper class to parse the settings.gradle file from the main build and extract a list of
* projects.
*
- * This is used by Playground projects too, so if it is changed please run `cd room && ./gradlew tasks`
+ * This is used by Playground projects too, so if it is changed please run `cd room && ./gradlew
+ * tasks`
*/
object SettingsParser {
/**
@@ -30,17 +31,17 @@
* path and an optional argument for project file path.
*/
/* ktlint-disable max-line-length */
- private val includeProjectPattern = Regex(
- """^[\n\r\s]*includeProject\("(?<name>[a-z0-9-:]*)"(,[\n\r\s]*"(?<path>[a-z0-9-/]+))?.*\).*$""",
- setOf(RegexOption.MULTILINE, RegexOption.IGNORE_CASE)
- ).toPattern()
+ private val includeProjectPattern =
+ Regex(
+ """^[\n\r\s]*includeProject\("(?<name>[a-z0-9-:]*)"(,[\n\r\s]*"(?<path>[a-z0-9-/]+))?.*\).*$""",
+ setOf(RegexOption.MULTILINE, RegexOption.IGNORE_CASE)
+ )
+ .toPattern()
fun findProjects(
settingsFile: File,
): List<IncludedProject> {
- return findProjects(
- fileContents = settingsFile.readText(Charsets.UTF_8)
- )
+ return findProjects(fileContents = settingsFile.readText(Charsets.UTF_8))
}
fun findProjects(
@@ -60,24 +61,16 @@
return includedProjects
}
- /**
- * Converts a gradle path (e.g. :a:b:c) to a file path (a/b/c)
- */
+ /** Converts a gradle path (e.g. :a:b:c) to a file path (a/b/c) */
private fun createFilePathFromGradlePath(gradlePath: String): String {
return gradlePath.trimStart(':').replace(':', '/')
}
- /**
- * Represents an included project from the main settings.gradle file.
- */
+ /** Represents an included project from the main settings.gradle file. */
data class IncludedProject(
- /**
- * Gradle path of the project (using : as separator)
- */
+ /** Gradle path of the project (using : as separator) */
val gradlePath: String,
- /**
- * File path for the project, relative to support root folder.
- */
+ /** File path for the project, relative to support root folder. */
val filePath: String
)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
index 5b380b7..e98648a 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt
@@ -20,7 +20,6 @@
import androidx.build.dackka.docsPlatform
import com.android.build.gradle.LibraryExtension
import com.google.gson.GsonBuilder
-import java.io.File
import java.util.Locale
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
@@ -30,6 +29,7 @@
import org.gradle.api.attributes.DocsType
import org.gradle.api.attributes.Usage
import org.gradle.api.file.DuplicatesStrategy
+import org.gradle.api.file.RegularFileProperty
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
@@ -44,22 +44,22 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.Companion.MAIN_COMPILATION_NAME
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
-/**
- * Sets up a source jar task for an Android library project.
- */
+/** Sets up a source jar task for an Android library project. */
fun Project.configureSourceJarForAndroid(extension: LibraryExtension) {
extension.defaultPublishVariant { variant ->
- val sourceJar = tasks.register(
- "sourceJar${variant.name.replaceFirstChar {
+ val sourceJar =
+ tasks.register(
+ "sourceJar${variant.name.replaceFirstChar {
if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
}}",
- Jar::class.java
- ) {
- it.archiveClassifier.set("sources")
- it.from(extension.sourceSets.getByName("main").java.srcDirs)
- // Do not allow source files with duplicate names, information would be lost otherwise.
- it.duplicatesStrategy = DuplicatesStrategy.FAIL
- }
+ Jar::class.java
+ ) {
+ it.archiveClassifier.set("sources")
+ it.from(extension.sourceSets.getByName("main").java.srcDirs)
+ // Do not allow source files with duplicate names, information would be lost
+ // otherwise.
+ it.duplicatesStrategy = DuplicatesStrategy.FAIL
+ }
registerSourcesVariant(sourceJar)
// b/272214715
@@ -99,67 +99,67 @@
}
}
-/**
- * Sets up a source jar task for a Java library project.
- */
+/** Sets up a source jar task for a Java library project. */
fun Project.configureSourceJarForJava() {
- val sourceJar = tasks.register("sourceJar", Jar::class.java) { task ->
- task.archiveClassifier.set("sources")
+ val sourceJar =
+ tasks.register("sourceJar", Jar::class.java) { task ->
+ task.archiveClassifier.set("sources")
- // Do not allow source files with duplicate names, information would be lost otherwise.
- // Different sourceSets in KMP should use different platform infixes, see b/203764756
- task.duplicatesStrategy = DuplicatesStrategy.FAIL
+ // Do not allow source files with duplicate names, information would be lost otherwise.
+ // Different sourceSets in KMP should use different platform infixes, see b/203764756
+ task.duplicatesStrategy = DuplicatesStrategy.FAIL
- extensions.findByType(JavaPluginExtension::class.java)?.let { extension ->
- // Since KotlinPlugin applies JavaPlugin, it's possible for JavaPlugin to exist, but
- // not to have "main". Eventually, we should stop expecting to grab sourceSets by name
- // (b/235828421)
- extension.sourceSets.findByName("main")?.let {
- task.from(it.allSource.sourceDirectories)
+ extensions.findByType(JavaPluginExtension::class.java)?.let { extension ->
+ // Since KotlinPlugin applies JavaPlugin, it's possible for JavaPlugin to exist, but
+ // not to have "main". Eventually, we should stop expecting to grab sourceSets by
+ // name
+ // (b/235828421)
+ extension.sourceSets.findByName("main")?.let {
+ task.from(it.allSource.sourceDirectories)
+ }
}
- }
- extensions.findByType(KotlinMultiplatformExtension::class.java)?.let { extension ->
- for (sourceSetName in listOf("commonMain", "jvmMain")) {
- extension.sourceSets.findByName(sourceSetName)?.let { sourceSet ->
- task.from(sourceSet.kotlin.sourceDirectories)
+ extensions.findByType(KotlinMultiplatformExtension::class.java)?.let { extension ->
+ for (sourceSetName in listOf("commonMain", "jvmMain")) {
+ extension.sourceSets.findByName(sourceSetName)?.let { sourceSet ->
+ task.from(sourceSet.kotlin.sourceDirectories)
+ }
}
}
}
- }
registerSourcesVariant(sourceJar)
}
fun Project.configureSourceJarForMultiplatform() {
- val extension = multiplatformExtension ?: throw GradleException(
- "Unable to find multiplatform extension while configuring multiplatform source JAR"
- )
- val metadataFile = buildDir.resolve(
- PROJECT_STRUCTURE_METADATA_FILEPATH
- )
- val multiplatformMetadataTask = tasks.register(
- "createMultiplatformMetadata",
- CreateMultiplatformMetadata::class.java
- ) {
- it.metadataFile = metadataFile
- it.sourceSetJson = createSourceSetMetadata(extension)
- }
- val sourceJar = tasks.register("multiplatformSourceJar", Jar::class.java) { task ->
- task.dependsOn(multiplatformMetadataTask)
- task.archiveClassifier.set("multiplatform-sources")
-
- // Do not allow source files with duplicate names, information would be lost otherwise.
- // Different sourceSets in KMP should use different platform infixes, see b/203764756
- task.duplicatesStrategy = DuplicatesStrategy.FAIL
- extension.targets.flatMap {
- it.mainCompilation().allKotlinSourceSets
- }.toSet().forEach { sourceSet ->
- task.from(sourceSet.kotlin.srcDirs) { copySpec ->
- copySpec.into(sourceSet.name)
- }
+ val extension =
+ multiplatformExtension
+ ?: throw GradleException(
+ "Unable to find multiplatform extension while configuring multiplatform source JAR"
+ )
+ val metadataFile = layout.buildDirectory.file(PROJECT_STRUCTURE_METADATA_FILEPATH)
+ val multiplatformMetadataTask =
+ tasks.register("createMultiplatformMetadata", CreateMultiplatformMetadata::class.java) {
+ it.metadataFile.set(metadataFile)
+ it.sourceSetJson = createSourceSetMetadata(extension)
}
- task.metaInf.from(metadataFile)
- }
+ val sourceJar =
+ tasks.register("multiplatformSourceJar", Jar::class.java) { task ->
+ task.dependsOn(multiplatformMetadataTask)
+ task.archiveClassifier.set("multiplatform-sources")
+
+ // Do not allow source files with duplicate names, information would be lost otherwise.
+ // Different sourceSets in KMP should use different platform infixes, see b/203764756
+ task.duplicatesStrategy = DuplicatesStrategy.FAIL
+ extension.targets
+ .flatMap { it.mainCompilation().allKotlinSourceSets }
+ .toSet()
+ .forEach { sourceSet ->
+ task.from(sourceSet.kotlin.srcDirs) { copySpec ->
+ copySpec.into(sourceSet.name)
+ }
+ }
+ task.metaInf.from(metadataFile)
+ }
registerMultiplatformSourcesVariant(sourceJar)
}
@@ -182,10 +182,7 @@
configurations.create(configurationName) { gradleVariant ->
gradleVariant.isVisible = false
gradleVariant.isCanBeResolved = false
- gradleVariant.attributes.attribute(
- Usage.USAGE_ATTRIBUTE,
- usage
- )
+ gradleVariant.attributes.attribute(Usage.USAGE_ATTRIBUTE, usage)
gradleVariant.attributes.attribute(
Category.CATEGORY_ATTRIBUTE,
objects.named<Category>(Category.DOCUMENTATION)
@@ -218,15 +215,13 @@
*/
@CacheableTask
abstract class CreateMultiplatformMetadata : DefaultTask() {
- @Input
- lateinit var sourceSetJson: String
+ @Input lateinit var sourceSetJson: String
- @OutputFile
- lateinit var metadataFile: File
+ @get:OutputFile abstract val metadataFile: RegularFileProperty
@TaskAction
fun execute() {
- metadataFile.apply {
+ metadataFile.get().asFile.apply {
parentFile.mkdirs()
createNewFile()
writeText(sourceSetJson)
@@ -236,13 +231,15 @@
fun createSourceSetMetadata(extension: KotlinMultiplatformExtension): String {
val commonMain = extension.sourceSets.getByName("commonMain")
- val sourceSetsByName = mutableMapOf(
- "commonMain" to mapOf(
- "name" to commonMain.name,
- "dependencies" to commonMain.dependsOn.map { it.name },
- "analysisPlatform" to DokkaAnalysisPlatform.COMMON.jsonName
+ val sourceSetsByName =
+ mutableMapOf(
+ "commonMain" to
+ mapOf(
+ "name" to commonMain.name,
+ "dependencies" to commonMain.dependsOn.map { it.name },
+ "analysisPlatform" to DokkaAnalysisPlatform.COMMON.jsonName
+ )
)
- )
extension.targets.forEach { target ->
target.mainCompilation().allKotlinSourceSets.forEach {
sourceSetsByName.getOrPut(it.name) {
@@ -254,9 +251,7 @@
}
}
}
- val sourceSetMetadata = mutableMapOf(
- "sourceSets" to sourceSetsByName.values
- )
+ val sourceSetMetadata = mutableMapOf("sourceSets" to sourceSetsByName.values)
val gson = GsonBuilder().setPrettyPrinting().create()
return gson.toJson(sourceSetMetadata)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/VerifyDependencyVersionsTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/VerifyDependencyVersionsTask.kt
index fcbd5cb..c961f39 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/VerifyDependencyVersionsTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/VerifyDependencyVersionsTask.kt
@@ -31,8 +31,8 @@
import org.gradle.kotlin.dsl.setProperty
/**
- * Task for verifying the androidx dependency-stability-suffix rule
- * (A library is only as stable as its least stable dependency)
+ * Task for verifying the androidx dependency-stability-suffix rule (A library is only as stable as
+ * its least stable dependency)
*/
@CacheableTask
abstract class VerifyDependencyVersionsTask : DefaultTask() {
@@ -42,8 +42,7 @@
description = "Task for verifying the androidx dependency-stability-suffix rule"
}
- @get:Input
- abstract val version: Property<String>
+ @get:Input abstract val version: Property<String>
@get:Input
val androidXDependencySet: SetProperty<AndroidXDependency> = project.objects.setProperty()
@@ -57,34 +56,28 @@
*/
@TaskAction
fun verifyDependencyVersions() {
- androidXDependencySet.get().forEach { dependency ->
- verifyDependencyVersion(dependency)
- }
+ androidXDependencySet.get().forEach { dependency -> verifyDependencyVersion(dependency) }
}
private fun verifyDependencyVersion(dependency: AndroidXDependency) {
// If the version is unspecified then treat as an alpha version. If the depending project's
// version is unspecified then it won't matter, and if the dependency's version is
// unspecified then any non alpha project won't be able to depend on it to ensure safety.
- val projectVersionExtra = if (version.get() ==
- AndroidXExtension.DEFAULT_UNSPECIFIED_VERSION
- ) {
- "-alpha01"
- } else {
- Version(version.get()).extra ?: ""
- }
- val dependencyVersionExtra = if (dependency.version ==
- AndroidXExtension.DEFAULT_UNSPECIFIED_VERSION
- ) {
- "-alpha01"
- } else {
- Version(dependency.version).extra ?: ""
- }
+ val projectVersionExtra =
+ if (version.get() == AndroidXExtension.DEFAULT_UNSPECIFIED_VERSION) {
+ "-alpha01"
+ } else {
+ Version(version.get()).extra ?: ""
+ }
+ val dependencyVersionExtra =
+ if (dependency.version == AndroidXExtension.DEFAULT_UNSPECIFIED_VERSION) {
+ "-alpha01"
+ } else {
+ Version(dependency.version).extra ?: ""
+ }
val projectReleasePhase = releasePhase(projectVersionExtra)
if (projectReleasePhase < 0) {
- throw GradleException(
- "Project has unexpected release phase $projectVersionExtra"
- )
+ throw GradleException("Project has unexpected release phase $projectVersionExtra")
}
val dependencyReleasePhase = releasePhase(dependencyVersionExtra)
if (dependencyReleasePhase < 0) {
@@ -111,8 +104,10 @@
3
} else if (versionExtra.startsWith("-beta")) {
2
- } else if (versionExtra.startsWith("-alpha") || versionExtra.startsWith("-qpreview") ||
- versionExtra.startsWith("-dev")
+ } else if (
+ versionExtra.startsWith("-alpha") ||
+ versionExtra.startsWith("-qpreview") ||
+ versionExtra.startsWith("-dev")
) {
1
} else {
@@ -142,31 +137,32 @@
return null
}
- val taskProvider = tasks.register(
- "verifyDependencyVersions",
- VerifyDependencyVersionsTask::class.java
- ) { task ->
- task.version.set(project.version.toString())
- task.androidXDependencySet.set(project.provider {
- val dependencies = mutableSetOf<AndroidXDependency>()
- project.configurations.filter(::shouldVerifyConfiguration).forEach { configuration ->
- configuration.allDependencies.filter(
- ::shouldVerifyDependency
- ).forEach { dependency ->
- dependencies.add(
- AndroidXDependency(
- dependency.group!!,
- dependency.name,
- dependency.version!!,
- configuration.name
- )
- )
+ val taskProvider =
+ tasks.register("verifyDependencyVersions", VerifyDependencyVersionsTask::class.java) { task
+ ->
+ task.version.set(project.version.toString())
+ task.androidXDependencySet.set(
+ project.provider {
+ val dependencies = mutableSetOf<AndroidXDependency>()
+ project.configurations.filter(::shouldVerifyConfiguration).forEach {
+ configuration ->
+ configuration.allDependencies.filter(::shouldVerifyDependency).forEach {
+ dependency ->
+ dependencies.add(
+ AndroidXDependency(
+ dependency.group!!,
+ dependency.name,
+ dependency.version!!,
+ configuration.name
+ )
+ )
+ }
+ }
+ dependencies
}
- }
- dependencies
- })
- task.cacheEvenIfNoOutputs()
- }
+ )
+ task.cacheEvenIfNoOutputs()
+ }
addToBuildOnServer(taskProvider)
return taskProvider
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/VerifyVersionFilesTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/VerifyVersionFilesTask.kt
index da12c90..f2f6a46 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/VerifyVersionFilesTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/VerifyVersionFilesTask.kt
@@ -27,15 +27,11 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Task for verifying version files in Androidx artifacts
- *
- */
+/** Task for verifying version files in Androidx artifacts */
@CacheableTask
open class VerifyVersionFilesTask : DefaultTask() {
- @InputDirectory @PathSensitive(PathSensitivity.RELATIVE)
- lateinit var repositoryDirectory: File
+ @InputDirectory @PathSensitive(PathSensitivity.RELATIVE) lateinit var repositoryDirectory: File
@TaskAction
fun verifyVersionFilesPresent() {
@@ -53,8 +49,9 @@
val classesJarInputStream = ZipInputStream(aarFileInputStream)
var jarEntry = classesJarInputStream.nextEntry
while (jarEntry != null) {
- if (jarEntry.name.startsWith("META-INF/$expectedPrefix.") &&
- jarEntry.name.endsWith(".version")
+ if (
+ jarEntry.name.startsWith("META-INF/$expectedPrefix.") &&
+ jarEntry.name.endsWith(".version")
) {
foundVersionFile = true
break
@@ -64,7 +61,7 @@
if (!foundVersionFile) {
throw Exception(
"Missing classes.jar/META-INF/$expectedPrefix.*version " +
- "file in ${file.absolutePath}"
+ "file in ${file.absolutePath}"
)
}
break
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/VersionCatalogExtensions.kt b/buildSrc/private/src/main/kotlin/androidx/build/VersionCatalogExtensions.kt
index 7839332..ae0e736 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/VersionCatalogExtensions.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/VersionCatalogExtensions.kt
@@ -19,13 +19,14 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
+import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
+val Project.versionCatalog: VersionCatalog
+ get() = project.extensions.getByType(VersionCatalogsExtension::class.java).find("libs").get()
+
fun Project.getLibraryByName(name: String): MinimalExternalModuleDependency {
- val libs = project.extensions.getByType(
- VersionCatalogsExtension::class.java
- ).find("libs").get()
- val library = libs.findLibrary(name)
+ val library = versionCatalog.findLibrary(name)
return if (library.isPresent) {
library.get().get()
} else {
@@ -34,10 +35,7 @@
}
fun Project.getVersionByName(name: String): String {
- val libs = project.extensions.getByType(
- VersionCatalogsExtension::class.java
- ).find("libs").get()
- val version = libs.findVersion(name)
+ val version = versionCatalog.findVersion(name)
return if (version.isPresent) {
version.get().requiredVersion
} else {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/VersionFileWriterTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/VersionFileWriterTask.kt
index ba29911..82b0dea 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/VersionFileWriterTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/VersionFileWriterTask.kt
@@ -28,21 +28,14 @@
import org.gradle.api.tasks.TaskAction
import org.gradle.work.DisableCachingByDefault
-/**
- * Task that allows to write a version to a given output file.
- */
+/** Task that allows to write a version to a given output file. */
@DisableCachingByDefault(because = "Doesn't benefit from caching")
abstract class VersionFileWriterTask : DefaultTask() {
- @get:Input
- abstract val version: Property<String>
- @get:Input
- abstract val relativePath: Property<String>
- @get:OutputDirectory
- abstract val outputDir: DirectoryProperty
+ @get:Input abstract val version: Property<String>
+ @get:Input abstract val relativePath: Property<String>
+ @get:OutputDirectory abstract val outputDir: DirectoryProperty
- /**
- * The main method for actually writing out the file.
- */
+ /** The main method for actually writing out the file. */
@TaskAction
fun run() {
val outputFile = File(outputDir.get().asFile, relativePath.get())
@@ -54,8 +47,8 @@
}
/**
- * Sets up Android Library project to have a task that generates a version file.
- * It must be called after [LibraryExtension] has been resolved.
+ * Sets up Android Library project to have a task that generates a version file. It must be called
+ * after [LibraryExtension] has been resolved.
*
* @receiver an Android Library project.
*/
@@ -63,26 +56,22 @@
library: LibraryExtension,
androidXExtension: AndroidXExtension
) {
- val writeVersionFile = tasks.register(
- "writeVersionFile",
- VersionFileWriterTask::class.java
- )
+ val writeVersionFile = tasks.register("writeVersionFile", VersionFileWriterTask::class.java)
afterEvaluate {
writeVersionFile.configure {
val group = findProperty("group") as String
val artifactId = findProperty("name") as String
- val version = if (androidXExtension.shouldPublish()) {
- version().toString()
- } else {
- "0.0.0"
- }
+ val version =
+ if (androidXExtension.shouldPublish()) {
+ version().toString()
+ } else {
+ "0.0.0"
+ }
it.version.set(version)
- it.relativePath.set(
- String.format("META-INF/%s_%s.version", group, artifactId)
- )
- it.outputDir.set(File(buildDir, "generatedVersionFile"))
+ it.relativePath.set(String.format("META-INF/%s_%s.version", group, artifactId))
+ it.outputDir.set(layout.buildDirectory.dir("generatedVersionFile"))
// We only add version file if is a library that is publishing.
it.enabled = androidXExtension.shouldPublish()
@@ -97,8 +86,6 @@
}
library.libraryVariants.all { variant ->
- variant.processJavaResourcesProvider.configure {
- it.dependsOn(writeVersionFile)
- }
+ variant.processJavaResourcesProvider.configure { it.dependsOn(writeVersionFile) }
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/XmlParser.kt b/buildSrc/private/src/main/kotlin/androidx/build/XmlParser.kt
index e584040..2bf2e8c2 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/XmlParser.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/XmlParser.kt
@@ -26,9 +26,7 @@
import org.xml.sax.InputSource
import org.xml.sax.XMLReader
-/**
- * Parses an xml string
- */
+/** Parses an xml string */
@Throws(DocumentException::class)
internal fun parseXml(text: String, namespaceUris: Map<String, String>): Document {
val docFactory = DocumentFactory()
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateAggregateLibraryBuildInfoFileTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateAggregateLibraryBuildInfoFileTask.kt
index d4ebdb8..5031f80 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateAggregateLibraryBuildInfoFileTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateAggregateLibraryBuildInfoFileTask.kt
@@ -30,9 +30,7 @@
import org.gradle.api.tasks.TaskAction
import org.gradle.work.DisableCachingByDefault
-/**
- * Task for a json file of all dependencies for each artifactId
- */
+/** Task for a json file of all dependencies for each artifactId */
@DisableCachingByDefault(because = "Not worth caching")
abstract class CreateAggregateLibraryBuildInfoFileTask : DefaultTask() {
init {
@@ -41,26 +39,19 @@
}
/** List of each build_info.txt file for each project. */
- @get:Input
- abstract val libraryBuildInfoFiles: ListProperty<File>
+ @get:Input abstract val libraryBuildInfoFiles: ListProperty<File>
@OutputFile
- val outputFile = File(
- project.getDistributionDirectory(),
- getAndroidxAggregateBuildInfoFilename()
- )
+ val outputFile =
+ File(project.getDistributionDirectory(), getAndroidxAggregateBuildInfoFilename())
private fun getAndroidxAggregateBuildInfoFilename(): String {
return "androidx_aggregate_build_info.txt"
}
- private data class AllLibraryBuildInfoFiles(
- val artifacts: ArrayList<LibraryBuildInfoFile>
- )
+ private data class AllLibraryBuildInfoFiles(val artifacts: ArrayList<LibraryBuildInfoFile>)
- /**
- * Reads in file and checks that json is valid
- */
+ /** Reads in file and checks that json is valid */
private fun jsonFileIsValid(jsonFile: File, artifactList: MutableList<String>): Boolean {
if (!jsonFile.exists()) {
return false
@@ -78,10 +69,10 @@
}
/**
- * Create the output file to contain the final complete AndroidX project build info graph
- * file. Iterate through the list of project-specific build info files, and collects
- * all dependencies as a JSON string. Finally, write this complete dependency graph to a text
- * file as a json list of every project's build information
+ * Create the output file to contain the final complete AndroidX project build info graph file.
+ * Iterate through the list of project-specific build info files, and collects all dependencies
+ * as a JSON string. Finally, write this complete dependency graph to a text file as a json list
+ * of every project's build information
*/
@TaskAction
fun createAndroidxAggregateBuildInfoFile() {
@@ -91,8 +82,9 @@
output.append("{ \"artifacts\": [\n")
val artifactList = mutableListOf<String>()
for (infoFile in libraryBuildInfoFiles.get()) {
- if ((infoFile.isFile and (infoFile.name != outputFile.name))
- and (infoFile.name.contains("_build_info.txt"))
+ if (
+ (infoFile.isFile and (infoFile.name != outputFile.name)) and
+ (infoFile.name.contains("_build_info.txt"))
) {
val fileText: String = infoFile.readText(Charsets.UTF_8)
output.append("$fileText,")
@@ -113,9 +105,7 @@
}
}
-fun Project.addTaskToAggregateBuildInfoFileTask(
- task: Provider<CreateLibraryBuildInfoFileTask>
-) {
+fun Project.addTaskToAggregateBuildInfoFileTask(task: Provider<CreateLibraryBuildInfoFileTask>) {
rootProject.tasks.named(CREATE_AGGREGATE_BUILD_INFO_FILES_TASK).configure {
val aggregateLibraryBuildInfoFileTask = it as CreateAggregateLibraryBuildInfoFileTask
aggregateLibraryBuildInfoFileTask.libraryBuildInfoFiles.add(
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateLibraryBuildInfoFileTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateLibraryBuildInfoFileTask.kt
index d1ba10f..3e4edb6 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateLibraryBuildInfoFileTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/CreateLibraryBuildInfoFileTask.kt
@@ -56,11 +56,10 @@
/**
* This task generates a library build information file containing the artifactId, groupId, and
- * version of public androidx dependencies and release checklist of the library for consumption
- * by the Jetpack Release Service (JetPad).
+ * version of public androidx dependencies and release checklist of the library for consumption by
+ * the Jetpack Release Service (JetPad).
*
- * Example:
- * If this task is configured
+ * Example: If this task is configured
* - for a project with group name "myGroup"
* - on a variant with artifactId "myArtifact",
* - and root project outDir is "out"
@@ -76,65 +75,44 @@
description = "Generates a file containing library build information serialized to json"
}
- @get:OutputFile
- abstract val outputFile: Property<File>
+ @get:OutputFile abstract val outputFile: Property<File>
- @get:Input
- abstract val artifactId: Property<String>
+ @get:Input abstract val artifactId: Property<String>
- @get:Input
- abstract val groupId: Property<String>
+ @get:Input abstract val groupId: Property<String>
- @get:Input
- abstract val version: Property<String>
+ @get:Input abstract val version: Property<String>
- @get:Optional
- @get:Input
- abstract val kotlinVersion: Property<String>
+ @get:Optional @get:Input abstract val kotlinVersion: Property<String>
- @get:Input
- abstract val projectDir: Property<String>
+ @get:Input abstract val projectDir: Property<String>
- @get:Input
- abstract val commit: Property<String>
+ @get:Input abstract val commit: Property<String>
- @get:Input
- abstract val groupIdRequiresSameVersion: Property<Boolean>
+ @get:Input abstract val groupIdRequiresSameVersion: Property<Boolean>
- @get:Input
- abstract val groupZipPath: Property<String>
+ @get:Input abstract val groupZipPath: Property<String>
- @get:Input
- abstract val projectZipPath: Property<String>
+ @get:Input abstract val projectZipPath: Property<String>
- @get:Input
- abstract val dependencyList: ListProperty<LibraryBuildInfoFile.Dependency>
+ @get:Input abstract val dependencyList: ListProperty<LibraryBuildInfoFile.Dependency>
- @get:Input
- abstract val dependencyConstraintList: ListProperty<LibraryBuildInfoFile.Dependency>
+ @get:Input abstract val dependencyConstraintList: ListProperty<LibraryBuildInfoFile.Dependency>
- /**
- * the local project directory without the full framework/support root directory path
- */
- @get:Input
- abstract val projectSpecificDirectory: Property<String>
+ /** the local project directory without the full framework/support root directory path */
+ @get:Input abstract val projectSpecificDirectory: Property<String>
private fun writeJsonToFile(info: LibraryBuildInfoFile) {
val resolvedOutputFile: File = outputFile.get()
val outputDir = resolvedOutputFile.parentFile
if (!outputDir.exists()) {
if (!outputDir.mkdirs()) {
- throw RuntimeException(
- "Failed to create " +
- "output directory: $outputDir"
- )
+ throw RuntimeException("Failed to create " + "output directory: $outputDir")
}
}
if (!resolvedOutputFile.exists()) {
if (!resolvedOutputFile.createNewFile()) {
- throw RuntimeException(
- "Failed to create output dependency dump file: $outputFile"
- )
+ throw RuntimeException("Failed to create output dependency dump file: $outputFile")
}
}
@@ -162,10 +140,10 @@
}
/**
- * Task: createLibraryBuildInfoFile
- * Iterates through each configuration of the project and builds the set of all dependencies.
- * Then adds each dependency to the Artifact class as a project or prebuilt dependency. Finally,
- * writes these dependencies to a json file as a json object.
+ * Task: createLibraryBuildInfoFile Iterates through each configuration of the project and
+ * builds the set of all dependencies. Then adds each dependency to the Artifact class as a
+ * project or prebuilt dependency. Finally, writes these dependencies to a json file as a json
+ * object.
*/
@TaskAction
fun createLibraryBuildInfoFile() {
@@ -189,10 +167,7 @@
val group = project.group.toString()
val artifactId = variant.artifactId
task.outputFile.set(
- File(
- project.getBuildInfoDirectory(),
- "${group}_${artifactId}_build_info.txt"
- )
+ File(project.getBuildInfoDirectory(), "${group}_${artifactId}_build_info.txt")
)
task.artifactId.set(artifactId)
task.groupId.set(group)
@@ -220,36 +195,39 @@
// lazily compute the task dependency list based on the variant dependencies.
task.dependencyList.set(variant.dependencies.map { it.asBuildInfoDependencies() })
- task.dependencyConstraintList.set(variant.dependencyConstraints.map {
- it.asBuildInfoDependencies()
- })
+ task.dependencyConstraintList.set(
+ variant.dependencyConstraints.map { it.asBuildInfoDependencies() }
+ )
}
}
fun List<Dependency>.asBuildInfoDependencies() =
- filter { it.group.isAndroidXDependency() }.map {
- LibraryBuildInfoFile.Dependency().apply {
- this.artifactId = it.name.toString()
- this.groupId = it.group.toString()
- this.version = it.version.toString()
- this.isTipOfTree = it is ProjectDependency || it is BuildInfoVariantDependency
+ filter { it.group.isAndroidXDependency() }
+ .map {
+ LibraryBuildInfoFile.Dependency().apply {
+ this.artifactId = it.name.toString()
+ this.groupId = it.group.toString()
+ this.version = it.version.toString()
+ this.isTipOfTree =
+ it is ProjectDependency || it is BuildInfoVariantDependency
+ }
}
- }.toHashSet().sortedWith(
- compareBy({ it.groupId }, { it.artifactId }, { it.version })
- )
+ .toHashSet()
+ .sortedWith(compareBy({ it.groupId }, { it.artifactId }, { it.version }))
@JvmName("dependencyConstraintsasBuildInfoDependencies")
fun List<DependencyConstraint>.asBuildInfoDependencies() =
- filter { it.group.isAndroidXDependency() }.map {
- LibraryBuildInfoFile.Dependency().apply {
- this.artifactId = it.name.toString()
- this.groupId = it.group.toString()
- this.version = it.version.toString()
- this.isTipOfTree = it is DefaultProjectDependencyConstraint
+ filter { it.group.isAndroidXDependency() }
+ .map {
+ LibraryBuildInfoFile.Dependency().apply {
+ this.artifactId = it.name.toString()
+ this.groupId = it.group.toString()
+ this.version = it.version.toString()
+ this.isTipOfTree = it is DefaultProjectDependencyConstraint
+ }
}
- }.toHashSet().sortedWith(
- compareBy({ it.groupId }, { it.artifactId }, { it.version })
- )
+ .toHashSet()
+ .sortedWith(compareBy({ it.groupId }, { it.artifactId }, { it.version }))
private fun String?.isAndroidXDependency() =
this != null && startsWith("androidx.") && !startsWith("androidx.test")
@@ -291,16 +269,16 @@
libraryGroup: LibraryGroup?,
artifactId: String
) {
- val task = createBuildInfoTask(
- pub,
- libraryGroup,
- artifactId,
- project.provider {
- project.getFrameworksSupportCommitShaAtHead()
- }
- )
- rootProject.tasks.named(CreateLibraryBuildInfoFileTask.TASK_NAME)
- .configure { it.dependsOn(task) }
+ val task =
+ createBuildInfoTask(
+ pub,
+ libraryGroup,
+ artifactId,
+ project.provider { project.getFrameworksSupportCommitShaAtHead() }
+ )
+ rootProject.tasks.named(CreateLibraryBuildInfoFileTask.TASK_NAME).configure {
+ it.dependsOn(task)
+ }
addTaskToAggregateBuildInfoFileTask(task)
}
@@ -311,30 +289,39 @@
shaProvider: Provider<String>
): TaskProvider<CreateLibraryBuildInfoFileTask> {
return CreateLibraryBuildInfoFileTask.setup(
- project = project,
- mavenGroup = libraryGroup,
- variant = VariantPublishPlan(
+ project = project,
+ mavenGroup = libraryGroup,
+ variant =
+ VariantPublishPlan(
artifactId = artifactId,
taskSuffix = computeTaskSuffix(artifactId),
- dependencies = project.provider {
- pub.component?.let { component ->
- val usageDependencies =
- component.usages.orEmpty().flatMap { it.dependencies }
- usageDependencies + dependenciesOnKmpVariants(component)
- }.orEmpty()
- },
- dependencyConstraints = project.provider {
- pub.component?.let { component ->
- component.usages.orEmpty().flatMap { it.dependencyConstraints }
- }.orEmpty()
- }),
+ dependencies =
+ project.provider {
+ pub.component
+ ?.let { component ->
+ val usageDependencies =
+ component.usages.orEmpty().flatMap { it.dependencies }
+ usageDependencies + dependenciesOnKmpVariants(component)
+ }
+ .orEmpty()
+ },
+ dependencyConstraints =
+ project.provider {
+ pub.component
+ ?.let { component ->
+ component.usages.orEmpty().flatMap { it.dependencyConstraints }
+ }
+ .orEmpty()
+ }
+ ),
shaProvider = shaProvider
- )
+ )
}
private fun dependenciesOnKmpVariants(component: SoftwareComponentInternal) =
- (component as? ComponentWithVariants)?.variants.orEmpty()
- .mapNotNull { (it as? ComponentWithCoordinates)?.coordinates?.asDependency() }
+ (component as? ComponentWithVariants)?.variants.orEmpty().mapNotNull {
+ (it as? ComponentWithCoordinates)?.coordinates?.asDependency()
+ }
private fun ModuleVersionIdentifier.asDependency() =
BuildInfoVariantDependency(group, name, version)
@@ -344,5 +331,7 @@
// For examples, see CreateLibraryBuildInfoFileTaskTest
@VisibleForTesting
-fun computeTaskSuffix(artifactId: String) = artifactId.split("-").drop(1)
- .joinToString("") { word -> word.replaceFirstChar { it.uppercase() } }
+fun computeTaskSuffix(artifactId: String) =
+ artifactId.split("-").drop(1).joinToString("") { word ->
+ word.replaceFirstChar { it.uppercase() }
+ }
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/VariantPublishPlan.kt b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/VariantPublishPlan.kt
index 1429b2e..4878d1a 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/VariantPublishPlan.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/buildInfo/VariantPublishPlan.kt
@@ -24,8 +24,8 @@
* Info about a particular variant that will be published
*
* @param artifactId the maven artifact id
- * @param taskSuffix if non-null, will be added to the end of task names to disambiguate
- * (i.e. createLibraryBuildInfoFiles becomes createLibraryBuildInfoFilesJvm)
+ * @param taskSuffix if non-null, will be added to the end of task names to disambiguate (i.e.
+ * createLibraryBuildInfoFiles becomes createLibraryBuildInfoFilesJvm)
* @param dependencies provider that will return the dependencies of this variant when/if needed
*/
data class VariantPublishPlan(
@@ -33,4 +33,4 @@
val taskSuffix: String = "",
val dependencies: Provider<List<Dependency>>,
val dependencyConstraints: Provider<List<DependencyConstraint>>
-)
\ No newline at end of file
+)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiLocation.kt b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiLocation.kt
index 634a9d7..9d2da02 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiLocation.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiLocation.kt
@@ -25,6 +25,7 @@
/**
* Contains information about the files used to record a library's API surfaces. This class may
* represent a versioned API txt file or the "current" API txt file.
+ *
* <p>
* This class is responsible for understanding the naming pattern used by various types of API
* files:
@@ -100,72 +101,48 @@
)
}
- /**
- * File name extension used by API files.
- */
+ /** File name extension used by API files. */
private const val EXTENSION = ".txt"
- /**
- * Base file name used by current API files.
- */
+ /** Base file name used by current API files. */
private const val CURRENT = "current"
- /**
- * Prefix used for removed API surface files.
- */
+ /** Prefix used for removed API surface files. */
private const val PREFIX_REMOVED = "removed_"
- /**
- * Prefix used for restricted API surface files.
- */
+ /** Prefix used for restricted API surface files. */
private const val PREFIX_RESTRICTED = "restricted_"
- /**
- * Prefix used for resource-type API files.
- */
+ /** Prefix used for resource-type API files. */
private const val PREFIX_RESOURCE = "res-"
- /**
- * Directory name for location of native API files
- */
+ /** Directory name for location of native API files */
private const val NATIVE_API_DIRECTORY_NAME = "native"
- /**
- * Directory name for location of AIDL API files
- */
+ /** Directory name for location of AIDL API files */
private const val AIDL_API_DIRECTORY_NAME = "aidl"
- /**
- * File name for API version history file.
- */
+ /** File name for API version history file. */
private const val API_LEVELS = "apiLevels.json"
}
}
-/**
- * Converts the version to a valid API file base name.
- */
+/** Converts the version to a valid API file base name. */
private fun Version.toApiFileBaseName(): String {
return getApiFileVersion(this).toString()
}
-/**
- * Returns the directory containing the project's versioned and current API files.
- */
+/** Returns the directory containing the project's versioned and current API files. */
fun Project.getApiFileDirectory(): File {
return File(project.projectDir, "api")
}
-/**
- * Returns whether the project's API file directory exists.
- */
+/** Returns whether the project's API file directory exists. */
fun Project.hasApiFileDirectory(): Boolean {
return project.getApiFileDirectory().exists()
}
-/**
- * Returns the directory containing the project's built current API file.
- */
+/** Returns the directory containing the project's built current API file. */
private fun Project.getBuiltApiFileDirectory(): File {
return File(project.buildDir, "api")
}
@@ -191,8 +168,8 @@
}
/**
- * Returns an ApiLocation for the "work-in-progress" current version which is built from
- * tip-of-tree and lives in the build output directory.
+ * Returns an ApiLocation for the "work-in-progress" current version which is built from tip-of-tree
+ * and lives in the build output directory.
*/
fun Project.getBuiltApiLocation(): ApiLocation {
return ApiLocation.fromCurrent(project.getBuiltApiFileDirectory())
@@ -201,9 +178,10 @@
/**
* Contains information about the files used to record a library's API compatibility and lint
* violation baselines.
+ *
* <p>
- * This class is responsible for understanding the naming pattern used by various types of
- * API compatibility and linting violation baseline files:
+ * This class is responsible for understanding the naming pattern used by various types of API
+ * compatibility and linting violation baseline files:
* <ul>
* <li>public API compatibility
* <li>restricted API compatibility
@@ -222,18 +200,17 @@
val ignoreFileDirectory = apiLocation.apiFileDirectory
return ApiBaselinesLocation(
ignoreFileDirectory = ignoreFileDirectory,
- publicApiFile = File(
- ignoreFileDirectory,
- apiLocation.publicApiFile.nameWithoutExtension + EXTENSION
- ),
- restrictedApiFile = File(
- ignoreFileDirectory,
- apiLocation.restrictedApiFile.nameWithoutExtension + EXTENSION
- ),
- apiLintFile = File(
- ignoreFileDirectory,
- "api_lint$EXTENSION"
- )
+ publicApiFile =
+ File(
+ ignoreFileDirectory,
+ apiLocation.publicApiFile.nameWithoutExtension + EXTENSION
+ ),
+ restrictedApiFile =
+ File(
+ ignoreFileDirectory,
+ apiLocation.restrictedApiFile.nameWithoutExtension + EXTENSION
+ ),
+ apiLintFile = File(ignoreFileDirectory, "api_lint$EXTENSION")
)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
index 84ef383..a05104f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
@@ -36,8 +36,11 @@
import org.gradle.kotlin.dsl.getByType
sealed class ApiTaskConfig
+
data class LibraryApiTaskConfig(val library: LibraryExtension) : ApiTaskConfig()
+
object JavaApiTaskConfig : ApiTaskConfig()
+
object KmpApiTaskConfig : ApiTaskConfig()
fun AndroidXExtension.shouldConfigureApiTasks(): Boolean {
@@ -65,7 +68,9 @@
}
is RunApiTasks.Yes -> {
// API behavior is default for type; not overridden
- if (type.checkApi is RunApiTasks.Yes) { return true }
+ if (type.checkApi is RunApiTasks.Yes) {
+ return true
+ }
// API behavior for type is overridden
(runApiTasks as RunApiTasks.Yes).reason?.let { reason ->
project.logger.info(
@@ -107,6 +112,7 @@
/**
* Returns whether the project should write versioned API files, e.g. `1.1.0-alpha01.txt`.
+ *
* <p>
* When set to `true`, the `updateApi` task will write the current API surface to both `current.txt`
* and `<version>.txt`. When set to `false`, only `current.txt` will be written. The default value
@@ -120,9 +126,8 @@
// Policy: Don't write versioned files for non-final API surfaces, ex. dev or alpha, or for
// versions that should only exist in dead-end release branches, ex. rc or stable.
- if (!project.version().isFinalApi() ||
- project.version().isRC() ||
- project.version().isStable()
+ if (
+ !project.version().isFinalApi() || project.version().isRC() || project.version().isStable()
) {
return false
}
@@ -130,10 +135,7 @@
return true
}
-fun Project.configureProjectForApiTasks(
- config: ApiTaskConfig,
- extension: AndroidXExtension
-) {
+fun Project.configureProjectForApiTasks(config: ApiTaskConfig, extension: AndroidXExtension) {
// afterEvaluate required to read extension properties
afterEvaluate {
if (!extension.shouldConfigureApiTasks()) {
@@ -143,34 +145,36 @@
val builtApiLocation = project.getBuiltApiLocation()
val versionedApiLocation = project.getVersionedApiLocation()
val currentApiLocation = project.getCurrentApiLocation()
- val outputApiLocations = if (project.shouldWriteVersionedApiFile()) {
- listOf(
- versionedApiLocation,
- currentApiLocation
- )
- } else {
- listOf(
- currentApiLocation
- )
- }
+ val outputApiLocations =
+ if (project.shouldWriteVersionedApiFile()) {
+ listOf(versionedApiLocation, currentApiLocation)
+ } else {
+ listOf(currentApiLocation)
+ }
val javaInputs: JavaCompileInputs
val processManifest: ProcessLibraryManifest?
when (config) {
is LibraryApiTaskConfig -> {
- val variant = config.library.libraryVariants.find {
- it.name == Release.DEFAULT_PUBLISH_CONFIG
- } ?: return@afterEvaluate
+ val variant =
+ config.library.libraryVariants.find {
+ it.name == Release.DEFAULT_PUBLISH_CONFIG
+ }
+ ?: return@afterEvaluate
- javaInputs = JavaCompileInputs.fromLibraryVariant(
- variant,
- project,
- // Note, in addition to androidx, bootClasspath will also include stub jars
- // from android { useLibrary "android.foo" } block.
- files(config.library.bootClasspath)
- )
- processManifest = config.library.buildOutputs.getByName(variant.name)
- .processManifestProvider.get() as ProcessLibraryManifest
+ javaInputs =
+ JavaCompileInputs.fromLibraryVariant(
+ variant,
+ project,
+ // Note, in addition to androidx, bootClasspath will also include stub jars
+ // from android { useLibrary "android.foo" } block.
+ files(config.library.bootClasspath)
+ )
+ processManifest =
+ config.library.buildOutputs
+ .getByName(variant.name)
+ .processManifestProvider
+ .get() as ProcessLibraryManifest
}
is KmpApiTaskConfig -> {
javaInputs = JavaCompileInputs.fromKmpJvmTarget(project)
@@ -187,8 +191,13 @@
val baselinesApiLocation = ApiBaselinesLocation.fromApiLocation(currentApiLocation)
MetalavaTasks.setupProject(
- project, javaInputs, extension, processManifest, baselinesApiLocation,
- builtApiLocation, outputApiLocations
+ project,
+ javaInputs,
+ extension,
+ processManifest,
+ baselinesApiLocation,
+ builtApiLocation,
+ outputApiLocations
)
if (extension.type == LibraryType.PUBLISHED_NATIVE_LIBRARY) {
@@ -203,8 +212,10 @@
if (config is LibraryApiTaskConfig) {
ResourceTasks.setupProject(
- project, Release.DEFAULT_PUBLISH_CONFIG,
- builtApiLocation, outputApiLocations
+ project,
+ Release.DEFAULT_PUBLISH_CONFIG,
+ builtApiLocation,
+ outputApiLocations
)
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CheckApi.kt b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CheckApi.kt
index 004cd68..222b537 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CheckApi.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/checkapi/CheckApi.kt
@@ -32,8 +32,9 @@
}
/**
- * Returns the API file containing the public API that this library promises to support
- * This is API file that checkApiRelease validates against
+ * Returns the API file containing the public API that this library promises to support This is API
+ * file that checkApiRelease validates against
+ *
* @return the API file
*/
fun Project.getRequiredCompatibilityApiFile(): File? {
@@ -53,10 +54,10 @@
}
/**
- * Sometimes the version of an API file might be not equal to the version of its artifact.
- * This is because under certain circumstances, APIs are not allowed to change, and in those
- * cases we may stop versioning the API.
- * This functions returns the version of API file to use given the version of an artifact
+ * Sometimes the version of an API file might be not equal to the version of its artifact. This is
+ * because under certain circumstances, APIs are not allowed to change, and in those cases we may
+ * stop versioning the API. This functions returns the version of API file to use given the version
+ * of an artifact
*/
fun getApiFileVersion(version: Version): Version {
if (!isValidArtifactVersion(version)) {
@@ -74,9 +75,7 @@
return Version(version.major, version.minor, 0, extra)
}
-/**
- * Whether it is allowed for an artifact to have this version
- */
+/** Whether it is allowed for an artifact to have this version */
fun isValidArtifactVersion(version: Version): Boolean {
if (version.patch != 0 && (version.isAlpha() || version.isBeta() || version.isDev())) {
return false
@@ -85,9 +84,9 @@
}
/**
- * Returns the api file that version <version> is required to be compatible with.
- * If apiType is RESOURCEAPI, it will return the resource api file and if it is CLASSAPI, it will
- * return the regular api file.
+ * Returns the api file that version <version> is required to be compatible with. If apiType is
+ * RESOURCEAPI, it will return the resource api file and if it is CLASSAPI, it will return the
+ * regular api file.
*/
fun getRequiredCompatibilityApiFileFromDir(
apiDir: File,
@@ -100,15 +99,17 @@
// Find the path with highest version that is lower than the current API version.
Files.newDirectoryStream(apiDir.toPath()).forEach { path ->
val pathName = path.name
- if ((apiType == ApiType.RESOURCEAPI && isResourceApiFilename(pathName)) ||
- (apiType == ApiType.CLASSAPI && !isResourceApiFilename(pathName))
+ if (
+ (apiType == ApiType.RESOURCEAPI && isResourceApiFilename(pathName)) ||
+ (apiType == ApiType.CLASSAPI && !isResourceApiFilename(pathName))
) {
val pathVersion = Version.parseFilenameOrNull(pathName)
- if (pathVersion != null &&
- (highestVersion == null || pathVersion > highestVersion!!) &&
- pathVersion <= apiVersion &&
- pathVersion.isFinalApi() &&
- pathVersion.major == apiVersion.major
+ if (
+ pathVersion != null &&
+ (highestVersion == null || pathVersion > highestVersion!!) &&
+ pathVersion <= apiVersion &&
+ pathVersion.isFinalApi() &&
+ pathVersion.major == apiVersion.major
) {
highestPath = path
highestVersion = pathVersion
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DackkaTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DackkaTask.kt
index 2210ace..59b5d8f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DackkaTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DackkaTask.kt
@@ -22,6 +22,7 @@
import javax.inject.Inject
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
+import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
@@ -43,17 +44,16 @@
import org.gradle.workers.WorkerExecutor
@CacheableTask
-abstract class DackkaTask @Inject constructor(
- private val workerExecutor: WorkerExecutor,
- private val objects: ObjectFactory
-) : DefaultTask() {
+abstract class DackkaTask
+@Inject
+constructor(private val workerExecutor: WorkerExecutor, private val objects: ObjectFactory) :
+ DefaultTask() {
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
- lateinit var projectStructureMetadataFile: File
+ abstract val projectStructureMetadataFile: RegularFileProperty
// Classpath containing Dackka
- @get:Classpath
- abstract val dackkaClasspath: ConfigurableFileCollection
+ @get:Classpath abstract val dackkaClasspath: ConfigurableFileCollection
// Classpath containing dependencies of libraries needed to resolve types in docs
@get:[InputFiles Classpath]
@@ -65,44 +65,37 @@
// Directory containing the code samples
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
- lateinit var samplesDir: File
+ abstract val samplesDir: DirectoryProperty
// Directory containing the JVM source code for Dackka to process
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
- lateinit var jvmSourcesDir: File
+ abstract val jvmSourcesDir: DirectoryProperty
// Directory containing the multiplatform source code for Dackka to process
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
- lateinit var multiplatformSourcesDir: File
+ abstract val multiplatformSourcesDir: DirectoryProperty
// Directory containing the docs project and package-lists
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
lateinit var docsProjectDir: File
// Location of generated reference docs
- @get:OutputDirectory
- lateinit var destinationDir: File
+ @get:OutputDirectory abstract val destinationDir: DirectoryProperty
// Set of packages to exclude for refdoc generation for all languages
- @Input
- lateinit var excludedPackages: Set<String>
+ @Input lateinit var excludedPackages: Set<String>
// Set of packages to exclude for Java refdoc generation
- @Input
- lateinit var excludedPackagesForJava: Set<String>
+ @Input lateinit var excludedPackagesForJava: Set<String>
// Set of packages to exclude for Kotlin refdoc generation
- @Input
- lateinit var excludedPackagesForKotlin: Set<String>
+ @Input lateinit var excludedPackagesForKotlin: Set<String>
- @Input
- lateinit var annotationsNotToDisplay: List<String>
+ @Input lateinit var annotationsNotToDisplay: List<String>
- @Input
- lateinit var annotationsNotToDisplayJava: List<String>
+ @Input lateinit var annotationsNotToDisplayJava: List<String>
- @Input
- lateinit var annotationsNotToDisplayKotlin: List<String>
+ @Input lateinit var annotationsNotToDisplayKotlin: List<String>
@InputFiles
@PathSensitive(PathSensitivity.NONE)
@@ -114,50 +107,50 @@
// The base URL to create source links for classes, as a format string with placeholders for the
// file path and qualified class name.
- @Input
- lateinit var baseSourceLink: String
+ @Input lateinit var baseSourceLink: String
private fun sourceSets(): List<DokkaInputModels.SourceSet> {
- val externalDocs = externalLinks.map { (name, url) ->
- DokkaInputModels.GlobalDocsLink(
- url = url,
- packageListUrl =
- "file://${docsProjectDir.toPath()}/package-lists/$name/package-list"
- )
- }
- val gson = GsonBuilder().create()
- val multiplatformSourceSets = projectStructureMetadataFile
- .takeIf { it.exists() }
- ?.let { metadataFile ->
- val metadata = gson.fromJson(
- metadataFile.readText(),
- ProjectStructureMetadata::class.java
+ val externalDocs =
+ externalLinks.map { (name, url) ->
+ DokkaInputModels.GlobalDocsLink(
+ url = url,
+ packageListUrl =
+ "file://${docsProjectDir.toPath()}/package-lists/$name/package-list"
)
- metadata.sourceSets.map { sourceSet ->
- val analysisPlatform = DokkaAnalysisPlatform.valueOf(
- sourceSet.analysisPlatform.uppercase()
- )
- val sourceDir = multiplatformSourcesDir.resolve(sourceSet.name)
- DokkaInputModels.SourceSet(
- id = sourceSetIdForSourceSet(sourceSet.name),
- displayName = sourceSet.name,
- analysisPlatform = analysisPlatform.jsonName,
- sourceRoots = objects.fileCollection().from(sourceDir),
- samples = objects.fileCollection(),
- includes = objects.fileCollection().from(includesFiles(sourceDir)),
- classpath = dependenciesClasspath,
- externalDocumentationLinks = externalDocs,
- dependentSourceSets = sourceSet.dependencies.map {
- sourceSetIdForSourceSet(it)
- },
- noJdkLink = !analysisPlatform.androidOrJvm(),
- noAndroidSdkLink = analysisPlatform != DokkaAnalysisPlatform.ANDROID,
- noStdlibLink = false,
- // Dackka source link configuration doesn't use the Dokka version
- sourceLinks = emptyList()
- )
+ }
+ val gson = GsonBuilder().create()
+ val multiplatformSourceSets =
+ projectStructureMetadataFile
+ .get()
+ .asFile
+ .takeIf { it.exists() }
+ ?.let { metadataFile ->
+ val metadata =
+ gson.fromJson(metadataFile.readText(), ProjectStructureMetadata::class.java)
+ metadata.sourceSets.map { sourceSet ->
+ val analysisPlatform =
+ DokkaAnalysisPlatform.valueOf(sourceSet.analysisPlatform.uppercase())
+ val sourceDir = multiplatformSourcesDir.get().asFile.resolve(sourceSet.name)
+ DokkaInputModels.SourceSet(
+ id = sourceSetIdForSourceSet(sourceSet.name),
+ displayName = sourceSet.name,
+ analysisPlatform = analysisPlatform.jsonName,
+ sourceRoots = objects.fileCollection().from(sourceDir),
+ samples = objects.fileCollection(),
+ includes = objects.fileCollection().from(includesFiles(sourceDir)),
+ classpath = dependenciesClasspath,
+ externalDocumentationLinks = externalDocs,
+ dependentSourceSets =
+ sourceSet.dependencies.map { sourceSetIdForSourceSet(it) },
+ noJdkLink = !analysisPlatform.androidOrJvm(),
+ noAndroidSdkLink = analysisPlatform != DokkaAnalysisPlatform.ANDROID,
+ noStdlibLink = false,
+ // Dackka source link configuration doesn't use the Dokka version
+ sourceLinks = emptyList()
+ )
+ }
}
- } ?: emptyList()
+ ?: emptyList()
return listOf(
DokkaInputModels.SourceSet(
id = sourceSetIdForSourceSet("main"),
@@ -165,7 +158,7 @@
analysisPlatform = "jvm",
sourceRoots = objects.fileCollection().from(jvmSourcesDir),
samples = objects.fileCollection().from(samplesDir, frameworkSamplesDir),
- includes = objects.fileCollection().from(includesFiles(jvmSourcesDir)),
+ includes = objects.fileCollection().from(includesFiles(jvmSourcesDir.get().asFile)),
classpath = dependenciesClasspath,
externalDocumentationLinks = externalDocs,
dependentSourceSets = emptyList(),
@@ -185,37 +178,43 @@
private fun computeArguments(): File {
val gson = DokkaUtils.createGson()
val linksConfiguration = ""
- val jsonMap = mapOf(
- "moduleName" to "",
- "outputDir" to destinationDir.path,
- "globalLinks" to linksConfiguration,
- "sourceSets" to sourceSets(),
- "offlineMode" to "true",
- "noJdkLink" to "true",
- "pluginsConfiguration" to listOf(
- mapOf(
- "fqPluginName" to "com.google.devsite.DevsitePlugin",
- "serializationFormat" to "JSON",
- // values is a JSON string
- "values" to gson.toJson(
+ val jsonMap =
+ mapOf(
+ "moduleName" to "",
+ "outputDir" to destinationDir.get().asFile.path,
+ "globalLinks" to linksConfiguration,
+ "sourceSets" to sourceSets(),
+ "offlineMode" to "true",
+ "noJdkLink" to "true",
+ "pluginsConfiguration" to
+ listOf(
mapOf(
- "projectPath" to "androidx",
- "javaDocsPath" to "",
- "kotlinDocsPath" to "kotlin",
- "excludedPackages" to excludedPackages,
- "excludedPackagesForJava" to excludedPackagesForJava,
- "excludedPackagesForKotlin" to excludedPackagesForKotlin,
- "libraryMetadataFilename" to libraryMetadataFile.get().toString(),
- "baseSourceLink" to baseSourceLink,
- "annotationsNotToDisplay" to annotationsNotToDisplay,
- "annotationsNotToDisplayJava" to annotationsNotToDisplayJava,
- "annotationsNotToDisplayKotlin" to annotationsNotToDisplayKotlin,
- "versionMetadataFilenames" to checkVersionMetadataFiles()
+ "fqPluginName" to "com.google.devsite.DevsitePlugin",
+ "serializationFormat" to "JSON",
+ // values is a JSON string
+ "values" to
+ gson.toJson(
+ mapOf(
+ "projectPath" to "androidx",
+ "javaDocsPath" to "",
+ "kotlinDocsPath" to "kotlin",
+ "excludedPackages" to excludedPackages,
+ "excludedPackagesForJava" to excludedPackagesForJava,
+ "excludedPackagesForKotlin" to excludedPackagesForKotlin,
+ "libraryMetadataFilename" to
+ libraryMetadataFile.get().toString(),
+ "baseSourceLink" to baseSourceLink,
+ "annotationsNotToDisplay" to annotationsNotToDisplay,
+ "annotationsNotToDisplayJava" to
+ annotationsNotToDisplayJava,
+ "annotationsNotToDisplayKotlin" to
+ annotationsNotToDisplayKotlin,
+ "versionMetadataFilenames" to checkVersionMetadataFiles()
+ )
+ )
)
)
- )
)
- )
val json = gson.toJson(jsonMap)
val outputFile = File.createTempFile("dackkaArgs", ".json")
@@ -225,9 +224,9 @@
}
/**
- * Return the list of version metadata files after checking if they're all JSON.
- * If version metadata does not exist for a project, it's possible that a configuration which
- * isn't an exact match of the version metadata attributes to be selected as version metadata.
+ * Return the list of version metadata files after checking if they're all JSON. If version
+ * metadata does not exist for a project, it's possible that a configuration which isn't an
+ * exact match of the version metadata attributes to be selected as version metadata.
*/
private fun checkVersionMetadataFiles(): List<File> {
val (json, nonJson) = versionMetadataFiles.get().partition { it.extension == "json" }
@@ -254,30 +253,34 @@
}
companion object {
- private val externalLinks = mapOf(
- "coroutinesCore" to "https://kotlinlang.org/api/kotlinx.coroutines/",
- "android" to "https://developer.android.com/reference",
- "guava" to "https://guava.dev/releases/18.0/api/docs/",
- "kotlin" to "https://kotlinlang.org/api/latest/jvm/stdlib/",
- "junit" to "https://junit.org/junit4/javadoc/4.12/",
- "okio" to "https://square.github.io/okio/3.x/okio/",
- "protobuf" to "https://protobuf.dev/reference/java/api-docs/",
- "kotlinpoet" to "https://square.github.io/kotlinpoet/1.x/kotlinpoet/",
- "skiko" to "https://jetbrains.github.io/skiko/",
- "reactivex" to "https://reactivex.io/RxJava/2.x/javadoc/",
- "reactivex-rxjava3" to "http://reactivex.io/RxJava/3.x/javadoc/",
- "grpc" to "https://grpc.github.io/grpc-java/javadoc/",
- // From developer.android.com/reference/com/google/android/play/core/package-list
- "play" to "https://developer.android.com/reference/",
- // From developer.android.com/reference/com/google/android/material/package-list
- "material" to "https://developer.android.com/reference",
- // All package-lists below were created manually
- "mlkit" to "https://developers.google.com/android/reference/",
- "dagger" to "https://dagger.dev/api/latest/",
- "reactivestreams" to "https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/",
- "jetbrains-annotations" to "https://javadoc.io/doc/org.jetbrains/annotations/latest/",
- "auto-value" to "https://www.javadoc.io/doc/com.google.auto.value/auto-value/latest/",
- )
+ private val externalLinks =
+ mapOf(
+ "coroutinesCore" to "https://kotlinlang.org/api/kotlinx.coroutines/",
+ "android" to "https://developer.android.com/reference",
+ "guava" to "https://guava.dev/releases/18.0/api/docs/",
+ "kotlin" to "https://kotlinlang.org/api/latest/jvm/stdlib/",
+ "junit" to "https://junit.org/junit4/javadoc/4.12/",
+ "okio" to "https://square.github.io/okio/3.x/okio/",
+ "protobuf" to "https://protobuf.dev/reference/java/api-docs/",
+ "kotlinpoet" to "https://square.github.io/kotlinpoet/1.x/kotlinpoet/",
+ "skiko" to "https://jetbrains.github.io/skiko/",
+ "reactivex" to "https://reactivex.io/RxJava/2.x/javadoc/",
+ "reactivex-rxjava3" to "http://reactivex.io/RxJava/3.x/javadoc/",
+ "grpc" to "https://grpc.github.io/grpc-java/javadoc/",
+ // From developer.android.com/reference/com/google/android/play/core/package-list
+ "play" to "https://developer.android.com/reference/",
+ // From developer.android.com/reference/com/google/android/material/package-list
+ "material" to "https://developer.android.com/reference",
+ // All package-lists below were created manually
+ "mlkit" to "https://developers.google.com/android/reference/",
+ "dagger" to "https://dagger.dev/api/latest/",
+ "reactivestreams" to
+ "https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/",
+ "jetbrains-annotations" to
+ "https://javadoc.io/doc/org.jetbrains/annotations/latest/",
+ "auto-value" to
+ "https://www.javadoc.io/doc/com.google.auto.value/auto-value/latest/",
+ )
}
}
@@ -298,9 +301,8 @@
}
}
-abstract class DackkaWorkAction @Inject constructor(
- private val execOperations: ExecOperations
-) : WorkAction<DackkaParams> {
+abstract class DackkaWorkAction @Inject constructor(private val execOperations: ExecOperations) :
+ WorkAction<DackkaParams> {
override fun execute() {
execOperations.javaexec {
it.mainClass.set("org.jetbrains.dokka.MainKt")
@@ -311,9 +313,7 @@
}
private fun includesFiles(sourceRoot: File): List<File> {
- return sourceRoot.walkTopDown().filter {
- it.name.endsWith("documentation.md")
- }.toList()
+ return sourceRoot.walkTopDown().filter { it.name.endsWith("documentation.md") }.toList()
}
private fun sourceSetIdForSourceSet(name: String): DokkaInputModels.SourceSetId {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaInputModels.kt b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaInputModels.kt
index 96ba6eae..22a3626 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaInputModels.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaInputModels.kt
@@ -36,64 +36,32 @@
internal object DokkaInputModels {
class SourceSet(
- @get:Input
- val displayName: String,
- @get:Nested
- @SerializedName("sourceSetID")
- val id: SourceSetId,
- @Classpath
- val classpath: FileCollection,
- @get:InputFiles
- @PathSensitive(PathSensitivity.RELATIVE)
- val sourceRoots: FileCollection,
- @get:InputFiles
- @PathSensitive(PathSensitivity.RELATIVE)
- val samples: FileCollection,
- @get:InputFiles
- @PathSensitive(PathSensitivity.RELATIVE)
- val includes: FileCollection,
- @get:Input
- val analysisPlatform: String,
- @get:Input
- val documentedVisibilities: List<String> = listOf(
- "PUBLIC",
- "PROTECTED"
- ),
- @get:Input
- val noStdlibLink: Boolean,
- @get:Input
- val noJdkLink: Boolean,
- @get:Input
- val noAndroidSdkLink: Boolean,
- @Nested
- val dependentSourceSets: List<SourceSetId>,
- @Nested
- val externalDocumentationLinks: List<GlobalDocsLink>,
- @Nested
- val sourceLinks: List<SrcLink>
+ @get:Input val displayName: String,
+ @get:Nested @SerializedName("sourceSetID") val id: SourceSetId,
+ @Classpath val classpath: FileCollection,
+ @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val sourceRoots: FileCollection,
+ @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val samples: FileCollection,
+ @get:InputFiles @PathSensitive(PathSensitivity.RELATIVE) val includes: FileCollection,
+ @get:Input val analysisPlatform: String,
+ @get:Input val documentedVisibilities: List<String> = listOf("PUBLIC", "PROTECTED"),
+ @get:Input val noStdlibLink: Boolean,
+ @get:Input val noJdkLink: Boolean,
+ @get:Input val noAndroidSdkLink: Boolean,
+ @Nested val dependentSourceSets: List<SourceSetId>,
+ @Nested val externalDocumentationLinks: List<GlobalDocsLink>,
+ @Nested val sourceLinks: List<SrcLink>
)
class SourceSetId(
- @get:Input
- val sourceSetName: String,
- @get:Input
- val scopeId: String,
+ @get:Input val sourceSetName: String,
+ @get:Input val scopeId: String,
)
class SrcLink(
- @get:InputDirectory
- @PathSensitive(PathSensitivity.RELATIVE)
- val localDirectory: File,
- @get:Input
- val remoteUrl: String,
- @get:Input
- val remoteLineSuffix: String = ";l="
+ @get:InputDirectory @PathSensitive(PathSensitivity.RELATIVE) val localDirectory: File,
+ @get:Input val remoteUrl: String,
+ @get:Input val remoteLineSuffix: String = ";l="
)
- class GlobalDocsLink(
- @get:Input
- val url: String,
- @get:Input
- val packageListUrl: String?
- )
-}
\ No newline at end of file
+ class GlobalDocsLink(@get:Input val url: String, @get:Input val packageListUrl: String?)
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaUtils.kt b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaUtils.kt
index cb9b4bb..e54a923 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaUtils.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dackka/DokkaUtils.kt
@@ -29,21 +29,15 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
internal object DokkaUtils {
- /**
- * Creates a GSON instance that can be used to serialize Dokka CLI json models.
- */
- fun createGson(): Gson = GsonBuilder().setPrettyPrinting()
- .registerTypeAdapter(
- File::class.java, CanonicalFileSerializer()
- ).registerTypeAdapter(
- FileCollection::class.java,
- FileCollectionSerializer()
- )
- .create()
+ /** Creates a GSON instance that can be used to serialize Dokka CLI json models. */
+ fun createGson(): Gson =
+ GsonBuilder()
+ .setPrettyPrinting()
+ .registerTypeAdapter(File::class.java, CanonicalFileSerializer())
+ .registerTypeAdapter(FileCollection::class.java, FileCollectionSerializer())
+ .create()
- /**
- * Serializer for Gradle's [FileCollection]
- */
+ /** Serializer for Gradle's [FileCollection] */
private class FileCollectionSerializer : JsonSerializer<FileCollection> {
override fun serialize(
src: FileCollection,
@@ -81,11 +75,12 @@
fun androidOrJvm() = this == JVM || this == ANDROID
}
-fun KotlinTarget.docsPlatform() = when (platformType) {
- KotlinPlatformType.common -> DokkaAnalysisPlatform.COMMON
- KotlinPlatformType.jvm -> DokkaAnalysisPlatform.JVM
- KotlinPlatformType.js -> DokkaAnalysisPlatform.JS
- KotlinPlatformType.wasm -> DokkaAnalysisPlatform.JS
- KotlinPlatformType.androidJvm -> DokkaAnalysisPlatform.ANDROID
- KotlinPlatformType.native -> DokkaAnalysisPlatform.NATIVE
-}
+fun KotlinTarget.docsPlatform() =
+ when (platformType) {
+ KotlinPlatformType.common -> DokkaAnalysisPlatform.COMMON
+ KotlinPlatformType.jvm -> DokkaAnalysisPlatform.JVM
+ KotlinPlatformType.js -> DokkaAnalysisPlatform.JS
+ KotlinPlatformType.wasm -> DokkaAnalysisPlatform.JS
+ KotlinPlatformType.androidJvm -> DokkaAnalysisPlatform.ANDROID
+ KotlinPlatformType.native -> DokkaAnalysisPlatform.NATIVE
+ }
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dackka/GenerateMetadataTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/dackka/GenerateMetadataTask.kt
index 435c07b..13b902c 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dackka/GenerateMetadataTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dackka/GenerateMetadataTask.kt
@@ -38,24 +38,16 @@
@CacheableTask
abstract class GenerateMetadataTask : DefaultTask() {
- /**
- * List of artifacts to convert to JSON
- */
- @Input
- abstract fun getArtifactIds(): ListProperty<ComponentArtifactIdentifier>
+ /** List of artifacts to convert to JSON */
+ @Input abstract fun getArtifactIds(): ListProperty<ComponentArtifactIdentifier>
- /**
- * List of files corresponding to artifacts in [getArtifactIds]
- */
+ /** List of files corresponding to artifacts in [getArtifactIds] */
@InputFiles
@PathSensitive(PathSensitivity.NONE)
abstract fun getArtifactFiles(): ListProperty<File>
- /**
- * Location of the generated JSON file
- */
- @get:OutputFile
- abstract val destinationFile: RegularFileProperty
+ /** Location of the generated JSON file */
+ @get:OutputFile abstract val destinationFile: RegularFileProperty
@TaskAction
fun generate() {
@@ -80,20 +72,22 @@
// Fetch the list of files contained in the .jar file
val fileList = ZipFile(file).entries().toList().map { it.name }
- val entry = MetadataEntry(
- groupId = componentId.group,
- artifactId = componentId.module,
- releaseNotesUrl = generateReleaseNotesUrl(componentId.group),
- jarContents = fileList
- )
+ val entry =
+ MetadataEntry(
+ groupId = componentId.group,
+ artifactId = componentId.module,
+ releaseNotesUrl = generateReleaseNotesUrl(componentId.group),
+ jarContents = fileList
+ )
entries.add(entry)
}
- val gson = if (DEBUG) {
- GsonBuilder().setPrettyPrinting().create()
- } else {
- Gson()
- }
+ val gson =
+ if (DEBUG) {
+ GsonBuilder().setPrettyPrinting().create()
+ } else {
+ Gson()
+ }
val writer = FileWriter(destinationFile.get().toString())
gson.toJson(entries, writer)
writer.close()
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dackka/MetadataEntry.kt b/buildSrc/private/src/main/kotlin/androidx/build/dackka/MetadataEntry.kt
index d450f18..da9d2de 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dackka/MetadataEntry.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dackka/MetadataEntry.kt
@@ -18,19 +18,10 @@
import com.google.gson.annotations.SerializedName
-/**
- * Helper data class to store the metadata information for each library/path.
- */
+/** Helper data class to store the metadata information for each library/path. */
data class MetadataEntry(
- @SerializedName("groupId")
- val groupId: String,
-
- @SerializedName("artifactId")
- val artifactId: String,
-
- @SerializedName("releaseNotesUrl")
- val releaseNotesUrl: String,
-
- @SerializedName("jarContents")
- val jarContents: List<String>,
-)
\ No newline at end of file
+ @SerializedName("groupId") val groupId: String,
+ @SerializedName("artifactId") val artifactId: String,
+ @SerializedName("releaseNotesUrl") val releaseNotesUrl: String,
+ @SerializedName("jarContents") val jarContents: List<String>,
+)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
index 488394f..a5a0384 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/AffectedModuleDetector.kt
@@ -34,27 +34,31 @@
import org.gradle.api.services.BuildServiceSpec
/**
- * The subsets we allow the projects to be partitioned into.
- * This is to allow more granular testing. Specifically, to enable running large tests on
- * CHANGED_PROJECTS, while still only running small and medium tests on DEPENDENT_PROJECTS.
+ * The subsets we allow the projects to be partitioned into. This is to allow more granular testing.
+ * Specifically, to enable running large tests on CHANGED_PROJECTS, while still only running small
+ * and medium tests on DEPENDENT_PROJECTS.
*
- * The ProjectSubset specifies which projects we are interested in testing.
- * The AffectedModuleDetector determines the minimum set of projects that must be built in
- * order to run all the tests along with their runtime dependencies.
+ * The ProjectSubset specifies which projects we are interested in testing. The
+ * AffectedModuleDetector determines the minimum set of projects that must be built in order to run
+ * all the tests along with their runtime dependencies.
*
- * The subsets are:
- * CHANGED_PROJECTS -- The containing projects for any files that were changed in this CL.
+ * The subsets are: CHANGED_PROJECTS -- The containing projects for any files that were changed in
+ * this CL.
*
- * DEPENDENT_PROJECTS -- Any projects that have a dependency on any of the projects
- * in the CHANGED_PROJECTS set.
+ * DEPENDENT_PROJECTS -- Any projects that have a dependency on any of the projects in the
+ * CHANGED_PROJECTS set.
*
- * NONE -- A status to return for a project when it is not supposed to be built.
+ * NONE -- A status to return for a project when it is not supposed to be built.
*/
-enum class ProjectSubset { DEPENDENT_PROJECTS, CHANGED_PROJECTS, NONE }
+enum class ProjectSubset {
+ DEPENDENT_PROJECTS,
+ CHANGED_PROJECTS,
+ NONE
+}
/**
- * Provides the list of file paths (relative to the git root) that have changed (can include
- * removed files).
+ * Provides the list of file paths (relative to the git root) that have changed (can include removed
+ * files).
*
* Returns `null` if changed files cannot be detected.
*/
@@ -70,33 +74,25 @@
*
* Eventually, we'll move to the props passed down by the build system when it is available.
*
- * Since this needs to check project dependency graph to work, it cannot be accessed before
- * all projects are loaded. Doing so will throw an exception.
+ * Since this needs to check project dependency graph to work, it cannot be accessed before all
+ * projects are loaded. Doing so will throw an exception.
*/
-abstract class AffectedModuleDetector(
- protected val logger: Logger?
-) {
- /**
- * Returns whether this project was affected by current changes.
- */
+abstract class AffectedModuleDetector(protected val logger: Logger?) {
+ /** Returns whether this project was affected by current changes. */
abstract fun shouldInclude(project: String): Boolean
- /**
- * Returns whether this task was affected by current changes.
- */
+ /** Returns whether this task was affected by current changes. */
open fun shouldInclude(task: Task): Boolean {
val projectPath = getProjectPathFromTaskPath(task.path)
val include = shouldInclude(projectPath)
val inclusionVerb = if (include) "Including" else "Excluding"
- logger?.info(
- "$inclusionVerb task ${task.path}"
- )
+ logger?.info("$inclusionVerb task ${task.path}")
return include
}
/**
- * Returns the set that the project belongs to. The set is one of the ProjectSubset above.
- * This is used by the test config generator.
+ * Returns the set that the project belongs to. The set is one of the ProjectSubset above. This
+ * is used by the test config generator.
*/
abstract fun getSubset(projectPath: String): ProjectSubset
@@ -122,8 +118,9 @@
val instance = AffectedModuleDetectorWrapper()
rootProject.extensions.add(ROOT_PROP_NAME, instance)
- val enabled = rootProject.hasProperty(ENABLE_ARG) &&
- rootProject.findProperty(ENABLE_ARG) != "false"
+ val enabled =
+ rootProject.hasProperty(ENABLE_ARG) &&
+ rootProject.findProperty(ENABLE_ARG) != "false"
val distDir = rootProject.getDistributionDirectory()
val outputFile = distDir.resolve(LOG_FILE_NAME)
@@ -132,14 +129,15 @@
val logger = FileLogger(outputFile)
logger.info("setup: enabled: $enabled")
if (!enabled) {
- val provider = setupWithParams(
- rootProject,
- { spec ->
- val params = spec.parameters
- params.acceptAll = true
- params.log = logger
- }
- )
+ val provider =
+ setupWithParams(
+ rootProject,
+ { spec ->
+ val params = spec.parameters
+ params.acceptAll = true
+ params.log = logger
+ }
+ )
logger.info("using AcceptAll")
instance.wrapped = provider
return
@@ -154,20 +152,21 @@
logger.lifecycle("projects evaluated")
val projectGraph = ProjectGraph(rootProject)
val dependencyTracker = DependencyTracker(rootProject, logger.toLogger())
- val provider = setupWithParams(
- rootProject,
- { spec ->
- val params = spec.parameters
- params.rootDir = rootProject.projectDir
- params.checkoutRoot = rootProject.getCheckoutRoot()
- params.projectGraph = projectGraph
- params.dependencyTracker = dependencyTracker
- params.log = logger
- params.baseCommitOverride = baseCommitOverride
- params.changeInfoPath = changeInfoPath
- params.manifestPath = manifestPath
- }
- )
+ val provider =
+ setupWithParams(
+ rootProject,
+ { spec ->
+ val params = spec.parameters
+ params.rootDir = rootProject.projectDir
+ params.checkoutRoot = rootProject.getCheckoutRoot()
+ params.projectGraph = projectGraph
+ params.dependencyTracker = dependencyTracker
+ params.log = logger
+ params.baseCommitOverride = baseCommitOverride
+ params.changeInfoPath = changeInfoPath
+ params.manifestPath = manifestPath
+ }
+ )
logger.info("using real detector")
instance.wrapped = provider
}
@@ -180,12 +179,11 @@
if (!rootProject.isRoot) {
throw IllegalArgumentException("this should've been the root project")
}
- return rootProject.gradle.sharedServices
- .registerIfAbsent(
- SERVICE_NAME,
- AffectedModuleDetectorLoader::class.java,
- configureAction
- )
+ return rootProject.gradle.sharedServices.registerIfAbsent(
+ SERVICE_NAME,
+ AffectedModuleDetectorLoader::class.java,
+ configureAction
+ )
}
fun getInstance(project: Project): AffectedModuleDetector {
@@ -196,24 +194,22 @@
}
/**
- * Call this method to configure the given task to execute only if the owner project
- * is affected by current changes
+ * Call this method to configure the given task to execute only if the owner project is
+ * affected by current changes
*/
@Throws(GradleException::class)
@JvmStatic
fun configureTaskGuard(task: Task) {
val detector = getInstance(task.project)
- task.onlyIf {
- detector.shouldInclude(task)
- }
+ task.onlyIf { detector.shouldInclude(task) }
}
}
}
/**
- * Wrapper for AffectedModuleDetector
- * Callers can access this wrapper during project configuration and save it until task execution
- * time when the wrapped detector is ready for use (after the project graph is ready)
+ * Wrapper for AffectedModuleDetector Callers can access this wrapper during project configuration
+ * and save it until task execution time when the wrapped detector is ready for use (after the
+ * project graph is ready)
*/
class AffectedModuleDetectorWrapper : AffectedModuleDetector(logger = null) {
// We save a provider to a build service that knows how to make an
@@ -230,28 +226,33 @@
var wrapped: Provider<AffectedModuleDetectorLoader>? = null
fun getOrThrow(): AffectedModuleDetector {
- return wrapped?.get()?.detector ?: throw GradleException(
- """
+ return wrapped?.get()?.detector
+ ?: throw GradleException(
+ """
Tried to get the affected module detector implementation too early.
You cannot access it until all projects are evaluated.
- """.trimIndent()
- )
+ """
+ .trimIndent()
+ )
}
+
override fun getSubset(projectPath: String): ProjectSubset {
return getOrThrow().getSubset(projectPath)
}
+
override fun shouldInclude(project: String): Boolean {
return getOrThrow().shouldInclude(project)
}
+
override fun shouldInclude(task: Task): Boolean {
return getOrThrow().shouldInclude(task)
}
}
/**
- * Stores the parameters of an AffectedModuleDetector and creates one when needed.
- * The parameters here may be deserialized and loaded from Gradle's configuration cache when the
- * configuration cache is enabled.
+ * Stores the parameters of an AffectedModuleDetector and creates one when needed. The parameters
+ * here may be deserialized and loaded from Gradle's configuration cache when the configuration
+ * cache is enabled.
*/
abstract class AffectedModuleDetectorLoader :
BuildService<AffectedModuleDetectorLoader.Parameters> {
@@ -280,13 +281,14 @@
if (baseCommitOverride != null) {
logger.info("using base commit override $baseCommitOverride")
}
- val gitClient = GitClient.create(
- projectDir = parameters.rootDir,
- checkoutRoot = parameters.checkoutRoot,
- logger = logger.toLogger(),
- changeInfoPath = parameters.changeInfoPath.get(),
- manifestPath = parameters.manifestPath.get()
- )
+ val gitClient =
+ GitClient.create(
+ projectDir = parameters.rootDir,
+ checkoutRoot = parameters.checkoutRoot,
+ logger = logger.toLogger(),
+ changeInfoPath = parameters.changeInfoPath.get(),
+ manifestPath = parameters.manifestPath.get()
+ )
val changedFilesProvider: ChangedFilesProvider = {
val baseSha = baseCommitOverride ?: gitClient.findPreviousSubmittedChange()
check(baseSha != null) {
@@ -302,9 +304,9 @@
dependencyTracker = parameters.dependencyTracker,
logger = logger.toLogger(),
cobuiltTestPaths = parameters.cobuiltTestPaths
- ?: AffectedModuleDetectorImpl.COBUILT_TEST_PATHS,
+ ?: AffectedModuleDetectorImpl.COBUILT_TEST_PATHS,
alwaysBuildIfExists = parameters.alwaysBuildIfExists
- ?: AffectedModuleDetectorImpl.ALWAYS_BUILD_IF_EXISTS,
+ ?: AffectedModuleDetectorImpl.ALWAYS_BUILD_IF_EXISTS,
ignoredPaths = parameters.ignoredPaths ?: AffectedModuleDetectorImpl.IGNORED_PATHS,
changedFilesProvider = changedFilesProvider
)
@@ -312,12 +314,8 @@
}
}
-/**
- * Implementation that accepts everything without checking.
- */
-private class AcceptAll(
- logger: Logger? = null
-) : AffectedModuleDetector(logger) {
+/** Implementation that accepts everything without checking. */
+private class AcceptAll(logger: Logger? = null) : AffectedModuleDetector(logger) {
override fun shouldInclude(project: String): Boolean {
logger?.info("[AcceptAll] acceptAll.shouldInclude returning true")
return true
@@ -336,55 +334,39 @@
*
* When a file in a module is changed, all modules that depend on it are considered as changed.
*/
-class AffectedModuleDetectorImpl constructor(
+class AffectedModuleDetectorImpl
+constructor(
private val projectGraph: ProjectGraph,
private val dependencyTracker: DependencyTracker,
logger: Logger?,
// used for debugging purposes when we want to ignore non module files
- @Suppress("unused")
- private val ignoreUnknownProjects: Boolean = false,
+ @Suppress("unused") private val ignoreUnknownProjects: Boolean = false,
private val cobuiltTestPaths: Set<Set<String>> = COBUILT_TEST_PATHS,
private val alwaysBuildIfExists: Set<String> = ALWAYS_BUILD_IF_EXISTS,
private val ignoredPaths: Set<String> = IGNORED_PATHS,
private val changedFilesProvider: ChangedFilesProvider
) : AffectedModuleDetector(logger) {
- private val allProjects by lazy {
- projectGraph.allProjects
- }
+ private val allProjects by lazy { projectGraph.allProjects }
- val affectedProjects by lazy {
- changedProjects + dependentProjects
- }
+ val affectedProjects by lazy { changedProjects + dependentProjects }
- val changedProjects by lazy {
- findChangedProjects()
- }
+ val changedProjects by lazy { findChangedProjects() }
- val dependentProjects by lazy {
- findDependentProjects()
- }
+ val dependentProjects by lazy { findDependentProjects() }
- val alwaysBuild by lazy {
- alwaysBuildIfExists.filter({ path -> allProjects.contains(path) })
- }
+ val alwaysBuild by lazy { alwaysBuildIfExists.filter({ path -> allProjects.contains(path) }) }
private var unknownFiles: MutableSet<String> = mutableSetOf()
// Files tracked by git that are not expected to effect the build, thus require no consideration
private var ignoredFiles: MutableSet<String> = mutableSetOf()
- val buildAll by lazy {
- shouldBuildAll()
- }
+ val buildAll by lazy { shouldBuildAll() }
- private val cobuiltTestProjects by lazy {
- lookupProjectSetsFromPaths(cobuiltTestPaths)
- }
+ private val cobuiltTestProjects by lazy { lookupProjectSetsFromPaths(cobuiltTestPaths) }
- private val buildContainsNonProjectFileChanges by lazy {
- unknownFiles.isNotEmpty()
- }
+ private val buildContainsNonProjectFileChanges by lazy { unknownFiles.isNotEmpty() }
override fun shouldInclude(project: String): Boolean {
return if (project == ":" || buildAll) {
@@ -425,9 +407,7 @@
for (filePath in changedFiles) {
if (ignoredPaths.any { filePath.startsWith(it) }) {
ignoredFiles.add(filePath)
- logger?.info(
- "Ignoring file: $filePath"
- )
+ logger?.info("Ignoring file: $filePath")
} else {
val containingProject = findContainingProject(filePath)
if (containingProject == null) {
@@ -446,9 +426,7 @@
}
}
- return changedProjects + getAffectedCobuiltProjects(
- changedProjects, cobuiltTestProjects
- )
+ return changedProjects + getAffectedCobuiltProjects(changedProjects, cobuiltTestProjects)
}
/**
@@ -456,24 +434,25 @@
* original changedProjects. Always build is still here to ensure at least 1 thing is built
*/
private fun findDependentProjects(): Set<String> {
- val dependentProjects = changedProjects.flatMap {
- dependencyTracker.findAllDependents(it)
- }.toSet()
- return dependentProjects + alwaysBuild +
+ val dependentProjects =
+ changedProjects.flatMap { dependencyTracker.findAllDependents(it) }.toSet()
+ return dependentProjects +
+ alwaysBuild +
getAffectedCobuiltProjects(dependentProjects, cobuiltTestProjects)
}
/**
- * Determines whether we are in a state where we want to build all projects, instead of
- * only affected ones. This occurs for buildSrc changes, as well as in situations where
- * we determine there are no changes within our repository (e.g. prebuilts change only)
+ * Determines whether we are in a state where we want to build all projects, instead of only
+ * affected ones. This occurs for buildSrc changes, as well as in situations where we determine
+ * there are no changes within our repository (e.g. prebuilts change only)
*/
private fun shouldBuildAll(): Boolean {
var shouldBuildAll = false
// Should only trigger if there are no changedFiles and no ignored files
- if (changedProjects.size == alwaysBuild.size &&
- unknownFiles.isEmpty() &&
- ignoredFiles.isEmpty()
+ if (
+ changedProjects.size == alwaysBuild.size &&
+ unknownFiles.isEmpty() &&
+ ignoredFiles.isEmpty()
) {
shouldBuildAll = true
} else if (unknownFiles.isNotEmpty() && !isGithubInfraChange()) {
@@ -494,7 +473,8 @@
"""
The modules detected as affected by changed files are
${changedProjects + dependentProjects}
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
@@ -507,30 +487,31 @@
* changed file tracking (e.g. not cause running all tests)
*/
private fun isGithubInfraChange(): Boolean {
- return unknownFiles.all {
- it.contains(".github") || it.contains("playground-common")
- }
+ return unknownFiles.all { it.contains(".github") || it.contains("playground-common") }
}
private fun lookupProjectSetsFromPaths(allSets: Set<Set<String>>): Set<Set<String>> {
- return allSets.map { setPaths ->
- var setExists = false
- val projectSet = HashSet<String>()
- for (path in setPaths) {
- if (!allProjects.contains(path)) {
- if (setExists) {
- throw IllegalStateException(
- "One of the projects in the group of projects that are required to " +
- "be built together is missing. Looked for " + setPaths
- )
+ return allSets
+ .map { setPaths ->
+ var setExists = false
+ val projectSet = HashSet<String>()
+ for (path in setPaths) {
+ if (!allProjects.contains(path)) {
+ if (setExists) {
+ throw IllegalStateException(
+ "One of the projects in the group of projects that are required " +
+ "to be built together is missing. Looked for " +
+ setPaths
+ )
+ }
+ } else {
+ setExists = true
+ projectSet.add(path)
}
- } else {
- setExists = true
- projectSet.add(path)
}
+ return@map projectSet
}
- return@map projectSet
- }.toSet()
+ .toSet()
}
private fun getAffectedCobuiltProjects(
@@ -556,108 +537,111 @@
companion object {
// Project paths that we always build if they exist
- val ALWAYS_BUILD_IF_EXISTS = setOf(
- // placeholder test project to ensure no failure due to no instrumentation.
- // We can eventually remove if we resolve b/127819369
- ":placeholder-tests",
- )
+ val ALWAYS_BUILD_IF_EXISTS =
+ setOf(
+ // placeholder test project to ensure no failure due to no instrumentation.
+ // We can eventually remove if we resolve b/127819369
+ ":placeholder-tests",
+ )
// Some tests are codependent even if their modules are not. Enable manual bundling of tests
- val COBUILT_TEST_PATHS = setOf(
- // Install media tests together per b/128577735
+ val COBUILT_TEST_PATHS =
setOf(
- // Making a change in :media:version-compat-tests makes
- // mediaGenerateTestConfiguration run (an unfortunate but low priority bug). To
- // prevent failures from missing apks, we make sure to build the
- // version-compat-tests projects in that case. Same with media2-session below.
- ":media:version-compat-tests",
- ":media:version-compat-tests:client",
- ":media:version-compat-tests:service",
- ":media:version-compat-tests:client-previous",
- ":media:version-compat-tests:service-previous"
- ),
- setOf(
- ":media2:media2-session",
- ":media2:media2-session:version-compat-tests",
- ":media2:media2-session:version-compat-tests:client",
- ":media2:media2-session:version-compat-tests:service",
- ":media2:media2-session:version-compat-tests:client-previous",
- ":media2:media2-session:version-compat-tests:service-previous"
- ), // Link graphics and material to always run @Large in presubmit per b/160624022
- setOf(
- ":compose:ui:ui-graphics",
- ":compose:material:material"
- ), // Link material and material-ripple
- setOf(
- ":compose:material:material-ripple",
- ":compose:material:material"
- ),
- setOf(
- ":benchmark:benchmark-macro",
- ":benchmark:integration-tests:macrobenchmark-target"
- ), // link benchmark-macro's correctness test and its target
- setOf(
- ":benchmark:integration-tests",
- ":benchmark:integration-tests:macrobenchmark",
- ":benchmark:integration-tests:macrobenchmark-target"
- ), // link benchmark's macrobenchmark and its target
- setOf(
- ":compose:integration-tests",
- ":compose:integration-tests:macrobenchmark",
- ":compose:integration-tests:macrobenchmark-target"
- ),
- setOf(
- ":emoji2:integration-tests",
- ":emoji2:integration-tests:init-disabled-macrobenchmark",
- ":emoji2:integration-tests:init-disabled-macrobenchmark-target",
- ),
- setOf(
- ":emoji2:integration-tests",
- ":emoji2:integration-tests:init-enabled-macrobenchmark",
- ":emoji2:integration-tests:init-enabled-macrobenchmark-target",
- ),
- setOf(
- ":wear:benchmark:integration-tests",
- ":wear:benchmark:integration-tests:macrobenchmark",
- ":wear:benchmark:integration-tests:macrobenchmark-target"
- ),
- setOf(
- ":wear:compose:integration-tests",
- ":wear:compose:integration-tests:macrobenchmark",
- ":wear:compose:integration-tests:macrobenchmark-target"
- ),
- // Changing generator code changes the output for generated icons, which are tested in
- // material-icons-extended.
- setOf(
- ":compose:material:material:icons:generator",
- ":compose:material:material-icons-extended"
- ),
- // Link glance-appwidget macrobenchmark and its target.
- setOf(
- ":glance:glance-appwidget:integration-tests",
- ":glance:glance-appwidget:integration-tests:macrobenchmark",
- ":glance:glance-appwidget:integration-tests:macrobenchmark-target"
- ),
- setOf(
- ":constraintlayout:constraintlayout-compose:integration-tests",
- ":constraintlayout:constraintlayout-compose:integration-tests:macrobenchmark",
- ":constraintlayout:constraintlayout-compose:integration-tests:macrobenchmark-target"
- ),
- setOf(
- ":profileinstaller:integration-tests:profile-verification",
- ":profileinstaller:integration-tests:profile-verification-sample",
- ":profileinstaller:integration-tests:profile-verification-sample-no-initializer",
- ":benchmark:integration-tests:baselineprofile-consumer",
+ // Install media tests together per b/128577735
+ setOf(
+ // Making a change in :media:version-compat-tests makes
+ // mediaGenerateTestConfiguration run (an unfortunate but low priority bug). To
+ // prevent failures from missing apks, we make sure to build the
+ // version-compat-tests projects in that case. Same with media2-session below.
+ ":media:version-compat-tests",
+ ":media:version-compat-tests:client",
+ ":media:version-compat-tests:service",
+ ":media:version-compat-tests:client-previous",
+ ":media:version-compat-tests:service-previous"
+ ),
+ setOf(
+ ":media2:media2-session",
+ ":media2:media2-session:version-compat-tests",
+ ":media2:media2-session:version-compat-tests:client",
+ ":media2:media2-session:version-compat-tests:service",
+ ":media2:media2-session:version-compat-tests:client-previous",
+ ":media2:media2-session:version-compat-tests:service-previous"
+ ), // Link graphics and material to always run @Large in presubmit per b/160624022
+ setOf(
+ ":compose:ui:ui-graphics",
+ ":compose:material:material"
+ ), // Link material and material-ripple
+ setOf(":compose:material:material-ripple", ":compose:material:material"),
+ setOf(
+ ":benchmark:benchmark-macro",
+ ":benchmark:integration-tests:macrobenchmark-target"
+ ), // link benchmark-macro's correctness test and its target
+ setOf(
+ ":benchmark:integration-tests",
+ ":benchmark:integration-tests:macrobenchmark",
+ ":benchmark:integration-tests:macrobenchmark-target"
+ ), // link benchmark's macrobenchmark and its target
+ setOf(
+ ":compose:integration-tests",
+ ":compose:integration-tests:macrobenchmark",
+ ":compose:integration-tests:macrobenchmark-target"
+ ),
+ setOf(
+ ":emoji2:integration-tests",
+ ":emoji2:integration-tests:init-disabled-macrobenchmark",
+ ":emoji2:integration-tests:init-disabled-macrobenchmark-target",
+ ),
+ setOf(
+ ":emoji2:integration-tests",
+ ":emoji2:integration-tests:init-enabled-macrobenchmark",
+ ":emoji2:integration-tests:init-enabled-macrobenchmark-target",
+ ),
+ setOf(
+ ":wear:benchmark:integration-tests",
+ ":wear:benchmark:integration-tests:macrobenchmark",
+ ":wear:benchmark:integration-tests:macrobenchmark-target"
+ ),
+ setOf(
+ ":wear:compose:integration-tests",
+ ":wear:compose:integration-tests:macrobenchmark",
+ ":wear:compose:integration-tests:macrobenchmark-target"
+ ),
+ // Changing generator code changes the output for generated icons, which are tested
+ // in
+ // material-icons-extended.
+ setOf(
+ ":compose:material:material:icons:generator",
+ ":compose:material:material-icons-extended"
+ ),
+ // Link glance-appwidget macrobenchmark and its target.
+ setOf(
+ ":glance:glance-appwidget:integration-tests",
+ ":glance:glance-appwidget:integration-tests:macrobenchmark",
+ ":glance:glance-appwidget:integration-tests:macrobenchmark-target"
+ ),
+ setOf(
+ ":constraintlayout:constraintlayout-compose:integration-tests",
+ ":constraintlayout:constraintlayout-compose:integration-tests:macrobenchmark",
+ ":constraintlayout:constraintlayout-compose:integration-tests:" +
+ "macrobenchmark-target"
+ ),
+ setOf(
+ ":profileinstaller:integration-tests:profile-verification",
+ ":profileinstaller:integration-tests:profile-verification-sample",
+ ":profileinstaller:integration-tests:" +
+ "profile-verification-sample-no-initializer",
+ ":benchmark:integration-tests:baselineprofile-consumer",
+ )
)
- )
- val IGNORED_PATHS = setOf(
- "docs/",
- "development/",
- "playground-common/",
- ".github/",
- // since we only used AMD for device tests, versions do not affect test outcomes.
- "libraryversions.toml",
- )
+ val IGNORED_PATHS =
+ setOf(
+ "docs/",
+ "development/",
+ "playground-common/",
+ ".github/",
+ // since we only used AMD for device tests, versions do not affect test outcomes.
+ "libraryversions.toml",
+ )
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/BuildPropParser.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/BuildPropParser.kt
index f851099..b8c2148 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/BuildPropParser.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/BuildPropParser.kt
@@ -29,14 +29,12 @@
* Returns the sha which is the reference sha that we should use to find changed files.
*
* It returns null if an appropriate sha couldn't be found. (e.g. if more than 1 project changed
- * or frameworks/support didn't change)
+ * or frameworks/support didn't change)
*
- * @param appliedPropsFile The applied.props file that is usually located in the out folder.
- * It contains information about the build specific SHAs for this build for each
- * module
- *
- * @param repoPropsFile The repo.props file that is usually located in the out folder.
- * It contains the origin versions for each repository
+ * @param appliedPropsFile The applied.props file that is usually located in the out folder. It
+ * contains information about the build specific SHAs for this build for each module
+ * @param repoPropsFile The repo.props file that is usually located in the out folder. It
+ * contains the origin versions for each repository
*/
fun getShaForThisBuild(
appliedPropsFile: File,
@@ -44,9 +42,7 @@
logger: Logger? = null
): BuildRange? {
if (!appliedPropsFile.canRead()) {
- logger?.error(
- "cannot read applied props file from ${appliedPropsFile.absolutePath}"
- )
+ logger?.error("cannot read applied props file from ${appliedPropsFile.absolutePath}")
return null
}
if (!repoPropsFile.canRead()) {
@@ -59,7 +55,8 @@
"""
We'll run everything because seems like too many things changed or nothing is
changed. Changed projects: $appliedProps
- """.trimIndent()
+ """
+ .trimIndent()
)
return null
}
@@ -69,29 +66,25 @@
"""
Changed project is not frameworks/support. I'll run everything.
Changed project: $changedProject
- """.trimIndent()
+ """
+ .trimIndent()
)
return null
}
val changeSha = changedProject.split(" ").last()
// now find it in repo props
- val androidXLineInRepo = repoPropsFile.readLines(Charsets.UTF_8).firstOrNull {
- it.indexOf("frameworks/support") >= 0
- }
+ val androidXLineInRepo =
+ repoPropsFile.readLines(Charsets.UTF_8).firstOrNull {
+ it.indexOf("frameworks/support") >= 0
+ }
if (androidXLineInRepo == null) {
logger?.info("Cannot find the androidX sha in repo props. $repoPropsFile")
return null
}
val repoSha = androidXLineInRepo.split(" ").last()
logger?.info("repo sha: $repoSha change sha: $changeSha")
- return BuildRange(
- buildSha = changeSha,
- repoSha = repoSha
- )
+ return BuildRange(buildSha = changeSha, repoSha = repoSha)
}
- data class BuildRange(
- val repoSha: String,
- val buildSha: String
- )
+ data class BuildRange(val repoSha: String, val buildSha: String)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/DependencyTracker.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/DependencyTracker.kt
index 3dae669e..c983dc9 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/DependencyTracker.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/DependencyTracker.kt
@@ -22,14 +22,10 @@
import org.gradle.api.logging.Logger
/**
- * Utility class that traverses all project dependencies and discover which modules depend
- * on each other. This is mainly used by [AffectedModuleDetector] to find out which projects
- * should be run.
+ * Utility class that traverses all project dependencies and discover which modules depend on each
+ * other. This is mainly used by [AffectedModuleDetector] to find out which projects should be run.
*/
-class DependencyTracker(
- rootProject: Project,
- logger: Logger?
-) : Serializable {
+class DependencyTracker(rootProject: Project, logger: Logger?) : Serializable {
val dependentList: Map<String, Set<String>>
init {
@@ -37,17 +33,14 @@
val stringBuilder = StringBuilder()
rootProject.subprojects.forEach { project ->
project.configurations.forEach { config ->
- config
- .dependencies
- .filterIsInstance(ProjectDependency::class.java)
- .forEach {
- stringBuilder.append(
- "there is a dependency from ${project.path} (${config.name}) to " +
- it.dependencyProject.path + "\n"
- )
- result.getOrPut(it.dependencyProject.path) { mutableSetOf() }
- .add(project.path)
- }
+ config.dependencies.filterIsInstance(ProjectDependency::class.java).forEach {
+ stringBuilder.append(
+ "there is a dependency from ${project.path} (${config.name}) to " +
+ it.dependencyProject.path +
+ "\n"
+ )
+ result.getOrPut(it.dependencyProject.path) { mutableSetOf() }.add(project.path)
+ }
}
}
logger?.info(stringBuilder.toString())
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/FileLogger.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/FileLogger.kt
index 6bd3a1c..d33330f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/FileLogger.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/FileLogger.kt
@@ -23,33 +23,22 @@
import org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext
import org.gradle.internal.time.Clock
-/**
- * Gradle logger that logs to a file
- */
-class FileLogger(
- val file: File
-) : Serializable {
- @Transient
- var impl: OutputEventListenerBackedLogger? = null
+/** Gradle logger that logs to a file */
+class FileLogger(val file: File) : Serializable {
+ @Transient var impl: OutputEventListenerBackedLogger? = null
fun toLogger(): OutputEventListenerBackedLogger {
if (impl == null) {
- impl = OutputEventListenerBackedLogger(
- "my_logger",
- OutputEventListenerBackedLoggerContext(
- Clock {
- System.currentTimeMillis()
- }
- ).also {
- it.level = LogLevel.DEBUG
- it.setOutputEventListener {
- file.appendText(it.toString() + "\n")
- }
- },
- Clock {
- System.currentTimeMillis()
- }
- )
+ impl =
+ OutputEventListenerBackedLogger(
+ "my_logger",
+ OutputEventListenerBackedLoggerContext(Clock { System.currentTimeMillis() })
+ .also {
+ it.level = LogLevel.DEBUG
+ it.setOutputEventListener { file.appendText(it.toString() + "\n") }
+ },
+ Clock { System.currentTimeMillis() }
+ )
}
return impl!!
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ProjectGraph.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ProjectGraph.kt
index 8472eeb..469d717 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ProjectGraph.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ProjectGraph.kt
@@ -22,9 +22,7 @@
import org.gradle.api.Project
import org.gradle.api.logging.Logger
-/**
- * Creates a project graph for fast lookup by file path
- */
+/** Creates a project graph for fast lookup by file path */
class ProjectGraph(project: Project, logger: Logger? = null) : Serializable {
private val rootNode: Node
@@ -33,28 +31,27 @@
logger?.info("initializing ProjectGraph")
rootNode = Node()
val rootProjectDir = project.getSupportRootFolder().canonicalFile
- val projects = if (rootProjectDir == project.rootDir.canonicalFile) {
- project.subprojects
- } else {
- // include root project if it is not the main AndroidX project.
- project.subprojects + project
- }
+ val projects =
+ if (rootProjectDir == project.rootDir.canonicalFile) {
+ project.subprojects
+ } else {
+ // include root project if it is not the main AndroidX project.
+ project.subprojects + project
+ }
projects.forEach {
logger?.info("creating node for ${it.path}")
val relativePath = it.projectDir.canonicalFile.toRelativeString(rootProjectDir)
val sections = relativePath.split(File.separatorChar)
logger?.info("relative path: $relativePath , sections: $sections")
- val leaf = sections.fold(rootNode) { left, right ->
- left.getOrCreateNode(right)
- }
+ val leaf = sections.fold(rootNode) { left, right -> left.getOrCreateNode(right) }
leaf.projectPath = it.path
}
logger?.info("finished creating ProjectGraph")
}
/**
- * Finds the project that contains the given file.
- * The file's path prefix should match the project's path.
+ * Finds the project that contains the given file. The file's path prefix should match the
+ * project's path.
*/
fun findContainingProject(filePath: String, logger: Logger? = null): String? {
val sections = filePath.split(File.separatorChar)
@@ -91,9 +88,7 @@
}
fun addAllProjectPaths(collection: MutableSet<String>) {
- projectPath?.let { path ->
- collection.add(path)
- }
+ projectPath?.let { path -> collection.add(path) }
for (child in children.values) {
child.addAllProjectPaths(collection)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ToStringLogger.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ToStringLogger.kt
index b1546c2..2e957d8 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ToStringLogger.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyTracker/ToStringLogger.kt
@@ -21,29 +21,16 @@
import org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext
import org.gradle.internal.time.Clock
-/**
- * Gradle logger that logs to a string.
- */
-class ToStringLogger(
- private val stringBuilder: StringBuilder = StringBuilder()
-) : OutputEventListenerBackedLogger(
- "my_logger",
- OutputEventListenerBackedLoggerContext(
- Clock {
- System.currentTimeMillis()
- }
- ).also {
- it.level = LogLevel.DEBUG
- it.setOutputEventListener {
- stringBuilder.append(it.toString() + "\n")
- }
- },
- Clock {
- System.currentTimeMillis()
- }
-) {
- /**
- * Returns the current log.
- */
+/** Gradle logger that logs to a string. */
+class ToStringLogger(private val stringBuilder: StringBuilder = StringBuilder()) :
+ OutputEventListenerBackedLogger(
+ "my_logger",
+ OutputEventListenerBackedLoggerContext(Clock { System.currentTimeMillis() }).also {
+ it.level = LogLevel.DEBUG
+ it.setOutputEventListener { stringBuilder.append(it.toString() + "\n") }
+ },
+ Clock { System.currentTimeMillis() }
+ ) {
+ /** Returns the current log. */
fun buildString() = stringBuilder.toString()
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/dependencyallowlist/DependencyAllowlist.kt b/buildSrc/private/src/main/kotlin/androidx/build/dependencyallowlist/DependencyAllowlist.kt
index 06fb204..7580ca9 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/dependencyallowlist/DependencyAllowlist.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/dependencyallowlist/DependencyAllowlist.kt
@@ -21,16 +21,16 @@
import org.w3c.dom.NodeList
/**
- * @param verificationMetadataXml A string containing the entire content of a file that would
- * live at
- * [gradle/verification-metadata.xml](https://docs.gradle.org/current/userguide/dependency_verification.html#sub:enabling-verification)
- *
- * @return a list of strings that are English descriptions of problems with the dependencies
- * (At this point, merely checksum dependency components that do not link to bugs that track
- * asking them to be signed)
+ * @param verificationMetadataXml A string containing the entire content of a file that would live
+ * at
+ * [gradle/verification-metadata.xml](https://docs.gradle.org/current/userguide/dependency_verification.html#sub:enabling-verification)
+ * @return a list of strings that are English descriptions of problems with the dependencies (At
+ * this point, merely checksum dependency components that do not link to bugs that track asking
+ * them to be signed)
*/
fun allowlistWarnings(verificationMetadataXml: String): List<String> {
- return verificationMetadataComponents(verificationMetadataXml).filter { !it.hasValidReason() }
+ return verificationMetadataComponents(verificationMetadataXml)
+ .filter { !it.hasValidReason() }
.map {
val componentName = it.attributes.getNamedItem("group").textContent
"Add androidx:reason for unsigned component '$componentName'" +
@@ -40,16 +40,18 @@
/**
* @param verificationMetadataXml see [allowlistWarnings]
- *
- * @return a list of [Node]s representing all of the components needing
- * validation in the file.
+ * @return a list of [Node]s representing all of the components needing validation in the file.
*/
private fun verificationMetadataComponents(verificationMetadataXml: String): List<Node> {
// Throw exception if there is not a single <components> element in the file.
val singleComponentsNode =
- DocumentBuilderFactory.newInstance().apply { isNamespaceAware = true }.newDocumentBuilder()
- .parse(verificationMetadataXml.byteInputStream()).getElementsByTagName("components")
- .toList().single()
+ DocumentBuilderFactory.newInstance()
+ .apply { isNamespaceAware = true }
+ .newDocumentBuilder()
+ .parse(verificationMetadataXml.byteInputStream())
+ .getElementsByTagName("components")
+ .toList()
+ .single()
val componentsChildNodes = singleComponentsNode.childNodes.toList()
return componentsChildNodes.filter {
@@ -64,7 +66,6 @@
return reason?.textContent?.containsBug() == true
}
-private fun String.containsBug() =
- contains("b/") || contains("github.com") && contains("issues")
+private fun String.containsBug() = contains("b/") || contains("github.com") && contains("issues")
-private fun NodeList.toList() = (0 until length).map { item(it) }
\ No newline at end of file
+private fun NodeList.toList() = (0 until length).map { item(it) }
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/docs/AndroidXDocsImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/docs/AndroidXDocsImplPlugin.kt
index a63311f..5b46f6a 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/docs/AndroidXDocsImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/docs/AndroidXDocsImplPlugin.kt
@@ -20,7 +20,6 @@
import androidx.build.dackka.DackkaTask
import androidx.build.dackka.GenerateMetadataTask
import androidx.build.defaultAndroidConfig
-import androidx.build.dependencies.KOTLIN_VERSION
import androidx.build.getAndroidJar
import androidx.build.getBuildId
import androidx.build.getCheckoutRoot
@@ -29,6 +28,7 @@
import androidx.build.getLibraryByName
import androidx.build.metalava.versionMetadataUsage
import androidx.build.multiplatformUsage
+import androidx.build.versionCatalog
import com.android.build.api.attributes.BuildTypeAttr
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
@@ -52,10 +52,13 @@
import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.file.ArchiveOperations
+import org.gradle.api.file.Directory
+import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFile
+import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.provider.Property
@@ -90,8 +93,7 @@
lateinit var versionMetadataConfiguration: Configuration
lateinit var dependencyClasspath: FileCollection
- @get:Inject
- abstract val archiveOperations: ArchiveOperations
+ @get:Inject abstract val archiveOperations: ArchiveOperations
override fun apply(project: Project) {
docsType = project.name.removePrefix("docs-")
@@ -99,8 +101,7 @@
when (plugin) {
is LibraryPlugin -> {
val libraryExtension = project.extensions.getByType<LibraryExtension>()
- libraryExtension.compileSdkVersion =
- project.defaultAndroidConfig.compileSdk
+ libraryExtension.compileSdkVersion = project.defaultAndroidConfig.compileSdk
libraryExtension.buildToolsVersion =
project.defaultAndroidConfig.buildToolsVersion
@@ -116,34 +117,35 @@
}
disableUnneededTasks(project)
createConfigurations(project)
- val buildOnServer = project.tasks.register<DocsBuildOnServer>("buildOnServer") {
- buildId = getBuildId()
- docsType = this@AndroidXDocsImplPlugin.docsType
- distributionDirectory = project.getDistributionDirectory()
- }
+ val buildOnServer =
+ project.tasks.register<DocsBuildOnServer>("buildOnServer") {
+ buildId = getBuildId()
+ docsType = this@AndroidXDocsImplPlugin.docsType
+ distributionDirectory = project.getDistributionDirectory()
+ }
- val unzippedSamplesSources = File(project.buildDir, "unzippedSampleSources")
- val unzipSamplesTask = configureUnzipTask(
- project,
- "unzipSampleSources",
- unzippedSamplesSources,
- samplesSourcesConfiguration
- )
+ val unzippedSamplesSources = project.layout.buildDirectory.dir("unzippedSampleSources")
+ val unzipSamplesTask =
+ configureUnzipTask(
+ project,
+ "unzipSampleSources",
+ unzippedSamplesSources,
+ samplesSourcesConfiguration
+ )
- val unzippedJvmSourcesDirectory = File(project.buildDir, "unzippedJvmSources")
- val unzippedMultiplatformSourcesDirectory = File(
- project.buildDir,
- "unzippedMultiplatformSources"
- )
- val mergedProjectMetadata = File(
- project.buildDir,
- "project_metadata/$PROJECT_STRUCTURE_METADATA_FILENAME"
- )
- val unzipJvmSourcesTask = configureUnzipJvmSourcesTasks(
- project,
- unzippedJvmSourcesDirectory,
- docsSourcesConfiguration
- )
+ val unzippedJvmSourcesDirectory = project.layout.buildDirectory.dir("unzippedJvmSources")
+ val unzippedMultiplatformSourcesDirectory =
+ project.layout.buildDirectory.dir("unzippedMultiplatformSources")
+ val mergedProjectMetadata =
+ project.layout.buildDirectory.file(
+ "project_metadata/$PROJECT_STRUCTURE_METADATA_FILENAME"
+ )
+ val unzipJvmSourcesTask =
+ configureUnzipJvmSourcesTasks(
+ project,
+ unzippedJvmSourcesDirectory,
+ docsSourcesConfiguration
+ )
val configureMultiplatformSourcesTask =
configureMultiplatformInputsTasks(
project,
@@ -174,14 +176,11 @@
private fun configureUnzipTask(
project: Project,
taskName: String,
- destinationDirectory: File,
+ destinationDirectory: Provider<Directory>,
docsConfiguration: Configuration
): TaskProvider<Sync> {
- return project.tasks.register(
- taskName,
- Sync::class.java
- ) { task ->
- val sources = docsConfiguration.incoming.artifactView { }.files
+ return project.tasks.register(taskName, Sync::class.java) { task ->
+ val sources = docsConfiguration.incoming.artifactView {}.files
// Store archiveOperations into a local variable to prevent access to the plugin
// during the task execution, as that breaks configuration caching.
val localVar = archiveOperations
@@ -204,9 +203,7 @@
// TODO(123020809) remove this filter once it is no longer necessary to prevent Dokka
// from failing
val regex = Regex("@attr ref ([^*]*)styleable#([^_*]*)_([^*]*)$")
- task.filter { line ->
- regex.replace(line, "{@link $1attr#$3}")
- }
+ task.filter { line -> regex.replace(line, "{@link $1attr#$3}") }
}
}
@@ -218,11 +215,11 @@
*/
private fun configureUnzipJvmSourcesTasks(
project: Project,
- destinationDirectory: File,
+ destinationDirectory: Provider<Directory>,
docsConfiguration: Configuration
): TaskProvider<Sync> {
return project.tasks.register("unzipJvmSources", Sync::class.java) { task ->
- val sources = docsConfiguration.incoming.artifactView { }.files
+ val sources = docsConfiguration.incoming.artifactView {}.files
// Store archiveOperations into a local variable to prevent access to the plugin
// during the task execution, as that breaks configuration caching.
@@ -231,9 +228,7 @@
task.from(
sources.elements.map { jars ->
jars.map { jar ->
- localVar.zipTree(jar).matching {
- it.exclude("**/META-INF/MANIFEST.MF")
- }
+ localVar.zipTree(jar).matching { it.exclude("**/META-INF/MANIFEST.MF") }
}
}
)
@@ -244,41 +239,42 @@
}
/**
- * Creates multiple tasks to unzip multiplatform sources and merge their metadata to be used
- * as input for Dackka. Returns a single umbrella task which depends on the others.
+ * Creates multiple tasks to unzip multiplatform sources and merge their metadata to be used as
+ * input for Dackka. Returns a single umbrella task which depends on the others.
*/
private fun configureMultiplatformInputsTasks(
project: Project,
- unzippedMultiplatformSourcesDirectory: File,
+ unzippedMultiplatformSourcesDirectory: Provider<Directory>,
multiplatformDocsSourcesConfiguration: Configuration,
- mergedProjectMetadata: File
+ mergedProjectMetadata: Provider<RegularFile>
): TaskProvider<MergeMultiplatformMetadataTask> {
- val tempMultiplatformMetadataDirectory = File(
- project.buildDir,
- "tmp/multiplatformMetadataFiles"
- )
+ val tempMultiplatformMetadataDirectory =
+ project.layout.buildDirectory.dir("tmp/multiplatformMetadataFiles")
// unzip the sources into source folder and metadata files into folders per project
- val unzipMultiplatformSources = project.tasks.register(
- "unzipMultiplatformSources",
- UnzipMultiplatformSourcesTask::class.java
- ) {
- it.inputJars.set(multiplatformDocsSourcesConfiguration.incoming.artifactView { }.files)
- it.metadataOutput = tempMultiplatformMetadataDirectory
- it.sourceOutput = unzippedMultiplatformSourcesDirectory
- }
+ val unzipMultiplatformSources =
+ project.tasks.register(
+ "unzipMultiplatformSources",
+ UnzipMultiplatformSourcesTask::class.java
+ ) {
+ it.inputJars.set(
+ multiplatformDocsSourcesConfiguration.incoming.artifactView {}.files
+ )
+ it.metadataOutput.set(tempMultiplatformMetadataDirectory)
+ it.sourceOutput.set(unzippedMultiplatformSourcesDirectory)
+ }
// merge all the metadata files from the individual project dirs
return project.tasks.register(
"mergeMultiplatformMetadata",
MergeMultiplatformMetadataTask::class.java
) {
it.dependsOn(unzipMultiplatformSources)
- it.mergedProjectMetadata = mergedProjectMetadata
- it.inputDirectory = tempMultiplatformMetadataDirectory
+ it.mergedProjectMetadata.set(mergedProjectMetadata)
+ it.inputDirectory.set(tempMultiplatformMetadataDirectory)
}
}
/**
- * The following configurations are created to build a list of projects that need to be
+ * The following configurations are created to build a list of projects that need to be
* documented and should be used from build.gradle of docs projects for the following:
* - docs(project(":foo:foo") or docs("androidx.foo:foo:1.0.0") for docs sources
* - samples(project(":foo:foo-samples") or samples("androidx.foo:foo-samples:1.0.0") for
@@ -287,26 +283,31 @@
*/
private fun createConfigurations(project: Project) {
project.dependencies.components.all<SourcesVariantRule>()
- val docsConfiguration = project.configurations.create("docs") {
- it.isCanBeResolved = false
- it.isCanBeConsumed = false
- }
- val apiSinceDocsConfiguration = project.configurations.create("apiSinceDocs") {
- it.isCanBeResolved = false
- it.isCanBeConsumed = false
- }
- val multiplatformDocsConfiguration = project.configurations.create("kmpDocs") {
- it.isCanBeResolved = false
- it.isCanBeConsumed = false
- }
- val samplesConfiguration = project.configurations.create("samples") {
- it.isCanBeResolved = false
- it.isCanBeConsumed = false
- }
- val stubsConfiguration = project.configurations.create("stubs") {
- it.isCanBeResolved = false
- it.isCanBeConsumed = false
- }
+ val docsConfiguration =
+ project.configurations.create("docs") {
+ it.isCanBeResolved = false
+ it.isCanBeConsumed = false
+ }
+ val apiSinceDocsConfiguration =
+ project.configurations.create("apiSinceDocs") {
+ it.isCanBeResolved = false
+ it.isCanBeConsumed = false
+ }
+ val multiplatformDocsConfiguration =
+ project.configurations.create("kmpDocs") {
+ it.isCanBeResolved = false
+ it.isCanBeConsumed = false
+ }
+ val samplesConfiguration =
+ project.configurations.create("samples") {
+ it.isCanBeResolved = false
+ it.isCanBeConsumed = false
+ }
+ val stubsConfiguration =
+ project.configurations.create("stubs") {
+ it.isCanBeResolved = false
+ it.isCanBeConsumed = false
+ }
fun Configuration.setResolveSources() {
isTransitive = false
@@ -330,67 +331,60 @@
)
}
}
- docsSourcesConfiguration = project.configurations.create("docs-sources") {
- it.setResolveSources()
- it.extendsFrom(docsConfiguration, apiSinceDocsConfiguration)
- }
- multiplatformDocsSourcesConfiguration = project.configurations.create(
- "multiplatform-docs-sources"
- ) { configuration ->
- configuration.isTransitive = false
- configuration.isCanBeConsumed = false
- configuration.attributes {
- it.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.multiplatformUsage
- )
- it.attribute(
+ docsSourcesConfiguration =
+ project.configurations.create("docs-sources") {
+ it.setResolveSources()
+ it.extendsFrom(docsConfiguration, apiSinceDocsConfiguration)
+ }
+ multiplatformDocsSourcesConfiguration =
+ project.configurations.create("multiplatform-docs-sources") { configuration ->
+ configuration.isTransitive = false
+ configuration.isCanBeConsumed = false
+ configuration.attributes {
+ it.attribute(Usage.USAGE_ATTRIBUTE, project.multiplatformUsage)
+ it.attribute(
+ Category.CATEGORY_ATTRIBUTE,
+ project.objects.named<Category>(Category.DOCUMENTATION)
+ )
+ it.attribute(
+ DocsType.DOCS_TYPE_ATTRIBUTE,
+ project.objects.named<DocsType>(DocsType.SOURCES)
+ )
+ it.attribute(
+ LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
+ project.objects.named<LibraryElements>(LibraryElements.JAR)
+ )
+ }
+ configuration.extendsFrom(multiplatformDocsConfiguration)
+ }
+ samplesSourcesConfiguration =
+ project.configurations.create("samples-sources") {
+ it.setResolveSources()
+ it.extendsFrom(samplesConfiguration)
+ }
+
+ versionMetadataConfiguration =
+ project.configurations.create("library-version-metadata") {
+ it.isTransitive = false
+ it.isCanBeConsumed = false
+
+ it.attributes.attribute(Usage.USAGE_ATTRIBUTE, project.versionMetadataUsage)
+ it.attributes.attribute(
Category.CATEGORY_ATTRIBUTE,
project.objects.named<Category>(Category.DOCUMENTATION)
)
- it.attribute(
- DocsType.DOCS_TYPE_ATTRIBUTE,
- project.objects.named<DocsType>(DocsType.SOURCES)
+ it.attributes.attribute(
+ Bundling.BUNDLING_ATTRIBUTE,
+ project.objects.named<Bundling>(Bundling.EXTERNAL)
)
- it.attribute(
- LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
- project.objects.named<LibraryElements>(LibraryElements.JAR)
- )
+
+ it.extendsFrom(apiSinceDocsConfiguration)
}
- configuration.extendsFrom(multiplatformDocsConfiguration)
- }
- samplesSourcesConfiguration = project.configurations.create("samples-sources") {
- it.setResolveSources()
- it.extendsFrom(samplesConfiguration)
- }
-
- versionMetadataConfiguration = project.configurations.create("library-version-metadata") {
- it.isTransitive = false
- it.isCanBeConsumed = false
-
- it.attributes.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.versionMetadataUsage
- )
- it.attributes.attribute(
- Category.CATEGORY_ATTRIBUTE,
- project.objects.named<Category>(Category.DOCUMENTATION)
- )
- it.attributes.attribute(
- Bundling.BUNDLING_ATTRIBUTE,
- project.objects.named<Bundling>(Bundling.EXTERNAL)
- )
-
- it.extendsFrom(apiSinceDocsConfiguration)
- }
fun Configuration.setResolveClasspathForUsage(usage: String) {
isCanBeConsumed = false
attributes {
- it.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.objects.named<Usage>(usage)
- )
+ it.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named<Usage>(usage))
it.attribute(
Category.CATEGORY_ATTRIBUTE,
project.objects.named<Category>(Category.LIBRARY)
@@ -401,164 +395,175 @@
)
}
extendsFrom(
- docsConfiguration, samplesConfiguration, stubsConfiguration,
+ docsConfiguration,
+ samplesConfiguration,
+ stubsConfiguration,
apiSinceDocsConfiguration
)
}
// Build a compile & runtime classpaths for needed for documenting the libraries
// from the configurations above.
- val docsCompileClasspath = project.configurations.create("docs-compile-classpath") {
- it.setResolveClasspathForUsage(Usage.JAVA_API)
- }
- val docsRuntimeClasspath = project.configurations.create("docs-runtime-classpath") {
- it.setResolveClasspathForUsage(Usage.JAVA_RUNTIME)
- }
+ val docsCompileClasspath =
+ project.configurations.create("docs-compile-classpath") {
+ it.setResolveClasspathForUsage(Usage.JAVA_API)
+ }
+ val docsRuntimeClasspath =
+ project.configurations.create("docs-runtime-classpath") {
+ it.setResolveClasspathForUsage(Usage.JAVA_RUNTIME)
+ }
+ val kotlinDefaultCatalogVersion = androidx.build.KotlinTarget.DEFAULT.catalogVersion
+ val kotlinLatest = project.versionCatalog.findVersion(kotlinDefaultCatalogVersion).get()
listOf(docsCompileClasspath, docsRuntimeClasspath).forEach { config ->
config.resolutionStrategy {
it.eachDependency { details ->
if (details.requested.group == "org.jetbrains.kotlin") {
- details.useVersion(KOTLIN_VERSION)
+ details.useVersion(kotlinLatest.requiredVersion)
}
}
}
}
- dependencyClasspath = docsCompileClasspath.incoming.artifactView {
- it.attributes.attribute(
- Attribute.of("artifactType", String::class.java),
- "android-classes"
- )
- }.files + docsRuntimeClasspath.incoming.artifactView {
- it.attributes.attribute(
- Attribute.of("artifactType", String::class.java),
- "android-classes"
- )
- }.files
+ dependencyClasspath =
+ docsCompileClasspath.incoming
+ .artifactView {
+ it.attributes.attribute(
+ Attribute.of("artifactType", String::class.java),
+ "android-classes"
+ )
+ }
+ .files +
+ docsRuntimeClasspath.incoming
+ .artifactView {
+ it.attributes.attribute(
+ Attribute.of("artifactType", String::class.java),
+ "android-classes"
+ )
+ }
+ .files
}
private fun configureDackka(
project: Project,
- unzippedJvmSourcesDirectory: File,
- unzippedMultiplatformSourcesDirectory: File,
+ unzippedJvmSourcesDirectory: Provider<Directory>,
+ unzippedMultiplatformSourcesDirectory: Provider<Directory>,
unzipJvmSourcesTask: TaskProvider<Sync>,
configureMultiplatformSourcesTask: TaskProvider<MergeMultiplatformMetadataTask>,
- unzippedSamplesSources: File,
+ unzippedSamplesSources: Provider<Directory>,
unzipSamplesTask: TaskProvider<Sync>,
dependencyClasspath: FileCollection,
buildOnServer: TaskProvider<*>,
docsConfiguration: Configuration,
- mergedProjectMetadata: File
+ mergedProjectMetadata: Provider<RegularFile>
) {
- val generatedDocsDir = project.file("${project.buildDir}/docs")
+ val generatedDocsDir = project.layout.buildDirectory.dir("docs")
- val dackkaConfiguration = project.configurations.create("dackka").apply {
- dependencies.add(project.dependencies.create(project.getLibraryByName("dackka")))
- }
+ val dackkaConfiguration =
+ project.configurations.create("dackka").apply {
+ dependencies.add(project.dependencies.create(project.getLibraryByName("dackka")))
+ }
- val generateMetadataTask = project.tasks.register(
- "generateMetadata",
- GenerateMetadataTask::class.java
- ) { task ->
+ val generateMetadataTask =
+ project.tasks.register("generateMetadata", GenerateMetadataTask::class.java) { task ->
+ val artifacts = docsConfiguration.incoming.artifacts.resolvedArtifacts
+ task.getArtifactIds().set(artifacts.map { result -> result.map { it.id } })
+ task.getArtifactFiles().set(artifacts.map { result -> result.map { it.file } })
+ task.destinationFile.set(getMetadataRegularFile(project))
+ }
- val artifacts = docsConfiguration.incoming.artifacts.resolvedArtifacts
- task.getArtifactIds().set(
- artifacts.map { result -> result.map { it.id } }
- )
- task.getArtifactFiles().set(
- artifacts.map { result -> result.map { it.file } }
- )
- task.destinationFile.set(getMetadataRegularFile(project))
- }
-
- val metricsDirectory = project.buildDir
- val metricsFile = File(metricsDirectory, "build-metrics.json")
+ val metricsFile = project.layout.buildDirectory.file("build-metrics.json")
val projectName = project.name
- val dackkaTask = project.tasks.register("docs", DackkaTask::class.java) { task ->
- var taskStartTime: LocalDateTime? = null
- task.apply {
- dependsOn(unzipJvmSourcesTask)
- dependsOn(unzipSamplesTask)
- dependsOn(generateMetadataTask)
- dependsOn(configureMultiplatformSourcesTask)
+ val dackkaTask =
+ project.tasks.register("docs", DackkaTask::class.java) { task ->
+ var taskStartTime: LocalDateTime? = null
+ task.apply {
+ dependsOn(unzipJvmSourcesTask)
+ dependsOn(unzipSamplesTask)
+ dependsOn(generateMetadataTask)
+ dependsOn(configureMultiplatformSourcesTask)
- description = "Generates reference documentation using a Google devsite Dokka" +
- " plugin. Places docs in $generatedDocsDir"
- group = JavaBasePlugin.DOCUMENTATION_GROUP
+ description =
+ "Generates reference documentation using a Google devsite Dokka" +
+ " plugin. Places docs in $generatedDocsDir"
+ group = JavaBasePlugin.DOCUMENTATION_GROUP
- dackkaClasspath.from(project.files(dackkaConfiguration))
- destinationDir = generatedDocsDir
- frameworkSamplesDir = File(project.rootDir, "samples")
- samplesDir = unzippedSamplesSources
- jvmSourcesDir = unzippedJvmSourcesDirectory
- multiplatformSourcesDir = unzippedMultiplatformSourcesDirectory
- docsProjectDir = File(project.rootDir, "docs-public")
- dependenciesClasspath = dependencyClasspath +
- project.getAndroidJar() +
- project.getExtraCommonDependencies()
- excludedPackages = hiddenPackages.toSet()
- excludedPackagesForJava = hiddenPackagesJava
- excludedPackagesForKotlin = emptySet()
- libraryMetadataFile.set(getMetadataRegularFile(project))
- projectStructureMetadataFile = mergedProjectMetadata
- // See go/dackka-source-link for details on this link.
- baseSourceLink = "https://cs.android.com/search?" +
- "q=file:%s+class:%s"
- annotationsNotToDisplay = hiddenAnnotations
- annotationsNotToDisplayJava = hiddenAnnotationsJava
- annotationsNotToDisplayKotlin = hiddenAnnotationsKotlin
- versionMetadataFiles = versionMetadataConfiguration.incoming.artifacts
- .resolvedArtifacts.map { it.map { it.file } }
- task.doFirst {
- taskStartTime = LocalDateTime.now()
- }
- task.doLast {
- val taskEndTime = LocalDateTime.now()
- val duration = Duration.between(taskStartTime, taskEndTime).toMillis()
- metricsDirectory.mkdirs()
- metricsFile.writeText(
- "{ \"${projectName}_docs_execution_duration\": $duration }"
- )
+ dackkaClasspath.from(project.files(dackkaConfiguration))
+ destinationDir.set(generatedDocsDir)
+ frameworkSamplesDir = File(project.rootDir, "samples")
+ samplesDir.set(unzippedSamplesSources)
+ jvmSourcesDir.set(unzippedJvmSourcesDirectory)
+ multiplatformSourcesDir.set(unzippedMultiplatformSourcesDirectory)
+ docsProjectDir = File(project.rootDir, "docs-public")
+ dependenciesClasspath =
+ dependencyClasspath +
+ project.getAndroidJar() +
+ project.getExtraCommonDependencies()
+ excludedPackages = hiddenPackages.toSet()
+ excludedPackagesForJava = hiddenPackagesJava
+ excludedPackagesForKotlin = emptySet()
+ libraryMetadataFile.set(getMetadataRegularFile(project))
+ projectStructureMetadataFile.set(mergedProjectMetadata)
+ // See go/dackka-source-link for details on this link.
+ baseSourceLink = "https://cs.android.com/search?" + "q=file:%s+class:%s"
+ annotationsNotToDisplay = hiddenAnnotations
+ annotationsNotToDisplayJava = hiddenAnnotationsJava
+ annotationsNotToDisplayKotlin = hiddenAnnotationsKotlin
+ versionMetadataFiles =
+ versionMetadataConfiguration.incoming.artifacts.resolvedArtifacts.map {
+ it.map { it.file }
+ }
+ task.doFirst { taskStartTime = LocalDateTime.now() }
+ task.doLast {
+ val taskEndTime = LocalDateTime.now()
+ val duration = Duration.between(taskStartTime, taskEndTime).toMillis()
+ metricsFile
+ .get()
+ .asFile
+ .writeText("{ \"${projectName}_docs_execution_duration\": $duration }")
+ }
}
}
- }
- val zipTask = project.tasks.register("zipDocs", Zip::class.java) { task ->
- task.apply {
- dependsOn(dackkaTask)
- from(generatedDocsDir)
+ val zipTask =
+ project.tasks.register("zipDocs", Zip::class.java) { task ->
+ task.apply {
+ dependsOn(dackkaTask)
+ from(generatedDocsDir)
- val baseName = "docs-$docsType"
- val buildId = getBuildId()
- archiveBaseName.set(baseName)
- archiveVersion.set(buildId)
- destinationDirectory.set(project.getDistributionDirectory())
- group = JavaBasePlugin.DOCUMENTATION_GROUP
+ val baseName = "docs-$docsType"
+ val buildId = getBuildId()
+ archiveBaseName.set(baseName)
+ archiveVersion.set(buildId)
+ destinationDirectory.set(project.getDistributionDirectory())
+ group = JavaBasePlugin.DOCUMENTATION_GROUP
- val filePath = "${project.getDistributionDirectory().canonicalPath}/"
- val fileName = "$baseName-$buildId.zip"
- val destinationFile = filePath + fileName
- description = "Zips Java and Kotlin documentation (generated via Dackka in the" +
- " style of d.android.com) into $destinationFile"
+ val filePath = "${project.getDistributionDirectory().canonicalPath}/"
+ val fileName = "$baseName-$buildId.zip"
+ val destinationFile = filePath + fileName
+ description =
+ "Zips Java and Kotlin documentation (generated via Dackka in the" +
+ " style of d.android.com) into $destinationFile"
+ }
}
- }
buildOnServer.configure { it.dependsOn(zipTask) }
}
/**
- * Replace all tests etc with empty task, so we don't run anything
- * it is more effective then task.enabled = false, because we avoid executing deps as well
+ * Replace all tests etc with empty task, so we don't run anything it is more effective then
+ * task.enabled = false, because we avoid executing deps as well
*/
private fun disableUnneededTasks(project: Project) {
var reentrance = false
project.tasks.whenTaskAdded { task ->
- if (task is Test || task.name.startsWith("assemble") ||
- task.name == "lint" ||
- task.name == "lintDebug" ||
- task.name == "lintAnalyzeDebug" ||
- task.name == "transformDexArchiveWithExternalLibsDexMergerForPublicDebug" ||
- task.name == "transformResourcesWithMergeJavaResForPublicDebug" ||
- task.name == "checkPublicDebugDuplicateClasses"
+ if (
+ task is Test ||
+ task.name.startsWith("assemble") ||
+ task.name == "lint" ||
+ task.name == "lintDebug" ||
+ task.name == "lintAnalyzeDebug" ||
+ task.name == "transformDexArchiveWithExternalLibsDexMergerForPublicDebug" ||
+ task.name == "transformResourcesWithMergeJavaResForPublicDebug" ||
+ task.name == "checkPublicDebugDuplicateClasses"
) {
if (!reentrance) {
reentrance = true
@@ -575,12 +580,9 @@
@DisableCachingByDefault(because = "Doesn't benefit from caching")
open class DocsBuildOnServer : DefaultTask() {
- @Internal
- lateinit var docsType: String
- @Internal
- lateinit var buildId: String
- @Internal
- lateinit var distributionDirectory: File
+ @Internal lateinit var docsType: String
+ @Internal lateinit var buildId: String
+ @Internal lateinit var distributionDirectory: File
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getRequiredFiles(): List<File> {
@@ -606,13 +608,13 @@
}
/**
- * Adapter rule to handles prebuilt dependencies that do not use Gradle Metadata (only pom).
- * We create a new variant sources that we can later use in the same way we do for tip of tree
- * projects and prebuilts with Gradle Metadata.
+ * Adapter rule to handles prebuilt dependencies that do not use Gradle Metadata (only pom). We
+ * create a new variant sources that we can later use in the same way we do for tip of tree projects
+ * and prebuilts with Gradle Metadata.
*/
abstract class SourcesVariantRule : ComponentMetadataRule {
- @get:Inject
- abstract val objects: ObjectFactory
+ @get:Inject abstract val objects: ObjectFactory
+
override fun execute(context: ComponentMetadataContext) {
context.details.maybeAddVariant("sources", "runtime") {
it.attributes {
@@ -635,60 +637,60 @@
project.layout.buildDirectory.file("AndroidXLibraryMetadata.json")
// List of packages to exclude from both Java and Kotlin refdoc generation
-private val hiddenPackages = listOf(
- "androidx.camera.camera2.impl",
- "androidx.camera.camera2.internal.*",
- "androidx.camera.core.impl.*",
- "androidx.camera.core.internal.*",
- "androidx.core.internal",
- "androidx.preference.internal",
- "androidx.wear.internal.widget.drawer",
- "androidx.webkit.internal",
- "androidx.work.impl.*"
-)
+private val hiddenPackages =
+ listOf(
+ "androidx.camera.camera2.impl",
+ "androidx.camera.camera2.internal.*",
+ "androidx.camera.core.impl.*",
+ "androidx.camera.core.internal.*",
+ "androidx.core.internal",
+ "androidx.preference.internal",
+ "androidx.wear.internal.widget.drawer",
+ "androidx.webkit.internal",
+ "androidx.work.impl.*"
+ )
// Set of packages to exclude from Java refdoc generation
-private val hiddenPackagesJava = setOf(
- "androidx.*compose.*",
- "androidx.*glance.*",
-)
+private val hiddenPackagesJava =
+ setOf(
+ "androidx.*compose.*",
+ "androidx.*glance.*",
+ )
// List of annotations which should not be displayed in the docs
-private val hiddenAnnotations: List<String> = listOf(
- // This information is compose runtime implementation details; not useful for most, those who
- // would want it should look at source
- "androidx.compose.runtime.Stable",
- "androidx.compose.runtime.Immutable",
- "androidx.compose.runtime.ReadOnlyComposable",
- // This opt-in requirement is non-propagating so developers don't need to know about it
- // https://kotlinlang.org/docs/opt-in-requirements.html#non-propagating-opt-in
- "androidx.annotation.OptIn",
- "kotlin.OptIn",
- // This annotation is used mostly in paging, and was removed at the request of the paging team
- "androidx.annotation.CheckResult",
- // This annotation is generated upstream. Dokka uses it for signature serialization. It doesn't
- // seem useful for developers
- "kotlin.ParameterName",
- // This annotations is not useful for developers but right now is @ShowAnnotation?
- "kotlin.js.JsName",
- // This annotation is intended to target the compiler and is general not useful for devs.
- "java.lang.Override"
-)
+private val hiddenAnnotations: List<String> =
+ listOf(
+ // This information is compose runtime implementation details; not useful for most, those
+ // who
+ // would want it should look at source
+ "androidx.compose.runtime.Stable",
+ "androidx.compose.runtime.Immutable",
+ "androidx.compose.runtime.ReadOnlyComposable",
+ // This opt-in requirement is non-propagating so developers don't need to know about it
+ // https://kotlinlang.org/docs/opt-in-requirements.html#non-propagating-opt-in
+ "androidx.annotation.OptIn",
+ "kotlin.OptIn",
+ // This annotation is used mostly in paging, and was removed at the request of the paging
+ // team
+ "androidx.annotation.CheckResult",
+ // This annotation is generated upstream. Dokka uses it for signature serialization. It
+ // doesn't
+ // seem useful for developers
+ "kotlin.ParameterName",
+ // This annotations is not useful for developers but right now is @ShowAnnotation?
+ "kotlin.js.JsName",
+ // This annotation is intended to target the compiler and is general not useful for devs.
+ "java.lang.Override"
+ )
// Annotations which should not be displayed in the Kotlin docs, in addition to hiddenAnnotations
-private val hiddenAnnotationsKotlin: List<String> = listOf(
- "kotlin.ExtensionFunctionType"
-)
+private val hiddenAnnotationsKotlin: List<String> = listOf("kotlin.ExtensionFunctionType")
// Annotations which should not be displayed in the Java docs, in addition to hiddenAnnotations
private val hiddenAnnotationsJava: List<String> = emptyList()
-/**
- * Data class that matches JSON structure of kotlin source set metadata
- */
-data class ProjectStructureMetadata(
- var sourceSets: List<SourceSetMetadata>
-)
+/** Data class that matches JSON structure of kotlin source set metadata */
+data class ProjectStructureMetadata(var sourceSets: List<SourceSetMetadata>)
data class SourceSetMetadata(
val name: String,
@@ -699,19 +701,14 @@
@CacheableTask
abstract class UnzipMultiplatformSourcesTask() : DefaultTask() {
- @get:Classpath
- abstract val inputJars: Property<FileCollection>
+ @get:Classpath abstract val inputJars: Property<FileCollection>
- @OutputDirectory
- lateinit var metadataOutput: File
+ @get:OutputDirectory abstract val metadataOutput: DirectoryProperty
- @OutputDirectory
- lateinit var sourceOutput: File
+ @get:OutputDirectory abstract val sourceOutput: DirectoryProperty
- @get:Inject
- abstract val fileSystemOperations: FileSystemOperations
- @get:Inject
- abstract val archiveOperations: ArchiveOperations
+ @get:Inject abstract val fileSystemOperations: FileSystemOperations
+ @get:Inject abstract val archiveOperations: ArchiveOperations
@TaskAction
fun execute() {
@@ -725,39 +722,39 @@
sources.forEach { (name, fileTree) ->
fileSystemOperations.sync {
it.from(fileTree)
- it.into(metadataOutput.resolve(name))
+ it.into(metadataOutput.file(name))
it.include("META-INF/*")
}
}
}
}
-/**
- * Merges multiplatform metadata files created by [CreateMultiplatformMetadata]
- */
+/** Merges multiplatform metadata files created by [CreateMultiplatformMetadata] */
@CacheableTask
-abstract class MergeMultiplatformMetadataTask() : DefaultTask() {
+abstract class MergeMultiplatformMetadataTask : DefaultTask() {
- @get:InputFiles @get:PathSensitive(PathSensitivity.RELATIVE)
- lateinit var inputDirectory: File
- @OutputFile
- lateinit var mergedProjectMetadata: File
+ @get:InputFiles
+ @get:PathSensitive(PathSensitivity.RELATIVE)
+ abstract val inputDirectory: DirectoryProperty
+ @get:OutputFile abstract val mergedProjectMetadata: RegularFileProperty
+
@TaskAction
fun execute() {
val mergedMetadata = ProjectStructureMetadata(sourceSets = listOf())
- inputDirectory.walkTopDown().filter { file ->
- file.name == PROJECT_STRUCTURE_METADATA_FILENAME
- }.forEach { metaFile ->
- val gson = GsonBuilder().create()
- val metadata = gson.fromJson(
- metaFile.readText(),
- ProjectStructureMetadata::class.java
- )
- mergedMetadata.merge(metadata)
- }
+ inputDirectory
+ .get()
+ .asFile
+ .walkTopDown()
+ .filter { file -> file.name == PROJECT_STRUCTURE_METADATA_FILENAME }
+ .forEach { metaFile ->
+ val gson = GsonBuilder().create()
+ val metadata =
+ gson.fromJson(metaFile.readText(), ProjectStructureMetadata::class.java)
+ mergedMetadata.merge(metadata)
+ }
val gson = GsonBuilder().setPrettyPrinting().create()
val json = gson.toJson(mergedMetadata)
- mergedProjectMetadata.apply {
+ mergedProjectMetadata.get().asFile.apply {
parentFile.mkdirs()
createNewFile()
writeText(json)
@@ -784,24 +781,24 @@
private val PLATFORMS =
listOf("linuxx64", "macosarm64", "macosx64", "iosx64", "iossimulatorarm64", "iosarm64")
-private fun Project.getExtraCommonDependencies(): FileCollection = files(
- arrayOf(
- File(
- getPrebuiltsExternalPath(),
- "org/jetbrains/kotlinx/kotlinx-coroutines-core/1.6.4/kotlinx-coroutines-core-1.6.4.jar"
- ),
- File(
- getPrebuiltsExternalPath(),
- "org/jetbrains/kotlinx/atomicfu/0.17.0/atomicfu-0.17.0.jar"
- ),
- File(
- getPrebuiltsExternalPath(),
- "com/squareup/okio/okio-jvm/3.1.0/okio-jvm-3.1.0.jar"
- )
- ) + PLATFORMS.map {
- File(
- getPrebuiltsExternalPath(),
- "com/squareup/okio/okio-$it/3.1.0/okio-$it-3.1.0.klib"
- )
- }
-)
+private fun Project.getExtraCommonDependencies(): FileCollection =
+ files(
+ arrayOf(
+ File(
+ getPrebuiltsExternalPath(),
+ "org/jetbrains/kotlinx/kotlinx-coroutines-core/1.6.4/" +
+ "kotlinx-coroutines-core-1.6.4.jar"
+ ),
+ File(
+ getPrebuiltsExternalPath(),
+ "org/jetbrains/kotlinx/atomicfu/0.17.0/atomicfu-0.17.0.jar"
+ ),
+ File(getPrebuiltsExternalPath(), "com/squareup/okio/okio-jvm/3.1.0/okio-jvm-3.1.0.jar")
+ ) +
+ PLATFORMS.map {
+ File(
+ getPrebuiltsExternalPath(),
+ "com/squareup/okio/okio-$it/3.1.0/okio-$it-3.1.0.klib"
+ )
+ }
+ )
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/ChangeInfoGitClient.kt b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/ChangeInfoGitClient.kt
index 2a92245..bfb9427 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/ChangeInfoGitClient.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/ChangeInfoGitClient.kt
@@ -24,24 +24,19 @@
/**
* A git client based on changeinfo files and manifest files created by the build server.
*
- * For sample changeinfo config files, see:
- * ChangeInfoGitClientTest.kt
+ * For sample changeinfo config files, see: ChangeInfoGitClientTest.kt
* https://android-build.googleplex.com/builds/pending/P28356101/androidx_incremental/latest/incremental/P28356101-changeInfo
*
* For more information, see b/171569941
*/
class ChangeInfoGitClient(
- /**
- * The file containing the information about which changes are new in this build
- */
+ /** The file containing the information about which changes are new in this build */
changeInfoText: String,
- /**
- * The file containing version information
- */
+ /** The file containing version information */
private val versionInfo: String,
/**
- * The project directory relative to the root of the checkout
- * The repository is derived from this value
+ * The project directory relative to the root of the checkout The repository is derived from
+ * this value
*/
private val projectPath: String
) : GitClient {
@@ -49,22 +44,18 @@
/**
* The name of the current git repository. In many cases this is 'platform/frameworks/support'
*/
- private val projectName: String by lazy {
- computeProjectName(versionInfo)
- }
+ private val projectName: String by lazy { computeProjectName(versionInfo) }
private fun computeProjectName(config: String): String {
val document = parseXml(config, mapOf())
val projectIterator = document.rootElement.elementIterator()
while (projectIterator.hasNext()) {
- val project = projectIterator.next()
+ val project = projectIterator.next()
val repositoryPath = project.attributeValue("path")
if (repositoryPath != null) {
if (pathContains(repositoryPath, projectPath)) {
val name = project.attributeValue("name")
- check(name != null) {
- "Could not get name for project $project"
- }
+ check(name != null) { "Could not get name for project $project" }
return name
}
}
@@ -74,29 +65,19 @@
)
}
- /**
- * Object representing changes
- */
+ /** Object representing changes */
private val changeInfo: ChangeInfo by lazy {
val gson = Gson()
gson.fromJson(changeInfoText, ChangeInfo::class.java)
}
- private data class ChangeInfo(
- val changes: List<ChangeEntry>?
- )
- private data class ChangeEntry(
- val project: String,
- val revisions: List<Revisions>?
- )
- private data class Revisions(
- val fileInfos: List<FileInfo>?
- )
- private data class FileInfo(
- val path: String?,
- val oldPath: String?,
- val status: String
- )
+ private data class ChangeInfo(val changes: List<ChangeEntry>?)
+
+ private data class ChangeEntry(val project: String, val revisions: List<Revisions>?)
+
+ private data class Revisions(val fileInfos: List<FileInfo>?)
+
+ private data class FileInfo(val path: String?, val oldPath: String?, val status: String)
private val changesInThisRepo: List<ChangeEntry>
get() {
@@ -118,9 +99,7 @@
)
}
- /**
- * Finds changed file paths
- */
+ /** Finds changed file paths */
override fun findChangedFilesSince(
sha: String, // unused in this implementation, the data file knows what is new
top: String, // unused in this implementation, the data file knows what is new
@@ -158,9 +137,8 @@
}
/**
- * Unused
- * If this were supported, it would:
- * Finds the most recently submitted change before any pending changes being tested
+ * Unused If this were supported, it would: Finds the most recently submitted change before any
+ * pending changes being tested
*/
override fun findPreviousSubmittedChange(): String {
// findChangedFilesSince doesn't need this information, so
@@ -169,9 +147,7 @@
return ""
}
- /**
- * Finds the commits in a certain range
- */
+ /** Finds the commits in a certain range */
override fun getGitLog(
gitCommitRange: GitCommitRange,
keepMerges: Boolean,
@@ -188,12 +164,7 @@
"not ${gitCommitRange.untilInclusive}"
)
}
- return listOf(
- Commit(
- "_CommitSHA:${extractVersion(versionInfo)}",
- projectPath
- )
- )
+ return listOf(Commit("_CommitSHA:${extractVersion(versionInfo)}", projectPath))
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitClient.kt b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitClient.kt
index 1bb758f..f6d757f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitClient.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitClient.kt
@@ -32,6 +32,7 @@
top: String = "HEAD",
includeUncommitted: Boolean = false
): List<String>
+
fun findPreviousSubmittedChange(): String?
fun getGitLog(
@@ -40,18 +41,12 @@
projectDir: File?
): List<Commit>
- /**
- * Returns the full commit sha for the HEAD of the git repository
- */
+ /** Returns the full commit sha for the HEAD of the git repository */
fun getHeadSha(): String {
val projectDir = null
val commitList: List<Commit> =
getGitLog(
- GitCommitRange(
- fromExclusive = "",
- untilInclusive = "HEAD",
- n = 1
- ),
+ GitCommitRange(fromExclusive = "", untilInclusive = "HEAD", n = 1),
keepMerges = true,
projectDir = projectDir
)
@@ -61,17 +56,11 @@
return commitList.first().sha
}
- /**
- * Abstraction for running execution commands for testability
- */
+ /** Abstraction for running execution commands for testability */
interface CommandRunner {
- /**
- * Executes the given shell command and returns the stdout as a string.
- */
+ /** Executes the given shell command and returns the stdout as a string. */
fun execute(command: String): String
- /**
- * Executes the given shell command and returns the stdout by lines.
- */
+ /** Executes the given shell command and returns the stdout by lines. */
fun executeAndParse(command: String): List<String>
}
@@ -79,9 +68,11 @@
fun getChangeInfoPath(project: Project): Provider<String> {
return project.providers.environmentVariable("CHANGE_INFO").orElse("")
}
+
fun getManifestPath(project: Project): Provider<String> {
return project.providers.environmentVariable("MANIFEST").orElse("")
}
+
fun forProject(project: Project): GitClient {
return create(
project.projectDir,
@@ -91,6 +82,7 @@
GitClient.getManifestPath(project).get()
)
}
+
fun create(
projectDir: File,
checkoutRoot: File,
@@ -113,18 +105,14 @@
val changeInfoText = changeInfoFile.readText()
val manifestText = manifestFile.readText()
val projectDirRelativeToRoot = projectDir.relativeTo(checkoutRoot).toString()
- logger.info("Using ChangeInfoGitClient with change info path $changeInfoPath, " +
- "manifest $manifestPath project dir $projectDirRelativeToRoot")
- return ChangeInfoGitClient(
- changeInfoText,
- manifestText,
- projectDirRelativeToRoot
+ logger.info(
+ "Using ChangeInfoGitClient with change info path $changeInfoPath, " +
+ "manifest $manifestPath project dir $projectDirRelativeToRoot"
)
+ return ChangeInfoGitClient(changeInfoText, manifestText, projectDirRelativeToRoot)
}
val gitRoot = findGitDirInParentFilepath(projectDir)
- check(gitRoot != null) {
- "Could not find .git dir for $projectDir"
- }
+ check(gitRoot != null) { "Could not find .git dir for $projectDir" }
logger.info("UsingGitRunnerGitClient")
return GitRunnerGitClient(gitRoot, logger)
}
@@ -150,9 +138,7 @@
cache = ConcurrentHashMap()
this.cache = cache
}
- return cache.getOrPut(
- key = projectDir
- ) {
+ return cache.getOrPut(key = projectDir) {
GitClient.create(projectDir, checkoutRoot, logger, changeInfoPath, manifestPath)
}
}
@@ -170,7 +156,11 @@
}
enum class CommitType {
- NEW_FEATURE, API_CHANGE, BUG_FIX, EXTERNAL_CONTRIBUTION;
+ NEW_FEATURE,
+ API_CHANGE,
+ BUG_FIX,
+ EXTERNAL_CONTRIBUTION;
+
companion object {
fun getTitle(commitType: CommitType): String {
return when (commitType) {
@@ -187,10 +177,10 @@
* Defines the parameters for a git log command
*
* @property fromExclusive the oldest SHA at which the git log starts. Set to an empty string to use
- * [n]
- * @property untilInclusive the latest SHA included in the git log. Defaults to HEAD
- * @property n a count of how many commits to go back to. Only used when [fromExclusive] is an
- * empty string
+ * [n]
+ * @property untilInclusive the latest SHA included in the git log. Defaults to HEAD
+ * @property n a count of how many commits to go back to. Only used when [fromExclusive] is an empty
+ * string
*/
data class GitCommitRange(
val fromExclusive: String = "",
@@ -199,14 +189,14 @@
)
/**
- * Class implementation of a git commit. It uses the input delimiters to parse the commit
+ * Class implementation of a git commit. It uses the input delimiters to parse the commit
*
* @property formattedCommitText a string representation of a git commit
* @property projectDir the project directory for which to parse file paths from a commit
* @property commitSHADelimiter the term to use to search for the commit SHA
* @property subjectDelimiter the term to use to search for the subject (aka commit summary)
* @property changeIdDelimiter the term to use to search for the change-id in the body of the commit
- * message
+ * message
* @property authorEmailDelimiter the term to use to search for the author email
*/
data class Commit(
@@ -225,15 +215,13 @@
var summary: String = ""
var type: CommitType = CommitType.BUG_FIX
var releaseNote: String = ""
- private val releaseNoteDelimiters: List<String> = listOf(
- "Relnote:"
- )
+ private val releaseNoteDelimiters: List<String> = listOf("Relnote:")
init {
val listedCommit: List<String> = formattedCommitText.split('\n')
- listedCommit.filter { line -> line.trim() != "" }.forEach { line ->
- processCommitLine(line)
- }
+ listedCommit
+ .filter { line -> line.trim() != "" }
+ .forEach { line -> processCommitLine(line) }
}
private fun processCommitLine(line: String) {
@@ -253,11 +241,12 @@
getAuthorEmailFromGitLine(line)
return
}
- if ("Bug:" in line ||
- "b/" in line ||
- "bug:" in line ||
- "Fixes:" in line ||
- "fixes b/" in line
+ if (
+ "Bug:" in line ||
+ "b/" in line ||
+ "bug:" in line ||
+ "Fixes:" in line ||
+ "fixes b/" in line
) {
getBugsFromGitLine(line)
return
@@ -279,32 +268,27 @@
}
/**
- * Parses SHAs from git commit line, with the format:
- * [Commit.commitSHADelimiter] <commitSHA>
+ * Parses SHAs from git commit line, with the format: [Commit.commitSHADelimiter] <commitSHA>
*/
private fun getSHAFromGitLine(line: String) {
sha = line.substringAfter(commitSHADelimiter).trim()
}
/**
- * Parses subject from git commit line, with the format:
- * [Commit.subjectDelimiter]<commit subject>
+ * Parses subject from git commit line, with the format: [Commit.subjectDelimiter]<commit
+ * subject>
*/
private fun getSummary(line: String) {
summary = line.substringAfter(subjectDelimiter).trim()
}
- /**
- * Parses commit Change-Id lines, with the format:
- * `commit.changeIdDelimiter` <changeId>
- */
+ /** Parses commit Change-Id lines, with the format: `commit.changeIdDelimiter` <changeId> */
private fun getChangeIdFromGitLine(line: String) {
changeId = line.substringAfter(changeIdDelimiter).trim()
}
/**
- * Parses commit author lines, with the format:
- * [Commit.authorEmailDelimiter]email@google.com
+ * Parses commit author lines, with the format: [Commit.authorEmailDelimiter]email@google.com
*/
private fun getAuthorEmailFromGitLine(line: String) {
authorEmail = line.substringAfter(authorEmailDelimiter).trim()
@@ -324,9 +308,7 @@
}
}
- /**
- * Parses bugs from a git commit message line
- */
+ /** Parses bugs from a git commit message line */
private fun getBugsFromGitLine(line: String) {
var formattedLine = line.replace("b/", " ")
formattedLine = formattedLine.replace(":", " ")
@@ -345,10 +327,9 @@
*
* They can have a couple valid formats:
*
- * `Release notes: This is a one-line release note`
- * `Release Notes: "This is a multi-line release note. This accounts for the use case where
- * the commit cannot be explained in one line"
- * `release notes: "This is a one-line release note. The quotes can be used this way too"`
+ * `Release notes: This is a one-line release note` `Release Notes: "This is a multi-line
+ * release note. This accounts for the use case where the commit cannot be explained in one
+ * line" `release notes: "This is a one-line release note. The quotes can be used this way too"`
*/
private fun getReleaseNotesFromGitLine(line: String, formattedCommitText: String) {
/* Account for the use of quotes in a release note line
@@ -357,7 +338,9 @@
*/
var quoteCountInRelNoteLine: Int = 0
line.forEach { character ->
- if (character == '"') { quoteCountInRelNoteLine++ }
+ if (character == '"') {
+ quoteCountInRelNoteLine++
+ }
}
if (quoteCountInRelNoteLine == 0) {
getOneLineReleaseNotesFromGitLine(line)
@@ -366,7 +349,7 @@
if (delimiter in line) {
// Find the starting quote of the release notes quote block
var releaseNoteStartIndex = formattedCommitText.lastIndexOf(delimiter)
- + delimiter.length
+ +delimiter.length
releaseNoteStartIndex = formattedCommitText.indexOf('"', releaseNoteStartIndex)
// Move to the character after the first quote
if (formattedCommitText[releaseNoteStartIndex] == '"') {
@@ -380,10 +363,13 @@
getOneLineReleaseNotesFromGitLine(line)
return
}
- releaseNote = formattedCommitText.substring(
- startIndex = releaseNoteStartIndex,
- endIndex = releaseNoteEndIndex
- ).trim()
+ releaseNote =
+ formattedCommitText
+ .substring(
+ startIndex = releaseNoteStartIndex,
+ endIndex = releaseNoteEndIndex
+ )
+ .trim()
}
}
}
@@ -401,18 +387,14 @@
fun getReleaseNoteString(): String {
var releaseNoteString: String = releaseNote
releaseNoteString += " ${getChangeIdAOSPLink(changeId)}"
- bugs.forEach { bug ->
- releaseNoteString += " ${getBuganizerLink(bug)}"
- }
+ bugs.forEach { bug -> releaseNoteString += " ${getBuganizerLink(bug)}" }
return releaseNoteString
}
override fun toString(): String {
var commitString: String = summary
commitString += " ${getChangeIdAOSPLink(changeId)}"
- bugs.forEach { bug ->
- commitString += " ${getBuganizerLink(bug)}"
- }
+ bugs.forEach { bug -> commitString += " ${getBuganizerLink(bug)}" }
return commitString
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitRunnerGitClient.kt b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitRunnerGitClient.kt
index 21e4e1c..abb6a77 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitRunnerGitClient.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/gitclient/GitRunnerGitClient.kt
@@ -25,22 +25,16 @@
* given working directory.
*/
class GitRunnerGitClient(
- /**
- * The root location for git
- */
+ /** The root location for git */
private val workingDir: File,
private val logger: Logger?,
- private val commandRunner: GitClient.CommandRunner = RealCommandRunner(
- workingDir = workingDir,
- logger = logger
- )
+ private val commandRunner: GitClient.CommandRunner =
+ RealCommandRunner(workingDir = workingDir, logger = logger)
) : GitClient {
private val gitRoot: File = findGitDirInParentFilepath(workingDir) ?: workingDir
- /**
- * Finds changed file paths since the given sha
- */
+ /** Finds changed file paths since the given sha */
override fun findChangedFilesSince(
sha: String,
top: String,
@@ -56,11 +50,10 @@
)
}
- /**
- * checks the history to find the first merge CL.
- */
+ /** checks the history to find the first merge CL. */
override fun findPreviousSubmittedChange(): String? {
- return commandRunner.executeAndParse(PREVIOUS_SUBMITTED_CMD)
+ return commandRunner
+ .executeAndParse(PREVIOUS_SUBMITTED_CMD)
.firstOrNull()
?.split(" ")
?.firstOrNull()
@@ -77,19 +70,19 @@
// Split commits string out into individual commits (note: this removes the deliminter)
val gitLogStringList: List<String>? = commitLogString.split(commitStartDelimiter)
var commitLog: MutableList<Commit> = mutableListOf()
- gitLogStringList?.filter { gitCommit ->
- gitCommit.trim() != ""
- }?.forEach { gitCommit ->
- commitLog.add(
- Commit(
- gitCommit,
- localProjectDir,
- commitSHADelimiter = commitSHADelimiter,
- subjectDelimiter = subjectDelimiter,
- authorEmailDelimiter = authorEmailDelimiter
+ gitLogStringList
+ ?.filter { gitCommit -> gitCommit.trim() != "" }
+ ?.forEach { gitCommit ->
+ commitLog.add(
+ Commit(
+ gitCommit,
+ localProjectDir,
+ commitSHADelimiter = commitSHADelimiter,
+ subjectDelimiter = subjectDelimiter,
+ authorEmailDelimiter = authorEmailDelimiter
+ )
)
- )
- }
+ }
return commitLog.toList()
}
@@ -111,10 +104,7 @@
val authorEmailDelimiter: String = "_Author:"
val dateDelimiter: String = "_Date:"
val bodyDelimiter: String = "_Body:"
- val fullProjectDir = if (projectDir == null)
- workingDir
- else
- projectDir
+ val fullProjectDir = if (projectDir == null) workingDir else projectDir
val localProjectDir: String = fullProjectDir.relativeTo(gitRoot).toString()
val relativeProjectDir: String = fullProjectDir.relativeTo(workingDir).toString()
@@ -132,54 +122,53 @@
}
var gitLogCmd: String
if (gitCommitRange.fromExclusive != "") {
- gitLogCmd = "$GIT_LOG_CMD_PREFIX $gitLogOptions " +
- "${gitCommitRange.fromExclusive}..${gitCommitRange.untilInclusive}" +
- " -- ./$relativeProjectDir"
+ gitLogCmd =
+ "$GIT_LOG_CMD_PREFIX $gitLogOptions " +
+ "${gitCommitRange.fromExclusive}..${gitCommitRange.untilInclusive}" +
+ " -- ./$relativeProjectDir"
} else {
- gitLogCmd = "$GIT_LOG_CMD_PREFIX $gitLogOptions ${gitCommitRange.untilInclusive} -n " +
- "${gitCommitRange.n} -- ./$relativeProjectDir"
+ gitLogCmd =
+ "$GIT_LOG_CMD_PREFIX $gitLogOptions ${gitCommitRange.untilInclusive} -n " +
+ "${gitCommitRange.n} -- ./$relativeProjectDir"
}
val gitLogString: String = commandRunner.execute(gitLogCmd)
- val commits = parseCommitLogString(
- gitLogString,
- commitStartDelimiter,
- commitSHADelimiter,
- subjectDelimiter,
- authorEmailDelimiter,
- localProjectDir
- )
+ val commits =
+ parseCommitLogString(
+ gitLogString,
+ commitStartDelimiter,
+ commitSHADelimiter,
+ subjectDelimiter,
+ authorEmailDelimiter,
+ localProjectDir
+ )
if (commits.isEmpty()) {
// Probably an error; log this
logger?.warn(
"No git commits found! Ran this command: '" +
- gitLogCmd + "' and received this output: '" + gitLogString + "'"
+ gitLogCmd +
+ "' and received this output: '" +
+ gitLogString +
+ "'"
)
}
return commits
}
- private class RealCommandRunner(
- private val workingDir: File,
- private val logger: Logger?
- ) : GitClient.CommandRunner {
+ private class RealCommandRunner(private val workingDir: File, private val logger: Logger?) :
+ GitClient.CommandRunner {
override fun execute(command: String): String {
val parts = command.split("\\s".toRegex())
logger?.info("running command $command in $workingDir")
- val proc = ProcessBuilder(*parts.toTypedArray())
- .directory(workingDir)
- .redirectOutput(ProcessBuilder.Redirect.PIPE)
- .redirectError(ProcessBuilder.Redirect.PIPE)
- .start()
+ val proc =
+ ProcessBuilder(*parts.toTypedArray())
+ .directory(workingDir)
+ .redirectOutput(ProcessBuilder.Redirect.PIPE)
+ .redirectError(ProcessBuilder.Redirect.PIPE)
+ .start()
// Read output, waiting for process to finish, as needed
- val stdout = proc
- .inputStream
- .bufferedReader()
- .readText()
- val stderr = proc
- .errorStream
- .bufferedReader()
- .readText()
+ val stdout = proc.inputStream.bufferedReader().readText()
+ val stderr = proc.errorStream.bufferedReader().readText()
val message = stdout + stderr
// wait potentially a little bit longer in case Git was waiting for us to
// read its response before it exited
@@ -190,27 +179,21 @@
}
return stdout
}
+
override fun executeAndParse(command: String): List<String> {
- val response = execute(command)
- .split(System.lineSeparator())
- .filterNot {
- it.isEmpty()
- }
+ val response = execute(command).split(System.lineSeparator()).filterNot { it.isEmpty() }
return response
}
}
companion object {
- const val PREVIOUS_SUBMITTED_CMD =
- "git log -1 --merges --oneline"
+ const val PREVIOUS_SUBMITTED_CMD = "git log -1 --merges --oneline"
const val CHANGED_FILES_CMD_PREFIX = "git diff --name-only"
const val GIT_LOG_CMD_PREFIX = "git log --name-only"
}
}
-/**
- * Finds the git directory containing the given File by checking parent directories
- */
+/** Finds the git directory containing the given File by checking parent directories */
internal fun findGitDirInParentFilepath(filepath: File): File? {
var curDirectory: File = filepath
while (curDirectory.path != "/") {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/java/JavaCompileInputs.kt b/buildSrc/private/src/main/kotlin/androidx/build/java/JavaCompileInputs.kt
index 2123fe6..760d0b8 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/java/JavaCompileInputs.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/java/JavaCompileInputs.kt
@@ -49,15 +49,9 @@
): JavaCompileInputs {
val sourceCollection = getSourceCollection(variant, project)
- val dependencyClasspath = variant.getCompileClasspath(null).filter {
- it.exists()
- }
+ val dependencyClasspath = variant.getCompileClasspath(null).filter { it.exists() }
- return JavaCompileInputs(
- sourceCollection,
- dependencyClasspath,
- bootClasspath
- )
+ return JavaCompileInputs(sourceCollection, dependencyClasspath, bootClasspath)
}
/**
@@ -65,39 +59,38 @@
*
* @param project The project whose main jvm target inputs will be returned.
*/
- fun fromKmpJvmTarget(
- project: Project
- ): JavaCompileInputs {
- val kmpExtension = checkNotNull(project.multiplatformExtension) {
- """
+ fun fromKmpJvmTarget(project: Project): JavaCompileInputs {
+ val kmpExtension =
+ checkNotNull(project.multiplatformExtension) {
+ """
${project.path} needs to have Kotlin Multiplatform Plugin applied to obtain its
jvm source sets.
- """.trimIndent()
- }
- val jvmTarget = kmpExtension.targets.requirePlatform(
- KotlinPlatformType.jvm
- )
- val sourceCollection = project.files(project.provider {
- jvmTarget.sourceFiles(
- compilationName = KotlinCompilation.MAIN_COMPILATION_NAME
+ """
+ .trimIndent()
+ }
+ val jvmTarget = kmpExtension.targets.requirePlatform(KotlinPlatformType.jvm)
+ val sourceCollection =
+ project.files(
+ project.provider {
+ jvmTarget.sourceFiles(
+ compilationName = KotlinCompilation.MAIN_COMPILATION_NAME
+ )
+ }
)
- })
return JavaCompileInputs(
sourcePaths = sourceCollection,
- dependencyClasspath = jvmTarget
- .compilations[KotlinCompilation.MAIN_COMPILATION_NAME].compileDependencyFiles,
+ dependencyClasspath =
+ jvmTarget.compilations[KotlinCompilation.MAIN_COMPILATION_NAME]
+ .compileDependencyFiles,
bootClasspath = project.getAndroidJar()
)
}
// Constructs a JavaCompileInputs from a sourceset
fun fromSourceSet(sourceSet: SourceSet, project: Project): JavaCompileInputs {
- val sourcePaths: FileCollection = project.files(
- project.provider {
- sourceSet.allSource.srcDirs
- }
- )
+ val sourcePaths: FileCollection =
+ project.files(project.provider { sourceSet.allSource.srcDirs })
val dependencyClasspath = sourceSet.compileClasspath
return JavaCompileInputs(sourcePaths, dependencyClasspath, project.getAndroidJar())
}
@@ -112,22 +105,24 @@
// with a common and Android source set, this will look inside commonMain and
// androidMain.
val taskDependencies = mutableListOf<Any>(variant.javaCompileProvider)
- val sourceFiles = project.multiplatformExtension?.let { kmpExtension ->
- project.provider {
- kmpExtension.targets.requirePlatform(
- KotlinPlatformType.androidJvm
- ).sourceFiles(compilationName = variant.name)
- }
- } ?: project.provider {
- variant
- .getSourceFolders(com.android.build.gradle.api.SourceKind.JAVA)
- .map { folder ->
- for (builtBy in folder.builtBy) {
- taskDependencies.add(builtBy)
- }
- folder.dir
+ val sourceFiles =
+ project.multiplatformExtension?.let { kmpExtension ->
+ project.provider {
+ kmpExtension.targets
+ .requirePlatform(KotlinPlatformType.androidJvm)
+ .sourceFiles(compilationName = variant.name)
}
- }
+ }
+ ?: project.provider {
+ variant
+ .getSourceFolders(com.android.build.gradle.api.SourceKind.JAVA)
+ .map { folder ->
+ for (builtBy in folder.builtBy) {
+ taskDependencies.add(builtBy)
+ }
+ folder.dir
+ }
+ }
val sourceCollection = project.files(sourceFiles)
for (dep in taskDependencies) {
@@ -137,31 +132,30 @@
}
/**
- * Returns the list of Files (might be directories) that are included in the compilation
- * of this target.
+ * Returns the list of Files (might be directories) that are included in the compilation of
+ * this target.
*
* @param compilationName The name of the compilation. A target might have separate
- * compilations (e.g. main vs test for jvm or debug vs release for Android)
+ * compilations (e.g. main vs test for jvm or debug vs release for Android)
*/
- private fun KotlinTarget.sourceFiles(
- compilationName: String
- ): List<File> {
- val selectedCompilation = checkNotNull(compilations.findByName(compilationName)) {
- """
+ private fun KotlinTarget.sourceFiles(compilationName: String): List<File> {
+ val selectedCompilation =
+ checkNotNull(compilations.findByName(compilationName)) {
+ """
Cannot find $compilationName compilation configuration of $name in
${project.parent}.
Available compilations: ${compilations.joinToString(", ") { it.name }}
- """.trimIndent()
- }
- return selectedCompilation
- .allKotlinSourceSets
- .flatMap {
- it.kotlin.sourceDirectories
- }.also {
+ """
+ .trimIndent()
+ }
+ return selectedCompilation.allKotlinSourceSets
+ .flatMap { it.kotlin.sourceDirectories }
+ .also {
require(it.isNotEmpty()) {
"""
Didn't find any source sets for $selectedCompilation in ${project.path}.
- """.trimIndent()
+ """
+ .trimIndent()
}
}
}
@@ -175,17 +169,17 @@
private fun Collection<KotlinTarget>.requirePlatform(
expectedPlatformType: KotlinPlatformType
): KotlinTarget {
- return this.singleOrNull {
- it.platformType == expectedPlatformType
- } ?: error(
- """
+ return this.singleOrNull { it.platformType == expectedPlatformType }
+ ?: error(
+ """
Expected 1 and only 1 kotlin target with $expectedPlatformType. Found $size.
Matching compilation targets:
${joinToString(",") { it.name }}
All compilation targets:
${this@requirePlatform.joinToString(",") { it.name }}
- """.trimIndent()
- )
+ """
+ .trimIndent()
+ )
}
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiCompatibilityTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiCompatibilityTask.kt
index 15b77b7..178b2f6 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiCompatibilityTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiCompatibilityTask.kt
@@ -46,35 +46,24 @@
@CacheableTask
abstract class CheckNativeApiCompatibilityTask : DefaultTask() {
- @get:Inject
- abstract val workerExecutor: WorkerExecutor
+ @get:Inject abstract val workerExecutor: WorkerExecutor
- @get:Internal
- abstract val artifactNames: ListProperty<String>
+ @get:Internal abstract val artifactNames: ListProperty<String>
- @get:Internal
- abstract val builtApiLocation: Property<File>
+ @get:Internal abstract val builtApiLocation: Property<File>
- @get:Internal
- abstract val currentApiLocation: Property<File>
+ @get:Internal abstract val currentApiLocation: Property<File>
- @get:Input
- abstract val strict: Property<Boolean>
+ @get:Input abstract val strict: Property<Boolean>
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getTaskInputs(): List<File> {
- return getLocationsForArtifacts(
- builtApiLocation.get(),
- artifactNames.get()
- )
+ return getLocationsForArtifacts(builtApiLocation.get(), artifactNames.get())
}
@OutputFiles
fun getTaskOutputs(): List<File> {
- return getLocationsForArtifacts(
- currentApiLocation.get(),
- artifactNames.get()
- )
+ return getLocationsForArtifacts(currentApiLocation.get(), artifactNames.get())
}
@TaskAction
@@ -91,18 +80,22 @@
// Unless this is the first time we've generated these files, a difference in the number of
// API files indicates that a library has been added / removed and the API has changed.
if (currentApiFiles.isNotEmpty() && builtApiFiles.size != currentApiFiles.size) {
- throw AbiDiffException("Number of built artifacts has changed, expected " +
- "${currentApiFiles.size} but was ${builtApiFiles.size}")
+ throw AbiDiffException(
+ "Number of built artifacts has changed, expected " +
+ "${currentApiFiles.size} but was ${builtApiFiles.size}"
+ )
}
val workQueue = workerExecutor.processIsolation()
builtApiLocation.get().listFiles().forEach { archDir ->
archDir.listFiles().forEach { apiFile ->
workQueue.submit(AbiDiffWorkAction::class.java) { parameters ->
// the current API file of the same name as the one in the built location
- parameters.pathToPreviousLib = currentApiLocation.get()
- .resolve(archDir.name)
- .resolve(apiFile.name)
- .toString()
+ parameters.pathToPreviousLib =
+ currentApiLocation
+ .get()
+ .resolve(archDir.name)
+ .resolve(apiFile.name)
+ .toString()
// the newly built API file we want to check
parameters.pathToCurrentLib = apiFile.toString()
// necessary to locate `abidiff`
@@ -124,18 +117,14 @@
}
/**
- * The exit value from `abidiff` is an 8-bit field, the specific bits have meaning.The exit codes
- * we are about are:
+ * The exit value from `abidiff` is an 8-bit field, the specific bits have meaning.The exit codes we
+ * are about are:
*
- * 0000 (0) -> success
- * 0001 (1) -> tool error
- * 0010 (2) -> user error (bad flags etc)
- * 0100 (4) -> ABI changed
- * 1100 (12) -> ABI changed + incompatible changes
+ * 0000 (0) -> success 0001 (1) -> tool error 0010 (2) -> user error (bad flags etc) 0100 (4) -> ABI
+ * changed 1100 (12) -> ABI changed + incompatible changes
*
- * Remaining bits unused for now, so we should indeed error if we encounter them until we know
- * their meaning.
- * https://sourceware.org/libabigail/manual/abidiff.html#return-values
+ * Remaining bits unused for now, so we should indeed error if we encounter them until we know their
+ * meaning. https://sourceware.org/libabigail/manual/abidiff.html#return-values
*/
enum class AbiDiffExitCode(val value: Int) {
SUCCESS(0),
@@ -144,39 +133,41 @@
ABI_CHANGE(4),
ABI_INCOMPATIBLE_CHANGE(12),
UNKNOWN(-1);
+
companion object {
fun fromInt(value: Int): AbiDiffExitCode = values().find { it.value == value } ?: UNKNOWN
}
}
-abstract class AbiDiffWorkAction @Inject constructor(
- private val execOperations: ExecOperations
-) : WorkAction<AbiDiffParameters> {
+abstract class AbiDiffWorkAction @Inject constructor(private val execOperations: ExecOperations) :
+ WorkAction<AbiDiffParameters> {
override fun execute() {
val outputStream = ByteArrayOutputStream()
- val result = execOperations.exec {
- it.executable = LibabigailPaths.Linux.abidiffPath(parameters.rootDir)
- it.args = listOf(
- parameters.pathToPreviousLib,
- parameters.pathToCurrentLib
- )
- it.standardOutput = outputStream
- it.isIgnoreExitValue = true
- }
+ val result =
+ execOperations.exec {
+ it.executable = LibabigailPaths.Linux.abidiffPath(parameters.rootDir)
+ it.args = listOf(parameters.pathToPreviousLib, parameters.pathToCurrentLib)
+ it.standardOutput = outputStream
+ it.isIgnoreExitValue = true
+ }
outputStream.close()
val exitValue = result.exitValue
val output = outputStream.toString()
when (AbiDiffExitCode.fromInt(exitValue)) {
AbiDiffExitCode.ABI_INCOMPATIBLE_CHANGE -> {
- throw AbiDiffException("Incompatible API changes found! Please make sure these " +
- "are intentional and if so update the API file by " +
- "running 'ignoreBreakingChangesAndUpdateNativeApi'\n\n$output")
+ throw AbiDiffException(
+ "Incompatible API changes found! Please make sure these " +
+ "are intentional and if so update the API file by " +
+ "running 'ignoreBreakingChangesAndUpdateNativeApi'\n\n$output"
+ )
}
AbiDiffExitCode.TOOL_ERROR,
AbiDiffExitCode.USER_ERROR,
AbiDiffExitCode.UNKNOWN -> {
- throw AbiDiffException("Encountered an error while executing 'abidiff', " +
- "this is likely a bug.\n\n$output")
+ throw AbiDiffException(
+ "Encountered an error while executing 'abidiff', " +
+ "this is likely a bug.\n\n$output"
+ )
}
AbiDiffExitCode.ABI_CHANGE, // non breaking changes are okay
AbiDiffExitCode.SUCCESS -> Unit
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiEquivalenceTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiEquivalenceTask.kt
index d6e5964..1750eef 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiEquivalenceTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/CheckNativeApiEquivalenceTask.kt
@@ -35,32 +35,20 @@
*/
@DisableCachingByDefault(because = "Doesn't benefit from caching")
abstract class CheckNativeApiEquivalenceTask : DefaultTask() {
- /**
- * Api file (in the build dir) to check
- */
- @get:Input
- abstract val builtApi: Property<File>
+ /** Api file (in the build dir) to check */
+ @get:Input abstract val builtApi: Property<File>
- /**
- * Api file (in source control) to compare against
- */
- @get:Input
- abstract val checkedInApis: ListProperty<File>
+ /** Api file (in source control) to compare against */
+ @get:Input abstract val checkedInApis: ListProperty<File>
- @get:Internal
- abstract val artifactNames: ListProperty<String>
+ @get:Internal abstract val artifactNames: ListProperty<String>
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getTaskInputs(): List<File> {
- return getLocationsForArtifacts(
- builtApi.get(),
- artifactNames.get()
- ) + checkedInApis.get().flatMap { checkedInApi ->
- getLocationsForArtifacts(
- checkedInApi,
- artifactNames.get()
- )
- }
+ return getLocationsForArtifacts(builtApi.get(), artifactNames.get()) +
+ checkedInApis.get().flatMap { checkedInApi ->
+ getLocationsForArtifacts(checkedInApi, artifactNames.get())
+ }
}
@TaskAction
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/GenerateNativeApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/GenerateNativeApiTask.kt
index ad4c23f..b91eadd 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/GenerateNativeApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/GenerateNativeApiTask.kt
@@ -22,6 +22,7 @@
import javax.inject.Inject
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
+import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
@@ -46,35 +47,26 @@
@CacheableTask
abstract class GenerateNativeApiTask : DefaultTask() {
- @get:Inject
- abstract val workerExecutor: WorkerExecutor
+ @get:Inject abstract val workerExecutor: WorkerExecutor
@get:[InputDirectory PathSensitive(PathSensitivity.RELATIVE)]
- abstract val prefabDirectory: Property<File>
+ abstract val prefabDirectory: DirectoryProperty
- @get:Internal
- abstract val projectRootDir: Property<File>
+ @get:Internal abstract val projectRootDir: Property<File>
- @get:Internal
- abstract val apiLocation: Property<File>
+ @get:Internal abstract val apiLocation: Property<File>
- @get:Internal
- abstract val artifactNames: ListProperty<String>
+ @get:Internal abstract val artifactNames: ListProperty<String>
@OutputFiles
fun getTaskOutputs(): List<File> {
- return getLocationsForArtifacts(
- apiLocation.get(),
- artifactNames.get()
- )
+ return getLocationsForArtifacts(apiLocation.get(), artifactNames.get())
}
@TaskAction
fun exec() {
if (getOperatingSystem() != OperatingSystem.LINUX) {
- logger.warn(
- "Native API checking is currently not supported on non-linux devices"
- )
+ logger.warn("Native API checking is currently not supported on non-linux devices")
return
}
val destinationDir = apiLocation.get()
@@ -84,21 +76,22 @@
destinationDir.deleteRecursively()
destinationDir.mkdirs()
}
- val prefabDir = prefabDirectory.get()
+ val prefabDir = prefabDirectory.get().asFile
val workQueue = workerExecutor.processIsolation()
artifactNames.get().forEach { moduleName ->
val module = prefabDir.resolve("modules/$moduleName/libs")
if (!module.exists()) {
throw GradleException(
"Expected prefab directory to include path $module, but it does not exist. " +
- "Check value of 'prefab.$moduleName.name' configuration in build.gradle."
+ "Check value of 'prefab.$moduleName.name' configuration in build.gradle."
)
}
module.listFiles().forEach { archDir ->
- val artifacts = archDir.listFiles().filter {
- // skip abi.json
- it.extension == "a" || it.extension == "so"
- }
+ val artifacts =
+ archDir.listFiles().filter {
+ // skip abi.json
+ it.extension == "a" || it.extension == "so"
+ }
val nameCounts = artifacts.groupingBy { it.nameWithoutExtension }.eachCount()
nameCounts.forEach { (name, count) ->
if (count > 1) {
@@ -109,11 +102,8 @@
}
artifacts.forEach { artifact ->
val arch = archDir.name.removePrefix(ARCH_PREFIX)
- val outputFilePath = getLocationForArtifact(
- destinationDir,
- arch,
- artifact.nameWithoutExtension
- )
+ val outputFilePath =
+ getLocationForArtifact(destinationDir, arch, artifact.nameWithoutExtension)
outputFilePath.parentFile.mkdirs()
workQueue.submit(AbiDwWorkAction::class.java) { parameters ->
parameters.rootDir = projectRootDir.get().toString()
@@ -138,38 +128,38 @@
val tempFile = File.createTempFile("abi", null)
execOperations.exec {
it.executable = LibabigailPaths.Linux.abidwPath(parameters.rootDir)
- it.args = listOf(
- "--drop-private-types",
- "--no-show-locs",
- "--short-locs",
- "--no-comp-dir-path",
- "--no-corpus-path",
- "--out-file",
- tempFile.toString(),
- parameters.pathToLib
- )
+ it.args =
+ listOf(
+ "--drop-private-types",
+ "--no-show-locs",
+ "--short-locs",
+ "--no-comp-dir-path",
+ "--no-corpus-path",
+ "--out-file",
+ tempFile.toString(),
+ parameters.pathToLib
+ )
}
execOperations.exec {
it.executable = LibabigailPaths.Linux.abitidyPath(parameters.rootDir)
- it.args = listOf(
- "--input",
- tempFile.toString(),
- "--output",
- parameters.outputFilePath,
- "--abort-on-untyped-symbols",
- "--eliminate-duplicates",
- "--sort",
- "--prune-unreachable"
- )
+ it.args =
+ listOf(
+ "--input",
+ tempFile.toString(),
+ "--output",
+ parameters.outputFilePath,
+ "--abort-on-untyped-symbols",
+ "--eliminate-duplicates",
+ "--sort",
+ "--prune-unreachable"
+ )
}
}
}
internal fun getLocationsForArtifacts(baseDir: File, artifactNames: List<String>): List<File> {
return artifactNames.flatMap { artifactName ->
- architectures.map { arch ->
- getLocationForArtifact(baseDir, arch, artifactName)
- }
+ architectures.map { arch -> getLocationForArtifact(baseDir, arch, artifactName) }
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/LibabigailPaths.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/LibabigailPaths.kt
index 12e9bbb..cc45d71 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/LibabigailPaths.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/LibabigailPaths.kt
@@ -16,15 +16,16 @@
package androidx.build.libabigail
-/**
- * Locations of libabigail libraries (`abidw`, `abidff`) relative to the root project path.
- */
+/** Locations of libabigail libraries (`abidw`, `abidff`) relative to the root project path. */
object LibabigailPaths {
object Linux {
private fun basePath(rootDir: String) =
"$rootDir/../../prebuilts/fullsdk-linux/kernel-build-tools/linux-x86/bin"
+
fun abidwPath(rootDir: String) = "${basePath(rootDir)}/abidw"
+
fun abidiffPath(rootDir: String) = "${basePath(rootDir)}/abidiff"
+
fun abitidyPath(rootDir: String) = "${basePath(rootDir)}/abitidy"
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/NativeApiTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/NativeApiTasks.kt
index 9101dc7..c483660 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/NativeApiTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/NativeApiTasks.kt
@@ -24,9 +24,7 @@
import java.io.File
import org.gradle.api.Project
-/**
- * Adds native API generation / updating / checking tasks to a project.
- */
+/** Adds native API generation / updating / checking tasks to a project. */
object NativeApiTasks {
private const val apiGroup = "API"
@@ -35,54 +33,56 @@
builtApiLocation: File,
outputApiLocations: List<File>,
) {
- val artifactNames = project.extensions.getByType(
- LibraryExtension::class.java
- ).prefab.filterNot { it.headerOnly }.map { it.name }
+ val artifactNames =
+ project.extensions
+ .getByType(LibraryExtension::class.java)
+ .prefab
+ .filterNot { it.headerOnly }
+ .map { it.name }
// Generates API files from source in the build directory
- val generateNativeApi = project.tasks.register(
- "generateNativeApi",
- GenerateNativeApiTask::class.java
- ) { task ->
- task.group = apiGroup
- task.description = "Generates API files from native source"
- task.projectRootDir.set(project.rootDir)
- task.prefabDirectory.set(
- project.buildDir.resolve("intermediates/prefab_package/release/prefab")
- )
- task.artifactNames.set(artifactNames)
- task.apiLocation.set(builtApiLocation)
- task.dependsOn("prefabReleasePackage")
- }
+ val generateNativeApi =
+ project.tasks.register("generateNativeApi", GenerateNativeApiTask::class.java) { task ->
+ task.group = apiGroup
+ task.description = "Generates API files from native source"
+ task.projectRootDir.set(project.rootDir)
+ task.prefabDirectory.set(
+ project.layout.buildDirectory.dir("intermediates/prefab_package/release/prefab")
+ )
+ task.artifactNames.set(artifactNames)
+ task.apiLocation.set(builtApiLocation)
+ task.dependsOn("prefabReleasePackage")
+ }
// Checks that there are no breaking changes since the last (non alpha) release
val requiredCompatibilityApiLocation = project.getRequiredCompatibilityApiLocation()
- val checkNativeApiRelease = requiredCompatibilityApiLocation?.let { lastReleasedApiFile ->
- project.tasks.register(
- "checkNativeApiRelease",
- CheckNativeApiCompatibilityTask::class.java
- ) { task ->
- task.group = apiGroup
- task.description = "Checks that the API generated from native sources is " +
- "compatible with the last released API file"
- task.artifactNames.set(artifactNames)
- task.builtApiLocation.set(builtApiLocation)
- task.currentApiLocation.set(lastReleasedApiFile.nativeApiDirectory)
- // only check for breaking changes here
- task.strict.set(false)
- task.dependsOn(generateNativeApi)
+ val checkNativeApiRelease =
+ requiredCompatibilityApiLocation?.let { lastReleasedApiFile ->
+ project.tasks.register(
+ "checkNativeApiRelease",
+ CheckNativeApiCompatibilityTask::class.java
+ ) { task ->
+ task.group = apiGroup
+ task.description =
+ "Checks that the API generated from native sources is " +
+ "compatible with the last released API file"
+ task.artifactNames.set(artifactNames)
+ task.builtApiLocation.set(builtApiLocation)
+ task.currentApiLocation.set(lastReleasedApiFile.nativeApiDirectory)
+ // only check for breaking changes here
+ task.strict.set(false)
+ task.dependsOn(generateNativeApi)
+ }
}
- }
// Checks that API present in source matches that of the current generated API files
val checkNativeApi =
- project.tasks.register(
- "checkNativeApi",
- CheckNativeApiEquivalenceTask::class.java
- ) { task ->
+ project.tasks.register("checkNativeApi", CheckNativeApiEquivalenceTask::class.java) {
+ task ->
task.group = apiGroup
- task.description = "Checks that the API generated from native sources matches " +
- "the checked in API file"
+ task.description =
+ "Checks that the API generated from native sources matches " +
+ "the checked in API file"
task.artifactNames.set(artifactNames)
task.builtApi.set(builtApiLocation)
task.checkedInApis.set(outputApiLocations)
@@ -95,8 +95,7 @@
// Update the native API files if there are no breaking changes since the last (non-alpha)
// release.
- project.tasks.register("updateNativeApi", UpdateNativeApi::class.java) {
- task ->
+ project.tasks.register("updateNativeApi", UpdateNativeApi::class.java) { task ->
task.group = apiGroup
task.description = "Updates the checked in API files to match source code API"
task.artifactNames.set(artifactNames)
@@ -116,4 +115,4 @@
project.addToCheckTask(checkNativeApi)
project.addToBuildOnServer(checkNativeApi)
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/UpdateNativeApi.kt b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/UpdateNativeApi.kt
index b430e48..0ab9714 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/libabigail/UpdateNativeApi.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/libabigail/UpdateNativeApi.kt
@@ -37,46 +37,31 @@
@DisableCachingByDefault(because = "Doesn't benefit from caching")
abstract class UpdateNativeApi : DefaultTask() {
- @get:Internal
- abstract val artifactNames: ListProperty<String>
+ @get:Internal abstract val artifactNames: ListProperty<String>
- @get:Internal
- abstract val inputApiLocation: Property<File>
+ @get:Internal abstract val inputApiLocation: Property<File>
- @get:Internal
- abstract val outputApiLocations: ListProperty<File>
+ @get:Internal abstract val outputApiLocations: ListProperty<File>
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getTaskInputs(): List<File> {
- return getLocationsForArtifacts(
- inputApiLocation.get(),
- artifactNames.get()
- )
+ return getLocationsForArtifacts(inputApiLocation.get(), artifactNames.get())
}
@OutputFiles
fun getTaskOutputs(): List<File> {
return outputApiLocations.get().flatMap { outputApiLocation ->
- getLocationsForArtifacts(
- outputApiLocation,
- artifactNames.get()
- )
+ getLocationsForArtifacts(outputApiLocation, artifactNames.get())
}
}
@TaskAction
fun exec() {
if (getOperatingSystem() != OperatingSystem.LINUX) {
- logger.warn(
- "Native API checking is currently not supported on non-linux devices"
- )
+ logger.warn("Native API checking is currently not supported on non-linux devices")
return
}
- outputApiLocations.get().forEach { dir ->
- dir.listFiles()?.forEach {
- it.delete()
- }
- }
+ outputApiLocations.get().forEach { dir -> dir.listFiles()?.forEach { it.delete() } }
outputApiLocations.get().forEach { outputLocation ->
inputApiLocation.get().copyRecursively(target = outputLocation, overwrite = true)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/license/CheckExternalDependencyLicensesTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/license/CheckExternalDependencyLicensesTask.kt
index 844ee8b..e3ec845 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/license/CheckExternalDependencyLicensesTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/license/CheckExternalDependencyLicensesTask.kt
@@ -40,15 +40,12 @@
import org.gradle.work.DisableCachingByDefault
/**
- * This task creates a configuration for the project that has all of its external dependencies
- * and then ensures that those dependencies:
- * a) come from prebuilts
- * b) has a license file.
+ * This task creates a configuration for the project that has all of its external dependencies and
+ * then ensures that those dependencies: a) come from prebuilts b) has a license file.
*/
@DisableCachingByDefault(because = "Too many inputs to declare")
abstract class CheckExternalDependencyLicensesTask : DefaultTask() {
- @get:Input
- abstract val prebuiltsRoot: Property<String>
+ @get:Input abstract val prebuiltsRoot: Property<String>
@get:[InputFiles PathSensitive(PathSensitivity.ABSOLUTE)]
abstract val filesToCheck: ConfigurableFileCollection
@@ -57,21 +54,24 @@
fun checkDependencies() {
val prebuiltsRoot = File(prebuiltsRoot.get())
val dependencyArtifacts = filesToCheck
- val missingLicenses = dependencyArtifacts.filter {
- findLicenseFile(it.canonicalFile, prebuiltsRoot) == null
- }.files
+ val missingLicenses =
+ dependencyArtifacts
+ .filter { findLicenseFile(it.canonicalFile, prebuiltsRoot) == null }
+ .files
if (missingLicenses.isNotEmpty()) {
- val suggestions = missingLicenses.joinToString("\n") {
- "$it does not have a license file. It should probably live in " +
- "${it.parentFile.parentFile}"
- }
+ val suggestions =
+ missingLicenses.joinToString("\n") {
+ "$it does not have a license file. It should probably live in " +
+ "${it.parentFile.parentFile}"
+ }
throw GradleException(
"""
Any external library referenced in the support library
build must have a LICENSE or NOTICE file next to it in the prebuilts.
The following libraries are missing it:
$suggestions
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
@@ -88,10 +88,11 @@
return recurse(folder.parentFile)
}
- val found = folder.listFiles()!!.firstOrNull {
- it.name.startsWith("NOTICE", ignoreCase = true) ||
- it.name.startsWith("LICENSE", ignoreCase = true)
- }
+ val found =
+ folder.listFiles()!!.firstOrNull {
+ it.name.startsWith("NOTICE", ignoreCase = true) ||
+ it.name.startsWith("LICENSE", ignoreCase = true)
+ }
return found ?: recurse(folder.parentFile)
}
return recurse(dependency)
@@ -108,60 +109,49 @@
CheckExternalDependencyLicensesTask.TASK_NAME,
CheckExternalDependencyLicensesTask::class.java
) { task ->
- task.prebuiltsRoot.set(project.provider {
- project.getPrebuiltsRoot().absolutePath
- })
+ task.prebuiltsRoot.set(project.provider { project.getPrebuiltsRoot().absolutePath })
task.filesToCheck.from(
project.provider {
-
val configName = "CheckExternalLicences"
val container = project.configurations
val checkerConfig =
- container.findByName(configName) ?: container.create(configName) { checkerConfig ->
+ container.findByName(configName)
+ ?: container.create(configName) { checkerConfig ->
+ checkerConfig.isCanBeConsumed = false
+ checkerConfig.attributes {
+ it.attribute(
+ Usage.USAGE_ATTRIBUTE,
+ project.objects.named<Usage>(Usage.JAVA_RUNTIME)
+ )
+ it.attribute(
+ Category.CATEGORY_ATTRIBUTE,
+ project.objects.named<Category>(Category.LIBRARY)
+ )
+ it.attribute(
+ GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE,
+ project.objects.named<GradlePluginApiVersion>(
+ GradleVersion.current().getVersion()
+ )
+ )
+ }
- checkerConfig.isCanBeConsumed = false
- checkerConfig.attributes {
- it.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.objects.named<Usage>(Usage.JAVA_RUNTIME)
- )
- it.attribute(
- Category.CATEGORY_ATTRIBUTE,
- project.objects.named<Category>(Category.LIBRARY)
- )
- it.attribute(
- GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE,
- project.objects.named<GradlePluginApiVersion>(
- GradleVersion.current().getVersion()
- )
- )
- }
-
- project
- .configurations
- .flatMap {
- it.allDependencies
- .filterIsInstance(ExternalDependency::class.java)
- .filterNot {
- it.group?.startsWith("com.android") == true
+ project.configurations
+ .flatMap {
+ it.allDependencies
+ .filterIsInstance(ExternalDependency::class.java)
+ .filterNot { it.group?.startsWith("com.android") == true }
+ .filterNot { it.group?.startsWith("android.arch") == true }
+ .filterNot { it.group?.startsWith("androidx") == true }
}
- .filterNot {
- it.group?.startsWith("android.arch") == true
- }
- .filterNot {
- it.group?.startsWith("androidx") == true
- }
+ .forEach { checkerConfig.dependencies.add(it) }
}
- .forEach {
- checkerConfig.dependencies.add(it)
- }
- }
val localArtifactRepositories = project.findLocalMavenRepositories()
- val dependencyArtifacts = checkerConfig.incoming.artifacts.artifacts.mapNotNull {
- project.validateAndGetArtifactInPrebuilts(it, localArtifactRepositories)
- }
+ val dependencyArtifacts =
+ checkerConfig.incoming.artifacts.artifacts.mapNotNull {
+ project.validateAndGetArtifactInPrebuilts(it, localArtifactRepositories)
+ }
dependencyArtifacts
}
@@ -170,28 +160,28 @@
}
/**
- * Checks if the given [ResolvedArtifactResult] resolves to an artifact in prebuilts and if
- * so, returns that File.
+ * Checks if the given [ResolvedArtifactResult] resolves to an artifact in prebuilts and if so,
+ * returns that File.
*
- * Note that, when artifacts are published with gradle metadata, the actual resolved file may
- * not reside in prebuilts directory. For those cases, this code re-resolves the artifact
- * from the [repoPaths] and returns the file in prebuilts instead.
+ * Note that, when artifacts are published with gradle metadata, the actual resolved file may not
+ * reside in prebuilts directory. For those cases, this code re-resolves the artifact from the
+ * [repoPaths] and returns the file in prebuilts instead.
*
* Returns null if the file does not exist in prebuilts. When it is an error (files outside
* prebuitls filder is allowed for IDE plugins), throws a [GradleException].
*
* @param resolvedArtifact Resolved artifact from the configuration
* @param repoPaths List of local maven repositories that can be used to resolve the artifact.
- *
* @return The artifact in prebuilts or null if it does not exist.
*/
private fun Project.validateAndGetArtifactInPrebuilts(
resolvedArtifact: ResolvedArtifactResult,
repoPaths: FileCollection
): File? {
- val fileInPrebuilts = repoPaths.any { repoPath ->
- resolvedArtifact.file.absolutePath.startsWith(repoPath.absolutePath)
- }
+ val fileInPrebuilts =
+ repoPaths.any { repoPath ->
+ resolvedArtifact.file.absolutePath.startsWith(repoPath.absolutePath)
+ }
if (fileInPrebuilts) {
return resolvedArtifact.file
}
@@ -204,8 +194,7 @@
// artifact.
// For a module: com.google:artifact:1.2.3; the path would be
// <repo-root>/com/google/artifact/1.2.3
- val subFolder = (id.group.split('.') + id.module + id.version)
- .joinToString(File.separator)
+ val subFolder = (id.group.split('.') + id.module + id.version).joinToString(File.separator)
// if it exists in one of the local repositories, return it.
repoPaths.forEach {
val artifactFolder = it.resolve(subFolder)
@@ -225,16 +214,17 @@
return null
}
-/**
- * Returns the list of local maven repository File paths declared in this project.
- */
+/** Returns the list of local maven repository File paths declared in this project. */
private fun Project.findLocalMavenRepositories(): FileCollection {
- val fileList = project.repositories.mapNotNull {
- if (it is MavenArtifactRepository && it.url.scheme == "file") {
- it.url
- } else {
- null
- }
- }.map { File(it) }
+ val fileList =
+ project.repositories
+ .mapNotNull {
+ if (it is MavenArtifactRepository && it.url.scheme == "file") {
+ it.url
+ } else {
+ null
+ }
+ }
+ .map { File(it) }
return project.files(fileList)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiCompatibilityTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiCompatibilityTask.kt
index 8fd9bef..b289706 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiCompatibilityTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiCompatibilityTask.kt
@@ -38,9 +38,8 @@
* in another.
*/
@CacheableTask
-abstract class CheckApiCompatibilityTask @Inject constructor(
- workerExecutor: WorkerExecutor
-) : MetalavaTask(workerExecutor) {
+abstract class CheckApiCompatibilityTask @Inject constructor(workerExecutor: WorkerExecutor) :
+ MetalavaTask(workerExecutor) {
// Text file from which the API signatures will be obtained.
@get:Internal // already expressed by getTaskInputs()
abstract val referenceApi: Property<ApiLocation>
@@ -54,8 +53,7 @@
abstract val baselines: Property<ApiBaselinesLocation>
// Version for the current API surface.
- @get:Input
- abstract val version: Property<Version>
+ @get:Input abstract val version: Property<Version>
@PathSensitive(PathSensitivity.RELATIVE)
@InputFiles
@@ -124,26 +122,23 @@
referenceVersion: Version?,
freezeApis: Boolean,
) {
- var args = listOf(
- "--classpath",
- (bootClasspath + dependencyClasspath.files).joinToString(File.pathSeparator),
-
- "--source-files",
- api.toString(),
-
- "--check-compatibility:api:released",
- oldApi.toString(),
-
- "--error-message:compatibility:released",
- if (freezeApis && referenceVersion != null) {
- createFrozenCompatibilityCheckError(referenceVersion.toString())
- } else {
- CompatibilityCheckError
- },
-
- "--warnings-as-errors",
- "--format=v3"
- )
+ var args =
+ listOf(
+ "--classpath",
+ (bootClasspath + dependencyClasspath.files).joinToString(File.pathSeparator),
+ "--source-files",
+ api.toString(),
+ "--check-compatibility:api:released",
+ oldApi.toString(),
+ "--error-message:compatibility:released",
+ if (freezeApis && referenceVersion != null) {
+ createFrozenCompatibilityCheckError(referenceVersion.toString())
+ } else {
+ CompatibilityCheckError
+ },
+ "--warnings-as-errors",
+ "--format=v3"
+ )
if (removedApi != null && removedApi.exists()) {
args = args + listOf("--source-files", removedApi.toString())
}
@@ -166,14 +161,16 @@
currentVersion.minor == referenceVersion.minor &&
referenceVersion.isFinalApi()
-private const val CompatibilityCheckError = """
+private const val CompatibilityCheckError =
+ """
${TERMINAL_RED}Your change has API compatibility issues. Fix the code according to the messages above.$TERMINAL_RESET
If you *intentionally* want to break compatibility, you can suppress it with
./gradlew ignoreApiChange && ./gradlew updateApi
"""
-private fun createFrozenCompatibilityCheckError(referenceVersion: String) = """
+private fun createFrozenCompatibilityCheckError(referenceVersion: String) =
+ """
${TERMINAL_RED}The API surface was finalized in $referenceVersion. Revert the changes noted in the errors above.$TERMINAL_RESET
If you have obtained permission from Android API Council or Jetpack Working Group to bypass this policy, you can suppress this check with:
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiEquivalenceTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiEquivalenceTask.kt
index 5fa1e9e..d0ded6c 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiEquivalenceTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/CheckApiEquivalenceTask.kt
@@ -34,35 +34,32 @@
/** Compares two API txt files against each other. */
@DisableCachingByDefault(because = "Doesn't benefit from caching")
abstract class CheckApiEquivalenceTask : DefaultTask() {
- /**
- * Api file (in the build dir) to check
- */
- @get:Input
- abstract val builtApi: Property<ApiLocation>
+ /** Api file (in the build dir) to check */
+ @get:Input abstract val builtApi: Property<ApiLocation>
- /**
- * Api file (in source control) to compare against
- */
- @get:Input
- abstract val checkedInApis: ListProperty<ApiLocation>
+ /** Api file (in source control) to compare against */
+ @get:Input abstract val checkedInApis: ListProperty<ApiLocation>
- @InputFiles @PathSensitive(PathSensitivity.RELATIVE)
+ @InputFiles
+ @PathSensitive(PathSensitivity.RELATIVE)
fun getTaskInputs(): List<File> {
val checkedInApiLocations = checkedInApis.get()
- val checkedInApiFiles = checkedInApiLocations.flatMap { checkedInApiLocation ->
- listOf(
- checkedInApiLocation.publicApiFile,
- checkedInApiLocation.removedApiFile,
- checkedInApiLocation.restrictedApiFile
- )
- }
+ val checkedInApiFiles =
+ checkedInApiLocations.flatMap { checkedInApiLocation ->
+ listOf(
+ checkedInApiLocation.publicApiFile,
+ checkedInApiLocation.removedApiFile,
+ checkedInApiLocation.restrictedApiFile
+ )
+ }
val builtApiLocation = builtApi.get()
- val builtApiFiles = listOf(
- builtApiLocation.publicApiFile,
- builtApiLocation.removedApiFile,
- builtApiLocation.restrictedApiFile
- )
+ val builtApiFiles =
+ listOf(
+ builtApiLocation.publicApiFile,
+ builtApiLocation.removedApiFile,
+ builtApiLocation.restrictedApiFile
+ )
return checkedInApiFiles + builtApiFiles
}
@@ -89,9 +86,10 @@
if (!b.exists()) {
return "$b does not exist"
}
- val process = ProcessBuilder(listOf("diff", a.toString(), b.toString()))
- .redirectOutput(ProcessBuilder.Redirect.PIPE)
- .start()
+ val process =
+ ProcessBuilder(listOf("diff", a.toString(), b.toString()))
+ .redirectOutput(ProcessBuilder.Redirect.PIPE)
+ .start()
process.waitFor(5, TimeUnit.SECONDS)
var diffLines = process.inputStream.bufferedReader().readLines().toMutableList()
if (diffLines.size > maxSummaryLines) {
@@ -104,7 +102,8 @@
fun checkEqual(expected: File, actual: File) {
if (!FileUtils.contentEquals(expected, actual)) {
val diff = summarizeDiff(expected, actual)
- val message = """API definition has changed
+ val message =
+ """API definition has changed
Declared definition is $expected
True definition is $actual
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiLevels.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiLevels.kt
index 1eab139..10cc8c3 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiLevels.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiLevels.kt
@@ -28,24 +28,24 @@
import org.gradle.kotlin.dsl.named
/**
- * Returns the API files that should be used to generate the API levels metadata.
- * This will not include the current version because the source is used as the current version.
+ * Returns the API files that should be used to generate the API levels metadata. This will not
+ * include the current version because the source is used as the current version.
*/
-fun getFilesForApiLevels(
- apiFiles: Collection<File>,
- currentVersion: Version
-): List<File> {
+fun getFilesForApiLevels(apiFiles: Collection<File>, currentVersion: Version): List<File> {
// Create a map from known versions of the library to signature files
- val versionToFileMap = apiFiles.mapNotNull { file ->
- // Resource API files are not included
- if (ApiLocation.isResourceApiFilename(file.name)) return@mapNotNull null
- val version = Version.parseFilenameOrNull(file.name)
- if (version != null) {
- version to file
- } else {
- null
- }
- }.toMap()
+ val versionToFileMap =
+ apiFiles
+ .mapNotNull { file ->
+ // Resource API files are not included
+ if (ApiLocation.isResourceApiFilename(file.name)) return@mapNotNull null
+ val version = Version.parseFilenameOrNull(file.name)
+ if (version != null) {
+ version to file
+ } else {
+ null
+ }
+ }
+ .toMap()
val filteredVersions = filterVersions(versionToFileMap, currentVersion)
return filteredVersions.map { versionToFileMap.getValue(it) }
@@ -60,10 +60,10 @@
}
/**
- * From the full set of versions, generates a sorted list of the versions to use when generating
- * the API levels metadata. For previous major-minor version cycles, this only includes the
- * latest signature file, because we only want one file per stable release. Does not include any
- * files for the current major-minor version cycle.
+ * From the full set of versions, generates a sorted list of the versions to use when generating the
+ * API levels metadata. For previous major-minor version cycles, this only includes the latest
+ * signature file, because we only want one file per stable release. Does not include any files for
+ * the current major-minor version cycle.
*/
private fun filterVersions(
versionToFileMap: Map<Version, File>,
@@ -87,31 +87,21 @@
return filteredVersions
}
-private fun sameMajorMinor(v1: Version, v2: Version) =
- v1.major == v2.major && v1.minor == v2.minor
+private fun sameMajorMinor(v1: Version, v2: Version) = v1.major == v2.major && v1.minor == v2.minor
private fun Version.roundUp() = Version(this.major, this.minor, this.patch)
-/**
- * Usage attribute to specify the version metadata component.
- */
+/** Usage attribute to specify the version metadata component. */
internal val Project.versionMetadataUsage: Usage
get() = objects.named("library-version-metadata")
-/**
- * Creates a component for the version metadata JSON and registers it for publishing.
- */
-fun Project.registerVersionMetadataComponent(
- generateApiTask: TaskProvider<GenerateApiTask>
-) {
+/** Creates a component for the version metadata JSON and registers it for publishing. */
+fun Project.registerVersionMetadataComponent(generateApiTask: TaskProvider<GenerateApiTask>) {
configurations.create("libraryVersionMetadata") { configuration ->
configuration.isVisible = false
configuration.isCanBeResolved = false
- configuration.attributes.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.versionMetadataUsage
- )
+ configuration.attributes.attribute(Usage.USAGE_ATTRIBUTE, project.versionMetadataUsage)
configuration.attributes.attribute(
Category.CATEGORY_ATTRIBUTE,
objects.named<Category>(Category.DOCUMENTATION)
@@ -122,14 +112,11 @@
)
// The generate API task has many output files, only add the version metadata as an artifact
- val levelsFile = generateApiTask.map { task ->
- task.apiLocation.map { location ->
- location.apiLevelsFile
+ val levelsFile =
+ generateApiTask.map { task ->
+ task.apiLocation.map { location -> location.apiLevelsFile }
}
- }
- configuration.outgoing.artifact(levelsFile) {
- it.classifier = "versionMetadata"
- }
+ configuration.outgoing.artifact(levelsFile) { it.classifier = "versionMetadata" }
registerAsComponentForPublishing(configuration)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiStubClassesTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiStubClassesTask.kt
index 0c68fc9..bb74bba 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiStubClassesTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiStubClassesTask.kt
@@ -25,14 +25,11 @@
import org.gradle.workers.WorkerExecutor
@CacheableTask
-abstract class GenerateApiStubClassesTask @Inject constructor(
- workerExecutor: WorkerExecutor
-) : MetalavaTask(workerExecutor) {
- @get:OutputDirectory
- abstract val apiStubsDirectory: DirectoryProperty
+abstract class GenerateApiStubClassesTask @Inject constructor(workerExecutor: WorkerExecutor) :
+ MetalavaTask(workerExecutor) {
+ @get:OutputDirectory abstract val apiStubsDirectory: DirectoryProperty
- @get:OutputDirectory
- abstract val docStubsDirectory: DirectoryProperty
+ @get:OutputDirectory abstract val docStubsDirectory: DirectoryProperty
@TaskAction
fun generate() {
@@ -40,16 +37,12 @@
listOf(
"--classpath",
(bootClasspath.files + dependencyClasspath.files).joinToString(File.pathSeparator),
-
"--source-path",
sourcePaths.filter { it.exists() }.joinToString(File.pathSeparator),
-
"--stubs",
apiStubsDirectory.get().asFile.path,
-
"--doc-stubs",
docStubsDirectory.get().asFile.path,
-
"--hide",
"HiddenTypedefConstant"
)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiTask.kt
index 60351bb..7afaaf1 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/GenerateApiTask.kt
@@ -41,9 +41,8 @@
* file from the previous API signature files.
*/
@CacheableTask
-abstract class GenerateApiTask @Inject constructor(
- workerExecutor: WorkerExecutor
-) : MetalavaTask(workerExecutor) {
+abstract class GenerateApiTask @Inject constructor(workerExecutor: WorkerExecutor) :
+ MetalavaTask(workerExecutor) {
@get:Internal // already expressed by getApiLintBaseline()
abstract val baselines: Property<ApiBaselinesLocation>
@@ -55,11 +54,9 @@
return if (baseline.exists()) baseline else null
}
- @get:Input
- var targetsJavaConsumers: Boolean = true
+ @get:Input var targetsJavaConsumers: Boolean = true
- @get:Input
- var generateRestrictToLibraryGroupAPIs = true
+ @get:Input var generateRestrictToLibraryGroupAPIs = true
/** Collection of text files to which API signatures will be written. */
@get:Internal // already expressed by getTaskOutputs()
@@ -76,19 +73,15 @@
)
}
- @get:Internal
- abstract val currentVersion: Property<Version>
+ @get:Internal abstract val currentVersion: Property<Version>
/**
* The directory where past API files are stored. Not all files in the directory are used, they
* are filtered in [getPastApiFiles].
*/
- @get:Internal
- abstract var projectApiDirectory: Directory
+ @get:Internal abstract var projectApiDirectory: Directory
- /**
- * An ordered list of the API files to use in generating the API level metadata JSON.
- */
+ /** An ordered list of the API files to use in generating the API level metadata JSON. */
@InputFiles
@PathSensitive(PathSensitivity.NONE)
fun getPastApiFiles(): List<File> {
@@ -100,17 +93,14 @@
check(bootClasspath.files.isNotEmpty()) { "Android boot classpath not set." }
check(sourcePaths.files.isNotEmpty()) { "Source paths not set." }
- val inputs = JavaCompileInputs(
- sourcePaths,
- dependencyClasspath,
- bootClasspath
- )
+ val inputs = JavaCompileInputs(sourcePaths, dependencyClasspath, bootClasspath)
- val levelsArgs = getGenerateApiLevelsArgs(
- getPastApiFiles(),
- currentVersion.get(),
- apiLocation.get().apiLevelsFile
- )
+ val levelsArgs =
+ getGenerateApiLevelsArgs(
+ getPastApiFiles(),
+ currentVersion.get(),
+ apiLocation.get().apiLevelsFile
+ )
generateApi(
metalavaClasspath,
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaRunner.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaRunner.kt
index 97feef8..31bba81 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaRunner.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaRunner.kt
@@ -43,24 +43,25 @@
k2UastEnabled: Boolean,
workerExecutor: WorkerExecutor,
) {
- val allArgs = args + listOf(
- "--hide",
- "HiddenSuperclass", // We allow having a hidden parent class
- "--hide",
- // Removing final from a method does not cause compatibility issues for AndroidX.
- "RemovedFinalStrict",
+ val allArgs =
+ args +
+ listOf(
+ "--hide",
+ "HiddenSuperclass", // We allow having a hidden parent class
+ "--hide",
+ // Removing final from a method does not cause compatibility issues for AndroidX.
+ "RemovedFinalStrict",
+ "--error",
+ "UnresolvedImport",
+ "--delete-empty-removed-signatures",
- "--error",
- "UnresolvedImport",
-
- "--delete-empty-removed-signatures",
-
- // Metalava arguments to suppress compatibility checks for experimental API surfaces.
- "--suppress-compatibility-meta-annotation",
- "androidx.annotation.RequiresOptIn",
- "--suppress-compatibility-meta-annotation",
- "kotlin.RequiresOptIn",
- )
+ // Metalava arguments to suppress compatibility checks for experimental API
+ // surfaces.
+ "--suppress-compatibility-meta-annotation",
+ "androidx.annotation.RequiresOptIn",
+ "--suppress-compatibility-meta-annotation",
+ "kotlin.RequiresOptIn",
+ )
val workQueue = workerExecutor.processIsolation()
workQueue.submit(MetalavaWorkAction::class.java) { parameters ->
parameters.args.set(allArgs)
@@ -75,26 +76,21 @@
val k2UastEnabled: Property<Boolean>
}
-abstract class MetalavaWorkAction @Inject constructor(
- private val execOperations: ExecOperations
-) : WorkAction<MetalavaParams> {
+abstract class MetalavaWorkAction @Inject constructor(private val execOperations: ExecOperations) :
+ WorkAction<MetalavaParams> {
override fun execute() {
val outputStream = ByteArrayOutputStream()
var successful = false
- val k2UastArg = listOfNotNull(
- // Enable Android Lint infrastructure used by Metalava to use K2 UAST
- // (also historically known as FIR) when running Metalava for this module.
- "--Xuse-k2-uast".takeIf {
- parameters.k2UastEnabled.get()
- }
- )
+ val k2UastArg =
+ listOfNotNull(
+ // Enable Android Lint infrastructure used by Metalava to use K2 UAST
+ // (also historically known as FIR) when running Metalava for this module.
+ "--Xuse-k2-uast".takeIf { parameters.k2UastEnabled.get() }
+ )
try {
execOperations.javaexec {
// Intellij core reflects into java.util.ResourceBundle
- it.jvmArgs = listOf(
- "--add-opens",
- "java.base/java.util=ALL-UNNAMED"
- )
+ it.jvmArgs = listOf("--add-opens", "java.base/java.util=ALL-UNNAMED")
it.classpath(parameters.metalavaClasspath.get())
it.mainClass.set("com.android.tools.metalava.Driver")
it.args = parameters.args.get() + k2UastArg
@@ -111,68 +107,74 @@
}
fun Project.getMetalavaClasspath(): FileCollection {
- val configuration = configurations.findByName("metalava") ?: configurations.create("metalava") {
- it.dependencies.add(dependencies.create(getLibraryByName("metalava")))
- }
+ val configuration =
+ configurations.findByName("metalava")
+ ?: configurations.create("metalava") {
+ it.dependencies.add(dependencies.create(getLibraryByName("metalava")))
+ }
return project.files(configuration)
}
fun getApiLintArgs(targetsJavaConsumers: Boolean): List<String> {
- val args = mutableListOf(
- "--api-lint",
- "--hide",
- listOf(
- // The list of checks that are hidden as they are not useful in androidx
- "Enum", // Enums are allowed to be use in androidx
- "CallbackInterface", // With target Java 8, we have default methods
- "ProtectedMember", // We allow using protected members in androidx
- "ManagerLookup", // Managers in androidx are not the same as platform services
- "ManagerConstructor",
- "RethrowRemoteException", // This check is for calls into system_server
- "PackageLayering", // This check is not relevant to androidx.* code.
- "UserHandle", // This check is not relevant to androidx.* code.
- "ParcelableList", // This check is only relevant to android platform that has managers.
+ val args =
+ mutableListOf(
+ "--api-lint",
+ "--hide",
+ listOf(
+ // The list of checks that are hidden as they are not useful in androidx
+ "Enum", // Enums are allowed to be use in androidx
+ "CallbackInterface", // With target Java 8, we have default methods
+ "ProtectedMember", // We allow using protected members in androidx
+ "ManagerLookup", // Managers in androidx are not the same as platform services
+ "ManagerConstructor",
+ "RethrowRemoteException", // This check is for calls into system_server
+ "PackageLayering", // This check is not relevant to androidx.* code.
+ "UserHandle", // This check is not relevant to androidx.* code.
+ "ParcelableList", // This check is only relevant to android platform that has
+ // managers.
- // List of checks that have bugs, but should be enabled once fixed.
- "StaticUtils", // b/135489083
- "StartWithLower", // b/135710527
+ // List of checks that have bugs, but should be enabled once fixed.
+ "StaticUtils", // b/135489083
+ "StartWithLower", // b/135710527
- // The list of checks that are API lint warnings and are yet to be enabled
- "SamShouldBeLast",
+ // The list of checks that are API lint warnings and are yet to be enabled
+ "SamShouldBeLast",
- // We should only treat these as warnings
- "IntentBuilderName",
- "OnNameExpected",
- "UserHandleName"
- ).joinToString(),
- "--error",
- listOf(
- "AllUpper",
- "GetterSetterNames",
- "MinMaxConstant",
- "TopLevelBuilder",
- "BuilderSetStyle",
- "MissingBuildMethod",
- "SetterReturnsThis",
- "OverlappingConstants",
- "IllegalStateException",
- "ListenerLast",
- "ExecutorRegistration",
- "StreamFiles",
- "AbstractInner",
- "NotCloseable",
- "MethodNameTense",
- "UseIcu",
- "NoByteOrShort",
- "CommonArgsFirst",
- "GetterOnBuilder",
- "CallbackMethodName",
- "StaticFinalBuilder",
- "MissingGetterMatchingBuilder",
- "HiddenSuperclass",
- "KotlinOperator"
- ).joinToString()
- )
+ // We should only treat these as warnings
+ "IntentBuilderName",
+ "OnNameExpected",
+ "UserHandleName"
+ )
+ .joinToString(),
+ "--error",
+ listOf(
+ "AllUpper",
+ "GetterSetterNames",
+ "MinMaxConstant",
+ "TopLevelBuilder",
+ "BuilderSetStyle",
+ "MissingBuildMethod",
+ "SetterReturnsThis",
+ "OverlappingConstants",
+ "IllegalStateException",
+ "ListenerLast",
+ "ExecutorRegistration",
+ "StreamFiles",
+ "AbstractInner",
+ "NotCloseable",
+ "MethodNameTense",
+ "UseIcu",
+ "NoByteOrShort",
+ "CommonArgsFirst",
+ "GetterOnBuilder",
+ "CallbackMethodName",
+ "StaticFinalBuilder",
+ "MissingGetterMatchingBuilder",
+ "HiddenSuperclass",
+ "KotlinOperator"
+ )
+ .joinToString()
+ )
if (targetsJavaConsumers) {
args.addAll(listOf("--error", "MissingJvmstatic", "--error", "ArrayReturn"))
} else {
@@ -181,9 +183,7 @@
return args
}
-/**
- * Returns the args needed to generate a version history JSON from the previous API files.
- */
+/** Returns the args needed to generate a version history JSON from the previous API files. */
internal fun getGenerateApiLevelsArgs(
apiFiles: List<File>,
currentVersion: Version,
@@ -191,34 +191,33 @@
): List<String> {
val versions = getVersionsForApiLevels(apiFiles) + currentVersion
- val args = listOf(
- "--generate-api-version-history",
- outputLocation.absolutePath,
- "--api-version-names",
- versions.joinToString(" ")
- )
+ val args =
+ listOf(
+ "--generate-api-version-history",
+ outputLocation.absolutePath,
+ "--api-version-names",
+ versions.joinToString(" ")
+ )
return if (apiFiles.isEmpty()) {
args
} else {
- args + listOf(
- "--api-version-signature-files",
- apiFiles.joinToString(":")
- )
+ args + listOf("--api-version-signature-files", apiFiles.joinToString(":"))
}
}
sealed class GenerateApiMode {
object PublicApi : GenerateApiMode()
+
object AllRestrictedApis : GenerateApiMode()
+
object RestrictToLibraryGroupPrefixApis : GenerateApiMode()
}
sealed class ApiLintMode {
- class CheckBaseline(
- val apiLintBaseline: File,
- val targetsJavaConsumers: Boolean
- ) : ApiLintMode()
+ class CheckBaseline(val apiLintBaseline: File, val targetsJavaConsumers: Boolean) :
+ ApiLintMode()
+
object Skip : ApiLintMode()
}
@@ -280,10 +279,17 @@
workerExecutor: WorkerExecutor,
pathToManifest: String? = null
) {
- val args = getGenerateApiArgs(
- bootClasspath, dependencyClasspath, sourcePaths, outputLocation, generateApiMode,
- apiLintMode, apiLevelsArgs, pathToManifest
- )
+ val args =
+ getGenerateApiArgs(
+ bootClasspath,
+ dependencyClasspath,
+ sourcePaths,
+ outputLocation,
+ generateApiMode,
+ apiLintMode,
+ apiLevelsArgs,
+ pathToManifest
+ )
runMetalavaWithArgs(metalavaClasspath, args, k2UastEnabled, workerExecutor)
}
@@ -302,21 +308,18 @@
pathToManifest: String? = null
): List<String> {
// generate public API txt
- val args = mutableListOf(
- "--classpath",
- (bootClasspath.files + dependencyClasspath.files).joinToString(File.pathSeparator),
+ val args =
+ mutableListOf(
+ "--classpath",
+ (bootClasspath.files + dependencyClasspath.files).joinToString(File.pathSeparator),
+ "--source-path",
+ sourcePaths.filter { it.exists() }.joinToString(File.pathSeparator),
+ "--format=v4",
+ "--output-kotlin-nulls=yes",
+ "--warnings-as-errors"
+ )
- "--source-path",
- sourcePaths.filter { it.exists() }.joinToString(File.pathSeparator),
-
- "--format=v4",
- "--output-kotlin-nulls=yes",
- "--warnings-as-errors"
- )
-
- pathToManifest?.let {
- args += listOf("--manifest", pathToManifest)
- }
+ pathToManifest?.let { args += listOf("--manifest", pathToManifest) }
if (outputLocation != null) {
when (generateApiMode) {
@@ -335,40 +338,42 @@
when (generateApiMode) {
is GenerateApiMode.PublicApi -> {
- args += listOf(
- "--hide-annotation", "androidx.annotation.RestrictTo"
- )
+ args += listOf("--hide-annotation", "androidx.annotation.RestrictTo")
args += listOf("--show-unannotated")
}
- is GenerateApiMode.AllRestrictedApis, GenerateApiMode.RestrictToLibraryGroupPrefixApis -> {
+ is GenerateApiMode.AllRestrictedApis,
+ GenerateApiMode.RestrictToLibraryGroupPrefixApis -> {
// Despite being hidden we still track the following:
// * @RestrictTo(Scope.LIBRARY_GROUP_PREFIX): inter-library APIs
// * @PublishedApi: needs binary stability for inline methods
// * @RestrictTo(Scope.LIBRARY_GROUP): APIs between libraries in non-atomic groups
- args += listOf(
- // hide RestrictTo(LIBRARY), use --show-annotation for RestrictTo with
- // specific arguments
- "--hide-annotation",
- "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY)",
- "--show-annotation",
- "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
- "LIBRARY_GROUP_PREFIX)",
- "--show-annotation",
- "kotlin.PublishedApi",
- "--show-unannotated"
- )
- if (generateApiMode is GenerateApiMode.AllRestrictedApis) {
- args += listOf(
+ args +=
+ listOf(
+ // hide RestrictTo(LIBRARY), use --show-annotation for RestrictTo with
+ // specific arguments
+ "--hide-annotation",
+ "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY)",
"--show-annotation",
"androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
- "LIBRARY_GROUP)"
+ "LIBRARY_GROUP_PREFIX)",
+ "--show-annotation",
+ "kotlin.PublishedApi",
+ "--show-unannotated"
)
+ if (generateApiMode is GenerateApiMode.AllRestrictedApis) {
+ args +=
+ listOf(
+ "--show-annotation",
+ "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
+ "LIBRARY_GROUP)"
+ )
} else {
- args += listOf(
- "--hide-annotation",
- "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
- "LIBRARY_GROUP)"
- )
+ args +=
+ listOf(
+ "--hide-annotation",
+ "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
+ "LIBRARY_GROUP)"
+ )
}
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTask.kt
index 0083bed..9c3cd1d 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTask.kt
@@ -35,21 +35,17 @@
/** Base class for invoking Metalava. */
@CacheableTask
-abstract class MetalavaTask @Inject constructor(
- @Internal
- protected val workerExecutor: WorkerExecutor
-) : DefaultTask() {
+abstract class MetalavaTask
+@Inject
+constructor(@Internal protected val workerExecutor: WorkerExecutor) : DefaultTask() {
/** Classpath containing Metalava and its dependencies. */
- @get:Classpath
- abstract val metalavaClasspath: ConfigurableFileCollection
+ @get:Classpath abstract val metalavaClasspath: ConfigurableFileCollection
/** Android's boot classpath */
- @get:Classpath
- lateinit var bootClasspath: FileCollection
+ @get:Classpath lateinit var bootClasspath: FileCollection
/** Dependencies of [sourcePaths]. */
- @get:Classpath
- lateinit var dependencyClasspath: FileCollection
+ @get:Classpath lateinit var dependencyClasspath: FileCollection
/** Source files against which API signatures will be validated. */
@get:[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
@@ -58,8 +54,7 @@
@get:[Optional InputFile PathSensitive(PathSensitivity.NONE)]
abstract val manifestPath: RegularFileProperty
- @get:Input
- abstract val k2UastEnabled: Property<Boolean>
+ @get:Input abstract val k2UastEnabled: Property<Boolean>
fun runWithArgs(args: List<String>) {
runMetalavaWithArgs(metalavaClasspath, args, k2UastEnabled.get(), workerExecutor)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTasks.kt
index 0b63a70..b2d7218 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/MetalavaTasks.kt
@@ -48,30 +48,27 @@
// binary compatibility for APIs annotated with @RestrictTo(LIBRARY_GROUP). This is
// implemented by excluding APIs with this annotation from the restricted API file.
val generateRestrictToLibraryGroupAPIs = !extension.mavenGroup!!.requireSameVersion
- val generateApi = project.tasks.register("generateApi", GenerateApiTask::class.java) {
- task ->
+ val generateApi =
+ project.tasks.register("generateApi", GenerateApiTask::class.java) { task ->
+ task.group = "API"
+ task.description = "Generates API files from source"
+ task.apiLocation.set(builtApiLocation)
+ task.metalavaClasspath.from(metalavaClasspath)
+ task.generateRestrictToLibraryGroupAPIs = generateRestrictToLibraryGroupAPIs
+ task.baselines.set(baselinesApiLocation)
+ task.targetsJavaConsumers = extension.targetsJavaConsumers
+ task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
- task.group = "API"
- task.description = "Generates API files from source"
- task.apiLocation.set(builtApiLocation)
- task.metalavaClasspath.from(metalavaClasspath)
- task.generateRestrictToLibraryGroupAPIs = generateRestrictToLibraryGroupAPIs
- task.baselines.set(baselinesApiLocation)
- task.targetsJavaConsumers = extension.targetsJavaConsumers
- task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
+ // Arguments needed for generating the API levels JSON
+ task.projectApiDirectory = project.layout.projectDirectory.dir("api")
+ task.currentVersion.set(version)
- // Arguments needed for generating the API levels JSON
- task.projectApiDirectory = project.layout.projectDirectory.dir("api")
- task.currentVersion.set(version)
-
- processManifest?.let {
- task.manifestPath.set(processManifest.manifestOutputFile)
+ processManifest?.let { task.manifestPath.set(processManifest.manifestOutputFile) }
+ applyInputs(javaCompileInputs, task)
+ // If we will be updating the api lint baselines, then we should do that before
+ // using it to validate the generated api
+ task.mustRunAfter("updateApiLintBaseline")
}
- applyInputs(javaCompileInputs, task)
- // If we will be updating the api lint baselines, then we should do that before
- // using it to validate the generated api
- task.mustRunAfter("updateApiLintBaseline")
- }
project.registerVersionMetadataComponent(generateApi)
// Policy: If the artifact has previously been released, e.g. has a beta or later API file
@@ -80,77 +77,73 @@
var checkApiRelease: TaskProvider<CheckApiCompatibilityTask>? = null
var ignoreApiChanges: TaskProvider<IgnoreApiChangesTask>? = null
project.getRequiredCompatibilityApiLocation()?.let { lastReleasedApiFile ->
- checkApiRelease = project.tasks.register(
- "checkApiRelease",
- CheckApiCompatibilityTask::class.java
+ checkApiRelease =
+ project.tasks.register("checkApiRelease", CheckApiCompatibilityTask::class.java) {
+ task ->
+ task.metalavaClasspath.from(metalavaClasspath)
+ task.referenceApi.set(lastReleasedApiFile)
+ task.baselines.set(baselinesApiLocation)
+ task.api.set(builtApiLocation)
+ task.version.set(version)
+ task.dependencyClasspath = javaCompileInputs.dependencyClasspath
+ task.bootClasspath = javaCompileInputs.bootClasspath
+ task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
+ task.cacheEvenIfNoOutputs()
+ task.dependsOn(generateApi)
+ }
+
+ ignoreApiChanges =
+ project.tasks.register("ignoreApiChanges", IgnoreApiChangesTask::class.java) { task
+ ->
+ task.metalavaClasspath.from(metalavaClasspath)
+ task.referenceApi.set(checkApiRelease!!.flatMap { it.referenceApi })
+ task.baselines.set(checkApiRelease!!.flatMap { it.baselines })
+ task.api.set(builtApiLocation)
+ task.version.set(version)
+ task.dependencyClasspath = javaCompileInputs.dependencyClasspath
+ task.bootClasspath = javaCompileInputs.bootClasspath
+ task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
+ task.dependsOn(generateApi)
+ }
+ }
+
+ val updateApiLintBaseline =
+ project.tasks.register(
+ "updateApiLintBaseline",
+ UpdateApiLintBaselineTask::class.java
) { task ->
task.metalavaClasspath.from(metalavaClasspath)
- task.referenceApi.set(lastReleasedApiFile)
task.baselines.set(baselinesApiLocation)
- task.api.set(builtApiLocation)
- task.version.set(version)
- task.dependencyClasspath = javaCompileInputs.dependencyClasspath
- task.bootClasspath = javaCompileInputs.bootClasspath
+ task.targetsJavaConsumers.set(extension.targetsJavaConsumers)
task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
- task.cacheEvenIfNoOutputs()
- task.dependsOn(generateApi)
+ processManifest?.let { task.manifestPath.set(processManifest.manifestOutputFile) }
+ applyInputs(javaCompileInputs, task)
}
- ignoreApiChanges = project.tasks.register(
- "ignoreApiChanges",
- IgnoreApiChangesTask::class.java
- ) { task ->
- task.metalavaClasspath.from(metalavaClasspath)
- task.referenceApi.set(checkApiRelease!!.flatMap { it.referenceApi })
- task.baselines.set(checkApiRelease!!.flatMap { it.baselines })
- task.api.set(builtApiLocation)
- task.dependencyClasspath = javaCompileInputs.dependencyClasspath
- task.bootClasspath = javaCompileInputs.bootClasspath
- task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
- task.dependsOn(generateApi)
- }
- }
-
- val updateApiLintBaseline = project.tasks.register(
- "updateApiLintBaseline",
- UpdateApiLintBaselineTask::class.java
- ) { task ->
- task.metalavaClasspath.from(metalavaClasspath)
- task.baselines.set(baselinesApiLocation)
- task.targetsJavaConsumers.set(extension.targetsJavaConsumers)
- task.k2UastEnabled.set(extension.metalavaK2UastEnabled)
- processManifest?.let {
- task.manifestPath.set(processManifest.manifestOutputFile)
- }
- applyInputs(javaCompileInputs, task)
- }
-
// Policy: All changes to API surfaces for which compatibility is enforced must be
// explicitly confirmed by running the updateApi task. To enforce this, the implementation
// checks the "work-in-progress" built API file against the checked in current API file.
val checkApi =
project.tasks.register("checkApi", CheckApiEquivalenceTask::class.java) { task ->
task.group = "API"
- task.description = "Checks that the API generated from source code matches the " +
- "checked in API file"
+ task.description =
+ "Checks that the API generated from source code matches the " +
+ "checked in API file"
task.builtApi.set(generateApi.flatMap { it.apiLocation })
task.cacheEvenIfNoOutputs()
task.checkedInApis.set(outputApiLocations)
task.dependsOn(generateApi)
- checkApiRelease?.let {
- task.dependsOn(checkApiRelease)
- }
+ checkApiRelease?.let { task.dependsOn(checkApiRelease) }
}
- val regenerateOldApis = project.tasks.register(
- "regenerateOldApis",
- RegenerateOldApisTask::class.java
- ) { task ->
- task.group = "API"
- task.description = "Regenerates historic API .txt files using the " +
- "corresponding prebuilt and the latest Metalava"
- task.generateRestrictToLibraryGroupAPIs = generateRestrictToLibraryGroupAPIs
- }
+ val regenerateOldApis =
+ project.tasks.register("regenerateOldApis", RegenerateOldApisTask::class.java) { task ->
+ task.group = "API"
+ task.description =
+ "Regenerates historic API .txt files using the " +
+ "corresponding prebuilt and the latest Metalava"
+ task.generateRestrictToLibraryGroupAPIs = generateRestrictToLibraryGroupAPIs
+ }
// ignoreApiChanges depends on the output of this task for the "last released" API
// surface. Make sure it always runs *after* the regenerateOldApis task.
@@ -160,32 +153,35 @@
// *after* the regenerateOldApis task.
checkApiRelease?.configure { it.mustRunAfter(regenerateOldApis) }
- val updateApi = project.tasks.register("updateApi", UpdateApiTask::class.java) { task ->
- task.group = "API"
- task.description = "Updates the checked in API files to match source code API"
- task.inputApiLocation.set(generateApi.flatMap { it.apiLocation })
- task.outputApiLocations.set(checkApi.flatMap { it.checkedInApis })
- task.dependsOn(generateApi)
+ val updateApi =
+ project.tasks.register("updateApi", UpdateApiTask::class.java) { task ->
+ task.group = "API"
+ task.description = "Updates the checked in API files to match source code API"
+ task.inputApiLocation.set(generateApi.flatMap { it.apiLocation })
+ task.outputApiLocations.set(checkApi.flatMap { it.checkedInApis })
+ task.dependsOn(generateApi)
- // If a developer (accidentally) makes a non-backwards compatible change to an API,
- // the developer will want to be informed of it as soon as possible. So, whenever a
- // developer updates an API, if backwards compatibility checks are enabled in the
- // library, then we want to check that the changes are backwards compatible.
- checkApiRelease?.let { task.dependsOn(it) }
- }
+ // If a developer (accidentally) makes a non-backwards compatible change to an API,
+ // the developer will want to be informed of it as soon as possible. So, whenever a
+ // developer updates an API, if backwards compatibility checks are enabled in the
+ // library, then we want to check that the changes are backwards compatible.
+ checkApiRelease?.let { task.dependsOn(it) }
+ }
// ignoreApiChanges depends on the output of this task for the "current" API surface.
// Make sure it always runs *after* the updateApi task.
ignoreApiChanges?.configure { it.mustRunAfter(updateApi) }
- val regenerateApis = project.tasks.register("regenerateApis") { task ->
- task.group = "API"
- task.description = "Regenerates current and historic API .txt files using the " +
- "corresponding prebuilt and the latest Metalava, then updates API ignore files"
- task.dependsOn(regenerateOldApis)
- task.dependsOn(updateApi)
- ignoreApiChanges?.let { task.dependsOn(it) }
- }
+ val regenerateApis =
+ project.tasks.register("regenerateApis") { task ->
+ task.group = "API"
+ task.description =
+ "Regenerates current and historic API .txt files using the corresponding " +
+ "prebuilt and the latest Metalava, then updates API ignore files"
+ task.dependsOn(regenerateOldApis)
+ task.dependsOn(updateApi)
+ ignoreApiChanges?.let { task.dependsOn(it) }
+ }
project.addToCheckTask(checkApi)
project.addToBuildOnServer(checkApi)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/RegenerateOldApisTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/RegenerateOldApisTask.kt
index 24ec7ba..9b7a013 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/RegenerateOldApisTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/RegenerateOldApisTask.kt
@@ -37,12 +37,11 @@
/** Generate API signature text files using previously built .jar/.aar artifacts. */
@CacheableTask
-abstract class RegenerateOldApisTask @Inject constructor(
- private val workerExecutor: WorkerExecutor
-) : DefaultTask() {
+abstract class RegenerateOldApisTask
+@Inject
+constructor(private val workerExecutor: WorkerExecutor) : DefaultTask() {
- @Input
- var generateRestrictToLibraryGroupAPIs = true
+ @Input var generateRestrictToLibraryGroupAPIs = true
@TaskAction
fun exec() {
@@ -76,12 +75,7 @@
return validVersions.sorted()
}
- fun regenerate(
- runnerProject: Project,
- groupId: String,
- artifactId: String,
- version: Version
- ) {
+ fun regenerate(runnerProject: Project, groupId: String, artifactId: String, version: Version) {
val mavenId = "$groupId:$artifactId:$version"
val inputs: JavaCompileInputs?
try {
@@ -95,8 +89,14 @@
if (outputApiLocation.publicApiFile.exists()) {
project.logger.lifecycle("Regenerating $mavenId")
generateApi(
- project.getMetalavaClasspath(), inputs, outputApiLocation, ApiLintMode.Skip,
- generateRestrictToLibraryGroupAPIs, emptyList(), false, workerExecutor
+ project.getMetalavaClasspath(),
+ inputs,
+ outputApiLocation,
+ ApiLintMode.Skip,
+ generateRestrictToLibraryGroupAPIs,
+ emptyList(),
+ false,
+ workerExecutor
)
}
}
@@ -109,23 +109,24 @@
}
fun getJars(runnerProject: Project, mavenId: String): FileCollection {
- val configuration = runnerProject.configurations.detachedConfiguration(
- runnerProject.dependencies.create("$mavenId")
- )
+ val configuration =
+ runnerProject.configurations.detachedConfiguration(
+ runnerProject.dependencies.create("$mavenId")
+ )
val resolvedConfiguration = configuration.resolvedConfiguration.resolvedArtifacts
- val dependencyFiles = resolvedConfiguration.map({ artifact ->
- artifact.file
- })
+ val dependencyFiles = resolvedConfiguration.map({ artifact -> artifact.file })
val jars = dependencyFiles.filter({ file -> file.name.endsWith(".jar") })
val aars = dependencyFiles.filter({ file -> file.name.endsWith(".aar") })
- val classesJars = aars.map({ aar ->
- val tree = project.zipTree(aar)
- val classesJar = tree.matching { filter: PatternFilterable ->
- filter.include("classes.jar")
- }.single()
- classesJar
- })
+ val classesJars =
+ aars.map({ aar ->
+ val tree = project.zipTree(aar)
+ val classesJar =
+ tree
+ .matching { filter: PatternFilterable -> filter.include("classes.jar") }
+ .single()
+ classesJar
+ })
val embeddedLibs = getEmbeddedLibs(runnerProject, mavenId)
val undeclaredJarDeps = getUndeclaredJarDeps(runnerProject, mavenId)
return runnerProject.files(jars + classesJars + embeddedLibs + undeclaredJarDeps)
@@ -139,9 +140,10 @@
}
fun getSources(runnerProject: Project, mavenId: String): FileCollection {
- val configuration = runnerProject.configurations.detachedConfiguration(
- runnerProject.dependencies.create(mavenId)
- )
+ val configuration =
+ runnerProject.configurations.detachedConfiguration(
+ runnerProject.dependencies.create(mavenId)
+ )
configuration.isTransitive = false
val sanitizedMavenId = mavenId.replace(":", "-")
@@ -154,9 +156,10 @@
}
fun getEmbeddedLibs(runnerProject: Project, mavenId: String): Collection<File> {
- val configuration = runnerProject.configurations.detachedConfiguration(
- runnerProject.dependencies.create(mavenId)
- )
+ val configuration =
+ runnerProject.configurations.detachedConfiguration(
+ runnerProject.dependencies.create(mavenId)
+ )
configuration.isTransitive = false
val sanitizedMavenId = mavenId.replace(":", "-")
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateApiTask.kt
index ede5678..768c0e7 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateApiTask.kt
@@ -34,15 +34,14 @@
import org.gradle.api.tasks.TaskAction
/**
- * Updates API signature text files.
- * In practice, the values they will be updated to will match the APIs defined by the source code.
+ * Updates API signature text files. In practice, the values they will be updated to will match the
+ * APIs defined by the source code.
*/
@CacheableTask
abstract class UpdateApiTask : DefaultTask() {
/** Text file from which API signatures will be read. */
- @get:Input
- abstract val inputApiLocation: Property<ApiLocation>
+ @get:Input abstract val inputApiLocation: Property<ApiLocation>
/** Text files to which API signatures will be written. */
@get:Internal // outputs are declared in getTaskOutputs()
@@ -52,11 +51,7 @@
@PathSensitive(PathSensitivity.RELATIVE)
fun getTaskInputs(): List<File> {
val inputApi = inputApiLocation.get()
- return listOf(
- inputApi.publicApiFile,
- inputApi.restrictedApiFile,
- inputApi.removedApiFile
- )
+ return listOf(inputApi.publicApiFile, inputApi.restrictedApiFile, inputApi.removedApiFile)
}
@Suppress("unused")
@@ -75,16 +70,8 @@
fun exec() {
for (outputApi in outputApiLocations.get()) {
val inputApi = inputApiLocation.get()
- copy(
- source = inputApi.publicApiFile,
- dest = outputApi.publicApiFile,
- logger = logger
- )
- copy(
- source = inputApi.removedApiFile,
- dest = outputApi.removedApiFile,
- logger = logger
- )
+ copy(source = inputApi.publicApiFile, dest = outputApi.publicApiFile, logger = logger)
+ copy(source = inputApi.removedApiFile, dest = outputApi.removedApiFile, logger = logger)
copy(
source = inputApi.restrictedApiFile,
dest = outputApi.restrictedApiFile,
@@ -94,37 +81,36 @@
}
}
-fun copy(
- source: File,
- dest: File,
- permitOverwriting: Boolean = true,
- logger: Logger? = null
-) {
+fun copy(source: File, dest: File, permitOverwriting: Boolean = true, logger: Logger? = null) {
if (!permitOverwriting) {
- val sourceText = if (source.exists()) {
- source.readText()
- } else {
- ""
- }
+ val sourceText =
+ if (source.exists()) {
+ source.readText()
+ } else {
+ ""
+ }
val overwriting = (dest.exists() && sourceText != dest.readText())
val changing = overwriting || (dest.exists() != source.exists())
if (changing) {
if (overwriting) {
val diff = summarizeDiff(source, dest, maxDiffLines + 1)
- val diffMsg = if (compareLineCount(diff, maxDiffLines) > 0) {
- "Diff is greater than $maxDiffLines lines, use diff tool to compare.\n\n"
- } else {
- "Diff:\n$diff\n\n"
- }
- val message = "Modifying the API definition for a previously released artifact " +
- "having a final API version (version not ending in '-alpha') is not " +
- "allowed.\n\n" +
- "Previously declared definition is $dest\n" +
- "Current generated definition is $source\n\n" +
- diffMsg +
- "Did you mean to increment the library version first?\n\n" +
- "If you have a valid reason to override Semantic Versioning policy, see " +
- "go/androidx/versioning#beta-api-change for information on obtaining approval."
+ val diffMsg =
+ if (compareLineCount(diff, maxDiffLines) > 0) {
+ "Diff is greater than $maxDiffLines lines, use diff tool to compare.\n\n"
+ } else {
+ "Diff:\n$diff\n\n"
+ }
+ val message =
+ "Modifying the API definition for a previously released artifact " +
+ "having a final API version (version not ending in '-alpha') is not " +
+ "allowed.\n\n" +
+ "Previously declared definition is $dest\n" +
+ "Current generated definition is $source\n\n" +
+ diffMsg +
+ "Did you mean to increment the library version first?\n\n" +
+ "If you have a valid reason to override Semantic Versioning policy, see " +
+ "go/androidx/versioning#beta-api-change for information on obtaining " +
+ "approval."
throw GradleException(message)
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateBaselineTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateBaselineTasks.kt
index 9e82b95..29bb09f 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateBaselineTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/metalava/UpdateBaselineTasks.kt
@@ -16,6 +16,7 @@
package androidx.build.metalava
+import androidx.build.Version
import androidx.build.checkapi.ApiBaselinesLocation
import androidx.build.checkapi.ApiLocation
import java.io.File
@@ -33,39 +34,40 @@
import org.gradle.workers.WorkerExecutor
@CacheableTask
-abstract class UpdateApiLintBaselineTask @Inject constructor(
- workerExecutor: WorkerExecutor
-) : MetalavaTask(workerExecutor) {
+abstract class UpdateApiLintBaselineTask @Inject constructor(workerExecutor: WorkerExecutor) :
+ MetalavaTask(workerExecutor) {
init {
group = "API"
- description = "Updates an API lint baseline file (api/api_lint.ignore) to match the " +
- "current set of violations. Only use a baseline " +
- "if you are in a library without Android dependencies, or when enabling a new " +
- "lint check, and it is prohibitively expensive / not possible to fix the errors " +
- "generated by enabling this lint check. "
+ description =
+ "Updates an API lint baseline file (api/api_lint.ignore) to match the " +
+ "current set of violations. Only use a baseline " +
+ "if you are in a library without Android dependencies, or when enabling a new " +
+ "lint check, and it is prohibitively expensive / not possible to fix the errors " +
+ "generated by enabling this lint check. "
}
- @get:Input
- abstract val baselines: Property<ApiBaselinesLocation>
+ @get:Input abstract val baselines: Property<ApiBaselinesLocation>
- @get:Input
- abstract val targetsJavaConsumers: Property<Boolean>
+ @get:Input abstract val targetsJavaConsumers: Property<Boolean>
- @OutputFile
- fun getApiLintBaseline(): File = baselines.get().apiLintFile
+ @OutputFile fun getApiLintBaseline(): File = baselines.get().apiLintFile
@TaskAction
fun updateBaseline() {
check(bootClasspath.files.isNotEmpty()) { "Android boot classpath not set." }
val baselineFile = baselines.get().apiLintFile
- val checkArgs = getGenerateApiArgs(
- bootClasspath, dependencyClasspath,
- sourcePaths.files.filter { it.exists() }, null, GenerateApiMode.PublicApi,
- ApiLintMode.CheckBaseline(baselineFile, targetsJavaConsumers.get()),
- // API version history doesn't need to be generated
- emptyList(),
- manifestPath.orNull?.asFile?.absolutePath
- )
+ val checkArgs =
+ getGenerateApiArgs(
+ bootClasspath,
+ dependencyClasspath,
+ sourcePaths.files.filter { it.exists() },
+ null,
+ GenerateApiMode.PublicApi,
+ ApiLintMode.CheckBaseline(baselineFile, targetsJavaConsumers.get()),
+ // API version history doesn't need to be generated
+ emptyList(),
+ manifestPath.orNull?.asFile?.absolutePath
+ )
val args = checkArgs + getCommonBaselineUpdateArgs(baselineFile)
runWithArgs(args)
@@ -73,95 +75,97 @@
}
@CacheableTask
-abstract class IgnoreApiChangesTask @Inject constructor(
- workerExecutor: WorkerExecutor
-) : MetalavaTask(workerExecutor) {
+abstract class IgnoreApiChangesTask @Inject constructor(workerExecutor: WorkerExecutor) :
+ MetalavaTask(workerExecutor) {
init {
- description = "Updates an API tracking baseline file (api/X.Y.Z.ignore) to match the " +
- "current set of violations"
+ description =
+ "Updates an API tracking baseline file (api/X.Y.Z.ignore) to match the " +
+ "current set of violations"
}
// The API that the library is supposed to be compatible with
- @get:Input
- abstract val referenceApi: Property<ApiLocation>
+ @get:Input abstract val referenceApi: Property<ApiLocation>
- @get:Input
- abstract val api: Property<ApiLocation>
+ @get:Input abstract val api: Property<ApiLocation>
// The baseline files (api/*.*.*.ignore) to update
- @get:Input
- abstract val baselines: Property<ApiBaselinesLocation>
+ @get:Input abstract val baselines: Property<ApiBaselinesLocation>
+
+ // Version for the current API surface.
+ @get:Input abstract val version: Property<Version>
@[InputFiles PathSensitive(PathSensitivity.RELATIVE)]
fun getTaskInputs(): List<File> {
val referenceApiLocation = referenceApi.get()
- return listOf(
- referenceApiLocation.publicApiFile,
- referenceApiLocation.restrictedApiFile
- )
+ return listOf(referenceApiLocation.publicApiFile, referenceApiLocation.restrictedApiFile)
}
// Declaring outputs prevents Gradle from rerunning this task if the inputs haven't changed
@OutputFiles
fun getTaskOutputs(): List<File>? {
val apiBaselinesLocation = baselines.get()
- return listOf(
- apiBaselinesLocation.publicApiFile,
- apiBaselinesLocation.restrictedApiFile
- )
+ return listOf(apiBaselinesLocation.publicApiFile, apiBaselinesLocation.restrictedApiFile)
}
@TaskAction
fun exec() {
check(bootClasspath.files.isNotEmpty()) { "Android boot classpath not set." }
+ val apiLocation = api.get()
+ val referenceApiLocation = referenceApi.get()
+ val freezeApis = shouldFreezeApis(referenceApiLocation.version(), version.get())
updateBaseline(
- api.get().publicApiFile,
- referenceApi.get().publicApiFile,
+ apiLocation.publicApiFile,
+ referenceApiLocation.publicApiFile,
baselines.get().publicApiFile,
- false
+ false,
+ freezeApis
)
- if (referenceApi.get().restrictedApiFile.exists()) {
+ if (referenceApiLocation.restrictedApiFile.exists()) {
updateBaseline(
- api.get().restrictedApiFile,
- referenceApi.get().restrictedApiFile,
+ apiLocation.restrictedApiFile,
+ referenceApiLocation.restrictedApiFile,
baselines.get().restrictedApiFile,
- true
+ true,
+ freezeApis
)
}
}
- // Updates the contents of baselineFile to specify an exception for every API present in apiFile but not
+ // Updates the contents of baselineFile to specify an exception for every API present in apiFile
+ // but not
// present in the current source path
private fun updateBaseline(
api: File,
prevApi: File,
baselineFile: File,
- processRestrictedApis: Boolean
+ processRestrictedApis: Boolean,
+ freezeApis: Boolean,
) {
- val args = getCommonBaselineUpdateArgs(
- bootClasspath,
- dependencyClasspath,
- baselineFile
- )
- args += listOf(
- "--baseline",
- baselineFile.toString(),
- "--check-compatibility:api:released",
- prevApi.toString(),
- "--source-files",
- api.toString()
- )
- if (processRestrictedApis) {
- args += listOf(
- "--show-annotation",
- "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
- "LIBRARY_GROUP)",
- "--show-annotation",
- "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
- "LIBRARY_GROUP_PREFIX)",
- "--show-unannotated"
+ val args = getCommonBaselineUpdateArgs(bootClasspath, dependencyClasspath, baselineFile)
+ args +=
+ listOf(
+ "--baseline",
+ baselineFile.toString(),
+ "--check-compatibility:api:released",
+ prevApi.toString(),
+ "--source-files",
+ api.toString()
)
+ if (freezeApis) {
+ args += listOf("--error-category", "Compatibility")
+ }
+ if (processRestrictedApis) {
+ args +=
+ listOf(
+ "--show-annotation",
+ "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
+ "LIBRARY_GROUP)",
+ "--show-annotation",
+ "androidx.annotation.RestrictTo(androidx.annotation.RestrictTo.Scope." +
+ "LIBRARY_GROUP_PREFIX)",
+ "--show-unannotated"
+ )
}
runWithArgs(args)
}
@@ -172,10 +176,11 @@
dependencyClasspath: FileCollection,
baselineFile: File
): MutableList<String> {
- val args = mutableListOf(
- "--classpath",
- (bootClasspath.files + dependencyClasspath.files).joinToString(File.pathSeparator)
- )
+ val args =
+ mutableListOf(
+ "--classpath",
+ (bootClasspath.files + dependencyClasspath.files).joinToString(File.pathSeparator)
+ )
args += getCommonBaselineUpdateArgs(baselineFile)
return args
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/AndroidXPaparazziImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/AndroidXPaparazziImplPlugin.kt
index b980843..ec08a58 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/AndroidXPaparazziImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/AndroidXPaparazziImplPlugin.kt
@@ -28,8 +28,10 @@
import org.gradle.api.Project
import org.gradle.api.artifacts.type.ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE
import org.gradle.api.artifacts.type.ArtifactTypeDefinition.JAR_TYPE
+import org.gradle.api.file.Directory
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
+import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.testing.Test
@@ -39,12 +41,10 @@
import org.gradle.kotlin.dsl.withType
import org.gradle.process.JavaForkOptions
-/**
- * Configures screenshot testing using Paparazzi for AndroidX projects.
- */
-class AndroidXPaparazziImplPlugin @Inject constructor(
- private val fileSystemOperations: FileSystemOperations
-) : Plugin<Project> {
+/** Configures screenshot testing using Paparazzi for AndroidX projects. */
+class AndroidXPaparazziImplPlugin
+@Inject
+constructor(private val fileSystemOperations: FileSystemOperations) : Plugin<Project> {
override fun apply(project: Project) {
val paparazziNative = project.createUnzippedPaparazziNativeDependency()
project.afterEvaluate { it.addTestUtilsDependency() }
@@ -58,8 +58,8 @@
}
/**
- * Add project's golden directory and the unzipped native Paparazzi location as task inputs,
- * and set system properties for the test library to consume at runtime.
+ * Add project's golden directory and the unzipped native Paparazzi location as task inputs, and
+ * set system properties for the test library to consume at runtime.
*/
private fun Test.configureTestTask(paparazziNative: FileCollection) {
val compileSdkVersion = project.defaultAndroidConfig.compileSdk
@@ -67,26 +67,30 @@
val cachedGoldenRootDirectory = project.goldenRootDirectory
val cachedReportDirectory = reportDirectory
val android = project.the<BaseExtension>()
- val packageName = requireNotNull(android.namespace) {
- "android.namespace must be set for Paparazzi"
- }
+ val packageName =
+ requireNotNull(android.namespace) { "android.namespace must be set for Paparazzi" }
// Attach unzipped Paparazzi native directory as a task input
- inputs.files(paparazziNative)
+ inputs
+ .files(paparazziNative)
.withPathSensitivity(PathSensitivity.NONE)
.withPropertyName("paparazziNative")
// Attach golden directory to task inputs to invalidate tests when updating goldens
- inputs.dir(project.goldenDirectory)
+ inputs
+ .dir(project.goldenDirectory)
.withPathSensitivity(PathSensitivity.RELATIVE)
.withPropertyName("goldenDirectory")
// Mark report directory as an output directory
- outputs.dir(reportDirectory)
- .withPropertyName("paparazziReportDir")
+ outputs.dir(reportDirectory).withPropertyName("paparazziReportDir")
// Clean the contents of the report directory before each test run
- doFirst { fileSystemOperations.delete { it.delete(cachedReportDirectory.listFiles()) } }
+ doFirst {
+ fileSystemOperations.delete {
+ it.delete(cachedReportDirectory.get().asFile.listFiles())
+ }
+ }
// Set non-path system properties at configuration time, so that changes invalidate caching
prefixedSystemProperties(
@@ -105,7 +109,7 @@
"platformDir" to platformDirectory.canonicalPath,
"assetsDir" to ".", // TODO: Merged assets dirs? (needed for compose?)
"resDir" to ".", // TODO: Merged resource dirs? (needed for compose?)
- "reportDir" to cachedReportDirectory.canonicalPath,
+ "reportDir" to cachedReportDirectory.get().asFile.canonicalPath,
"goldenRootDir" to cachedGoldenRootDirectory.canonicalPath,
)
}
@@ -136,14 +140,15 @@
* Paparazzi native layoutlib dependency, using the version in `libs.versions.toml`.
*/
private fun Project.createUnzippedPaparazziNativeDependency(): FileCollection {
- val platformSuffix = when (val os = getOperatingSystem()) {
- OperatingSystem.LINUX -> "LinuxX64"
- OperatingSystem.MAC -> {
- val arch = System.getProperty("os.arch")
- if (arch.startsWith("x86", ignoreCase = true)) "MacOsX64" else "MacOsArm64"
+ val platformSuffix =
+ when (val os = getOperatingSystem()) {
+ OperatingSystem.LINUX -> "LinuxX64"
+ OperatingSystem.MAC -> {
+ val arch = System.getProperty("os.arch")
+ if (arch.startsWith("x86", ignoreCase = true)) "MacOsX64" else "MacOsArm64"
+ }
+ else -> error("Unsupported operating system $os for Paparazzi")
}
- else -> error("Unsupported operating system $os for Paparazzi")
- }
dependencies.registerTransform(UnzipPaparazziNativeTransform::class.java) { spec ->
spec.from.attribute(ARTIFACT_TYPE_ATTRIBUTE, JAR_TYPE)
@@ -155,9 +160,11 @@
dependencies.create(getLibraryByName("paparazziNative$platformSuffix"))
)
- return configuration.incoming.artifactView {
- it.attributes.attribute(ARTIFACT_TYPE_ATTRIBUTE, UNZIPPED_PAPARAZZI_NATIVE)
- }.files
+ return configuration.incoming
+ .artifactView {
+ it.attributes.attribute(ARTIFACT_TYPE_ATTRIBUTE, UNZIPPED_PAPARAZZI_NATIVE)
+ }
+ .files
}
/** The golden image directory for this project. */
@@ -173,14 +180,14 @@
get() = path.replace(':', '/').trim('/')
/** Output directory for storing reports and images. */
- private val Test.reportDirectory
- get() = project.buildDir.resolve("paparazzi").resolve(name)
+ private val Test.reportDirectory: Provider<Directory>
+ get() = project.layout.buildDirectory.dir("paparazzi/$name")
/** Add a testImplementation dependency on the wrapper test utils library. */
private fun Project.addTestUtilsDependency() {
- configurations["testImplementation"].dependencies.add(
- dependencies.create(project(TEST_UTILS_PROJECT))
- )
+ configurations["testImplementation"]
+ .dependencies
+ .add(dependencies.create(project(TEST_UTILS_PROJECT)))
}
private companion object {
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/UnzipPaparazziNativeTransform.kt b/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/UnzipPaparazziNativeTransform.kt
index 0af7ef7..9d7e8c6 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/UnzipPaparazziNativeTransform.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/paparazzi/UnzipPaparazziNativeTransform.kt
@@ -57,4 +57,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
index f09eb2f..2778116 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/playground/VerifyPlaygroundGradleConfigurationTask.kt
@@ -32,9 +32,9 @@
import org.gradle.api.tasks.TaskProvider
/**
- * Compares the playground Gradle configuration with the main androidx Gradle configuration
- * to ensure playgrounds do not define any property in their own build that conflicts with the
- * main build.
+ * Compares the playground Gradle configuration with the main androidx Gradle configuration to
+ * ensure playgrounds do not define any property in their own build that conflicts with the main
+ * build.
*/
@CacheableTask
abstract class VerifyPlaygroundGradleConfigurationTask : DefaultTask() {
@@ -54,8 +54,7 @@
@get:PathSensitive(PathSensitivity.NONE)
abstract val playgroundGradleWrapper: RegularFileProperty
- @get:OutputFile
- abstract val outputFile: RegularFileProperty
+ @get:OutputFile abstract val outputFile: RegularFileProperty
@TaskAction
fun checkPlaygroundGradleConfiguration() {
@@ -74,25 +73,22 @@
}
private fun compareGradleWrapperVersion() {
- val androidxGradleVersion = readGradleVersionFromWrapperProperties(
- androidxGradleWrapper.get().asFile
- )
- val playgroundGradleVersion = readGradleVersionFromWrapperProperties(
- playgroundGradleWrapper.get().asFile
- )
+ val androidxGradleVersion =
+ readGradleVersionFromWrapperProperties(androidxGradleWrapper.get().asFile)
+ val playgroundGradleVersion =
+ readGradleVersionFromWrapperProperties(playgroundGradleWrapper.get().asFile)
if (androidxGradleVersion != playgroundGradleVersion) {
throw GradleException(
"""
Playground gradle version ($playgroundGradleVersion) must match the AndroidX main
build gradle version ($androidxGradleVersion).
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
- private fun readGradleVersionFromWrapperProperties(
- file: File
- ): String {
+ private fun readGradleVersionFromWrapperProperties(file: File): String {
val distributionUrl = loadPropertiesFile(file).getProperty("distributionUrl")
checkNotNull(distributionUrl) {
"cannot read distribution url from gradle wrapper file: ${file.canonicalPath}"
@@ -103,10 +99,7 @@
}
}
- private fun validateProperties(
- rootProperties: Properties,
- playgroundProperties: Properties
- ) {
+ private fun validateProperties(rootProperties: Properties, playgroundProperties: Properties) {
// ensure we don't define properties that do not match the root file
// this includes properties that are not defined in the root androidx build as they might
// be properties which can alter the build output. We might consider allow listing certain
@@ -116,9 +109,10 @@
val rootValue = rootProperties[key]
val playgroundValue = playgroundProperties[key]
- if (rootValue != playgroundValue &&
- !ignoredProperties.contains(key) &&
- exceptedProperties[key] != playgroundValue
+ if (
+ rootValue != playgroundValue &&
+ !ignoredProperties.contains(key) &&
+ exceptedProperties[key] != playgroundValue
) {
throw GradleException(
"""
@@ -131,17 +125,15 @@
Note: Having inconsistent properties in playground projects might trigger wrong
compilation output in the main AndroidX build, so if a property is defined in
playground properties, its value **MUST** match that of regular AndroidX build.
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
}
- private fun loadPropertiesFile(file: File) = file.inputStream().use { inputStream ->
- Properties().apply {
- load(inputStream)
- }
- }
+ private fun loadPropertiesFile(file: File) =
+ file.inputStream().use { inputStream -> Properties().apply { load(inputStream) } }
companion object {
private const val TASK_NAME = "verifyPlaygroundGradleConfiguration"
@@ -150,27 +142,27 @@
// androidx-main. Generally, should only be used for conflicting properties which have
// different values in different built targets on AOSP, but still should be declared in
// playground.
- private val exceptedProperties = mapOf(
- "androidx.writeVersionedApiFiles" to "true",
- )
+ private val exceptedProperties =
+ mapOf(
+ "androidx.writeVersionedApiFiles" to "true",
+ )
- private val ignoredProperties = setOf(
- "org.gradle.jvmargs",
- "org.gradle.daemon",
- "android.builder.sdkDownload",
- "android.suppressUnsupportedCompileSdk",
- )
+ private val ignoredProperties =
+ setOf(
+ "org.gradle.jvmargs",
+ "org.gradle.daemon",
+ "android.builder.sdkDownload",
+ "android.suppressUnsupportedCompileSdk",
+ )
/**
- * Regular expression to extract the gradle version from a distributionUrl property.
- * Sample input looks like: <some-path>/gradle-7.3-rc-2-all.zip
+ * Regular expression to extract the gradle version from a distributionUrl property. Sample
+ * input looks like: <some-path>/gradle-7.3-rc-2-all.zip
*/
private val GRADLE_VERSION_REGEX = """/gradle-(.+)-(all|bin)\.zip$""".toRegex()
@VisibleForTesting // make it accessible for buildSrc-tests
- fun extractGradleVersion(
- distributionUrl: String
- ): String? {
+ fun extractGradleVersion(distributionUrl: String): String? {
return GRADLE_VERSION_REGEX.find(distributionUrl)?.groupValues?.getOrNull(1)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/Markdown.kt b/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/Markdown.kt
index 498e836..b1f3e6f0 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/Markdown.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/Markdown.kt
@@ -17,18 +17,23 @@
package androidx.build.releasenotes
/** Classes for generating markdown */
-
enum class HeaderType {
- H1, H2, H3, H4, H5, H6;
+ H1,
+ H2,
+ H3,
+ H4,
+ H5,
+ H6;
+
companion object {
fun getHeaderTag(tag: HeaderType): String {
when (tag) {
- H1 -> return("#")
- H2 -> return("##")
- H3 -> return("###")
- H4 -> return("####")
- H5 -> return("#####")
- H6 -> return("######")
+ H1 -> return ("#")
+ H2 -> return ("##")
+ H3 -> return ("###")
+ H4 -> return ("####")
+ H5 -> return ("#####")
+ H6 -> return ("######")
}
}
}
@@ -42,6 +47,7 @@
override fun toString(): String {
return HeaderType.getHeaderTag(markdownType) + ' ' + text
}
+
fun print() {
println(toString())
}
@@ -61,10 +67,9 @@
}
}
-open class MarkdownBoldText(
- inputText: String
-) {
+open class MarkdownBoldText(inputText: String) {
var text: String = ""
+
init {
text = inputText
}
@@ -78,10 +83,9 @@
}
}
-open class MarkdownComment(
- inputText: String
-) {
+open class MarkdownComment(inputText: String) {
var text: String = ""
+
init {
text = inputText
}
@@ -93,4 +97,4 @@
fun print() {
println(toString())
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/ReleaseNoteMarkdown.kt b/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/ReleaseNoteMarkdown.kt
index 3901ffe..ce85adf 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/ReleaseNoteMarkdown.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/releasenotes/ReleaseNoteMarkdown.kt
@@ -21,12 +21,11 @@
import java.time.LocalDate
import java.time.format.DateTimeFormatter
-/**
- * Classes for generating androidx release note specific markdown
- */
+/** Classes for generating androidx release note specific markdown */
/**
* Markdown class for a Library Header in the format:
+ *
* ### Version <version> {:#<version>}
*/
class LibraryHeader(groupId: String, version: String) : MarkdownHeader() {
@@ -40,25 +39,18 @@
* Generates the markdown list of commits with sections defined by enum [CommitType], in the format:
*
* **New Features**
- *
* - <[Commit.summary]> <[getChangeIdAOSPLink]> <[getBuganizerLink] 1> <[getBuganizerLink] 2>...
*
* **API Changes**
- *
* - <[Commit.summary]> <[getChangeIdAOSPLink]> <[getBuganizerLink] 1> <[getBuganizerLink] 2>...
*
* **Bug Fixes**
- *
* - <[Commit.summary]> <[getChangeIdAOSPLink]> <[getBuganizerLink] 1> <[getBuganizerLink] 2>...
*
* **External Contribution**
- *
* - <[Commit.summary]> <[getChangeIdAOSPLink]> <[getBuganizerLink] 1> <[getBuganizerLink] 2>...
- *
*/
-class CommitMarkdownList(
- private var includeAllCommits: Boolean = false
-) {
+class CommitMarkdownList(private var includeAllCommits: Boolean = false) {
private var commits: MutableList<Commit> = mutableListOf()
fun add(commit: Commit) {
@@ -70,32 +62,34 @@
}
private fun makeReleaseNotesSection(sectionCommitType: CommitType): String {
- var sectionHeader: MarkdownBoldText = MarkdownBoldText(
- CommitType.getTitle(sectionCommitType)
- )
+ var sectionHeader: MarkdownBoldText =
+ MarkdownBoldText(CommitType.getTitle(sectionCommitType))
var markdownStringSection: String = ""
- commits.filter { commit ->
- commit.type == sectionCommitType
- }.forEach { commit ->
- // While we are choosing to ignore Release Note field
- val commitString: String = getListItemStr() + if (commit.releaseNote.isNotEmpty())
- commit.getReleaseNoteString() else commit.toString()
- if (includeAllCommits || commit.releaseNote.isNotEmpty()) {
- markdownStringSection = markdownStringSection + commitString
- if (markdownStringSection.last() != '\n') {
- markdownStringSection += '\n'
+ commits
+ .filter { commit -> commit.type == sectionCommitType }
+ .forEach { commit ->
+ // While we are choosing to ignore Release Note field
+ val commitString: String =
+ getListItemStr() +
+ if (commit.releaseNote.isNotEmpty()) commit.getReleaseNoteString()
+ else commit.toString()
+ if (includeAllCommits || commit.releaseNote.isNotEmpty()) {
+ markdownStringSection = markdownStringSection + commitString
+ if (markdownStringSection.last() != '\n') {
+ markdownStringSection += '\n'
+ }
}
+ /* If we are not ignoring Release Note fields (meaning we are respecting it) and
+ * the commit does not contain a Release Note field, then don't include the commit
+ * in the release notes.
+ */
}
- /* If we are not ignoring Release Note fields (meaning we are respecting it) and
- * the commit does not contain a Release Note field, then don't include the commit
- * in the release notes.
- */
- }
- markdownStringSection = if (markdownStringSection.isEmpty()) {
- "\n${MarkdownComment(sectionHeader.toString())}\n\n$markdownStringSection"
- } else {
- "\n$sectionHeader\n\n$markdownStringSection"
- }
+ markdownStringSection =
+ if (markdownStringSection.isEmpty()) {
+ "\n${MarkdownComment(sectionHeader.toString())}\n\n$markdownStringSection"
+ } else {
+ "\n$sectionHeader\n\n$markdownStringSection"
+ }
return markdownStringSection
}
@@ -117,7 +111,6 @@
* @param startSHA the SHA at which to start the diff log (exclusive)
* @param endSHA the last SHA to include in the diff log (inclusive)
* @param projectDir the local directory of the project, in relation to frameworks/support
- *
* @return A [MarkdownLink] to the public Gitiles diff log
*/
fun getGitilesDiffLogLink(startSHA: String, endSHA: String, projectDir: String): MarkdownLink {
@@ -173,12 +166,10 @@
* Data class to contain an array of LibraryReleaseNotes when serializing collections of release
* notes
*/
-data class LibraryReleaseNotesList(
- val list: MutableList<LibraryReleaseNotes> = mutableListOf()
-)
+data class LibraryReleaseNotesList(val list: MutableList<LibraryReleaseNotes> = mutableListOf())
/**
- * Structured release notes class, that connects all parts of the release notes. Create release
+ * Structured release notes class, that connects all parts of the release notes. Create release
* notes in the format:
* <pre>
* <[LibraryHeader]>
@@ -190,21 +181,21 @@
* <[CommitMarkdownList]>
* </pre>
*
+ * @param includeAllCommits Set to true to include all commits, both with and without a release note
+ * field in the commit message. Defaults to false, which means only commits with a release note
+ * field are included in the release notes.
* @property groupId Library GroupId.
* @property artifactIds List of ArtifactIds included in these release notes.
* @property version Version of the library, assuming all artifactIds have the same version.
- * @property releaseDate Date the release will go live. Defaults to the current date.
+ * @property releaseDate Date the release will go live. Defaults to the current date.
* @property fromSHA The oldest SHA to include in the release notes.
* @property untilSHA The newest SHA to be included in the release notes.
* @property projectDir The filepath relative to the parent directory of the .git directory.
- * @property commitList The initial list of Commits to include in these release notes. Defaults to an
- * empty list. Users can always add more commits with [LibraryReleaseNotes.addCommit]
+ * @property commitList The initial list of Commits to include in these release notes. Defaults to
+ * an empty list. Users can always add more commits with [LibraryReleaseNotes.addCommit]
* @property requiresSameVersion True if the groupId of this module requires the same version for
- * all artifactIds in the groupId. When true, uses the GroupId for the release notes
- * header. When false, uses the list of artifactIds for the header.
- * @param includeAllCommits Set to true to include all commits, both with and without a
- * release note field in the commit message. Defaults to false, which means only commits
- * with a release note field are included in the release notes.
+ * all artifactIds in the groupId. When true, uses the GroupId for the release notes header. When
+ * false, uses the list of artifactIds for the header.
*/
class LibraryReleaseNotes(
val groupId: String,
@@ -235,16 +226,15 @@
if (fromSHA == "" || untilSHA == "") {
throw RuntimeException("Tried to create Library Release Notes with an empty SHA!")
}
- header = if (requiresSameVersion) {
- LibraryHeader(groupId, version)
- } else {
- LibraryHeader(artifactIds.joinToString(), version)
- }
+ header =
+ if (requiresSameVersion) {
+ LibraryHeader(groupId, version)
+ } else {
+ LibraryHeader(artifactIds.joinToString(), version)
+ }
diffLogLink = getGitilesDiffLogLink(fromSHA, untilSHA, projectDir)
if (commitList.isNotEmpty()) {
- commitList.forEach { commit ->
- addCommit(commit)
- }
+ commitList.forEach { commit -> addCommit(commit) }
}
}
@@ -284,9 +274,7 @@
}
fun addCommit(newCommit: Commit) {
- newCommit.bugs.forEach { bug ->
- bugsFixed.add(bug)
- }
+ newCommit.bugs.forEach { bug -> bugsFixed.add(bug) }
commits.add(newCommit)
commitMarkdownList.add(newCommit)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiReleaseTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiReleaseTask.kt
index df32518..99897c9 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiReleaseTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiReleaseTask.kt
@@ -29,9 +29,7 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Task for verifying changes in the public Android resource surface, e.g. `public.xml`.
- */
+/** Task for verifying changes in the public Android resource surface, e.g. `public.xml`. */
@CacheableTask
abstract class CheckResourceApiReleaseTask : DefaultTask() {
/** Reference resource API file (in source control). */
@@ -40,8 +38,7 @@
abstract val referenceApiFile: Property<File>
/** Generated resource API file (in build output). */
- @get:Internal
- abstract val apiLocation: Property<ApiLocation>
+ @get:Internal abstract val apiLocation: Property<ApiLocation>
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
@@ -55,11 +52,12 @@
val apiFile = apiLocation.get().resourceFile
// Read the current API surface, if any, into memory.
- val newApiSet = if (apiFile.exists()) {
- apiFile.readLines().toSet()
- } else {
- emptySet()
- }
+ val newApiSet =
+ if (apiFile.exists()) {
+ apiFile.readLines().toSet()
+ } else {
+ emptySet()
+ }
// Read the reference API surface into memory.
val referenceApiSet = referenceApiFile.readLines().toSet()
@@ -72,7 +70,8 @@
removed += "$e\n"
}
- val errorMessage = """Public resources have been removed since the previous revision
+ val errorMessage =
+ """Public resources have been removed since the previous revision
Previous definition is ${referenceApiFile.canonicalPath}
Current definition is ${apiFile.canonicalPath}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiTask.kt
index 2b2a1b0..c0f1627 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/CheckResourceApiTask.kt
@@ -29,9 +29,7 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Task for detecting changes in the public Android resource surface, e.g. `public.xml`.
- */
+/** Task for detecting changes in the public Android resource surface, e.g. `public.xml`. */
@CacheableTask
abstract class CheckResourceApiTask : DefaultTask() {
/** Checked in resource API files (in source control). */
@@ -40,8 +38,7 @@
abstract val checkedInApiFiles: ListProperty<File>
/** Generated resource API file (in build output). */
- @get:Internal
- abstract val apiLocation: Property<ApiLocation>
+ @get:Internal abstract val apiLocation: Property<ApiLocation>
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/GenerateResourceApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/GenerateResourceApiTask.kt
index a94bc4c..09601c6 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/GenerateResourceApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/GenerateResourceApiTask.kt
@@ -30,16 +30,14 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Generates a resource API file for consumption by other API tasks.
- */
+/** Generates a resource API file for consumption by other API tasks. */
@CacheableTask
abstract class GenerateResourceApiTask : DefaultTask() {
/**
* Public resources text file generated by AAPT.
*
- * This file must be defined, but the file may not exist on the filesystem if the library
- * has no resources. In that case, we will generate an empty API signature file.
+ * This file must be defined, but the file may not exist on the filesystem if the library has no
+ * resources. In that case, we will generate an empty API signature file.
*/
@get:InputFiles // InputFiles allows non-existent files, whereas InputFile does not.
@get:PathSensitive(PathSensitivity.RELATIVE)
@@ -50,8 +48,7 @@
var sourcePaths: Collection<File> = emptyList()
/** Text file to which API signatures will be written. */
- @get:Internal
- abstract val apiLocation: Property<ApiLocation>
+ @get:Internal abstract val apiLocation: Property<ApiLocation>
@OutputFile
fun getTaskOutput(): File {
@@ -61,10 +58,12 @@
@TaskAction
fun generateResourceApi() {
val builtApiFile = builtApi.get().asFile
- val sortedApiLines = if (builtApiFile.exists()) {
- builtApiFile.readLines().toSortedSet()
- } else {
- val errorMessage = """No public resources defined
+ val sortedApiLines =
+ if (builtApiFile.exists()) {
+ builtApiFile.readLines().toSortedSet()
+ } else {
+ val errorMessage =
+ """No public resources defined
At least one public resource must be defined to prevent all resources from
appearing public by default.
@@ -72,8 +71,8 @@
This exception should never occur for AndroidX projects, as a <public />
resource is added by default to all library project. Please contact the
AndroidX Core team for assistance."""
- throw GradleException(errorMessage)
- }
+ throw GradleException(errorMessage)
+ }
val outputApiFile = apiLocation.get().resourceFile
outputApiFile.bufferedWriter().use { out ->
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/PublicResourcesStubHelper.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/PublicResourcesStubHelper.kt
index baae1c5..a21e6ea 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/PublicResourcesStubHelper.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/PublicResourcesStubHelper.kt
@@ -23,19 +23,17 @@
import org.gradle.api.tasks.Copy
fun Project.configurePublicResourcesStub(extension: LibraryExtension) {
- val targetResFolder = File(project.buildDir, "generated/res/public-stub")
+ val targetRes = project.layout.buildDirectory.dir("generated/res/public-stub")
- val generatePublicResourcesTask = tasks.register(
- "generatePublicResourcesStub",
- Copy::class.java
- ) { task ->
- task.from(File(project.getSupportRootFolder(), "buildSrc/res"))
- task.into(targetResFolder)
- }
+ val generatePublicResourcesTask =
+ tasks.register("generatePublicResourcesStub", Copy::class.java) { task ->
+ task.from(File(project.getSupportRootFolder(), "buildSrc/res"))
+ task.into(targetRes)
+ }
extension.libraryVariants.all { variant ->
variant.registerGeneratedResFolders(
- project.files(targetResFolder).builtBy(generatePublicResourcesTask)
+ project.files(targetRes).builtBy(generatePublicResourcesTask)
)
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/ResourceTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/ResourceTasks.kt
index e889831..65ef6d3 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/ResourceTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/ResourceTasks.kt
@@ -38,87 +38,86 @@
builtApiLocation: ApiLocation,
outputApiLocations: List<ApiLocation>
) {
- val packageResTask = project.tasks
- .named(
+ val packageResTask =
+ project.tasks.named(
"package${variantName.replaceFirstChar {
if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString()
}}Resources"
)
- val builtApiFile = packageResTask.flatMap { task ->
- (task as com.android.build.gradle.tasks.MergeResources).publicFile
- }
+ val builtApiFile =
+ packageResTask.flatMap { task ->
+ (task as com.android.build.gradle.tasks.MergeResources).publicFile
+ }
- val outputApiFiles = outputApiLocations.map { location ->
- location.resourceFile
- }
+ val outputApiFiles = outputApiLocations.map { location -> location.resourceFile }
- val generateResourceApi = project.tasks.register(
- GENERATE_RESOURCE_API_TASK,
- GenerateResourceApiTask::class.java
- ) { task ->
- task.group = "API"
- task.description = "Generates resource API files from source"
- task.builtApi.set(builtApiFile)
- task.apiLocation.set(builtApiLocation)
- }
+ val generateResourceApi =
+ project.tasks.register(
+ GENERATE_RESOURCE_API_TASK,
+ GenerateResourceApiTask::class.java
+ ) { task ->
+ task.group = "API"
+ task.description = "Generates resource API files from source"
+ task.builtApi.set(builtApiFile)
+ task.apiLocation.set(builtApiLocation)
+ }
// Policy: If the artifact has previously been released, e.g. has a beta or later API file
// checked in, then we must verify "release compatibility" against the work-in-progress
// API file.
- val checkResourceApiRelease = project.getRequiredCompatibilityApiLocation()?.let {
- lastReleasedApiFile ->
- project.tasks.register(
- CHECK_RESOURCE_API_RELEASE_TASK,
- CheckResourceApiReleaseTask::class.java
- ) { task ->
- task.referenceApiFile.set(lastReleasedApiFile.resourceFile)
- task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
- // Since apiLocation isn't a File, we have to manually set up the dependency.
- task.dependsOn(generateResourceApi)
- task.cacheEvenIfNoOutputs()
+ val checkResourceApiRelease =
+ project.getRequiredCompatibilityApiLocation()?.let { lastReleasedApiFile ->
+ project.tasks.register(
+ CHECK_RESOURCE_API_RELEASE_TASK,
+ CheckResourceApiReleaseTask::class.java
+ ) { task ->
+ task.referenceApiFile.set(lastReleasedApiFile.resourceFile)
+ task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
+ // Since apiLocation isn't a File, we have to manually set up the dependency.
+ task.dependsOn(generateResourceApi)
+ task.cacheEvenIfNoOutputs()
+ }
}
- }
// Policy: All changes to API surfaces for which compatibility is enforced must be
// explicitly confirmed by running the updateApi task. To enforce this, the implementation
// checks the "work-in-progress" built API file against the checked in current API file.
- val checkResourceApi = project.tasks.register(
- CHECK_RESOURCE_API_TASK,
- CheckResourceApiTask::class.java
- ) { task ->
- task.group = TASK_GROUP_API
- task.description = "Checks that the resource API generated from source matches the " +
- "checked in resource API file"
- task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
- // Since apiLocation isn't a File, we have to manually set up the dependency.
- task.dependsOn(generateResourceApi)
- task.cacheEvenIfNoOutputs()
- task.checkedInApiFiles.set(outputApiFiles)
- checkResourceApiRelease?.let {
- task.dependsOn(it)
+ val checkResourceApi =
+ project.tasks.register(CHECK_RESOURCE_API_TASK, CheckResourceApiTask::class.java) { task
+ ->
+ task.group = TASK_GROUP_API
+ task.description =
+ "Checks that the resource API generated from source matches the " +
+ "checked in resource API file"
+ task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
+ // Since apiLocation isn't a File, we have to manually set up the dependency.
+ task.dependsOn(generateResourceApi)
+ task.cacheEvenIfNoOutputs()
+ task.checkedInApiFiles.set(outputApiFiles)
+ checkResourceApiRelease?.let { task.dependsOn(it) }
}
- }
- val updateResourceApi = project.tasks.register(
- UPDATE_RESOURCE_API_TASK,
- UpdateResourceApiTask::class.java
- ) { task ->
- task.group = TASK_GROUP_API
- task.description = "Updates the checked in resource API files to match source code API"
- task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
- // Since apiLocation isn't a File, we have to manually set up the dependency.
- task.dependsOn(generateResourceApi)
- task.outputApiLocations.set(outputApiLocations)
- task.forceUpdate.set(project.providers.gradleProperty("force").isPresent)
- checkResourceApiRelease?.let {
- // If a developer (accidentally) makes a non-backwards compatible change to an
- // API, the developer will want to be informed of it as soon as possible.
- // So, whenever a developer updates an API, if backwards compatibility checks are
- // enabled in the library, then we want to check that the changes are backwards
- // compatible
- task.dependsOn(it)
+ val updateResourceApi =
+ project.tasks.register(UPDATE_RESOURCE_API_TASK, UpdateResourceApiTask::class.java) {
+ task ->
+ task.group = TASK_GROUP_API
+ task.description =
+ "Updates the checked in resource API files to match source code API"
+ task.apiLocation.set(generateResourceApi.flatMap { it.apiLocation })
+ // Since apiLocation isn't a File, we have to manually set up the dependency.
+ task.dependsOn(generateResourceApi)
+ task.outputApiLocations.set(outputApiLocations)
+ task.forceUpdate.set(project.providers.gradleProperty("force").isPresent)
+ checkResourceApiRelease?.let {
+ // If a developer (accidentally) makes a non-backwards compatible change to an
+ // API, the developer will want to be informed of it as soon as possible.
+ // So, whenever a developer updates an API, if backwards compatibility checks
+ // are
+ // enabled in the library, then we want to check that the changes are backwards
+ // compatible
+ task.dependsOn(it)
+ }
}
- }
// Ensure that this task runs as part of "updateApi" task from MetalavaTasks.
project.tasks.withType(UpdateApiTask::class.java).configureEach { task ->
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/resources/UpdateResourceApiTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/resources/UpdateResourceApiTask.kt
index bec59cc0..8454c21 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/resources/UpdateResourceApiTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/resources/UpdateResourceApiTask.kt
@@ -30,17 +30,13 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
-/**
- * Task for updating the public Android resource surface, e.g. `public.xml`.
- */
+/** Task for updating the public Android resource surface, e.g. `public.xml`. */
@CacheableTask
abstract class UpdateResourceApiTask : DefaultTask() {
/** Generated resource API file (in build output). */
- @get:Internal
- abstract val apiLocation: Property<ApiLocation>
+ @get:Internal abstract val apiLocation: Property<ApiLocation>
- @get:Input
- abstract val forceUpdate: Property<Boolean>
+ @get:Input abstract val forceUpdate: Property<Boolean>
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@@ -55,9 +51,7 @@
@OutputFiles
fun getTaskOutputs(): List<File> {
return outputApiLocations.get().flatMap { outputApiLocation ->
- listOf(
- outputApiLocation.resourceFile
- )
+ listOf(outputApiLocation.resourceFile)
}
}
@@ -66,9 +60,11 @@
var permitOverwriting = true
for (outputApi in outputApiLocations.get()) {
val version = outputApi.version()
- if (version != null && version.isFinalApi() &&
- outputApi.publicApiFile.exists() &&
- !forceUpdate.get()
+ if (
+ version != null &&
+ version.isFinalApi() &&
+ outputApi.publicApiFile.exists() &&
+ !forceUpdate.get()
) {
permitOverwriting = false
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/sbom/Sbom.kt b/buildSrc/private/src/main/kotlin/androidx/build/sbom/Sbom.kt
index f6cfcfd..5836ed8 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/sbom/Sbom.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/sbom/Sbom.kt
@@ -48,7 +48,8 @@
/**
* Tells whether the contents of the Configuration with the given name should be listed in our sbom
*
- * That is, this tells whether the corresponding Configuration contains dependencies that get embedded into our build artifact
+ * That is, this tells whether the corresponding Configuration contains dependencies that get
+ * embedded into our build artifact
*/
fun Project.shouldSbomIncludeConfigurationName(configurationName: String): Boolean {
return when (configurationName) {
@@ -71,16 +72,17 @@
private val sbomEmptyConfiguration = "sbomEmpty"
// some tasks that don't embed configurations having external dependencies
-private val excludeTaskNames = setOf(
- "distZip",
- "shadowDistZip",
- "annotationsZip",
- "protoLiteJar",
- "bundleDebugLocalLintAar",
- "bundleReleaseLocalLintAar",
- "bundleDebugAar",
- "bundleReleaseAar"
-)
+private val excludeTaskNames =
+ setOf(
+ "distZip",
+ "shadowDistZip",
+ "annotationsZip",
+ "protoLiteJar",
+ "bundleDebugLocalLintAar",
+ "bundleReleaseLocalLintAar",
+ "bundleDebugAar",
+ "bundleReleaseAar"
+ )
/**
* Lists the Configurations that we should declare we're embedding into the output of this task
@@ -88,12 +90,12 @@
* The immediate inputs to the task are not generally mentioned here: external entities aren't
* interested in knowing that our .aar file contains a classes.jar
*
- * The external dependencies that embed into our artifacts are what we mention here:
- * external entities might be interested in knowing if,
- * for example, we embed protobuf-javalite into our artifact
+ * The external dependencies that embed into our artifacts are what we mention here: external
+ * entities might be interested in knowing if, for example, we embed protobuf-javalite into our
+ * artifact
*
- * The purpose of this function is to detect new archive tasks and remind developers to
- * update shouldSbomIncludeConfigurationName
+ * The purpose of this function is to detect new archive tasks and remind developers to update
+ * shouldSbomIncludeConfigurationName
*/
fun Project.listSbomConfigurationNamesForArchive(task: AbstractArchiveTask): List<String> {
if (task is Jar && !(task is ShadowJar)) {
@@ -114,24 +116,20 @@
}
if (
projectPath.contains("inspection") &&
- (
- taskName == "assembleInspectorJarRelease" ||
- taskName == "inspectionShadowDependenciesRelease"
- )
+ (taskName == "assembleInspectorJarRelease" ||
+ taskName == "inspectionShadowDependenciesRelease")
) {
return listOf(EXPORT_INSPECTOR_DEPENDENCIES)
}
- if (excludeTaskNames.contains(taskName))
- return listOf()
+ if (excludeTaskNames.contains(taskName)) return listOf()
if (projectPath == ":compose:lint:internal-lint-checks")
return listOf() // we don't publish these lint checks
if (projectPath.contains("integration-tests"))
return listOf() // we don't publish integration tests
if (taskName.startsWith("zip") && taskName.contains("ResultsOf") && taskName.contains("Test"))
return listOf() // we don't publish test results
- if (projectPath == ":compose:compiler:compiler" && taskName == "embeddedPlugin")
- return listOf()
+ if (projectPath == ":compose:compiler:compiler" && taskName == "embeddedPlugin") return listOf()
// ShadowJar tasks have a `configurations` property that lists the configurations that
// are inputs to the task, but they don't also list file inputs
@@ -141,28 +139,26 @@
// If a project has multiple shadowJar tasks, we ask the developer to provide
// this metadata somehow by failing below
if (taskName == "shadowJar") {
- // If the task is a ShadowJar task, we can just ask it which configurations it intends to embed
+ // If the task is a ShadowJar task, we can just ask it which configurations it intends to
+ // embed
// We separately validate that this list is correct in
val shadowTask = task as? ShadowJar
if (shadowTask != null) {
- val configurations = project.configurations.filter { conf ->
- shadowTask.configurations.contains(conf)
- }
+ val configurations =
+ project.configurations.filter { conf -> shadowTask.configurations.contains(conf) }
return configurations.map { conf -> conf.name }
}
}
throw GradleException(
"Not sure which external dependencies are included in $projectPath:$taskName of type " +
- "${task::class.java} (this is used for publishing sboms). Please update " +
- "AndroidXImplPlugin's listSbomConfigurationNamesForArchive and " +
- "shouldSbomIncludeConfigurationName"
+ "${task::class.java} (this is used for publishing sboms). Please update " +
+ "AndroidXImplPlugin's listSbomConfigurationNamesForArchive and " +
+ "shouldSbomIncludeConfigurationName"
)
}
-/**
- * Returns which configurations are used by the given task that we should list in an sbom
- */
+/** Returns which configurations are used by the given task that we should list in an sbom */
fun Project.listSbomConfigurationsForArchive(task: AbstractArchiveTask): List<Configuration> {
val configurationNames = listSbomConfigurationNamesForArchive(task)
return configurationNames.map { configurationName ->
@@ -170,33 +166,29 @@
if (resolved == null) {
throw GradleException(
"listSbomConfigurationsForArchive($task) expected to find " +
- "configuration $configurationName but it does not exist"
+ "configuration $configurationName but it does not exist"
)
}
resolved
}
}
-/**
- * Validates that the inputs of the given archive task are recognized
- */
+/** Validates that the inputs of the given archive task are recognized */
fun Project.validateArchiveInputsRecognized(task: AbstractArchiveTask) {
val configurationNames = task.project.listSbomConfigurationNamesForArchive(task)
for (configurationName in configurationNames) {
if (!task.project.shouldSbomIncludeConfigurationName(configurationName)) {
throw GradleException(
"Task listSbomConfigurationNamesForArchive(\"${task.name}\") = " +
- "$configurationNames but " +
- "shouldSbomIncludeConfigurationName(\"$configurationName\") = false. " +
- "You probably should update shouldSbomIncludeConfigurationName to match"
+ "$configurationNames but " +
+ "shouldSbomIncludeConfigurationName(\"$configurationName\") = false. " +
+ "You probably should update shouldSbomIncludeConfigurationName to match"
)
}
}
}
-/**
- * Validates that the inputs of each archive task are recognized
- */
+/** Validates that the inputs of each archive task are recognized */
fun Project.validateAllArchiveInputsRecognized() {
project.tasks.withType(Zip::class.java).configureEach { task ->
project.validateArchiveInputsRecognized(task)
@@ -206,9 +198,7 @@
}
}
-/**
- * Enables the publishing of an sbom that lists our embedded dependencies
- */
+/** Enables the publishing of an sbom that lists our embedded dependencies */
fun Project.configureSbomPublishing() {
val uuid = project.coordinatesToUUID().toString()
@@ -222,45 +212,49 @@
project.tasks.withType(SpdxSbomTask::class.java).configureEach { task ->
val sbomProjectDir = project.projectDir
- task.taskExtension.set(object : DefaultSpdxSbomTaskExtension() {
- override fun mapRepoUri(repoUri: URI, artifact: ModuleVersionIdentifier): URI {
- val uriString = repoUri.toString()
- for (repo in repos) {
- val ourRepoUrl = repo.key
- val publicRepoUrl = repo.value
- if (uriString.startsWith(ourRepoUrl)) {
- return URI.create(publicRepoUrl)
- }
- if (allowPublicRepos) {
- if (uriString.startsWith(publicRepoUrl)) {
+ task.taskExtension.set(
+ object : DefaultSpdxSbomTaskExtension() {
+ override fun mapRepoUri(repoUri: URI, artifact: ModuleVersionIdentifier): URI {
+ val uriString = repoUri.toString()
+ for (repo in repos) {
+ val ourRepoUrl = repo.key
+ val publicRepoUrl = repo.value
+ if (uriString.startsWith(ourRepoUrl)) {
return URI.create(publicRepoUrl)
}
+ if (allowPublicRepos) {
+ if (uriString.startsWith(publicRepoUrl)) {
+ return URI.create(publicRepoUrl)
+ }
+ }
}
+ throw GradleException(
+ "Cannot determine public repo url for repo $uriString artifact $artifact"
+ )
}
- throw GradleException(
- "Cannot determine public repo url for repo $uriString artifact $artifact"
- )
- }
- override fun mapScmForProject(original: ScmInfo, projectInfo: ProjectInfo): ScmInfo {
- val gitClient = gitsClient.getGitClient(projectInfo.projectDirectory)
- val commit = gitClient.getHeadSha()
- val url = getGitRemoteUrl(projectInfo.projectDirectory, supportRootDir)
- return ScmInfo.from("git", url, commit)
- }
- override fun shouldCreatePackageForProject(projectInfo: ProjectInfo): Boolean {
- // sbom should include the project it describes
- if (sbomProjectDir.equals(projectInfo.projectDirectory))
+ override fun mapScmForProject(
+ original: ScmInfo,
+ projectInfo: ProjectInfo
+ ): ScmInfo {
+ val gitClient = gitsClient.getGitClient(projectInfo.projectDirectory)
+ val commit = gitClient.getHeadSha()
+ val url = getGitRemoteUrl(projectInfo.projectDirectory, supportRootDir)
+ return ScmInfo.from("git", url, commit)
+ }
+
+ override fun shouldCreatePackageForProject(projectInfo: ProjectInfo): Boolean {
+ // sbom should include the project it describes
+ if (sbomProjectDir.equals(projectInfo.projectDirectory)) return true
+ // sbom doesn't need to list our projects as dependencies;
+ // they're implementation details
+ // Example: glance:glance-appwidget uses glance:glance-appwidget-proto
+ if (pathContains(supportRootDir, projectInfo.projectDirectory)) return false
+ // sbom should list remaining project dependencies
return true
- // sbom doesn't need to list our projects as dependencies;
- // they're implementation details
- // Example: glance:glance-appwidget uses glance:glance-appwidget-proto
- if (pathContains(supportRootDir, projectInfo.projectDirectory))
- return false
- // sbom should list remaining project dependencies
- return true
+ }
}
- })
+ )
}
val sbomExtension = project.extensions.getByType<SpdxSbomExtension>()
@@ -269,7 +263,7 @@
project.afterEvaluate {
project.configurations.configureEach { configuration ->
if (shouldSbomIncludeConfigurationName(configuration.name)) {
- sbomConfigurations.add(configuration.getName())
+ sbomConfigurations.add(configuration.getName())
}
}
@@ -318,9 +312,7 @@
private const val MAVEN_CENTRAL_REPO_URL = "https://repo.maven.apache.org/maven2"
private const val GMAVEN_REPO_URL = "https://dl.google.com/android/maven2"
-/**
- * Returns a mapping from local repo url to public repo url
- */
+/** Returns a mapping from local repo url to public repo url */
private fun Project.getRepoPublicUrls(): Map<String, String> {
return if (ProjectLayoutType.isPlayground(this)) {
mapOf(
@@ -329,10 +321,8 @@
)
} else {
mapOf(
- "file:${project.getPrebuiltsRoot()}/androidx/external"
- to MAVEN_CENTRAL_REPO_URL,
- "file:${project.getPrebuiltsRoot()}/androidx/internal"
- to GMAVEN_REPO_URL
+ "file:${project.getPrebuiltsRoot()}/androidx/external" to MAVEN_CENTRAL_REPO_URL,
+ "file:${project.getPrebuiltsRoot()}/androidx/internal" to GMAVEN_REPO_URL
)
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/stableaidl/StableAidlApiTasks.kt b/buildSrc/private/src/main/kotlin/androidx/build/stableaidl/StableAidlApiTasks.kt
index f700913..d65888c 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/stableaidl/StableAidlApiTasks.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/stableaidl/StableAidlApiTasks.kt
@@ -22,30 +22,35 @@
import java.io.File
import org.gradle.api.Project
-fun Project.setupWithStableAidlPlugin() = this.withStableAidlPlugin { ext ->
- ext.checkAction.apply {
- before(project.tasks.named("check"))
- before(project.tasks.named(BUILD_ON_SERVER_TASK))
- before(project.tasks.register("checkAidlApi") { task ->
- task.group = "API"
- task.description = "Checks that the API surface generated Stable AIDL sources " +
- "matches the checked in API surface"
- })
+fun Project.setupWithStableAidlPlugin() =
+ this.withStableAidlPlugin { ext ->
+ ext.checkAction.apply {
+ before(project.tasks.named("check"))
+ before(project.tasks.named(BUILD_ON_SERVER_TASK))
+ before(
+ project.tasks.register("checkAidlApi") { task ->
+ task.group = "API"
+ task.description =
+ "Checks that the API surface generated Stable AIDL sources " +
+ "matches the checked in API surface"
+ }
+ )
+ }
+
+ ext.updateAction.apply {
+ before(project.tasks.named("updateApi"))
+ before(
+ project.tasks.register("updateAidlApi") { task ->
+ task.group = "API"
+ task.description =
+ "Updates the checked in API surface based on Stable AIDL sources"
+ }
+ )
+ }
+
+ // Don't show tasks added by the Stable AIDL plugin.
+ ext.taskGroup = null
+
+ // Use a single top-level directory for shadow framework definitions.
+ ext.addStaticImportDirs(File(project.getSupportRootFolder(), "buildSrc/stableAidlImports"))
}
-
- ext.updateAction.apply {
- before(project.tasks.named("updateApi"))
- before(project.tasks.register("updateAidlApi") { task ->
- task.group = "API"
- task.description = "Updates the checked in API surface based on Stable AIDL sources"
- })
- }
-
- // Don't show tasks added by the Stable AIDL plugin.
- ext.taskGroup = null
-
- // Use a single top-level directory for shadow framework definitions.
- ext.addStaticImportDirs(
- File(project.getSupportRootFolder(), "buildSrc/stableAidlImports")
- )
-}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioPlatformUtilities.kt b/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioPlatformUtilities.kt
index 587f0a9..d2a4948 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioPlatformUtilities.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioPlatformUtilities.kt
@@ -27,65 +27,53 @@
* @property studioInstallationDir the directory where studio is installed to
*/
sealed class StudioPlatformUtilities(val projectRoot: File, val studioInstallationDir: File) {
- /**
- * The file extension used for this platform's Studio archive
- */
+ /** The file extension used for this platform's Studio archive */
abstract val archiveExtension: String
- /**
- * The binary directory of the Studio installation.
- */
+ /** The binary directory of the Studio installation. */
abstract val StudioTask.binaryDirectory: File
- /**
- * A list of arguments that will be executed in a shell to launch Studio.
- */
+ /** A list of arguments that will be executed in a shell to launch Studio. */
abstract val StudioTask.launchCommandArguments: List<String>
- /**
- * The lib directory of the Studio installation.
- */
+ /** The lib directory of the Studio installation. */
abstract val StudioTask.libDirectory: File
/**
* The plugins directory of the Studio installation.
- * TODO: Consider removing after Studio has switched to Kotlin 1.4
- * b/162414740
+ *
+ * TODO: Consider removing after Studio has switched to Kotlin 1.4 b/162414740
*/
abstract val StudioTask.pluginsDirectory: File
- /**
- * The license path for the Studio installation.
- */
+ /** The license path for the Studio installation. */
abstract val StudioTask.licensePath: String
- /**
- * Extracts an archive at [fromPath] with [archiveExtension] to [toPath]
- */
+ /** Extracts an archive at [fromPath] with [archiveExtension] to [toPath] */
abstract fun extractArchive(fromPath: String, toPath: String, execSpec: ExecSpec)
/**
* Updates the Jvm heap size for this Studio installation.
+ *
* TODO: this is temporary until b/135183535 is fixed
*/
abstract fun StudioTask.updateJvmHeapSize()
- /**
- * Regex to match '-Xmx512m' or similar, so we can replace it with a larger heap size.
- */
+ /** Regex to match '-Xmx512m' or similar, so we can replace it with a larger heap size. */
protected val jvmHeapRegex = "-Xmx.*".toRegex()
companion object {
- val osName = if (System.getProperty("os.name").lowercase(Locale.ROOT).contains("linux")) {
- "linux"
- } else {
- // Only works when using native version of JDK, otherwise it will fallback to x86_64
- if (System.getProperty("os.arch") == "aarch64") {
- "mac_arm"
+ val osName =
+ if (System.getProperty("os.name").lowercase(Locale.ROOT).contains("linux")) {
+ "linux"
} else {
- "mac"
+ // Only works when using native version of JDK, otherwise it will fallback to x86_64
+ if (System.getProperty("os.arch") == "aarch64") {
+ "mac_arm"
+ } else {
+ "mac"
+ }
}
- }
fun get(projectRoot: File, studioInstallationDir: File): StudioPlatformUtilities {
return if (osName == "linux") {
@@ -99,24 +87,23 @@
private class MacOsUtilities(projectRoot: File, studioInstallationDir: File) :
StudioPlatformUtilities(projectRoot, studioInstallationDir) {
- override val archiveExtension: String get() = ".zip"
+ override val archiveExtension: String
+ get() = ".zip"
override val StudioTask.binaryDirectory: File
get() {
- val file = studioInstallationDir.walk().maxDepth(1).find { file ->
- file.nameWithoutExtension.startsWith("Android Studio") &&
- file.extension == "app"
- }
+ val file =
+ studioInstallationDir.walk().maxDepth(1).find { file ->
+ file.nameWithoutExtension.startsWith("Android Studio") &&
+ file.extension == "app"
+ }
return requireNotNull(file) { "Android Studio*.app not found!" }
}
override val StudioTask.launchCommandArguments: List<String>
get() {
val studioBinary = File(binaryDirectory.absolutePath, "Contents/MacOS/studio")
- return listOf(
- studioBinary.absolutePath,
- projectRoot.absolutePath
- )
+ return listOf(studioBinary.absolutePath, projectRoot.absolutePath)
}
override val StudioTask.libDirectory: File
@@ -144,7 +131,8 @@
private class LinuxUtilities(projectRoot: File, studioInstallationDir: File) :
StudioPlatformUtilities(projectRoot, studioInstallationDir) {
- override val archiveExtension: String get() = ".tar.gz"
+ override val archiveExtension: String
+ get() = ".tar.gz"
override val StudioTask.binaryDirectory: File
get() = File(studioInstallationDir, "android-studio")
@@ -152,11 +140,7 @@
override val StudioTask.launchCommandArguments: List<String>
get() {
val studioScript = File(binaryDirectory, "bin/studio.sh")
- return listOf(
- "sh",
- studioScript.absolutePath,
- projectRoot.absolutePath
- )
+ return listOf("sh", studioScript.absolutePath, projectRoot.absolutePath)
}
override val StudioTask.pluginsDirectory: File
@@ -176,8 +160,7 @@
}
override fun StudioTask.updateJvmHeapSize() {
- val vmoptions64 =
- File(binaryDirectory, "bin/studio64.vmoptions")
+ val vmoptions64 = File(binaryDirectory, "bin/studio64.vmoptions")
val newText64 = vmoptions64.readText().replace(jvmHeapRegex, "-Xmx8g")
vmoptions64.writeText(newText64)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioTask.kt
index 8e922b1..07597e3 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/studio/StudioTask.kt
@@ -40,8 +40,8 @@
/**
* Base task with common logic for updating and launching studio in both the frameworks/support
- * project and playground projects. Project-specific configuration is provided by
- * [RootStudioTask] and [PlaygroundStudioTask].
+ * project and playground projects. Project-specific configuration is provided by [RootStudioTask]
+ * and [PlaygroundStudioTask].
*/
@DisableCachingByDefault(because = "the purpose of this task is to launch Studio")
abstract class StudioTask : DefaultTask() {
@@ -58,38 +58,28 @@
StudioPlatformUtilities.get(projectRoot, studioInstallationDir)
}
- @get:Inject
- abstract val execOperations: ExecOperations
+ @get:Inject abstract val execOperations: ExecOperations
/**
- * If `true`, checks for `ANDROIDX_PROJECTS` environment variable to decide which
- * projects need to be loaded.
+ * If `true`, checks for `ANDROIDX_PROJECTS` environment variable to decide which projects need
+ * to be loaded.
*/
- @get:Internal
- protected open val requiresProjectList: Boolean = true
+ @get:Internal protected open val requiresProjectList: Boolean = true
- @get:Internal
- protected val projectRoot: File = project.rootDir
+ @get:Internal protected val projectRoot: File = project.rootDir
- @get:Internal
- protected open val installParentDir: File = project.rootDir
+ @get:Internal protected open val installParentDir: File = project.rootDir
- private val studioVersion by lazy {
- project.getVersionByName("androidStudio")
- }
+ private val studioVersion by lazy { project.getVersionByName("androidStudio") }
- /**
- * Directory name (not path) that Studio will be unzipped into.
- */
+ /** Directory name (not path) that Studio will be unzipped into. */
private val studioDirectoryName: String
get() {
val osName = StudioPlatformUtilities.osName
return "android-studio-$studioVersion-$osName"
}
- /**
- * Filename (not path) of the Studio archive
- */
+ /** Filename (not path) of the Studio archive */
private val studioArchiveName: String
get() = studioDirectoryName + platformUtilities.archiveExtension
@@ -103,44 +93,29 @@
File(installParentDir, "studio/$studioDirectoryName")
}
- /**
- * Absolute path of the Studio archive
- */
+ /** Absolute path of the Studio archive */
private val studioArchivePath: String by lazy {
File(studioInstallationDir.parentFile, studioArchiveName).absolutePath
}
- /**
- * The idea.properties file that we want to tell Studio to use
- */
- @get:Internal
- protected abstract val ideaProperties: File
+ /** The idea.properties file that we want to tell Studio to use */
+ @get:Internal protected abstract val ideaProperties: File
- /**
- * The studio.vmoptions file that we want to start Studio with
- */
+ /** The studio.vmoptions file that we want to start Studio with */
@get:Internal
open val vmOptions = File(project.getSupportRootFolder(), "development/studio/studio.vmoptions")
- /**
- * The path to the SDK directory used by Studio.
- */
- @get:Internal
- open val localSdkPath = project.getSdkPath()
+ /** The path to the SDK directory used by Studio. */
+ @get:Internal open val localSdkPath = project.getSdkPath()
- /**
- * List of additional environment variables to pass into the Studio application.
- */
- @get:Internal
- open val additionalEnvironmentProperties: Map<String, String> = emptyMap()
+ /** List of additional environment variables to pass into the Studio application. */
+ @get:Internal open val additionalEnvironmentProperties: Map<String, String> = emptyMap()
private val licenseAcceptedFile: File by lazy {
File("$studioInstallationDir/STUDIOW_LICENSE_ACCEPTED")
}
- /**
- * Ensure that we can launch Studio without issue.
- */
+ /** Ensure that we can launch Studio without issue. */
private fun validateEnvironment() {
if (System.getenv().containsKey("SSH_CLIENT") && !System.getenv().containsKey("DISPLAY")) {
throw GradleException(
@@ -149,14 +124,13 @@
Could not read DISPLAY environment variable. If you are using SSH into a remote
machine, consider using either ssh -X or switching to Chrome Remote Desktop.
- """.trimIndent()
+ """
+ .trimIndent()
)
}
}
- /**
- * Install Studio and removes any old installation files if they exist.
- */
+ /** Install Studio and removes any old installation files if they exist. */
private fun install() {
val successfulInstallFile = File("$studioInstallationDir/INSTALL_SUCCESSFUL")
if (!licenseAcceptedFile.exists() && !successfulInstallFile.exists()) {
@@ -178,9 +152,7 @@
}
}
- /**
- * Attempts to symlink the system-images and emulator SDK directories to a canonical SDK.
- */
+ /** Attempts to symlink the system-images and emulator SDK directories to a canonical SDK. */
private fun setupSymlinksIfNeeded() {
val paths = listOf("system-images", "emulator")
if (!localSdkPath.exists()) {
@@ -188,14 +160,15 @@
return
}
- val relativeSdkPath = when (val osType = getOperatingSystem()) {
- OperatingSystem.MAC -> "Library/Android/sdk"
- OperatingSystem.LINUX -> "Android/Sdk"
- else -> {
- println("Failed to locate canonical SDK, unsupported operating system: $osType")
- return
+ val relativeSdkPath =
+ when (val osType = getOperatingSystem()) {
+ OperatingSystem.MAC -> "Library/Android/sdk"
+ OperatingSystem.LINUX -> "Android/Sdk"
+ else -> {
+ println("Failed to locate canonical SDK, unsupported operating system: $osType")
+ return
+ }
}
- }
val canonicalSdkPath = File(File(System.getProperty("user.home")).parent, relativeSdkPath)
if (!canonicalSdkPath.exists()) {
@@ -216,15 +189,14 @@
}
}
- /**
- * Launches Studio if the user accepts / has accepted the license agreement.
- */
+ /** Launches Studio if the user accepts / has accepted the license agreement. */
private fun launch() {
if (checkLicenseAgreement(services)) {
- if (requiresProjectList &&
- !System.getenv().containsKey("ANDROIDX_PROJECTS") &&
- !System.getenv().containsKey("PROJECT_PREFIX")
- ) {
+ if (
+ requiresProjectList &&
+ !System.getenv().containsKey("ANDROIDX_PROJECTS") &&
+ !System.getenv().containsKey("PROJECT_PREFIX")
+ ) {
throw GradleException(
"""
Please specify which set of projects you'd like to open in studio
@@ -232,7 +204,8 @@
or PROJECT_PREFIX=:room: ./gradlew studio
For possible options see settings.gradle
- """.trimIndent()
+ """
+ .trimIndent()
)
}
@@ -262,19 +235,24 @@
redirectError(logFile)
with(platformUtilities) { command(launchCommandArguments) }
- val additionalStudioEnvironmentProperties = mapOf(
- // These environment variables are used to set up AndroidX's default configuration.
- "STUDIO_PROPERTIES" to ideaProperties.canonicalPath,
- "STUDIO_VM_OPTIONS" to vmOptions.canonicalPath,
- // This environment variable prevents Studio from showing IDE inspection warnings
- // for nullability issues, if the context is deprecated. This environment variable
- // is consumed by InteroperabilityDetector.kt
- "ANDROID_LINT_NULLNESS_IGNORE_DEPRECATED" to "true",
- // This environment variable is read by AndroidXRootImplPlugin to ensure that
- // Studio-initiated Gradle tasks are run against the same version of AGP that was
- // used to start Studio, which prevents version mismatch after repo sync.
- "EXPECTED_AGP_VERSION" to ANDROID_GRADLE_PLUGIN_VERSION
- ) + additionalEnvironmentProperties
+ val additionalStudioEnvironmentProperties =
+ mapOf(
+ // These environment variables are used to set up AndroidX's default
+ // configuration.
+ "STUDIO_PROPERTIES" to ideaProperties.canonicalPath,
+ "STUDIO_VM_OPTIONS" to vmOptions.canonicalPath,
+ // This environment variable prevents Studio from showing IDE inspection
+ // warnings
+ // for nullability issues, if the context is deprecated. This environment
+ // variable
+ // is consumed by InteroperabilityDetector.kt
+ "ANDROID_LINT_NULLNESS_IGNORE_DEPRECATED" to "true",
+ // This environment variable is read by AndroidXRootImplPlugin to ensure that
+ // Studio-initiated Gradle tasks are run against the same version of AGP that
+ // was
+ // used to start Studio, which prevents version mismatch after repo sync.
+ "EXPECTED_AGP_VERSION" to ANDROID_GRADLE_PLUGIN_VERSION
+ ) + additionalEnvironmentProperties
// Append to the existing environment variables set by gradlew and the user.
environment().putAll(additionalStudioEnvironmentProperties)
@@ -288,10 +266,11 @@
val licensePath = with(platformUtilities) { licensePath }
val userInput = services.get(UserInputHandler::class.java)
- val acceptAgreement = userInput.askYesNoQuestion(
- "Do you accept the license agreement at $licensePath?",
- /* default answer*/ false
- )
+ val acceptAgreement =
+ userInput.askYesNoQuestion(
+ "Do you accept the license agreement at $licensePath?",
+ /* default answer*/ false
+ )
if (!acceptAgreement) {
return false
}
@@ -335,41 +314,45 @@
private const val STUDIO_TASK = "studio"
fun Project.registerStudioTask() {
- val studioTask = when (ProjectLayoutType.from(this)) {
- ProjectLayoutType.ANDROIDX -> RootStudioTask::class.java
- ProjectLayoutType.PLAYGROUND -> PlaygroundStudioTask::class.java
- }
+ val studioTask =
+ when (ProjectLayoutType.from(this)) {
+ ProjectLayoutType.ANDROIDX -> RootStudioTask::class.java
+ ProjectLayoutType.PLAYGROUND -> PlaygroundStudioTask::class.java
+ }
tasks.register(STUDIO_TASK, studioTask)
}
}
}
-/**
- * Task for launching studio in the frameworks/support project
- */
+/** Task for launching studio in the frameworks/support project */
@DisableCachingByDefault(because = "the purpose of this task is to launch Studio")
abstract class RootStudioTask : StudioTask() {
- override val ideaProperties get() = projectRoot.resolve("development/studio/idea.properties")
+ override val ideaProperties
+ get() = projectRoot.resolve("development/studio/idea.properties")
}
-/**
- * Task for launching studio in a playground project
- */
+/** Task for launching studio in a playground project */
@DisableCachingByDefault(because = "the purpose of this task is to launch Studio")
abstract class PlaygroundStudioTask : RootStudioTask() {
@get:Internal
- val supportRootFolder = (project.rootProject.property("ext") as ExtraPropertiesExtension)
- .let { it.get("supportRootFolder") as File }
+ val supportRootFolder =
+ (project.rootProject.property("ext") as ExtraPropertiesExtension).let {
+ it.get("supportRootFolder") as File
+ }
- /**
- * Playground projects have only 1 setup so there is no need to specify the project list.
- */
- override val requiresProjectList get() = false
- override val installParentDir get() = supportRootFolder
+ /** Playground projects have only 1 setup so there is no need to specify the project list. */
+ override val requiresProjectList
+ get() = false
+
+ override val installParentDir
+ get() = supportRootFolder
+
override val additionalEnvironmentProperties: Map<String, String>
get() = mapOf("ALLOW_PUBLIC_REPOS" to "true")
+
override val ideaProperties
get() = supportRootFolder.resolve("playground-common/idea.properties")
+
override val vmOptions
get() = supportRootFolder.resolve("playground-common/studio.vmoptions")
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/AndroidTestConfigBuilder.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/AndroidTestConfigBuilder.kt
index 9b1016d..24d77e9 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/AndroidTestConfigBuilder.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/AndroidTestConfigBuilder.kt
@@ -33,41 +33,52 @@
val additionalApkKeys = mutableListOf<String>()
fun configName(configName: String) = apply { this.configName = configName }
+
fun appApkName(appApkName: String) = apply { this.appApkName = appApkName }
+
fun appApkSha256(appApkSha256: String) = apply { this.appApkSha256 = appApkSha256 }
+
fun applicationId(applicationId: String) = apply { this.applicationId = applicationId }
+
fun isBenchmark(isBenchmark: Boolean) = apply { this.isBenchmark = isBenchmark }
+
fun isPostsubmit(isPostsubmit: Boolean) = apply { this.isPostsubmit = isPostsubmit }
+
fun minSdk(minSdk: String) = apply { this.minSdk = minSdk }
+
fun tag(tag: String) = apply { this.tags.add(tag) }
+
fun additionalApkKeys(keys: List<String>) = apply { additionalApkKeys.addAll(keys) }
+
fun testApkName(testApkName: String) = apply { this.testApkName = testApkName }
+
fun testApkSha256(testApkSha256: String) = apply { this.testApkSha256 = testApkSha256 }
+
fun testRunner(testRunner: String) = apply { this.testRunner = testRunner }
fun buildJson(): String {
val gson = GsonBuilder().setPrettyPrinting().create()
- val instrumentationArgs = if (isBenchmark && !isPostsubmit) {
- listOf(
- InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest"),
- InstrumentationArg("androidx.benchmark.dryRunMode.enable", "true"),
+ val instrumentationArgs =
+ if (isBenchmark && !isPostsubmit) {
+ listOf(
+ InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest"),
+ InstrumentationArg("androidx.benchmark.dryRunMode.enable", "true"),
+ )
+ } else {
+ listOf(InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest"))
+ }
+ val values =
+ mapOf(
+ "name" to configName,
+ "minSdkVersion" to minSdk,
+ "testSuiteTags" to tags,
+ "testApk" to testApkName,
+ "testApkSha256" to testApkSha256,
+ "appApk" to appApkName,
+ "appApkSha256" to appApkSha256,
+ "instrumentationArgs" to instrumentationArgs,
+ "additionalApkKeys" to additionalApkKeys
)
- } else {
- listOf(
- InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest")
- )
- }
- val values = mapOf(
- "name" to configName,
- "minSdkVersion" to minSdk,
- "testSuiteTags" to tags,
- "testApk" to testApkName,
- "testApkSha256" to testApkSha256,
- "appApk" to appApkName,
- "appApkSha256" to appApkSha256,
- "instrumentationArgs" to instrumentationArgs,
- "additionalApkKeys" to additionalApkKeys
- )
return gson.toJson(values)
}
@@ -76,9 +87,7 @@
sb.append(XML_HEADER_AND_LICENSE)
sb.append(CONFIGURATION_OPEN)
.append(MIN_API_LEVEL_CONTROLLER_OBJECT.replace("MIN_SDK", minSdk))
- tags.forEach { tag ->
- sb.append(TEST_SUITE_TAG_OPTION.replace("TEST_SUITE_TAG", tag))
- }
+ tags.forEach { tag -> sb.append(TEST_SUITE_TAG_OPTION.replace("TEST_SUITE_TAG", tag)) }
sb.append(MODULE_METADATA_TAG_OPTION.replace("APPLICATION_ID", applicationId))
.append(WIFI_DISABLE_OPTION)
.append(FLAKY_TEST_OPTION)
@@ -136,40 +145,36 @@
): String {
val gson = GsonBuilder().setPrettyPrinting().create()
val instrumentationArgs =
- listOf(
- InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest")
- ) + mediaInstrumentationArgsForJson(
- isClientPrevious = isClientPrevious,
- isServicePrevious = isServicePrevious
+ listOf(InstrumentationArg("notAnnotation", "androidx.test.filters.FlakyTest")) +
+ mediaInstrumentationArgsForJson(
+ isClientPrevious = isClientPrevious,
+ isServicePrevious = isServicePrevious
+ )
+ val values =
+ mapOf(
+ "name" to configName,
+ "minSdkVersion" to minSdk,
+ "testSuiteTags" to tags,
+ "testApk" to if (forClient) clientApkName else serviceApkName,
+ "testApkSha256" to if (forClient) clientApkSha256 else serviceApkSha256,
+ "appApk" to if (forClient) serviceApkName else clientApkName,
+ "appApkSha256" to if (forClient) serviceApkSha256 else clientApkSha256,
+ "instrumentationArgs" to instrumentationArgs,
+ "additionalApkKeys" to listOf<String>()
)
- val values = mapOf(
- "name" to configName,
- "minSdkVersion" to minSdk,
- "testSuiteTags" to tags,
- "testApk" to if (forClient) clientApkName else serviceApkName,
- "testApkSha256" to if (forClient) clientApkSha256 else serviceApkSha256,
- "appApk" to if (forClient) serviceApkName else clientApkName,
- "appApkSha256" to if (forClient) serviceApkSha256 else clientApkSha256,
- "instrumentationArgs" to instrumentationArgs,
- "additionalApkKeys" to listOf<String>()
- )
return gson.toJson(values)
}
-private data class InstrumentationArg(
- val key: String,
- val value: String
-)
+private data class InstrumentationArg(val key: String, val value: String)
/**
- * These constants are the building blocks of the xml configs, but
- * they aren't very readable as separate chunks. Look to
- * the golden examples at the bottom of
- * {@link androidx.build.testConfiguration.XmlTestConfigVerificationTest}
- * for examples of what the full xml will look like.
+ * These constants are the building blocks of the xml configs, but they aren't very readable as
+ * separate chunks. Look to the golden examples at the bottom of {@link
+ * androidx.build.testConfiguration.XmlTestConfigVerificationTest} for examples of what the full xml
+ * will look like.
*/
-
-private val XML_HEADER_AND_LICENSE = """
+private val XML_HEADER_AND_LICENSE =
+ """
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License")
@@ -182,98 +187,133 @@
See the License for the specific language governing permissions
and limitations under the License.-->
-""".trimIndent()
+"""
+ .trimIndent()
-private val CONFIGURATION_OPEN = """
+private val CONFIGURATION_OPEN =
+ """
<configuration description="Runs tests for the module">
-""".trimIndent()
+"""
+ .trimIndent()
-private val CONFIGURATION_CLOSE = """
+private val CONFIGURATION_CLOSE =
+ """
</configuration>
-""".trimIndent()
+"""
+ .trimIndent()
-private val MIN_API_LEVEL_CONTROLLER_OBJECT = """
+private val MIN_API_LEVEL_CONTROLLER_OBJECT =
+ """
<object type="module_controller" class="com.android.tradefed.testtype.suite.module.MinApiLevelModuleController">
<option name="min-api-level" value="MIN_SDK" />
</object>
-""".trimIndent()
+"""
+ .trimIndent()
-private val TEST_SUITE_TAG_OPTION = """
+private val TEST_SUITE_TAG_OPTION =
+ """
<option name="test-suite-tag" value="TEST_SUITE_TAG" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val MODULE_METADATA_TAG_OPTION = """
+private val MODULE_METADATA_TAG_OPTION =
+ """
<option name="config-descriptor:metadata" key="applicationId" value="APPLICATION_ID" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val WIFI_DISABLE_OPTION = """
+private val WIFI_DISABLE_OPTION =
+ """
<option name="wifi:disable" value="true" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val SETUP_INCLUDE = """
+private val SETUP_INCLUDE =
+ """
<include name="google/unbundled/common/setup" />
-""".trimIndent()
+"""
+ .trimIndent()
/**
* Specify the following options on the APK installer:
* - Pass the -t argument when installing APKs. This allows testonly APKs to be installed, which
* includes all APKs built against a pre-release SDK. See b/205571374.
*/
-private val TARGET_PREPARER_OPEN = """
+private val TARGET_PREPARER_OPEN =
+ """
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="CLEANUP_APKS" />
<option name="install-arg" value="-t" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val TARGET_PREPARER_CLOSE = """
+private val TARGET_PREPARER_CLOSE =
+ """
</target_preparer>
-""".trimIndent()
+"""
+ .trimIndent()
-private val APK_INSTALL_OPTION = """
+private val APK_INSTALL_OPTION =
+ """
<option name="test-file-name" value="APK_NAME" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val TEST_BLOCK_OPEN = """
+private val TEST_BLOCK_OPEN =
+ """
<test class="com.android.tradefed.testtype.AndroidJUnitTest">
-""".trimIndent()
+"""
+ .trimIndent()
-private val TEST_BLOCK_CLOSE = """
+private val TEST_BLOCK_CLOSE =
+ """
</test>
-""".trimIndent()
+"""
+ .trimIndent()
-private val RUNNER_OPTION = """
+private val RUNNER_OPTION =
+ """
<option name="runner" value="TEST_RUNNER"/>
-""".trimIndent()
+"""
+ .trimIndent()
-private val PACKAGE_OPTION = """
+private val PACKAGE_OPTION =
+ """
<option name="package" value="APPLICATION_ID" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val BENCHMARK_PRESUBMIT_OPTION = """
+private val BENCHMARK_PRESUBMIT_OPTION =
+ """
<option name="instrumentation-arg" key="androidx.benchmark.dryRunMode.enable" value="true" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val BENCHMARK_POSTSUBMIT_OPTIONS = """
+private val BENCHMARK_POSTSUBMIT_OPTIONS =
+ """
<option name="instrumentation-arg" key="androidx.benchmark.output.enable" value="true" />
<option name="instrumentation-arg" key="listener" value="androidx.benchmark.junit4.InstrumentationResultsRunListener" />
-""".trimIndent()
+"""
+ .trimIndent()
-private val FLAKY_TEST_OPTION = """
+private val FLAKY_TEST_OPTION =
+ """
<option name="instrumentation-arg" key="notAnnotation" value="androidx.test.filters.FlakyTest" />
-""".trimIndent()
+"""
+ .trimIndent()
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
index 6b15cff..bff8393 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
@@ -33,8 +33,8 @@
import org.gradle.work.DisableCachingByDefault
/**
- * Writes three configuration files to test combinations of media client & service in
- * <a href=https://source.android.com/devices/tech/test_infra/tradefed/testing/through-suite/android-test-structure>AndroidTest.xml</a>
+ * Writes three configuration files to test combinations of media client & service in <a
+ * href=https://source.android.com/devices/tech/test_infra/tradefed/testing/through-suite/android-test-structure>AndroidTest.xml</a>
* format that gets zipped alongside the APKs to be tested. The combinations are of previous and
* tip-of-tree versions client and service. We want to test every possible pairing that includes
* tip-of-tree.
@@ -48,85 +48,65 @@
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val clientToTFolder: DirectoryProperty
- @get:Internal
- abstract val clientToTLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val clientToTLoader: Property<BuiltArtifactsLoader>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val clientPreviousFolder: DirectoryProperty
- @get:Internal
- abstract val clientPreviousLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val clientPreviousLoader: Property<BuiltArtifactsLoader>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val serviceToTFolder: DirectoryProperty
- @get:Internal
- abstract val serviceToTLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val serviceToTLoader: Property<BuiltArtifactsLoader>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val servicePreviousFolder: DirectoryProperty
- @get:Internal
- abstract val servicePreviousLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val servicePreviousLoader: Property<BuiltArtifactsLoader>
- @get:Input
- abstract val minSdk: Property<Int>
+ @get:Input abstract val minSdk: Property<Int>
- @get:Input
- abstract val testRunner: Property<String>
+ @get:Input abstract val testRunner: Property<String>
- @get:Input
- abstract val presubmit: Property<Boolean>
+ @get:Input abstract val presubmit: Property<Boolean>
- @get:OutputFile
- abstract val jsonClientPreviousServiceToTClientTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientPreviousServiceToTClientTests: RegularFileProperty
- @get:OutputFile
- abstract val jsonClientPreviousServiceToTServiceTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientPreviousServiceToTServiceTests: RegularFileProperty
- @get:OutputFile
- abstract val jsonClientToTServicePreviousClientTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientToTServicePreviousClientTests: RegularFileProperty
- @get:OutputFile
- abstract val jsonClientToTServicePreviousServiceTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientToTServicePreviousServiceTests: RegularFileProperty
- @get:OutputFile
- abstract val jsonClientToTServiceToTClientTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientToTServiceToTClientTests: RegularFileProperty
- @get:OutputFile
- abstract val jsonClientToTServiceToTServiceTests: RegularFileProperty
+ @get:OutputFile abstract val jsonClientToTServiceToTServiceTests: RegularFileProperty
- @get:OutputFile
- abstract val previousClientApk: RegularFileProperty
+ @get:OutputFile abstract val previousClientApk: RegularFileProperty
- @get:OutputFile
- abstract val totClientApk: RegularFileProperty
+ @get:OutputFile abstract val totClientApk: RegularFileProperty
- @get:OutputFile
- abstract val previousServiceApk: RegularFileProperty
+ @get:OutputFile abstract val previousServiceApk: RegularFileProperty
- @get:OutputFile
- abstract val totServiceApk: RegularFileProperty
+ @get:OutputFile abstract val totServiceApk: RegularFileProperty
@TaskAction
fun generateAndroidTestZip() {
val clientToTApk = totClientApk.get().asFile
val clientToTSha256 = copyApkAndGetSha256(clientToTFolder, clientToTLoader, clientToTApk)
val clientPreviousApk = previousClientApk.get().asFile
- val clientPreviousSha256 = copyApkAndGetSha256(
- clientPreviousFolder, clientPreviousLoader, clientPreviousApk
- )
+ val clientPreviousSha256 =
+ copyApkAndGetSha256(clientPreviousFolder, clientPreviousLoader, clientPreviousApk)
val serviceToTApk = totServiceApk.get().asFile
- val serviceToTSha256 = copyApkAndGetSha256(
- serviceToTFolder, serviceToTLoader, serviceToTApk
- )
+ val serviceToTSha256 =
+ copyApkAndGetSha256(serviceToTFolder, serviceToTLoader, serviceToTApk)
val servicePreviousApk = previousServiceApk.get().asFile
- val servicePreviousSha256 = copyApkAndGetSha256(
- servicePreviousFolder, servicePreviousLoader, servicePreviousApk
- )
+ val servicePreviousSha256 =
+ copyApkAndGetSha256(servicePreviousFolder, servicePreviousLoader, servicePreviousApk)
writeConfigFileContent(
clientApkName = clientToTApk.name,
@@ -173,8 +153,9 @@
apkLoader: Property<BuiltArtifactsLoader>,
destination: File
): String {
- val artifacts = apkLoader.get().load(apkFolder.get())
- ?: throw RuntimeException("Cannot load required APK for task: $name")
+ val artifacts =
+ apkLoader.get().load(apkFolder.get())
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
File(artifacts.elements.single().outputFile).copyTo(destination, overwrite = true)
return sha256(destination)
}
@@ -189,39 +170,35 @@
isClientPrevious: Boolean,
isServicePrevious: Boolean,
) {
- createOrFail(jsonClientOutputFile).writeText(
- buildMediaJson(
- configName = jsonClientOutputFile.asFile.get().name,
- forClient = true,
- clientApkName = clientApkName,
- clientApkSha256 = clientApkSha256,
- isClientPrevious = isClientPrevious,
- isServicePrevious = isServicePrevious,
- minSdk = minSdk.get().toString(),
- serviceApkName = serviceApkName,
- serviceApkSha256 = serviceApkSha256,
- tags = listOf(
- "androidx_unit_tests",
- "media_compat"
- ),
+ createOrFail(jsonClientOutputFile)
+ .writeText(
+ buildMediaJson(
+ configName = jsonClientOutputFile.asFile.get().name,
+ forClient = true,
+ clientApkName = clientApkName,
+ clientApkSha256 = clientApkSha256,
+ isClientPrevious = isClientPrevious,
+ isServicePrevious = isServicePrevious,
+ minSdk = minSdk.get().toString(),
+ serviceApkName = serviceApkName,
+ serviceApkSha256 = serviceApkSha256,
+ tags = listOf("androidx_unit_tests", "media_compat"),
+ )
)
- )
- createOrFail(jsonServiceOutputFile).writeText(
- buildMediaJson(
- configName = jsonServiceOutputFile.asFile.get().name,
- forClient = false,
- clientApkName = clientApkName,
- clientApkSha256 = clientApkSha256,
- isClientPrevious = isClientPrevious,
- isServicePrevious = isServicePrevious,
- minSdk = minSdk.get().toString(),
- serviceApkName = serviceApkName,
- serviceApkSha256 = serviceApkSha256,
- tags = listOf(
- "androidx_unit_tests",
- "media_compat"
- ),
+ createOrFail(jsonServiceOutputFile)
+ .writeText(
+ buildMediaJson(
+ configName = jsonServiceOutputFile.asFile.get().name,
+ forClient = false,
+ clientApkName = clientApkName,
+ clientApkSha256 = clientApkSha256,
+ isClientPrevious = isClientPrevious,
+ isServicePrevious = isServicePrevious,
+ minSdk = minSdk.get().toString(),
+ serviceApkName = serviceApkName,
+ serviceApkSha256 = serviceApkSha256,
+ tags = listOf("androidx_unit_tests", "media_compat"),
+ )
)
- )
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
index 6e2ac84..87b7114 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
@@ -38,15 +38,14 @@
import org.gradle.work.DisableCachingByDefault
/**
- * Writes a configuration file in
- * <a href=https://source.android.com/devices/tech/test_infra/tradefed/testing/through-suite/android-test-structure>AndroidTest.xml</a>
- * format that gets zipped alongside the APKs to be tested.
- * This config gets ingested by Tradefed.
+ * Writes a configuration file in <a
+ * href=https://source.android.com/devices/tech/test_infra/tradefed/testing/through-suite/android-test-structure>AndroidTest.xml</a>
+ * format that gets zipped alongside the APKs to be tested. This config gets ingested by Tradefed.
*/
@DisableCachingByDefault(because = "Doesn't benefit from caching")
-abstract class GenerateTestConfigurationTask @Inject constructor(
- private val objects: ObjectFactory
-) : DefaultTask() {
+abstract class GenerateTestConfigurationTask
+@Inject
+constructor(private val objects: ObjectFactory) : DefaultTask() {
@get:InputFiles
@get:Optional
@@ -57,45 +56,33 @@
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val appFileCollection: ConfigurableFileCollection
- @get:Internal
- abstract val appLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val appLoader: Property<BuiltArtifactsLoader>
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val testFolder: DirectoryProperty
- @get:Internal
- abstract val testLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val testLoader: Property<BuiltArtifactsLoader>
- @get:Input
- abstract val testProjectPath: Property<String>
+ @get:Input abstract val testProjectPath: Property<String>
- @get:Input
- abstract val minSdk: Property<Int>
+ @get:Input abstract val minSdk: Property<Int>
- @get:Input
- abstract val hasBenchmarkPlugin: Property<Boolean>
+ @get:Input abstract val hasBenchmarkPlugin: Property<Boolean>
- @get:Input
- abstract val testRunner: Property<String>
+ @get:Input abstract val testRunner: Property<String>
- @get:Input
- abstract val presubmit: Property<Boolean>
+ @get:Input abstract val presubmit: Property<Boolean>
- @get:Input
- abstract val additionalApkKeys: ListProperty<String>
+ @get:Input abstract val additionalApkKeys: ListProperty<String>
- @get:Input
- abstract val additionalTags: ListProperty<String>
+ @get:Input abstract val additionalTags: ListProperty<String>
- @get:OutputFile
- abstract val outputXml: RegularFileProperty
+ @get:OutputFile abstract val outputXml: RegularFileProperty
- @get:OutputFile
- abstract val outputJson: RegularFileProperty
+ @get:OutputFile abstract val outputJson: RegularFileProperty
- @get:OutputFile
- abstract val outputTestApk: RegularFileProperty
+ @get:OutputFile abstract val outputTestApk: RegularFileProperty
@get:[OutputFile Optional]
abstract val outputAppApk: RegularFileProperty
@@ -114,23 +101,32 @@
// Decides where to load the app apk from, depending on whether appFolder or
// appFileCollection has been set.
- val appDir = if (appFolder.isPresent && appFileCollection.files.isEmpty()) {
- appFolder.get()
- } else if (!appFolder.isPresent && appFileCollection.files.size == 1) {
- objects.directoryProperty().also { it.set(appFileCollection.files.first()) }.get()
- } else {
- throw IllegalStateException("""
+ val appDir =
+ if (appFolder.isPresent && appFileCollection.files.isEmpty()) {
+ appFolder.get()
+ } else if (!appFolder.isPresent && appFileCollection.files.size == 1) {
+ objects
+ .directoryProperty()
+ .also { it.set(appFileCollection.files.first()) }
+ .get()
+ } else {
+ throw IllegalStateException(
+ """
App apk not specified or both appFileCollection and appFolder specified.
- """.trimIndent())
- }
+ """
+ .trimIndent()
+ )
+ }
- val appApk = appLoader.get().load(appDir)
- ?: throw RuntimeException("Cannot load required APK for task: $name")
+ val appApk =
+ appLoader.get().load(appDir)
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
// We don't need to check hasBenchmarkPlugin because benchmarks shouldn't have test apps
val appApkBuiltArtifact = appApk.elements.single()
val destinationApk = outputAppApk.get().asFile
File(appApkBuiltArtifact.outputFile).copyTo(destinationApk, overwrite = true)
- configBuilder.appApkName(destinationApk.name)
+ configBuilder
+ .appApkName(destinationApk.name)
.appApkSha256(sha256(File(appApkBuiltArtifact.outputFile)))
}
configBuilder.additionalApkKeys(additionalApkKeys.get())
@@ -153,12 +149,14 @@
configBuilder.tag("androidx_unit_tests")
}
additionalTags.get().forEach { configBuilder.tag(it) }
- val testApk = testLoader.get().load(testFolder.get())
- ?: throw RuntimeException("Cannot load required APK for task: $name")
+ val testApk =
+ testLoader.get().load(testFolder.get())
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
val testApkBuiltArtifact = testApk.elements.single()
val destinationApk = outputTestApk.get().asFile
File(testApkBuiltArtifact.outputFile).copyTo(destinationApk, overwrite = true)
- configBuilder.testApkName(destinationApk.name)
+ configBuilder
+ .testApkName(destinationApk.name)
.applicationId(testApk.applicationId)
.minSdk(minSdk.get().toString())
.testRunner(testRunner.get())
@@ -167,8 +165,10 @@
if (!outputJson.asFile.get().name.startsWith("_")) {
// Prefixing json file names with _ allows us to collocate these files
// inside of the androidTest.zip to make fetching them less expensive.
- throw GradleException("json output file names are expected to use _ prefix to, " +
- "currently set to ${outputJson.asFile.get().name}")
+ throw GradleException(
+ "json output file names are expected to use _ prefix to, " +
+ "currently set to ${outputJson.asFile.get().name}"
+ )
}
createOrFail(outputJson).writeText(configBuilder.buildJson())
}
@@ -178,10 +178,8 @@
val resolvedFile: File = fileProperty.asFile.get()
if (!resolvedFile.exists()) {
if (!resolvedFile.createNewFile()) {
- throw RuntimeException(
- "Failed to create test configuration file: $resolvedFile"
- )
+ throw RuntimeException("Failed to create test configuration file: $resolvedFile")
}
}
return resolvedFile
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/OwnersService.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/OwnersService.kt
index efe1549..56384dd 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/OwnersService.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/OwnersService.kt
@@ -31,11 +31,9 @@
@CacheableTask
abstract class ModuleInfoGenerator : DefaultTask() {
- @get:OutputFile
- abstract val outputFile: RegularFileProperty
+ @get:OutputFile abstract val outputFile: RegularFileProperty
- @get:Internal
- val testModules: MutableList<TestModule> = mutableListOf()
+ @get:Internal val testModules: MutableList<TestModule> = mutableListOf()
@Input
fun getSerialized(): String {
@@ -52,9 +50,9 @@
}
/**
- * Register two tasks needed to generate information for Android test owners service.
- * One task zips all the OWNERS files in frameworks/support, and second task creates a
- * module-info.json that links test modules to paths.
+ * Register two tasks needed to generate information for Android test owners service. One task zips
+ * all the OWNERS files in frameworks/support, and second task creates a module-info.json that links
+ * test modules to paths.
*/
internal fun Project.registerOwnersServiceTasks() {
tasks.register("zipOwnersFiles", Zip::class.java) { task ->
@@ -72,7 +70,4 @@
}
}
-data class TestModule(
- val name: String,
- val path: List<String>
-)
+data class TestModule(val name: String, val path: List<String>)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestApkSha256Report.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestApkSha256Report.kt
index 7fd7d05..22d94be 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestApkSha256Report.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestApkSha256Report.kt
@@ -28,7 +28,5 @@
hasher.putBytes(it.readNBytes(1024))
}
}
- return BaseEncoding.base16().lowerCase().encode(
- hasher.hash().asBytes()
- )
-}
\ No newline at end of file
+ return BaseEncoding.base16().lowerCase().encode(hasher.hash().asBytes())
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
index 639e0bf..abc2099 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
@@ -21,8 +21,8 @@
import androidx.build.AndroidXImplPlugin.Companion.ZIP_TEST_CONFIGS_WITH_APKS_TASK
import androidx.build.asFilenamePrefix
import androidx.build.dependencyTracker.AffectedModuleDetector
+import androidx.build.getFileInTestConfigDirectory
import androidx.build.getSupportRootFolder
-import androidx.build.getTestConfigDirectory
import androidx.build.hasAndroidTestSourceCode
import androidx.build.hasBenchmarkPlugin
import androidx.build.isPresubmitBuild
@@ -39,17 +39,18 @@
import com.android.build.gradle.internal.attributes.VariantAttr
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactType
-import java.io.File
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
+import org.gradle.api.file.RegularFile
+import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.named
/**
* Creates and configures the test config generation task for a project. Configuration includes
- * populating the task with relevant data from the first 4 params, and setting whether the task
- * is enabled.
+ * populating the task with relevant data from the first 4 params, and setting whether the task is
+ * enabled.
*/
fun Project.createTestConfigurationGenerationTask(
variantName: String,
@@ -68,34 +69,35 @@
)
)
}
- val generateTestConfigurationTask = tasks.register(
- "${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}$variantName",
- GenerateTestConfigurationTask::class.java
- ) { task ->
- val androidXExtension = extensions.getByType<AndroidXExtension>()
+ val generateTestConfigurationTask =
+ tasks.register(
+ "${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}$variantName",
+ GenerateTestConfigurationTask::class.java
+ ) { task ->
+ val androidXExtension = extensions.getByType<AndroidXExtension>()
- task.testFolder.set(artifacts.get(SingleArtifact.APK))
- task.testLoader.set(artifacts.getBuiltArtifactsLoader())
- task.outputTestApk.set(
- File(getTestConfigDirectory(), "${path.asFilenamePrefix()}-$variantName.apk")
- )
- task.additionalApkKeys.set(androidXExtension.additionalDeviceTestApkKeys)
- task.additionalTags.set(androidXExtension.additionalDeviceTestTags)
- task.outputXml.fileValue(File(getTestConfigDirectory(), xmlName))
- task.outputJson.fileValue(File(getTestConfigDirectory(), jsonName))
- task.presubmit.set(isPresubmitBuild())
- // Disable work tests on < API 18: b/178127496
- if (path.startsWith(":work:")) {
- task.minSdk.set(maxOf(18, minSdk))
- } else {
- task.minSdk.set(minSdk)
+ task.testFolder.set(artifacts.get(SingleArtifact.APK))
+ task.testLoader.set(artifacts.getBuiltArtifactsLoader())
+ task.outputTestApk.set(
+ getFileInTestConfigDirectory("${path.asFilenamePrefix()}-$variantName.apk")
+ )
+ task.additionalApkKeys.set(androidXExtension.additionalDeviceTestApkKeys)
+ task.additionalTags.set(androidXExtension.additionalDeviceTestTags)
+ task.outputXml.set(getFileInTestConfigDirectory(xmlName))
+ task.outputJson.set(getFileInTestConfigDirectory(jsonName))
+ task.presubmit.set(isPresubmitBuild())
+ // Disable work tests on < API 18: b/178127496
+ if (path.startsWith(":work:")) {
+ task.minSdk.set(maxOf(18, minSdk))
+ } else {
+ task.minSdk.set(minSdk)
+ }
+ val hasBenchmarkPlugin = hasBenchmarkPlugin()
+ task.hasBenchmarkPlugin.set(hasBenchmarkPlugin)
+ task.testRunner.set(testRunner)
+ task.testProjectPath.set(path)
+ AffectedModuleDetector.configureTaskGuard(task)
}
- val hasBenchmarkPlugin = hasBenchmarkPlugin()
- task.hasBenchmarkPlugin.set(hasBenchmarkPlugin)
- task.testRunner.set(testRunner)
- task.testProjectPath.set(path)
- AffectedModuleDetector.configureTaskGuard(task)
- }
// Disable xml generation for projects that have no test sources
// or explicitly don't want to run device tests
afterEvaluate {
@@ -104,7 +106,8 @@
it.enabled = androidXExtension.deviceTests.enabled && hasAndroidTestSourceCode()
}
}
- rootProject.tasks.findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!
+ rootProject.tasks
+ .findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!
.dependsOn(generateTestConfigurationTask)
}
@@ -119,13 +122,13 @@
variant: Variant,
appProjectPath: String,
instrumentationProjectPath: String?
- ): File {
+ ): Provider<RegularFile> {
var filename = appProjectPath.asFilenamePrefix()
if (instrumentationProjectPath != null) {
filename += "_for_${instrumentationProjectPath.asFilenamePrefix()}"
}
filename += "-${variant.name}.apk"
- return File(getTestConfigDirectory(), filename)
+ return getFileInTestConfigDirectory(filename)
}
// For application modules, the instrumentation apk is generated in the module itself
@@ -153,22 +156,19 @@
"${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}${variant.name}",
GenerateTestConfigurationTask::class.java
) { task ->
- task.appLoader.set(
- variant.artifacts.getBuiltArtifactsLoader()
- )
+ task.appLoader.set(variant.artifacts.getBuiltArtifactsLoader())
// The target app path is defined in the targetProjectPath field in the android
// extension of the test module
- val targetProjectPath = project
- .extensions
- .getByType(TestExtension::class.java)
- .targetProjectPath
- ?: throw IllegalStateException("""
+ val targetProjectPath =
+ project.extensions.getByType(TestExtension::class.java).targetProjectPath
+ ?: throw IllegalStateException(
+ """
Module `$path` does not have a targetProjectPath defined.
- """.trimIndent())
- task.outputAppApk.set(
- outputAppApkFile(variant, targetProjectPath, path)
- )
+ """
+ .trimIndent()
+ )
+ task.outputAppApk.set(outputAppApkFile(variant, targetProjectPath, path))
task.appFileCollection.from(
configurations
@@ -194,26 +194,23 @@
// and targetAppProjectVariantForInstrumentationTest.
extensions.findByType(LibraryAndroidComponentsExtension::class.java)?.apply {
onVariants(selector().withBuildType("debug")) { variant ->
-
val targetAppProject =
androidXExtension.deviceTests.targetAppProject ?: return@onVariants
- val targetAppProjectVariant =
- androidXExtension.deviceTests.targetAppVariant
+ val targetAppProjectVariant = androidXExtension.deviceTests.targetAppVariant
// Recreate the same configuration existing for test modules to pull the artifact
// from the application module specified in the deviceTests extension.
@Suppress("UnstableApiUsage") // Incubating dependencyFactory APIs
- val configuration = configurations.create("${variant.name}TestedApks") { config ->
- config.isCanBeResolved = true
- config.isCanBeConsumed = false
- config.attributes {
- it.attribute(VariantAttr.ATTRIBUTE, objects.named(targetAppProjectVariant))
- it.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
+ val configuration =
+ configurations.create("${variant.name}TestedApks") { config ->
+ config.isCanBeResolved = true
+ config.isCanBeConsumed = false
+ config.attributes {
+ it.attribute(VariantAttr.ATTRIBUTE, objects.named(targetAppProjectVariant))
+ it.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
+ }
+ config.dependencies.add(project.dependencyFactory.create(targetAppProject))
}
- config
- .dependencies
- .add(project.dependencyFactory.create(targetAppProject))
- }
tasks.named(
"${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}${variant.name}AndroidTest",
@@ -222,51 +219,57 @@
task.appLoader.set(variant.artifacts.getBuiltArtifactsLoader())
// The target app path is defined in the androidx extension
- task.outputAppApk.set(
- outputAppApkFile(variant, targetAppProject.path, path)
- )
+ task.outputAppApk.set(outputAppApkFile(variant, targetAppProject.path, path))
task.appFileCollection.from(
- configuration.incoming.artifactView { view ->
- view.attributes {
- it.attribute(AndroidArtifacts.ARTIFACT_TYPE, ArtifactType.APK.type)
+ configuration.incoming
+ .artifactView { view ->
+ view.attributes {
+ it.attribute(AndroidArtifacts.ARTIFACT_TYPE, ArtifactType.APK.type)
+ }
}
- }.files
+ .files
)
}
}
}
}
-private fun getOrCreateMediaTestConfigTask(project: Project, isMedia2: Boolean):
- TaskProvider<GenerateMediaTestConfigurationTask> {
- val mediaPrefix = getMediaConfigTaskPrefix(isMedia2)
- val parentProject = project.parent!!
- if (!parentProject.tasks.withType(GenerateMediaTestConfigurationTask::class.java)
- .names.contains(
- "support-$mediaPrefix-test${
+private fun getOrCreateMediaTestConfigTask(
+ project: Project,
+ isMedia2: Boolean
+): TaskProvider<GenerateMediaTestConfigurationTask> {
+ val mediaPrefix = getMediaConfigTaskPrefix(isMedia2)
+ val parentProject = project.parent!!
+ if (
+ !parentProject.tasks
+ .withType(GenerateMediaTestConfigurationTask::class.java)
+ .names
+ .contains(
+ "support-$mediaPrefix-test${
AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK
}"
- )
- ) {
- val task = parentProject.tasks.register(
+ )
+ ) {
+ val task =
+ parentProject.tasks.register(
"support-$mediaPrefix-test${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}",
GenerateMediaTestConfigurationTask::class.java
) { task ->
AffectedModuleDetector.configureTaskGuard(task)
}
- project.rootProject.tasks.findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!
- .dependsOn(task)
- return task
- } else {
- return parentProject.tasks.withType(GenerateMediaTestConfigurationTask::class.java)
- .named(
- "support-$mediaPrefix-test${
+ project.rootProject.tasks.findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!.dependsOn(task)
+ return task
+ } else {
+ return parentProject.tasks
+ .withType(GenerateMediaTestConfigurationTask::class.java)
+ .named(
+ "support-$mediaPrefix-test${
AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK
}"
- )
- }
+ )
}
+}
private fun getMediaConfigTaskPrefix(isMedia2: Boolean): String {
return if (isMedia2) "media2" else "media"
@@ -300,53 +303,45 @@
it.serviceToTLoader.set(artifacts.getBuiltArtifactsLoader())
}
}
- it.jsonClientPreviousServiceToTClientTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientPreviousServiceToTClientTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientPreviousServiceToTClientTests$variantName.json"
)
)
- it.jsonClientPreviousServiceToTServiceTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientPreviousServiceToTServiceTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientPreviousServiceToTServiceTests$variantName.json"
)
)
- it.jsonClientToTServicePreviousClientTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientToTServicePreviousClientTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientToTServicePreviousClientTests$variantName.json"
)
)
- it.jsonClientToTServicePreviousServiceTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientToTServicePreviousServiceTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientToTServicePreviousServiceTests$variantName.json"
)
)
- it.jsonClientToTServiceToTClientTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientToTServiceToTClientTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientToTServiceToTClientTests$variantName.json"
)
)
- it.jsonClientToTServiceToTServiceTests.fileValue(
- File(
- this.getTestConfigDirectory(),
+ it.jsonClientToTServiceToTServiceTests.set(
+ getFileInTestConfigDirectory(
"_${mediaPrefix}ClientToTServiceToTServiceTests$variantName.json"
)
)
- it.totClientApk.fileValue(
- File(getTestConfigDirectory(), "${mediaPrefix}ClientToT$variantName.apk")
+ it.totClientApk.set(getFileInTestConfigDirectory("${mediaPrefix}ClientToT$variantName.apk"))
+ it.previousClientApk.set(
+ getFileInTestConfigDirectory("${mediaPrefix}ClientPrevious$variantName.apk")
)
- it.previousClientApk.fileValue(
- File(getTestConfigDirectory(), "${mediaPrefix}ClientPrevious$variantName.apk")
+ it.totServiceApk.set(
+ getFileInTestConfigDirectory("${mediaPrefix}ServiceToT$variantName.apk")
)
- it.totServiceApk.fileValue(
- File(getTestConfigDirectory(), "${mediaPrefix}ServiceToT$variantName.apk")
- )
- it.previousServiceApk.fileValue(
- File(getTestConfigDirectory(), "${mediaPrefix}ServicePrevious$variantName.apk")
+ it.previousServiceApk.set(
+ getFileInTestConfigDirectory("${mediaPrefix}ServicePrevious$variantName.apk")
)
it.minSdk.set(minSdk)
it.testRunner.set(testRunner)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/transform/ConfigureAarAsJar.kt b/buildSrc/private/src/main/kotlin/androidx/build/transform/ConfigureAarAsJar.kt
index 1b04cf7..b6c9910 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/transform/ConfigureAarAsJar.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/transform/ConfigureAarAsJar.kt
@@ -27,19 +27,20 @@
* classes on the classpath.
*/
fun configureAarAsJarForConfiguration(project: Project, configurationName: String) {
- val testAarsAsJars = project.configurations.create("${configurationName}AarAsJar") {
- it.isTransitive = false
- it.isCanBeConsumed = false
- it.isCanBeResolved = true
- it.attributes.attribute(
- BuildTypeAttr.ATTRIBUTE,
- project.objects.named(BuildTypeAttr::class.java, "release")
- )
- it.attributes.attribute(
- Usage.USAGE_ATTRIBUTE,
- project.objects.named(Usage::class.java, Usage.JAVA_API)
- )
- }
+ val testAarsAsJars =
+ project.configurations.create("${configurationName}AarAsJar") {
+ it.isTransitive = false
+ it.isCanBeConsumed = false
+ it.isCanBeResolved = true
+ it.attributes.attribute(
+ BuildTypeAttr.ATTRIBUTE,
+ project.objects.named(BuildTypeAttr::class.java, "release")
+ )
+ it.attributes.attribute(
+ Usage.USAGE_ATTRIBUTE,
+ project.objects.named(Usage::class.java, Usage.JAVA_API)
+ )
+ }
val artifactType = Attribute.of("artifactType", String::class.java)
project.dependencies.registerTransform(IdentityTransform::class.java) { spec ->
spec.from.attribute(artifactType, "jar")
@@ -51,17 +52,24 @@
spec.to.attribute(artifactType, "aarAsJar")
}
- val aarAsJar = testAarsAsJars.incoming.artifactView { viewConfiguration ->
- viewConfiguration.attributes.attribute(artifactType, "aarAsJar")
- }.files
- project.configurations.getByName(configurationName).dependencies.add(
- project.dependencies.create(aarAsJar)
- )
+ val aarAsJar =
+ testAarsAsJars.incoming
+ .artifactView { viewConfiguration ->
+ viewConfiguration.attributes.attribute(artifactType, "aarAsJar")
+ }
+ .files
+ project.configurations
+ .getByName(configurationName)
+ .dependencies
+ .add(project.dependencies.create(aarAsJar))
// Added to allow the :external:paparazzi:paparazzi build to select the correct jar (not get
// confused by the mpp jars) when the mpp builds are enabled
- project.configurations.getByName(testAarsAsJars.name).attributes.attribute(
- TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
- project.objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.ANDROID)
- )
-}
\ No newline at end of file
+ project.configurations
+ .getByName(testAarsAsJars.name)
+ .attributes
+ .attribute(
+ TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
+ project.objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.ANDROID)
+ )
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/transform/IdentityTransform.kt b/buildSrc/private/src/main/kotlin/androidx/build/transform/IdentityTransform.kt
index d662963..42494bb 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/transform/IdentityTransform.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/transform/IdentityTransform.kt
@@ -37,8 +37,10 @@
when {
input.isDirectory -> transformOutputs.dir(input)
input.isFile -> transformOutputs.file(input)
- else -> throw IllegalArgumentException(
- "File/directory does not exist: ${input.absolutePath}")
+ else ->
+ throw IllegalArgumentException(
+ "File/directory does not exist: ${input.absolutePath}"
+ )
}
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/EnableCaching.kt b/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/EnableCaching.kt
index 94855ce..d6f1557 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/EnableCaching.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/EnableCaching.kt
@@ -16,8 +16,9 @@
package androidx.build.uptodatedness
-import java.io.File
import org.gradle.api.Task
+import org.gradle.api.file.RegularFile
+import org.gradle.api.provider.Provider
// Tells Gradle to skip running this task, even if this task declares no output files
fun Task.cacheEvenIfNoOutputs() {
@@ -27,6 +28,6 @@
// Returns a dummy/unused output path that we can pass to Gradle to prevent Gradle from thinking
// that we forgot to declare outputs of this task, and instead to skip this task if its inputs
// are unchanged
-fun Task.getDummyOutput(): File {
- return File(this.project.buildDir, "dummyOutput/" + this.name.replace(":", "-"))
+private fun Task.getDummyOutput(): Provider<RegularFile> {
+ return project.layout.buildDirectory.file("dummyOutput/" + this.name.replace(":", "-"))
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt b/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
index 4af02e4..8fa0772 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
@@ -29,13 +29,12 @@
import org.gradle.tooling.events.task.TaskExecutionResult
/**
- * Validates that all tasks (except a temporary exception list) are considered up-to-date.
- * The expected usage of this is that the user will invoke a build with the
- * TaskUpToDateValidator disabled, and then reinvoke the same build with the TaskUpToDateValidator
- * enabled. If the second build actually runs any tasks, then some tasks don't have the correct
- * inputs/outputs declared and are running more often than necessary.
+ * Validates that all tasks (except a temporary exception list) are considered up-to-date. The
+ * expected usage of this is that the user will invoke a build with the TaskUpToDateValidator
+ * disabled, and then reinvoke the same build with the TaskUpToDateValidator enabled. If the second
+ * build actually runs any tasks, then some tasks don't have the correct inputs/outputs declared and
+ * are running more often than necessary.
*/
-
const val DISALLOW_TASK_EXECUTION_VAR_NAME = "DISALLOW_TASK_EXECUTION"
private const val ENABLE_FLAG_NAME = VERIFY_UP_TO_DATE
@@ -45,129 +44,132 @@
// (like :core:core:assembleRelease)
// Entries in this set do still get rerun because they might produce files that are needed by
// subsequent tasks
-val ALLOW_RERUNNING_TASKS = setOf(
- "buildOnServer",
- "checkExternalLicenses",
- // caching disabled for now while we look for a fix for b/273294710
- "createAllArchives",
- // https://youtrack.jetbrains.com/issue/KT-52632
- "commonizeNativeDistribution",
- "createDiffArchiveForAll",
- "externalNativeBuildDebug",
- "externalNativeBuildRelease",
- "generateDebugUnitTestConfig",
- "generateJsonModelDebug",
- "generateJsonModelRelease",
- /**
- * relocateShadowJar is used to configure the ShadowJar hence it does not have any outputs.
- * https://github.com/johnrengelman/shadow/issues/561
- */
- "relocateShadowJar",
- "testDebugUnitTest",
- "verifyDependencyVersions",
- "zipTestConfigsWithApks",
- "zipHtmlResultsOfTestDebugUnitTest",
- "zipXmlResultsOfTestDebugUnitTest",
+val ALLOW_RERUNNING_TASKS =
+ setOf(
+ "buildOnServer",
+ "checkExternalLicenses",
+ // caching disabled for now while we look for a fix for b/273294710
+ "createAllArchives",
+ // https://youtrack.jetbrains.com/issue/KT-52632
+ "commonizeNativeDistribution",
+ "createDiffArchiveForAll",
+ "externalNativeBuildDebug",
+ "externalNativeBuildRelease",
+ "generateDebugUnitTestConfig",
+ "generateJsonModelDebug",
+ "generateJsonModelRelease",
+ /**
+ * relocateShadowJar is used to configure the ShadowJar hence it does not have any outputs.
+ * https://github.com/johnrengelman/shadow/issues/561
+ */
+ "relocateShadowJar",
+ "testDebugUnitTest",
+ "verifyDependencyVersions",
+ "zipTestConfigsWithApks",
+ "zipHtmlResultsOfTestDebugUnitTest",
+ "zipXmlResultsOfTestDebugUnitTest",
+ ":camera:integration-tests:camera-testapp-core:mergeLibDexDebug",
+ ":camera:integration-tests:camera-testapp-core:packageDebug",
+ ":camera:integration-tests:camera-testapp-extensions:mergeLibDexDebug",
+ ":camera:integration-tests:camera-testapp-extensions:packageDebug",
+ ":camera:integration-tests:camera-testapp-extensions:" +
+ "GenerateTestConfigurationdebugAndroidTest",
+ ":camera:integration-tests:camera-testapp-uiwidgets:mergeLibDexDebug",
+ ":camera:integration-tests:camera-testapp-uiwidgets:packageDebug",
+ ":camera:integration-tests:camera-testapp-core:GenerateTestConfigurationdebug",
+ ":camera:integration-tests:camera-testapp-core:GenerateTestConfigurationdebugAndroidTest",
+ ":camera:integration-tests:camera-testapp-view:GenerateTestConfigurationdebug",
+ ":camera:integration-tests:camera-testapp-view:GenerateTestConfigurationdebugAndroidTest",
+ ":camera:integration-tests:camera-testapp-view:mergeLibDexDebug",
+ ":camera:integration-tests:camera-testapp-view:packageDebug",
+ "configureCMakeDebug[armeabi-v7a]",
+ "configureCMakeDebug[arm64-v8a]",
+ "configureCMakeDebug[x86]",
+ "configureCMakeDebug[x86_64]",
+ "buildCMakeDebug[armeabi-v7a]",
+ "buildCMakeDebug[arm64-v8a]",
+ "buildCMakeDebug[x86]",
+ "buildCMakeDebug[x86_64]",
+ "configureCMakeRelWithDebInfo[armeabi-v7a]",
+ "configureCMakeRelWithDebInfo[arm64-v8a]",
+ "configureCMakeRelWithDebInfo[x86]",
+ "configureCMakeRelWithDebInfo[x86_64]",
+ "buildCMakeRelWithDebInfo[armeabi-v7a]",
+ "buildCMakeRelWithDebInfo[arm64-v8a]",
+ "buildCMakeRelWithDebInfo[x86]",
+ "buildCMakeRelWithDebInfo[x86_64]",
+ ":appsearch:appsearch-local-storage:buildCMakeDebug[armeabi-v7a][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeDebug[arm64-v8a][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeDebug[x86][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeDebug[x86_64][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[armeabi-v7a][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[arm64-v8a][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[x86][icing]",
+ ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[x86_64][icing]",
+ ":external:libyuv:buildCMakeDebug[armeabi-v7a][yuv]",
+ ":external:libyuv:buildCMakeDebug[arm64-v8a][yuv]",
+ ":external:libyuv:buildCMakeDebug[x86][yuv]",
+ ":external:libyuv:buildCMakeDebug[x86_64][yuv]",
+ ":external:libyuv:buildCMakeRelWithDebInfo[armeabi-v7a][yuv]",
+ ":external:libyuv:buildCMakeRelWithDebInfo[arm64-v8a][yuv]",
+ ":external:libyuv:buildCMakeRelWithDebInfo[x86][yuv]",
+ ":external:libyuv:buildCMakeRelWithDebInfo[x86_64][yuv]",
+ ":hilt:hilt-navigation-compose:kaptGenerateStubsDebugKotlin",
+ ":hilt:hilt-navigation-compose:kaptGenerateStubsReleaseKotlin",
+ ":lint-checks:integration-tests:copyDebugAndroidLintReports",
- ":camera:integration-tests:camera-testapp-core:mergeLibDexDebug",
- ":camera:integration-tests:camera-testapp-core:packageDebug",
- ":camera:integration-tests:camera-testapp-extensions:mergeLibDexDebug",
- ":camera:integration-tests:camera-testapp-extensions:packageDebug",
- ":camera:integration-tests:camera-testapp-extensions:GenerateTestConfigurationdebugAndroidTest",
- ":camera:integration-tests:camera-testapp-uiwidgets:mergeLibDexDebug",
- ":camera:integration-tests:camera-testapp-uiwidgets:packageDebug",
- ":camera:integration-tests:camera-testapp-core:GenerateTestConfigurationdebug",
- ":camera:integration-tests:camera-testapp-core:GenerateTestConfigurationdebugAndroidTest",
- ":camera:integration-tests:camera-testapp-view:GenerateTestConfigurationdebug",
- ":camera:integration-tests:camera-testapp-view:GenerateTestConfigurationdebugAndroidTest",
- ":camera:integration-tests:camera-testapp-view:mergeLibDexDebug",
- ":camera:integration-tests:camera-testapp-view:packageDebug",
- "configureCMakeDebug[armeabi-v7a]",
- "configureCMakeDebug[arm64-v8a]",
- "configureCMakeDebug[x86]",
- "configureCMakeDebug[x86_64]",
- "buildCMakeDebug[armeabi-v7a]",
- "buildCMakeDebug[arm64-v8a]",
- "buildCMakeDebug[x86]",
- "buildCMakeDebug[x86_64]",
- "configureCMakeRelWithDebInfo[armeabi-v7a]",
- "configureCMakeRelWithDebInfo[arm64-v8a]",
- "configureCMakeRelWithDebInfo[x86]",
- "configureCMakeRelWithDebInfo[x86_64]",
- "buildCMakeRelWithDebInfo[armeabi-v7a]",
- "buildCMakeRelWithDebInfo[arm64-v8a]",
- "buildCMakeRelWithDebInfo[x86]",
- "buildCMakeRelWithDebInfo[x86_64]",
- ":appsearch:appsearch-local-storage:buildCMakeDebug[armeabi-v7a][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeDebug[arm64-v8a][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeDebug[x86][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeDebug[x86_64][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[armeabi-v7a][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[arm64-v8a][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[x86][icing]",
- ":appsearch:appsearch-local-storage:buildCMakeRelWithDebInfo[x86_64][icing]",
- ":external:libyuv:buildCMakeDebug[armeabi-v7a][yuv]",
- ":external:libyuv:buildCMakeDebug[arm64-v8a][yuv]",
- ":external:libyuv:buildCMakeDebug[x86][yuv]",
- ":external:libyuv:buildCMakeDebug[x86_64][yuv]",
- ":external:libyuv:buildCMakeRelWithDebInfo[armeabi-v7a][yuv]",
- ":external:libyuv:buildCMakeRelWithDebInfo[arm64-v8a][yuv]",
- ":external:libyuv:buildCMakeRelWithDebInfo[x86][yuv]",
- ":external:libyuv:buildCMakeRelWithDebInfo[x86_64][yuv]",
- ":hilt:hilt-navigation-compose:kaptGenerateStubsDebugKotlin",
- ":hilt:hilt-navigation-compose:kaptGenerateStubsReleaseKotlin",
- ":lint-checks:integration-tests:copyDebugAndroidLintReports",
+ // https://youtrack.jetbrains.com/issue/KT-49933
+ "generateProjectStructureMetadata",
- // https://youtrack.jetbrains.com/issue/KT-49933
- "generateProjectStructureMetadata",
-
- // https://github.com/google/protobuf-gradle-plugin/issues/667
- ":appactions:interaction:interaction-service-proto:extractIncludeTestProto",
- ":datastore:datastore-preferences-proto:extractIncludeTestProto",
- ":glance:glance-appwidget-proto:extractIncludeTestProto",
- ":health:connect:connect-client-proto:extractIncludeTestProto",
- ":privacysandbox:tools:tools-core:extractIncludeTestProto",
- ":test:screenshot:screenshot-proto:extractIncludeTestProto",
- ":wear:protolayout:protolayout-proto:extractIncludeTestProto",
- ":wear:tiles:tiles-proto:extractIncludeTestProto"
-)
+ // https://github.com/google/protobuf-gradle-plugin/issues/667
+ ":appactions:interaction:interaction-service-proto:extractIncludeTestProto",
+ ":datastore:datastore-preferences-proto:extractIncludeTestProto",
+ ":glance:glance-appwidget-proto:extractIncludeTestProto",
+ ":health:connect:connect-client-proto:extractIncludeTestProto",
+ ":privacysandbox:tools:tools-core:extractIncludeTestProto",
+ ":test:screenshot:screenshot-proto:extractIncludeTestProto",
+ ":wear:protolayout:protolayout-proto:extractIncludeTestProto",
+ ":wear:tiles:tiles-proto:extractIncludeTestProto"
+ )
// Additional tasks that are expected to be temporarily out-of-date after running once
// Tasks in this set we don't even try to rerun, because they're known to be unnecessary
-val DONT_TRY_RERUNNING_TASKS = setOf(
- "listTaskOutputs",
- "tasks",
+val DONT_TRY_RERUNNING_TASKS =
+ setOf(
+ "listTaskOutputs",
+ "tasks",
- // More information about the fact that these dackka tasks rerun can be found at b/167569304
- "docs",
+ // More information about the fact that these dackka tasks rerun can be found at b/167569304
+ "docs",
- // We know that these tasks are never up to date due to maven-metadata.xml changing
- // https://github.com/gradle/gradle/issues/11203
- "partiallyDejetifyArchive",
- "stripArchiveForPartialDejetification",
- "createArchive",
+ // We know that these tasks are never up to date due to maven-metadata.xml changing
+ // https://github.com/gradle/gradle/issues/11203
+ "partiallyDejetifyArchive",
+ "stripArchiveForPartialDejetification",
+ "createArchive",
- // https://github.com/spdx/spdx-gradle-plugin/issues/18
- "spdxSbomForRelease",
-)
+ // https://github.com/spdx/spdx-gradle-plugin/issues/18
+ "spdxSbomForRelease",
+ )
-val DONT_TRY_RERUNNING_TASK_TYPES = setOf(
- // TODO(aurimas): add back when upgrading to AGP 8.0.0-beta01
- "com.android.build.gradle.internal.tasks.BundleLibraryJavaRes_Decorated",
- "com.android.build.gradle.internal.lint.AndroidLintTextOutputTask_Decorated",
- // lint report tasks
- "com.android.build.gradle.internal.lint.AndroidLintTask_Decorated",
- // lint analysis tasks b/223287425
- "com.android.build.gradle.internal.lint.AndroidLintAnalysisTask_Decorated",
- // https://github.com/gradle/gradle/issues/11717
- "org.gradle.api.publish.tasks.GenerateModuleMetadata_Decorated",
- "org.gradle.api.publish.maven.tasks.GenerateMavenPom_Decorated",
- // due to GenerateModuleMetadata re-running
- "androidx.build.GMavenZipTask_Decorated",
- "org.gradle.api.publish.maven.tasks.PublishToMavenRepository_Decorated",
- // This task is not cacheable by design due to large number of inputs
- "androidx.build.license.CheckExternalDependencyLicensesTask_Decorated",
-)
+val DONT_TRY_RERUNNING_TASK_TYPES =
+ setOf(
+ // TODO(aurimas): add back when upgrading to AGP 8.0.0-beta01
+ "com.android.build.gradle.internal.tasks.BundleLibraryJavaRes_Decorated",
+ "com.android.build.gradle.internal.lint.AndroidLintTextOutputTask_Decorated",
+ // lint report tasks
+ "com.android.build.gradle.internal.lint.AndroidLintTask_Decorated",
+ // lint analysis tasks b/223287425
+ "com.android.build.gradle.internal.lint.AndroidLintAnalysisTask_Decorated",
+ // https://github.com/gradle/gradle/issues/11717
+ "org.gradle.api.publish.tasks.GenerateModuleMetadata_Decorated",
+ "org.gradle.api.publish.maven.tasks.GenerateMavenPom_Decorated",
+ // due to GenerateModuleMetadata re-running
+ "androidx.build.GMavenZipTask_Decorated",
+ "org.gradle.api.publish.maven.tasks.PublishToMavenRepository_Decorated",
+ // This task is not cacheable by design due to large number of inputs
+ "androidx.build.license.CheckExternalDependencyLicensesTask_Decorated",
+ )
abstract class TaskUpToDateValidator :
BuildService<TaskUpToDateValidator.Parameters>, OperationCompletionListener {
@@ -215,17 +217,15 @@
}
/**
- * Currently, klibs are not reproducible, which means any task that depends on them
- * might get invalidated at no fault of their own.
+ * Currently, klibs are not reproducible, which means any task that depends on them might
+ * get invalidated at no fault of their own.
*
* https://youtrack.jetbrains.com/issue/KT-52741
*/
private fun isCausedByAKlibChange(result: TaskExecutionResult): Boolean {
// the actual message looks something like:
// Input property 'rootSpec$1$3' file <some-path>.klib has changed
- return result.executionReasons.orEmpty().any {
- it.contains(".klib has changed")
- }
+ return result.executionReasons.orEmpty().any { it.contains(".klib has changed") }
}
private fun isAllowedToRerunTask(taskPath: String): Boolean {
@@ -248,33 +248,34 @@
}
private fun shouldTryRerunningTask(task: Task): Boolean {
- return !(
- DONT_TRY_RERUNNING_TASKS.contains(task.name) ||
- DONT_TRY_RERUNNING_TASKS.contains(task.path) ||
- DONT_TRY_RERUNNING_TASK_TYPES.contains(task::class.qualifiedName)
- )
+ return !(DONT_TRY_RERUNNING_TASKS.contains(task.name) ||
+ DONT_TRY_RERUNNING_TASKS.contains(task.path) ||
+ DONT_TRY_RERUNNING_TASK_TYPES.contains(task::class.qualifiedName))
}
fun setup(rootProject: Project, registry: BuildEventsListenerRegistry) {
if (!shouldEnable(rootProject)) {
return
}
- val validate = rootProject.providers
- .environmentVariable(DISALLOW_TASK_EXECUTION_VAR_NAME).map { true }.orElse(false)
+ val validate =
+ rootProject.providers
+ .environmentVariable(DISALLOW_TASK_EXECUTION_VAR_NAME)
+ .map { true }
+ .orElse(false)
// create listener for validating that any task that reran was expected to rerun
- val validatorProvider = rootProject.gradle.sharedServices
- .registerIfAbsent(
+ val validatorProvider =
+ rootProject.gradle.sharedServices.registerIfAbsent(
"TaskUpToDateValidator",
TaskUpToDateValidator::class.java
- ) { spec -> spec.parameters.validate = validate }
+ ) { spec ->
+ spec.parameters.validate = validate
+ }
registry.onTaskCompletion(validatorProvider)
// skip rerunning tasks that are known to be unnecessary to rerun
rootProject.allprojects { subproject ->
subproject.tasks.configureEach { task ->
- task.onlyIf {
- shouldTryRerunningTask(task) || !validate.get()
- }
+ task.onlyIf { shouldTryRerunningTask(task) || !validate.get() }
}
}
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfig.kt b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfig.kt
index f51e0e9..04a99a9 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfig.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfig.kt
@@ -22,17 +22,11 @@
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
-/**
- * AndroidX configuration backed by Gradle properties.
- */
-abstract class AndroidConfigImpl(
- private val project: Project
-) : AndroidConfig {
+/** AndroidX configuration backed by Gradle properties. */
+abstract class AndroidConfigImpl(private val project: Project) : AndroidConfig {
override val buildToolsVersion: String = "34.0.0"
- override val compileSdk: String by lazy {
- project.findProperty(COMPILE_SDK_VERSION).toString()
- }
+ override val compileSdk: String by lazy { project.findProperty(COMPILE_SDK_VERSION).toString() }
override val minSdk: Int = 14
override val ndkVersion: String = "23.1.7779620"
@@ -49,10 +43,11 @@
* Implementation detail. This should only be used by AndroidXGradleProperties for property
* validation.
*/
- val GRADLE_PROPERTIES = listOf(
- COMPILE_SDK_VERSION,
- TARGET_SDK_VERSION,
- )
+ val GRADLE_PROPERTIES =
+ listOf(
+ COMPILE_SDK_VERSION,
+ TARGET_SDK_VERSION,
+ )
}
}
@@ -61,9 +56,7 @@
* [com.android.build.gradle.BaseExtension].
*/
interface AndroidConfig {
- /**
- * Build tools version used for AndroidX projects.
- */
+ /** Build tools version used for AndroidX projects. */
val buildToolsVersion: String
/**
@@ -73,14 +66,10 @@
*/
val compileSdk: String
- /**
- * Default minimum SDK version used for AndroidX projects.
- */
+ /** Default minimum SDK version used for AndroidX projects. */
val minSdk: Int
- /**
- * NDK version used for AndroidX projects.
- */
+ /** NDK version used for AndroidX projects. */
val ndkVersion: String
/**
@@ -91,15 +80,11 @@
val targetSdk: Int
}
-/**
- * Default configuration values for Android Gradle Plugin.
- */
+/** Default configuration values for Android Gradle Plugin. */
val Project.defaultAndroidConfig: AndroidConfig
- get() = extensions.findByType(AndroidConfigImpl::class.java)
- ?: extensions.create(
- "androidx.build.AndroidConfigImpl",
- AndroidConfigImpl::class.java
- )
+ get() =
+ extensions.findByType(AndroidConfigImpl::class.java)
+ ?: extensions.create("androidx.build.AndroidConfigImpl", AndroidConfigImpl::class.java)
fun Project.getExternalProjectPath(): File {
return File(rootProject.projectDir, "../../external").canonicalFile
@@ -113,26 +98,18 @@
return File(project.rootProject.property("prebuiltsRoot").toString())
}
-/**
- * @return the project's Android SDK stub JAR as a File.
- */
+/** @return the project's Android SDK stub JAR as a File. */
fun Project.getAndroidJar(): FileCollection {
val compileSdk = project.defaultAndroidConfig.compileSdk
return files(
arrayOf(
- File(
- getSdkPath(),
- "platforms/$compileSdk/android.jar"
- ),
+ File(getSdkPath(), "platforms/$compileSdk/android.jar"),
// Allow using optional android.car APIs
- File(
- getSdkPath(),
- "platforms/$compileSdk/optional/android.car.jar"
- ),
+ File(getSdkPath(), "platforms/$compileSdk/optional/android.car.jar"),
// Allow using optional android.test APIs
File(getSdkPath(), "platforms/$compileSdk/optional/android.test.base.jar"),
File(getSdkPath(), "platforms/$compileSdk/optional/android.test.mock.jar"),
File(getSdkPath(), "platforms/$compileSdk/optional/android.test.runner.jar")
)
)
-}
\ No newline at end of file
+}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfiguration.kt b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfiguration.kt
new file mode 100644
index 0000000..8387759
--- /dev/null
+++ b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXConfiguration.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.build
+
+import org.gradle.api.Project
+import org.gradle.api.provider.Provider
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
+
+/** Public-facing interface for the `androidx` configuration DSL. */
+interface AndroidXConfiguration {
+ /**
+ * Target Kotlin API version passed to the Kotlin compiler.
+ *
+ * Specified using `kotlinTarget` in the `androidx` DSL.
+ */
+ val kotlinApiVersion: Provider<KotlinVersion>
+
+ /**
+ * Version of the Kotlin BOM used to resolve dependencies in the `org.jetbrains.kotlin` group.
+ *
+ * Specified using `kotlinTarget` in the `androidx` DSL.
+ */
+ val kotlinBomVersion: Provider<String>
+}
+
+enum class KotlinTarget(val apiVersion: KotlinVersion, val catalogVersion: String) {
+ KOTLIN_1_7(KotlinVersion.KOTLIN_1_7, "kotlin17"),
+ KOTLIN_1_8(KotlinVersion.KOTLIN_1_8, "kotlin18"),
+ KOTLIN_1_9(KotlinVersion.KOTLIN_1_9, "kotlin19"),
+ DEFAULT(KOTLIN_1_8);
+
+ constructor(
+ kotlinTarget: KotlinTarget
+ ) : this(kotlinTarget.apiVersion, kotlinTarget.catalogVersion)
+}
+
+val Project.androidXConfiguration: AndroidXConfiguration
+ get() = extensions.findByType(AndroidXConfiguration::class.java)!!
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/AndroidXPublicGradleProperties.kt b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXPublicGradleProperties.kt
index 36cfeca..4ac0e5d 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/AndroidXPublicGradleProperties.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/AndroidXPublicGradleProperties.kt
@@ -18,7 +18,5 @@
package androidx.build
-/**
- * Specifies the type of Android Studio to use for the project's Studio task
- */
+/** Specifies the type of Android Studio to use for the project's Studio task */
const val STUDIO_TYPE = "androidx.studio.type"
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/ApkCopyHelper.kt b/buildSrc/public/src/main/kotlin/androidx/build/ApkCopyHelper.kt
index 685aa9d..4a65f8d 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/ApkCopyHelper.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/ApkCopyHelper.kt
@@ -42,17 +42,16 @@
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val apkFolder: DirectoryProperty
- @get:Internal
- abstract val apkLoader: Property<BuiltArtifactsLoader>
+ @get:Internal abstract val apkLoader: Property<BuiltArtifactsLoader>
- @get:OutputFile
- abstract val outputApk: RegularFileProperty
+ @get:OutputFile abstract val outputApk: RegularFileProperty
@TaskAction
fun copyApk() {
val destinationApk = outputApk.get().asFile
- val apk = apkLoader.get().load(apkFolder.get())
- ?: throw RuntimeException("Cannot load required APK for task: $name")
+ val apk =
+ apkLoader.get().load(apkFolder.get())
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
val apkBuiltArtifact = apk.elements.single()
File(apkBuiltArtifact.outputFile).copyTo(destinationApk, overwrite = true)
}
@@ -61,15 +60,18 @@
fun setupAppApkCopy(project: Project, buildType: String) {
project.extensions.findByType(ApplicationAndroidComponentsExtension::class.java)?.apply {
onVariants(selector().withBuildType(buildType)) { variant ->
- val apkCopy = project.tasks.register("copyAppApk", ApkCopyTask::class.java) { task ->
- task.apkFolder.set(variant.artifacts.get(SingleArtifact.APK))
- task.apkLoader.set(variant.artifacts.getBuiltArtifactsLoader())
- val file = "apks/${project.path.substring(1).replace(':', '-')}-${variant.name}.apk"
- task.outputApk.set(File(project.getDistributionDirectory(), file))
- }
+ val apkCopy =
+ project.tasks.register("copyAppApk", ApkCopyTask::class.java) { task ->
+ task.apkFolder.set(variant.artifacts.get(SingleArtifact.APK))
+ task.apkLoader.set(variant.artifacts.getBuiltArtifactsLoader())
+ val file =
+ "apks/${project.path.substring(1).replace(':', '-')}-${variant.name}.apk"
+ task.outputApk.set(File(project.getDistributionDirectory(), file))
+ }
project.addToBuildOnServer(apkCopy)
}
- } ?: throw Exception("Unable to set up app APK copying")
+ }
+ ?: throw Exception("Unable to set up app APK copying")
}
fun setupTestApkCopy(project: Project) {
@@ -82,7 +84,6 @@
name = variant.androidTest?.name
artifacts = variant.androidTest?.artifacts
}
-
project.plugins.hasPlugin("com.android.test") -> {
name = variant.name
artifacts = variant.artifacts
@@ -91,12 +92,13 @@
if (name == null || artifacts == null) {
return@onVariants
}
- val apkCopy = project.tasks.register("copyTestApk", ApkCopyTask::class.java) { task ->
- task.apkFolder.set(artifacts.get(SingleArtifact.APK))
- task.apkLoader.set(artifacts.getBuiltArtifactsLoader())
- val file = "apks/${project.path.substring(1).replace(':', '-')}-$name.apk"
- task.outputApk.set(File(project.getDistributionDirectory(), file))
- }
+ val apkCopy =
+ project.tasks.register("copyTestApk", ApkCopyTask::class.java) { task ->
+ task.apkFolder.set(artifacts.get(SingleArtifact.APK))
+ task.apkLoader.set(artifacts.getBuiltArtifactsLoader())
+ val file = "apks/${project.path.substring(1).replace(':', '-')}-$name.apk"
+ task.outputApk.set(File(project.getDistributionDirectory(), file))
+ }
project.addToBuildOnServer(apkCopy)
}
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/BuildOnServer.kt b/buildSrc/public/src/main/kotlin/androidx/build/BuildOnServer.kt
index 666dfb8..c29f465 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/BuildOnServer.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/BuildOnServer.kt
@@ -22,20 +22,12 @@
const val BUILD_ON_SERVER_TASK = "buildOnServer"
-/**
- * Configures the root project's buildOnServer task to run the specified task.
- */
+/** Configures the root project's buildOnServer task to run the specified task. */
fun <T : Task> Project.addToBuildOnServer(taskProvider: TaskProvider<T>) {
- tasks.named(BUILD_ON_SERVER_TASK).configure {
- it.dependsOn(taskProvider)
- }
+ tasks.named(BUILD_ON_SERVER_TASK).configure { it.dependsOn(taskProvider) }
}
-/**
- * Configures the root project's buildOnServer task to run the specified task.
- */
+/** Configures the root project's buildOnServer task to run the specified task. */
fun <T : Task> Project.addToBuildOnServer(taskPath: String) {
- tasks.named(BUILD_ON_SERVER_TASK).configure {
- it.dependsOn(taskPath)
- }
+ tasks.named(BUILD_ON_SERVER_TASK).configure { it.dependsOn(taskPath) }
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/BuildServerConfiguration.kt b/buildSrc/public/src/main/kotlin/androidx/build/BuildServerConfiguration.kt
index 27f18c9..fece4cf 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/BuildServerConfiguration.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/BuildServerConfiguration.kt
@@ -19,6 +19,9 @@
import androidx.build.gradle.isRoot
import java.io.File
import org.gradle.api.Project
+import org.gradle.api.file.Directory
+import org.gradle.api.file.RegularFile
+import org.gradle.api.provider.Provider
/**
* @return build id string for current build
@@ -37,8 +40,8 @@
/**
* Gets set to true when the build id is prefixed with P.
*
- * In AffectedModuleDetector, we return a different ProjectSubset in presubmit vs.
- * postsubmit, to get the desired test behaviors.
+ * In AffectedModuleDetector, we return a different ProjectSubset in presubmit vs. postsubmit, to
+ * get the desired test behaviors.
*/
fun isPresubmitBuild(): Boolean {
return if (System.getenv("BUILD_NUMBER") != null) {
@@ -49,80 +52,64 @@
}
/**
- * The DIST_DIR is where you want to save things from the build. The build server will copy
- * the contents of DIST_DIR to somewhere and make it available.
+ * The DIST_DIR is where you want to save things from the build. The build server will copy the
+ * contents of DIST_DIR to somewhere and make it available.
*/
fun Project.getDistributionDirectory(): File {
val envVar = project.providers.environmentVariable("DIST_DIR").getOrElse("")
return if (envVar != "") {
- File(envVar)
- } else {
- File(getRootOutDirectory(), "dist")
- }.also { distDir ->
- distDir.mkdirs()
- }
+ File(envVar)
+ } else {
+ File(getRootOutDirectory(), "dist")
+ }
+ .also { distDir -> distDir.mkdirs() }
}
-/**
- * Returns the out directory (an ancestor of all files generated by the build)
- */
+/** Returns the out directory (an ancestor of all files generated by the build) */
fun Project.getRootOutDirectory(): File {
return project.rootProject.extensions.extraProperties.get("outDir") as File
}
-/**
- * Directory to put build info files for release service dependency files.
- */
-fun Project.getBuildInfoDirectory(): File =
- File(getDistributionDirectory(), "build-info")
+/** Directory to put build info files for release service dependency files. */
+fun Project.getBuildInfoDirectory(): File = File(getDistributionDirectory(), "build-info")
/**
- * Directory for android test configuration files that get consumed by Tradefed in CI. These
- * configs cause all the tests to be run, except in cases where buildSrc changes.
+ * Directory for android test configuration files that get consumed by Tradefed in CI. These configs
+ * cause all the tests to be run, except in cases where buildSrc changes.
*/
-fun Project.getTestConfigDirectory(): File =
- File(rootProject.buildDir, "test-xml-configs")
+fun Project.getTestConfigDirectory(): Provider<Directory> =
+ rootProject.layout.buildDirectory.dir("test-xml-configs")
-/**
- * Directory to put release note files for generate release note tasks.
- */
-fun Project.getReleaseNotesDirectory(): File =
- File(getDistributionDirectory(), "release-notes")
+/** A file within [getTestConfigDirectory] */
+fun Project.getFileInTestConfigDirectory(name: String): Provider<RegularFile> =
+ getTestConfigDirectory().map { it.file(name) }
-/**
- * Directory to put host test results so they can be consumed by the testing dashboard.
- */
+/** Directory to put release note files for generate release note tasks. */
+fun Project.getReleaseNotesDirectory(): File = File(getDistributionDirectory(), "release-notes")
+
+/** Directory to put host test results so they can be consumed by the testing dashboard. */
fun Project.getHostTestResultDirectory(): File =
File(getDistributionDirectory(), "host-test-reports")
-/**
- * Directory to put json metrics so they can be consumed by the metrics dashboards.
- */
-fun Project.getLibraryMetricsDirectory(): File =
- File(getDistributionDirectory(), "librarymetrics")
+/** Directory to put json metrics so they can be consumed by the metrics dashboards. */
+fun Project.getLibraryMetricsDirectory(): File = File(getDistributionDirectory(), "librarymetrics")
-/**
- * Directory to put json metrics so they can be consumed by the metrics dashboards.
- */
-fun Project.getLibraryReportsDirectory(): File =
- File(getDistributionDirectory(), "libraryreports")
+/** Directory to put json metrics so they can be consumed by the metrics dashboards. */
+fun Project.getLibraryReportsDirectory(): File = File(getDistributionDirectory(), "libraryreports")
-/**
- * Whether the build should force all versions to be snapshots.
- */
+/** Whether the build should force all versions to be snapshots. */
fun isSnapshotBuild() = System.getenv("SNAPSHOT") != null
-/**
- * Directory in a maven format to put all the publishing libraries.
- */
+/** Directory in a maven format to put all the publishing libraries. */
fun Project.getRepositoryDirectory(): File {
val actualRootProject = if (project.isRoot) project else project.rootProject
- val directory = if (isSnapshotBuild()) {
- // For snapshot builds we put artifacts directly where downstream users can find them.
- File(actualRootProject.getDistributionDirectory(), "repository")
- } else {
- File(actualRootProject.buildDir, "support_repo")
- }
+ val directory =
+ if (isSnapshotBuild()) {
+ // For snapshot builds we put artifacts directly where downstream users can find them.
+ File(actualRootProject.getDistributionDirectory(), "repository")
+ } else {
+ File(actualRootProject.buildDir, "support_repo")
+ }
directory.mkdirs()
return directory
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/BundleInsideHelper.kt b/buildSrc/public/src/main/kotlin/androidx/build/BundleInsideHelper.kt
index 502f2b5..e928e54 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/BundleInsideHelper.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/BundleInsideHelper.kt
@@ -17,7 +17,6 @@
package androidx.build
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
-import java.io.File
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
@@ -29,9 +28,7 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
-/**
- * Allow java and Android libraries to bundle other projects inside the project jar/aar.
- */
+/** Allow java and Android libraries to bundle other projects inside the project jar/aar. */
object BundleInsideHelper {
val CONFIGURATION_NAME = "bundleInside"
val REPACKAGE_TASK_NAME = "repackageBundledJars"
@@ -47,10 +44,9 @@
*
* Used project are expected
*
- * @see forInsideAar(String, String)
- *
- * @receiver the project that should bundle jars specified by this configuration
* @param relocations a list of package relocations to apply
+ * @receiver the project that should bundle jars specified by this configuration
+ * @see forInsideAar(String, String)
*/
@JvmStatic
fun Project.forInsideAar(relocations: List<Relocation>) {
@@ -60,8 +56,8 @@
dependencies.add("implementation", files(repackage.flatMap { it.archiveFile }))
}
/**
- * Creates 3 configurations for the users to use that will be used bundle these dependency
- * jars inside of libs/ directory inside of the aar.
+ * Creates 3 configurations for the users to use that will be used bundle these dependency jars
+ * inside of libs/ directory inside of the aar.
*
* ```
* dependencies {
@@ -71,9 +67,9 @@
*
* Used project are expected
*
- * @receiver the project that should bundle jars specified by these configurations
* @param from specifies from which package the rename should happen
* @param to specifies to which package to put the renamed classes
+ * @receiver the project that should bundle jars specified by these configurations
*/
@JvmStatic
fun Project.forInsideAar(from: String, to: String) {
@@ -81,8 +77,8 @@
}
/**
- * Creates a configuration for the users to use that will be used bundle these dependency
- * jars inside of this project's jar.
+ * Creates a configuration for the users to use that will be used bundle these dependency jars
+ * inside of this project's jar.
*
* ```
* dependencies {
@@ -91,17 +87,15 @@
* releaseBundleInside(project(path: ":bar", configuration: "someReleaseConfiguration"))
* }
* ```
- * @receiver the project that should bundle jars specified by these configurations
+ *
* @param from specifies from which package the rename should happen
* @param to specifies to which package to put the renamed classes
+ * @receiver the project that should bundle jars specified by these configurations
*/
@JvmStatic
fun Project.forInsideJar(from: String, to: String) {
val bundle = configurations.create(CONFIGURATION_NAME)
- val repackage = configureRepackageTaskForType(
- listOf(Relocation(from, to)),
- bundle
- )
+ val repackage = configureRepackageTaskForType(listOf(Relocation(from, to)), bundle)
dependencies.add("compileOnly", files(repackage.flatMap { it.archiveFile }))
dependencies.add("testImplementation", files(repackage.flatMap { it.archiveFile }))
@@ -132,33 +126,27 @@
/**
* KMP Version of [Project.forInsideJar]. See those docs for details.
*
- * TODO(b/237104605): bundleInside is a global configuration. Should figure out how to make it
- * work properly with kmp and source sets so it can reside inside a sourceSet dependency.
+ * TODO(b/237104605): bundleInside is a global configuration. Should figure out how to make it
+ * work properly with kmp and source sets so it can reside inside a sourceSet dependency.
*/
@JvmStatic
fun Project.forInsideJarKmp(from: String, to: String) {
- val kmpExtension = extensions.findByType<KotlinMultiplatformExtension>()
- ?: error("kmp only")
+ val kmpExtension =
+ extensions.findByType<KotlinMultiplatformExtension>() ?: error("kmp only")
val bundle = configurations.create(CONFIGURATION_NAME)
- val repackage = configureRepackageTaskForType(
- listOf(Relocation(from, to)),
- bundle
- )
+ val repackage = configureRepackageTaskForType(listOf(Relocation(from, to)), bundle)
// To account for KMP structure we need to find the jvm specific target
// and add the repackaged archive files to only their compilations.
- val jvmTarget = kmpExtension.targets.firstOrNull {
- it.platformType == KotlinPlatformType.jvm
- } as? KotlinJvmTarget ?: error("cannot find jvm target")
+ val jvmTarget =
+ kmpExtension.targets.firstOrNull { it.platformType == KotlinPlatformType.jvm }
+ as? KotlinJvmTarget
+ ?: error("cannot find jvm target")
jvmTarget.compilations["main"].defaultSourceSet {
- dependencies {
- compileOnly(files(repackage.flatMap { it.archiveFile }))
- }
+ dependencies { compileOnly(files(repackage.flatMap { it.archiveFile })) }
}
jvmTarget.compilations["test"].defaultSourceSet {
- dependencies {
- implementation(files(repackage.flatMap { it.archiveFile }))
- }
+ dependencies { implementation(files(repackage.flatMap { it.archiveFile })) }
}
val jarTask = tasks.named(jvmTarget.artifactsTaskName)
jarTask.configure {
@@ -170,10 +158,10 @@
}
/**
- * Creates a configuration for users to use that will be used bundle these dependency
- * jars inside of this lint check's jar. This is required because lintPublish does
- * not currently support dependencies, so instead we need to bundle any dependencies with the
- * lint jar manually. (b/182319899)
+ * Creates a configuration for users to use that will be used bundle these dependency jars
+ * inside of this lint check's jar. This is required because lintPublish does not currently
+ * support dependencies, so instead we need to bundle any dependencies with the lint jar
+ * manually. (b/182319899)
*
* ```
* dependencies {
@@ -187,6 +175,7 @@
* bundleInside(project(":foo-lint-utils"))
* }
* ```
+ *
* @receiver the project that should bundle jars specified by these configurations
*/
@JvmStatic
@@ -223,10 +212,7 @@
relocations: List<Relocation>,
configuration: Configuration
): TaskProvider<ShadowJar> {
- return tasks.register(
- REPACKAGE_TASK_NAME,
- ShadowJar::class.java
- ) { task ->
+ return tasks.register(REPACKAGE_TASK_NAME, ShadowJar::class.java) { task ->
task.apply {
configurations = listOf(configuration)
for (relocation in relocations) {
@@ -234,7 +220,7 @@
}
archiveBaseName.set("repackaged")
archiveVersion.set("")
- destinationDirectory.set(File(buildDir, "repackaged"))
+ destinationDirectory.set(layout.buildDirectory.dir("repackaged"))
}
}
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/ExportAtomicLibraryGroupsToTextTask.kt b/buildSrc/public/src/main/kotlin/androidx/build/ExportAtomicLibraryGroupsToTextTask.kt
index 085d264..52ad665 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/ExportAtomicLibraryGroupsToTextTask.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/ExportAtomicLibraryGroupsToTextTask.kt
@@ -37,8 +37,7 @@
@get:[Input]
lateinit var libraryGroups: List<LibraryGroup>
- @get:OutputDirectory
- abstract val outputDir: DirectoryProperty
+ @get:OutputDirectory abstract val outputDir: DirectoryProperty
@TaskAction
fun exec() {
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/KmpPlatforms.kt b/buildSrc/public/src/main/kotlin/androidx/build/KmpPlatforms.kt
index d1d7611..84a979a 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/KmpPlatforms.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/KmpPlatforms.kt
@@ -29,9 +29,7 @@
*/
const val ENABLED_KMP_TARGET_PLATFORMS = "androidx.enabled.kmp.target.platforms"
-/**
- * Target platform groups supported by the AndroidX implementation of Kotlin multi-platform.
- */
+/** Target platform groups supported by the AndroidX implementation of Kotlin multi-platform. */
enum class PlatformGroup {
JVM,
JS,
@@ -40,9 +38,7 @@
DESKTOP;
companion object {
- /**
- * Target platform groups which require native compilation (e.g. LLVM).
- */
+ /** Target platform groups which require native compilation (e.g. LLVM). */
val native = listOf(MAC, LINUX)
/**
@@ -55,9 +51,7 @@
}
}
-/**
- * Target platforms supported by the AndroidX implementation of Kotlin multi-platform.
- */
+/** Target platforms supported by the AndroidX implementation of Kotlin multi-platform. */
enum class PlatformIdentifier(
val id: String,
@Suppress("unused") private val group: PlatformGroup
@@ -99,44 +93,44 @@
return enabled.toSortedSet()
}
-private fun matchingPlatformGroups(flag: String) = if (flag == "native") {
- PlatformGroup.native
-} else {
- listOf(PlatformGroup.valueOf(flag.uppercase(Locale.getDefault())))
-}
+private fun matchingPlatformGroups(flag: String) =
+ if (flag == "native") {
+ PlatformGroup.native
+ } else {
+ listOf(PlatformGroup.valueOf(flag.uppercase(Locale.getDefault())))
+ }
private val Project.enabledKmpPlatforms: Set<PlatformGroup>
get() {
- val extension: KmpPlatformsExtension = extensions.findByType()
- ?: extensions.create("androidx.build.KmpPlatforms", this)
+ val extension: KmpPlatformsExtension =
+ extensions.findByType() ?: extensions.create("androidx.build.KmpPlatforms", this)
return extension.enabledKmpPlatforms
}
-/**
- * Returns true if kotlin native targets should be enabled.
- */
+/** Returns true if kotlin native targets should be enabled. */
private fun Project.isKotlinNativeEnabled(): Boolean {
return "KMP".equals(System.getenv()["ANDROIDX_PROJECTS"], ignoreCase = true) ||
"INFRAROGUE".equals(System.getenv()["ANDROIDX_PROJECTS"], ignoreCase = true) ||
ProjectLayoutType.isPlayground(project) ||
- project.providers.gradleProperty("androidx.kmp.native.enabled")
- .orNull?.toBoolean() == true
+ project.providers.gradleProperty("androidx.kmp.native.enabled").orNull?.toBoolean() == true
}
-/**
- * Extension used to store parsed KMP configuration information.
- */
+/** Extension used to store parsed KMP configuration information. */
private open class KmpPlatformsExtension(project: Project) {
- val enabledKmpPlatforms = parseTargetPlatformsFlag(
- project.findProperty(ENABLED_KMP_TARGET_PLATFORMS) as? String
- )
+ val enabledKmpPlatforms =
+ parseTargetPlatformsFlag(project.findProperty(ENABLED_KMP_TARGET_PLATFORMS) as? String)
}
fun Project.enableJs(): Boolean = enabledKmpPlatforms.contains(PlatformGroup.JS)
+
fun Project.enableMac(): Boolean =
enabledKmpPlatforms.contains(PlatformGroup.MAC) || isKotlinNativeEnabled()
+
fun Project.enableLinux(): Boolean =
enabledKmpPlatforms.contains(PlatformGroup.LINUX) || isKotlinNativeEnabled()
+
fun Project.enableJvm(): Boolean = enabledKmpPlatforms.contains(PlatformGroup.JVM)
+
fun Project.enableDesktop(): Boolean = enabledKmpPlatforms.contains(PlatformGroup.DESKTOP)
+
fun Project.enableNative(): Boolean = enableMac() && enableLinux()
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/LibraryGroup.kt b/buildSrc/public/src/main/kotlin/androidx/build/LibraryGroup.kt
index 545d364..c28c055 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/LibraryGroup.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/LibraryGroup.kt
@@ -17,8 +17,8 @@
package androidx.build
/**
- * This object contains the library group, as well as whether libraries
- * in this group are all required to have the same development version.
+ * This object contains the library group, as well as whether libraries in this group are all
+ * required to have the same development version.
*/
data class LibraryGroup(
val group: String = "unspecified",
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt b/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
index 51a2301..a07ef93 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/LibraryType.kt
@@ -17,59 +17,49 @@
package androidx.build
/**
- * LibraryType represents the purpose and type of a library, whether it is a conventional library,
- * a set of samples showing how to use a conventional library, a set of lint rules for using a
+ * LibraryType represents the purpose and type of a library, whether it is a conventional library, a
+ * set of samples showing how to use a conventional library, a set of lint rules for using a
* conventional library, or any other type of published project.
*
* LibraryType collects a set of properties together, to make the "why" more clear and to simplify
- * setting these properties for library developers, so that only a single enum inferrable from
- * the purpose of the library needs to be set, rather than a variety of more arcane options.
+ * setting these properties for library developers, so that only a single enum inferrable from the
+ * purpose of the library needs to be set, rather than a variety of more arcane options.
*
- * These properties are as follows:
- * LibraryType.publish represents how the library is published to GMaven
- * LibraryType.sourceJars represents whether we publish the source code for the library to GMaven
- * in a way accessible to download, such as by Android Studio
- * LibraryType.generateDocs represents whether we generate documentation from the library to put on
- * developer.android.com
- * LibraryType.checkApi represents whether we enforce API compatibility of the library according
- * to our semantic versioning protocol
+ * These properties are as follows: LibraryType.publish represents how the library is published to
+ * GMaven LibraryType.sourceJars represents whether we publish the source code for the library to
+ * GMaven in a way accessible to download, such as by Android Studio LibraryType.generateDocs
+ * represents whether we generate documentation from the library to put on developer.android.com
+ * LibraryType.checkApi represents whether we enforce API compatibility of the library according to
+ * our semantic versioning protocol
*
- * The possible values of LibraryType are as follows:
- * PUBLISHED_LIBRARY: a conventional library, published, sourced, documented, and versioned.
- * PUBLISHED_TEST_LIBRARY: PUBLISHED_LIBRARY, but allows calling @VisibleForTesting API. Used for
- * libraries that allow developers to test code that uses your library. Often provides test fakes.
- * PUBLISHED_NATIVE_LIBRARY: PUBLISHED_LIBRARY, but uses native API tracking instead of Java
- * INTERNAL_TEST_LIBRARY: unpublished, untracked, undocumented. Used in internal tests. Usually
- * contains integration tests, but is _not_ an app. Runs device tests.
- * INTERNAL_HOST_TEST_LIBRARY: as INTERNAL_TEST_LIBRARY, but runs host tests instead. Avoid mixing
- * host tests and device tests in the same library, for performance / test-result-caching reasons.
- * SAMPLES: a library containing sample code referenced in your library's documentation with
- * @sampled, published as a documentation-related supplement to a conventional library.
- * LINT: a library of lint rules for using a conventional library. Published through lintPublish as
- * part of an AAR, not published standalone.
- * COMPILER_DAEMON: a tool that modifies the kotlin or java compiler. Used only while compiling. Has
- * no API and does not publish source jars, but does release to maven.
- * COMPILER_DAEMON_TEST: a compiler plugin that is not published at all, for internal-only use.
- * COMPILER_PLUGIN: as COMPILER_DAEMON, but is compatible with JDK 11.
- * GRADLE_PLUGIN: a library that is a gradle plugin.
- * ANNOTATION_PROCESSOR: a library consisting of an annotation processor. Used only while compiling.
- * ANNOTATION_PROCESSOR_UTILS: contains reference code for understanding an annotation processor.
- * Publishes source jars, but does not track API.
- * OTHER_CODE_PROCESSOR: a library that algorithmically generates and/or alters code
- * but not through hooking into custom annotations or the kotlin compiler.
- * For example, navigation:safe-args-generator or Jetifier.
- * IDE_PLUGIN: a library that should only ever be downloaded by studio. Unfortunately, we don't
- * yet have a good way to track API for these. b/281843422
- * UNSET: a library that has not yet been migrated to using LibraryType. Should never be used.
- * APP: an app, such as an example app or integration testsapp. Should never be used; apps should
- * not apply the AndroidX plugin or have an androidx block in their build.gradle files.
+ * The possible values of LibraryType are as follows: PUBLISHED_LIBRARY: a conventional library,
+ * published, sourced, documented, and versioned. PUBLISHED_TEST_LIBRARY: PUBLISHED_LIBRARY, but
+ * allows calling @VisibleForTesting API. Used for libraries that allow developers to test code that
+ * uses your library. Often provides test fakes. PUBLISHED_NATIVE_LIBRARY: PUBLISHED_LIBRARY, but
+ * uses native API tracking instead of Java INTERNAL_TEST_LIBRARY: unpublished, untracked,
+ * undocumented. Used in internal tests. Usually contains integration tests, but is _not_ an app.
+ * Runs device tests. INTERNAL_HOST_TEST_LIBRARY: as INTERNAL_TEST_LIBRARY, but runs host tests
+ * instead. Avoid mixing host tests and device tests in the same library, for performance /
+ * test-result-caching reasons. SAMPLES: a library containing sample code referenced in your
+ * library's documentation with @sampled, published as a documentation-related supplement to a
+ * conventional library. LINT: a library of lint rules for using a conventional library. Published
+ * through lintPublish as part of an AAR, not published standalone. COMPILER_DAEMON: a tool that
+ * modifies the kotlin or java compiler. Used only while compiling. Has no API and does not publish
+ * source jars, but does release to maven. COMPILER_DAEMON_TEST: a compiler plugin that is not
+ * published at all, for internal-only use. COMPILER_PLUGIN: as COMPILER_DAEMON, but is compatible
+ * with JDK 11. GRADLE_PLUGIN: a library that is a gradle plugin. ANNOTATION_PROCESSOR: a library
+ * consisting of an annotation processor. Used only while compiling. ANNOTATION_PROCESSOR_UTILS:
+ * contains reference code for understanding an annotation processor. Publishes source jars, but
+ * does not track API. OTHER_CODE_PROCESSOR: a library that algorithmically generates and/or alters
+ * code but not through hooking into custom annotations or the kotlin compiler. For example,
+ * navigation:safe-args-generator or Jetifier. IDE_PLUGIN: a library that should only ever be
+ * downloaded by studio. Unfortunately, we don't yet have a good way to track API for these.
+ * b/281843422 UNSET: a library that has not yet been migrated to using LibraryType. Should never be
+ * used. APP: an app, such as an example app or integration testsapp. Should never be used; apps
+ * should not apply the AndroidX plugin or have an androidx block in their build.gradle files.
*
- * TODO: potential future LibraryTypes:
- * KOTLIN_ONLY_LIBRARY: like PUBLISHED_LIBRARY, but not intended for use from java. ktx and compose.
- * INTERNAL_TEST
- * DEMO
- * IDE_PLUGIN
- *
+ * TODO: potential future LibraryTypes: KOTLIN_ONLY_LIBRARY: like PUBLISHED_LIBRARY, but not
+ * intended for use from java. ktx and compose. INTERNAL_TEST DEMO IDE_PLUGIN
*/
sealed class LibraryType(
val publish: Publish = Publish.NONE,
@@ -102,115 +92,144 @@
val APP = UNSET
@Suppress("DEPRECATION")
- private val allTypes = mapOf(
- "PUBLISHED_LIBRARY" to PUBLISHED_LIBRARY,
- "PUBLISHED_TEST_LIBRARY" to PUBLISHED_TEST_LIBRARY,
- "PUBLISHED_NATIVE_LIBRARY" to PUBLISHED_NATIVE_LIBRARY,
- "INTERNAL_TEST_LIBRARY" to INTERNAL_TEST_LIBRARY,
- "INTERNAL_HOST_TEST_LIBRARY" to INTERNAL_HOST_TEST_LIBRARY,
- "SAMPLES" to SAMPLES,
- "LINT" to LINT,
- "COMPILER_DAEMON" to COMPILER_DAEMON,
- "COMPILER_DAEMON_TEST" to COMPILER_DAEMON_TEST,
- "COMPILER_PLUGIN" to COMPILER_PLUGIN,
- "GRADLE_PLUGIN" to GRADLE_PLUGIN,
- "ANNOTATION_PROCESSOR" to ANNOTATION_PROCESSOR,
- "ANNOTATION_PROCESSOR_UTILS" to ANNOTATION_PROCESSOR_UTILS,
- "OTHER_CODE_PROCESSOR" to OTHER_CODE_PROCESSOR,
- "IDE_PLUGIN" to IDE_PLUGIN,
- "UNSET" to UNSET,
- "APP" to APP
- )
+ private val allTypes =
+ mapOf(
+ "PUBLISHED_LIBRARY" to PUBLISHED_LIBRARY,
+ "PUBLISHED_TEST_LIBRARY" to PUBLISHED_TEST_LIBRARY,
+ "PUBLISHED_NATIVE_LIBRARY" to PUBLISHED_NATIVE_LIBRARY,
+ "INTERNAL_TEST_LIBRARY" to INTERNAL_TEST_LIBRARY,
+ "INTERNAL_HOST_TEST_LIBRARY" to INTERNAL_HOST_TEST_LIBRARY,
+ "SAMPLES" to SAMPLES,
+ "LINT" to LINT,
+ "COMPILER_DAEMON" to COMPILER_DAEMON,
+ "COMPILER_DAEMON_TEST" to COMPILER_DAEMON_TEST,
+ "COMPILER_PLUGIN" to COMPILER_PLUGIN,
+ "GRADLE_PLUGIN" to GRADLE_PLUGIN,
+ "ANNOTATION_PROCESSOR" to ANNOTATION_PROCESSOR,
+ "ANNOTATION_PROCESSOR_UTILS" to ANNOTATION_PROCESSOR_UTILS,
+ "OTHER_CODE_PROCESSOR" to OTHER_CODE_PROCESSOR,
+ "IDE_PLUGIN" to IDE_PLUGIN,
+ "UNSET" to UNSET,
+ "APP" to APP
+ )
+
fun valueOf(name: String): LibraryType {
val result = allTypes[name]
- check(result != null) {
- "LibraryType with name $name not found"
- }
+ check(result != null) { "LibraryType with name $name not found" }
return result
}
}
- open class PublishedLibrary(allowCallingVisibleForTestsApis: Boolean = false) : LibraryType(
- publish = Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = true,
- checkApi = RunApiTasks.Yes(),
- allowCallingVisibleForTestsApis = allowCallingVisibleForTestsApis
- )
+
+ open class PublishedLibrary(allowCallingVisibleForTestsApis: Boolean = false) :
+ LibraryType(
+ publish = Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = true,
+ checkApi = RunApiTasks.Yes(),
+ allowCallingVisibleForTestsApis = allowCallingVisibleForTestsApis
+ )
+
open class InternalLibrary(
compilationTarget: CompilationTarget = CompilationTarget.DEVICE,
allowCallingVisibleForTestsApis: Boolean = false
- ) : LibraryType(
- checkApi = RunApiTasks.No("Internal Library"),
- compilationTarget = compilationTarget,
- allowCallingVisibleForTestsApis = allowCallingVisibleForTestsApis
- )
+ ) :
+ LibraryType(
+ checkApi = RunApiTasks.No("Internal Library"),
+ compilationTarget = compilationTarget,
+ allowCallingVisibleForTestsApis = allowCallingVisibleForTestsApis
+ )
class PublishedTestLibrary() : PublishedLibrary(allowCallingVisibleForTestsApis = true)
- class InternalTestLibrary() : InternalLibrary(allowCallingVisibleForTestsApis = true)
- class InternalHostTestLibrary() : InternalLibrary(CompilationTarget.HOST)
- class PublishedNativeLibrary : PublishedLibrary()
- class Samples : LibraryType(
- publish = Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = true,
- checkApi = RunApiTasks.No("Sample Library")
- )
- class Lint : LibraryType(
- publish = Publish.NONE,
- sourceJars = false,
- checkApi = RunApiTasks.No("Lint Library"),
- compilationTarget = CompilationTarget.HOST
- )
- class CompilerDaemon : LibraryType(
- Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = false,
- RunApiTasks.No("Compiler Daemon (Host-only)"),
- CompilationTarget.HOST
- )
- class CompilerDaemonTest : LibraryType(
- Publish.NONE,
- sourceJars = false,
- RunApiTasks.No("Compiler Daemon (Host-only) Test"),
- CompilationTarget.HOST
- )
- class CompilerPlugin : LibraryType(
- Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = false,
- RunApiTasks.No("Compiler Plugin (Host-only)"),
- CompilationTarget.HOST
- )
- class GradlePlugin : LibraryType(
- Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = false,
- RunApiTasks.No("Gradle Plugin (Host-only)"),
- CompilationTarget.HOST
- )
- class AnnotationProcessor : LibraryType(
- publish = Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = false,
- checkApi = RunApiTasks.No("Annotation Processor"),
- compilationTarget = CompilationTarget.HOST
- )
- class AnnotationProcessorUtils : LibraryType(
- publish = Publish.SNAPSHOT_AND_RELEASE,
- sourceJars = true,
- checkApi = RunApiTasks.No("Annotation Processor Helper Library"),
- compilationTarget = CompilationTarget.HOST
- )
- class OtherCodeProcessor(publish: Publish = Publish.SNAPSHOT_AND_RELEASE) : LibraryType(
- publish = publish,
- sourceJars = false,
- checkApi = RunApiTasks.No("Code Processor (Host-only)"),
- compilationTarget = CompilationTarget.HOST
- )
- class IdePlugin : LibraryType(
- publish = Publish.NONE,
- sourceJars = false,
- // TODO: figure out a way to make sure we don't break Studio
- checkApi = RunApiTasks.No("IDE Plugin (consumed only by Android Studio"),
- // This is a bit complicated. IDE plugins usually have an on-device component installed by
- // Android Studio, rather than by a client of the library, but also a host-side component.
- compilationTarget = CompilationTarget.DEVICE
- )
+ class InternalTestLibrary() : InternalLibrary(allowCallingVisibleForTestsApis = true)
+
+ class InternalHostTestLibrary() : InternalLibrary(CompilationTarget.HOST)
+
+ class PublishedNativeLibrary : PublishedLibrary()
+
+ class Samples :
+ LibraryType(
+ publish = Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = true,
+ checkApi = RunApiTasks.No("Sample Library")
+ )
+
+ class Lint :
+ LibraryType(
+ publish = Publish.NONE,
+ sourceJars = false,
+ checkApi = RunApiTasks.No("Lint Library"),
+ compilationTarget = CompilationTarget.HOST
+ )
+
+ class CompilerDaemon :
+ LibraryType(
+ Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = false,
+ RunApiTasks.No("Compiler Daemon (Host-only)"),
+ CompilationTarget.HOST
+ )
+
+ class CompilerDaemonTest :
+ LibraryType(
+ Publish.NONE,
+ sourceJars = false,
+ RunApiTasks.No("Compiler Daemon (Host-only) Test"),
+ CompilationTarget.HOST
+ )
+
+ class CompilerPlugin :
+ LibraryType(
+ Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = false,
+ RunApiTasks.No("Compiler Plugin (Host-only)"),
+ CompilationTarget.HOST
+ )
+
+ class GradlePlugin :
+ LibraryType(
+ Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = false,
+ RunApiTasks.No("Gradle Plugin (Host-only)"),
+ CompilationTarget.HOST
+ )
+
+ class AnnotationProcessor :
+ LibraryType(
+ publish = Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = false,
+ checkApi = RunApiTasks.No("Annotation Processor"),
+ compilationTarget = CompilationTarget.HOST
+ )
+
+ class AnnotationProcessorUtils :
+ LibraryType(
+ publish = Publish.SNAPSHOT_AND_RELEASE,
+ sourceJars = true,
+ checkApi = RunApiTasks.No("Annotation Processor Helper Library"),
+ compilationTarget = CompilationTarget.HOST
+ )
+
+ class OtherCodeProcessor(publish: Publish = Publish.SNAPSHOT_AND_RELEASE) :
+ LibraryType(
+ publish = publish,
+ sourceJars = false,
+ checkApi = RunApiTasks.No("Code Processor (Host-only)"),
+ compilationTarget = CompilationTarget.HOST
+ )
+
+ class IdePlugin :
+ LibraryType(
+ publish = Publish.NONE,
+ sourceJars = false,
+ // TODO: figure out a way to make sure we don't break Studio
+ checkApi = RunApiTasks.No("IDE Plugin (consumed only by Android Studio"),
+ // This is a bit complicated. IDE plugins usually have an on-device component installed
+ // by
+ // Android Studio, rather than by a client of the library, but also a host-side
+ // component.
+ compilationTarget = CompilationTarget.DEVICE
+ )
+
class Unset : LibraryType()
}
@@ -222,21 +241,23 @@
}
/**
- * Publish Enum:
- * Publish.NONE -> Generates no artifacts; does not generate snapshot artifacts
- * or releasable maven artifacts
- * Publish.SNAPSHOT_ONLY -> Only generates snapshot artifacts
+ * Publish Enum: Publish.NONE -> Generates no artifacts; does not generate snapshot artifacts or
+ * releasable maven artifacts Publish.SNAPSHOT_ONLY -> Only generates snapshot artifacts
* Publish.SNAPSHOT_AND_RELEASE -> Generates both snapshot artifacts and releasable maven artifact
* Publish.UNSET -> Do the default, based on LibraryType. If LibraryType.UNSET -> Publish.NONE
*
* TODO: should we introduce a Publish.lintPublish?
- * TODO: remove Publish.UNSET once we remove LibraryType.UNSET.
- * It is necessary now in order to be able to override LibraryType.publish (with Publish.None)
+ * TODO: remove Publish.UNSET once we remove LibraryType.UNSET. It is necessary now in order to be
+ * able to override LibraryType.publish (with Publish.None)
*/
enum class Publish {
- NONE, SNAPSHOT_ONLY, SNAPSHOT_AND_RELEASE, UNSET;
+ NONE,
+ SNAPSHOT_ONLY,
+ SNAPSHOT_AND_RELEASE,
+ UNSET;
fun shouldRelease() = this == SNAPSHOT_AND_RELEASE
+
fun shouldPublish() = shouldRelease() || this == SNAPSHOT_ONLY
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/OperatingSystem.kt b/buildSrc/public/src/main/kotlin/androidx/build/OperatingSystem.kt
index c73ff70..0f09b4f 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/OperatingSystem.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/OperatingSystem.kt
@@ -35,4 +35,4 @@
os.startsWith("linux") -> OperatingSystem.LINUX
else -> throw GradleException("Unsupported operating system $os")
}
-}
\ No newline at end of file
+}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/ProjectLayoutType.kt b/buildSrc/public/src/main/kotlin/androidx/build/ProjectLayoutType.kt
index 3048823..ec0129f 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/ProjectLayoutType.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/ProjectLayoutType.kt
@@ -23,22 +23,19 @@
PLAYGROUND;
companion object {
- /**
- * Returns the project layout type for the project (PLAYGROUND or ANDROIDX)
- */
+ /** Returns the project layout type for the project (PLAYGROUND or ANDROIDX) */
@JvmStatic
fun from(project: Project): ProjectLayoutType {
val value = project.findProperty(STUDIO_TYPE)?.toString()
return when (value) {
"playground" -> ProjectLayoutType.PLAYGROUND
- null, "androidx" -> ProjectLayoutType.ANDROIDX
+ null,
+ "androidx" -> ProjectLayoutType.ANDROIDX
else -> error("Invalid project type $value")
}
}
- /**
- * @return `true` if running in a Playground (Github) setup, `false` otherwise.
- */
+ /** @return `true` if running in a Playground (Github) setup, `false` otherwise. */
@JvmStatic
fun isPlayground(project: Project): Boolean {
return ProjectLayoutType.from(project) == ProjectLayoutType.PLAYGROUND
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/SdkHelper.kt b/buildSrc/public/src/main/kotlin/androidx/build/SdkHelper.kt
index b159b36..f056d56 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/SdkHelper.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/SdkHelper.kt
@@ -23,9 +23,7 @@
import org.gradle.api.file.FileTree
import org.gradle.api.plugins.ExtraPropertiesExtension
-/**
- * Writes the appropriate SDK path to local.properties file in specified location.
- */
+/** Writes the appropriate SDK path to local.properties file in specified location. */
fun Project.writeSdkPathToLocalPropertiesFile() {
val sdkPath = project.getSdkPath()
if (sdkPath.exists()) {
@@ -33,9 +31,7 @@
// Gradle always separates directories with '/' regardless of the OS, so convert here.
val gradlePath = sdkPath.absolutePath.replace(File.separator, "/")
val contents = "sdk.dir=$gradlePath\ncmake.dir=$gradlePath/native-build-tools"
- props.printWriter().use { out ->
- out.println(contents)
- }
+ props.printWriter().use { out -> out.println(contents) }
} else {
throw Exception(
"Unable to find SDK prebuilts at $sdkPath. If you are not using a " +
@@ -45,21 +41,17 @@
}
}
-/**
- * Returns a file tree representing the platform SDK suitable for use as a dependency.
- */
-fun Project.getSdkDependency(): FileTree = fileTree(
- "${getSdkPath()}/platforms/${project.defaultAndroidConfig.compileSdk}/"
-) {
- it.include("android.jar")
-}
+/** Returns a file tree representing the platform SDK suitable for use as a dependency. */
+fun Project.getSdkDependency(): FileTree =
+ fileTree("${getSdkPath()}/platforms/${project.defaultAndroidConfig.compileSdk}/") {
+ it.include("android.jar")
+ }
-/**
- * Returns the root project's platform-specific SDK path as a file.
- */
+/** Returns the root project's platform-specific SDK path as a file. */
fun Project.getSdkPath(): File {
- if (rootProject.plugins.hasPlugin("AndroidXPlaygroundRootPlugin") ||
- System.getenv("COMPOSE_DESKTOP_GITHUB_BUILD") != null
+ if (
+ rootProject.plugins.hasPlugin("AndroidXPlaygroundRootPlugin") ||
+ System.getenv("COMPOSE_DESKTOP_GITHUB_BUILD") != null
) {
// This is not full checkout, use local settings instead.
// https://developer.android.com/studio/command-line/variables
@@ -67,9 +59,7 @@
val localPropsFile = rootProject.projectDir.resolve("local.properties")
if (localPropsFile.exists()) {
val localProps = Properties()
- localPropsFile.inputStream().use {
- localProps.load(it)
- }
+ localPropsFile.inputStream().use { localProps.load(it) }
val localSdkDir = localProps["sdk.dir"]?.toString()
if (localSdkDir != null) {
val sdkDirectory = File(localSdkDir)
@@ -91,9 +81,7 @@
}
}
-/**
- * @return [File] representing the path stored in [envValue] if it exists, `null` otherwise.
- */
+/** @return [File] representing the path stored in [envValue] if it exists, `null` otherwise. */
private fun getPathFromEnvironmentVariableOrNull(envVar: String): File? {
val envValue = System.getenv(envVar)
if (envValue != null) {
@@ -127,9 +115,7 @@
throw GradleException("ANDROID_SDK_ROOT environment variable is not set")
}
-/**
- * Sets the path to the canonical root project directory, e.g. {@code frameworks/support}.
- */
+/** Sets the path to the canonical root project directory, e.g. {@code frameworks/support}. */
fun Project.setSupportRootFolder(rootDir: File?) {
val extension = project.rootProject.property("ext") as ExtraPropertiesExtension
return extension.set("supportRootFolder", rootDir)
@@ -146,9 +132,7 @@
return extension.get("supportRootFolder") as File
}
-/**
- * Returns whether the path to the canonical root project directory has been set.
- */
+/** Returns whether the path to the canonical root project directory has been set. */
fun Project.hasSupportRootFolder(): Boolean {
val extension = project.rootProject.property("ext") as ExtraPropertiesExtension
return extension.has("supportRootFolder")
@@ -156,6 +140,7 @@
/**
* Returns the path to the checkout's root directory, e.g. where {@code repo init} was run.
+ *
* <p>
* This method assumes that the canonical root project directory is {@code frameworks/support}.
*/
@@ -163,9 +148,7 @@
return project.getSupportRootFolder().parentFile.parentFile
}
-/**
- * Returns the path to the konan prebuilts folder (e.g. <root>/prebuilts/androidx/konan).
- */
+/** Returns the path to the konan prebuilts folder (e.g. <root>/prebuilts/androidx/konan). */
fun Project.getKonanPrebuiltsFolder(): File {
return getPrebuiltsRoot().resolve("androidx/konan")
-}
\ No newline at end of file
+}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/SdkResourceGenerator.kt b/buildSrc/public/src/main/kotlin/androidx/build/SdkResourceGenerator.kt
index e4c56bf..5e6ca39 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/SdkResourceGenerator.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/SdkResourceGenerator.kt
@@ -17,8 +17,6 @@
package androidx.build
import androidx.build.dependencies.AGP_LATEST
-import androidx.build.dependencies.KOTLIN_STDLIB
-import androidx.build.dependencies.KOTLIN_VERSION
import androidx.build.dependencies.KSP_VERSION
import com.google.common.annotations.VisibleForTesting
import java.io.File
@@ -41,45 +39,35 @@
@DisableCachingByDefault(because = "Simply generates a small file and doesn't benefit from caching")
abstract class SdkResourceGenerator : DefaultTask() {
- @get:Input
- lateinit var tipOfTreeMavenRepoRelativePath: String
+ @get:Input lateinit var tipOfTreeMavenRepoRelativePath: String
/**
- * project-relative path to folder where outputs from buildSrc builds can be found
- * (perhaps something like ../out/buildSrc)
+ * project-relative path to folder where outputs from buildSrc builds can be found (perhaps
+ * something like ../out/buildSrc)
*/
- @get:Input
- lateinit var buildSrcOutRelativePath: String
+ @get:Input lateinit var buildSrcOutRelativePath: String
@get:[InputFile PathSensitive(PathSensitivity.NONE)]
abstract val debugKeystore: RegularFileProperty
- @get:Input
- abstract val compileSdkVersion: Property<String>
+ @get:Input abstract val compileSdkVersion: Property<String>
- @get:Input
- abstract val buildToolsVersion: Property<String>
+ @get:Input abstract val buildToolsVersion: Property<String>
- @get:Input
- abstract val minSdkVersion: Property<Int>
+ @get:Input abstract val minSdkVersion: Property<Int>
- @get:Input
- val agpDependency: String = AGP_LATEST
+ @get:Input val agpDependency: String = AGP_LATEST
@get:Input
val navigationRuntime: String = "androidx.navigation:navigation-runtime:2.4.0-alpha01"
- @get:Input
- val kotlinStdlib: String = KOTLIN_STDLIB
+ @get:Input abstract val kotlinStdlib: Property<String>
- @get:Input
- val kotlinVersion: String = KOTLIN_VERSION
+ @get:Input abstract val kotlinVersion: Property<String>
- @get:Input
- val kspVersion: String = KSP_VERSION
+ @get:Input val kspVersion: String = KSP_VERSION
- @get:Input
- lateinit var repositoryUrls: List<String>
+ @get:Input lateinit var repositoryUrls: List<String>
@get:Input
val rootProjectRelativePath: String =
@@ -87,8 +75,7 @@
private val projectDir: File = project.projectDir
- @get:OutputDirectory
- abstract val outputDir: DirectoryProperty
+ @get:OutputDirectory abstract val outputDir: DirectoryProperty
@TaskAction
fun generateFile() {
@@ -108,11 +95,11 @@
writer.write("agpDependency=$agpDependency\n")
writer.write("navigationRuntime=$navigationRuntime\n")
- writer.write("kotlinStdlib=$kotlinStdlib\n")
+ writer.write("kotlinStdlib=${kotlinStdlib.get()}\n")
writer.write("compileSdkVersion=${compileSdkVersion.get()}\n")
writer.write("buildToolsVersion=${buildToolsVersion.get()}\n")
writer.write("minSdkVersion=${minSdkVersion.get()}\n")
- writer.write("kotlinVersion=$kotlinVersion\n")
+ writer.write("kotlinVersion=${kotlinVersion.get()}\n")
writer.write("kspVersion=$kspVersion\n")
writer.write("buildSrcOutRelativePath=$buildSrcOutRelativePath\n")
}
@@ -131,25 +118,29 @@
@VisibleForTesting
fun registerSdkResourceGeneratorTask(project: Project): TaskProvider<SdkResourceGenerator> {
- val generatedDirectory = File(project.buildDir, "generated/resources")
+ val generatedDirectory = project.layout.buildDirectory.dir("generated/resources")
return project.tasks.register(TASK_NAME, SdkResourceGenerator::class.java) {
it.tipOfTreeMavenRepoRelativePath =
project.getRepositoryDirectory().toRelativeString(project.projectDir)
it.debugKeystore.set(project.getKeystore())
it.outputDir.set(generatedDirectory)
it.buildToolsVersion.set(
- project.provider {
- project.defaultAndroidConfig.buildToolsVersion
- }
+ project.provider { project.defaultAndroidConfig.buildToolsVersion }
)
it.minSdkVersion.set(project.defaultAndroidConfig.minSdk)
it.compileSdkVersion.set(project.defaultAndroidConfig.compileSdk)
+ it.kotlinStdlib.set(
+ project.androidXConfiguration.kotlinBomVersion.map { version ->
+ "org.jetbrains.kotlin:kotlin-stdlib:$version"
+ }
+ )
+ it.kotlinVersion.set(project.androidXConfiguration.kotlinBomVersion)
it.buildSrcOutRelativePath =
(project.properties["buildSrcOut"] as File).toRelativeString(project.projectDir)
// Copy repositories used for the library project so that it can replicate the same
// maven structure in test.
- it.repositoryUrls = project.repositories.filterIsInstance<MavenArtifactRepository>()
- .map {
+ it.repositoryUrls =
+ project.repositories.filterIsInstance<MavenArtifactRepository>().map {
if (it.url.scheme == "file") {
// Make file paths relative to projectDir
File(it.url.path).toRelativeString(project.projectDir)
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/SingleFileCopy.kt b/buildSrc/public/src/main/kotlin/androidx/build/SingleFileCopy.kt
index e2121d7..03c97ab 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/SingleFileCopy.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/SingleFileCopy.kt
@@ -28,11 +28,9 @@
@DisableCachingByDefault(because = "Doesn't benefit from cache")
open class SingleFileCopy : DefaultTask() {
- @InputFile @PathSensitive(PathSensitivity.ABSOLUTE)
- lateinit var sourceFile: File
+ @InputFile @PathSensitive(PathSensitivity.ABSOLUTE) lateinit var sourceFile: File
- @OutputFile
- lateinit var destinationFile: File
+ @OutputFile lateinit var destinationFile: File
@TaskAction
fun copyFile() {
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/Version.kt b/buildSrc/public/src/main/kotlin/androidx/build/Version.kt
index fbee578..4b4a473 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/Version.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/Version.kt
@@ -22,23 +22,18 @@
import java.util.regex.Pattern
import org.gradle.api.Project
-/**
- * Utility class which represents a version
- */
-data class Version(
- val major: Int,
- val minor: Int,
- val patch: Int,
- val extra: String? = null
-) : Comparable<Version>, java.io.Serializable {
+/** Utility class which represents a version */
+data class Version(val major: Int, val minor: Int, val patch: Int, val extra: String? = null) :
+ Comparable<Version>, java.io.Serializable {
- constructor(versionString: String) : this(
+ constructor(
+ versionString: String
+ ) : this(
Integer.parseInt(checkedMatcher(versionString).group(1)),
Integer.parseInt(checkedMatcher(versionString).group(2)),
Integer.parseInt(checkedMatcher(versionString).group(3)),
- if (checkedMatcher(versionString).groupCount() == 4) checkedMatcher(
- versionString
- ).group(4) else null
+ if (checkedMatcher(versionString).groupCount() == 4) checkedMatcher(versionString).group(4)
+ else null
)
fun isPatch(): Boolean = patch != 0
@@ -55,17 +50,20 @@
fun isStable(): Boolean = (extra == null)
- // Returns whether the API surface is allowed to change within the current revision (see go/androidx/versioning for policy definition)
+ // Returns whether the API surface is allowed to change within the current revision (see
+ // go/androidx/versioning for policy definition)
fun isFinalApi(): Boolean = !(isSnapshot() || isAlpha() || isDev())
- override fun compareTo(other: Version) = compareValuesBy(
- this, other,
- { it.major },
- { it.minor },
- { it.patch },
- { it.extra == null }, // False (no extra) sorts above true (has extra)
- { it.extra } // gradle uses lexicographic ordering
- )
+ override fun compareTo(other: Version) =
+ compareValuesBy(
+ this,
+ other,
+ { it.major },
+ { it.minor },
+ { it.patch },
+ { it.extra == null }, // False (no extra) sorts above true (has extra)
+ { it.extra } // gradle uses lexicographic ordering
+ )
override fun toString(): String {
return if (extra != null) {
@@ -87,37 +85,30 @@
return matcher
}
- /**
- * @return Version or null, if a name of the given file doesn't match
- */
+ /** @return Version or null, if a name of the given file doesn't match */
fun parseOrNull(file: File): Version? {
if (!file.isFile) return null
return parseFilenameOrNull(file.name)
}
- /**
- * @return Version or null, if a name of the given file doesn't match
- */
+ /** @return Version or null, if a name of the given file doesn't match */
fun parseFilenameOrNull(filename: String): Version? {
val matcher = VERSION_FILE_REGEX.matcher(filename)
return if (matcher.matches()) parseOrNull(matcher.group(2)) else null
}
- /**
- * @return Version or null, if the given string doesn't match
- */
+ /** @return Version or null, if the given string doesn't match */
fun parseOrNull(versionString: String): Version? {
val matcher = VERSION_REGEX.matcher(versionString)
return if (matcher.matches()) Version(versionString) else null
}
- /**
- * Tells whether a version string would refer to a dependency range
- */
+ /** Tells whether a version string would refer to a dependency range */
fun isDependencyRange(version: String): Boolean {
- if ((version.startsWith("[") || version.startsWith("(")) &&
- version.contains(",") &&
- (version.endsWith("]") || version.endsWith(")"))
+ if (
+ (version.startsWith("[") || version.startsWith("(")) &&
+ version.contains(",") &&
+ (version.endsWith("]") || version.endsWith(")"))
) {
return true
}
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/dependencies/Dependencies.kt b/buildSrc/public/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
index 400a2e9..9e5e84a 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
@@ -17,16 +17,17 @@
package androidx.build.dependencies
lateinit var guavaVersion: String
-val GUAVA_VERSION get() = guavaVersion
+val GUAVA_VERSION
+ get() = guavaVersion
lateinit var kspVersion: String
-val KSP_VERSION get() = kspVersion
+val KSP_VERSION
+ get() = kspVersion
-lateinit var kotlinVersion: String
-val KOTLIN_VERSION get() = kotlinVersion
lateinit var kotlinNativeVersion: String
-val KOTLIN_NATIVE_VERSION get() = kotlinNativeVersion
-val KOTLIN_STDLIB get() = "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
+val KOTLIN_NATIVE_VERSION
+ get() = kotlinNativeVersion
lateinit var agpVersion: String
-val AGP_LATEST get() = "com.android.tools.build:gradle:$agpVersion"
+val AGP_LATEST
+ get() = "com.android.tools.build:gradle:$agpVersion"
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/gradle/Extensions.kt b/buildSrc/public/src/main/kotlin/androidx/build/gradle/Extensions.kt
index c59a6b7..7d2ebd4 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/gradle/Extensions.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/gradle/Extensions.kt
@@ -18,4 +18,5 @@
import org.gradle.api.Project
-val Project.isRoot get() = this == rootProject
+val Project.isRoot
+ get() = this == rootProject
diff --git a/buildSrc/shared-dependencies.gradle b/buildSrc/shared-dependencies.gradle
index 107c4ef..56c89bd 100644
--- a/buildSrc/shared-dependencies.gradle
+++ b/buildSrc/shared-dependencies.gradle
@@ -29,6 +29,8 @@
}
implementation(libs.xerces)
+ implementation(libs.ktfmt)
+ implementation(libs.kotlinCoroutinesCore)
implementation(libs.shadow) // used by BundleInsideHelper.kt
implementation(libs.apacheAnt) // used in AarManifestTransformerTask.kt for unziping
implementation(libs.toml)
diff --git a/busytown/impl/build.sh b/busytown/impl/build.sh
index 023909d..a063bf4 100755
--- a/busytown/impl/build.sh
+++ b/busytown/impl/build.sh
@@ -49,9 +49,7 @@
if eval "$*"; then
return 0
else
- echo >&2
echo "Gradle command failed:" >&2
- echo >&2
# Echo the Gradle command formatted for ease of reading.
# Put each argument on its own line because some arguments may be long.
# Also put "\" at the end of non-final lines so the command can be copy-pasted
@@ -107,6 +105,7 @@
echo build passed
else
if grep "has several compatible actual declarations in modules" "$DIST_DIR/logs/gradle.log" >/dev/null 2>/dev/null; then
+ run ./gradlew --stop || true
# try to copy the OUT_DIR into DIST where we can find it
cd "$OUT_DIR"
echo "zipping out into $DIST_DIR/out.zip"
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/Camera2CameraControlDeviceTest.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/Camera2CameraControlDeviceTest.kt
index fc3bf34..ad18e9d 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/Camera2CameraControlDeviceTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/Camera2CameraControlDeviceTest.kt
@@ -496,4 +496,4 @@
)
camera2CameraControl = Camera2CameraControl.from(camera.cameraControl)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/CaptureConfigAdapterDeviceTest.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/CaptureConfigAdapterDeviceTest.kt
index c8d8825a..f8e93c7 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/CaptureConfigAdapterDeviceTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/CaptureConfigAdapterDeviceTest.kt
@@ -185,4 +185,4 @@
surfaceTexture.release()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EncoderProfilesProviderAdapterDeviceTest.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EncoderProfilesProviderAdapterDeviceTest.kt
index 9a81718..3f7c01e 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EncoderProfilesProviderAdapterDeviceTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EncoderProfilesProviderAdapterDeviceTest.kt
@@ -204,4 +204,4 @@
return Build.MODEL.contains("Cuttlefish", true) &&
(Build.ID.startsWith("TP1A", true) || Build.ID.startsWith("TSE4", true))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EvCompDeviceTest.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EvCompDeviceTest.kt
index 1c7730d..262a338 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EvCompDeviceTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/EvCompDeviceTest.kt
@@ -270,4 +270,4 @@
)
cameraControl = camera.cameraControl.toCameraControlAdapter()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/InitializationTest.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/InitializationTest.kt
index d093292..5e28362 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/InitializationTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/integration/InitializationTest.kt
@@ -47,4 +47,4 @@
cameraProvider.shutdown().await()
return@runBlocking
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/testing/VerifyResultListener.kt b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/testing/VerifyResultListener.kt
index 80eed7d..46a90fc 100644
--- a/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/testing/VerifyResultListener.kt
+++ b/camera/camera-camera2-pipe-integration/src/androidTest/java/androidx/camera/camera2/pipe/testing/VerifyResultListener.kt
@@ -124,4 +124,4 @@
verifyBlock(captureRequests, captureResults)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/CameraPipeConfig.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/CameraPipeConfig.kt
index 4196f2f..520974c 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/CameraPipeConfig.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/CameraPipeConfig.kt
@@ -61,4 +61,4 @@
.build()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryAdapter.kt
index 1aaab34..eb8dcb1 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryAdapter.kt
@@ -135,4 +135,4 @@
}
override fun getCameraManager(): Any = appComponent
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryProvider.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryProvider.kt
index 91cc123..d24697b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryProvider.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraFactoryProvider.kt
@@ -102,4 +102,4 @@
Debug.traceStop()
return cameraPipe
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapter.kt
index 268c9a4..8372c38 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapter.kt
@@ -261,4 +261,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraSurfaceAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraSurfaceAdapter.kt
index f920bed..e8b59257 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraSurfaceAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraSurfaceAdapter.kt
@@ -147,4 +147,4 @@
newUseCaseConfigsSupportedSizeMap
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraUseCaseAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraUseCaseAdapter.kt
index 416b0e4..4d083da 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraUseCaseAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/CameraUseCaseAdapter.kt
@@ -35,7 +35,6 @@
import androidx.camera.core.impl.Config
import androidx.camera.core.impl.ImageCaptureConfig
import androidx.camera.core.impl.ImageOutputConfig
-import androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR
import androidx.camera.core.impl.MutableOptionsBundle
import androidx.camera.core.impl.OptionsBundle
import androidx.camera.core.impl.PreviewConfig
@@ -43,8 +42,6 @@
import androidx.camera.core.impl.UseCaseConfig
import androidx.camera.core.impl.UseCaseConfigFactory
import androidx.camera.core.impl.UseCaseConfigFactory.CaptureType
-import androidx.camera.core.resolutionselector.ResolutionSelector
-import androidx.camera.core.resolutionselector.ResolutionStrategy
/**
* This class builds [Config] objects for a given [UseCaseConfigFactory.CaptureType].
@@ -136,15 +133,6 @@
ImageOutputConfig.OPTION_MAX_RESOLUTION,
previewSize
)
- mutableConfig.insertOption(
- OPTION_RESOLUTION_SELECTOR,
- ResolutionSelector.Builder().setResolutionStrategy(
- ResolutionStrategy(
- previewSize,
- ResolutionStrategy.FALLBACK_RULE_CLOSEST_LOWER
- )
- ).build()
- )
}
mutableConfig.insertOption(
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EncoderProfilesProviderAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EncoderProfilesProviderAdapter.kt
index d16071e9..f2250d1 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EncoderProfilesProviderAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EncoderProfilesProviderAdapter.kt
@@ -141,4 +141,4 @@
companion object {
private const val TAG = "EncoderProfilesProviderAdapter"
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EvCompValue.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EvCompValue.kt
index ef218f0..99c93d4 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EvCompValue.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/EvCompValue.kt
@@ -41,4 +41,4 @@
internal fun updateIndex(newIndex: Int): EvCompValue {
return copy(index = newIndex)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/ExposureStateAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/ExposureStateAdapter.kt
index 3b4ae6a..b891648 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/ExposureStateAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/ExposureStateAdapter.kt
@@ -53,4 +53,4 @@
return cameraProperties.metadata[CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE]
?: EMPTY_RANGE
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/GuaranteedConfigurationsUtil.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/GuaranteedConfigurationsUtil.kt
index b383e7a..ce74b04 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/GuaranteedConfigurationsUtil.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/GuaranteedConfigurationsUtil.kt
@@ -724,4 +724,4 @@
surfaceCombinations.addAll(getConcurrentSupportedCombinationList())
return surfaceCombinations
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SessionConfigAdapter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SessionConfigAdapter.kt
index 13ec899..09ea465 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SessionConfigAdapter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SessionConfigAdapter.kt
@@ -208,4 +208,4 @@
return Camera2ImplConfig(implementationOptions)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombination.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombination.kt
index 8ba00e1..daa54a8 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombination.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombination.kt
@@ -772,4 +772,4 @@
companion object {
private const val TAG = "SupportedSurfaceCombination"
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/Camera2CameraControlCompat.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/Camera2CameraControlCompat.kt
index 907d4e5..e7b63a3 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/Camera2CameraControlCompat.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/Camera2CameraControlCompat.kt
@@ -174,4 +174,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/EvCompCompat.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/EvCompCompat.kt
index 3dafac7..d880775 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/EvCompCompat.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/EvCompCompat.kt
@@ -161,4 +161,4 @@
return signal
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompat.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompat.kt
index 5eb3edb..5b963d5 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompat.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompat.kt
@@ -153,4 +153,4 @@
*/
fun unwrap(): StreamConfigurationMap?
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompatApi23Impl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompatApi23Impl.kt
index 53b126f..342eb6b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompatApi23Impl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/StreamConfigurationMapCompatApi23Impl.kt
@@ -30,4 +30,4 @@
override fun getHighResolutionOutputSizes(format: Int): Array<Size>? {
return streamConfigurationMap?.getHighResolutionOutputSizes(format)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AeFpsRangeLegacyQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AeFpsRangeLegacyQuirk.kt
index e8c12f7..3feee08 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AeFpsRangeLegacyQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AeFpsRangeLegacyQuirk.kt
@@ -103,4 +103,4 @@
return level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AspectRatioLegacyApi21Quirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AspectRatioLegacyApi21Quirk.kt
index 3634002..b45fc4c2 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AspectRatioLegacyApi21Quirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/AspectRatioLegacyApi21Quirk.kt
@@ -53,4 +53,4 @@
Build.VERSION.SDK_INT == 21
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CameraNoResponseWhenEnablingFlashQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CameraNoResponseWhenEnablingFlashQuirk.kt
index 92d37e5..b594466 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CameraNoResponseWhenEnablingFlashQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CameraNoResponseWhenEnablingFlashQuirk.kt
@@ -66,4 +66,4 @@
cameraMetadata[CameraCharacteristics.LENS_FACING] == LENS_FACING_BACK
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionOnClosedNotCalledQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionOnClosedNotCalledQuirk.kt
index c97a228..371f58f 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionOnClosedNotCalledQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionOnClosedNotCalledQuirk.kt
@@ -43,4 +43,4 @@
*/
fun isEnabled(): Boolean = false
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionStuckQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionStuckQuirk.kt
index 9d3ba9e..cd201ec 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionStuckQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CaptureSessionStuckQuirk.kt
@@ -43,4 +43,4 @@
*/
fun isEnabled(): Boolean = false
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCameraDeviceOnCameraGraphCloseQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCameraDeviceOnCameraGraphCloseQuirk.kt
index f3ebd6b..d1c3dc1 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCameraDeviceOnCameraGraphCloseQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCameraDeviceOnCameraGraphCloseQuirk.kt
@@ -43,4 +43,4 @@
return Build.HARDWARE == "samsungexynos7870"
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnDisconnectQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnDisconnectQuirk.kt
index 5e70155..b68e948 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnDisconnectQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnDisconnectQuirk.kt
@@ -75,4 +75,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnVideoQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnVideoQuirk.kt
index caad5f5..7a111e5 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnVideoQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CloseCaptureSessionOnVideoQuirk.kt
@@ -39,4 +39,4 @@
companion object {
fun isEnabled(): Boolean = true
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ConfigureSurfaceToSecondarySessionFailQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ConfigureSurfaceToSecondarySessionFailQuirk.kt
index 969985f..e325619 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ConfigureSurfaceToSecondarySessionFailQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ConfigureSurfaceToSecondarySessionFailQuirk.kt
@@ -46,4 +46,4 @@
return level == INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CrashWhenTakingPhotoWithAutoFlashAEModeQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CrashWhenTakingPhotoWithAutoFlashAEModeQuirk.kt
index 09bbda7..3f941bd 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CrashWhenTakingPhotoWithAutoFlashAEModeQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/CrashWhenTakingPhotoWithAutoFlashAEModeQuirk.kt
@@ -63,4 +63,4 @@
return AFFECTED_MODELS.contains(Build.MODEL.uppercase())
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/DeviceQuirks.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/DeviceQuirks.kt
index a46eb22..b0a1998 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/DeviceQuirks.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/DeviceQuirks.kt
@@ -47,4 +47,4 @@
operator fun <T : Quirk?> get(quirkClass: Class<T>): T? {
return all.get(quirkClass)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExcludedSupportedSizesQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExcludedSupportedSizesQuirk.kt
index 4f6107d..d2fd771 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExcludedSupportedSizesQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExcludedSupportedSizesQuirk.kt
@@ -240,4 +240,4 @@
(Build.VERSION.SDK_INT >= 27))
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirk.kt
index 2e9b935..876c408 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirk.kt
@@ -96,4 +96,4 @@
return apiLevelRange?.contains(Build.VERSION.SDK_INT) ?: true
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedOutputSizeQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedOutputSizeQuirk.kt
index fc4e622..8f78da2 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedOutputSizeQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedOutputSizeQuirk.kt
@@ -88,4 +88,4 @@
Build.MODEL, ignoreCase = true
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirk.kt
index 83a2a88..0c22433 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirk.kt
@@ -349,4 +349,4 @@
return surfaceCombination
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FinalizeSessionOnCloseQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FinalizeSessionOnCloseQuirk.kt
index eeec375..a3cb4c7 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FinalizeSessionOnCloseQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FinalizeSessionOnCloseQuirk.kt
@@ -67,4 +67,4 @@
FinalizeSessionOnCloseBehavior.OFF
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FlashAvailabilityBufferUnderflowQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FlashAvailabilityBufferUnderflowQuirk.kt
index bc50a37..d6a3237 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FlashAvailabilityBufferUnderflowQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/FlashAvailabilityBufferUnderflowQuirk.kt
@@ -60,4 +60,4 @@
DeviceInfo(manufacturer.lowercase(Locale.US), model.lowercase(Locale.US))
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFailWithAutoFlashQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFailWithAutoFlashQuirk.kt
index 1b6a41f..21d7e219 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFailWithAutoFlashQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFailWithAutoFlashQuirk.kt
@@ -52,4 +52,4 @@
cameraMetadata[LENS_FACING] == LENS_FACING_FRONT
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFlashNotFireQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFlashNotFireQuirk.kt
index 7ddffbb..66a8f07 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFlashNotFireQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureFlashNotFireQuirk.kt
@@ -54,4 +54,4 @@
return isFrontCameraAffected || isAffected
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWashedOutImageQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWashedOutImageQuirk.kt
index 64cd4ab..2c9ece1 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWashedOutImageQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWashedOutImageQuirk.kt
@@ -62,4 +62,4 @@
cameraMetadata[LENS_FACING] == LENS_FACING_BACK
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWithFlashUnderexposureQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWithFlashUnderexposureQuirk.kt
index d6c1817..8af6c6b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWithFlashUnderexposureQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/ImageCaptureWithFlashUnderexposureQuirk.kt
@@ -56,4 +56,4 @@
cameraMetadata[LENS_FACING] == LENS_FACING_BACK
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/InvalidVideoProfilesQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/InvalidVideoProfilesQuirk.kt
index dac86b9..4c2c27a 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/InvalidVideoProfilesQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/InvalidVideoProfilesQuirk.kt
@@ -86,4 +86,4 @@
return Build.ID.startsWith("TD1A", true)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/Nexus4AndroidLTargetAspectRatioQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/Nexus4AndroidLTargetAspectRatioQuirk.kt
index 9833eb1..5a02af2 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/Nexus4AndroidLTargetAspectRatioQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/Nexus4AndroidLTargetAspectRatioQuirk.kt
@@ -58,4 +58,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewOrientationIncorrectQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewOrientationIncorrectQuirk.kt
index 7428f9a..98faa45 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewOrientationIncorrectQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewOrientationIncorrectQuirk.kt
@@ -46,4 +46,4 @@
return level == INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewPixelHDRnetQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewPixelHDRnetQuirk.kt
index 655f21b..b161f45 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewPixelHDRnetQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/PreviewPixelHDRnetQuirk.kt
@@ -52,4 +52,4 @@
Build.DEVICE.lowercase(Locale.getDefault())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/RepeatingStreamConstraintForVideoRecordingQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/RepeatingStreamConstraintForVideoRecordingQuirk.kt
index 8235b0b..710e9e1 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/RepeatingStreamConstraintForVideoRecordingQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/RepeatingStreamConstraintForVideoRecordingQuirk.kt
@@ -40,4 +40,4 @@
"Huawei".equals(Build.BRAND, ignoreCase = true) &&
"mha-l29".equals(Build.MODEL, ignoreCase = true)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/SurfaceOrderQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/SurfaceOrderQuirk.kt
index 4778a85..846704c 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/SurfaceOrderQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/SurfaceOrderQuirk.kt
@@ -56,4 +56,4 @@
))
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TextureViewIsClosedQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TextureViewIsClosedQuirk.kt
index 136e3c6..31c05f8 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TextureViewIsClosedQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TextureViewIsClosedQuirk.kt
@@ -42,4 +42,4 @@
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.M
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TorchIsClosedAfterImageCapturingQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TorchIsClosedAfterImageCapturingQuirk.kt
index 52c7c81..836663e 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TorchIsClosedAfterImageCapturingQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/TorchIsClosedAfterImageCapturingQuirk.kt
@@ -46,4 +46,4 @@
return BUILD_MODELS.contains(Build.MODEL.lowercase())
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/UseTorchAsFlashQuirk.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/UseTorchAsFlashQuirk.kt
index bc57376..e72272b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/UseTorchAsFlashQuirk.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/quirk/UseTorchAsFlashQuirk.kt
@@ -27,4 +27,4 @@
* pre-capture.
*/
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
-interface UseTorchAsFlashQuirk : Quirk
\ No newline at end of file
+interface UseTorchAsFlashQuirk : Quirk
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRange.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRange.kt
index 8f1c132..d5c8b0c 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRange.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRange.kt
@@ -43,4 +43,4 @@
fun getTargetAeFpsRange(): Range<Int>? {
return aeTargetFpsRange
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/CapturePipelineTorchCorrection.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/CapturePipelineTorchCorrection.kt
index 0525273..713d6c4 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/CapturePipelineTorchCorrection.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/CapturePipelineTorchCorrection.kt
@@ -103,4 +103,4 @@
val isEnabled = DeviceQuirks[TorchIsClosedAfterImageCapturingQuirk::class.java] != null
private val stillCaptureTemplate = RequestTemplate(CameraDevice.TEMPLATE_STILL_CAPTURE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/FlashAvailabilityChecker.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/FlashAvailabilityChecker.kt
index febe978..fbb8072 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/FlashAvailabilityChecker.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/FlashAvailabilityChecker.kt
@@ -72,4 +72,4 @@
}
}
return flashAvailable ?: false
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ImageCapturePixelHDRPlus.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ImageCapturePixelHDRPlus.kt
index 52aff5a..2adfbee 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ImageCapturePixelHDRPlus.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ImageCapturePixelHDRPlus.kt
@@ -50,4 +50,4 @@
ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY ->
setCaptureRequestOption(CaptureRequest.CONTROL_ENABLE_ZSL, false)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/InactiveSurfaceCloser.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/InactiveSurfaceCloser.kt
index d08bbb9..315c205 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/InactiveSurfaceCloser.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/InactiveSurfaceCloser.kt
@@ -131,4 +131,4 @@
override fun closeAll() {
// Nothing to do.
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/MaxPreviewSize.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/MaxPreviewSize.kt
index 93a724e..c65a9db 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/MaxPreviewSize.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/MaxPreviewSize.kt
@@ -50,4 +50,4 @@
defaultMaxPreviewResolution.width * defaultMaxPreviewResolution.height)
return if (isSelectResolutionLarger) selectResolution else defaultMaxPreviewResolution
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/PreviewPixelHDRnet.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/PreviewPixelHDRnet.kt
index 496e17e..0ee62c5 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/PreviewPixelHDRnet.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/PreviewPixelHDRnet.kt
@@ -54,4 +54,4 @@
aspectRatio: Rational
): Boolean {
return aspectRatio == Rational(resolution.width, resolution.height)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ResolutionCorrector.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ResolutionCorrector.kt
index c3cee29..57407fd 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ResolutionCorrector.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/ResolutionCorrector.kt
@@ -60,4 +60,4 @@
}
return newResolutions
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/TargetAspectRatio.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/TargetAspectRatio.kt
index 99c6d19..6c84ed3 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/TargetAspectRatio.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/TargetAspectRatio.kt
@@ -80,4 +80,4 @@
/** No correction is needed. */
const val RATIO_ORIGINAL = 3
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlash.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlash.kt
index 4522456..74a1086 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlash.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlash.kt
@@ -52,4 +52,4 @@
object NotUseTorchAsFlash : UseTorchAsFlash {
override fun shouldUseTorchAsFlash() = false
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/config/UseCaseCameraConfig.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/config/UseCaseCameraConfig.kt
index 01bdd6e..566b875 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/config/UseCaseCameraConfig.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/config/UseCaseCameraConfig.kt
@@ -264,4 +264,4 @@
fun config(config: UseCaseCameraConfig): Builder
fun build(): UseCaseCameraComponent
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfig.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfig.kt
index 691c70a..ab6853b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfig.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfig.kt
@@ -300,4 +300,4 @@
}
return parameters
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraCallbackMap.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraCallbackMap.kt
index dfb4e41..315e653 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraCallbackMap.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraCallbackMap.kt
@@ -262,4 +262,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraInteropStateCallbackRepository.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraInteropStateCallbackRepository.kt
index 02b7507..36b9381 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraInteropStateCallbackRepository.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraInteropStateCallbackRepository.kt
@@ -174,4 +174,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraProperties.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraProperties.kt
index 2e06fbf..4da3b4b 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraProperties.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/CameraProperties.kt
@@ -44,4 +44,4 @@
override val metadata: CameraMetadata by lazy {
checkNotNull(cameraPipe.cameras().awaitCameraMetadata(cameraId))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Sizes.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Sizes.kt
index 929c199..7dbf84f 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Sizes.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/Sizes.kt
@@ -32,4 +32,4 @@
fun maxByArea(left: Size, right: Size) = if (left.area() > right.area()) left else right
fun Point.area(): Int = this.x * this.y
-fun Point.toSize() = Size(this.x, this.y)
\ No newline at end of file
+fun Point.toSize() = Size(this.x, this.y)
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/StillCaptureRequestControl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/StillCaptureRequestControl.kt
index e4dec65..3a7e196 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/StillCaptureRequestControl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/StillCaptureRequestControl.kt
@@ -19,7 +19,6 @@
import androidx.annotation.GuardedBy
import androidx.annotation.RequiresApi
import androidx.camera.camera2.pipe.core.Log.debug
-import androidx.camera.camera2.pipe.core.Log.warn
import androidx.camera.camera2.pipe.integration.adapter.asListenableFuture
import androidx.camera.camera2.pipe.integration.adapter.propagateOnceTo
import androidx.camera.camera2.pipe.integration.config.CameraScope
@@ -40,7 +39,6 @@
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
-import kotlinx.coroutines.withTimeoutOrNull
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
@CameraScope
@@ -144,12 +142,7 @@
// completed. On some devices, AE preCapture triggered in submitStillCaptures may not
// work properly if the repeating request to change the flash mode is not completed.
debug { "StillCaptureRequestControl: Waiting for flash control" }
- withTimeoutOrNull(1_000L) {
- flashControl.updateSignal.join()
- } ?: {
- warn { "StillCaptureRequestControl: Waiting for flash control timed out" }
- }
- debug { "StillCaptureRequestControl: Waiting for flash control done" }
+ flashControl.updateSignal.join()
debug { "StillCaptureRequestControl: Issuing single capture" }
val deferredList = camera.requestControl.issueSingleCaptureAsync(
request.captureConfigs,
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/TorchControl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/TorchControl.kt
index fad5c9a..683ef5f 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/TorchControl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/TorchControl.kt
@@ -149,4 +149,4 @@
@IntoSet
abstract fun provideControls(torchControl: TorchControl): UseCaseCameraControl
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCamera.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCamera.kt
index 32c7488..1f31a5a 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCamera.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCamera.kt
@@ -139,6 +139,7 @@
return if (closed.compareAndSet(expect = false, update = true)) {
threads.scope.launch(start = CoroutineStart.UNDISPATCHED) {
debug { "Closing $this" }
+ requestControl.close()
useCaseGraphConfig.graph.close()
useCaseSurfaceManager.stopAsync().await()
}
@@ -151,15 +152,19 @@
key: CaptureRequest.Key<T>,
value: T,
priority: Config.OptionPriority,
- ): Deferred<Unit> = setParametersAsync(mapOf(key to (value as Any)), priority)
+ ): Deferred<Unit> = runIfNotClosed {
+ setParametersAsync(mapOf(key to (value as Any)), priority)
+ } ?: canceledResult
override fun setParametersAsync(
values: Map<CaptureRequest.Key<*>, Any>,
priority: Config.OptionPriority,
- ): Deferred<Unit> = requestControl.addParametersAsync(
- values = values,
- optionPriority = priority
- )
+ ): Deferred<Unit> = runIfNotClosed {
+ requestControl.addParametersAsync(
+ values = values,
+ optionPriority = priority
+ )
+ } ?: canceledResult
override fun setActiveResumeMode(enabled: Boolean) {
useCaseGraphConfig.graph.isForeground = enabled
@@ -167,21 +172,27 @@
private fun UseCaseCameraRequestControl.setSessionConfigAsync(
sessionConfig: SessionConfig
- ): Deferred<Unit> = setConfigAsync(
- type = UseCaseCameraRequestControl.Type.SESSION_CONFIG,
- config = sessionConfig.implementationOptions,
- tags = sessionConfig.repeatingCaptureConfig.tagBundle.toMap(),
- listeners = setOf(
- CameraCallbackMap.createFor(
- sessionConfig.repeatingCameraCaptureCallbacks,
- threads.backgroundExecutor
- )
- ),
- template = RequestTemplate(sessionConfig.repeatingCaptureConfig.templateType),
- streams = useCaseGraphConfig.getStreamIdsFromSurfaces(
- sessionConfig.repeatingCaptureConfig.surfaces
- ),
- )
+ ): Deferred<Unit> = runIfNotClosed {
+ setConfigAsync(
+ type = UseCaseCameraRequestControl.Type.SESSION_CONFIG,
+ config = sessionConfig.implementationOptions,
+ tags = sessionConfig.repeatingCaptureConfig.tagBundle.toMap(),
+ listeners = setOf(
+ CameraCallbackMap.createFor(
+ sessionConfig.repeatingCameraCaptureCallbacks,
+ threads.backgroundExecutor
+ )
+ ),
+ template = RequestTemplate(sessionConfig.repeatingCaptureConfig.templateType),
+ streams = useCaseGraphConfig.getStreamIdsFromSurfaces(
+ sessionConfig.repeatingCaptureConfig.surfaces
+ ),
+ )
+ } ?: canceledResult
+
+ private inline fun <R> runIfNotClosed(crossinline block: () -> R): R? {
+ return if (!closed.value) block() else null
+ }
override fun toString(): String = "UseCaseCamera-$debugId"
@@ -191,4 +202,8 @@
@Binds
abstract fun provideUseCaseCamera(useCaseCamera: UseCaseCameraImpl): UseCaseCamera
}
+
+ companion object {
+ private val canceledResult = CompletableDeferred<Unit>().apply { cancel() }
+ }
}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraControl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraControl.kt
index 260b7d7..436ad39 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraControl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraControl.kt
@@ -22,4 +22,4 @@
interface UseCaseCameraControl {
var useCaseCamera: UseCaseCamera?
fun reset()
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraRequestControl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraRequestControl.kt
index 6ce070e..13ac999 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraRequestControl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraRequestControl.kt
@@ -46,6 +46,7 @@
import dagger.Binds
import dagger.Module
import javax.inject.Inject
+import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Deferred
@@ -150,6 +151,8 @@
flashType: Int,
flashMode: Int,
): List<Deferred<Void?>>
+
+ fun close()
}
@UseCaseCameraScope
@@ -161,6 +164,9 @@
) : UseCaseCameraRequestControl {
private val graph = useCaseGraphConfig.graph
+ @Volatile
+ private var closed = false
+
private data class InfoBundle(
val options: Camera2ImplConfig.Builder = Camera2ImplConfig.Builder(),
val tags: MutableMap<String, Any> = mutableMapOf(),
@@ -178,15 +184,17 @@
optionPriority: Config.OptionPriority,
tags: Map<String, Any>,
listeners: Set<Request.Listener>
- ): Deferred<Unit> = synchronized(lock) {
- debug { "[$type] Add request option: $values" }
- infoBundleMap.getOrPut(type) { InfoBundle() }.let {
- it.options.addAllCaptureRequestOptionsWithPriority(values, optionPriority)
- it.tags.putAll(tags)
- it.listeners.addAll(listeners)
- }
- infoBundleMap.merge()
- }.updateCameraStateAsync()
+ ): Deferred<Unit> = runIfNotClosed {
+ synchronized(lock) {
+ debug { "[$type] Add request option: $values" }
+ infoBundleMap.getOrPut(type) { InfoBundle() }.let {
+ it.options.addAllCaptureRequestOptionsWithPriority(values, optionPriority)
+ it.tags.putAll(tags)
+ it.listeners.addAll(listeners)
+ }
+ infoBundleMap.merge()
+ }.updateCameraStateAsync()
+ } ?: canceledResult
override fun setConfigAsync(
type: UseCaseCameraRequestControl.Type,
@@ -195,25 +203,27 @@
streams: Set<StreamId>?,
template: RequestTemplate?,
listeners: Set<Request.Listener>
- ): Deferred<Unit> = synchronized(lock) {
- debug { "[$type] Set config: ${config?.toParameters()}" }
- infoBundleMap[type] = InfoBundle(
- Camera2ImplConfig.Builder().apply {
- config?.let {
- insertAllOptions(it)
- }
- },
- tags.toMutableMap(),
- listeners.toMutableSet(),
- template,
+ ): Deferred<Unit> = runIfNotClosed {
+ synchronized(lock) {
+ debug { "[$type] Set config: ${config?.toParameters()}" }
+ infoBundleMap[type] = InfoBundle(
+ Camera2ImplConfig.Builder().apply {
+ config?.let {
+ insertAllOptions(it)
+ }
+ },
+ tags.toMutableMap(),
+ listeners.toMutableSet(),
+ template,
+ )
+ infoBundleMap.merge()
+ }.updateCameraStateAsync(
+ streams = streams,
)
- infoBundleMap.merge()
- }.updateCameraStateAsync(
- streams = streams,
- )
+ } ?: canceledResult
- override suspend fun setTorchAsync(enabled: Boolean): Deferred<Result3A> =
- graph.acquireSession().use {
+ override suspend fun setTorchAsync(enabled: Boolean): Deferred<Result3A> = runIfNotClosed {
+ useGraphSessionOrFailed {
it.setTorch(
when (enabled) {
true -> TorchState.ON
@@ -221,6 +231,7 @@
}
)
}
+ } ?: submitFailedResult
override suspend fun startFocusAndMeteringAsync(
aeRegions: List<MeteringRectangle>?,
@@ -231,54 +242,49 @@
awbLockBehavior: Lock3ABehavior?,
afTriggerStartAeMode: AeMode?,
timeLimitNs: Long,
- ): Deferred<Result3A> = graph.acquireSession().use {
- it.lock3A(
- aeRegions = aeRegions,
- afRegions = afRegions,
- awbRegions = awbRegions,
- aeLockBehavior = aeLockBehavior,
- afLockBehavior = afLockBehavior,
- awbLockBehavior = awbLockBehavior,
- afTriggerStartAeMode = afTriggerStartAeMode,
- timeLimitNs = timeLimitNs,
- )
- }
+ ): Deferred<Result3A> = runIfNotClosed {
+ useGraphSessionOrFailed {
+ it.lock3A(
+ aeRegions = aeRegions,
+ afRegions = afRegions,
+ awbRegions = awbRegions,
+ aeLockBehavior = aeLockBehavior,
+ afLockBehavior = afLockBehavior,
+ awbLockBehavior = awbLockBehavior,
+ afTriggerStartAeMode = afTriggerStartAeMode,
+ timeLimitNs = timeLimitNs,
+ )
+ }
+ } ?: submitFailedResult
- override suspend fun cancelFocusAndMeteringAsync(): Deferred<Result3A> {
- graph.acquireSession().use {
+ override suspend fun cancelFocusAndMeteringAsync() = runIfNotClosed {
+ useGraphSessionOrFailed {
it.unlock3A(ae = true, af = true, awb = true)
}.await()
- return graph.acquireSession().use {
+ useGraphSessionOrFailed {
it.update3A(
aeRegions = METERING_REGIONS_DEFAULT.asList(),
afRegions = METERING_REGIONS_DEFAULT.asList(),
awbRegions = METERING_REGIONS_DEFAULT.asList()
)
}
- }
+ } ?: submitFailedResult
override suspend fun issueSingleCaptureAsync(
captureSequence: List<CaptureConfig>,
captureMode: Int,
flashType: Int,
flashMode: Int,
- ): List<Deferred<Void?>> {
+ ) = runIfNotClosed {
if (captureSequence.hasInvalidSurface()) {
- return List(captureSequence.size) {
- CompletableDeferred<Void?>().apply {
- completeExceptionally(
- ImageCaptureException(
- ImageCapture.ERROR_CAPTURE_FAILED,
- "Capture request failed due to invalid surface",
- null
- )
- )
- }
- }
+ failedResults(
+ captureSequence.size,
+ "Capture request failed due to invalid surface"
+ )
}
- return synchronized(lock) {
+ synchronized(lock) {
infoBundleMap.merge()
}.let { infoBundle ->
debug { "UseCaseCameraRequestControl: Submitting still captures to capture pipeline" }
@@ -295,8 +301,21 @@
flashMode = flashMode,
)
}
+ } ?: failedResults(captureSequence.size, "Capture request is cancelled on closed CameraGraph")
+
+ override fun close() {
+ closed = true
}
+ private fun failedResults(count: Int, message: String): List<Deferred<Void?>> =
+ List(count) {
+ CompletableDeferred<Void>().apply {
+ completeExceptionally(
+ ImageCaptureException(ImageCapture.ERROR_CAPTURE_FAILED, message, null)
+ )
+ }
+ }
+
private fun List<CaptureConfig>.hasInvalidSurface(): Boolean {
forEach { captureConfig ->
if (captureConfig.surfaces.isEmpty()) {
@@ -339,23 +358,37 @@
}
}
- private fun InfoBundle.updateCameraStateAsync(streams: Set<StreamId>? = null): Deferred<Unit> {
- capturePipeline.template =
- if (template != null && template!!.value != TEMPLATE_TYPE_NONE) {
- template!!.value
- } else {
- DEFAULT_REQUEST_TEMPLATE
- }
+ private fun InfoBundle.updateCameraStateAsync(streams: Set<StreamId>? = null): Deferred<Unit> =
+ runIfNotClosed {
+ capturePipeline.template =
+ if (template != null && template!!.value != TEMPLATE_TYPE_NONE) {
+ template!!.value
+ } else {
+ DEFAULT_REQUEST_TEMPLATE
+ }
- return state.updateAsync(
- parameters = options.build().toParameters(),
- appendParameters = false,
- internalParameters = mapOf(CAMERAX_TAG_BUNDLE to toTagBundle()),
- appendInternalParameters = false,
- streams = streams,
- template = template,
- listeners = listeners,
- )
+ state.updateAsync(
+ parameters = options.build().toParameters(),
+ appendParameters = false,
+ internalParameters = mapOf(CAMERAX_TAG_BUNDLE to toTagBundle()),
+ appendInternalParameters = false,
+ streams = streams,
+ template = template,
+ listeners = listeners,
+ )
+ } ?: canceledResult
+
+ private inline fun <R> runIfNotClosed(block: () -> R): R? {
+ return if (!closed) block() else null
+ }
+
+ private suspend inline fun useGraphSessionOrFailed(
+ crossinline block: suspend (CameraGraph.Session) -> Deferred<Result3A>
+ ): Deferred<Result3A> = try {
+ graph.acquireSession().use { block(it) }
+ } catch (e: CancellationException) {
+ debug(e) { "Cannot acquire the CameraGraph.Session" }
+ submitFailedResult
}
@Module
@@ -366,6 +399,12 @@
requestControl: UseCaseCameraRequestControlImpl
): UseCaseCameraRequestControl
}
+
+ companion object {
+ private val submitFailedResult =
+ CompletableDeferred(Result3A(Result3A.Status.SUBMIT_FAILED))
+ private val canceledResult = CompletableDeferred<Unit>().apply { cancel() }
+ }
}
fun TagBundle.toMap(): Map<String, Any> = mutableMapOf<String, Any>().also {
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraState.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraState.kt
index 75a210e..b67a339 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraState.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseCameraState.kt
@@ -38,6 +38,7 @@
import androidx.camera.camera2.pipe.integration.config.UseCaseGraphConfig
import javax.inject.Inject
import kotlinx.atomicfu.atomic
+import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred
@@ -241,9 +242,14 @@
threads.scope.launch(start = CoroutineStart.UNDISPATCHED) {
val result: CompletableDeferred<Unit>?
val request: Request?
- cameraGraph.acquireSession().use {
+ try {
+ cameraGraph.acquireSession()
+ } catch (e: CancellationException) {
+ Log.debug(e) { "Cannot acquire session at ${this@UseCaseCameraState}" }
+ null
+ }.let { session ->
synchronized(lock) {
- request = if (currentStreams.isEmpty()) {
+ request = if (currentStreams.isEmpty() || session == null) {
null
} else {
Request(
@@ -263,18 +269,21 @@
updating = false
updateSignal = null
}
-
- if (request == null) {
- it.stopRepeating()
- } else {
- result?.let { result ->
- synchronized(lock) {
- updateSignals.add(RequestSignal(submittedRequestCounter.value, result))
+ session?.use {
+ if (request == null) {
+ it.stopRepeating()
+ } else {
+ result?.let { result ->
+ synchronized(lock) {
+ updateSignals.add(
+ RequestSignal(submittedRequestCounter.value, result)
+ )
+ }
}
+ Log.debug { "Update RepeatingRequest: $request" }
+ it.startRepeating(request)
+ it.update3A(request.parameters)
}
- Log.debug { "Update RepeatingRequest: $request" }
- it.startRepeating(request)
- it.update3A(request.parameters)
}
}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManager.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManager.kt
index 94f1484..223c075 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManager.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManager.kt
@@ -226,4 +226,4 @@
// Surface was not retrieved from the ListenableFuture.
return isNotEmpty() && !contains(null)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilter.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilter.kt
index 763675f..014101e 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilter.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilter.kt
@@ -80,4 +80,4 @@
return false
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizer.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizer.kt
index 5179c88..dcd64a7 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizer.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizer.kt
@@ -132,4 +132,4 @@
return skippedCameraId
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControl.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControl.kt
index 9159825..a733d72 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControl.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControl.kt
@@ -200,4 +200,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2Interop.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2Interop.kt
index e12fbdc..e1076d2 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2Interop.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2Interop.kt
@@ -232,4 +232,4 @@
return this
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/CaptureRequestOptions.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/CaptureRequestOptions.kt
index 0d720da..da59baf 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/CaptureRequestOptions.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/CaptureRequestOptions.kt
@@ -162,4 +162,4 @@
return CaptureRequestOptions(OptionsBundle.from(mutableOptionsBundle))
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/ExperimentalCamera2Interop.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/ExperimentalCamera2Interop.kt
index 53ad7dd..53b9cd3 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/ExperimentalCamera2Interop.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/interop/ExperimentalCamera2Interop.kt
@@ -33,4 +33,4 @@
*/
@Retention(AnnotationRetention.BINARY)
@RequiresOptIn
-annotation class ExperimentalCamera2Interop
\ No newline at end of file
+annotation class ExperimentalCamera2Interop
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapterTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapterTest.kt
index bc7dddf..9d54d25 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapterTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CameraStateAdapterTest.kt
@@ -330,4 +330,4 @@
assertThat(cameraState.type).isEqualTo(CameraState.Type.CLOSING)
assertThat(cameraState.error?.code).isEqualTo(ERROR_OTHER_RECOVERABLE_ERROR)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureConfigAdapterTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureConfigAdapterTest.kt
index b6ff946..4b1602e 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureConfigAdapterTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureConfigAdapterTest.kt
@@ -288,4 +288,4 @@
val template = request.template
assertThat(template).isEqualTo(RequestTemplate(CameraDevice.TEMPLATE_VIDEO_SNAPSHOT))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureResultAdapterTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureResultAdapterTest.kt
index 3449f14..e2ef85b 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureResultAdapterTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CaptureResultAdapterTest.kt
@@ -486,4 +486,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CoroutineAdapterTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CoroutineAdapterTest.kt
index 87533ee..9b27a11 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CoroutineAdapterTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/CoroutineAdapterTest.kt
@@ -74,4 +74,4 @@
// Assert.
assertThat(resultDeferred.getCompletionExceptionOrNull()).isSameInstanceAs(testThrowable)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/CamcorderProfileResolutionQuirkTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
index 5f0a226..eeeb64a 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
@@ -106,4 +106,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirkTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirkTest.kt
index 9f7e6c3..03a3b85 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirkTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraCroppingQuirkTest.kt
@@ -94,4 +94,4 @@
Truth.assertThat(quirk.getVerifiedResolution(SurfaceConfig.ConfigType.JPEG))
.isEqualTo(Size(3264, 1836))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirkTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirkTest.kt
index e48b3fb..cb3d569 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirkTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/quirk/ExtraSupportedSurfaceCombinationsQuirkTest.kt
@@ -311,4 +311,4 @@
val hardwareLevel: Int,
val expectedSupportedSurfaceCombinations: Array<SurfaceCombination> = arrayOf()
)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRangeTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRangeTest.kt
index 1f0626e..ec9a852 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRangeTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AeFpsRangeTest.kt
@@ -149,4 +149,4 @@
private fun getAeFpsRange(aeFpsRange: AeFpsRange): Range<Int>? {
return aeFpsRange.getTargetAeFpsRange()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AutoFlashAEModeDisablerTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AutoFlashAEModeDisablerTest.kt
index f7ad78c..943704d 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AutoFlashAEModeDisablerTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/AutoFlashAEModeDisablerTest.kt
@@ -121,4 +121,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlashTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlashTest.kt
index 4322730..0a55e43b 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlashTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/compat/workaround/UseTorchAsFlashTest.kt
@@ -93,4 +93,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfigTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfigTest.kt
index f258ffd..d695dd9 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfigTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/Camera2ImplConfigTest.kt
@@ -166,4 +166,4 @@
// TODO: After porting CameraEventCallback (used for extension) to CameraUseCaseAdapter,
// also porting canExtendWithCameraEventCallback
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/EvCompControlTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/EvCompControlTest.kt
index 59d5f6e..87cc58c 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/EvCompControlTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/EvCompControlTest.kt
@@ -217,4 +217,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManagerTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManagerTest.kt
index 0472eed..f845e33 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManagerTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseSurfaceManagerTest.kt
@@ -324,4 +324,4 @@
private fun createTestDeferrableSurface() = TestDeferrableSurface().also {
it.terminationFuture.addListener({ it.cleanUp() }, useCaseThreads.backgroundExecutor)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilterTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilterTest.kt
index 6af4773..e9a0f23 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilterTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraCompatibilityFilterTest.kt
@@ -145,4 +145,4 @@
.getSystemService(Context.CAMERA_SERVICE)
) as ShadowCameraManager).addCamera(cameraId, characteristics)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizerTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizerTest.kt
index f22f016..6a08158 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizerTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/internal/CameraSelectionOptimizerTest.kt
@@ -241,4 +241,4 @@
) as ShadowCameraManager)
.addCamera(cameraId, characteristics)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControlTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControlTest.kt
index f4d0a96..8cd09c9 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControlTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControlTest.kt
@@ -198,4 +198,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeCapturePipeline.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeCapturePipeline.kt
index 2323e14..66ac8ac 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeCapturePipeline.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeCapturePipeline.kt
@@ -36,4 +36,4 @@
CompletableDeferred<Void?>(null).apply { complete(null) }
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeUseCaseCamera.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeUseCaseCamera.kt
index d2d439e..5fd0c64 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeUseCaseCamera.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/testing/FakeUseCaseCamera.kt
@@ -160,6 +160,9 @@
}
}
+ override fun close() {
+ }
+
data class FocusMeteringParams(
val aeRegions: List<MeteringRectangle>? = null,
val afRegions: List<MeteringRectangle>? = null,
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraControllerSimulator.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraControllerSimulator.kt
index 5ce8070..ae4763a 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraControllerSimulator.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraControllerSimulator.kt
@@ -196,4 +196,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraGraphSimulator.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraGraphSimulator.kt
index bf2264c..ba087f3 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraGraphSimulator.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/CameraGraphSimulator.kt
@@ -323,4 +323,4 @@
extraMetadata = extraMetadata.toMap()
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraBackend.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraBackend.kt
index 7300290..52325db 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraBackend.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraBackend.kt
@@ -90,4 +90,4 @@
val FAKE_CAMERA_BACKEND_ID =
CameraBackendId("androidx.camera.camera2.pipe.testing.FakeCameraBackend")
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraDevices.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraDevices.kt
index 268f1bd..26fcc47 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraDevices.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCameraDevices.kt
@@ -96,4 +96,4 @@
)
override fun awaitMetadata(camera: CameraId): CameraMetadata =
checkNotNull(awaitCameraMetadata(camera))
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequence.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequence.kt
index b40b1e4..5ab483e 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequence.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequence.kt
@@ -26,7 +26,7 @@
import androidx.camera.camera2.pipe.Request
import androidx.camera.camera2.pipe.RequestMetadata
-/** A CaptureSequence used for testing interactions with a [FakeCaptureSequenceProcessor] **/
+/** A CaptureSequence used for testing interactions with a [FakeCaptureSequenceProcessor] */
data class FakeCaptureSequence(
override val repeating: Boolean,
override val cameraId: CameraId,
@@ -55,4 +55,4 @@
invokeOnRequests { requestMetadata, _, listener ->
listener.onRequestSequenceCompleted(requestMetadata, frameNumber)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequenceListener.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequenceListener.kt
index f56f154..ee515b7 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequenceListener.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeCaptureSequenceListener.kt
@@ -30,4 +30,4 @@
override fun onCaptureSequenceComplete(captureSequence: CaptureSequence<*>) {
isComplete = true
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeThreads.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeThreads.kt
index c1c23e0..4626816 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeThreads.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeThreads.kt
@@ -58,4 +58,4 @@
camera2Executor = { executor }
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeTimeSource.kt b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeTimeSource.kt
index 8b033c1..e67408e 100644
--- a/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeTimeSource.kt
+++ b/camera/camera-camera2-pipe-testing/src/main/java/androidx/camera/camera2/pipe/testing/FakeTimeSource.kt
@@ -25,4 +25,4 @@
public var currentTimestamp = TimestampNs(0L)
override fun now() = currentTimestamp
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe-testing/src/test/java/androidx/camera/camera2/pipe/testing/FakeCameraDevicesTest.kt b/camera/camera-camera2-pipe-testing/src/test/java/androidx/camera/camera2/pipe/testing/FakeCameraDevicesTest.kt
index f709049..d76f46d 100644
--- a/camera/camera-camera2-pipe-testing/src/test/java/androidx/camera/camera2/pipe/testing/FakeCameraDevicesTest.kt
+++ b/camera/camera-camera2-pipe-testing/src/test/java/androidx/camera/camera2/pipe/testing/FakeCameraDevicesTest.kt
@@ -86,4 +86,4 @@
)
).isSameInstanceAs(metadata3)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraError.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraError.kt
index 93701f4..bd9a6b9 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraError.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraError.kt
@@ -179,4 +179,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
// An exception indicating that the CameraDevice.close() call has stalled.
-class CameraCloseStallException(message: String) : RuntimeException(message)
\ No newline at end of file
+class CameraCloseStallException(message: String) : RuntimeException(message)
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraGraph.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraGraph.kt
index f9b7c7b..581aeac 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraGraph.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraGraph.kt
@@ -513,4 +513,4 @@
override fun toString(): String =
super.toString() + "(cameraError = $cameraError, willAttemptRetry = $willAttemptRetry)"
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraMetadata.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraMetadata.kt
index c8c4d47..57e6259 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraMetadata.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/CameraMetadata.kt
@@ -137,4 +137,4 @@
availableAfModes.contains(CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/Frames.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/Frames.kt
index bdbf8d7..6d10262 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/Frames.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/Frames.kt
@@ -108,4 +108,4 @@
related: List<FrameInfo?>
): Map<*, Any?> = emptyMap<Any, Any?>()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/AndroidCaptureFailure.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/AndroidCaptureFailure.kt
index 7b22375..e0c1a2c 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/AndroidCaptureFailure.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/AndroidCaptureFailure.kt
@@ -35,4 +35,4 @@
override val wasImageCaptured: Boolean,
override val frameNumber: FrameNumber,
override val reason: Int
-) : RequestFailureWrapper
\ No newline at end of file
+) : RequestFailureWrapper
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CameraStatusMonitor.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CameraStatusMonitor.kt
index 0ab7e59..0bd244e 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CameraStatusMonitor.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CameraStatusMonitor.kt
@@ -70,4 +70,4 @@
awaitClose { manager.unregisterAvailabilityCallback(availabilityCallback) }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CaptureCallback.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CaptureCallback.kt
index 4fbaac1..ac083de 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CaptureCallback.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2CaptureCallback.kt
@@ -55,4 +55,4 @@
fun onCaptureSequenceCompleted(captureSequenceId: Int, captureFrameNumber: Long)
fun onCaptureSequenceAborted(captureSequenceId: Int)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2DeviceCloser.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2DeviceCloser.kt
index c63ea2b..abf3a2f 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2DeviceCloser.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2DeviceCloser.kt
@@ -146,4 +146,4 @@
}
sessionConfigured.await()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2Quirks.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2Quirks.kt
index a56125a..c9ad6e2 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2Quirks.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/Camera2Quirks.kt
@@ -85,4 +85,4 @@
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL]
return level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraDeviceWrapper.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraDeviceWrapper.kt
index 6a4b1eb..3cd3934 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraDeviceWrapper.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraDeviceWrapper.kt
@@ -525,4 +525,4 @@
internal fun disconnect() = synchronized(lock) {
disconnected = true
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraPipeKeys.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraPipeKeys.kt
index 8d2008a..2792db89 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraPipeKeys.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/CameraPipeKeys.kt
@@ -62,4 +62,4 @@
* quality under low light conditions. See [CameraExtensionCharacteristics.EXTENSION_NIGHT]
*/
const val CAMERA2_EXTENSION_MODE_NIGHT = 4
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionState.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionState.kt
index c603507..9a61581 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionState.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionState.kt
@@ -51,4 +51,4 @@
override fun onClosed(session: CameraExtensionSessionWrapper) {
captureSessionState.onClosed(session as CameraCaptureSessionWrapper)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionWrapper.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionWrapper.kt
index 2d69b39..1e04f26 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionWrapper.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/ExtensionSessionWrapper.kt
@@ -22,6 +22,7 @@
import android.hardware.camera2.CameraExtensionSession
import android.hardware.camera2.CaptureRequest
import android.hardware.camera2.TotalCaptureResult
+import android.os.Build
import android.view.Surface
import androidx.annotation.RequiresApi
import androidx.camera.camera2.pipe.FrameNumber
@@ -145,36 +146,56 @@
) : CameraExtensionSessionWrapper {
private val frameNumbers: AtomicLong = atomic(0L)
- private val frameNumbersMap: MutableMap<CameraExtensionSession, Long> = HashMap()
+ private val extensionSessionMap: MutableMap<CameraExtensionSession, Long> = HashMap()
override fun capture(
request: CaptureRequest,
listener: CameraCaptureSession.CaptureCallback
): Int? = catchAndReportCameraExceptions(device.cameraId, cameraErrorListener) {
- val frameQueue = LinkedList<Long>()
- cameraExtensionSession.capture(
- request,
- callbackExecutor,
- Camera2CaptureSessionCallbackToExtensionCaptureCallback(
- listener as Camera2CaptureCallback,
- frameQueue
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ cameraExtensionSession.capture(
+ request,
+ callbackExecutor,
+ Camera2CaptureSessionCallbackToExtensionCaptureCallback(
+ listener as Camera2CaptureCallback,
+ LinkedList()
+ )
)
- )
+ } else {
+ cameraExtensionSession.capture(
+ request,
+ callbackExecutor,
+ Camera2CaptureSessionCallbackToExtensionCaptureCallbackAndroidS(
+ listener as Camera2CaptureCallback,
+ mutableMapOf()
+ )
+ )
+ }
}
override fun setRepeatingRequest(
request: CaptureRequest,
listener: CameraCaptureSession.CaptureCallback,
): Int? = catchAndReportCameraExceptions(device.cameraId, cameraErrorListener) {
- val frameQueue = LinkedList<Long>()
- cameraExtensionSession.setRepeatingRequest(
- request,
- callbackExecutor,
- Camera2CaptureSessionCallbackToExtensionCaptureCallback(
- listener as Camera2CaptureCallback,
- frameQueue
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ cameraExtensionSession.setRepeatingRequest(
+ request,
+ callbackExecutor,
+ Camera2CaptureSessionCallbackToExtensionCaptureCallback(
+ listener as Camera2CaptureCallback,
+ LinkedList()
+ )
)
- )
+ } else {
+ cameraExtensionSession.setRepeatingRequest(
+ request,
+ callbackExecutor,
+ Camera2CaptureSessionCallbackToExtensionCaptureCallbackAndroidS(
+ listener as Camera2CaptureCallback,
+ mutableMapOf()
+ )
+ )
+ }
}
override fun stopRepeating(): Boolean =
@@ -238,7 +259,7 @@
timestamp: Long
) {
val frameNumber = frameNumbers.incrementAndGet()
- frameNumbersMap[session] = frameNumber
+ extensionSessionMap[session] = frameNumber
frameQueue.add(frameNumber)
captureCallback.onCaptureStarted(
request,
@@ -262,7 +283,7 @@
}
override fun onCaptureSequenceCompleted(session: CameraExtensionSession, sequenceId: Int) {
- val frameNumber = frameNumbersMap[session]
+ val frameNumber = extensionSessionMap[session]
captureCallback.onCaptureSequenceCompleted(sequenceId, frameNumber!!)
}
@@ -275,8 +296,67 @@
request: CaptureRequest,
result: TotalCaptureResult
) {
+ Log.info { "Extension session listener's onComplete requires Android T or higher." }
val frameNumber = frameQueue.remove()
captureCallback.onCaptureCompleted(request, result, FrameNumber(frameNumber))
}
}
+
+ /**
+ * [CameraExtensionSession.ExtensionCaptureCallback]'s onCaptureResultAvailable is gated
+ * behind Android T, so any devices on Android S or older will not see onCaptureResultAvailable
+ * being triggered. This implementation calls onCaptureCompleted in onCaptureStarted and does
+ * not keep track of completed or failed frames for repeating requests.
+ */
+ inner class Camera2CaptureSessionCallbackToExtensionCaptureCallbackAndroidS(
+ private val captureCallback: Camera2CaptureCallback,
+ private val captureRequestMap: MutableMap<CaptureRequest, MutableList<Long>>
+
+ ) : CameraExtensionSession.ExtensionCaptureCallback() {
+
+ override fun onCaptureStarted(
+ session: CameraExtensionSession,
+ request: CaptureRequest,
+ timestamp: Long
+ ) {
+ val frameNumber = frameNumbers.incrementAndGet()
+ extensionSessionMap[session] = frameNumber
+ captureRequestMap.getOrPut(request) { mutableListOf() }.add(frameNumber)
+ captureCallback.onCaptureStarted(
+ request,
+ frameNumber,
+ timestamp
+ )
+ }
+
+ override fun onCaptureProcessStarted(
+ session: CameraExtensionSession,
+ request: CaptureRequest
+ ) {
+ }
+
+ override fun onCaptureFailed(session: CameraExtensionSession, request: CaptureRequest) {
+ if (captureRequestMap[request]!!.size == 1) {
+ val frameNumber = captureRequestMap[request]!![0]
+ captureCallback.onCaptureFailed(
+ request,
+ FrameNumber(frameNumber)
+ )
+ } else {
+ Log.info {
+ "onCaptureFailed is not triggered for repeating requests. Request " +
+ "frame numbers: " + captureRequestMap[request]!!.stream()
+ }
+ }
+ }
+
+ override fun onCaptureSequenceCompleted(session: CameraExtensionSession, sequenceId: Int) {
+ val frameNumber = extensionSessionMap[session]
+ captureCallback.onCaptureSequenceCompleted(sequenceId, frameNumber!!)
+ }
+
+ override fun onCaptureSequenceAborted(session: CameraExtensionSession, sequenceId: Int) {
+ captureCallback.onCaptureSequenceAborted(sequenceId)
+ }
+ }
}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/OnSessionFinalized.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/OnSessionFinalized.kt
index 67aa9a5..5bc42ee 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/OnSessionFinalized.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/compat/OnSessionFinalized.kt
@@ -33,4 +33,4 @@
* See b/249258992 for more details.
*/
fun onSessionFinalized()
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/core/Threading.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/core/Threading.kt
index 184b6ac..9327e1a 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/core/Threading.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/core/Threading.kt
@@ -79,4 +79,4 @@
block()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/CameraErrorListener.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/CameraErrorListener.kt
index 19b6018..c0a6076 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/CameraErrorListener.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/CameraErrorListener.kt
@@ -29,4 +29,4 @@
cameraError: CameraError,
willAttemptRetry: Boolean = false
)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/GraphLifecycleManager.kt b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/GraphLifecycleManager.kt
index ee876bf..1355137 100644
--- a/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/GraphLifecycleManager.kt
+++ b/camera/camera-camera2-pipe/src/main/java/androidx/camera/camera2/pipe/internal/GraphLifecycleManager.kt
@@ -129,4 +129,4 @@
}
}?.tryRestart(cameraStatus)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2-pipe/src/test/java/androidx/camera/camera2/pipe/testing/FakeCamera2DeviceCloser.kt b/camera/camera-camera2-pipe/src/test/java/androidx/camera/camera2/pipe/testing/FakeCamera2DeviceCloser.kt
index ca52b9b..7b6cc46 100644
--- a/camera/camera-camera2-pipe/src/test/java/androidx/camera/camera2/pipe/testing/FakeCamera2DeviceCloser.kt
+++ b/camera/camera-camera2-pipe/src/test/java/androidx/camera/camera2/pipe/testing/FakeCamera2DeviceCloser.kt
@@ -30,4 +30,4 @@
) {
cameraDeviceWrapper?.onDeviceClosed()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/AsyncCameraDevice.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/AsyncCameraDevice.kt
index ca939dd..027664e 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/AsyncCameraDevice.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/AsyncCameraDevice.kt
@@ -124,4 +124,4 @@
}
return closeFuture
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplForceOpenCameraTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplForceOpenCameraTest.kt
index c62fed7..2b3d16c 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplForceOpenCameraTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplForceOpenCameraTest.kt
@@ -233,4 +233,4 @@
cameraHandlerThread.quitSafely()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplStateTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplStateTest.kt
index c1f0759..f847cec 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplStateTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraImplStateTest.kt
@@ -527,4 +527,4 @@
cameraHandlerThread.quitSafely()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2EncoderProfilesProviderTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2EncoderProfilesProviderTest.kt
index 81c3054..a293c09 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2EncoderProfilesProviderTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2EncoderProfilesProviderTest.kt
@@ -199,4 +199,4 @@
return Build.MODEL.contains("Cuttlefish", true) &&
(Build.ID.startsWith("TP1A", true) || Build.ID.startsWith("TSE4", true))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2RequestProcessorTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2RequestProcessorTest.kt
index 693f94e..e306537 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2RequestProcessorTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2RequestProcessorTest.kt
@@ -574,4 +574,4 @@
override fun onCaptureSequenceAborted(sequenceId: Int) {
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/FovDeviceTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/FovDeviceTest.kt
index 220bc32..df11ed2 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/FovDeviceTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/FovDeviceTest.kt
@@ -95,4 +95,4 @@
assumeTrue(DEFAULT_CAMERA_ID_GROUP.contains(cameraId))
assertThat(cameraUseCaseAdapter.cameraInfo.intrinsicZoomRatio).isEqualTo(1.0F)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/ProcessingCaptureSessionTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/ProcessingCaptureSessionTest.kt
index 201f1c5..ddbccb6 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/ProcessingCaptureSessionTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/ProcessingCaptureSessionTest.kt
@@ -956,4 +956,4 @@
closeOutputSurfaces()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/CameraDeviceCompatDeviceTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/CameraDeviceCompatDeviceTest.kt
index b4b2411..46bf3a6 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/CameraDeviceCompatDeviceTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/CameraDeviceCompatDeviceTest.kt
@@ -152,4 +152,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
index 36a2bec..ab379bc 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
@@ -383,4 +383,4 @@
assertThat(latch.await(timeout, TimeUnit.MILLISECONDS)).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2UseCaseConfigFactory.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2UseCaseConfigFactory.java
index 3d271cd..0010019 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2UseCaseConfigFactory.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2UseCaseConfigFactory.java
@@ -17,7 +17,6 @@
package androidx.camera.camera2.internal;
import static androidx.camera.core.impl.ImageOutputConfig.OPTION_MAX_RESOLUTION;
-import static androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR;
import static androidx.camera.core.impl.ImageOutputConfig.OPTION_TARGET_ROTATION;
import static androidx.camera.core.impl.UseCaseConfig.OPTION_CAPTURE_CONFIG_UNPACKER;
import static androidx.camera.core.impl.UseCaseConfig.OPTION_DEFAULT_CAPTURE_CONFIG;
@@ -37,8 +36,6 @@
import androidx.camera.core.impl.OptionsBundle;
import androidx.camera.core.impl.SessionConfig;
import androidx.camera.core.impl.UseCaseConfigFactory;
-import androidx.camera.core.resolutionselector.ResolutionSelector;
-import androidx.camera.core.resolutionselector.ResolutionStrategy;
/**
* Implementation of UseCaseConfigFactory to provide the default camera2 configurations for use
@@ -86,11 +83,6 @@
if (captureType == CaptureType.PREVIEW) {
Size previewSize = mDisplayInfoManager.getPreviewSize();
mutableConfig.insertOption(OPTION_MAX_RESOLUTION, previewSize);
- ResolutionStrategy resolutionStrategy = new ResolutionStrategy(previewSize,
- ResolutionStrategy.FALLBACK_RULE_CLOSEST_LOWER);
- mutableConfig.insertOption(OPTION_RESOLUTION_SELECTOR,
- new ResolutionSelector.Builder().setResolutionStrategy(
- resolutionStrategy).build());
}
// The default rotation value should be determined by the max non-state-off display.
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CameraCaptureSessionStateCallbacks.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CameraCaptureSessionStateCallbacks.java
index 40c2a9a..bd4f52c 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CameraCaptureSessionStateCallbacks.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CameraCaptureSessionStateCallbacks.java
@@ -38,7 +38,7 @@
/**
* Returns a session state callback which does nothing.
- **/
+ */
@NonNull
public static CameraCaptureSession.StateCallback createNoOpCallback() {
return new NoOpSessionStateCallback();
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CaptureSession.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CaptureSession.java
index 95dda70..1030126 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CaptureSession.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/CaptureSession.java
@@ -105,7 +105,7 @@
@Nullable
@GuardedBy("mSessionLock")
SessionConfig mSessionConfig;
- /** The capture options from CameraEventCallback.onRepeating(). **/
+ /** The capture options from CameraEventCallback.onRepeating(). */
@NonNull
@GuardedBy("mSessionLock")
Config mCameraEventOnRepeatingOptions = OptionsBundle.emptyBundle();
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/CameraStateMachineTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/CameraStateMachineTest.kt
index 4ea8c60..850a673 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/CameraStateMachineTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/CameraStateMachineTest.kt
@@ -202,4 +202,4 @@
assertThat(index).isEqualTo(states.size)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/DisplayInfoManagerTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/DisplayInfoManagerTest.kt
index 980dfe6..dfe737a 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/DisplayInfoManagerTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/DisplayInfoManagerTest.kt
@@ -213,4 +213,4 @@
.getInstance(ApplicationProvider.getApplicationContext())
assertThat(displayInfoManager.previewSize).isEqualTo(Size(1600, 720))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/quirk/CamcorderProfileResolutionQuirkTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
index 83defcab..9a9de1c 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/quirk/CamcorderProfileResolutionQuirkTest.kt
@@ -104,4 +104,4 @@
CAMERA_ID_0
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/DisplaySizeCorrectorTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/DisplaySizeCorrectorTest.kt
index e50212b..22ce30b 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/DisplaySizeCorrectorTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/DisplaySizeCorrectorTest.kt
@@ -43,4 +43,4 @@
// See SmallDisplaySizeQuirk for the device display size
assertThat(DisplaySizeCorrector().displaySize).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/OverrideAeModeForStillCaptureTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/OverrideAeModeForStillCaptureTest.kt
index 7288b26..1ecc319 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/OverrideAeModeForStillCaptureTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/OverrideAeModeForStillCaptureTest.kt
@@ -103,4 +103,4 @@
assertThat(overrideAeModeForStillCapture.shouldSetAeModeAlwaysFlash(FLASH_MODE_ON))
.isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/SupportedRepeatingSurfaceSizeTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/SupportedRepeatingSurfaceSizeTest.kt
index 3a69119..dfa49ab 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/SupportedRepeatingSurfaceSizeTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/compat/workaround/SupportedRepeatingSurfaceSizeTest.kt
@@ -67,4 +67,4 @@
SupportedRepeatingSurfaceSize().getSupportedSizes(input_sizes).asList()
).containsExactlyElementsIn(result_sizes)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/concurrent/Camera2CameraCoordinatorTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/concurrent/Camera2CameraCoordinatorTest.kt
index 5354bb1..6b7de32 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/concurrent/Camera2CameraCoordinatorTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/concurrent/Camera2CameraCoordinatorTest.kt
@@ -212,4 +212,4 @@
return mCameraManagerImpl.cameraManager
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/interop/Camera2CameraControlTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/interop/Camera2CameraControlTest.kt
index bdf3f1e..75d73db 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/interop/Camera2CameraControlTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/interop/Camera2CameraControlTest.kt
@@ -37,4 +37,4 @@
CameraControlInternal.DEFAULT_EMPTY_INSTANCE
Camera2CameraControl.from(wrongCameraControl)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/AndroidImageProxyTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/AndroidImageProxyTest.kt
index eafedc5..f42b888 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/AndroidImageProxyTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/AndroidImageProxyTest.kt
@@ -123,4 +123,4 @@
assertThat(wrappedPlanes[i].buffer).isEqualTo(originalPlanes[i].buffer)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.kt
index 156dfe0..6dd0b4f 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.kt
@@ -417,4 +417,4 @@
Surface::class.java
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/UseCaseTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/UseCaseTest.kt
index cbb7e2e..9850f20 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/UseCaseTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/UseCaseTest.kt
@@ -355,4 +355,4 @@
StreamSpec.builder(SURFACE_RESOLUTION).build()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Bitmap2JpegBytesTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Bitmap2JpegBytesTest.kt
index 6a5cdde..5fc1f51 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Bitmap2JpegBytesTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Bitmap2JpegBytesTest.kt
@@ -65,4 +65,4 @@
assertThat(getAverageDiff(bitmap, restoredBitmap)).isEqualTo(0)
assertThat(output.cameraCaptureResult).isEqualTo(CAMERA_CAPTURE_RESULT)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/BitmapEffectDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/BitmapEffectDeviceTest.kt
index be488a6..efc723c 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/BitmapEffectDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/BitmapEffectDeviceTest.kt
@@ -75,4 +75,4 @@
assertThat(getAverageDiff(output.data, Rect(0, 240, 320, 480), 0X555555)).isEqualTo(0)
assertThat(getAverageDiff(output.data, Rect(321, 240, WIDTH, 480), 0XAAAAAA)).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
index 8aa7647..6eae218 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
@@ -84,4 +84,4 @@
onDiskResultCont = cont
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallbackDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallbackDeviceTest.kt
index e7cb20b..50c9346 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallbackDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/FakeTakePictureCallbackDeviceTest.kt
@@ -53,4 +53,4 @@
// Act.
assertThat(fakeTakePictureCallback.getInMemoryResult()).isEqualTo(inMemoryResult)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Image2JpegBytesDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Image2JpegBytesDeviceTest.kt
index c431343..d78da09 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Image2JpegBytesDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Image2JpegBytesDeviceTest.kt
@@ -89,4 +89,4 @@
// Assert: capture result
assertThat(output.cameraCaptureResult).isEqualTo(CAMERA_CAPTURE_RESULT)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2DiskDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2DiskDeviceTest.kt
index 1a60fa7..0366954 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2DiskDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2DiskDeviceTest.kt
@@ -124,4 +124,4 @@
val input = JpegBytes2Disk.In.of(inputPacket, options)
return operation.apply(input).savedUri!!.path!!
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2ImageDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2ImageDeviceTest.kt
index 106df81..1ffc67b 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2ImageDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/JpegBytes2ImageDeviceTest.kt
@@ -79,4 +79,4 @@
assertThat(output.sensorToBufferTransform).isEqualTo(matrix)
assertThat(output.cameraCaptureResult).isEqualTo(CAMERA_CAPTURE_RESULT)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/RgbaImageProxyDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/RgbaImageProxyDeviceTest.kt
index 13f89bd..ccfe7a2 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/RgbaImageProxyDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/RgbaImageProxyDeviceTest.kt
@@ -138,4 +138,4 @@
}
return false
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Utils.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Utils.kt
index 1e37add..385f7c7 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Utils.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/imagecapture/Utils.kt
@@ -47,4 +47,4 @@
internal val CAMERA_CAPTURE_RESULT = FakeCameraCaptureResult().also {
it.timestamp = TIMESTAMP
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ConstantObservableTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ConstantObservableTest.kt
index b5d0248..63af27c 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ConstantObservableTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ConstantObservableTest.kt
@@ -80,4 +80,4 @@
assertThat(deferredValue.await()).isEqualTo(MAGIC_STRING)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/LiveDataObservableTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/LiveDataObservableTest.kt
index 79413be..e1da6f2 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/LiveDataObservableTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/LiveDataObservableTest.kt
@@ -117,4 +117,4 @@
}
}
-internal class TestError(message: String) : Exception(message)
\ No newline at end of file
+internal class TestError(message: String) : Exception(message)
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/StateObservableTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/StateObservableTest.kt
index 0052b91..6f7b501 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/StateObservableTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/StateObservableTest.kt
@@ -192,4 +192,4 @@
// Ensure receiveJob completes
receiveJob.join()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ViewPortsTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ViewPortsTest.kt
index 5a63cf5..f45c019 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ViewPortsTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/ViewPortsTest.kt
@@ -967,4 +967,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/utils/ExifOutputStreamTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/utils/ExifOutputStreamTest.kt
index 5945f0a..dcf65da 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/utils/ExifOutputStreamTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/impl/utils/ExifOutputStreamTest.kt
@@ -75,4 +75,4 @@
.isEqualTo(0)
assertThat(withoutExif.getAttribute(ExifInterface.TAG_EXPOSURE_TIME)).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ArrayRingBufferTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ArrayRingBufferTest.kt
index 61c2f9d..7310d63 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ArrayRingBufferTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ArrayRingBufferTest.kt
@@ -84,4 +84,4 @@
ArrayRingBuffer(5)
assertThrows(NoSuchElementException::class.java, testBuffer::dequeue)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ImageUtilDeviceTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ImageUtilDeviceTest.kt
index 3627d63..35a5ba9 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ImageUtilDeviceTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ImageUtilDeviceTest.kt
@@ -220,4 +220,4 @@
ImageUtil.createBitmapFromImageProxy(image)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ZslRingBufferTest.kt b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ZslRingBufferTest.kt
index 63fcf61..08a233b 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ZslRingBufferTest.kt
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/internal/utils/ZslRingBufferTest.kt
@@ -106,4 +106,4 @@
verify(onRemoveCallback, times(3)).onRemove(any())
assertThat(ringBuffer.dequeue()).isEqualTo(imageProxy1)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java b/camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
index dd99ca8..f4e2420 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java
@@ -1167,7 +1167,7 @@
* {@link ImageCaptureLatencyEstimate#UNDEFINED_CAPTURE_LATENCY}. If the processing
* latency is not supported then the processing latency component will be
* {@link ImageCaptureLatencyEstimate#UNDEFINED_PROCESSING_LATENCY}.
- **/
+ */
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
public ImageCaptureLatencyEstimate getRealtimeCaptureLatencyEstimate() {
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/Preview.java b/camera/camera-core/src/main/java/androidx/camera/core/Preview.java
index 6661ecb..e36507c 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/Preview.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/Preview.java
@@ -1080,10 +1080,8 @@
* size match to the device's screen resolution, or to 1080p (1920x1080), whichever is
* smaller. See the
* <a href="https://developer.android.com/reference/android/hardware/camera2/CameraDevice#regular-capture">Regular capture</a>
- * section in {@link android.hardware.camera2.CameraDevice}'. {@link Preview} has a
- * default {@link ResolutionStrategy} with the {@code PREVIEW} bound size and
- * {@link ResolutionStrategy#FALLBACK_RULE_CLOSEST_LOWER} to achieve this. Applications
- * can override this default strategy with a different resolution strategy.
+ * section in {@link android.hardware.camera2.CameraDevice}'. Applications can set any
+ * {@link ResolutionStrategy} to override it.
*
* <p>Note that due to compatibility reasons, CameraX may select a resolution that is
* larger than the default screen resolution on certain devices.
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/UseCase.java b/camera/camera-core/src/main/java/androidx/camera/core/UseCase.java
index 396e646..a9c5504 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/UseCase.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/UseCase.java
@@ -19,6 +19,7 @@
import static androidx.camera.core.MirrorMode.MIRROR_MODE_OFF;
import static androidx.camera.core.MirrorMode.MIRROR_MODE_ON;
import static androidx.camera.core.MirrorMode.MIRROR_MODE_ON_FRONT_ONLY;
+import static androidx.camera.core.impl.ImageOutputConfig.OPTION_MAX_RESOLUTION;
import static androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR;
import static androidx.camera.core.impl.ImageOutputConfig.OPTION_TARGET_ASPECT_RATIO;
import static androidx.camera.core.impl.ImageOutputConfig.OPTION_TARGET_RESOLUTION;
@@ -226,29 +227,28 @@
}
}
+ // Removes the default max resolution setting if application sets any ResolutionStrategy
+ // to override it.
+ if (mUseCaseConfig.containsOption(OPTION_RESOLUTION_SELECTOR)
+ && mergedConfig.containsOption(OPTION_MAX_RESOLUTION)) {
+ ResolutionSelector resolutionSelector =
+ mUseCaseConfig.retrieveOption(OPTION_RESOLUTION_SELECTOR);
+ if (resolutionSelector.getResolutionStrategy() != null) {
+ mergedConfig.removeOption(OPTION_MAX_RESOLUTION);
+ }
+ }
+
// If any options need special handling, this is the place to do it. For now we'll just copy
// over all options.
for (Option<?> opt : mUseCaseConfig.listOptions()) {
- @SuppressWarnings("unchecked") // Options/values are being copied directly
- Option<Object> objectOpt = (Option<Object>) opt;
-
- mergedConfig.insertOption(objectOpt,
- mUseCaseConfig.getOptionPriority(opt),
- mUseCaseConfig.retrieveOption(objectOpt));
+ Config.mergeOptionValue(mergedConfig, mergedConfig, mUseCaseConfig, opt);
}
if (extendedConfig != null) {
// If any options need special handling, this is the place to do it. For now we'll
// just copy over all options.
for (Option<?> opt : extendedConfig.listOptions()) {
- @SuppressWarnings("unchecked") // Options/values are being copied directly
- Option<Object> objectOpt = (Option<Object>) opt;
- if (objectOpt.getId().equals(TargetConfig.OPTION_TARGET_NAME.getId())) {
- continue;
- }
- mergedConfig.insertOption(objectOpt,
- extendedConfig.getOptionPriority(opt),
- extendedConfig.retrieveOption(objectOpt));
+ Config.mergeOptionValue(mergedConfig, mergedConfig, extendedConfig, opt);
}
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/imagecapture/JpegBytes2Disk.java b/camera/camera-core/src/main/java/androidx/camera/core/imagecapture/JpegBytes2Disk.java
index 55b074b..cec0faa 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/imagecapture/JpegBytes2Disk.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/imagecapture/JpegBytes2Disk.java
@@ -24,6 +24,7 @@
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
+import android.util.Range;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -31,6 +32,7 @@
import androidx.camera.core.ImageCapture;
import androidx.camera.core.ImageCaptureException;
import androidx.camera.core.impl.utils.Exif;
+import androidx.camera.core.internal.compat.workaround.InvalidJpegDataParser;
import androidx.camera.core.processing.Operation;
import androidx.camera.core.processing.Packet;
@@ -109,7 +111,16 @@
private static void writeBytesToFile(
@NonNull File tempFile, @NonNull byte[] bytes) throws ImageCaptureException {
try (FileOutputStream output = new FileOutputStream(tempFile)) {
- output.write(bytes);
+ InvalidJpegDataParser invalidJpegDataParser = new InvalidJpegDataParser();
+ Range<Integer> invalidDataRange = invalidJpegDataParser.getInvalidDataRange(bytes);
+
+ if (invalidDataRange != null) {
+ output.write(bytes, 0, invalidDataRange.getLower());
+ output.write(bytes, invalidDataRange.getUpper() + 1,
+ (bytes.length - invalidDataRange.getUpper() - 1));
+ } else {
+ output.write(bytes);
+ }
} catch (IOException e) {
throw new ImageCaptureException(ERROR_FILE_IO, "Failed to write to temp file", e);
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/impl/Config.java b/camera/camera-core/src/main/java/androidx/camera/core/impl/Config.java
index 67493a2..ab1314e 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/impl/Config.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/impl/Config.java
@@ -323,27 +323,44 @@
// If any options need special handling, this is the place to do it. For now we'll
// just copy over all options.
for (Config.Option<?> opt : extendedConfig.listOptions()) {
- @SuppressWarnings("unchecked") // Options/values are being copied directly
- Config.Option<Object> objectOpt = (Config.Option<Object>) opt;
-
- // ResolutionSelector needs special handling to merge the underlying settings.
- if (Objects.equals(objectOpt, ImageOutputConfig.OPTION_RESOLUTION_SELECTOR)) {
- ResolutionSelector resolutionSelectorToOverride =
- (ResolutionSelector) extendedConfig.retrieveOption(objectOpt);
- ResolutionSelector baseResolutionSelector =
- (ResolutionSelector) baseConfig.retrieveOption(objectOpt);
- mergedConfig.insertOption(objectOpt,
- extendedConfig.getOptionPriority(opt),
- ResolutionSelectorUtil.overrideResolutionSelectors(
- baseResolutionSelector, resolutionSelectorToOverride));
- } else {
- mergedConfig.insertOption(objectOpt,
- extendedConfig.getOptionPriority(opt),
- extendedConfig.retrieveOption(objectOpt));
- }
+ mergeOptionValue(mergedConfig, baseConfig, extendedConfig, opt);
}
}
return OptionsBundle.from(mergedConfig);
}
+
+ /**
+ * Merges a specific option value from two configs.
+ *
+ * @param mergedConfig the final output config
+ * @param baseConfig the base config contains the option value which might be overridden by
+ * the corresponding option value in the extend config.
+ * @param extendedConfig the extended config contains the option value which might override
+ * the corresponding option value in the base config.
+ * @param opt the option to merge
+ */
+ static void mergeOptionValue(@NonNull MutableOptionsBundle mergedConfig,
+ @NonNull Config baseConfig,
+ @NonNull Config extendedConfig,
+ @NonNull Option<?> opt) {
+ @SuppressWarnings("unchecked") // Options/values are being copied directly
+ Config.Option<Object> objectOpt = (Config.Option<Object>) opt;
+
+ // ResolutionSelector needs special handling to merge the underlying settings.
+ if (Objects.equals(objectOpt, ImageOutputConfig.OPTION_RESOLUTION_SELECTOR)) {
+ ResolutionSelector resolutionSelectorToOverride =
+ (ResolutionSelector) extendedConfig.retrieveOption(objectOpt, null);
+ ResolutionSelector baseResolutionSelector =
+ (ResolutionSelector) baseConfig.retrieveOption(objectOpt, null);
+ mergedConfig.insertOption(objectOpt,
+ extendedConfig.getOptionPriority(opt),
+ ResolutionSelectorUtil.overrideResolutionSelectors(
+ baseResolutionSelector, resolutionSelectorToOverride));
+ } else {
+ mergedConfig.insertOption(objectOpt,
+ extendedConfig.getOptionPriority(opt),
+ extendedConfig.retrieveOption(objectOpt));
+ }
+ }
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/internal/SupportedOutputSizesSorter.java b/camera/camera-core/src/main/java/androidx/camera/core/internal/SupportedOutputSizesSorter.java
index 7bbe75e..be65059 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/internal/SupportedOutputSizesSorter.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/internal/SupportedOutputSizesSorter.java
@@ -40,6 +40,7 @@
import androidx.camera.core.impl.utils.AspectRatioUtil;
import androidx.camera.core.impl.utils.CameraOrientationUtil;
import androidx.camera.core.impl.utils.CompareSizesByArea;
+import androidx.camera.core.internal.utils.SizeUtil;
import androidx.camera.core.resolutionselector.AspectRatioStrategy;
import androidx.camera.core.resolutionselector.ResolutionFilter;
import androidx.camera.core.resolutionselector.ResolutionSelector;
@@ -216,6 +217,13 @@
applyAspectRatioStrategy(resolutionCandidateList,
resolutionSelector.getAspectRatioStrategy());
+
+ // Applies the max resolution setting
+ Size maxResolution = ((ImageOutputConfig) useCaseConfig).getMaxResolution(null);
+ if (maxResolution != null) {
+ applyMaxResolutionRestriction(aspectRatioSizeListMap, maxResolution);
+ }
+
// Applies the resolution strategy onto the resolution candidate list.
applyResolutionStrategy(aspectRatioSizeListMap, resolutionSelector.getResolutionStrategy());
@@ -436,6 +444,32 @@
}
/**
+ * Applies the max resolution restriction.
+ *
+ * <p>Filters out the output sizes that exceed the max resolution in area size.
+ *
+ * @param sortedAspectRatioSizeListMap the aspect ratio to size list linked hash map. The
+ * entries order should not be changed.
+ * @param maxResolution the max resolution size.
+ */
+ private static void applyMaxResolutionRestriction(
+ @NonNull LinkedHashMap<Rational, List<Size>> sortedAspectRatioSizeListMap,
+ @NonNull Size maxResolution) {
+ int maxResolutionAreaSize = SizeUtil.getArea(maxResolution);
+ for (Rational key : sortedAspectRatioSizeListMap.keySet()) {
+ List<Size> supportedSizesList = sortedAspectRatioSizeListMap.get(key);
+ List<Size> filteredResultList = new ArrayList<>();
+ for (Size size : supportedSizesList) {
+ if (SizeUtil.getArea(size) <= maxResolutionAreaSize) {
+ filteredResultList.add(size);
+ }
+ }
+ supportedSizesList.clear();
+ supportedSizesList.addAll(filteredResultList);
+ }
+ }
+
+ /**
* Applies the resolution filtered to the sorted output size list.
*
* @param sizeList the supported size list which has been filtered and sorted by the
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
index 801f381..4735c7c 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
@@ -52,6 +52,9 @@
if (LowMemoryQuirk.load()) {
quirks.add(new LowMemoryQuirk());
}
+ if (LargeJpegImageQuirk.load()) {
+ quirks.add(new LargeJpegImageQuirk());
+ }
return quirks;
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/LargeJpegImageQuirk.java b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/LargeJpegImageQuirk.java
new file mode 100644
index 0000000..e73a437
--- /dev/null
+++ b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/LargeJpegImageQuirk.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.camera.core.internal.compat.quirk;
+
+import android.os.Build;
+
+import androidx.annotation.RequiresApi;
+import androidx.camera.core.impl.Quirk;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * <p>QuirkSummary
+ * Bug Id: 288828159
+ * Description: Quirk required to check whether the captured JPEG image contains redundant
+ * 0's padding data. For example, Samsung A5 (2017) series devices have the
+ * problem and result in the output JPEG image to be extremely large (about 32 MB).
+ * Device(s): Samsung Galaxy A5 (2017) series
+ */
+@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
+public final class LargeJpegImageQuirk implements Quirk {
+
+ private static final Set<String> DEVICE_MODELS = new HashSet<>(Arrays.asList(
+ // Samsung Galaxy A5 series devices
+ "SM-A520F",
+ "SM-A520X",
+ "SM-A520W",
+ "SM-A520K",
+ "SM-A520L",
+ "SM-A520S"
+ ));
+
+ static boolean load() {
+ return DEVICE_MODELS.contains(Build.MODEL.toUpperCase(Locale.US));
+ }
+}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParser.java b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParser.java
new file mode 100644
index 0000000..4f3bdbb
--- /dev/null
+++ b/camera/camera-core/src/main/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParser.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.camera.core.internal.compat.workaround;
+
+import android.util.Range;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.camera.core.internal.compat.quirk.DeviceQuirks;
+import androidx.camera.core.internal.compat.quirk.LargeJpegImageQuirk;
+
+/**
+ * Workaround to check whether the captured JPEG image contains redundant 0's padding data.
+ *
+ * @see LargeJpegImageQuirk
+ */
+@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
+public class InvalidJpegDataParser {
+ private final boolean mHasQuirk = DeviceQuirks.get(LargeJpegImageQuirk.class) != null;
+
+ /**
+ * Retrieves the invalid data position range from the input JPEG byte data array.
+ *
+ * @return the invalid data position range of the JPEG byte data, or {@code null} when
+ * invalid data position range can't be found.
+ */
+ @Nullable
+ public Range<Integer> getInvalidDataRange(@NonNull byte[] bytes) {
+ if (!mHasQuirk) {
+ return null;
+ }
+
+ // Parses the JFIF segments from the start of the JPEG image data
+ int markPosition = 0x2;
+ while (true) {
+ // Breaks the while-loop and return null if the mark byte can't be correctly found.
+ if (markPosition + 4 > bytes.length || bytes[markPosition] != ((byte) 0xff)) {
+ return null;
+ }
+
+ int segmentLength =
+ ((bytes[markPosition + 2] & 0xff) << 8) | (bytes[markPosition + 3] & 0xff);
+
+ // Breaks the while-loop when finding the SOS (FF DA) mark
+ if (bytes[markPosition] == ((byte) 0xff) && bytes[markPosition + 1] == ((byte) 0xda)) {
+ break;
+ }
+ markPosition += segmentLength + 2;
+ }
+
+ // Finds the EOI (FF D9) mark to know the end position of the valid compressed image data
+ int eoiPosition = markPosition + 2;
+
+ while (true) {
+ // Breaks the while-loop and return null if EOI mark can't be found
+ if (eoiPosition + 2 > bytes.length) {
+ return null;
+ }
+
+ if (bytes[eoiPosition] == ((byte) 0xff) && bytes[eoiPosition + 1] == ((byte) 0xd9)) {
+ break;
+ }
+ eoiPosition++;
+ }
+
+ // The captured images might have non-zero data after the EOI byte. Those valid data should
+ // be kept. Searches the final valid byte from the end side can save the processing time.
+ int finalValidBytePosition = bytes.length - 1;
+
+ while (true) {
+ // Breaks the while-loop and return null if finalValidBytePosition has reach the EOI
+ // mark position.
+ if (finalValidBytePosition <= eoiPosition) {
+ return null;
+ }
+
+ if (bytes[finalValidBytePosition] == ((byte) 0xff)) {
+ break;
+ }
+ finalValidBytePosition--;
+ }
+
+ if (finalValidBytePosition - 1 > eoiPosition + 2) {
+ return Range.create(eoiPosition + 2, finalValidBytePosition - 1);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/CameraSelectorTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/CameraSelectorTest.kt
index 621932c..c7710f5 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/CameraSelectorTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/CameraSelectorTest.kt
@@ -187,4 +187,4 @@
val filteredCameraInfos = backCameraSelector.filter(cameraInfos)
assertThat(filteredCameraInfos).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/UseCaseGroupTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/UseCaseGroupTest.kt
index 7250e35..39dbbb6 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/UseCaseGroupTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/UseCaseGroupTest.kt
@@ -105,4 +105,4 @@
}
return message
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/CaptureNodeTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/CaptureNodeTest.kt
index ffcd64c..fa2fc24 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/CaptureNodeTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/CaptureNodeTest.kt
@@ -168,4 +168,4 @@
captureNode.onRequestAvailable(requestA)
captureNode.onRequestAvailable(requestB)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeRetryControl.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeRetryControl.kt
index e58d031..e638fee0 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeRetryControl.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeRetryControl.kt
@@ -28,4 +28,4 @@
override fun retryRequest(takePictureRequest: TakePictureRequest) {
retriedRequest = takePictureRequest
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
index 6f17fe5..6baa103 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/FakeTakePictureCallback.kt
@@ -55,4 +55,4 @@
override fun isAborted(): Boolean {
return aborted
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/Image2JpegBytesTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/Image2JpegBytesTest.kt
index 8ae0894..c305c68 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/Image2JpegBytesTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/Image2JpegBytesTest.kt
@@ -79,4 +79,4 @@
assertThat(output.sensorToBufferTransform).isEqualTo(SENSOR_TO_BUFFER)
assertThat(output.cameraCaptureResult).isEqualTo(CAMERA_CAPTURE_RESULT)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ImagePipelineTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ImagePipelineTest.kt
index eb21888..52b780a 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ImagePipelineTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ImagePipelineTest.kt
@@ -399,4 +399,4 @@
// Assert: The failure is propagated.
assertThat(CALLBACK.captureFailure).isEqualTo(FAILURE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2CroppedBitmapTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2CroppedBitmapTest.kt
index cccbff0..e4ef33b 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2CroppedBitmapTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2CroppedBitmapTest.kt
@@ -84,4 +84,4 @@
output.sensorToBufferTransform.mapPoints(points)
assertThat(points).usingTolerance(1E-4).containsExactly(0, 240)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2DiskTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2DiskTest.kt
index 8750c0b..ccf4c18 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2DiskTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegBytes2DiskTest.kt
@@ -140,4 +140,4 @@
val input = JpegBytes2Disk.In.of(inputPacket, options)
return operation.apply(input).savedUri!!.path!!
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegImage2ResultTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegImage2ResultTest.kt
index 5822469..9c05b11 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegImage2ResultTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/JpegImage2ResultTest.kt
@@ -76,4 +76,4 @@
assertThat(output.imageInfo.rotationDegrees).isEqualTo(ROTATION_DEGREES)
assertThat(output.imageInfo.sensorToBufferTransformMatrix).isEqualTo(SENSOR_TO_BUFFER)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ProcessingInput2PacketTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ProcessingInput2PacketTest.kt
index 4d024c5..7f920f1 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ProcessingInput2PacketTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/ProcessingInput2PacketTest.kt
@@ -158,4 +158,4 @@
assertThat(output.size).isEqualTo(Size(WIDTH, HEIGHT))
assertThat(output.sensorToBufferTransform).isEqualTo(SENSOR_TO_BUFFER)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/RequestWithCallbackTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/RequestWithCallbackTest.kt
index 425cdef..581ead6 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/RequestWithCallbackTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/RequestWithCallbackTest.kt
@@ -202,4 +202,4 @@
assertThat(request.imageReceived).isNull()
assertThat(captureRequestFuture.isCancelled).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/SingleBundlingNodeTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/SingleBundlingNodeTest.kt
index a99697e..71d08ad 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/SingleBundlingNodeTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/imagecapture/SingleBundlingNodeTest.kt
@@ -89,4 +89,4 @@
assertThat(packetB.imageProxy).isEqualTo(imageB1)
assertThat(packetB.processingRequest).isEqualTo(requestB)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/AttachedSurfaceInfoTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/AttachedSurfaceInfoTest.kt
index 8a3d600..30a9e35 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/AttachedSurfaceInfoTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/AttachedSurfaceInfoTest.kt
@@ -127,4 +127,4 @@
)
Truth.assertThat(attachedSurfaceInfo2.targetFrameRate).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInfoInternalTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInfoInternalTest.kt
index 7c083c9..8ae50cc 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInfoInternalTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInfoInternalTest.kt
@@ -52,4 +52,4 @@
private fun createCamerasWithIds(ids: Array<Int>): List<CameraInternal> {
return ids.map { FakeCamera(it.toString()) }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInternalTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInternalTest.kt
index 5299376..80102f8 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInternalTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/CameraInternalTest.kt
@@ -46,4 +46,4 @@
val camera = FakeCamera(null, FakeCameraInfoInternal(0, CameraSelector.LENS_FACING_BACK))
assertThat(camera.isFrontFacing).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/ConfigTest.java b/camera/camera-core/src/test/java/androidx/camera/core/impl/ConfigTest.java
index 7967b76..3943a57 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/ConfigTest.java
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/ConfigTest.java
@@ -19,11 +19,18 @@
import static androidx.camera.core.impl.Config.OptionPriority.ALWAYS_OVERRIDE;
import static androidx.camera.core.impl.Config.OptionPriority.OPTIONAL;
import static androidx.camera.core.impl.Config.OptionPriority.REQUIRED;
+import static androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR;
import static com.google.common.truth.Truth.assertThat;
import android.os.Build;
+import androidx.camera.core.resolutionselector.AspectRatioStrategy;
+import androidx.camera.core.resolutionselector.ResolutionFilter;
+import androidx.camera.core.resolutionselector.ResolutionSelector;
+import androidx.camera.core.resolutionselector.ResolutionStrategy;
+import androidx.camera.testing.fakes.FakeUseCaseConfig;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -126,4 +133,32 @@
assertThat(Config.hasConflict(ALWAYS_OVERRIDE, REQUIRED)).isFalse();
}
+ @Test
+ public void overrideResolutionSelectorCorrectly() {
+ MutableOptionsBundle mergedConfig = MutableOptionsBundle.create();
+ MutableConfig baseConfig = new FakeUseCaseConfig.Builder().getMutableConfig();
+ baseConfig.insertOption(OPTION_RESOLUTION_SELECTOR,
+ new ResolutionSelector.Builder().setAspectRatioStrategy(
+ AspectRatioStrategy.RATIO_4_3_FALLBACK_AUTO_STRATEGY)
+ .setResolutionStrategy(
+ ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY).build());
+ MutableConfig extendedConfig = new FakeUseCaseConfig.Builder().getMutableConfig();
+ ResolutionFilter resolutionFilter = (supportedSizes, rotationDegrees) -> null;
+ extendedConfig.insertOption(OPTION_RESOLUTION_SELECTOR,
+ new ResolutionSelector.Builder().setAspectRatioStrategy(
+ AspectRatioStrategy.RATIO_16_9_FALLBACK_AUTO_STRATEGY)
+ .setResolutionFilter(resolutionFilter).build());
+ Config.mergeOptionValue(mergedConfig, baseConfig, extendedConfig,
+ OPTION_RESOLUTION_SELECTOR);
+
+ ResolutionSelector mergedResolutionSelector =
+ mergedConfig.retrieveOption(OPTION_RESOLUTION_SELECTOR);
+
+ assertThat(mergedResolutionSelector.getAspectRatioStrategy()).isEqualTo(
+ AspectRatioStrategy.RATIO_16_9_FALLBACK_AUTO_STRATEGY);
+ assertThat(mergedResolutionSelector.getResolutionStrategy()).isEqualTo(
+ ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY);
+ assertThat(mergedResolutionSelector.getResolutionFilter()).isEqualTo(resolutionFilter);
+ }
+
}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/EncoderProfilesResolutionValidatorTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/EncoderProfilesResolutionValidatorTest.kt
index 57b9338..3aa6c83 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/EncoderProfilesResolutionValidatorTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/EncoderProfilesResolutionValidatorTest.kt
@@ -73,4 +73,4 @@
return supportedResolutions.toMutableList()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/StreamSpecTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/StreamSpecTest.kt
index b7b122c..ea839c49 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/StreamSpecTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/StreamSpecTest.kt
@@ -99,4 +99,4 @@
private val TEST_IMPLEMENTATION_OPTION =
FakeUseCaseConfig.Builder(CaptureType.PREVIEW, TEST_INPUT_FORMAT).useCaseConfig.config
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/UseCaseConfigTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/UseCaseConfigTest.kt
index 778fbfc..89c1cad 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/UseCaseConfigTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/UseCaseConfigTest.kt
@@ -45,4 +45,4 @@
useCaseBuilder.mutableConfig.insertOption(UseCaseConfig.OPTION_ZSL_DISABLED, true)
Truth.assertThat(useCaseBuilder.useCaseConfig.isZslDisabled(false)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/AspectRatioUtilTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/AspectRatioUtilTest.kt
index 7b527fa..7d3fe1a 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/AspectRatioUtilTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/AspectRatioUtilTest.kt
@@ -174,4 +174,4 @@
assertThat(aspectRatios == expectedResult).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/ExifDataTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/ExifDataTest.kt
index 01bd6ee..98c1bda 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/ExifDataTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/impl/utils/ExifDataTest.kt
@@ -169,4 +169,4 @@
assertThat(exifDataDefault.getAttribute(ExifInterface.TAG_MODEL))
.isEqualTo(Build.MODEL)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/internal/SupportedOutputSizesSorterTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/internal/SupportedOutputSizesSorterTest.kt
index 3cb7587..e79c482 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/internal/SupportedOutputSizesSorterTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/internal/SupportedOutputSizesSorterTest.kt
@@ -540,6 +540,28 @@
supportedOutputSizesSorter.getSortedSupportedOutputSizes(useCaseConfig)
}
+ @Test
+ fun canKeepFhdResolution_whenMaxResolutionHasShorterEdgeButLargerArea() {
+ verifySupportedOutputSizesWithResolutionSelectorSettings(
+ maxResolution = Size(2244, 1008),
+ expectedList = listOf(
+ // Matched default preferred AspectRatio items, sorted by area size.
+ Size(1280, 960),
+ Size(640, 480),
+ Size(320, 240),
+ // Mismatched default preferred AspectRatio items, sorted by FOV and area size.
+ Size(960, 960), // 1:1
+ Size(1920, 1080), // 16:9, this can be kept even the max resolution
+ // setting has a shorter edge of 1008
+ Size(1280, 720),
+ Size(960, 544),
+ Size(800, 450),
+ Size(320, 180),
+ Size(256, 144),
+ )
+ )
+ }
+
private fun verifySupportedOutputSizesWithResolutionSelectorSettings(
outputSizesSorter: SupportedOutputSizesSorter = supportedOutputSizesSorter,
captureType: CaptureType = CaptureType.IMAGE_CAPTURE,
@@ -551,6 +573,7 @@
resolutionFilter: ResolutionFilter? = null,
allowedResolutionMode: Int = ResolutionSelector.PREFER_CAPTURE_RATE_OVER_HIGHER_RESOLUTION,
highResolutionForceDisabled: Boolean = false,
+ maxResolution: Size? = null,
expectedList: List<Size> = Collections.emptyList(),
) {
val useCaseConfig = createUseCaseConfig(
@@ -562,7 +585,8 @@
resolutionFallbackRule,
resolutionFilter,
allowedResolutionMode,
- highResolutionForceDisabled
+ highResolutionForceDisabled,
+ maxResolution,
)
val resultList = outputSizesSorter.getSortedSupportedOutputSizes(useCaseConfig)
assertThat(resultList).containsExactlyElementsIn(expectedList).inOrder()
@@ -578,6 +602,7 @@
resolutionFilter: ResolutionFilter? = null,
allowedResolutionMode: Int = ResolutionSelector.PREFER_CAPTURE_RATE_OVER_HIGHER_RESOLUTION,
highResolutionForceDisabled: Boolean = false,
+ maxResolution: Size? = null,
): UseCaseConfig<*> {
val useCaseConfigBuilder = FakeUseCaseConfig.Builder(captureType, ImageFormat.JPEG)
val resolutionSelectorBuilder = ResolutionSelector.Builder()
@@ -616,6 +641,9 @@
// Sets the high resolution force disabled setting
useCaseConfigBuilder.setHighResolutionDisabled(highResolutionForceDisabled)
+ // Sets the max resolution setting
+ maxResolution?.let { useCaseConfigBuilder.setMaxResolution(it) }
+
return useCaseConfigBuilder.useCaseConfig
}
}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/CaptureFailedRetryEnablerTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/CaptureFailedRetryEnablerTest.kt
index 74b8ffe..26c01c1 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/CaptureFailedRetryEnablerTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/CaptureFailedRetryEnablerTest.kt
@@ -64,4 +64,4 @@
fun shouldRetry() {
assertThat(CaptureFailedRetryEnabler().retryCount).isEqualTo(expectedResult)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParserTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParserTest.kt
new file mode 100644
index 0000000..3623de8
--- /dev/null
+++ b/camera/camera-core/src/test/java/androidx/camera/core/internal/compat/workaround/InvalidJpegDataParserTest.kt
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.camera.core.internal.compat.workaround
+
+import android.os.Build
+import android.util.Range
+import com.google.common.truth.Truth.assertThat
+import java.util.Objects
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.ParameterizedRobolectricTestRunner
+import org.robolectric.annotation.Config
+import org.robolectric.annotation.internal.DoNotInstrument
+import org.robolectric.util.ReflectionHelpers
+
+// Correct Jpeg byte array 1 that has additional segment data in the end of the file
+private val correctJpegByteArray1 = listOf(
+ 0xff, 0xd8, 0xff, 0xe1, 0x00, 0x06, 0x55, 0x55, 0x55, 0x55, 0xff, 0xda, 0x99, 0x99, 0x99, 0x99,
+ 0xff, 0xd9, 0xff, 0x00, 0x00, 0xe5, 0x92, 0x00, 0x00, 0xe6, 0x01, 0x00
+).map { it.toByte() }.toByteArray()
+
+// Correct Jpeg byte array 2 that doesn't have additional segment data in the end of the file
+private val correctJpegByteArray2 = listOf(
+ 0xff, 0xd8, 0xff, 0xe1, 0x00, 0x06, 0x55, 0x55, 0x55, 0x55, 0xff, 0xda, 0x99, 0x99, 0x99, 0x99,
+ 0xff, 0xd9
+).map { it.toByte() }.toByteArray()
+
+// Invalid data starts from position 18 to position 31.
+private val problematicJpegByteArray = listOf(
+ 0xff, 0xd8, 0xff, 0xe1, 0x00, 0x06, 0x55, 0x55, 0x55, 0x55, 0xff, 0xda, 0x99, 0x99, 0x99, 0x99,
+ 0xff, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0xe5, 0x92, 0x00, 0x00, 0xe6, 0x01, 0x00
+).map { it.toByte() }.toByteArray()
+
+// Invalid very short data
+private val invalidVeryShortData = listOf(
+ 0xff, 0xd8
+).map { it.toByte() }.toByteArray()
+
+// Invalid data without SOS byte
+private val invalidNoSosData = listOf(
+ 0xff, 0xd8, 0xff, 0xe1, 0x00, 0x06, 0x55, 0x55, 0x55, 0x55, 0xff, 0x00, 0x99, 0x99, 0x99, 0x99,
+ 0xff, 0xd9, 0xff, 0x00, 0x00, 0xe5, 0x92, 0x00, 0x00, 0xe6, 0x01, 0x00
+).map { it.toByte() }.toByteArray()
+
+// Invalid data without EOI byte
+private val invalidNoEoiData = listOf(
+ 0xff, 0xd8, 0xff, 0xe1, 0x00, 0x06, 0x55, 0x55, 0x55, 0x55, 0xff, 0xda, 0x99, 0x99, 0x99, 0x99,
+ 0xff, 0x00, 0xff, 0x00, 0x00, 0xe5, 0x92, 0x00, 0x00, 0xe6, 0x01, 0x00
+).map { it.toByte() }.toByteArray()
+
+@RunWith(ParameterizedRobolectricTestRunner::class)
+@DoNotInstrument
+@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
+class InvalidJpegDataParserTest(
+ private val model: String,
+ private val data: ByteArray,
+ private val range: Range<*>?,
+ ) {
+
+ companion object {
+ @JvmStatic
+ @ParameterizedRobolectricTestRunner.Parameters(name = "model={0}, data={1}, range={2}")
+ fun data() = mutableListOf<Array<Any?>>().apply {
+ add(arrayOf("SM-A520F", problematicJpegByteArray, Range.create(18, 31)))
+ add(arrayOf("SM-A520F", correctJpegByteArray1, null))
+ add(arrayOf("SM-A520F", correctJpegByteArray2, null))
+ add(arrayOf("SM-A520F", invalidVeryShortData, null))
+ add(arrayOf("SM-A520F", invalidNoSosData, null))
+ add(arrayOf("SM-A520F", invalidNoEoiData, null))
+ add(arrayOf("fake-model", problematicJpegByteArray, null))
+ add(arrayOf("fake-model", correctJpegByteArray1, null))
+ add(arrayOf("fake-model", correctJpegByteArray2, null))
+ }
+ }
+
+ @Test
+ fun canGetInvalidJpegDataRange() {
+ ReflectionHelpers.setStaticField(Build::class.java, "MODEL", model)
+ assertThat(
+ Objects.equals(
+ InvalidJpegDataParser().getInvalidDataRange(data),
+ range
+ )
+ ).isTrue()
+ }
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/DefaultSurfaceProcessorTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/DefaultSurfaceProcessorTest.kt
index 016de19..6813752 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/DefaultSurfaceProcessorTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/DefaultSurfaceProcessorTest.kt
@@ -53,4 +53,4 @@
assertThat(DefaultSurfaceProcessor.Factory.newInstance(DynamicRange.SDR))
.isSameInstanceAs(noOpProcessor)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/EdgeTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/EdgeTest.kt
index a2458aa..c67bde8 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/EdgeTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/EdgeTest.kt
@@ -54,4 +54,4 @@
fun acceptDataWithoutListener_throwsException() {
Edge<String>().accept(DATA)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/InternalImageProcessorTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/InternalImageProcessorTest.kt
index 8e80f42..cecbc94 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/InternalImageProcessorTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/InternalImageProcessorTest.kt
@@ -104,4 +104,4 @@
assertThat(outputImage).isEqualTo(imageFromEffect)
assertThat(calledThreadName).isEqualTo(THREAD_NAME)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/PacketTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/PacketTest.kt
index f785077..5f47228 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/PacketTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/PacketTest.kt
@@ -61,4 +61,4 @@
assertThat(bitmapPacket.size).isEqualTo(Size(100, 200))
assertThat(bitmapPacket.format).isEqualTo(ImageFormat.FLEX_RGBA_8888)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceEdgeTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceEdgeTest.kt
index ad6dbd7..cbf9c1e 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceEdgeTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceEdgeTest.kt
@@ -568,4 +568,4 @@
/*mirroring=*/false,
FakeCamera()
)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceOutputImplTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceOutputImplTest.kt
index 2603f35..c51251b3 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceOutputImplTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceOutputImplTest.kt
@@ -191,4 +191,4 @@
).apply {
surfaceOutputsToCleanup.add(this)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceProcessorWithExecutorTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceProcessorWithExecutorTest.kt
index 333d92d..39071bf 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceProcessorWithExecutorTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/SurfaceProcessorWithExecutorTest.kt
@@ -130,4 +130,4 @@
assertThat(onInputSurfaceInvokedThread).isEqualTo(executorThread)
assertThat(onOutputSurfaceInvokedThread).isEqualTo(executorThread)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/processing/TargetUtilsTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/processing/TargetUtilsTest.kt
index 624814b..6e1764a 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/processing/TargetUtilsTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/processing/TargetUtilsTest.kt
@@ -51,4 +51,4 @@
assertThat(getHumanReadableName(PREVIEW or VIDEO_CAPTURE or IMAGE_CAPTURE))
.isEqualTo("IMAGE_CAPTURE|PREVIEW|VIDEO_CAPTURE")
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/StreamSharingTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/StreamSharingTest.kt
index ed08929..9052ca6 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/StreamSharingTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/StreamSharingTest.kt
@@ -383,4 +383,4 @@
assertThat(config.captureTypes[0]).isEqualTo(CaptureType.PREVIEW)
assertThat(config.captureTypes[1]).isEqualTo(CaptureType.PREVIEW)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraCaptureResultTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraCaptureResultTest.kt
index ff0e72e..88fc8de 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraCaptureResultTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraCaptureResultTest.kt
@@ -78,4 +78,4 @@
assertThat(result.flashState).isEqualTo(baseCameraCaptureResult.flashState)
assertThat(result.afMode).isEqualTo(baseCameraCaptureResult.afMode)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraTest.kt
index 03c3d5c..590a4ab 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraTest.kt
@@ -330,4 +330,4 @@
assertThat(childrenEdges[child]!!.deferrableSurfaceForTesting.isClosed).isEqualTo(isClosed)
assertThat(childrenEdges[child]!!.hasProvider()).isEqualTo(hasProvider)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageAnalysisTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageAnalysisTest.kt
index 5ca9ee9..b8d0cd2 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageAnalysisTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageAnalysisTest.kt
@@ -272,4 +272,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageCaptureTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageCaptureTest.kt
index 91fefed..74c34a9 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageCaptureTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/ImageCaptureTest.kt
@@ -196,4 +196,4 @@
assertThat(imageCapture.currentConfig.isHigResolutionDisabled(false)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/PreviewTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/PreviewTest.kt
index 0896f12..bcc0a07 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/PreviewTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/PreviewTest.kt
@@ -213,4 +213,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/AdvancedSessionProcessorTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/AdvancedSessionProcessorTest.kt
index 0570e39..bd31f81 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/AdvancedSessionProcessorTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/AdvancedSessionProcessorTest.kt
@@ -116,6 +116,7 @@
@Before
fun setUp() = runBlocking {
+ ExtensionVersion.injectInstance(null)
cameraProvider = ProcessCameraProvider.getInstance(context)[10, TimeUnit.SECONDS]
withContext(Dispatchers.Main) {
fakeLifecycleOwner = FakeLifecycleOwner()
@@ -229,6 +230,9 @@
@Test
fun getRealtimeLatencyEstimate_advancedSessionProcessorInvokesSessionProcessorImpl() =
runBlocking {
+ assumeTrue(ExtensionVersion.isMinimumCompatibleVersion(Version.VERSION_1_4))
+ ClientVersion.setCurrentVersion(ClientVersion("1.4.0"))
+
val fakeSessionProcessImpl = object : SessionProcessorImpl by FakeSessionProcessImpl() {
override fun getRealtimeCaptureLatency(): Pair<Long, Long> = Pair(1000L, 10L)
}
@@ -692,4 +696,4 @@
override fun getTemplateId(): Int {
return templateId
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/compat/workaround/OnEnableDisableSessionDurationCheckTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/compat/workaround/OnEnableDisableSessionDurationCheckTest.kt
index d8a730b..abd3bda 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/compat/workaround/OnEnableDisableSessionDurationCheckTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/compat/workaround/OnEnableDisableSessionDurationCheckTest.kt
@@ -94,4 +94,4 @@
// 3. Assert
assertThat(elapsedTime).isLessThan(TOLERANCE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/BasicExtenderSessionProcessorTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/BasicExtenderSessionProcessorTest.kt
index b1b7d73..c494bd2 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/BasicExtenderSessionProcessorTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/BasicExtenderSessionProcessorTest.kt
@@ -68,6 +68,9 @@
import androidx.camera.extensions.impl.PreviewImageProcessorImpl
import androidx.camera.extensions.impl.ProcessResultImpl
import androidx.camera.extensions.impl.RequestUpdateProcessorImpl
+import androidx.camera.extensions.internal.ClientVersion
+import androidx.camera.extensions.internal.ExtensionVersion
+import androidx.camera.extensions.internal.Version
import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.testing.CameraUtil
import androidx.camera.testing.SurfaceTextureProvider
@@ -141,6 +144,7 @@
@Before
fun setUp() = runBlocking {
+ ExtensionVersion.injectInstance(null)
cameraProvider = ProcessCameraProvider.getInstance(context)[10, TimeUnit.SECONDS]
withContext(Dispatchers.Main) {
fakeLifecycleOwner = FakeLifecycleOwner()
@@ -340,6 +344,8 @@
@Test
fun getRealtimeCaptureLatencyEstimate_invokesCaptureExtenderImpl(): Unit = runBlocking {
assumeTrue(hasCaptureProcessor)
+ assumeTrue(ExtensionVersion.isMinimumCompatibleVersion(Version.VERSION_1_4))
+ ClientVersion.setCurrentVersion(ClientVersion("1.4.0"))
fakeCaptureExtenderImpl = object : FakeImageCaptureExtenderImpl(hasCaptureProcessor) {
override fun getRealtimeCaptureLatency(): Pair<Long, Long> = Pair(1000L, 10L)
}
@@ -1026,4 +1032,4 @@
override fun stopRepeating() {
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/StillCaptureProcessorTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/StillCaptureProcessorTest.kt
index 8e2a3c9..70e269c 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/StillCaptureProcessorTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/StillCaptureProcessorTest.kt
@@ -447,4 +447,4 @@
imageWriter?.close()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/YuvToJpegConverterTest.kt b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/YuvToJpegConverterTest.kt
index b459806..f4e3e4e 100644
--- a/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/YuvToJpegConverterTest.kt
+++ b/camera/camera-extensions/src/androidTest/java/androidx/camera/extensions/internal/sessionprocessor/YuvToJpegConverterTest.kt
@@ -118,4 +118,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMaximumCompatibleTest.kt b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMaximumCompatibleTest.kt
index 74a649e3..519c6f0 100644
--- a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMaximumCompatibleTest.kt
+++ b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMaximumCompatibleTest.kt
@@ -77,4 +77,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMinimumCompatibleTest.kt b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMinimumCompatibleTest.kt
index b39e854..c2c3e89 100644
--- a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMinimumCompatibleTest.kt
+++ b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/ExtensionVersionMinimumCompatibleTest.kt
@@ -76,4 +76,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/SupportedCameraOperationsTest.kt b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/SupportedCameraOperationsTest.kt
index 3b6be71..ce25a89 100644
--- a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/SupportedCameraOperationsTest.kt
+++ b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/SupportedCameraOperationsTest.kt
@@ -452,4 +452,4 @@
throw UnsupportedOperationException("Not supported")
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/compat/workaround/AvailableKeysRetrieverTest.kt b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/compat/workaround/AvailableKeysRetrieverTest.kt
index 816aaf4..7b527b8 100644
--- a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/compat/workaround/AvailableKeysRetrieverTest.kt
+++ b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/compat/workaround/AvailableKeysRetrieverTest.kt
@@ -134,4 +134,4 @@
override fun onDisableSession(): CaptureStageImpl? = null
override fun onSessionType(): Int = SessionConfiguration.SESSION_REGULAR
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/sessionprocessor/Camera2SessionConfigBuilderTest.kt b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/sessionprocessor/Camera2SessionConfigBuilderTest.kt
index 4b878b1..9ed654b2 100644
--- a/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/sessionprocessor/Camera2SessionConfigBuilderTest.kt
+++ b/camera/camera-extensions/src/test/java/androidx/camera/extensions/internal/sessionprocessor/Camera2SessionConfigBuilderTest.kt
@@ -82,4 +82,4 @@
assertThat(sessionConfig.sessionParameters[CaptureRequest.CONTROL_AF_MODE])
.isEqualTo(CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_VIDEO)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-lifecycle/src/androidTest/java/androidx/camera/lifecycle/TestMetaDataConfigProvider.kt b/camera/camera-lifecycle/src/androidTest/java/androidx/camera/lifecycle/TestMetaDataConfigProvider.kt
index 9d1e243..b0a57df 100644
--- a/camera/camera-lifecycle/src/androidTest/java/androidx/camera/lifecycle/TestMetaDataConfigProvider.kt
+++ b/camera/camera-lifecycle/src/androidTest/java/androidx/camera/lifecycle/TestMetaDataConfigProvider.kt
@@ -36,4 +36,4 @@
count += 1
return FakeAppConfig.create()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeDetector.kt b/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeDetector.kt
index b7a38c1..ce6bb42 100644
--- a/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeDetector.kt
+++ b/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeDetector.kt
@@ -69,4 +69,4 @@
override fun process(p0: ByteBuffer, p1: Int, p2: Int, p3: Int, p4: Int): Task<String> {
TODO("Not yet implemented")
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeTask.kt b/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeTask.kt
index 2eda9cf..39f031e 100644
--- a/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeTask.kt
+++ b/camera/camera-mlkit-vision/src/test/java/androidx/camera/mlkit/vision/FakeTask.kt
@@ -103,4 +103,4 @@
): Task<T> {
TODO("Not yet implemented")
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/androidTest/java/androidx/camera/testing/TestImageUtilDeviceTest.kt b/camera/camera-testing/src/androidTest/java/androidx/camera/testing/TestImageUtilDeviceTest.kt
index 7b69b03..02428ec 100644
--- a/camera/camera-testing/src/androidTest/java/androidx/camera/testing/TestImageUtilDeviceTest.kt
+++ b/camera/camera-testing/src/androidTest/java/androidx/camera/testing/TestImageUtilDeviceTest.kt
@@ -70,4 +70,4 @@
)
assertThat(diff).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/Camera2Util.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/Camera2Util.kt
index cbee160..a861e3a 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/Camera2Util.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/Camera2Util.kt
@@ -164,4 +164,4 @@
Handler(Looper.getMainLooper())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/CameraPipeConfigTestRule.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/CameraPipeConfigTestRule.kt
index 05be1ee..9b02ac3 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/CameraPipeConfigTestRule.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/CameraPipeConfigTestRule.kt
@@ -121,4 +121,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/EncoderProfilesUtil.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/EncoderProfilesUtil.kt
index c344c6c..28fbc51 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/EncoderProfilesUtil.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/EncoderProfilesUtil.kt
@@ -210,4 +210,4 @@
DEFAULT_AUDIO_PROFILE
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/IdlingResourceUtil.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/IdlingResourceUtil.kt
index f44e640..64b05f4 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/IdlingResourceUtil.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/IdlingResourceUtil.kt
@@ -26,4 +26,4 @@
Espresso.onIdle()
IdlingRegistry.getInstance().unregister(this)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreAudioProblematicDeviceRule.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreAudioProblematicDeviceRule.kt
index 1d1713e..0afb82c 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreAudioProblematicDeviceRule.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreAudioProblematicDeviceRule.kt
@@ -46,4 +46,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreProblematicDeviceRule.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreProblematicDeviceRule.kt
index 99214e5..4a98b78 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreProblematicDeviceRule.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/IgnoreProblematicDeviceRule.kt
@@ -76,4 +76,4 @@
"Pixel2", ignoreCase = true
) && Build.VERSION.SDK_INT == Build.VERSION_CODES.O
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/ObservableExtensions.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/ObservableExtensions.kt
index 79b54b7..a5c2cc3 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/ObservableExtensions.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/ObservableExtensions.kt
@@ -48,4 +48,4 @@
addObserver(producerDispatcher.asExecutor(), observer)
awaitClose { removeObserver(observer) }
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/RequiresDevice.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/RequiresDevice.kt
index 116a7d3..5314e58 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/RequiresDevice.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/RequiresDevice.kt
@@ -35,4 +35,4 @@
@CustomFilter(filterClass = RequiresDeviceFilter::class)
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
-annotation class RequiresDevice
\ No newline at end of file
+annotation class RequiresDevice
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/StressTestRule.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/StressTestRule.kt
index 4e4568c..fbabbed 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/StressTestRule.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/StressTestRule.kt
@@ -41,4 +41,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/WakelockEmptyActivityRule.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/WakelockEmptyActivityRule.kt
index 036c35f..39512c4 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/WakelockEmptyActivityRule.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/WakelockEmptyActivityRule.kt
@@ -97,4 +97,4 @@
fun Activity.setTurnScreenOn() {
setTurnScreenOn(true)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/activity/EmptyActivity.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/activity/EmptyActivity.kt
index 01d6002..f131192 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/activity/EmptyActivity.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/activity/EmptyActivity.kt
@@ -21,4 +21,4 @@
/**
* An empty Activity.
*/
-class EmptyActivity : AppCompatActivity()
\ No newline at end of file
+class EmptyActivity : AppCompatActivity()
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCameraCaptureResult.java b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCameraCaptureResult.java
index a36925a..223a87f 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCameraCaptureResult.java
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCameraCaptureResult.java
@@ -140,35 +140,35 @@
return fakeCameraCaptureResult;
}
- /** Set the {@link CameraCaptureMetaData.AfMode} **/
+ /** Set the {@link CameraCaptureMetaData.AfMode} */
@NonNull
public Builder setAfMode(@Nullable CameraCaptureMetaData.AfMode mode) {
mAfMode = mode;
return this;
}
- /** Set the {@link CameraCaptureMetaData.AfState} **/
+ /** Set the {@link CameraCaptureMetaData.AfState} */
@NonNull
public Builder setAfState(@Nullable CameraCaptureMetaData.AfState state) {
mAfState = state;
return this;
}
- /** Set the {@link CameraCaptureMetaData.AeState} **/
+ /** Set the {@link CameraCaptureMetaData.AeState} */
@NonNull
public Builder setAeState(@Nullable CameraCaptureMetaData.AeState state) {
mAeState = state;
return this;
}
- /** Set the {@link CameraCaptureMetaData.AwbState} **/
+ /** Set the {@link CameraCaptureMetaData.AwbState} */
@NonNull
public Builder setAwbState(@Nullable CameraCaptureMetaData.AwbState state) {
mAwbState = state;
return this;
}
- /** Set the {@link CameraCaptureMetaData.FlashState} **/
+ /** Set the {@link CameraCaptureMetaData.FlashState} */
@NonNull
public Builder setFlashState(@Nullable CameraCaptureMetaData.FlashState state) {
mFlashState = state;
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeEncoderInfo.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeEncoderInfo.kt
index 99c0791..35e9431 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeEncoderInfo.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeEncoderInfo.kt
@@ -20,4 +20,4 @@
open class FakeEncoderInfo(var _name: String = "fake.encoder") : EncoderInfo {
override fun getName(): String = _name
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeVideoEncoderInfo.kt b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeVideoEncoderInfo.kt
index ac8b164..13e0492 100644
--- a/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeVideoEncoderInfo.kt
+++ b/camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeVideoEncoderInfo.kt
@@ -59,4 +59,4 @@
override fun getSupportedBitrateRange(): Range<Int> {
return supportedBitrateRange
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-testing/src/test/java/androidx/camera/testing/ExifUtilTest.kt b/camera/camera-testing/src/test/java/androidx/camera/testing/ExifUtilTest.kt
index fde19de..f0bf2d7 100644
--- a/camera/camera-testing/src/test/java/androidx/camera/testing/ExifUtilTest.kt
+++ b/camera/camera-testing/src/test/java/androidx/camera/testing/ExifUtilTest.kt
@@ -52,4 +52,4 @@
val exif = createFromInputStream(ByteArrayInputStream(jpegWithExif))
assertThat(exif.description).isEqualTo(DESCRIPTION)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioChecker.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioChecker.kt
index cf47384..ea7095a 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioChecker.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioChecker.kt
@@ -76,4 +76,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioSpecTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioSpecTest.kt
index 9ba2f4a..ae07924 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioSpecTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioSpecTest.kt
@@ -38,4 +38,4 @@
assertThat(audioSpec.channelCount).isEqualTo(AudioSpec.CHANNEL_COUNT_AUTO)
assertThat(audioSpec.sampleRate).isEqualTo(AudioSpec.SAMPLE_RATE_RANGE_AUTO)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioVideoSyncTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioVideoSyncTest.kt
index c200bfb..4f4f927 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioVideoSyncTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/AudioVideoSyncTest.kt
@@ -235,4 +235,4 @@
arrayOf(CameraPipeConfig::class.simpleName, CameraPipeConfig.defaultConfig())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/MediaSpecTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/MediaSpecTest.kt
index b4a979f..105da27 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/MediaSpecTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/MediaSpecTest.kt
@@ -65,4 +65,4 @@
assertThat(mediaSpec.audioSpec.channelCount).isEqualTo(AudioSpec.CHANNEL_COUNT_NONE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/OutputOptionsTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/OutputOptionsTest.kt
index 12ef8da..ec69e6e 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/OutputOptionsTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/OutputOptionsTest.kt
@@ -189,4 +189,4 @@
this.latitude = latitude
this.longitude = longitude
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderVideoCapabilitiesTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderVideoCapabilitiesTest.kt
index 969868a..9e55bd6 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderVideoCapabilitiesTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/RecorderVideoCapabilitiesTest.kt
@@ -111,4 +111,4 @@
return isNokia2Point1 || isMotoE5Play
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/SupportedQualitiesVerificationTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/SupportedQualitiesVerificationTest.kt
index 85fd4aa..50c98d0 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/SupportedQualitiesVerificationTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/SupportedQualitiesVerificationTest.kt
@@ -273,4 +273,4 @@
).start(
CameraXExecutors.directExecutor(), eventListener
)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoOutputTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoOutputTest.kt
index f7ffbfc..4f61051 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoOutputTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoOutputTest.kt
@@ -50,4 +50,4 @@
val mediaSpec = videoOutput.mediaSpec.asFlow().first()
assertThat(mediaSpec).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingFrameDropTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingFrameDropTest.kt
index 1b0eb61..d7a446f 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingFrameDropTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingFrameDropTest.kt
@@ -405,4 +405,4 @@
val recording = start(CameraXExecutors.directExecutor(), eventListener)
recording.use { it.apply { block(eventFlow) } }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingTest.kt
index 19ba003..6787df1 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoRecordingTest.kt
@@ -1404,4 +1404,4 @@
} else {
assumeTrue(msg, Camera2DeviceQuirks.get(Camera2ExtraCroppingQuirk::class.java) == null)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoSpecTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoSpecTest.kt
index b6edfbf..21b39de 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoSpecTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/VideoSpecTest.kt
@@ -38,4 +38,4 @@
assertThat(videoSpec.frameRate).isEqualTo(VideoSpec.FRAME_RATE_RANGE_AUTO)
assertThat(videoSpec.aspectRatio).isEqualTo(RATIO_DEFAULT)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
index d5500c4..0558c63 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
@@ -184,4 +184,4 @@
assertThat(backupVideoProfiles.last().hdrFormat).isEqualTo(HDR_HLG)
assertThat(backupVideoProfiles.last().bitDepth).isEqualTo(BIT_DEPTH_10)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/SharedByteBufferTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/SharedByteBufferTest.kt
index 58e7d60..a811e43 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/SharedByteBufferTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/SharedByteBufferTest.kt
@@ -336,4 +336,4 @@
}
private fun isModel(model: String) = model.equals(Build.MODEL, true)
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigAudioProfileResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigAudioProfileResolverTest.kt
index e1af002..69a6f18 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigAudioProfileResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigAudioProfileResolverTest.kt
@@ -255,4 +255,4 @@
).get().bitrate
).isEqualTo(lowerBitrate)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigDefaultResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigDefaultResolverTest.kt
index 2f3cc89..d3ae838 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigDefaultResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioEncoderConfigDefaultResolverTest.kt
@@ -154,4 +154,4 @@
).get().bitrate
).isEqualTo(lowerBitrate)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsAudioProfileResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsAudioProfileResolverTest.kt
index 553e0a2..0b75e53 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsAudioProfileResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsAudioProfileResolverTest.kt
@@ -260,4 +260,4 @@
assertThat(resolvedAudioSourceFormat).isNotEqualTo(AudioFormat.ENCODING_INVALID)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsDefaultResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsDefaultResolverTest.kt
index 02eae65..04cacdc 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsDefaultResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/AudioSettingsDefaultResolverTest.kt
@@ -74,4 +74,4 @@
assertThat(resolvedAudioSourceFormat).isNotEqualTo(AudioFormat.ENCODING_INVALID)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigDefaultResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigDefaultResolverTest.kt
index ea11ae8..ce85ee2 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigDefaultResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigDefaultResolverTest.kt
@@ -408,4 +408,4 @@
expectedDataSpace
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigVideoProfileResolverTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigVideoProfileResolverTest.kt
index 9a321d4..55d4322 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigVideoProfileResolverTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/config/VideoEncoderConfigVideoProfileResolverTest.kt
@@ -383,4 +383,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/workaround/EncoderFinderTest.kt b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/workaround/EncoderFinderTest.kt
index 16c14bb..a1098fd 100644
--- a/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/workaround/EncoderFinderTest.kt
+++ b/camera/camera-video/src/androidTest/java/androidx/camera/video/internal/workaround/EncoderFinderTest.kt
@@ -193,4 +193,4 @@
) ?: return false
return quirk.isUnSupportMediaCodecInfo(mediaFormat)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/main/java/androidx/camera/video/internal/audio/BufferedAudioStream.java b/camera/camera-video/src/main/java/androidx/camera/video/internal/audio/BufferedAudioStream.java
index 2c1c122..7c3d659 100644
--- a/camera/camera-video/src/main/java/androidx/camera/video/internal/audio/BufferedAudioStream.java
+++ b/camera/camera-video/src/main/java/androidx/camera/video/internal/audio/BufferedAudioStream.java
@@ -246,6 +246,7 @@
// Pop audio data when the queue size exceeds the limit.
while (mAudioDataQueue.size() > queueMaxSize) {
mAudioDataQueue.poll();
+ Logger.w(TAG, "Drop audio data due to full of queue.");
}
}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
index d260eae..8412d7b 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/BackupHdrProfileEncoderProfilesProviderTest.kt
@@ -100,4 +100,4 @@
it
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/DynamicRangeMatchedEncoderProfilesProviderTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/DynamicRangeMatchedEncoderProfilesProviderTest.kt
index d9f0af8..71da559 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/DynamicRangeMatchedEncoderProfilesProviderTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/DynamicRangeMatchedEncoderProfilesProviderTest.kt
@@ -210,4 +210,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/AudioSourceTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/AudioSourceTest.kt
index eeaf74b..ba7c67a 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/AudioSourceTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/AudioSourceTest.kt
@@ -16,6 +16,7 @@
package androidx.camera.video.internal.audio
+import android.annotation.SuppressLint
import android.media.AudioFormat
import android.media.MediaRecorder
import android.os.Build
@@ -33,7 +34,6 @@
import java.util.concurrent.Executor
import java.util.concurrent.TimeUnit.NANOSECONDS
import org.junit.After
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@@ -63,11 +63,11 @@
}
}
- @Ignore("b/289918974")
@Test
fun canStartAndStopAudioSource() {
// Arrange.
- val audioStream = createAudioStream()
+ val audioDataProvider = createAudioDataProvider(audioRecordingDelayMillis = 1)
+ val audioStream = createAudioStream(audioDataProvider = audioDataProvider)
val bufferProvider = createBufferProvider()
val audioSource = createAudioSource(
audioStreamFactory = { _, _ -> audioStream },
@@ -376,9 +376,18 @@
exceptionOnStartMaxTimes = exceptionOnStartMaxTimes
)
- private fun createAudioDataProvider(): (Int) -> FakeAudioStream.AudioData = { index ->
+ @SuppressLint("BanThreadSleep") // Needed to simulate the audio recording delays.
+ private fun createAudioDataProvider(
+ audioRecordingDelayMillis: Long = 0
+ ): (Int) -> FakeAudioStream.AudioData = { index ->
val byteBuffer = ByteBuffer.allocate(BYTE_BUFFER_CAPACITY).put(0, index.toByte())
val timestampNs = index.toLong()
+
+ // Simulate the audio recording delays.
+ if (audioRecordingDelayMillis > 0) {
+ Thread.sleep(audioRecordingDelayMillis)
+ }
+
FakeAudioStream.AudioData(byteBuffer, timestampNs)
}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/BufferedAudioStreamTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/BufferedAudioStreamTest.kt
index 8b8ce98..0b6bc89 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/BufferedAudioStreamTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/audio/BufferedAudioStreamTest.kt
@@ -214,4 +214,4 @@
val timestampNs = (index + SOURCE_TIMESTAMP_OFFSET)
FakeAudioStream.AudioData(byteBuffer, timestampNs)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/config/VideoConfigUtilTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/config/VideoConfigUtilTest.kt
index 1b7a609..c28ff98 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/config/VideoConfigUtilTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/config/VideoConfigUtilTest.kt
@@ -198,4 +198,4 @@
videoBitDepth = VideoProfileProxy.BIT_DEPTH_10
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/BufferCopiedEncodedDataTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/BufferCopiedEncodedDataTest.kt
index 7037076..ef55d94 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/BufferCopiedEncodedDataTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/BufferCopiedEncodedDataTest.kt
@@ -126,4 +126,4 @@
fun getIsKeyFrame_returnCorrectResult() {
assertThat(copiedEncodedData.isKeyFrame).isEqualTo(fakeEncodedData.isKeyFrame)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/FakeEncodedData.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/FakeEncodedData.kt
index f0fa204..4a5ae1a 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/FakeEncodedData.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/FakeEncodedData.kt
@@ -57,4 +57,4 @@
override fun getClosedFuture(): ListenableFuture<Void> {
return terminationFuture
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/VideoEncoderDataSpaceTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/VideoEncoderDataSpaceTest.kt
index a7ef9c0..f58429a 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/VideoEncoderDataSpaceTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/encoder/VideoEncoderDataSpaceTest.kt
@@ -46,4 +46,4 @@
assertThat(dataSpace.transfer).isEqualTo(TEST_TRANSFER_FN)
assertThat(dataSpace.range).isEqualTo(TEST_COLOR_RANGE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/internal/workaround/QualityValidatedEncoderProfilesProviderTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/internal/workaround/QualityValidatedEncoderProfilesProviderTest.kt
index ab489a2..f2082c9 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/internal/workaround/QualityValidatedEncoderProfilesProviderTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/internal/workaround/QualityValidatedEncoderProfilesProviderTest.kt
@@ -142,4 +142,4 @@
return canBeWorkaround
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/build.gradle b/camera/camera-view/build.gradle
index 15b4c24..a9453b6 100644
--- a/camera/camera-view/build.gradle
+++ b/camera/camera-view/build.gradle
@@ -29,14 +29,12 @@
api(project(":camera:camera-core"))
api(project(":camera:camera-video"))
implementation(project(":camera:camera-lifecycle"))
- implementation("androidx.annotation:annotation-experimental:1.1.0-rc01")
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
implementation(libs.guavaListenableFuture)
implementation("androidx.core:core:1.3.2")
implementation("androidx.concurrent:concurrent-futures:1.0.0")
implementation(libs.autoValueAnnotations)
implementation("androidx.appcompat:appcompat:1.1.0")
- // Added for annotation-experimental
- compileOnly(libs.kotlinStdlib)
annotationProcessor(libs.autoValue)
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/CameraControllerDeviceTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/CameraControllerDeviceTest.kt
index 429a03c..58e8452 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/CameraControllerDeviceTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/CameraControllerDeviceTest.kt
@@ -379,4 +379,4 @@
})
assertThat(countDownLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewBitmapTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewBitmapTest.kt
index c4bfa90..b8f61b6 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewBitmapTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewBitmapTest.kt
@@ -378,4 +378,4 @@
arrayOf(CameraPipeConfig::class.simpleName, CameraPipeConfig.defaultConfig())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewDeviceTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewDeviceTest.kt
index f1c1e02..11e39e6 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewDeviceTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewDeviceTest.kt
@@ -1121,4 +1121,4 @@
arrayOf(CameraPipeConfig::class.simpleName, CameraPipeConfig.defaultConfig())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewMeteringPointFactoryDeviceTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewMeteringPointFactoryDeviceTest.kt
index ae5acc6..4e31333 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewMeteringPointFactoryDeviceTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewMeteringPointFactoryDeviceTest.kt
@@ -227,4 +227,4 @@
assertThat(meteringPoint.x).isWithin(FLOAT_ERROR).of(expectedMeteringPoint.x)
assertThat(meteringPoint.y).isWithin(FLOAT_ERROR).of(expectedMeteringPoint.y)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt
index 4dac7b4..f4bff40 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt
@@ -238,4 +238,4 @@
const val TIMEOUT_SECONDS = 10L
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
index f5fdfb6..8792e9b 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
@@ -175,4 +175,4 @@
surfaceRequest.deferrableSurface.surface.get(1000, TimeUnit.MILLISECONDS)
surfaceRequest.deferrableSurface.close()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.kt
index 25e1814..503e520 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.kt
@@ -303,4 +303,4 @@
private const val ANY_HEIGHT = 1200
private val ANY_SIZE: Size by lazy { Size(ANY_WIDTH, ANY_HEIGHT) }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/VideoCaptureDeviceTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/VideoCaptureDeviceTest.kt
index fc7bc7d..f7731e9 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/VideoCaptureDeviceTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/VideoCaptureDeviceTest.kt
@@ -681,4 +681,4 @@
Build.MODEL.contains("Cuttlefish") && Build.VERSION.SDK_INT == 30
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/androidTest/java/androidx/camera/view/transform/FileTransformFactoryDeviceTest.kt b/camera/camera-view/src/androidTest/java/androidx/camera/view/transform/FileTransformFactoryDeviceTest.kt
index aee04dc..06ac1ee 100644
--- a/camera/camera-view/src/androidTest/java/androidx/camera/view/transform/FileTransformFactoryDeviceTest.kt
+++ b/camera/camera-view/src/androidTest/java/androidx/camera/view/transform/FileTransformFactoryDeviceTest.kt
@@ -147,4 +147,4 @@
private fun createBitmap(): Bitmap {
return Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/test/java/androidx/camera/view/PendingValueTest.kt b/camera/camera-view/src/test/java/androidx/camera/view/PendingValueTest.kt
index 06d7972..91263d6 100644
--- a/camera/camera-view/src/test/java/androidx/camera/view/PendingValueTest.kt
+++ b/camera/camera-view/src/test/java/androidx/camera/view/PendingValueTest.kt
@@ -53,4 +53,4 @@
assertThat(future2.isCancelled).isFalse()
assertThat(future2.isDone).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/test/java/androidx/camera/view/RotationProviderTest.kt b/camera/camera-view/src/test/java/androidx/camera/view/RotationProviderTest.kt
index 24030e3..b6b7533 100644
--- a/camera/camera-view/src/test/java/androidx/camera/view/RotationProviderTest.kt
+++ b/camera/camera-view/src/test/java/androidx/camera/view/RotationProviderTest.kt
@@ -107,4 +107,4 @@
assertThat(RotationProvider.orientationToSurfaceRotation(270))
.isEqualTo(Surface.ROTATION_90)
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/test/java/androidx/camera/view/internal/compat/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt b/camera/camera-view/src/test/java/androidx/camera/view/internal/compat/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
index e0f3019..f690b13 100644
--- a/camera/camera-view/src/test/java/androidx/camera/view/internal/compat/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
+++ b/camera/camera-view/src/test/java/androidx/camera/view/internal/compat/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
@@ -47,4 +47,4 @@
// Assert.
assertThat(quirk).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/test/java/androidx/camera/view/transform/CoordinateTransformTest.kt b/camera/camera-view/src/test/java/androidx/camera/view/transform/CoordinateTransformTest.kt
index 31153d8..b3a1aec 100644
--- a/camera/camera-view/src/test/java/androidx/camera/view/transform/CoordinateTransformTest.kt
+++ b/camera/camera-view/src/test/java/androidx/camera/view/transform/CoordinateTransformTest.kt
@@ -193,4 +193,4 @@
coordinateTransform.mapPoints(point)
assertThat(point).isEqualTo(floatArrayOf(8f, 6f))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-view/src/test/java/androidx/camera/view/transform/ImageProxyTransformFactoryTest.kt b/camera/camera-view/src/test/java/androidx/camera/view/transform/ImageProxyTransformFactoryTest.kt
index 19747bc..7f7c5c8 100644
--- a/camera/camera-view/src/test/java/androidx/camera/view/transform/ImageProxyTransformFactoryTest.kt
+++ b/camera/camera-view/src/test/java/androidx/camera/view/transform/ImageProxyTransformFactoryTest.kt
@@ -109,4 +109,4 @@
transform.matrix.mapPoints(point)
assertThat(point).isEqualTo(floatArrayOf(6f, 4f))
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-viewfinder/build.gradle b/camera/camera-viewfinder/build.gradle
index 6a75556..246aaa2 100644
--- a/camera/camera-viewfinder/build.gradle
+++ b/camera/camera-viewfinder/build.gradle
@@ -25,7 +25,7 @@
dependencies {
api("androidx.annotation:annotation:1.2.0")
- implementation("androidx.annotation:annotation-experimental:1.1.0-rc01")
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
implementation(libs.guavaListenableFuture)
implementation("androidx.core:core:1.7.0")
implementation("androidx.concurrent:concurrent-futures:1.1.0")
@@ -36,9 +36,6 @@
implementation(libs.kotlinCoroutinesCore)
implementation(libs.kotlinCoroutinesAndroid)
- // Added for annotation-experimental
- compileOnly(libs.kotlinStdlib)
-
annotationProcessor(libs.autoValue)
testImplementation(libs.testRunner)
diff --git a/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/SurfaceViewImplementationTest.kt b/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/SurfaceViewImplementationTest.kt
index 7e0012c..4074c5e 100644
--- a/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/SurfaceViewImplementationTest.kt
+++ b/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/SurfaceViewImplementationTest.kt
@@ -101,4 +101,4 @@
private fun setContentView(view: View) {
mActivityScenario.onActivity { activity -> activity.setContentView(view) }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/TextureViewImplementationTest.kt b/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/TextureViewImplementationTest.kt
index dbb8587..cf9b4aa 100644
--- a/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/TextureViewImplementationTest.kt
+++ b/camera/camera-viewfinder/src/androidTest/java/androidx/camera/viewfinder/TextureViewImplementationTest.kt
@@ -265,4 +265,4 @@
private const val ANY_HEIGHT = 1200
private val ANY_SIZE: Size by lazy { Size(ANY_WIDTH, ANY_HEIGHT) }
}
-}
\ No newline at end of file
+}
diff --git a/camera/camera-viewfinder/src/main/java/androidx/camera/viewfinder/ViewfinderSurfaceRequestExt.kt b/camera/camera-viewfinder/src/main/java/androidx/camera/viewfinder/ViewfinderSurfaceRequestExt.kt
index 4b8112e..8353647 100644
--- a/camera/camera-viewfinder/src/main/java/androidx/camera/viewfinder/ViewfinderSurfaceRequestExt.kt
+++ b/camera/camera-viewfinder/src/main/java/androidx/camera/viewfinder/ViewfinderSurfaceRequestExt.kt
@@ -43,4 +43,4 @@
setImplementationMode(ImplementationMode.COMPATIBLE)
}
return this
-}
\ No newline at end of file
+}
diff --git a/camera/camera-viewfinder/src/test/java/androidx/camera/viewfinder/internal/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt b/camera/camera-viewfinder/src/test/java/androidx/camera/viewfinder/internal/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
index 6a9499a..744b22d 100644
--- a/camera/camera-viewfinder/src/test/java/androidx/camera/viewfinder/internal/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
+++ b/camera/camera-viewfinder/src/test/java/androidx/camera/viewfinder/internal/quirk/SurfaceViewNotCroppedByParentQuirkTest.kt
@@ -47,4 +47,4 @@
// Assert.
assertThat(quirk).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/SignalGeneratorViewModelTest.kt b/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/SignalGeneratorViewModelTest.kt
index 870c376..ce07922 100644
--- a/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/SignalGeneratorViewModelTest.kt
+++ b/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/SignalGeneratorViewModelTest.kt
@@ -195,4 +195,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/model/AudioGeneratorDeviceTest.kt b/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/model/AudioGeneratorDeviceTest.kt
index 75e45364..d7cc856 100644
--- a/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/model/AudioGeneratorDeviceTest.kt
+++ b/camera/integration-tests/avsynctestapp/src/androidTest/java/androidx/camera/integration/avsync/model/AudioGeneratorDeviceTest.kt
@@ -76,4 +76,4 @@
assertThat(audioGenerator.audioTrack!!.state).isEqualTo(AudioTrack.STATE_INITIALIZED)
assertThat(audioGenerator.audioTrack!!.playbackHeadPosition).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/MainActivity.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/MainActivity.kt
index 4d86552..0686a3f 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/MainActivity.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/MainActivity.kt
@@ -107,4 +107,4 @@
MaterialTheme {
SignalGeneratorScreen(beepFrequency, beepEnabled)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorScreen.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorScreen.kt
index a4daab7..eabc522b 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorScreen.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorScreen.kt
@@ -209,4 +209,4 @@
@Composable
private fun Preview_SignalGeneratorPage() {
MainContent()
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorViewModel.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorViewModel.kt
index 9931e68..4e56a8d 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorViewModel.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/SignalGeneratorViewModel.kt
@@ -191,4 +191,4 @@
private fun stopBeepSound() {
audioGenerator.stop()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/AudioGenerator.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/AudioGenerator.kt
index 76a8be0..edbee1a 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/AudioGenerator.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/AudioGenerator.kt
@@ -188,4 +188,4 @@
return res
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/CameraHelper.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/CameraHelper.kt
index 161095e..d0ddf6f 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/CameraHelper.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/model/CameraHelper.kt
@@ -162,4 +162,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/theme/Color.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/theme/Color.kt
index b3ca452..db8b314 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/theme/Color.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/theme/Color.kt
@@ -19,4 +19,4 @@
import androidx.compose.ui.graphics.Color
val LightOn = Color.White
-val LightOff = Color.Black
\ No newline at end of file
+val LightOff = Color.Black
diff --git a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
index 0189901..fb57929 100644
--- a/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
+++ b/camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
@@ -68,4 +68,4 @@
@Composable
override fun rippleAlpha(): RippleAlpha = RippleAlpha(0f, 0f, 0f, 0f)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/avsynctestapp/src/test/java/androidx/camera/integration/avsync/model/AudioGeneratorTest.kt b/camera/integration-tests/avsynctestapp/src/test/java/androidx/camera/integration/avsync/model/AudioGeneratorTest.kt
index b017a55..4adc899 100644
--- a/camera/integration-tests/avsynctestapp/src/test/java/androidx/camera/integration/avsync/model/AudioGeneratorTest.kt
+++ b/camera/integration-tests/avsynctestapp/src/test/java/androidx/camera/integration/avsync/model/AudioGeneratorTest.kt
@@ -131,4 +131,4 @@
assertThat(5311.toBytes(2)).isEqualTo(expected)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraMetadataKey.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraMetadataKey.kt
index b922907..d8a945d 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraMetadataKey.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraMetadataKey.kt
@@ -32,4 +32,4 @@
SENSOR_SENSITIVITY,
SCALAR_CROP_REGION,
STATISTICS_FACES,
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPermissionActivity.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPermissionActivity.kt
index 1d0fe6d..bf7d4bc 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPermissionActivity.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPermissionActivity.kt
@@ -222,4 +222,4 @@
lastPermissionRequestNumber
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeActivity.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeActivity.kt
index a7977aa..d4755ef 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeActivity.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeActivity.kt
@@ -213,4 +213,4 @@
// When we reach the end of the list of cameras, loop.
return cameraIdGroups[(lastCamerasIndex + 1) % cameraIdGroups.size]
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeApplication.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeApplication.kt
index c6ea7d1..4e78839 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeApplication.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeApplication.kt
@@ -51,4 +51,4 @@
Log.i("CXCP-App", "Application (${Process.myPid()}) created.")
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeUi.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeUi.kt
index 8aa0eb8..960ab24 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeUi.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/CameraPipeUi.kt
@@ -85,4 +85,4 @@
button.isEnabled = true
button.alpha = 1.0f
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerationDefaults.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerationDefaults.kt
index e4c3800..7d83d83 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerationDefaults.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerationDefaults.kt
@@ -262,4 +262,4 @@
/** Once in this many times, the value changes from what it was before */
val changeModeOnceInHowMany: Int
-)
\ No newline at end of file
+)
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerator.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerator.kt
index 9440d76b..f195061 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerator.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataGenerator.kt
@@ -66,4 +66,4 @@
it.join()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataManager.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataManager.kt
index b336cc6..f0bb0e2 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataManager.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataManager.kt
@@ -71,4 +71,4 @@
if (dataHolder != null) graphDataHolders[key]?.addPoint(dataPoint)
else throw IllegalArgumentException("A graph data holder for $key does not exist.")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataVisualizations.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataVisualizations.kt
index 858a3cd..cc49115 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataVisualizations.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/DataVisualizations.kt
@@ -197,4 +197,4 @@
// graphs.addView(graphLayout)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/VisualizationDefaults.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/VisualizationDefaults.kt
index 1c54ddf..43cf10c5 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/VisualizationDefaults.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/VisualizationDefaults.kt
@@ -90,4 +90,4 @@
2 to "HIGH_QUALITY"
)
)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolder.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolder.kt
index fa237cf..533109e 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolder.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolder.kt
@@ -37,4 +37,4 @@
timeWindowLengthNanos,
timeWindowEndNanos
)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderStateImpl.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderStateImpl.kt
index 557c84b..7ef44e5 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderStateImpl.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderStateImpl.kt
@@ -36,4 +36,4 @@
fun getNumStates() = stateMap.size
fun getStrings(): List<String> = stateMap.values.toList()
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderValueImpl.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderValueImpl.kt
index d1ee6c0..828a18c 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderValueImpl.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataHolderValueImpl.kt
@@ -49,4 +49,4 @@
fun getMax(): Number = absoluteMax
fun getRange(): Number = absoluteRange
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataPoint.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataPoint.kt
index f1f5bff..860471d 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataPoint.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataPoint.kt
@@ -35,4 +35,4 @@
override fun compareTo(other: GraphDataPoint): Int =
if (frameNumber != other.frameNumber) frameNumber.compareTo(other.frameNumber)
else timestampNanos.compareTo(timestampNanos)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataSortedRingBuffer.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataSortedRingBuffer.kt
index 189f014..f422e6f 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataSortedRingBuffer.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/GraphDataSortedRingBuffer.kt
@@ -71,4 +71,4 @@
/** 2000 is roughly the number of points added after 1 min if points are added at 30 FPS. */
const val CAPACITY = 2000
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/KeyValueDataHolder.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/KeyValueDataHolder.kt
index 29970c1..930ffbe 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/KeyValueDataHolder.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/dataholders/KeyValueDataHolder.kt
@@ -27,4 +27,4 @@
fun updateValue(newValue: String?) {
value = newValue
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/DataGenerationFunctions.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/DataGenerationFunctions.kt
index 29e5da8..258db4b 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/DataGenerationFunctions.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/DataGenerationFunctions.kt
@@ -108,4 +108,4 @@
e.printStackTrace()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/NumberOperators.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/NumberOperators.kt
index 7fbe7ec..90eb9dc 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/NumberOperators.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/extensions/NumberOperators.kt
@@ -43,4 +43,4 @@
"${otherNum.javaClass.simpleName} is not supported"
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformations1D.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformations1D.kt
index 5dca4a0..6a6452d 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformations1D.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformations1D.kt
@@ -119,4 +119,4 @@
" not supported"
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformationsKeyValue.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformationsKeyValue.kt
index 42a3b41..f04818b 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformationsKeyValue.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/transformations/DataTransformationsKeyValue.kt
@@ -84,4 +84,4 @@
" not supported"
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/GraphView.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/GraphView.kt
index ee106f9..a81f607 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/GraphView.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/GraphView.kt
@@ -202,4 +202,4 @@
/** Length of the time window of points being drawn - arbitrarily set at 4 seconds */
const val TIME_INTERVAL_LENGTH_NANOS: Long = 3000000000
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/KeyValueView.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/KeyValueView.kt
index 00d0b74..767b5a7 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/KeyValueView.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/KeyValueView.kt
@@ -63,4 +63,4 @@
canvas.drawText(valueString, widthFloat, bottom, paint)
postInvalidate()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/Paints.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/Paints.kt
index a3823fe..eea9dbc 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/Paints.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/Paints.kt
@@ -61,4 +61,4 @@
textSize = ResourcesCompat.getFloat(context.resources, R.dimen.keyValueValueTextSize)
textAlign = Paint.Align.RIGHT
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/StateGraphView.kt b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/StateGraphView.kt
index c11ee5d..4560e4c 100644
--- a/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/StateGraphView.kt
+++ b/camera/integration-tests/camerapipetestapp/src/main/java/androidx/camera/integration/camera2/pipe/visualizations/StateGraphView.kt
@@ -53,4 +53,4 @@
h += unitHeight
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataManagerTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataManagerTest.kt
index cecbf75..ef5d8fb 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataManagerTest.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataManagerTest.kt
@@ -85,4 +85,4 @@
dataManager.initializeDataHolders()
dataManager.updateGraphDataHolder(SCALAR_CROP_REGION, dataPoint)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataTransformations1DTests.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataTransformations1DTests.kt
index 76e314c..9b0c7d5 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataTransformations1DTests.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/DataTransformations1DTests.kt
@@ -129,4 +129,4 @@
fun lensFocalLength_booleanTest() {
DataTransformations1D.convert(LENS_FOCAL_LENGTH, true)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderStateImplTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderStateImplTest.kt
index 25ecfb3..64c0bb8 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderStateImplTest.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderStateImplTest.kt
@@ -65,4 +65,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderValueImplTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderValueImplTest.kt
index 9b2b13e..91fde59 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderValueImplTest.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataHolderValueImplTest.kt
@@ -59,4 +59,4 @@
)
assertThat(graphDataHolderValueImpl.getRange()).isEqualTo(967)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataSortedRingBufferTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataSortedRingBufferTest.kt
index cf49e43..839fb6b 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataSortedRingBufferTest.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/GraphDataSortedRingBufferTest.kt
@@ -405,4 +405,4 @@
Truth.assertThat(pointList).isEqualTo(listOf(p1, p2, p3, p4, p5))
Truth.assertThat(pointList.size).isEqualTo(5)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/VisualizationDefaultsTest.kt b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/VisualizationDefaultsTest.kt
index b393db1..f3693f8 100644
--- a/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/VisualizationDefaultsTest.kt
+++ b/camera/integration-tests/camerapipetestapp/src/test/java/androidx/camera/integration/camera2/pipe/VisualizationDefaultsTest.kt
@@ -34,4 +34,4 @@
assertThat(ValueRanges.absoluteRanges.containsKey(it)).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/BasicUITest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/BasicUITest.kt
index b2f1751..198f35b 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/BasicUITest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/BasicUITest.kt
@@ -202,4 +202,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/CameraXActivityTestExtensions.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/CameraXActivityTestExtensions.kt
index d13c4c4..7463876 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/CameraXActivityTestExtensions.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/CameraXActivityTestExtensions.kt
@@ -136,4 +136,4 @@
IdlingRegistry.getInstance().unregister(idlingResource)
withActivity { deleteSessionVideos() }
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageAnalysisTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageAnalysisTest.kt
index 4b963f7..01e996f 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageAnalysisTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageAnalysisTest.kt
@@ -33,9 +33,14 @@
import androidx.camera.core.ImageCapture
import androidx.camera.core.ImageProxy
import androidx.camera.core.impl.ImageOutputConfig
+import androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR
import androidx.camera.core.impl.utils.executor.CameraXExecutors
+import androidx.camera.core.internal.utils.SizeUtil
+import androidx.camera.core.resolutionselector.AspectRatioStrategy
+import androidx.camera.core.resolutionselector.ResolutionFilter
import androidx.camera.core.resolutionselector.ResolutionSelector
import androidx.camera.core.resolutionselector.ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+import androidx.camera.core.resolutionselector.ResolutionStrategy
import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.testing.CameraPipeConfigTestRule
import androidx.camera.testing.CameraUtil
@@ -461,6 +466,36 @@
}
}
+ @Test
+ fun resolutionSelectorConfigCorrectlyMerged_afterBindToLifecycle() = runBlocking {
+ val resolutionFilter = ResolutionFilter { supportedSizes, _ -> supportedSizes }
+ val useCase = ImageAnalysis.Builder().setResolutionSelector(
+ ResolutionSelector.Builder().setResolutionFilter(resolutionFilter)
+ .setAllowedResolutionMode(PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE).build()
+ ).build()
+ withContext(Dispatchers.Main) {
+ cameraProvider.bindToLifecycle(fakeLifecycleOwner, DEFAULT_CAMERA_SELECTOR, useCase)
+ }
+ val resolutionSelector = useCase.currentConfig.retrieveOption(OPTION_RESOLUTION_SELECTOR)
+ // The default 4:3 AspectRatioStrategy is kept
+ assertThat(resolutionSelector!!.aspectRatioStrategy).isEqualTo(
+ AspectRatioStrategy.RATIO_4_3_FALLBACK_AUTO_STRATEGY
+ )
+ // The default ResolutionStrategy with VGA bound size is kept
+ assertThat(resolutionSelector.resolutionStrategy!!.boundSize).isEqualTo(
+ SizeUtil.RESOLUTION_VGA
+ )
+ assertThat(resolutionSelector.resolutionStrategy!!.fallbackRule).isEqualTo(
+ ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER
+ )
+ // The set resolutionFilter is kept
+ assertThat(resolutionSelector.resolutionFilter).isEqualTo(resolutionFilter)
+ // The set allowedResolutionMode is kept
+ assertThat(resolutionSelector.allowedResolutionMode).isEqualTo(
+ PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+ )
+ }
+
private data class ImageProperties(
val resolution: Size,
val format: Int,
@@ -475,4 +510,4 @@
image.imageInfo.rotationDegrees
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureLatencyTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureLatencyTest.kt
index 88e709e..1022e81 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureLatencyTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureLatencyTest.kt
@@ -169,4 +169,4 @@
Logger.d(TAG,
"Image capture performance profiling, duration: [$duration] capture mode: $captureMode")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
index 066282a..ff11f0f 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
@@ -58,13 +58,17 @@
import androidx.camera.core.impl.Identifier
import androidx.camera.core.impl.ImageCaptureConfig
import androidx.camera.core.impl.ImageOutputConfig
+import androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR
import androidx.camera.core.impl.MutableOptionsBundle
import androidx.camera.core.impl.SessionProcessor
import androidx.camera.core.impl.utils.CameraOrientationUtil
import androidx.camera.core.impl.utils.Exif
import androidx.camera.core.internal.compat.workaround.ExifRotationAvailability
+import androidx.camera.core.resolutionselector.AspectRatioStrategy
+import androidx.camera.core.resolutionselector.ResolutionFilter
import androidx.camera.core.resolutionselector.ResolutionSelector
import androidx.camera.core.resolutionselector.ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+import androidx.camera.core.resolutionselector.ResolutionStrategy
import androidx.camera.integration.core.util.CameraPipeUtil
import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.testing.CameraPipeConfigTestRule
@@ -1669,6 +1673,33 @@
)
}
+ @Test
+ fun resolutionSelectorConfigCorrectlyMerged_afterBindToLifecycle() = runBlocking {
+ val resolutionFilter = ResolutionFilter { supportedSizes, _ -> supportedSizes }
+ val useCase = ImageCapture.Builder().setResolutionSelector(
+ ResolutionSelector.Builder().setResolutionFilter(resolutionFilter)
+ .setAllowedResolutionMode(PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE).build()
+ ).build()
+ withContext(Dispatchers.Main) {
+ cameraProvider.bindToLifecycle(fakeLifecycleOwner, BACK_SELECTOR, useCase)
+ }
+ val resolutionSelector = useCase.currentConfig.retrieveOption(OPTION_RESOLUTION_SELECTOR)
+ // The default 4:3 AspectRatioStrategy is kept
+ assertThat(resolutionSelector!!.aspectRatioStrategy).isEqualTo(
+ AspectRatioStrategy.RATIO_4_3_FALLBACK_AUTO_STRATEGY
+ )
+ // The default highest available ResolutionStrategy is kept
+ assertThat(resolutionSelector.resolutionStrategy).isEqualTo(
+ ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY
+ )
+ // The set resolutionFilter is kept
+ assertThat(resolutionSelector.resolutionFilter).isEqualTo(resolutionFilter)
+ // The set allowedResolutionMode is kept
+ assertThat(resolutionSelector.allowedResolutionMode).isEqualTo(
+ PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+ )
+ }
+
private fun capturedImage_withHighResolutionEnabled(
preview: Preview? = null,
imageAnalysis: ImageAnalysis? = null
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageProcessingLatencyTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageProcessingLatencyTest.kt
index 4586b00..269098b 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageProcessingLatencyTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageProcessingLatencyTest.kt
@@ -138,4 +138,4 @@
assertTrue(countDownLatch.await(60, TimeUnit.SECONDS))
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/InitializationTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/InitializationTest.kt
index ef5f4da..b020728 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/InitializationTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/InitializationTest.kt
@@ -143,4 +143,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/PreviewTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/PreviewTest.kt
index 00a4ae3..1895c58 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/PreviewTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/PreviewTest.kt
@@ -31,10 +31,14 @@
import androidx.camera.core.Preview
import androidx.camera.core.UseCase
import androidx.camera.core.impl.ImageOutputConfig
+import androidx.camera.core.impl.ImageOutputConfig.OPTION_RESOLUTION_SELECTOR
import androidx.camera.core.impl.utils.executor.CameraXExecutors
import androidx.camera.core.internal.CameraUseCaseAdapter
+import androidx.camera.core.resolutionselector.AspectRatioStrategy
+import androidx.camera.core.resolutionselector.ResolutionFilter
import androidx.camera.core.resolutionselector.ResolutionSelector
import androidx.camera.core.resolutionselector.ResolutionSelector.PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+import androidx.camera.core.resolutionselector.ResolutionStrategy
import androidx.camera.testing.CameraPipeConfigTestRule
import androidx.camera.testing.CameraUtil
import androidx.camera.testing.CameraUtil.PreTestCameraIdList
@@ -564,6 +568,7 @@
val resolutionSelector =
ResolutionSelector.Builder()
.setAllowedResolutionMode(PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE)
+ .setResolutionStrategy(ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY)
.setResolutionFilter { _, _ ->
listOf(maxHighResolutionOutputSize)
}
@@ -583,6 +588,67 @@
Truth.assertThat(surfaceFutureSemaphore!!.tryAcquire(10, TimeUnit.SECONDS)).isTrue()
}
+ @Test
+ fun defaultMaxResolutionCanBeKept_whenResolutionStrategyIsNotSet() {
+ assumeTrue(CameraUtil.hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK))
+ val useCase = Preview.Builder().build()
+ camera = CameraUtil.createCameraAndAttachUseCase(
+ context!!,
+ CameraSelector.DEFAULT_BACK_CAMERA, useCase
+ )
+ Truth.assertThat(
+ useCase.currentConfig.containsOption(
+ ImageOutputConfig.OPTION_MAX_RESOLUTION
+ )
+ ).isTrue()
+ }
+
+ @Test
+ fun defaultMaxResolutionCanBeRemoved_whenResolutionStrategyIsSet() {
+ assumeTrue(CameraUtil.hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK))
+ val useCase = Preview.Builder().setResolutionSelector(
+ ResolutionSelector.Builder()
+ .setResolutionStrategy(ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY).build()
+ ).build()
+ camera = CameraUtil.createCameraAndAttachUseCase(
+ context!!,
+ CameraSelector.DEFAULT_BACK_CAMERA, useCase
+ )
+ Truth.assertThat(
+ useCase.currentConfig.containsOption(
+ ImageOutputConfig.OPTION_MAX_RESOLUTION
+ )
+ ).isFalse()
+ }
+
+ @Test
+ fun resolutionSelectorConfigCorrectlyMerged_afterBindToLifecycle() {
+ val resolutionFilter = ResolutionFilter { supportedSizes, _ -> supportedSizes }
+ val useCase = Preview.Builder().setResolutionSelector(
+ ResolutionSelector.Builder().setResolutionFilter(resolutionFilter)
+ .setAllowedResolutionMode(PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE).build()
+ ).build()
+ camera = CameraUtil.createCameraAndAttachUseCase(
+ context!!,
+ CameraSelector.DEFAULT_BACK_CAMERA, useCase
+ )
+ val resolutionSelector = useCase.currentConfig.retrieveOption(OPTION_RESOLUTION_SELECTOR)
+ // The default 4:3 AspectRatioStrategy is kept
+ Truth.assertThat(resolutionSelector!!.aspectRatioStrategy).isEqualTo(
+ AspectRatioStrategy.RATIO_4_3_FALLBACK_AUTO_STRATEGY
+ )
+ // The default highest available ResolutionStrategy is kept
+ Truth.assertThat(resolutionSelector.resolutionStrategy).isEqualTo(
+ ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY
+ )
+ // The set resolutionFilter is kept
+ Truth.assertThat(resolutionSelector.resolutionFilter).isEqualTo(resolutionFilter)
+ // The set allowedResolutionMode is kept
+ Truth.assertThat(resolutionSelector.allowedResolutionMode).isEqualTo(
+ PREFER_HIGHER_RESOLUTION_OVER_CAPTURE_RATE
+ )
+ }
+
private val workExecutorWithNamedThread: Executor
get() {
val threadFactory =
@@ -642,4 +708,4 @@
} while (totalCheckTime < timeoutMs)
return false
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/SurfaceOrientedMeteringPointFactoryTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/SurfaceOrientedMeteringPointFactoryTest.kt
index 4a3759a..f0b6393 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/SurfaceOrientedMeteringPointFactoryTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/camera2/SurfaceOrientedMeteringPointFactoryTest.kt
@@ -158,4 +158,4 @@
arrayOf(CameraPipeConfig::class.simpleName, CameraPipeConfig.defaultConfig())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/ImageCaptureStressTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/ImageCaptureStressTest.kt
index 578ae88..971b57d 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/ImageCaptureStressTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/ImageCaptureStressTest.kt
@@ -293,4 +293,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/LifecycleStatusChangeStressTestBase.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/LifecycleStatusChangeStressTestBase.kt
index 3c59a34..5424f2c 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/LifecycleStatusChangeStressTestBase.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/LifecycleStatusChangeStressTestBase.kt
@@ -242,4 +242,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/SwitchCameraStressTestBase.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/SwitchCameraStressTestBase.kt
index f710cab8..59f9139 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/SwitchCameraStressTestBase.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/stresstest/SwitchCameraStressTestBase.kt
@@ -267,4 +267,4 @@
// Checks whether the camera of the other lens facing can support the use case combination
assumeCameraSupportUseCaseCombination(otherLensFacingCamera, useCaseCombination)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/CameraPipeUtil.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/CameraPipeUtil.kt
index c89ede759..2738bfc2 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/CameraPipeUtil.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/CameraPipeUtil.kt
@@ -133,4 +133,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/StressTestUtil.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/StressTestUtil.kt
index fed1f5b..6995464 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/StressTestUtil.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/util/StressTestUtil.kt
@@ -221,4 +221,4 @@
* Constant to specify that the verification target is [ImageAnalysis].
*/
const val VERIFICATION_TARGET_IMAGE_ANALYSIS = 0x8
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Calibration.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Calibration.kt
index 5a457ed..18f2ae8 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Calibration.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Calibration.kt
@@ -160,4 +160,4 @@
private const val TAG = "Calibration"
private const val THRESHOLD = 4F
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/CollectDeviceInfoTask.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/CollectDeviceInfoTask.kt
index 2382efe..6f893e1 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/CollectDeviceInfoTask.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/CollectDeviceInfoTask.kt
@@ -45,4 +45,4 @@
dataStore.appendText("Version SDK: ${Build.VERSION.SDK_INT}")
dataStore.appendText("Fingerprint: ${Build.FINGERPRINT}")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DataStore.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DataStore.kt
index e20d1c9..02d09f5 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DataStore.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DataStore.kt
@@ -112,4 +112,4 @@
}
return File(dir, filename)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Diagnosis.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Diagnosis.kt
index 71625af..a5afc1e 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Diagnosis.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/Diagnosis.kt
@@ -56,4 +56,4 @@
companion object {
private const val TAG = "Diagnosis"
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DiagnosisTask.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DiagnosisTask.kt
index b2c0cf9..7bf3ec0 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DiagnosisTask.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/DiagnosisTask.kt
@@ -38,4 +38,4 @@
dataStore: DataStore,
context: Context
)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/ImageCaptureTask.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/ImageCaptureTask.kt
index b032578..e44a8ba 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/ImageCaptureTask.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/ImageCaptureTask.kt
@@ -93,4 +93,4 @@
}
})
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/MainActivity.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/MainActivity.kt
index 5abea5c..dfd1d5a 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/MainActivity.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/MainActivity.kt
@@ -382,4 +382,4 @@
}
}.toTypedArray()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/OverlayView.kt b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/OverlayView.kt
index 000c98c..c440d5aa 100644
--- a/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/OverlayView.kt
+++ b/camera/integration-tests/diagnosetestapp/src/main/java/androidx/camera/integration/diagnose/OverlayView.kt
@@ -101,4 +101,4 @@
companion object {
private const val TAG = "OverlayView"
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DataStoreTest.kt b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DataStoreTest.kt
index b2ca7af..842487c 100644
--- a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DataStoreTest.kt
+++ b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DataStoreTest.kt
@@ -108,4 +108,4 @@
private const val TEST_STRING_FILE = "test_string_file"
private const val TEST_BITMAP_FILE = "test_bitmap_file"
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DiagnosisTest.kt b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DiagnosisTest.kt
index e6af322..769198a 100644
--- a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DiagnosisTest.kt
+++ b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/DiagnosisTest.kt
@@ -155,4 +155,4 @@
private const val FAKE_TEXT_SAVING_TASK_STRING = "This is a fake test 1.Line 2."
private const val FAKE_TEXT_AND_IMAGE_SAVING_TASK_STRING = "This is fake task 2."
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextAndImageSavingTask.kt b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextAndImageSavingTask.kt
index f5837dc..99e025f 100644
--- a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextAndImageSavingTask.kt
+++ b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextAndImageSavingTask.kt
@@ -37,4 +37,4 @@
}
dataStore.flushBitmapToFile("FakeImage", bitmap)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextSavingTask.kt b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextSavingTask.kt
index 51bb314..611bb61 100644
--- a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextSavingTask.kt
+++ b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/FakeTextSavingTask.kt
@@ -30,4 +30,4 @@
dataStore.appendText("This is a fake test 1.")
dataStore.appendText("Line 2.")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/TestUtils.kt b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/TestUtils.kt
index 6c25c61..f530803 100644
--- a/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/TestUtils.kt
+++ b/camera/integration-tests/diagnosetestapp/src/test/java/androidx/camera/integration/diagnose/TestUtils.kt
@@ -51,4 +51,4 @@
lines.append(br.readLine())
}
return lines.toString()
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidation.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidation.kt
index d615435..b406d30 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidation.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidation.kt
@@ -444,4 +444,4 @@
assertThat(captureSession).isNotNull()
addTearDown { captureSession.close() }
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidationTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidationTest.kt
index 5fbc9a3..9f25dcc 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidationTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/AdvancedExtenderValidationTest.kt
@@ -100,4 +100,4 @@
@Test
fun initSessionWithAnalysis_medianSize_canConfigureSession() =
validation.initSessionWithAnalysis_medianSize_canConfigureSession()
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ClientVersionBackwardCompatibilityTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ClientVersionBackwardCompatibilityTest.kt
index 5b4f7b2..dd81b9a 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ClientVersionBackwardCompatibilityTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ClientVersionBackwardCompatibilityTest.kt
@@ -167,4 +167,4 @@
fun previewImageCaptureWork_clientVersion_1_4_0() = runBlocking {
assertPreviewAndImageCaptureWorking(clientVersion = "1.4.0")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ImageCaptureTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ImageCaptureTest.kt
index 941ad66..73f9355 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ImageCaptureTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/ImageCaptureTest.kt
@@ -123,4 +123,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/LifecycleStatusChangeStressTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/LifecycleStatusChangeStressTest.kt
index 04404e4..428b73a 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/LifecycleStatusChangeStressTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/LifecycleStatusChangeStressTest.kt
@@ -213,4 +213,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/PreviewTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/PreviewTest.kt
index 8154c16..2734269 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/PreviewTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/PreviewTest.kt
@@ -155,4 +155,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsActivityTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsActivityTest.kt
index f689467..fb79a40 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsActivityTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsActivityTest.kt
@@ -215,4 +215,4 @@
return activityScenario
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsImageCaptureStressTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsImageCaptureStressTest.kt
index f9d8b9d..b26f587 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsImageCaptureStressTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsImageCaptureStressTest.kt
@@ -133,4 +133,4 @@
image!!.close()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsOpenCloseStressTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsOpenCloseStressTest.kt
index 8c9f89d..769ee4f 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsOpenCloseStressTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsOpenCloseStressTest.kt
@@ -76,4 +76,4 @@
verifyOutput = true
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchCameraStressTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchCameraStressTest.kt
index bc0dfdd..cb47160 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchCameraStressTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchCameraStressTest.kt
@@ -81,4 +81,4 @@
verifyOutput = true
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchModeStressTest.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchModeStressTest.kt
index 6cffd8f..87192bc 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchModeStressTest.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/camera2extensions/Camera2ExtensionsSwitchModeStressTest.kt
@@ -91,4 +91,4 @@
verifyOutput = true
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsActivityTestExtensions.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsActivityTestExtensions.kt
index 13cfeb4..7fcc418 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsActivityTestExtensions.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsActivityTestExtensions.kt
@@ -79,4 +79,4 @@
IdlingRegistry.getInstance().unregister(idlingResource)
withActivity { deleteSessionImages() }
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsTestUtil.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsTestUtil.kt
index 2b39b56..5200916 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsTestUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/Camera2ExtensionsTestUtil.kt
@@ -384,4 +384,4 @@
}
return EXTENSION_NOT_FOUND
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsActivityTestExtensions.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsActivityTestExtensions.kt
index 082aa68..9994192 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsActivityTestExtensions.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsActivityTestExtensions.kt
@@ -112,4 +112,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsTestUtil.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsTestUtil.kt
index 09a7be9..0754f07 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsTestUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/CameraXExtensionsTestUtil.kt
@@ -310,4 +310,4 @@
* Constant to specify that the verification target is [ImageAnalysis].
*/
const val VERIFICATION_TARGET_IMAGE_ANALYSIS = 0x4
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/ImageCaptureTestUtil.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/ImageCaptureTestUtil.kt
index 1875421..af16196 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/ImageCaptureTestUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/ImageCaptureTestUtil.kt
@@ -58,4 +58,4 @@
buffer.get(data)
buffer.rewind()
return data
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/TestContants.kt b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/TestContants.kt
index b3ab2a4..62e47d8 100644
--- a/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/TestContants.kt
+++ b/camera/integration-tests/extensionstestapp/src/androidTest/java/androidx/camera/integration/extensions/util/TestContants.kt
@@ -24,4 +24,4 @@
/**
* Timeout duration to wait for idle after pressing HOME key
*/
-const val HOME_TIMEOUT_MS = 3000L
\ No newline at end of file
+const val HOME_TIMEOUT_MS = 3000L
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/Camera2ExtensionsActivity.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/Camera2ExtensionsActivity.kt
index 7ffa4e5..4ddf059 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/Camera2ExtensionsActivity.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/Camera2ExtensionsActivity.kt
@@ -1196,4 +1196,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/Camera2ExtensionsUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/Camera2ExtensionsUtil.kt
index 9fbc9fc..bc7738d 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/Camera2ExtensionsUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/Camera2ExtensionsUtil.kt
@@ -202,4 +202,4 @@
return Pair(stillCaptureSize, stillFormat)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/CameraSelectorUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/CameraSelectorUtil.kt
index 9a15a66..29d47c2 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/CameraSelectorUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/CameraSelectorUtil.kt
@@ -72,4 +72,4 @@
}
return null
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ExtensionModeUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ExtensionModeUtil.kt
index 1757d06..13c6ad8 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ExtensionModeUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ExtensionModeUtil.kt
@@ -57,4 +57,4 @@
ExtensionMode.FACE_RETOUCH,
ExtensionMode.AUTO
)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/FileUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/FileUtil.kt
index 0bdb22e..1fb8db9 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/FileUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/FileUtil.kt
@@ -188,4 +188,4 @@
}
return true
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ImageUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ImageUtil.kt
index 70c1cb5..dd31ecb 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ImageUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/ImageUtil.kt
@@ -142,4 +142,4 @@
}
return nv21
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/TransformUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/TransformUtil.kt
index fb3c5ef..48dcd67 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/TransformUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/TransformUtil.kt
@@ -252,4 +252,4 @@
}
throw IllegalArgumentException("Invalid rotation degrees: $rotationDegrees")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/validation/PhotoFragment.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/validation/PhotoFragment.kt
index f58b75e..c27c9d9 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/validation/PhotoFragment.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/validation/PhotoFragment.kt
@@ -114,4 +114,4 @@
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/AntelopeInstrumentedTests.kt b/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/AntelopeInstrumentedTests.kt
index 0b87c9a..5594bf0 100644
--- a/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/AntelopeInstrumentedTests.kt
+++ b/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/AntelopeInstrumentedTests.kt
@@ -742,4 +742,4 @@
return ""
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/RepeatRule.kt b/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/RepeatRule.kt
index 728fefb..c101d6d 100644
--- a/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/RepeatRule.kt
+++ b/camera/integration-tests/timingtestapp/src/androidTest/java/androidx/camera/integration/antelope/RepeatRule.kt
@@ -65,4 +65,4 @@
base
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitSurfaceView.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitSurfaceView.kt
index e996710..eeda45a 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitSurfaceView.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitSurfaceView.kt
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitTextureView.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitTextureView.kt
index 7f814b5..2ce9993 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitTextureView.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/AutoFitTextureView.kt
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CamViewModel.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CamViewModel.kt
index f5b86dd..a71000c 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CamViewModel.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CamViewModel.kt
@@ -70,4 +70,4 @@
fun getHumanReadableReport(): MutableLiveData<String> {
return humanReadableReport
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraParams.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraParams.kt
index e8cf6c8..41d78965 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraParams.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraParams.kt
@@ -113,4 +113,4 @@
// Testing variables
internal var timer: CameraTimer = CameraTimer()
internal var autoFocusStuckCounter = 0
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraTimer.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraTimer.kt
index 17ab0fd..1d41bab 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraTimer.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CameraTimer.kt
@@ -68,4 +68,4 @@
imageSaveEnd = 0L
isHDRPlus = false
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CustomLifecycle.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CustomLifecycle.kt
index a68e4f2..5c35763 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CustomLifecycle.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/CustomLifecycle.kt
@@ -105,4 +105,4 @@
fun isFinished(): Boolean {
return (Lifecycle.State.DESTROYED == lifecycleRegistry.currentState)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/DeviceInfo.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/DeviceInfo.kt
index dbbd722..46aceb5 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/DeviceInfo.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/DeviceInfo.kt
@@ -31,4 +31,4 @@
/** Short string with device information */
val deviceShort: String = android.os.Build.DEVICE
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/ImageUtils.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/ImageUtils.kt
index ab9f1a2..ed7f3d2 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/ImageUtils.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/ImageUtils.kt
@@ -459,4 +459,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/MeasureUtils.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/MeasureUtils.kt
index d0b1a6a..91781f3 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/MeasureUtils.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/MeasureUtils.kt
@@ -57,4 +57,4 @@
Log.e(MainActivity.LOG_TAG, "Couldn't find any suitable preview size")
return choices[0]
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/PrefHelper.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/PrefHelper.kt
index 9194ee3..b257c24 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/PrefHelper.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/PrefHelper.kt
@@ -309,4 +309,4 @@
return -1
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SettingsDialog.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SettingsDialog.kt
index b7f03b7..c5b13e9 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SettingsDialog.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SettingsDialog.kt
@@ -157,4 +157,4 @@
return settingsDialog
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SingleTestSettingsFragment.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SingleTestSettingsFragment.kt
index 6196051..32f69df 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SingleTestSettingsFragment.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/SingleTestSettingsFragment.kt
@@ -105,4 +105,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestConfig.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestConfig.kt
index 1e25989..232420f 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestConfig.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestConfig.kt
@@ -82,4 +82,4 @@
testResults.imageCaptureSize = imageCaptureSize
testResults.focusMode = focusMode
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestResults.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestResults.kt
index 03eaa24..686f2e3 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestResults.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestResults.kt
@@ -557,4 +557,4 @@
}
return output
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingApplication.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingApplication.kt
index 29c9927..2cea254 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingApplication.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingApplication.kt
@@ -33,4 +33,4 @@
override fun getCameraXConfig(): CameraXConfig {
return Camera2Config.defaultConfig()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingTests.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingTests.kt
index 2e26b3a5..b3589084 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingTests.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TimingTests.kt
@@ -641,4 +641,4 @@
cameraXOpenCamera(activity, params, testConfig)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera1Controller.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera1Controller.kt
index a8c2c56..bf47c8f 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera1Controller.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera1Controller.kt
@@ -312,4 +312,4 @@
testConfig.testFinished = true
closePreviewAndCamera(activity, params, testConfig)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureCallback.kt
index 8401722..b3aedd7 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureCallback.kt
@@ -145,4 +145,4 @@
params.timer.imageReaderStart = System.currentTimeMillis()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureSessionCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureSessionCallback.kt
index 04c128e..ad4a4c3 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureSessionCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2CaptureSessionCallback.kt
@@ -221,4 +221,4 @@
// " Total result frame number: " + result.frameNumber)
process(result)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2Controller.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2Controller.kt
index 9b1d8fd..d4a3cad 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2Controller.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2Controller.kt
@@ -341,4 +341,4 @@
fun camera2Abort(activity: MainActivity, params: CameraParams) {
params.camera2CaptureSession?.abortCaptures()
activity.stopBackgroundThread(params)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2DeviceStateCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2DeviceStateCallback.kt
index 17483c1..57dae04 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2DeviceStateCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Camera2DeviceStateCallback.kt
@@ -144,4 +144,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXCaptureSessionCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXCaptureSessionCallback.kt
index 58d3974..91cd0a6 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXCaptureSessionCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXCaptureSessionCallback.kt
@@ -143,4 +143,4 @@
params.timer.imageReaderStart = System.currentTimeMillis()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXController.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXController.kt
index 5c393cc..0b893df 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXController.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXController.kt
@@ -349,4 +349,4 @@
// Prints a log to suppress "fix Parameter 'focusMode' is never used" build error"
Log.d("Antelope", "focusMode($focusMode) Not enabled.")
return configBuilder
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXDeviceStateCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXDeviceStateCallback.kt
index bdc8cdc..b6c660e 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXDeviceStateCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXDeviceStateCallback.kt
@@ -134,4 +134,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXPreviewSessionStateCallback.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXPreviewSessionStateCallback.kt
index ee1f1e6..76d6db1 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXPreviewSessionStateCallback.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/CameraXPreviewSessionStateCallback.kt
@@ -109,4 +109,4 @@
override fun onClosed(session: CameraCaptureSession) {
MainActivity.logd("In CameraXPreviewSessionStateCallback onClosed.")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Common.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Common.kt
index 62799fc..685ec97 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Common.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/cameracontrollers/Common.kt
@@ -65,4 +65,4 @@
if (!closedACamera) {
closeAllCameras(activity, testConfig)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraAppTest.kt b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraAppTest.kt
index 4e031ec..586408c 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraAppTest.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/compose/ComposeCameraAppTest.kt
@@ -139,4 +139,4 @@
companion object {
private const val TAG = "ComposeCameraAppTest"
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageAnalysisBaseTest.kt b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageAnalysisBaseTest.kt
index 0add8e7..039083f 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageAnalysisBaseTest.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageAnalysisBaseTest.kt
@@ -182,4 +182,4 @@
testCameraRule = CameraUtil.PreTestCamera()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureBaseTest.kt b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureBaseTest.kt
index 741b76f..4d65618 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureBaseTest.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureBaseTest.kt
@@ -249,4 +249,4 @@
testCameraRule = CameraUtil.PreTestCamera()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/RotationUnlocked.kt b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/RotationUnlocked.kt
index 31e8fc6..677183c 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/RotationUnlocked.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/rotations/RotationUnlocked.kt
@@ -26,4 +26,4 @@
object Natural : RotationUnlocked(false, {})
object Left : RotationUnlocked(true, UiDevice::setOrientationLeft)
object Right : RotationUnlocked(true, UiDevice::setOrientationRight)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/viewpager/ViewPagerActivityTest.kt b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/viewpager/ViewPagerActivityTest.kt
index d828729..0a6ab4e 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/viewpager/ViewPagerActivityTest.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/androidTest/java/androidx/camera/integration/uiwidgets/viewpager/ViewPagerActivityTest.kt
@@ -256,4 +256,4 @@
}
assertThat(latchForFrameUpdate.await(ACTION_IDLE_TIMEOUT, TimeUnit.MILLISECONDS)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/MainActivity.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/MainActivity.kt
index 3fd4c7d..400f740 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/MainActivity.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/MainActivity.kt
@@ -64,4 +64,4 @@
val intent = Intent(this, activityClass)
startActivity(intent)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt
index 27af7e9..94e7f2b 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/PermissionsUI.kt
@@ -53,4 +53,4 @@
} else {
Text("Permissions are not granted to the app.")
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
index d91fc70..12fd340 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraNavHost.kt
@@ -60,4 +60,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraScreen.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraScreen.kt
index 124fe4f..4197f85 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraScreen.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/navigation/ComposeCameraScreen.kt
@@ -43,4 +43,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlButton.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlButton.kt
index 0f237e5..df7182a 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlButton.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlButton.kt
@@ -64,4 +64,4 @@
@Composable
fun CameraControlButtonPlaceholder(modifier: Modifier = Modifier) {
Spacer(modifier = modifier.size(CAMERA_CONTROL_BUTTON_SIZE))
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlRow.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlRow.kt
index 89fe498..4bb99c0 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlRow.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/CameraControlRow.kt
@@ -44,4 +44,4 @@
) {
content()
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/TabRow.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/TabRow.kt
index 40f5ed1..0cae0bb 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/TabRow.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/components/TabRow.kt
@@ -131,4 +131,4 @@
Text(text.uppercase(Locale.getDefault()), color = tabTintColor)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
index 4b4ed18..1f54e41 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreen.kt
@@ -275,4 +275,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreenState.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreenState.kt
index 051fee8..72fdd51e 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreenState.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/imagecapture/ImageCaptureScreenState.kt
@@ -391,4 +391,4 @@
initialFlashMode = initialFlashMode
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
index 5bb0aae..71f10a5 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreen.kt
@@ -213,4 +213,4 @@
tint = iconColor,
onClick = onVideoCaptureIconClicked
)
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreenState.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreenState.kt
index bd6b3cc..e5df82b 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreenState.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/compose/ui/screen/videocapture/VideoCaptureScreenState.kt
@@ -319,4 +319,4 @@
initialLensFacing = initialLensFacing
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureResult.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureResult.kt
index 2dec4dd..0452b86 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureResult.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/ImageCaptureResult.kt
@@ -63,4 +63,4 @@
contentResolver.delete(uri, null, null)
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/UnlockedOrientationActivity.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/UnlockedOrientationActivity.kt
index ec1b7fe..4ac8f26 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/UnlockedOrientationActivity.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/rotations/UnlockedOrientationActivity.kt
@@ -16,4 +16,4 @@
package androidx.camera.integration.uiwidgets.rotations
-class UnlockedOrientationActivity : CameraActivity()
\ No newline at end of file
+class UnlockedOrientationActivity : CameraActivity()
diff --git a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/viewpager/BaseActivity.kt b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/viewpager/BaseActivity.kt
index 2a54dfc..f90c8f9 100644
--- a/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/viewpager/BaseActivity.kt
+++ b/camera/integration-tests/uiwidgetstestapp/src/main/java/androidx/camera/integration/uiwidgets/viewpager/BaseActivity.kt
@@ -72,4 +72,4 @@
return latchForState.await(LATCH_TIMEOUT, TimeUnit.MILLISECONDS)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderActivity.kt b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderActivity.kt
index 998ffb7..89682eb 100644
--- a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderActivity.kt
+++ b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderActivity.kt
@@ -63,4 +63,4 @@
else
arrayOf(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
index fd85b14..3627dd5 100644
--- a/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
+++ b/camera/integration-tests/viewfindertestapp/src/main/java/androidx/camera/integration/viewfinder/CameraViewfinderFoldableFragment.kt
@@ -895,4 +895,4 @@
override fun close() = image.close()
}
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.kt b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.kt
index db47f11..b6e280f 100644
--- a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.kt
+++ b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.kt
@@ -301,4 +301,4 @@
arrayOf(CameraPipeConfig::class.simpleName, CameraPipeConfig.defaultConfig())
)
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/MlKitFragment.kt b/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/MlKitFragment.kt
index 685a18e..17c2e9f 100644
--- a/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/MlKitFragment.kt
+++ b/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/MlKitFragment.kt
@@ -101,4 +101,4 @@
}
})
}
-}
\ No newline at end of file
+}
diff --git a/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/ToneMappingSurfaceProcessor.kt b/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/ToneMappingSurfaceProcessor.kt
index 7f67745..107d006 100644
--- a/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/ToneMappingSurfaceProcessor.kt
+++ b/camera/integration-tests/viewtestapp/src/main/java/androidx/camera/integration/view/ToneMappingSurfaceProcessor.kt
@@ -172,4 +172,4 @@
glRenderer.render(surfaceTexture.timestamp, surfaceTransform, surface)
}
}
-}
\ No newline at end of file
+}
diff --git a/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/LegacySurfacePackage.java b/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/LegacySurfacePackage.java
index a377cb9..c429e4a 100644
--- a/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/LegacySurfacePackage.java
+++ b/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/LegacySurfacePackage.java
@@ -83,7 +83,7 @@
};
}
- /** Empty constructor needed for serializations. **/
+ /** Empty constructor needed for serializations. */
private LegacySurfacePackage() {
}
diff --git a/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/SurfaceWrapper.java b/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/SurfaceWrapper.java
index ce2ffdf..e2f399a 100644
--- a/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/SurfaceWrapper.java
+++ b/car/app/app-automotive/src/main/java/androidx/car/app/activity/renderer/surface/SurfaceWrapper.java
@@ -64,7 +64,7 @@
mSurface = surface;
}
- /** Empty constructor needed for serializations. **/
+ /** Empty constructor needed for serializations. */
private SurfaceWrapper() {
}
diff --git a/car/app/app-samples/navigation/common/build.gradle b/car/app/app-samples/navigation/common/build.gradle
index b7bb4a0..0b5ec8f 100644
--- a/car/app/app-samples/navigation/common/build.gradle
+++ b/car/app/app-samples/navigation/common/build.gradle
@@ -33,10 +33,7 @@
implementation(project(":car:app:app"))
implementation 'androidx.core:core:1.7.0'
- implementation "androidx.annotation:annotation-experimental:1.3.0"
- // There is an implicit compile-only dep due to :annotation-experimental
- // Build will complain without this manual declaration.
- compileOnly libs.kotlinStdlib
+ implementation "androidx.annotation:annotation-experimental:1.3.1"
implementation 'androidx.lifecycle:lifecycle-livedata:2.3.1'
implementation 'androidx.activity:activity:1.2.3'
}
diff --git a/car/app/app-samples/showcase/common/build.gradle b/car/app/app-samples/showcase/common/build.gradle
index fc49490..e9a455a5 100644
--- a/car/app/app-samples/showcase/common/build.gradle
+++ b/car/app/app-samples/showcase/common/build.gradle
@@ -33,10 +33,7 @@
debugImplementation(libs.leakcanary)
implementation("androidx.core:core:1.7.0")
- implementation "androidx.annotation:annotation-experimental:1.3.0"
- // There is an implicit compile-only dep due to :annotation-experimental
- // Build will complain without this manual declaration.
- compileOnly libs.kotlinStdlib
+ implementation "androidx.annotation:annotation-experimental:1.3.1"
}
diff --git a/car/app/app-testing/build.gradle b/car/app/app-testing/build.gradle
index 9211db4..549b140 100644
--- a/car/app/app-testing/build.gradle
+++ b/car/app/app-testing/build.gradle
@@ -27,10 +27,7 @@
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
implementation 'androidx.annotation:annotation:1.1.0'
implementation(libs.robolectric)
- implementation("androidx.annotation:annotation-experimental:1.1.0")
- // There is an implicit compile-only dep due to :annotation-experimental
- // Build will complain without this manual declaration.
- compileOnly libs.kotlinStdlib
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
testImplementation(project(":car:app:app-projected"))
testImplementation(libs.junit)
diff --git a/car/app/app/api/current.txt b/car/app/app/api/current.txt
index ec7d0e1..d0e6c4a 100644
--- a/car/app/app/api/current.txt
+++ b/car/app/app/api/current.txt
@@ -931,12 +931,14 @@
method public static String typeToString(int);
field public static final androidx.car.app.model.Action APP_ICON;
field public static final androidx.car.app.model.Action BACK;
+ field @SuppressCompatibility @androidx.car.app.annotations.ExperimentalCarApi @androidx.car.app.annotations.RequiresCarApi(7) public static final androidx.car.app.model.Action COMPOSE_MESSAGE;
field @androidx.car.app.annotations.RequiresCarApi(5) public static final int FLAG_DEFAULT = 4; // 0x4
field @androidx.car.app.annotations.RequiresCarApi(5) public static final int FLAG_IS_PERSISTENT = 2; // 0x2
field @androidx.car.app.annotations.RequiresCarApi(4) public static final int FLAG_PRIMARY = 1; // 0x1
field public static final androidx.car.app.model.Action PAN;
field public static final int TYPE_APP_ICON = 65538; // 0x10002
field public static final int TYPE_BACK = 65539; // 0x10003
+ field @SuppressCompatibility @androidx.car.app.annotations.ExperimentalCarApi @androidx.car.app.annotations.RequiresCarApi(7) public static final int TYPE_COMPOSE_MESSAGE = 65541; // 0x10005
field public static final int TYPE_CUSTOM = 1; // 0x1
field public static final int TYPE_PAN = 65540; // 0x10004
}
diff --git a/car/app/app/api/restricted_current.txt b/car/app/app/api/restricted_current.txt
index ec7d0e1..d0e6c4a 100644
--- a/car/app/app/api/restricted_current.txt
+++ b/car/app/app/api/restricted_current.txt
@@ -931,12 +931,14 @@
method public static String typeToString(int);
field public static final androidx.car.app.model.Action APP_ICON;
field public static final androidx.car.app.model.Action BACK;
+ field @SuppressCompatibility @androidx.car.app.annotations.ExperimentalCarApi @androidx.car.app.annotations.RequiresCarApi(7) public static final androidx.car.app.model.Action COMPOSE_MESSAGE;
field @androidx.car.app.annotations.RequiresCarApi(5) public static final int FLAG_DEFAULT = 4; // 0x4
field @androidx.car.app.annotations.RequiresCarApi(5) public static final int FLAG_IS_PERSISTENT = 2; // 0x2
field @androidx.car.app.annotations.RequiresCarApi(4) public static final int FLAG_PRIMARY = 1; // 0x1
field public static final androidx.car.app.model.Action PAN;
field public static final int TYPE_APP_ICON = 65538; // 0x10002
field public static final int TYPE_BACK = 65539; // 0x10003
+ field @SuppressCompatibility @androidx.car.app.annotations.ExperimentalCarApi @androidx.car.app.annotations.RequiresCarApi(7) public static final int TYPE_COMPOSE_MESSAGE = 65541; // 0x10005
field public static final int TYPE_CUSTOM = 1; // 0x1
field public static final int TYPE_PAN = 65540; // 0x10004
}
diff --git a/car/app/app/build.gradle b/car/app/app/build.gradle
index beb856f..c0fd300 100644
--- a/car/app/app/build.gradle
+++ b/car/app/app/build.gradle
@@ -53,10 +53,7 @@
implementation("androidx.lifecycle:lifecycle-viewmodel:2.2.0")
// Session and Screen both implement LifeCycleOwner so this needs to be exposed.
api("androidx.lifecycle:lifecycle-common-java8:2.2.0")
- api("androidx.annotation:annotation-experimental:1.1.0")
- // There is an implicit compile-only dep due to :annotation-experimental
- // Build will complain without this manual declaration.
- api(libs.kotlinStdlib) // Added for annotation-experimental
+ api("androidx.annotation:annotation-experimental:1.3.1")
annotationProcessor(libs.nullaway)
diff --git a/car/app/app/src/main/java/androidx/car/app/mediaextensions/MetadataExtras.java b/car/app/app/src/main/java/androidx/car/app/mediaextensions/MetadataExtras.java
index 1ad83f2..1a46be5 100644
--- a/car/app/app/src/main/java/androidx/car/app/mediaextensions/MetadataExtras.java
+++ b/car/app/app/src/main/java/androidx/car/app/mediaextensions/MetadataExtras.java
@@ -58,7 +58,7 @@
* + subtitle: “Beethoven” // Artist
* + subtitleLinkMediaId: “artist:Beethoven” // Artist ID
* </pre>
- **/
+ */
public static final String KEY_SUBTITLE_LINK_MEDIA_ID =
"androidx.car.app.mediaextensions.KEY_SUBTITLE_LINK_MEDIA_ID";
@@ -90,7 +90,7 @@
* ╚════+ mediaId: “artist:Beethoven” // ID
* + title: “Beethoven” // Artist
* </pre>
- **/
+ */
public static final String KEY_DESCRIPTION_LINK_MEDIA_ID =
"androidx.car.app.mediaextensions.KEY_DESCRIPTION_LINK_MEDIA_ID";
}
diff --git a/car/app/app/src/main/java/androidx/car/app/model/Action.java b/car/app/app/src/main/java/androidx/car/app/model/Action.java
index 38d13b7..7396916 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/Action.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/Action.java
@@ -31,12 +31,14 @@
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.OptIn;
import androidx.annotation.RestrictTo;
import androidx.car.app.CarContext;
import androidx.car.app.annotations.CarProtocol;
+import androidx.car.app.annotations.ExperimentalCarApi;
+import androidx.car.app.annotations.KeepFields;
import androidx.car.app.annotations.RequiresCarApi;
import androidx.car.app.model.constraints.CarIconConstraints;
-import androidx.car.app.annotations.KeepFields;
import androidx.lifecycle.LifecycleOwner;
import java.lang.annotation.Retention;
@@ -66,8 +68,8 @@
public final class Action {
/**
* The type of action represented by the {@link Action} instance.
- *
*/
+ @OptIn(markerClass = androidx.car.app.annotations.ExperimentalCarApi.class)
@RestrictTo(LIBRARY)
@IntDef(
value = {
@@ -75,6 +77,7 @@
TYPE_APP_ICON,
TYPE_BACK,
TYPE_PAN,
+ TYPE_COMPOSE_MESSAGE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ActionType {
@@ -82,7 +85,6 @@
/**
* The flag of action represented by the {@link Action} instance.
- *
*/
@RestrictTo(LIBRARY)
@IntDef(
@@ -123,6 +125,13 @@
public static final int TYPE_PAN = 4 | TYPE_STANDARD;
/**
+ * An action to allow user compose a message.
+ */
+ @ExperimentalCarApi
+ @RequiresCarApi(7)
+ public static final int TYPE_COMPOSE_MESSAGE = 5 | TYPE_STANDARD;
+
+ /**
* Indicates that this action is the most important one, out of a set of other actions.
*
* <p>The action with this flag may be treated differently by the host depending on where they
@@ -160,6 +169,16 @@
public static final Action APP_ICON = new Action(TYPE_APP_ICON);
/**
+ * A standard action to show the message compose button
+ *
+ * <p>This action is interactive.
+ */
+ @NonNull
+ @ExperimentalCarApi
+ @RequiresCarApi(7)
+ public static final Action COMPOSE_MESSAGE = new Action(TYPE_COMPOSE_MESSAGE);
+
+ /**
* A standard action to navigate back in the user interface.
*
* <p>The default behavior for a back press will call
@@ -275,6 +294,7 @@
/**
* Converts the given {@code type} into a string representation.
*/
+ @OptIn(markerClass = androidx.car.app.annotations.ExperimentalCarApi.class)
@NonNull
public static String typeToString(@ActionType int type) {
switch (type) {
@@ -286,6 +306,8 @@
return "BACK";
case TYPE_PAN:
return "PAN";
+ case TYPE_COMPOSE_MESSAGE:
+ return "COMPOSE_MESSAGE";
default:
return "<unknown>";
}
diff --git a/car/app/app/src/main/java/androidx/car/app/model/TabContents.java b/car/app/app/src/main/java/androidx/car/app/model/TabContents.java
index 84c1a68..0a7b5bd 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/TabContents.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/TabContents.java
@@ -28,7 +28,8 @@
import java.util.Objects;
/**
- * Represents the contents to display for a selected tab in a {@link TabTemplate}.
+ * Represents the contents to display for a selected tab in a {@link TabTemplate}. Only certain
+ * templates may be used as content. See {@link Builder#Builder(Template)} for more details.
*/
@CarProtocol
@RequiresCarApi(6)
@@ -112,17 +113,29 @@
* Creates a {@link TabContents.Builder} instance using the given {@link Template} to
* display as contents.
*
- * <h4>Requirements</h4>
+ * <p>There should be no title, Header {@link Action} or {@link ActionStrip} set on the
+ * template. The host will ignore these.
*
- * There should be no title, Header{@link Action} or {@link ActionStrip} set on the
- * template.
- * The host will ignore these.
+ * <p>From Car API 6 onward, the following template types are supported as content:
+ * <ul>
+ * <li>{@code ListTemplate}
+ * <li>{@code PaneTemplate}
+ * <li>{@code GridTemplate}
+ * <li>{@code MessageTemplate}
+ * <li>{@code SearchTemplate}
+ * </ul>
+ *
+ * <p>From Car API 7 onward, the following templates types are supported as content in
+ * addition to all previously supported template types:
+ * <ul>
+ * <li>{@code NavigationTemplate}
+ * </ul>
*
* @throws NullPointerException if {@code template} is null
* @throws IllegalArgumentException if {@code template} does not meet the requirements
*/
public Builder(@NonNull Template template) {
- TabContentsConstraints.DEFAULT.validateOrThrow(requireNonNull(template));
+ TabContentsConstraints.API_7.validateOrThrow(requireNonNull(template));
mTemplate = template;
}
}
diff --git a/car/app/app/src/main/java/androidx/car/app/model/TabTemplate.java b/car/app/app/src/main/java/androidx/car/app/model/TabTemplate.java
index fb8974a..ce84c5d 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/TabTemplate.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/TabTemplate.java
@@ -239,7 +239,9 @@
}
/**
- * Sets the {@link TabContents} to show in the template.
+ * Sets the {@link TabContents} to show in the template. Note that only certain templates
+ * may be used as content. See {@link TabContents.Builder#Builder(Template)} for more
+ * details.
*
* @throws NullPointerException if {@code tabContents} is null
*/
diff --git a/car/app/app/src/main/java/androidx/car/app/model/constraints/ActionsConstraints.java b/car/app/app/src/main/java/androidx/car/app/model/constraints/ActionsConstraints.java
index 182656b..b91efc0f 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/constraints/ActionsConstraints.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/constraints/ActionsConstraints.java
@@ -22,6 +22,8 @@
import static java.util.Objects.requireNonNull;
+import android.annotation.SuppressLint;
+
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
@@ -147,11 +149,13 @@
*
* <p>Only buttons with icons and background color are allowed.
*/
+ @SuppressLint("UnsafeOptInUsageError")
@NonNull
public static final ActionsConstraints ACTIONS_CONSTRAINTS_FAB =
new ActionsConstraints.Builder()
.setMaxActions(1)
.addAllowedActionType(Action.TYPE_CUSTOM)
+ .addAllowedActionType(Action.TYPE_COMPOSE_MESSAGE)
.setRequireActionIcons(true)
.setRequireActionBackgroundColor(true)
.setOnClickListenerAllowed(true)
diff --git a/car/app/app/src/main/java/androidx/car/app/model/constraints/TabContentsConstraints.java b/car/app/app/src/main/java/androidx/car/app/model/constraints/TabContentsConstraints.java
index fe60984..25f65df 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/constraints/TabContentsConstraints.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/constraints/TabContentsConstraints.java
@@ -26,6 +26,7 @@
import androidx.car.app.model.PaneTemplate;
import androidx.car.app.model.SearchTemplate;
import androidx.car.app.model.Template;
+import androidx.car.app.navigation.model.NavigationTemplate;
import java.util.Arrays;
import java.util.HashSet;
@@ -39,7 +40,10 @@
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class TabContentsConstraints {
- /** Allow restricted set of templates as contents for a tab **/
+ /**
+ * The set of allowed templates as content within a tab template since the introduction of the
+ * tab template (API 6).
+ */
@NonNull
public static final TabContentsConstraints DEFAULT =
new TabContentsConstraints(Arrays.asList(
@@ -49,6 +53,19 @@
MessageTemplate.class,
SearchTemplate.class
));
+
+ /** The set of allowed templates as content within a tab template since API 7. */
+ @NonNull
+ public static final TabContentsConstraints API_7 =
+ new TabContentsConstraints(Arrays.asList(
+ ListTemplate.class,
+ PaneTemplate.class,
+ GridTemplate.class,
+ MessageTemplate.class,
+ SearchTemplate.class,
+ NavigationTemplate.class
+ ));
+
private HashSet<Class<? extends Template>> mAllowedTemplateTypes;
/**
diff --git a/car/app/app/src/main/java/androidx/car/app/navigation/model/NavigationTemplate.java b/car/app/app/src/main/java/androidx/car/app/navigation/model/NavigationTemplate.java
index 94190e0..5c467cd 100644
--- a/car/app/app/src/main/java/androidx/car/app/navigation/model/NavigationTemplate.java
+++ b/car/app/app/src/main/java/androidx/car/app/navigation/model/NavigationTemplate.java
@@ -29,13 +29,13 @@
import androidx.car.app.Screen;
import androidx.car.app.SurfaceCallback;
import androidx.car.app.annotations.CarProtocol;
+import androidx.car.app.annotations.KeepFields;
import androidx.car.app.annotations.RequiresCarApi;
import androidx.car.app.model.Action;
import androidx.car.app.model.ActionStrip;
import androidx.car.app.model.CarColor;
import androidx.car.app.model.Template;
import androidx.car.app.model.Toggle;
-import androidx.car.app.annotations.KeepFields;
import java.util.Objects;
@@ -306,15 +306,17 @@
/**
* Sets the {@link TravelEstimate} to the final destination.
*
- * @throws IllegalArgumentException if the {@link TravelEstimate}'s remaining time is
- * {@link TravelEstimate#REMAINING_TIME_UNKNOWN} or less
- * than zero
+ * @throws IllegalArgumentException if the {@link TravelEstimate}'s remaining time is less
+ * than zero unless the value provided is
+ * {@link TravelEstimate#REMAINING_TIME_UNKNOWN}
* @throws NullPointerException if {@code destinationTravelEstimate} is {@code null}
*/
@NonNull
public Builder setDestinationTravelEstimate(
@NonNull TravelEstimate destinationTravelEstimate) {
- if (requireNonNull(destinationTravelEstimate).getRemainingTimeSeconds() < 0) {
+ if (requireNonNull(destinationTravelEstimate).getRemainingTimeSeconds() < 0
+ && requireNonNull(destinationTravelEstimate).getRemainingTimeSeconds()
+ != TravelEstimate.REMAINING_TIME_UNKNOWN) {
throw new IllegalArgumentException(
"The destination travel estimate's remaining time must be greater or "
+ "equal to zero");
diff --git a/car/app/app/src/main/java/androidx/car/app/navigation/model/PanModeDelegateImpl.java b/car/app/app/src/main/java/androidx/car/app/navigation/model/PanModeDelegateImpl.java
index 3bce717..72ef523 100644
--- a/car/app/app/src/main/java/androidx/car/app/navigation/model/PanModeDelegateImpl.java
+++ b/car/app/app/src/main/java/androidx/car/app/navigation/model/PanModeDelegateImpl.java
@@ -23,7 +23,6 @@
import android.annotation.SuppressLint;
import android.os.RemoteException;
-import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
@@ -33,8 +32,6 @@
import androidx.car.app.annotations.KeepFields;
import androidx.car.app.utils.RemoteUtils;
-import org.jetbrains.annotations.NotNull;
-
/**
* Implementation class for {@link PanModeDelegate}.
*
@@ -47,7 +44,7 @@
private final IPanModeListener mStub;
@Override
- public void sendPanModeChanged(boolean isInPanMode, @NonNull @NotNull OnDoneCallback callback) {
+ public void sendPanModeChanged(boolean isInPanMode, @NonNull OnDoneCallback callback) {
try {
requireNonNull(mStub).onPanModeChanged(isInPanMode,
RemoteUtils.createOnDoneCallbackStub(callback));
diff --git a/car/app/app/src/main/java/androidx/car/app/navigation/model/constraints/ContentTemplateConstraints.java b/car/app/app/src/main/java/androidx/car/app/navigation/model/constraints/ContentTemplateConstraints.java
index 8b84e57..dda27ab 100644
--- a/car/app/app/src/main/java/androidx/car/app/navigation/model/constraints/ContentTemplateConstraints.java
+++ b/car/app/app/src/main/java/androidx/car/app/navigation/model/constraints/ContentTemplateConstraints.java
@@ -37,7 +37,7 @@
@ExperimentalCarApi
@RequiresCarApi(7)
public class ContentTemplateConstraints {
- /** Allowed templates for Map with Content Templates **/
+ /** Allowed templates for Map with Content Templates */
@NonNull
public static final ContentTemplateConstraints MAP_WITH_CONTENT_TEMPLATE_CONSTRAINTS =
new ContentTemplateConstraints(ImmutableSet.of(
@@ -45,7 +45,7 @@
MessageTemplate.class
));
- /** Allowed templates for TabContents **/
+ /** Allowed templates for TabContents */
@NonNull
public static final ContentTemplateConstraints TAB_CONTENTS_CONSTRAINTS =
new ContentTemplateConstraints(ImmutableSet.of(
diff --git a/car/app/app/src/test/java/androidx/car/app/model/ListTemplateTest.java b/car/app/app/src/test/java/androidx/car/app/model/ListTemplateTest.java
index 1777bdf..b0c1369 100644
--- a/car/app/app/src/test/java/androidx/car/app/model/ListTemplateTest.java
+++ b/car/app/app/src/test/java/androidx/car/app/model/ListTemplateTest.java
@@ -263,6 +263,19 @@
}
@Test
+ public void createInstance_addComposeAction() {
+ CarIcon icon = TestUtils.getTestCarIcon(ApplicationProvider.getApplicationContext(),
+ "ic_test_1");
+ Action composeAction = Action.COMPOSE_MESSAGE;
+ ListTemplate template =
+ new ListTemplate.Builder()
+ .setSingleList(getList())
+ .addAction(composeAction)
+ .build();
+ assertThat(template.getActions()).containsExactly(composeAction);
+ }
+
+ @Test
public void createInstance_addAction_appIconInvalid_throws() {
assertThrows(
IllegalArgumentException.class,
diff --git a/car/app/app/src/test/java/androidx/car/app/model/TabContentsTest.java b/car/app/app/src/test/java/androidx/car/app/model/TabContentsTest.java
index bc16980..4b38369 100644
--- a/car/app/app/src/test/java/androidx/car/app/model/TabContentsTest.java
+++ b/car/app/app/src/test/java/androidx/car/app/model/TabContentsTest.java
@@ -21,6 +21,7 @@
import static org.junit.Assert.assertThrows;
import androidx.car.app.navigation.model.MapTemplate;
+import androidx.car.app.navigation.model.NavigationTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -74,6 +75,17 @@
}
@Test
+ public void createInstance_navigationTemplate() {
+ NavigationTemplate template =
+ new NavigationTemplate.Builder().setActionStrip(new ActionStrip.Builder().addAction(
+ new Action.Builder().setTitle("test").build()).build()).build();
+
+ TabContents tabContents = new TabContents.Builder(template).build();
+
+ assertEquals(template, tabContents.getTemplate());
+ }
+
+ @Test
public void equals() {
MessageTemplate template = new MessageTemplate.Builder("title")
.addAction(
diff --git a/car/app/app/src/test/java/androidx/car/app/navigation/model/NavigationTemplateTest.java b/car/app/app/src/test/java/androidx/car/app/navigation/model/NavigationTemplateTest.java
index 5edd1f2..aec4364 100644
--- a/car/app/app/src/test/java/androidx/car/app/navigation/model/NavigationTemplateTest.java
+++ b/car/app/app/src/test/java/androidx/car/app/navigation/model/NavigationTemplateTest.java
@@ -65,6 +65,40 @@
() -> new NavigationTemplate.Builder().setMapActionStrip(mActionStrip));
}
+ @Test
+ public void negativeValueInRemainingTimeSeconds_throws() {
+ assertThrows(IllegalArgumentException.class,
+ () -> createMinimalTemplateWithRemainingSeconds(-100));
+ }
+
+ @Test
+ public void unknownValueInRemainingTimeSeconds_works() {
+ NavigationTemplate navigationTemplate =
+ createMinimalTemplateWithRemainingSeconds(TravelEstimate.REMAINING_TIME_UNKNOWN);
+
+ assertThat(
+ navigationTemplate.getDestinationTravelEstimate().getRemainingTimeSeconds())
+ .isEqualTo(TravelEstimate.REMAINING_TIME_UNKNOWN);
+ }
+
+
+ private NavigationTemplate createMinimalTemplateWithRemainingSeconds(long remainingSeconds) {
+ TravelEstimate travelEstimate =
+ new TravelEstimate.Builder(
+ Distance.create(/* displayDistance= */ 20, Distance.UNIT_METERS),
+ createDateTimeWithZone("2020-05-14T19:57:00-07:00", "US/Pacific"))
+ .setRemainingTimeSeconds(remainingSeconds).build();
+
+ return new NavigationTemplate.Builder()
+ .setNavigationInfo(
+ new RoutingInfo.Builder().setCurrentStep(mCurrentStep,
+ mCurrentDistance).build())
+ .setActionStrip(mActionStrip)
+ .setDestinationTravelEstimate(travelEstimate)
+ .build();
+ }
+
+
/** Tests basic construction of a template with a minimal data. */
@Test
public void createMinimalInstance() {
@@ -209,10 +243,9 @@
@Test
public void notEquals_panModeListenerChange() {
NavigationTemplate template = new NavigationTemplate.Builder().setActionStrip(
- mActionStrip).setPanModeListener((isInPanMode) -> {}).build();
+ mActionStrip).setPanModeListener((isInPanMode) -> { }).build();
- assertThat(template)
- .isNotEqualTo(
+ assertThat(template).isNotEqualTo(
new NavigationTemplate.Builder()
.setActionStrip(mActionStrip)
.build());
diff --git a/collection/collection-benchmark-kmp/src/commonMain/kotlin/androidx/collection/LruCacheBenchmark.kt b/collection/collection-benchmark-kmp/src/commonMain/kotlin/androidx/collection/LruCacheBenchmark.kt
index 1e61af2..786de64 100644
--- a/collection/collection-benchmark-kmp/src/commonMain/kotlin/androidx/collection/LruCacheBenchmark.kt
+++ b/collection/collection-benchmark-kmp/src/commonMain/kotlin/androidx/collection/LruCacheBenchmark.kt
@@ -72,4 +72,4 @@
assertEquals(1, cache.hitCount())
assertEquals(1, cache.missCount())
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection-benchmark/src/androidTest/java/androidx/collection/CollectionBenchmarkExt.kt b/collection/collection-benchmark/src/androidTest/java/androidx/collection/CollectionBenchmarkExt.kt
index 352097d..a8968fd 100644
--- a/collection/collection-benchmark/src/androidTest/java/androidx/collection/CollectionBenchmarkExt.kt
+++ b/collection/collection-benchmark/src/androidTest/java/androidx/collection/CollectionBenchmarkExt.kt
@@ -21,4 +21,4 @@
internal fun BenchmarkRule.runCollectionBenchmark(benchmark: CollectionBenchmark) {
measureRepeated { benchmark.measuredBlock() }
-}
\ No newline at end of file
+}
diff --git a/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CircularArrayBenchmarks.kt b/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CircularArrayBenchmarks.kt
index aff075f..29ddb56 100644
--- a/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CircularArrayBenchmarks.kt
+++ b/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CircularArrayBenchmarks.kt
@@ -33,4 +33,4 @@
internal fun createSeed(size: Int): List<String> = List(size) {
"element $it"
-}
\ No newline at end of file
+}
diff --git a/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CollectionBenchmark.kt b/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CollectionBenchmark.kt
index ce3293d..8fb1beb 100644
--- a/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CollectionBenchmark.kt
+++ b/collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/CollectionBenchmark.kt
@@ -18,4 +18,4 @@
internal interface CollectionBenchmark {
fun measuredBlock()
-}
\ No newline at end of file
+}
diff --git a/collection/collection/build.gradle b/collection/collection/build.gradle
index afab27a..97c829e 100644
--- a/collection/collection/build.gradle
+++ b/collection/collection/build.gradle
@@ -90,12 +90,6 @@
}
}
- targets.withType(KotlinNativeTarget.class) {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
-
targets.all { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
diff --git a/collection/collection/src/commonMain/kotlin/androidx/collection/CircularArray.kt b/collection/collection/src/commonMain/kotlin/androidx/collection/CircularArray.kt
index 83dfc46..b3cb747 100644
--- a/collection/collection/src/commonMain/kotlin/androidx/collection/CircularArray.kt
+++ b/collection/collection/src/commonMain/kotlin/androidx/collection/CircularArray.kt
@@ -266,4 +266,4 @@
* @return `true` if [size] is 0.
*/
public fun isEmpty(): Boolean = head == tail
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonMain/kotlin/androidx/collection/IndexBasedArrayIterator.kt b/collection/collection/src/commonMain/kotlin/androidx/collection/IndexBasedArrayIterator.kt
index 549780e..7b88ba0 100644
--- a/collection/collection/src/commonMain/kotlin/androidx/collection/IndexBasedArrayIterator.kt
+++ b/collection/collection/src/commonMain/kotlin/androidx/collection/IndexBasedArrayIterator.kt
@@ -44,4 +44,4 @@
size--
canRemove = false
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonMain/kotlin/androidx/collection/internal/ContainerHelpers.kt b/collection/collection/src/commonMain/kotlin/androidx/collection/internal/ContainerHelpers.kt
index f75daf6..80710fc 100644
--- a/collection/collection/src/commonMain/kotlin/androidx/collection/internal/ContainerHelpers.kt
+++ b/collection/collection/src/commonMain/kotlin/androidx/collection/internal/ContainerHelpers.kt
@@ -86,4 +86,4 @@
}
}
return lo.inv() // value not present
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/ArraySetTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/ArraySetTest.kt
index 257a876..e754419 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/ArraySetTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/ArraySetTest.kt
@@ -217,4 +217,4 @@
set5.add(set5)
assertEquals("{1, one, (this Set)}", set5.toString())
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/CircularArrayTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/CircularArrayTest.kt
index b2077f8..25600d1 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/CircularArrayTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/CircularArrayTest.kt
@@ -151,4 +151,4 @@
array.popLast()
}
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/CircularIntArrayTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/CircularIntArrayTest.kt
index 3574b22..a07d297 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/CircularIntArrayTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/CircularIntArrayTest.kt
@@ -130,4 +130,4 @@
}
assertEquals(expectedSize, array.size())
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/IndexBasedArrayIteratorTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/IndexBasedArrayIteratorTest.kt
index 6ff715e..74a9268 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/IndexBasedArrayIteratorTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/IndexBasedArrayIteratorTest.kt
@@ -137,4 +137,4 @@
add(item)
}
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/LongSparseArrayTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/LongSparseArrayTest.kt
index f12e234..b9e75e1 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/LongSparseArrayTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/LongSparseArrayTest.kt
@@ -266,4 +266,4 @@
assertEquals(1L, dest[1L])
assertEquals("two", dest[2L])
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/SimpleArrayMapTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/SimpleArrayMapTest.kt
index 0ae476f..2289824 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/SimpleArrayMapTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/SimpleArrayMapTest.kt
@@ -327,4 +327,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/commonTest/kotlin/androidx/collection/internal/LruHashMapTest.kt b/collection/collection/src/commonTest/kotlin/androidx/collection/internal/LruHashMapTest.kt
index 77bba6b..3702e9f 100644
--- a/collection/collection/src/commonTest/kotlin/androidx/collection/internal/LruHashMapTest.kt
+++ b/collection/collection/src/commonTest/kotlin/androidx/collection/internal/LruHashMapTest.kt
@@ -105,4 +105,4 @@
assertContentEquals(listOf("b" to "B", "a" to "A"), list)
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/darwinMain/kotlin/androidx.collection.internal/Lock.mac.kt b/collection/collection/src/darwinMain/kotlin/androidx.collection.internal/Lock.mac.kt
index f981d94..0f76eb1 100644
--- a/collection/collection/src/darwinMain/kotlin/androidx.collection.internal/Lock.mac.kt
+++ b/collection/collection/src/darwinMain/kotlin/androidx.collection.internal/Lock.mac.kt
@@ -16,4 +16,4 @@
package androidx.collection.internal
-internal actual val PTHREAD_MUTEX_RECURSIVE: Int = platform.posix.PTHREAD_MUTEX_RECURSIVE
\ No newline at end of file
+internal actual val PTHREAD_MUTEX_RECURSIVE: Int = platform.posix.PTHREAD_MUTEX_RECURSIVE
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapCompatTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapCompatTest.kt
index f5b9e8e..5cbe950 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapCompatTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapCompatTest.kt
@@ -82,4 +82,4 @@
val array = map.entries.toTypedArray()
assertEquals(2, array.size)
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapExtensionsTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapExtensionsTest.kt
index e326e0f..2709310 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapExtensionsTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapExtensionsTest.kt
@@ -38,4 +38,4 @@
val map = arrayMapOf("foo" to "bar", "foo" to "baz")
assertThat(map).containsExactly("foo", "baz")
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapTest.kt
index c38514e..5891004 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArrayMapTest.kt
@@ -164,4 +164,4 @@
map.remove("c")
assertContentEquals(map.values, listOf(1))
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetCompatTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetCompatTest.kt
index 12d96a4..68540e0 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetCompatTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetCompatTest.kt
@@ -36,4 +36,4 @@
iterator.next()
}
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetExtensionsTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetExtensionsTest.kt
index 6575af7..43c7ca8 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetExtensionsTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetExtensionsTest.kt
@@ -32,4 +32,4 @@
val set = arraySetOf("foo", "bar", "baz")
assertThat(set).containsExactly("foo", "bar", "baz")
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetJvmTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetJvmTest.kt
index df77ccc..18b21f1 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetJvmTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/ArraySetJvmTest.kt
@@ -44,4 +44,4 @@
val result: Array<Int> = set.toArray(Array(10) { -1 })
assertNull(result[5])
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/LongSparseArrayJvmTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/LongSparseArrayJvmTest.kt
index df45728..4be7a39 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/LongSparseArrayJvmTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/LongSparseArrayJvmTest.kt
@@ -36,4 +36,4 @@
assertEquals(source.valueAt(i), dest.valueAt(i))
}
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/jvmTest/kotlin/androidx/collection/SimpleArrayMapJvmTest.kt b/collection/collection/src/jvmTest/kotlin/androidx/collection/SimpleArrayMapJvmTest.kt
index 35d6c1bf..695c50d 100644
--- a/collection/collection/src/jvmTest/kotlin/androidx/collection/SimpleArrayMapJvmTest.kt
+++ b/collection/collection/src/jvmTest/kotlin/androidx/collection/SimpleArrayMapJvmTest.kt
@@ -66,4 +66,4 @@
}
done.set(true)
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/linuxMain/kotlin/androidx/collection/internal/Lock.linux.kt b/collection/collection/src/linuxMain/kotlin/androidx/collection/internal/Lock.linux.kt
index c7966f9..52c2982 100644
--- a/collection/collection/src/linuxMain/kotlin/androidx/collection/internal/Lock.linux.kt
+++ b/collection/collection/src/linuxMain/kotlin/androidx/collection/internal/Lock.linux.kt
@@ -16,4 +16,4 @@
package androidx.collection.internal
-internal actual val PTHREAD_MUTEX_RECURSIVE: Int = platform.posix.PTHREAD_MUTEX_RECURSIVE.toInt()
\ No newline at end of file
+internal actual val PTHREAD_MUTEX_RECURSIVE: Int = platform.posix.PTHREAD_MUTEX_RECURSIVE.toInt()
diff --git a/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt b/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
index 678d982..20777ea 100644
--- a/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
+++ b/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
@@ -23,4 +23,4 @@
internal actual inline fun createIndexOutOfBoundsException(): IndexOutOfBoundsException {
return ArrayIndexOutOfBoundsException()
}
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/nativeMain/kotlin/androidx/collection/LongSparseArray.native.kt b/collection/collection/src/nativeMain/kotlin/androidx/collection/LongSparseArray.native.kt
index 1c6afd7..c36ee48 100644
--- a/collection/collection/src/nativeMain/kotlin/androidx/collection/LongSparseArray.native.kt
+++ b/collection/collection/src/nativeMain/kotlin/androidx/collection/LongSparseArray.native.kt
@@ -230,4 +230,4 @@
* itself as a value, the string "(this Map)" will appear in its place.
*/
actual override fun toString(): String = commonToString()
-}
\ No newline at end of file
+}
diff --git a/collection/collection/src/nativeTest/kotlin/androidx/collection/internal/MemoryModelTest.kt b/collection/collection/src/nativeTest/kotlin/androidx/collection/internal/MemoryModelTest.kt
index 63e694e..e5982dd 100644
--- a/collection/collection/src/nativeTest/kotlin/androidx/collection/internal/MemoryModelTest.kt
+++ b/collection/collection/src/nativeTest/kotlin/androidx/collection/internal/MemoryModelTest.kt
@@ -26,4 +26,4 @@
fun newMemoryModelEnabled() {
assertTrue(isExperimentalMM())
}
-}
\ No newline at end of file
+}
diff --git a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/CircularIntArrayKotlin.kt b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/CircularIntArrayKotlin.kt
index 5b01fba..68018c7 100644
--- a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/CircularIntArrayKotlin.kt
+++ b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/CircularIntArrayKotlin.kt
@@ -33,4 +33,4 @@
circularIntArray.size() == 0 &&
circularIntArray.first.equals(circularIntArray.last) &&
circularIntArray.popFirst().equals(circularIntArray.popLast())
-}
\ No newline at end of file
+}
diff --git a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/LongSparseArrayKotlin.kt b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/LongSparseArrayKotlin.kt
index 6271d2d..4fe545f 100644
--- a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/LongSparseArrayKotlin.kt
+++ b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/LongSparseArrayKotlin.kt
@@ -145,4 +145,4 @@
array.containsValue(0) && array.remove(0, 0) && array.replace(0, 0, 1) &&
array.replace(0, 0) == null && array.indexOfKey(0) == array.indexOfValue(0) &&
array.valueAt(3) == 0
-}
\ No newline at end of file
+}
diff --git a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/SparseArrayCompatKotlin.kt b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/SparseArrayCompatKotlin.kt
index bda1593..f32c96e 100644
--- a/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/SparseArrayCompatKotlin.kt
+++ b/collection/integration-tests/testapp/src/main/kotlin/androidx/collection/integration/SparseArrayCompatKotlin.kt
@@ -154,4 +154,4 @@
// Operator access
@Suppress("UNUSED_VARIABLE")
val returnsNullable = sparseArray[0] == null
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/api/current.txt b/compose/animation/animation-core/api/current.txt
index f6e8e56..d1a61aa 100644
--- a/compose/animation/animation-core/api/current.txt
+++ b/compose/animation/animation-core/api/current.txt
@@ -239,7 +239,7 @@
public final class DecayAnimationSpecKt {
method public static float calculateTargetValue(androidx.compose.animation.core.DecayAnimationSpec<java.lang.Float>, float initialValue, float initialVelocity);
method public static <T, V extends androidx.compose.animation.core.AnimationVector> T calculateTargetValue(androidx.compose.animation.core.DecayAnimationSpec<T>, androidx.compose.animation.core.TwoWayConverter<T,V> typeConverter, T initialValue, T initialVelocity);
- method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> exponentialDecay(optional float frictionMultiplier, optional float absVelocityThreshold);
+ method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> exponentialDecay(optional @FloatRange(from=0.0, fromInclusive=false) float frictionMultiplier, optional @FloatRange(from=0.0, fromInclusive=false) float absVelocityThreshold);
method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> generateDecayAnimationSpec(androidx.compose.animation.core.FloatDecayAnimationSpec);
}
@@ -358,7 +358,7 @@
}
public final class FloatExponentialDecaySpec implements androidx.compose.animation.core.FloatDecayAnimationSpec {
- ctor public FloatExponentialDecaySpec(optional float frictionMultiplier, optional float absVelocityThreshold);
+ ctor public FloatExponentialDecaySpec(optional @FloatRange(from=0.0, fromInclusive=false) float frictionMultiplier, optional @FloatRange(from=0.0, fromInclusive=false) float absVelocityThreshold);
method public float getAbsVelocityThreshold();
method public long getDurationNanos(float initialValue, float initialVelocity);
method public float getTargetValue(float initialValue, float initialVelocity);
@@ -450,15 +450,15 @@
public static final class KeyframesSpec.KeyframesSpecConfig<T> {
ctor public KeyframesSpec.KeyframesSpecConfig();
- method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> at(T, int timeStamp);
+ method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> at(T, @IntRange(from=0L) int timeStamp);
method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> atFraction(T, float fraction);
- method public int getDelayMillis();
- method public int getDurationMillis();
+ method @IntRange(from=0L) public int getDelayMillis();
+ method @IntRange(from=0L) public int getDurationMillis();
method public void setDelayMillis(int);
method public void setDurationMillis(int);
method public infix void with(androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T>, androidx.compose.animation.core.Easing easing);
- property public final int delayMillis;
- property public final int durationMillis;
+ property @IntRange(from=0L) public final int delayMillis;
+ property @IntRange(from=0L) public final int durationMillis;
}
public final class MutableTransitionState<S> {
diff --git a/compose/animation/animation-core/api/restricted_current.txt b/compose/animation/animation-core/api/restricted_current.txt
index 091fb90..23c18bd 100644
--- a/compose/animation/animation-core/api/restricted_current.txt
+++ b/compose/animation/animation-core/api/restricted_current.txt
@@ -239,7 +239,7 @@
public final class DecayAnimationSpecKt {
method public static float calculateTargetValue(androidx.compose.animation.core.DecayAnimationSpec<java.lang.Float>, float initialValue, float initialVelocity);
method public static <T, V extends androidx.compose.animation.core.AnimationVector> T calculateTargetValue(androidx.compose.animation.core.DecayAnimationSpec<T>, androidx.compose.animation.core.TwoWayConverter<T,V> typeConverter, T initialValue, T initialVelocity);
- method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> exponentialDecay(optional float frictionMultiplier, optional float absVelocityThreshold);
+ method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> exponentialDecay(optional @FloatRange(from=0.0, fromInclusive=false) float frictionMultiplier, optional @FloatRange(from=0.0, fromInclusive=false) float absVelocityThreshold);
method public static <T> androidx.compose.animation.core.DecayAnimationSpec<T> generateDecayAnimationSpec(androidx.compose.animation.core.FloatDecayAnimationSpec);
}
@@ -358,7 +358,7 @@
}
public final class FloatExponentialDecaySpec implements androidx.compose.animation.core.FloatDecayAnimationSpec {
- ctor public FloatExponentialDecaySpec(optional float frictionMultiplier, optional float absVelocityThreshold);
+ ctor public FloatExponentialDecaySpec(optional @FloatRange(from=0.0, fromInclusive=false) float frictionMultiplier, optional @FloatRange(from=0.0, fromInclusive=false) float absVelocityThreshold);
method public float getAbsVelocityThreshold();
method public long getDurationNanos(float initialValue, float initialVelocity);
method public float getTargetValue(float initialValue, float initialVelocity);
@@ -450,15 +450,15 @@
public static final class KeyframesSpec.KeyframesSpecConfig<T> {
ctor public KeyframesSpec.KeyframesSpecConfig();
- method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> at(T, int timeStamp);
+ method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> at(T, @IntRange(from=0L) int timeStamp);
method public infix androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T> atFraction(T, float fraction);
- method public int getDelayMillis();
- method public int getDurationMillis();
+ method @IntRange(from=0L) public int getDelayMillis();
+ method @IntRange(from=0L) public int getDurationMillis();
method public void setDelayMillis(int);
method public void setDurationMillis(int);
method public infix void with(androidx.compose.animation.core.KeyframesSpec.KeyframeEntity<T>, androidx.compose.animation.core.Easing easing);
- property public final int delayMillis;
- property public final int durationMillis;
+ property @IntRange(from=0L) public final int delayMillis;
+ property @IntRange(from=0L) public final int durationMillis;
}
public final class MutableTransitionState<S> {
diff --git a/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/AnimationBenchmark.kt b/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/AnimationBenchmark.kt
index f004d5e..5f2009a 100644
--- a/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/AnimationBenchmark.kt
+++ b/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/AnimationBenchmark.kt
@@ -162,4 +162,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/SpringEstimationBenchmark.kt b/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/SpringEstimationBenchmark.kt
index 0c15e61..e926920 100644
--- a/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/SpringEstimationBenchmark.kt
+++ b/compose/animation/animation-core/benchmark/src/androidTest/java/androidx/compose/animation/core/benchmark/SpringEstimationBenchmark.kt
@@ -77,4 +77,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/AnimationSpecSamples.kt b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/AnimationSpecSamples.kt
index 96ce4ce..67a0111 100644
--- a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/AnimationSpecSamples.kt
+++ b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/AnimationSpecSamples.kt
@@ -83,4 +83,4 @@
Dot(scale2)
Dot(scale3)
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/SuspendAnimationSamples.kt b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/SuspendAnimationSamples.kt
index 01fb138..36b34c8 100644
--- a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/SuspendAnimationSamples.kt
+++ b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/SuspendAnimationSamples.kt
@@ -104,4 +104,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/TransitionSamples.kt b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/TransitionSamples.kt
index 7d04945..eb08b78 100644
--- a/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/TransitionSamples.kt
+++ b/compose/animation/animation-core/samples/src/main/java/androidx/compose/animation/core/samples/TransitionSamples.kt
@@ -446,4 +446,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/androidAndroidTest/kotlin/androidx/compose/animation/core/TransitionTest.kt b/compose/animation/animation-core/src/androidAndroidTest/kotlin/androidx/compose/animation/core/TransitionTest.kt
index 8135f03..d6e9272 100644
--- a/compose/animation/animation-core/src/androidAndroidTest/kotlin/androidx/compose/animation/core/TransitionTest.kt
+++ b/compose/animation/animation-core/src/androidAndroidTest/kotlin/androidx/compose/animation/core/TransitionTest.kt
@@ -446,4 +446,4 @@
assertEquals(0f, childTransitionFloat.value)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationEndReason.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationEndReason.kt
index 0a9dad9..0e56e86 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationEndReason.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationEndReason.kt
@@ -33,4 +33,4 @@
* Animation has finished successfully without any interruption.
*/
Finished
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
index 78eb1f6..e280595 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt
@@ -16,6 +16,7 @@
package androidx.compose.animation.core
+import androidx.annotation.IntRange
import androidx.compose.animation.core.AnimationConstants.DefaultDurationMillis
import androidx.compose.animation.core.KeyframesSpec.KeyframesSpecConfig
import androidx.compose.runtime.Immutable
@@ -421,14 +422,14 @@
* Duration of the animation in milliseconds. The minimum is `0` and defaults to
* [DefaultDurationMillis]
*/
- /*@IntRange(from = 0)*/
+ @get:IntRange(from = 0)
var durationMillis: Int = DefaultDurationMillis
/**
* The amount of time that the animation should be delayed. The minimum is `0` and defaults
* to 0.
*/
- /*@IntRange(from = 0)*/
+ @get:IntRange(from = 0)
var delayMillis: Int = 0
internal val keyframes = mutableMapOf<Int, KeyframeEntity<T>>()
@@ -442,7 +443,7 @@
* @return an [KeyframeEntity] so a custom [Easing] can be added by [with] method.
*/
// TODO: Need a IntRange equivalent annotation
- infix fun T.at(/*@IntRange(from = 0)*/ timeStamp: Int): KeyframeEntity<T> {
+ infix fun T.at(@IntRange(from = 0) timeStamp: Int): KeyframeEntity<T> {
return KeyframeEntity(this).also {
keyframes[timeStamp] = it
}
@@ -654,4 +655,4 @@
* @param delayMillis the number of milliseconds to wait before the animation runs. 0 by default.
*/
@Stable
-fun <T> snap(delayMillis: Int = 0) = SnapSpec<T>(delayMillis)
\ No newline at end of file
+fun <T> snap(delayMillis: Int = 0) = SnapSpec<T>(delayMillis)
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ComplexDouble.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ComplexDouble.kt
index 1bc18567..50e8854 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ComplexDouble.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ComplexDouble.kt
@@ -109,4 +109,4 @@
internal inline operator fun Double.times(other: ComplexDouble): ComplexDouble {
return other * this
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/DecayAnimationSpec.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/DecayAnimationSpec.kt
index 959c2d5..58a3561 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/DecayAnimationSpec.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/DecayAnimationSpec.kt
@@ -16,6 +16,7 @@
package androidx.compose.animation.core
+import androidx.annotation.FloatRange
import androidx.compose.ui.unit.IntOffset
/**
@@ -99,15 +100,15 @@
* Must be greater than `0`.
*/
fun <T> exponentialDecay(
- /*@FloatRange(
+ @FloatRange(
from = 0.0,
fromInclusive = false
- )*/
+ )
frictionMultiplier: Float = 1f,
- /*@FloatRange(
+ @FloatRange(
from = 0.0,
fromInclusive = false
- )*/
+ )
absVelocityThreshold: Float = 0.1f
): DecayAnimationSpec<T> =
FloatExponentialDecaySpec(frictionMultiplier, absVelocityThreshold).generateDecayAnimationSpec()
@@ -190,4 +191,4 @@
}
return targetVector
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Expect.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Expect.kt
index e0b26ae..a87a64c 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Expect.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Expect.kt
@@ -23,4 +23,4 @@
fun set(value: V)
fun getAndSet(value: V): V
fun compareAndSet(expect: V, newValue: V): Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalTransitionApi.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalTransitionApi.kt
index 8fd3df7..7aeadaa 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalTransitionApi.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/ExperimentalTransitionApi.kt
@@ -20,4 +20,4 @@
message = "This is an experimental animation API for Transition. It may change in the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalTransitionApi
\ No newline at end of file
+annotation class ExperimentalTransitionApi
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.kt
index 98cc051..8790428 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.kt
@@ -16,6 +16,7 @@
package androidx.compose.animation.core
+import androidx.annotation.FloatRange
import kotlin.math.abs
import kotlin.math.exp
import kotlin.math.ln
@@ -99,15 +100,15 @@
* rest for the animation to finish.
*/
class FloatExponentialDecaySpec(
- /*@FloatRange(
+ @FloatRange(
from = 0.0,
fromInclusive = false
- )*/
+ )
frictionMultiplier: Float = 1f,
- /*@FloatRange(
+ @FloatRange(
from = 0.0,
fromInclusive = false
- )*/
+ )
absVelocityThreshold: Float = 0.1f
) : FloatDecayAnimationSpec {
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InternalAnimationApi.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InternalAnimationApi.kt
index d87eb4c..eb2cf15 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InternalAnimationApi.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/InternalAnimationApi.kt
@@ -22,4 +22,4 @@
AnnotationTarget.FIELD, AnnotationTarget.PROPERTY_GETTER
)
@Retention(AnnotationRetention.BINARY)
-annotation class InternalAnimationApi
\ No newline at end of file
+annotation class InternalAnimationApi
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
index 7ae4fe0..3e9edc1 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
@@ -254,7 +254,7 @@
get() = _animations
// Seeking related
- /** @suppress **/
+ /** @suppress */
@InternalAnimationApi
var isSeeking: Boolean by mutableStateOf(false)
internal set
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorConverters.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorConverters.kt
index e3354a9..b3a5747 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorConverters.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorConverters.kt
@@ -192,4 +192,4 @@
convertFromVector = {
Rect(it.v1, it.v2, it.v3, it.v4)
}
- )
\ No newline at end of file
+ )
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VisibilityThresholds.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VisibilityThresholds.kt
index 7293a1b..89aaa6e 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VisibilityThresholds.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VisibilityThresholds.kt
@@ -111,4 +111,4 @@
Offset.VectorConverter to PxVisibilityThreshold,
Dp.VectorConverter to DpVisibilityThreshold,
DpOffset.VectorConverter to DpVisibilityThreshold
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/ActualJvm.kt b/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/ActualJvm.kt
index 537e0ce..de959d5 100644
--- a/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/ActualJvm.kt
+++ b/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/ActualJvm.kt
@@ -18,4 +18,4 @@
package androidx.compose.animation.core
-internal actual typealias AtomicReference<V> = java.util.concurrent.atomic.AtomicReference<V>
\ No newline at end of file
+internal actual typealias AtomicReference<V> = java.util.concurrent.atomic.AtomicReference<V>
diff --git a/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.jvm.kt
index 6367424..e7a00d2 100644
--- a/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/animation/animation-core/src/jvmMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.animation.core.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/AnimationVectorTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/AnimationVectorTest.kt
index b71db2e..3683f26 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/AnimationVectorTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/AnimationVectorTest.kt
@@ -91,4 +91,4 @@
AnimationVector(1f, 2f, 3f, 4f)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/DurationScaleTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/DurationScaleTest.kt
index f4421da9..ed39954 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/DurationScaleTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/DurationScaleTest.kt
@@ -59,4 +59,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/MotionTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/MotionTest.kt
index 5ab7215..ddc271f 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/MotionTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/MotionTest.kt
@@ -44,4 +44,4 @@
Assert.assertEquals(100f, copy.value)
Assert.assertEquals(300f, copy.velocity)
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/PhysicsAnimationTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/PhysicsAnimationTest.kt
index 0f93629..6157268 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/PhysicsAnimationTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/PhysicsAnimationTest.kt
@@ -317,4 +317,4 @@
it.dampingRatio = dampingRatio
it.stiffness = stiffness
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/RepeatableAnimationTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/RepeatableAnimationTest.kt
index 919aedb..bb4d20b 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/RepeatableAnimationTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/RepeatableAnimationTest.kt
@@ -293,4 +293,4 @@
private val DelayDuration = 13
private val Duration = 50
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/SpringEstimationTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/SpringEstimationTest.kt
index 9b0281d..8cc46e2 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/SpringEstimationTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/SpringEstimationTest.kt
@@ -227,4 +227,4 @@
val testCase: TestCase,
val reason: String = ""
)
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/TypeConverterTest.kt b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/TypeConverterTest.kt
index 1b3711c..81b503b 100644
--- a/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/TypeConverterTest.kt
+++ b/compose/animation/animation-core/src/test/java/androidx/compose/animation/core/TypeConverterTest.kt
@@ -35,4 +35,4 @@
assertEquals(100f, Int.VectorConverter.convertToVector(100).value)
assertEquals(5, Int.VectorConverter.convertFromVector(AnimationVector1D(5f)))
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation-graphics/build.gradle b/compose/animation/animation-graphics/build.gradle
index dacdfee..4faa4b5 100644
--- a/compose/animation/animation-graphics/build.gradle
+++ b/compose/animation/animation-graphics/build.gradle
@@ -120,7 +120,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/compose/animation/animation-graphics/src/androidAndroidTest/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResourcesTest.kt b/compose/animation/animation-graphics/src/androidAndroidTest/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResourcesTest.kt
new file mode 100644
index 0000000..2f4bbd2
--- /dev/null
+++ b/compose/animation/animation-graphics/src/androidAndroidTest/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResourcesTest.kt
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.animation.graphics.res
+
+import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
+import androidx.compose.animation.graphics.test.R
+import androidx.compose.animation.graphics.vector.AnimatedImageVector
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.ui.graphics.vector.VectorConfig
+import androidx.compose.ui.graphics.vector.VectorProperty
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.LargeTest
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@OptIn(ExperimentalAnimationGraphicsApi::class)
+@LargeTest
+@RunWith(AndroidJUnit4::class)
+class AnimatedVectorPainterResourcesTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun vectorConfig() {
+ val isAtEnd = mutableStateOf(false)
+ var checked = false
+ rule.setContent {
+ val avd = AnimatedImageVector.animatedVectorResource(R.drawable.avd_complex)
+ rememberAnimatedVectorPainter(
+ animatedImageVector = avd,
+ atEnd = isAtEnd.value
+ ) { _, map ->
+ if (!checked) {
+ assertThat(map).containsKey("background")
+ val config = map["background"] as VectorConfig
+ val fill = config.getOrDefault(VectorProperty.Fill, null)
+ assertThat(fill).isNotNull()
+ val stroke = config.getOrDefault(VectorProperty.Stroke, null)
+ assertThat(stroke).isNull()
+ checked = true
+ }
+ }
+ }
+ rule.runOnIdle { isAtEnd.value = true }
+ rule.waitForIdle()
+ assertThat(checked).isTrue()
+ }
+
+ @Test
+ fun targetDuplicated() {
+ val isAtEnd = mutableStateOf(false)
+ var checked = false
+ rule.setContent {
+ val avd = AnimatedImageVector.animatedVectorResource(R.drawable.target_duplicated)
+ rememberAnimatedVectorPainter(
+ animatedImageVector = avd,
+ atEnd = isAtEnd.value
+ ) { _, map ->
+ if (!checked) {
+ assertThat(map).containsKey("line_01")
+ val config = map["line_01"] as VectorConfig
+ val strokeWidth = config.getOrDefault(VectorProperty.StrokeLineWidth, 0f)
+ assertThat(strokeWidth).isNotEqualTo(0f)
+ val stroke = config.getOrDefault(VectorProperty.Stroke, null)
+ assertThat(stroke).isNotNull()
+ checked = true
+ }
+ }
+ }
+ rule.runOnIdle { isAtEnd.value = true }
+ rule.waitForIdle()
+ assertThat(checked).isTrue()
+ }
+}
diff --git a/compose/animation/animation-graphics/src/androidAndroidTest/res/drawable/target_duplicated.xml b/compose/animation/animation-graphics/src/androidAndroidTest/res/drawable/target_duplicated.xml
new file mode 100644
index 0000000..88254bba
--- /dev/null
+++ b/compose/animation/animation-graphics/src/androidAndroidTest/res/drawable/target_duplicated.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt">
+ <target android:name="line_01">
+ <aapt:attr name="android:animation">
+ <objectAnimator
+ android:duration="1000"
+ android:propertyName="strokeColor"
+ android:valueFrom="#ff0000"
+ android:valueTo="#0000ff"
+ android:valueType="colorType" />
+ </aapt:attr>
+ </target>
+ <target android:name="line_01">
+ <aapt:attr name="android:animation">
+ <objectAnimator
+ android:duration="1000"
+ android:propertyName="strokeWidth"
+ android:valueFrom="1"
+ android:valueTo="4"
+ android:valueType="floatType" />
+ </aapt:attr>
+ </target>
+ <aapt:attr name="android:drawable">
+ <vector
+ android:width="30dp"
+ android:height="30dp"
+ android:viewportHeight="30"
+ android:viewportWidth="30">
+ <path
+ android:name="line_01"
+ android:pathData=" M0,15 L30,15 "
+ android:strokeAlpha="1"
+ android:strokeColor="#ffffff"
+ android:strokeLineCap="round"
+ android:strokeLineJoin="round"
+ android:strokeWidth="1" />
+ </vector>
+ </aapt:attr>
+</animated-vector>
diff --git a/compose/animation/animation-graphics/src/androidMain/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResources.android.kt b/compose/animation/animation-graphics/src/androidMain/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResources.android.kt
index d444652..58544fd 100644
--- a/compose/animation/animation-graphics/src/androidMain/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResources.android.kt
+++ b/compose/animation/animation-graphics/src/androidMain/kotlin/androidx/compose/animation/graphics/res/AnimatedVectorPainterResources.android.kt
@@ -16,9 +16,11 @@
package androidx.compose.animation.graphics.res
+import androidx.annotation.VisibleForTesting
import androidx.compose.animation.core.updateTransition
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
import androidx.compose.animation.graphics.vector.AnimatedImageVector
+import androidx.compose.animation.graphics.vector.StateVectorConfig
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.RenderVectorGroup
@@ -48,8 +50,9 @@
}
@ExperimentalAnimationGraphicsApi
+@VisibleForTesting
@Composable
-private fun rememberAnimatedVectorPainter(
+internal fun rememberAnimatedVectorPainter(
animatedImageVector: AnimatedImageVector,
atEnd: Boolean,
render: @Composable @VectorComposable (VectorGroup, Map<String, VectorConfig>) -> Unit
@@ -65,14 +68,19 @@
autoMirror = true
) { _, _ ->
val transition = updateTransition(atEnd, label = animatedImageVector.imageVector.name)
- render(
- animatedImageVector.imageVector.root,
- animatedImageVector.targets.associate { target ->
- target.name to target.animator.createVectorConfig(
- transition,
- animatedImageVector.totalDuration
- )
+ val map = mutableMapOf<String, StateVectorConfig>()
+ for (target in animatedImageVector.targets) {
+ val config = target.animator.createVectorConfig(
+ transition,
+ animatedImageVector.totalDuration
+ )
+ val currentConfig = map[target.name]
+ if (currentConfig != null) {
+ currentConfig.merge(config)
+ } else {
+ map[target.name] = config
}
- )
+ }
+ render(animatedImageVector.imageVector.root, map)
}
}
diff --git a/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/compose-animation-graphics-documentation.md b/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/compose-animation-graphics-documentation.md
index 32cb6cd..e3e9103 100644
--- a/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/compose-animation-graphics-documentation.md
+++ b/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/compose-animation-graphics-documentation.md
@@ -2,7 +2,7 @@
Compose Animation Graphics
-# Package androidx.compose.anamition.graphics
+# Package androidx.compose.animation.graphics
In this page, you'll find documentation for types, properties, and functions available in the
`androidx.compose.animation.graphics` package.
diff --git a/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/vector/Animator.kt b/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/vector/Animator.kt
index 483a690..37fa401 100644
--- a/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/vector/Animator.kt
+++ b/compose/animation/animation-graphics/src/commonMain/kotlin/androidx/compose/animation/graphics/vector/Animator.kt
@@ -50,7 +50,7 @@
fun createVectorConfig(
transition: Transition<Boolean>,
overallDuration: Int
- ): VectorConfig {
+ ): StateVectorConfig {
return remember { StateVectorConfig() }.also { config ->
Configure(transition, config, overallDuration)
}
@@ -485,6 +485,25 @@
is VectorProperty.TrimPathOffset -> trimPathOffsetState?.value ?: defaultValue
} as T
}
+
+ fun merge(config: StateVectorConfig) {
+ if (config.rotationState != null) rotationState = config.rotationState
+ if (config.pivotXState != null) pivotXState = config.pivotXState
+ if (config.pivotYState != null) pivotYState = config.pivotYState
+ if (config.scaleXState != null) scaleXState = config.scaleXState
+ if (config.scaleYState != null) scaleYState = config.scaleYState
+ if (config.translateXState != null) translateXState = config.translateXState
+ if (config.translateYState != null) translateYState = config.translateYState
+ if (config.pathDataState != null) pathDataState = config.pathDataState
+ if (config.fillColorState != null) fillColorState = config.fillColorState
+ if (config.strokeColorState != null) strokeColorState = config.strokeColorState
+ if (config.strokeWidthState != null) strokeWidthState = config.strokeWidthState
+ if (config.strokeAlphaState != null) strokeAlphaState = config.strokeAlphaState
+ if (config.fillAlphaState != null) fillAlphaState = config.fillAlphaState
+ if (config.trimPathStartState != null) trimPathStartState = config.trimPathStartState
+ if (config.trimPathEndState != null) trimPathEndState = config.trimPathEndState
+ if (config.trimPathOffsetState != null) trimPathOffsetState = config.trimPathOffsetState
+ }
}
private fun lerp(start: List<PathNode>, stop: List<PathNode>, fraction: Float): List<PathNode> {
diff --git a/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/ComposeAnimatedProperty.kt b/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/ComposeAnimatedProperty.kt
index 8c29d14..5e8cd6a 100644
--- a/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/ComposeAnimatedProperty.kt
+++ b/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/ComposeAnimatedProperty.kt
@@ -22,4 +22,4 @@
* @property label The property text representation.
* @property value The value associated with the property at a given time.
*/
-public data class ComposeAnimatedProperty(val label: String, val value: Any)
\ No newline at end of file
+public data class ComposeAnimatedProperty(val label: String, val value: Any)
diff --git a/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/TransitionInfo.kt b/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/TransitionInfo.kt
index 63bee77..ce658de 100644
--- a/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/TransitionInfo.kt
+++ b/compose/animation/animation-tooling-internal/src/main/java/androidx/compose/animation/tooling/TransitionInfo.kt
@@ -30,4 +30,4 @@
public val startTimeMillis: Long,
public val endTimeMillis: Long,
public val values: Map<Long, Any?>
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/SpringChainDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/SpringChainDemo.kt
index fdeb465..e1f0049 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/SpringChainDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/SpringChainDemo.kt
@@ -117,4 +117,4 @@
Color(0xffffdcab),
Color(0xffd5ffb0),
Color(0xffbaefff)
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
index 86bc567..78804eb 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
@@ -77,9 +77,9 @@
val decay = exponentialDecay<Float>()
val target = decay.calculateTargetValue(animScroll.value, velocity)
// Adjust the target position to center align the item
- var rem = target % itemWidth.value
+ var rem = target % itemWidth.floatValue
if (rem < 0) {
- rem += itemWidth.value
+ rem += itemWidth.floatValue
}
animScroll.animateTo(
targetValue = target - rem,
@@ -93,7 +93,7 @@
Canvas(modifier.fillMaxWidth().height(400.dp)) {
val width = size.width / 2f
val scroll = animScroll.value + width / 2
- itemWidth.value = width
+ itemWidth.floatValue = width
if (DEBUG) {
Log.w(
"Anim",
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
index 2f0db13..5853da2 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
@@ -89,7 +89,7 @@
this.pointerInput(Unit) {
coroutineScope {
while (true) {
- height.value = size.height
+ height.intValue = size.height
val velocityTracker = VelocityTracker()
awaitPointerEventScope {
val pointerId = awaitFirstDown().id
@@ -126,7 +126,7 @@
}
}
}.offset { IntOffset(0, animatedOffset.value.roundToInt()) }
- .graphicsLayer(alpha = calculateAlpha(animatedOffset.value, height.value))
+ .graphicsLayer(alpha = calculateAlpha(animatedOffset.value, height.intValue))
}
private fun calculateAlpha(offset: Float, size: Int): Float {
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimateIncrementDecrementDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimateIncrementDecrementDemo.kt
index 387d875..79033ee 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimateIncrementDecrementDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimateIncrementDecrementDemo.kt
@@ -30,4 +30,4 @@
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
AnimateIncrementDecrementSample()
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
index 88ec8f8..a54c2a9 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
@@ -108,4 +108,4 @@
var target: MyScreen by mutableStateOf(CountScreen())
private set
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedPlacementDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedPlacementDemo.kt
index ab3a86a..7f2bfcc 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedPlacementDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedPlacementDemo.kt
@@ -145,4 +145,4 @@
.background(Color.Red)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/NestedMenuDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/NestedMenuDemo.kt
index cd45d8b..eccc068 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/NestedMenuDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/NestedMenuDemo.kt
@@ -132,4 +132,4 @@
}
}
-private val menuColor = turquoiseColors[4]
\ No newline at end of file
+private val menuColor = turquoiseColors[4]
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/ScaleEnterExitDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/ScaleEnterExitDemo.kt
index 149faf9..59b60ea 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/ScaleEnterExitDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/ScaleEnterExitDemo.kt
@@ -126,4 +126,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
index 8e60214..331ba4f 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
@@ -115,4 +115,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadLayoutWithAlignmentLinesDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadLayoutWithAlignmentLinesDemo.kt
index fe66f60..e4f7044 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadLayoutWithAlignmentLinesDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadLayoutWithAlignmentLinesDemo.kt
@@ -156,4 +156,4 @@
}
}
-typealias SharedElement = @Composable SceneScope.(Modifier) -> Unit
\ No newline at end of file
+typealias SharedElement = @Composable SceneScope.(Modifier) -> Unit
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadSamplesDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadSamplesDemo.kt
index 2e9048a..1fdf49b 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadSamplesDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadSamplesDemo.kt
@@ -27,4 +27,4 @@
IntermediateLayoutSample()
LookaheadLayoutCoordinatesSample()
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithAnimatedContentSize.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithAnimatedContentSize.kt
index feb0fd75..b245565 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithAnimatedContentSize.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithAnimatedContentSize.kt
@@ -79,4 +79,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithDisappearingMoveableContentDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithDisappearingMoveableContentDemo.kt
index 9704813..4f66032 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithDisappearingMoveableContentDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithDisappearingMoveableContentDemo.kt
@@ -177,4 +177,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithFlowRowDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithFlowRowDemo.kt
index d3756c6..adba4fa 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithFlowRowDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithFlowRowDemo.kt
@@ -140,4 +140,4 @@
Color(0xffffcc5c),
Color(0xff2a9d84),
Color(0xff264653)
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithIntrinsicsDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithIntrinsicsDemo.kt
index 58dce48..c5069be 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithIntrinsicsDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithIntrinsicsDemo.kt
@@ -205,4 +205,4 @@
Color(0xffffcc5c),
Color(0xff2a9d84),
Color(0xff264653)
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithPopularBoxWithConstraintsUsage.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithPopularBoxWithConstraintsUsage.kt
index ba99f5f..859dcde 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithPopularBoxWithConstraintsUsage.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithPopularBoxWithConstraintsUsage.kt
@@ -141,4 +141,4 @@
contentScale = ContentScale.Crop,
contentDescription = null
)
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithSubcompose.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithSubcompose.kt
index 4197a50..412d8b3 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithSubcompose.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithSubcompose.kt
@@ -121,4 +121,4 @@
Color(0xffffcc5c),
Color(0xff2a9d84),
Color(0xff264653)
-)
\ No newline at end of file
+)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/NestedSceneHostDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/NestedSceneHostDemo.kt
index 543ff01..c77dcd3 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/NestedSceneHostDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/NestedSceneHostDemo.kt
@@ -69,4 +69,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SceneHostExperiment.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SceneHostExperiment.kt
index 2e70edb..0a3b4a8 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SceneHostExperiment.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SceneHostExperiment.kt
@@ -140,4 +140,4 @@
placeable.place(-(wrapperWidth - width) / 2, -(wrapperHeight - height) / 2)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SharedElementExplorationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SharedElementExplorationDemo.kt
index 165d59a..343c269 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SharedElementExplorationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/SharedElementExplorationDemo.kt
@@ -87,4 +87,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
index 2f77328..2fa45b8 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
@@ -82,4 +82,4 @@
field = value
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
index 01ca017..6f90300 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
@@ -91,4 +91,4 @@
Collapsed,
Expanded,
PutAway
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/RepeatedRotationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/RepeatedRotationDemo.kt
index 5e89ee7..eccdd75 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/RepeatedRotationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/RepeatedRotationDemo.kt
@@ -96,4 +96,4 @@
private enum class RotationStates {
Original,
Rotated
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
index b8e5bad..f16a41d 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
@@ -66,4 +66,4 @@
tint = Color.Red
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/ColumnConfigurationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/ColumnConfigurationDemo.kt
index dfd5b8e..493dc79 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/ColumnConfigurationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/ColumnConfigurationDemo.kt
@@ -185,4 +185,4 @@
}
}
-val androidBlue = Color(0xff4282f2)
\ No newline at end of file
+val androidBlue = Color(0xff4282f2)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/EasingFunctionDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/EasingFunctionDemo.kt
index f5cf9f1..bef78a5 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/EasingFunctionDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualaid/EasingFunctionDemo.kt
@@ -251,4 +251,4 @@
}
internal val AndroidBlue = Color(0xFF4285F4)
-internal val AndroidNavy = Color(0xFF073042)
\ No newline at end of file
+internal val AndroidNavy = Color(0xFF073042)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
index 48187047..b266714 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
@@ -90,4 +90,4 @@
.clickable { if (count > 0) count-- }
.padding(50.dp))
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedVisibiltyContentSizeChange.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedVisibiltyContentSizeChange.kt
index 3a1eff6..52a57e6 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedVisibiltyContentSizeChange.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedVisibiltyContentSizeChange.kt
@@ -83,4 +83,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/EnterExitCombination.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/EnterExitCombination.kt
index b39fd18..9267c8f 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/EnterExitCombination.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/EnterExitCombination.kt
@@ -330,4 +330,4 @@
TopCenter -> BottomCenter
BottomCenter -> TopCenter
else -> alignment
- }
\ No newline at end of file
+ }
diff --git a/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedValueSamples.kt b/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedValueSamples.kt
index 9ed78f9..042824a 100644
--- a/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedValueSamples.kt
+++ b/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedValueSamples.kt
@@ -67,4 +67,4 @@
}
return color.value
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedVisibilitySamples.kt b/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedVisibilitySamples.kt
index bba61af..cce61a4 100644
--- a/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedVisibilitySamples.kt
+++ b/compose/animation/animation/samples/src/main/java/androidx/compose/animation/samples/AnimatedVisibilitySamples.kt
@@ -733,4 +733,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
index d1ac4ac..ae65174 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
@@ -859,4 +859,4 @@
measurables: List<IntrinsicMeasurable>,
width: Int
) = measurables.asSequence().map { it.maxIntrinsicHeight(width) }.maxOrNull() ?: 0
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimationModifier.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimationModifier.kt
index d15138e..a43b12d 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimationModifier.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimationModifier.kt
@@ -227,4 +227,4 @@
measurable: IntrinsicMeasurable,
width: Int
) = measurable.maxIntrinsicHeight(width)
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/DefaultDecayAnimationSpec.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/DefaultDecayAnimationSpec.kt
index 5ca4053..2b156e6 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/DefaultDecayAnimationSpec.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/DefaultDecayAnimationSpec.kt
@@ -25,4 +25,4 @@
@Composable
@Deprecated("Replace with rememberSplineBasedDecay<Float>")
expect fun defaultDecayAnimationSpec(): DecayAnimationSpec<Float>
-expect fun <T> rememberSplineBasedDecay(): DecayAnimationSpec<T>
\ No newline at end of file
+expect fun <T> rememberSplineBasedDecay(): DecayAnimationSpec<T>
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
index 3db5a76..b204bed 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
@@ -1176,4 +1176,4 @@
properties["exit"] = exit
properties["graphicsLayerBlock"] = graphicsLayerBlock
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/FlingCalculator.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/FlingCalculator.kt
index 0e33a08..d972db9 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/FlingCalculator.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/FlingCalculator.kt
@@ -126,4 +126,4 @@
sign(initialVelocity) * distance / duration * 1000.0f
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SingleValueAnimation.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SingleValueAnimation.kt
index 27d75d0..fcf0fc5 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SingleValueAnimation.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/SingleValueAnimation.kt
@@ -107,4 +107,4 @@
* @param initialValue initial value of the [Animatable]
*/
fun Animatable(initialValue: Color): Animatable<Color, AnimationVector4D> =
- Animatable(initialValue, (Color.VectorConverter)(initialValue.colorSpace))
\ No newline at end of file
+ Animatable(initialValue, (Color.VectorConverter)(initialValue.colorSpace))
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.kt
index 3359b66..10429bb 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.animation.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/animation/animation/src/jvmMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/animation/animation/src/jvmMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.jvm.kt
index ff08562..37bd30c 100644
--- a/compose/animation/animation/src/jvmMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/animation/animation/src/jvmMain/kotlin/androidx/compose/animation/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.animation.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/animation/animation/src/test/kotlin/androidx/compose/animation/ConverterTest.kt b/compose/animation/animation/src/test/kotlin/androidx/compose/animation/ConverterTest.kt
index ea4d100..9b384dd 100644
--- a/compose/animation/animation/src/test/kotlin/androidx/compose/animation/ConverterTest.kt
+++ b/compose/animation/animation/src/test/kotlin/androidx/compose/animation/ConverterTest.kt
@@ -141,4 +141,4 @@
Offset.VectorConverter.convertToVector(Offset(x, y))
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/AndroidBenchmarkRule.kt b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/AndroidBenchmarkRule.kt
index 7877aa7..6d4a5d7 100644
--- a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/AndroidBenchmarkRule.kt
+++ b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/AndroidBenchmarkRule.kt
@@ -77,4 +77,4 @@
fun measureRepeated(block: BenchmarkRule.Scope.() -> Unit) {
benchmarkRule.measureRepeated(block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkFirstExtensions.kt b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkFirstExtensions.kt
index 2c3769bd..71bf866 100644
--- a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkFirstExtensions.kt
+++ b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkFirstExtensions.kt
@@ -286,4 +286,4 @@
assertTrue(!isComposed)
isComposed = true
}
-}
\ No newline at end of file
+}
diff --git a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkHelpers.kt b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkHelpers.kt
index ec3c2e7..d313d54 100644
--- a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkHelpers.kt
+++ b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/BenchmarkHelpers.kt
@@ -62,4 +62,4 @@
override fun endRecording() {
picture.endRecording()
}
-}
\ No newline at end of file
+}
diff --git a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/ComposeBenchmarkRule.kt b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/ComposeBenchmarkRule.kt
index 05a3a29..5db4de8 100644
--- a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/ComposeBenchmarkRule.kt
+++ b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/ComposeBenchmarkRule.kt
@@ -91,4 +91,4 @@
fun runOnUiThread(block: () -> Unit) {
activityTestRule.runOnUiThread(block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/android/AndroidTestCase.kt b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/android/AndroidTestCase.kt
index d3e4fb6..772d621 100644
--- a/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/android/AndroidTestCase.kt
+++ b/compose/benchmark-utils/src/main/java/androidx/compose/testutils/benchmark/android/AndroidTestCase.kt
@@ -24,4 +24,4 @@
*/
interface AndroidTestCase {
fun getContent(activity: Activity): ViewGroup
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-daemon/build.gradle b/compose/compiler/compiler-daemon/build.gradle
index 33ee2f7..c1dc0cf 100644
--- a/compose/compiler/compiler-daemon/build.gradle
+++ b/compose/compiler/compiler-daemon/build.gradle
@@ -40,6 +40,10 @@
archiveBaseName = 'kotlin-compiler-daemon'
}
+project.tasks.named("shadowJar").configure { shadowJar ->
+ shadowJar.outputs.doNotCacheIf("Restoring from cache often takes longer", { true })
+}
+
androidx {
name = "Compose Compiler Daemon"
type = LibraryType.COMPILER_DAEMON
diff --git a/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/CompilerTest.kt b/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/CompilerTest.kt
index 8b284f3..70a24f6 100644
--- a/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/CompilerTest.kt
+++ b/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/CompilerTest.kt
@@ -108,4 +108,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/DaemonProtocolTest.kt b/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/DaemonProtocolTest.kt
index d993c1e..04b8b54 100644
--- a/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/DaemonProtocolTest.kt
+++ b/compose/compiler/compiler-daemon/integration-tests/src/test/kotlin/androidx/compose/compiler/daemon/DaemonProtocolTest.kt
@@ -81,4 +81,4 @@
""".trimIndent(), compileCalls.joinToString("\n")
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/Compiler.kt b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/Compiler.kt
index 65757e6..be43334 100644
--- a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/Compiler.kt
+++ b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/Compiler.kt
@@ -133,4 +133,4 @@
ExitCode.INTERNAL_ERROR
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/DaemonProtocol.kt b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/DaemonProtocol.kt
index f4d6970..8ffe8d15 100644
--- a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/DaemonProtocol.kt
+++ b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/DaemonProtocol.kt
@@ -52,4 +52,4 @@
output.println("RESULT ${exitCode.code}")
output.flush()
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/main.kt b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/main.kt
index 8e8f201..4a30174 100644
--- a/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/main.kt
+++ b/compose/compiler/compiler-daemon/src/main/kotlin/androidx/compose/compiler/daemon/main.kt
@@ -78,4 +78,4 @@
System.`in`.bufferedReader(Charset.defaultCharset()),
PrintWriter(System.out)
)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
index 67673c8..dee3137 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractCodegenSignatureTest.kt
@@ -276,4 +276,4 @@
classLoader(text, fileName, dumpClasses)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLiveLiteralTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLiveLiteralTransformTests.kt
index f82658c..2bdd293 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLiveLiteralTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLiveLiteralTransformTests.kt
@@ -116,4 +116,4 @@
""".trimIndent(),
dumpTree = dumpTree
)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLoweringTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLoweringTests.kt
index 480de2d..28ed106 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLoweringTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractLoweringTests.kt
@@ -134,4 +134,4 @@
testMethod.invoke(instanceOfClass, *arguments, composer, 1)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractMetricsTransformTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractMetricsTransformTest.kt
index 8b012f3..44c13ea 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractMetricsTransformTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/AbstractMetricsTransformTest.kt
@@ -99,4 +99,4 @@
.trimTrailingWhitespacesAndAddNewlineAtEOF(),
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCodegenTestUtils.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCodegenTestUtils.kt
index b5a4bea..e178a88e 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCodegenTestUtils.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeCodegenTestUtils.kt
@@ -30,4 +30,4 @@
)
defineClassMethod.isAccessible = true
return defineClassMethod.invoke(loader, name, bytes, 0, bytes.size) as Class<*>
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeModuleMetricsTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeModuleMetricsTests.kt
index dcb8380..d2c9ea1 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeModuleMetricsTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeModuleMetricsTests.kt
@@ -142,4 +142,4 @@
}
"""
)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeMultiPlatformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeMultiPlatformTests.kt
index 0442a7f..c9b2e80 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeMultiPlatformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposeMultiPlatformTests.kt
@@ -103,4 +103,4 @@
""".trimIndent()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
index bbe9866..bc52879 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamSignatureTests.kt
@@ -1687,4 +1687,4 @@
) {
assertFalse(it.contains("INVOKESTATIC kotlin/jvm/internal/Reflection.property0 (Lkotlin/jvm/internal/PropertyReference0;)Lkotlin/reflect/KProperty0;"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ContextReceiversTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ContextReceiversTransformTests.kt
index dbe4c1b..52bf805 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ContextReceiversTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ContextReceiversTransformTests.kt
@@ -674,4 +674,4 @@
}
"""
)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableFunctionKeyCodegenTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableFunctionKeyCodegenTests.kt
index 359393d..1ee3448 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableFunctionKeyCodegenTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableFunctionKeyCodegenTests.kt
@@ -105,4 +105,4 @@
private fun String.occurrences(substring: String): Int = split(substring)
.dropLastWhile { it.isEmpty() }
.count() - 1
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableKeyTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableKeyTests.kt
index 9e0d6cd..610920b 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableKeyTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/DurableKeyTests.kt
@@ -75,4 +75,4 @@
assertDuplicate("c", "c/b")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/FunctionalInterfaceExtensionReceiverTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/FunctionalInterfaceExtensionReceiverTransformTests.kt
index 86c1eaa..fff78f4 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/FunctionalInterfaceExtensionReceiverTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/FunctionalInterfaceExtensionReceiverTransformTests.kt
@@ -119,4 +119,4 @@
""".trimIndent()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxTransformationTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxTransformationTest.kt
index 50d3a82..b17d8dd 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxTransformationTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxTransformationTest.kt
@@ -717,4 +717,4 @@
"""
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationRegressionTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationRegressionTests.kt
index 201a7f8..16d0c91 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationRegressionTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LambdaMemoizationRegressionTests.kt
@@ -132,4 +132,4 @@
}
"""
)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
index 79754ae..6c68452 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/LiveLiteralCodegenTests.kt
@@ -78,4 +78,4 @@
assert(!it.contains("GETFIELD"))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RunComposableTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RunComposableTests.kt
index f884eb9..4fe6e50 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RunComposableTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/RunComposableTests.kt
@@ -460,4 +460,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ScopeComposabilityTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ScopeComposabilityTests.kt
index 3a6d1d1..6af9824 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ScopeComposabilityTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ScopeComposabilityTests.kt
@@ -218,4 +218,4 @@
node = node.parent as? KtElement
}
return false
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/StaticExpressionDetectionTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/StaticExpressionDetectionTests.kt
index d339a8a..34460d1 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/StaticExpressionDetectionTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/StaticExpressionDetectionTests.kt
@@ -333,4 +333,4 @@
const val Mask = 0b111
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/TargetAnnotationsTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/TargetAnnotationsTransformTests.kt
index 40f8b00..eb66445 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/TargetAnnotationsTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/TargetAnnotationsTransformTests.kt
@@ -1713,4 +1713,4 @@
@Composable
fun Wrapper(content: @Composable () -> Unit) { content() }
"""
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableTargetCheckerTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableTargetCheckerTests.kt
index 8102666..9563e07 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableTargetCheckerTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableTargetCheckerTests.kt
@@ -459,4 +459,4 @@
}
}
""")
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt
index 2aaeeb1..3c55338 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/AbstractDebuggerTest.kt
@@ -314,4 +314,4 @@
}
override fun clear() {}
}
-""".trimIndent()
\ No newline at end of file
+""".trimIndent()
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProcessServer.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProcessServer.kt
index 1f60b47..7d9e1d0 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProcessServer.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProcessServer.kt
@@ -155,4 +155,4 @@
CLASS_PATH,
RESULT,
ERROR
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProxy.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProxy.kt
index 9ddd212..47c1b2a 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProxy.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/debug/clientserver/TestProxy.kt
@@ -50,4 +50,4 @@
File(it.file).startsWith(javaFolder)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/KtxNameConventions.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/KtxNameConventions.kt
index 8317770..9816b2a 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/KtxNameConventions.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/KtxNameConventions.kt
@@ -23,4 +23,4 @@
val UPDATE_CHANGED_FLAGS = "updateChangedFlags"
val CURRENTMARKER = Name.identifier("currentMarker")
val ENDTOMARKER = Name.identifier("endToMarker")
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/Bindings.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/Bindings.kt
index f087527..3214bf8 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/Bindings.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/Bindings.kt
@@ -179,4 +179,4 @@
listener()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/CallBindings.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/CallBindings.kt
index 6ebcaa2..f0c20a1 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/CallBindings.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/CallBindings.kt
@@ -38,4 +38,4 @@
val resultString = result?.let { "-> $it" } ?: ""
return "[$target$anyParametersStr$paramsString$resultString]"
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/LazyScheme.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/LazyScheme.kt
index ef0bb32..8d447d8 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/LazyScheme.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/LazyScheme.kt
@@ -112,4 +112,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrorMessages.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrorMessages.kt
index ec1dd1e..d83e84a 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrorMessages.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrorMessages.kt
@@ -139,4 +139,4 @@
" This will become an error in Kotlin 2.0"
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrors.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrors.kt
index 72e77cd..b6bc829a 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrors.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeErrors.kt
@@ -172,4 +172,4 @@
ComposeErrorMessages()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/FrontendWritableSlices.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/FrontendWritableSlices.kt
index 24bd498..c65d7aa 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/FrontendWritableSlices.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/FrontendWritableSlices.kt
@@ -32,4 +32,4 @@
BasicWritableSlice(RewritePolicy.DO_NOTHING)
val COMPOSE_LAZY_SCHEME: WritableSlice<Any, LazyScheme> =
BasicWritableSlice(RewritePolicy.DO_NOTHING)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityFieldSerializationPlugin.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityFieldSerializationPlugin.kt
index efc090b..66be174 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityFieldSerializationPlugin.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityFieldSerializationPlugin.kt
@@ -61,4 +61,4 @@
proto.flags = proto.flags or hasAnnotationFlag
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityTransformer.kt
index 4d29926..0d1e90e 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ClassStabilityTransformer.kt
@@ -189,4 +189,4 @@
declarations += stabilityProp
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/CopyDefaultValuesFromExpectLowering.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/CopyDefaultValuesFromExpectLowering.kt
index 6226df2..f79f3bfa 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/CopyDefaultValuesFromExpectLowering.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/CopyDefaultValuesFromExpectLowering.kt
@@ -266,4 +266,4 @@
else -> error(parent)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DeepCopyPreservingMetadata.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DeepCopyPreservingMetadata.kt
index 3ef6491..033b426 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DeepCopyPreservingMetadata.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DeepCopyPreservingMetadata.kt
@@ -69,4 +69,4 @@
super.visitLocalDelegatedProperty(declaration).apply {
metadata = declaration.metadata
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableFunctionKeyTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableFunctionKeyTransformer.kt
index 615d019..c631f57 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableFunctionKeyTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableFunctionKeyTransformer.kt
@@ -251,4 +251,4 @@
context.irTrace.record(DURABLE_FUNCTION_KEY, declaration, info)
return super.visitSimpleFunction(declaration)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyTransformer.kt
index dbfacff..57226ea 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyTransformer.kt
@@ -459,4 +459,4 @@
declaration
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyVisitor.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyVisitor.kt
index 01b8dc4..50c85a4 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyVisitor.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/DurableKeyVisitor.kt
@@ -183,4 +183,4 @@
it to keys.add(it)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/KlibAssignableParamTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/KlibAssignableParamTransformer.kt
index 94d46bf..3010e87 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/KlibAssignableParamTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/KlibAssignableParamTransformer.kt
@@ -149,4 +149,4 @@
return super.visitFunction(declaration)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ModuleLoweringPass.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ModuleLoweringPass.kt
index 527b5e2..25080da 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ModuleLoweringPass.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ModuleLoweringPass.kt
@@ -20,4 +20,4 @@
interface ModuleLoweringPass {
fun lower(module: IrModuleFragment)
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/WrapJsComposableLambdaLowering.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/WrapJsComposableLambdaLowering.kt
index 98424d5..28d1731 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/WrapJsComposableLambdaLowering.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/WrapJsComposableLambdaLowering.kt
@@ -263,4 +263,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/AbstractDecoysLowering.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/AbstractDecoysLowering.kt
index bab96bb..c7d7c34 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/AbstractDecoysLowering.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/AbstractDecoysLowering.kt
@@ -90,4 +90,4 @@
else -> false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/SubstituteDecoyCallsTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/SubstituteDecoyCallsTransformer.kt
index 7eb835d..2c2c2dd 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/SubstituteDecoyCallsTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/decoys/SubstituteDecoyCallsTransformer.kt
@@ -264,4 +264,4 @@
} else owner
}
} else owner
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestBindings.kt b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestBindings.kt
index 3663084..6a2cbd2 100644
--- a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestBindings.kt
+++ b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestBindings.kt
@@ -173,4 +173,4 @@
cBindings.unify(bOpen, cClosed)
expect(a = 2, b = 2, c = 0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestInferApplier.kt b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestInferApplier.kt
index 4e8437d..dfd801a 100644
--- a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestInferApplier.kt
+++ b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestInferApplier.kt
@@ -266,4 +266,4 @@
private class ResolvedExpression(val node: Node, val type: Type) : Leaf() {
override fun accept(visitor: Visitor) { }
override fun storageNode(): Node = node
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestLazyScheme.kt b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestLazyScheme.kt
index a54ccc2..f0f3b16 100644
--- a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestLazyScheme.kt
+++ b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestLazyScheme.kt
@@ -189,4 +189,4 @@
}
return scheme()
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestScheme.kt b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestScheme.kt
index 9463eb0..e78bb7d 100644
--- a/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestScheme.kt
+++ b/compose/compiler/compiler-hosted/src/test/kotlin/androidx/compose/compiler/plugins/kotlin/inference/TestScheme.kt
@@ -170,4 +170,4 @@
assertNull(result)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/compiler/compiler/integration-tests/src/test/kotlin/androidx/compose/compiler/test/CompilerPluginRuntimeVersionCheckTest.kt b/compose/compiler/compiler/integration-tests/src/test/kotlin/androidx/compose/compiler/test/CompilerPluginRuntimeVersionCheckTest.kt
index 9559f16..9a44385 100644
--- a/compose/compiler/compiler/integration-tests/src/test/kotlin/androidx/compose/compiler/test/CompilerPluginRuntimeVersionCheckTest.kt
+++ b/compose/compiler/compiler/integration-tests/src/test/kotlin/androidx/compose/compiler/test/CompilerPluginRuntimeVersionCheckTest.kt
@@ -236,4 +236,4 @@
file.parentFile.mkdirs()
file.writeText(content)
}
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/disabled/Empty.kt b/compose/desktop/desktop/samples/src/jvmMain/disabled/Empty.kt
index 0c32401..9e53caab 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/disabled/Empty.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/disabled/Empty.kt
@@ -1 +1 @@
-// Give Kotlin a placeholder file to compile when this project is disabled.
\ No newline at end of file
+// Give Kotlin a placeholder file to compile when this project is disabled.
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/AppState.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/AppState.jvm.kt
index 5119ec7..d76162a 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/AppState.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/AppState.jvm.kt
@@ -90,4 +90,4 @@
error.value = false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.jvm.kt
index 3d99ae2..548a1b3 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/Main.jvm.kt
@@ -66,4 +66,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/MenuItems.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/MenuItems.jvm.kt
index 7acba63..4e4624b 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/MenuItems.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/MenuItems.jvm.kt
@@ -80,4 +80,4 @@
shortcut = KeyShortcut(Key.Escape).takeIf { withShortcuts },
onClick = AppState::closeAll
)
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/TestAmbient.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/TestAmbient.jvm.kt
index 7a6e0e3..cb2d9a2 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/TestAmbient.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/popupexample/TestAmbient.jvm.kt
@@ -20,4 +20,4 @@
val LocalTest = staticCompositionLocalOf<Int> {
error("LocalTest not provided")
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/swingexample/Main.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/swingexample/Main.jvm.kt
index 06ddea7..27a2c5a 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/swingexample/Main.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/swingexample/Main.jvm.kt
@@ -268,4 +268,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/vsynctest/Main.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/vsynctest/Main.jvm.kt
index 331a34e..aed8bfb 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/vsynctest/Main.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/vsynctest/Main.jvm.kt
@@ -119,4 +119,4 @@
}
}
-private fun List<Long>.median() = sorted()[size / 2]
\ No newline at end of file
+private fun List<Long>.median() = sorted()[size / 2]
diff --git a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/windowapi/Main.jvm.kt b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/windowapi/Main.jvm.kt
index cc5b99f..a2b863f 100644
--- a/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/windowapi/Main.jvm.kt
+++ b/compose/desktop/desktop/samples/src/jvmMain/kotlin/androidx/compose/desktop/examples/windowapi/Main.jvm.kt
@@ -74,4 +74,4 @@
modifier = Modifier.padding(2.dp)
) {
Text(text)
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/src/disabled/Empty.kt b/compose/desktop/desktop/src/disabled/Empty.kt
index 0c32401..9e53caab 100644
--- a/compose/desktop/desktop/src/disabled/Empty.kt
+++ b/compose/desktop/desktop/src/disabled/Empty.kt
@@ -1 +1 @@
-// Give Kotlin a placeholder file to compile when this project is disabled.
\ No newline at end of file
+// Give Kotlin a placeholder file to compile when this project is disabled.
diff --git a/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.jvm.kt b/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.jvm.kt
index 1e8384c..e132334 100644
--- a/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.jvm.kt
+++ b/compose/desktop/desktop/src/jvmMain/kotlin/androidx/compose/desktop/DesktopTheme.jvm.kt
@@ -73,4 +73,4 @@
) = CompositionLocalProvider(
LocalScrollbarStyle provides scrollbar,
content = content
-)
\ No newline at end of file
+)
diff --git a/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/InputsTest.kt b/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/InputsTest.kt
index 937db0c..80e5b39 100644
--- a/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/InputsTest.kt
+++ b/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/InputsTest.kt
@@ -56,4 +56,4 @@
}
rule.onNodeWithTag(tag).assertRangeInfoEquals(ProgressBarRangeInfo(0f, 0f..1f, 0))
}
-}
\ No newline at end of file
+}
diff --git a/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/ParagraphTest.kt b/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/ParagraphTest.kt
index 9901bb97..38fb4b9 100644
--- a/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/ParagraphTest.kt
+++ b/compose/desktop/desktop/src/jvmTest/kotlin/androidx/compose/desktop/ParagraphTest.kt
@@ -123,4 +123,4 @@
}
screenshotRule.snap(window.surface)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/api/current.txt b/compose/foundation/foundation-layout/api/current.txt
index 9d8d6f4..2c7d904 100644
--- a/compose/foundation/foundation-layout/api/current.txt
+++ b/compose/foundation/foundation-layout/api/current.txt
@@ -70,7 +70,7 @@
}
public final class AspectRatioKt {
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier aspectRatio(androidx.compose.ui.Modifier, float ratio, optional boolean matchHeightConstraintsFirst);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier aspectRatio(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio, optional boolean matchHeightConstraintsFirst);
}
public final class BoxKt {
@@ -108,7 +108,7 @@
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Horizontal alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.VerticalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
- method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, float weight, optional boolean fill);
+ method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, optional boolean fill);
}
@SuppressCompatibility @kotlin.RequiresOptIn(message="The API of this layout is experimental and is likely to change in the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalLayoutApi {
@@ -197,14 +197,14 @@
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.HorizontalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignByBaseline(androidx.compose.ui.Modifier);
- method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, float weight, optional boolean fill);
+ method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, optional boolean fill);
}
public final class SizeKt {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier defaultMinSize(androidx.compose.ui.Modifier, optional float minWidth, optional float minHeight);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxSize(androidx.compose.ui.Modifier, optional float fraction);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxHeight(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxSize(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxWidth(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier height(androidx.compose.ui.Modifier, float height);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier heightIn(androidx.compose.ui.Modifier, optional float min, optional float max);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier requiredHeight(androidx.compose.ui.Modifier, float height);
diff --git a/compose/foundation/foundation-layout/api/restricted_current.txt b/compose/foundation/foundation-layout/api/restricted_current.txt
index 875c895..57c78cb 100644
--- a/compose/foundation/foundation-layout/api/restricted_current.txt
+++ b/compose/foundation/foundation-layout/api/restricted_current.txt
@@ -70,7 +70,7 @@
}
public final class AspectRatioKt {
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier aspectRatio(androidx.compose.ui.Modifier, float ratio, optional boolean matchHeightConstraintsFirst);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier aspectRatio(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float ratio, optional boolean matchHeightConstraintsFirst);
}
public final class BoxKt {
@@ -111,7 +111,7 @@
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier align(androidx.compose.ui.Modifier, androidx.compose.ui.Alignment.Horizontal alignment);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.VerticalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
- method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, float weight, optional boolean fill);
+ method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, optional boolean fill);
}
@SuppressCompatibility @kotlin.RequiresOptIn(message="The API of this layout is experimental and is likely to change in the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalLayoutApi {
@@ -204,14 +204,14 @@
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, androidx.compose.ui.layout.HorizontalAlignmentLine alignmentLine);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignBy(androidx.compose.ui.Modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.layout.Measured,java.lang.Integer> alignmentLineBlock);
method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier alignByBaseline(androidx.compose.ui.Modifier);
- method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, float weight, optional boolean fill);
+ method @androidx.compose.runtime.Stable public androidx.compose.ui.Modifier weight(androidx.compose.ui.Modifier, @FloatRange(from=0.0, fromInclusive=false) float weight, optional boolean fill);
}
public final class SizeKt {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier defaultMinSize(androidx.compose.ui.Modifier, optional float minWidth, optional float minHeight);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxSize(androidx.compose.ui.Modifier, optional float fraction);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxHeight(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxSize(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier fillMaxWidth(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier height(androidx.compose.ui.Modifier, float height);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier heightIn(androidx.compose.ui.Modifier, optional float min, optional float max);
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier requiredHeight(androidx.compose.ui.Modifier, float height);
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColorLerpBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColorLerpBenchmark.kt
index 54895668..571ddab 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColorLerpBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColorLerpBenchmark.kt
@@ -62,4 +62,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesBenchmark.kt
index 8f777b8..b81dbd7 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesBenchmark.kt
@@ -58,4 +58,4 @@
fun first_layout() {
benchmarkRule.benchmarkFirstLayout(checkboxCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesTestCase.kt
index ace9fdd..115fbe6 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/NestedBoxesTestCase.kt
@@ -44,4 +44,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnBenchmark.kt
index fa84cee..02aa96c 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnBenchmark.kt
@@ -100,4 +100,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(rectsInColumnCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelBenchmark.kt
index dcfeaca5..6d6be30 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelBenchmark.kt
@@ -100,4 +100,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(rectsInColumnCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelTestCase.kt
index 18add1b..eff3f4e 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnSharedModelTestCase.kt
@@ -61,4 +61,4 @@
color.value = Color.Magenta
}
}
-}
\ No newline at end of file
+}
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 63c62bf..0fbdb92 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
@@ -66,4 +66,4 @@
states.add(state)
Box(Modifier.size(100.dp, 50.dp).background(color = state.value))
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnBenchmark.kt
index 0a6072f..2d6f27f 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnBenchmark.kt
@@ -100,4 +100,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(rectsInFlowColumnCaseFactory)
}
-}
\ No newline at end of file
+}
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 223b9f5..079516d 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
@@ -71,4 +71,4 @@
.size(100.dp, 50.dp)
.background(color = state.value))
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ResizeComposeViewBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ResizeComposeViewBenchmark.kt
index 7f1d93a..b2190b2 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ResizeComposeViewBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ResizeComposeViewBenchmark.kt
@@ -145,4 +145,4 @@
childSize = IntSize(300, 400)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsBenchmark.kt
index 27e6d90..54ea872 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsBenchmark.kt
@@ -99,4 +99,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(simpleColumnWithRowsFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsTestCase.kt
index 5b302fd..727e76b 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/SimpleColumnWithRowsTestCase.kt
@@ -54,4 +54,4 @@
numberOfSubLayouts.value = subLayouts
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsBenchmark.kt
index 2cd66ac..6a8a67b 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsBenchmark.kt
@@ -99,4 +99,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(simpleColumnWithRowsFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsTestCase.kt
index 2632095..a9bd699 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/WeightedColumnWithRowsTestCase.kt
@@ -60,4 +60,4 @@
numberOfSubLayouts.value = subLayouts
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutBenchmark.kt
index 4716000..1728bd6 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutBenchmark.kt
@@ -78,4 +78,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(rectanglesCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutTestCase.kt
index b962431..4729e91 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/AndroidRectsInLinearLayoutTestCase.kt
@@ -59,4 +59,4 @@
it.setBackgroundColor(color)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutBenchmark.kt
index be7f962..19853cf 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutBenchmark.kt
@@ -93,4 +93,4 @@
fun changeLayoutContents_draw() {
benchmarkRule.toggleStateBenchmarkDraw(linearLayoutCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutTestCase.kt
index 4b5f0f6..94135e6 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/SimpleLinearLayoutTestCase.kt
@@ -72,4 +72,4 @@
isToggled = false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutBenchmark.kt
index 3d11935..a0165f7 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutBenchmark.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutBenchmark.kt
@@ -94,4 +94,4 @@
fun changeLayoutContents_draw() {
benchmarkRule.toggleStateBenchmarkDraw(linearLayoutCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutTestCase.kt
index 0177e2e..ca5f4c3 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/view/WeightedLinearLayoutTestCase.kt
@@ -74,4 +74,4 @@
isToggled = false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowColumnDemo.kt b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowColumnDemo.kt
index 973c4c3..3afa90f 100644
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowColumnDemo.kt
+++ b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowColumnDemo.kt
@@ -29,4 +29,4 @@
SimpleFlowColumn()
SimpleFlowColumnWithWeights()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowRowDemo.kt b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowRowDemo.kt
index 0cceea3..d777eab 100644
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowRowDemo.kt
+++ b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleFlowRowDemo.kt
@@ -29,4 +29,4 @@
SimpleFlowRow()
SimpleFlowRowWithWeights()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleLayoutDemo.kt b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleLayoutDemo.kt
index e285ad6..224c045 100644
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleLayoutDemo.kt
+++ b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/java/androidx/compose/foundation/layout/demos/SimpleLayoutDemo.kt
@@ -126,4 +126,4 @@
Box(modifier.size(24.dp).background(Color(0xFF03DAC6)))
}
-private val ExampleSize = 140.dp
\ No newline at end of file
+private val ExampleSize = 140.dp
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/BoxSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/BoxSample.kt
index 03f6a9f..70709cb 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/BoxSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/BoxSample.kt
@@ -59,4 +59,4 @@
.background(Color.Blue)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/ColumnSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/ColumnSample.kt
index c4cfe09..44f46ec 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/ColumnSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/ColumnSample.kt
@@ -155,4 +155,4 @@
height = 40.dp
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt
index 94be47c..b5472254 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt
@@ -93,4 +93,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt
index 9bc950c..7af3c27 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt
@@ -84,4 +84,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/LayoutPaddingSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/LayoutPaddingSample.kt
index 86e4ea6..8390c4d 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/LayoutPaddingSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/LayoutPaddingSample.kt
@@ -80,4 +80,4 @@
.background(Color.Blue)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/SpacerSample.kt b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/SpacerSample.kt
index ac36b09..83df70d 100644
--- a/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/SpacerSample.kt
+++ b/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/SpacerSample.kt
@@ -38,4 +38,4 @@
Spacer(Modifier.weight(1f))
Box(Modifier.size(100.dp).background(Color.Black))
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/ArrangementTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/ArrangementTest.kt
index 8808486..34ffd4b 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/ArrangementTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/ArrangementTest.kt
@@ -94,4 +94,4 @@
),
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/AspectRatioTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/AspectRatioTest.kt
index 460b85a..62ea033 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/AspectRatioTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/AspectRatioTest.kt
@@ -180,4 +180,4 @@
ValueElement("matchHeightConstraintsFirst", false)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
index d3cdacb..11962f0 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/BoxWithConstraintsTest.kt
@@ -998,4 +998,4 @@
var size: Int by mutableStateOf(size)
var outerColor: Color by mutableStateOf(outerColor)
var innerColor: Color by mutableStateOf(innerColor)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/FlowRowColumnTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/FlowRowColumnTest.kt
index 8142e08..3eeedac 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/FlowRowColumnTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/FlowRowColumnTest.kt
@@ -2538,4 +2538,4 @@
rule.waitForIdle()
Truth.assertThat(height).isEqualTo(200)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt
index bfc6d1d..b51d90a 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt
@@ -477,4 +477,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnModifierTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnModifierTest.kt
index ae3fbd6..651281f 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnModifierTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnModifierTest.kt
@@ -439,4 +439,4 @@
Truth.assertThat(positionInParentX).isEqualTo(5)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
index c896de1..fd13029 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
@@ -6113,4 +6113,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
index 46f3307..2373fc2 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SizeTest.kt
@@ -2004,4 +2004,4 @@
val root = findComposeView()
waitForDraw(root)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SpacerTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SpacerTest.kt
index 6d2bb4e..81a0bc1 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SpacerTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/SpacerTest.kt
@@ -216,4 +216,4 @@
Truth.assertThat(size?.width).isEqualTo(0)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsActivity.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsActivity.kt
index 245cff1..4e09f2d 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsActivity.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsActivity.kt
@@ -36,4 +36,4 @@
}
}
-class WindowInsetsActionBarActivity : WindowInsetsActivity()
\ No newline at end of file
+class WindowInsetsActionBarActivity : WindowInsetsActivity()
diff --git a/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsConnection.android.kt b/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsConnection.android.kt
index bd2e95d..9512a4a 100644
--- a/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsConnection.android.kt
+++ b/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsConnection.android.kt
@@ -721,4 +721,4 @@
*/
val velocityCoefficient: Float get() = unpackFloat2(packedValue)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsPadding.android.kt b/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsPadding.android.kt
index 9a9e20d..bb506bc 100644
--- a/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsPadding.android.kt
+++ b/compose/foundation/foundation-layout/src/androidMain/kotlin/androidx/compose/foundation/layout/WindowInsetsPadding.android.kt
@@ -252,4 +252,4 @@
val insets = composeInsets.insetsCalculation()
InsetsPaddingModifier(insets)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AspectRatio.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AspectRatio.kt
index 03ba1e45..bcfcde8 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AspectRatio.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AspectRatio.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.layout
+import androidx.annotation.FloatRange
import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.IntrinsicMeasurable
@@ -52,7 +53,7 @@
*/
@Stable
fun Modifier.aspectRatio(
- /*@FloatRange(from = 0.0, fromInclusive = false)*/
+ @FloatRange(from = 0.0, fromInclusive = false)
ratio: Float,
matchHeightConstraintsFirst: Boolean = false
) = this.then(
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt
index 10f1128..c243943 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.layout
+import androidx.annotation.FloatRange
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
@@ -139,7 +140,7 @@
*/
@Stable
fun Modifier.weight(
- /*@FloatRange(from = 0.0, fromInclusive = false)*/
+ @FloatRange(from = 0.0, fromInclusive = false)
weight: Float,
fill: Boolean = true
): Modifier
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 cdec1d5..7bd845d 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
@@ -752,4 +752,4 @@
val mainAxisTotalSize: Int,
val crossAxisTotalSize: Int,
val items: MutableVector<RowColumnMeasureHelperResult>,
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt
index 02bd8ec..c9b7612 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.layout
+import androidx.annotation.FloatRange
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
@@ -140,7 +141,7 @@
*/
@Stable
fun Modifier.weight(
- /*@FloatRange(from = 0.0, fromInclusive = false)*/
+ @FloatRange(from = 0.0, fromInclusive = false)
weight: Float,
fill: Boolean = true
): Modifier
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnMeasurementHelper.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnMeasurementHelper.kt
index a828f9f..7483575 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnMeasurementHelper.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnMeasurementHelper.kt
@@ -322,4 +322,4 @@
}
}
}
-}
\ No newline at end of file
+}
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 b0a80c7..febc9bc 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
@@ -16,6 +16,7 @@
package androidx.compose.foundation.layout
+import androidx.annotation.FloatRange
import androidx.compose.runtime.Stable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -455,7 +456,7 @@
* @sample androidx.compose.foundation.layout.samples.FillHalfWidthModifier
*/
@Stable
-fun Modifier.fillMaxWidth(/*@FloatRange(from = 0.0, to = 1.0)*/ fraction: Float = 1f) =
+fun Modifier.fillMaxWidth(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
this.then(if (fraction == 1f) FillWholeMaxWidth else FillElement.width(fraction))
private val FillWholeMaxWidth = FillElement.width(1f)
@@ -475,7 +476,7 @@
* @sample androidx.compose.foundation.layout.samples.FillHalfHeightModifier
*/
@Stable
-fun Modifier.fillMaxHeight(/*@FloatRange(from = 0.0, to = 1.0)*/ fraction: Float = 1f) =
+fun Modifier.fillMaxHeight(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
this.then(if (fraction == 1f) FillWholeMaxHeight else FillElement.height(fraction))
private val FillWholeMaxHeight = FillElement.height(1f)
@@ -499,7 +500,7 @@
* @sample androidx.compose.foundation.layout.samples.FillHalfSizeModifier
*/
@Stable
-fun Modifier.fillMaxSize(/*@FloatRange(from = 0.0, to = 1.0)*/ fraction: Float = 1f) =
+fun Modifier.fillMaxSize(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
this.then(if (fraction == 1f) FillWholeMaxSize else FillElement.size(fraction))
private val FillWholeMaxSize = FillElement.size(1f)
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/WindowInsetsSize.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/WindowInsetsSize.kt
index 76af273..9c83dd3 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/WindowInsetsSize.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/WindowInsetsSize.kt
@@ -210,4 +210,4 @@
}
override fun hashCode(): Int = 31 * insets.hashCode() + heightCalc.hashCode()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.kt
index e29df01..de7f92e 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.foundation.layout.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/foundation/foundation-layout/src/jvmMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/foundation/foundation-layout/src/jvmMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.jvm.kt
index 83e51ff..556829a 100644
--- a/compose/foundation/foundation-layout/src/jvmMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/foundation/foundation-layout/src/jvmMain/kotlin/androidx/compose/foundation/layout/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.foundation.layout.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/FoundationNames.kt b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/FoundationNames.kt
index e75f537..b6a07ab 100644
--- a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/FoundationNames.kt
+++ b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/FoundationNames.kt
@@ -42,4 +42,4 @@
val Offset = Name(PackageName, "offset")
val AbsoluteOffset = Name(PackageName, "absoluteOffset")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetector.kt b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetector.kt
index a8d615e..8df549b 100644
--- a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetector.kt
+++ b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetector.kt
@@ -179,4 +179,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetector.kt b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetector.kt
index 673f5be..3d98da8 100644
--- a/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetector.kt
+++ b/compose/foundation/foundation-lint/src/main/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetector.kt
@@ -154,4 +154,4 @@
private const val OffsetSignature =
"(Landroidx/compose/ui/Modifier;Landroidx/compose/ui/unit/Dp;Landroidx/compose/ui/unit/Dp;)" +
- "Landroidx/compose/ui/Modifier;"
\ No newline at end of file
+ "Landroidx/compose/ui/Modifier;"
diff --git a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetectorTest.kt b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetectorTest.kt
index 4e448e6..3fb5c9a 100644
--- a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetectorTest.kt
+++ b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/LazyLayoutStateReadInCompositionDetectorTest.kt
@@ -708,4 +708,4 @@
+ }
""".trimIndent())
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetectorTest.kt b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetectorTest.kt
index d1ea423..6b70cb7 100644
--- a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetectorTest.kt
+++ b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/NonLambdaOffsetModifierDetectorTest.kt
@@ -1412,4 +1412,4 @@
.run()
.expectClean()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/UnrememberedMutableInteractionSourceDetectorTest.kt b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/UnrememberedMutableInteractionSourceDetectorTest.kt
index 32c8d2b..c59797b 100644
--- a/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/UnrememberedMutableInteractionSourceDetectorTest.kt
+++ b/compose/foundation/foundation-lint/src/test/java/androidx/compose/foundation/lint/UnrememberedMutableInteractionSourceDetectorTest.kt
@@ -314,4 +314,4 @@
.run()
.expectClean()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/api/current.txt b/compose/foundation/foundation/api/current.txt
index 77d79cc..605ad44 100644
--- a/compose/foundation/foundation/api/current.txt
+++ b/compose/foundation/foundation/api/current.txt
@@ -2,7 +2,7 @@
package androidx.compose.foundation {
public final class BackgroundKt {
- method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, androidx.compose.ui.graphics.Brush brush, optional androidx.compose.ui.graphics.Shape shape, optional float alpha);
+ method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, androidx.compose.ui.graphics.Brush brush, optional androidx.compose.ui.graphics.Shape shape, optional @FloatRange(from=0.0, to=1.0) float alpha);
method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, long color, optional androidx.compose.ui.graphics.Shape shape);
}
@@ -193,7 +193,7 @@
public final class ProgressSemanticsKt {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier, float value, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier, float value, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps);
}
public final class ScrollKt {
@@ -257,7 +257,7 @@
method public T getCurrentValue();
method public float getLastVelocity();
method public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public T getTargetValue();
method public boolean isAnimationRunning();
method public float requireOffset();
@@ -269,7 +269,7 @@
property public final boolean isAnimationRunning;
property public final float lastVelocity;
property public final float offset;
- property public final float progress;
+ property @FloatRange(from=0.0, to=1.0) public final float progress;
property public final T targetValue;
field public static final androidx.compose.foundation.gestures.AnchoredDraggableState.Companion Companion;
}
@@ -609,9 +609,9 @@
@androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyItemScope {
method @SuppressCompatibility @androidx.compose.foundation.ExperimentalFoundationApi public androidx.compose.ui.Modifier animateItemPlacement(androidx.compose.ui.Modifier, optional androidx.compose.animation.core.FiniteAnimationSpec<androidx.compose.ui.unit.IntOffset> animationSpec);
- method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
- method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional float fraction);
- method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
}
public interface LazyListItemInfo {
@@ -660,7 +660,7 @@
@androidx.compose.runtime.Stable public final class LazyListState implements androidx.compose.foundation.gestures.ScrollableState {
ctor public LazyListState(optional int firstVisibleItemIndex, optional int firstVisibleItemScrollOffset);
- method public suspend Object? animateScrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? animateScrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public float dispatchRawDelta(float delta);
method public int getFirstVisibleItemIndex();
method public int getFirstVisibleItemScrollOffset();
@@ -668,7 +668,7 @@
method public androidx.compose.foundation.lazy.LazyListLayoutInfo getLayoutInfo();
method public boolean isScrollInProgress();
method public suspend Object? scroll(androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
- method public suspend Object? scrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? scrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public boolean canScrollBackward;
property public boolean canScrollForward;
property public final int firstVisibleItemIndex;
@@ -801,7 +801,7 @@
@androidx.compose.runtime.Stable public final class LazyGridState implements androidx.compose.foundation.gestures.ScrollableState {
ctor public LazyGridState(optional int firstVisibleItemIndex, optional int firstVisibleItemScrollOffset);
- method public suspend Object? animateScrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? animateScrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public float dispatchRawDelta(float delta);
method public int getFirstVisibleItemIndex();
method public int getFirstVisibleItemScrollOffset();
@@ -809,7 +809,7 @@
method public androidx.compose.foundation.lazy.grid.LazyGridLayoutInfo getLayoutInfo();
method public boolean isScrollInProgress();
method public suspend Object? scroll(androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
- method public suspend Object? scrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? scrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public boolean canScrollBackward;
property public boolean canScrollForward;
property public final int firstVisibleItemIndex;
@@ -1191,7 +1191,7 @@
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(int percent);
- method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional int topLeftPercent, optional int topRightPercent, optional int bottomRightPercent, optional int bottomLeftPercent);
+ method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional @IntRange(from=0L, to=100L) int topLeftPercent, optional @IntRange(from=0L, to=100L) int topRightPercent, optional @IntRange(from=0L, to=100L) int bottomRightPercent, optional @IntRange(from=0L, to=100L) int bottomLeftPercent);
}
public final class AbsoluteRoundedCornerShape extends androidx.compose.foundation.shape.CornerBasedShape {
@@ -1207,7 +1207,7 @@
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(int percent);
- method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional int topLeftPercent, optional int topRightPercent, optional int bottomRightPercent, optional int bottomLeftPercent);
+ method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional @IntRange(from=0L, to=100L) int topLeftPercent, optional @IntRange(from=0L, to=100L) int topRightPercent, optional @IntRange(from=0L, to=100L) int bottomRightPercent, optional @IntRange(from=0L, to=100L) int bottomLeftPercent);
}
public abstract class CornerBasedShape implements androidx.compose.ui.graphics.Shape {
@@ -1233,7 +1233,7 @@
public final class CornerSizeKt {
method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(float size);
method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(float size);
- method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(int percent);
+ method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(@IntRange(from=0L, to=100L) int percent);
method public static androidx.compose.foundation.shape.CornerSize getZeroCornerSize();
property public static final androidx.compose.foundation.shape.CornerSize ZeroCornerSize;
}
@@ -1251,7 +1251,7 @@
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(int percent);
- method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional int topStartPercent, optional int topEndPercent, optional int bottomEndPercent, optional int bottomStartPercent);
+ method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional @IntRange(from=0L, to=100L) int topStartPercent, optional @IntRange(from=0L, to=100L) int topEndPercent, optional @IntRange(from=0L, to=100L) int bottomEndPercent, optional @IntRange(from=0L, to=100L) int bottomStartPercent);
}
public final class GenericShape implements androidx.compose.ui.graphics.Shape {
@@ -1272,7 +1272,7 @@
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(int percent);
- method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional int topStartPercent, optional int topEndPercent, optional int bottomEndPercent, optional int bottomStartPercent);
+ method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional @IntRange(from=0L, to=100L) int topStartPercent, optional @IntRange(from=0L, to=100L) int topEndPercent, optional @IntRange(from=0L, to=100L) int bottomEndPercent, optional @IntRange(from=0L, to=100L) int bottomStartPercent);
method public static androidx.compose.foundation.shape.RoundedCornerShape getCircleShape();
property public static final androidx.compose.foundation.shape.RoundedCornerShape CircleShape;
}
diff --git a/compose/foundation/foundation/api/restricted_current.txt b/compose/foundation/foundation/api/restricted_current.txt
index b676dff..01842ad 100644
--- a/compose/foundation/foundation/api/restricted_current.txt
+++ b/compose/foundation/foundation/api/restricted_current.txt
@@ -2,7 +2,7 @@
package androidx.compose.foundation {
public final class BackgroundKt {
- method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, androidx.compose.ui.graphics.Brush brush, optional androidx.compose.ui.graphics.Shape shape, optional float alpha);
+ method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, androidx.compose.ui.graphics.Brush brush, optional androidx.compose.ui.graphics.Shape shape, optional @FloatRange(from=0.0, to=1.0) float alpha);
method public static androidx.compose.ui.Modifier background(androidx.compose.ui.Modifier, long color, optional androidx.compose.ui.graphics.Shape shape);
}
@@ -195,7 +195,7 @@
public final class ProgressSemanticsKt {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier);
- method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier, float value, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps);
+ method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier progressSemantics(androidx.compose.ui.Modifier, float value, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps);
}
public final class ScrollKt {
@@ -259,7 +259,7 @@
method public T getCurrentValue();
method public float getLastVelocity();
method public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public T getTargetValue();
method public boolean isAnimationRunning();
method public float requireOffset();
@@ -271,7 +271,7 @@
property public final boolean isAnimationRunning;
property public final float lastVelocity;
property public final float offset;
- property public final float progress;
+ property @FloatRange(from=0.0, to=1.0) public final float progress;
property public final T targetValue;
field public static final androidx.compose.foundation.gestures.AnchoredDraggableState.Companion Companion;
}
@@ -611,9 +611,9 @@
@androidx.compose.foundation.lazy.LazyScopeMarker @androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LazyItemScope {
method @SuppressCompatibility @androidx.compose.foundation.ExperimentalFoundationApi public androidx.compose.ui.Modifier animateItemPlacement(androidx.compose.ui.Modifier, optional androidx.compose.animation.core.FiniteAnimationSpec<androidx.compose.ui.unit.IntOffset> animationSpec);
- method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional float fraction);
- method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional float fraction);
- method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxHeight(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxSize(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
+ method public androidx.compose.ui.Modifier fillParentMaxWidth(androidx.compose.ui.Modifier, optional @FloatRange(from=0.0, to=1.0) float fraction);
}
public interface LazyListItemInfo {
@@ -662,7 +662,7 @@
@androidx.compose.runtime.Stable public final class LazyListState implements androidx.compose.foundation.gestures.ScrollableState {
ctor public LazyListState(optional int firstVisibleItemIndex, optional int firstVisibleItemScrollOffset);
- method public suspend Object? animateScrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? animateScrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public float dispatchRawDelta(float delta);
method public int getFirstVisibleItemIndex();
method public int getFirstVisibleItemScrollOffset();
@@ -670,7 +670,7 @@
method public androidx.compose.foundation.lazy.LazyListLayoutInfo getLayoutInfo();
method public boolean isScrollInProgress();
method public suspend Object? scroll(androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
- method public suspend Object? scrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? scrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public boolean canScrollBackward;
property public boolean canScrollForward;
property public final int firstVisibleItemIndex;
@@ -803,7 +803,7 @@
@androidx.compose.runtime.Stable public final class LazyGridState implements androidx.compose.foundation.gestures.ScrollableState {
ctor public LazyGridState(optional int firstVisibleItemIndex, optional int firstVisibleItemScrollOffset);
- method public suspend Object? animateScrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? animateScrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public float dispatchRawDelta(float delta);
method public int getFirstVisibleItemIndex();
method public int getFirstVisibleItemScrollOffset();
@@ -811,7 +811,7 @@
method public androidx.compose.foundation.lazy.grid.LazyGridLayoutInfo getLayoutInfo();
method public boolean isScrollInProgress();
method public suspend Object? scroll(androidx.compose.foundation.MutatePriority scrollPriority, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.gestures.ScrollScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block, kotlin.coroutines.Continuation<? super kotlin.Unit>);
- method public suspend Object? scrollToItem(int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
+ method public suspend Object? scrollToItem(@IntRange(from=0L) int index, optional int scrollOffset, optional kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public boolean canScrollBackward;
property public boolean canScrollForward;
property public final int firstVisibleItemIndex;
@@ -1193,7 +1193,7 @@
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(int percent);
- method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional int topLeftPercent, optional int topRightPercent, optional int bottomRightPercent, optional int bottomLeftPercent);
+ method public static androidx.compose.foundation.shape.AbsoluteCutCornerShape AbsoluteCutCornerShape(optional @IntRange(from=0L, to=100L) int topLeftPercent, optional @IntRange(from=0L, to=100L) int topRightPercent, optional @IntRange(from=0L, to=100L) int bottomRightPercent, optional @IntRange(from=0L, to=100L) int bottomLeftPercent);
}
public final class AbsoluteRoundedCornerShape extends androidx.compose.foundation.shape.CornerBasedShape {
@@ -1209,7 +1209,7 @@
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional float topLeft, optional float topRight, optional float bottomRight, optional float bottomLeft);
method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(int percent);
- method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional int topLeftPercent, optional int topRightPercent, optional int bottomRightPercent, optional int bottomLeftPercent);
+ method public static androidx.compose.foundation.shape.AbsoluteRoundedCornerShape AbsoluteRoundedCornerShape(optional @IntRange(from=0L, to=100L) int topLeftPercent, optional @IntRange(from=0L, to=100L) int topRightPercent, optional @IntRange(from=0L, to=100L) int bottomRightPercent, optional @IntRange(from=0L, to=100L) int bottomLeftPercent);
}
public abstract class CornerBasedShape implements androidx.compose.ui.graphics.Shape {
@@ -1235,7 +1235,7 @@
public final class CornerSizeKt {
method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(float size);
method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(float size);
- method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(int percent);
+ method @androidx.compose.runtime.Stable public static androidx.compose.foundation.shape.CornerSize CornerSize(@IntRange(from=0L, to=100L) int percent);
method public static androidx.compose.foundation.shape.CornerSize getZeroCornerSize();
property public static final androidx.compose.foundation.shape.CornerSize ZeroCornerSize;
}
@@ -1253,7 +1253,7 @@
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(int percent);
- method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional int topStartPercent, optional int topEndPercent, optional int bottomEndPercent, optional int bottomStartPercent);
+ method public static androidx.compose.foundation.shape.CutCornerShape CutCornerShape(optional @IntRange(from=0L, to=100L) int topStartPercent, optional @IntRange(from=0L, to=100L) int topEndPercent, optional @IntRange(from=0L, to=100L) int bottomEndPercent, optional @IntRange(from=0L, to=100L) int bottomStartPercent);
}
public final class GenericShape implements androidx.compose.ui.graphics.Shape {
@@ -1274,7 +1274,7 @@
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional float topStart, optional float topEnd, optional float bottomEnd, optional float bottomStart);
method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(int percent);
- method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional int topStartPercent, optional int topEndPercent, optional int bottomEndPercent, optional int bottomStartPercent);
+ method public static androidx.compose.foundation.shape.RoundedCornerShape RoundedCornerShape(optional @IntRange(from=0L, to=100L) int topStartPercent, optional @IntRange(from=0L, to=100L) int topEndPercent, optional @IntRange(from=0L, to=100L) int bottomEndPercent, optional @IntRange(from=0L, to=100L) int bottomStartPercent);
method public static androidx.compose.foundation.shape.RoundedCornerShape getCircleShape();
property public static final androidx.compose.foundation.shape.RoundedCornerShape CircleShape;
}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerBenchmark.kt
index 00d6d39..c4f9226 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerBenchmark.kt
@@ -93,4 +93,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(nestedScrollerCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerTestCase.kt
index 96778f3..4176188 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/NestedScrollerTestCase.kt
@@ -100,4 +100,4 @@
val state = if (useScrollerPosition) scrollState else rememberScrollState()
Row(Modifier.horizontalScroll(state), content = content)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerBenchmark.kt
index fe1e785..a97a22b 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerBenchmark.kt
@@ -93,4 +93,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(scrollerCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerTestCase.kt
index a80559c..43c37f6 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/ScrollerTestCase.kt
@@ -74,4 +74,4 @@
drawRect(Color(red = red, green = green, blue = blue))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/SimpleComponentImplementationBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/SimpleComponentImplementationBenchmark.kt
index 61c4f40..ef0fe06 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/SimpleComponentImplementationBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/SimpleComponentImplementationBenchmark.kt
@@ -300,4 +300,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/AnnotatedTextInColumnTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/AnnotatedTextInColumnTestCase.kt
index a199a83..67ffa52 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/AnnotatedTextInColumnTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/AnnotatedTextInColumnTestCase.kt
@@ -68,4 +68,4 @@
color.value = Color.Black
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/ParamUtils.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/ParamUtils.kt
index 71fc777..b60780a 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/ParamUtils.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/ParamUtils.kt
@@ -36,4 +36,4 @@
this as Array<Any>
} else {
arrayOf(selector())
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextBasicBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextBasicBenchmark.kt
index 61c650e..2f34336 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextBasicBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextBasicBenchmark.kt
@@ -152,4 +152,4 @@
fun toggleColor_draw() {
benchmarkRule.toggleStateBenchmarkDraw(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextEllipsisBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextEllipsisBenchmark.kt
index 605f891..d8e8c73 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextEllipsisBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextEllipsisBenchmark.kt
@@ -96,4 +96,4 @@
fun toggleAlignment_measureLayout() {
benchmarkRule.toggleStateBenchmarkMeasureLayout(caseFactory, assertOneRecomposition = false)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextBenchmark.kt
index 8f04fa2f9..cfc5e10 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextBenchmark.kt
@@ -147,4 +147,4 @@
fun toggleText_draw() {
benchmarkRule.toggleStateBenchmarkDraw(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextTestCase.kt
index 92c706c..3ae3e9a 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextTestCase.kt
@@ -101,4 +101,4 @@
/*do nothing*/
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextInColumnTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextInColumnTestCase.kt
index 0cdc58b..a4d56ed 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextInColumnTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextInColumnTestCase.kt
@@ -67,4 +67,4 @@
color.value = Color.Black
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextMultiStyleBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextMultiStyleBenchmark.kt
index 984ae0a..c2fb0f1 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextMultiStyleBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextMultiStyleBenchmark.kt
@@ -128,4 +128,4 @@
fun layout() {
benchmarkRule.benchmarkLayoutPerf(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextBenchmark.kt
index 58b7647..8fc96f7 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextBenchmark.kt
@@ -84,4 +84,4 @@
fun toggleText_draw() {
benchmarkRule.toggleStateBenchmarkDraw(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextTestCase.kt
index c4ea2ab..f6eb648 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextToggleTextTestCase.kt
@@ -62,4 +62,4 @@
it.value = textGenerator.nextParagraph(length = textLength)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextWithEllipsisTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextWithEllipsisTestCase.kt
index 69eb483..6017c6b 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextWithEllipsisTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextWithEllipsisTestCase.kt
@@ -67,4 +67,4 @@
override fun toggleState() {
align.value = if (align.value == TextAlign.Left) TextAlign.Right else TextAlign.Left
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/IfNotEmptyCallTextWithSpans.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/IfNotEmptyCallTextWithSpans.kt
index d37ba36..d15ec0f 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/IfNotEmptyCallTextWithSpans.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/IfNotEmptyCallTextWithSpans.kt
@@ -148,4 +148,4 @@
// we only need this for full reporting
Assume.assumeTrue(DoFullBenchmark)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/Parameters.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/Parameters.kt
index 260bfdd..1db91b9 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/Parameters.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/Parameters.kt
@@ -130,4 +130,4 @@
*/
private fun Array<Any>.cartesian(rhs: Array<Any>): List<Array<Any>> = flatMap { lhs ->
rhs.map { arrayOf(lhs, it) }
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/ParametersKtTest.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/ParametersKtTest.kt
index 53b4b07..6f0d1b9 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/ParametersKtTest.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/ParametersKtTest.kt
@@ -65,4 +65,4 @@
fun generate16() {
assertThat(generateCacheableStringOf(16)).isEqualTo("aaaaaaa aaaaaaaa")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithInlineContent.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithInlineContent.kt
index 4916430..ed02274 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithInlineContent.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithInlineContent.kt
@@ -145,4 +145,4 @@
// we only need this for full reporting
Assume.assumeTrue(DoFullBenchmark)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithSpans.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithSpans.kt
index bf8d216..1aac7da 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithSpans.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/SetTextWithSpans.kt
@@ -136,4 +136,4 @@
// we only need this for full reporting
assumeTrue(DoFullBenchmark)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/baselines/StaticLayoutBaseline.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/baselines/StaticLayoutBaseline.kt
index 4e3cd87..da0c34c 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/baselines/StaticLayoutBaseline.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/empirical/baselines/StaticLayoutBaseline.kt
@@ -132,4 +132,4 @@
textPaint, /* width = */
Int.MAX_VALUE).build()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/lazyhosted/TextLazyReuse.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/lazyhosted/TextLazyReuse.kt
index f6b097b..27c7154 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/lazyhosted/TextLazyReuse.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/lazyhosted/TextLazyReuse.kt
@@ -124,4 +124,4 @@
fun draw() {
benchmarkRule.toggleStateBenchmarkDraw(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerBenchmark.kt
index efdeef8..3ade0c5 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerBenchmark.kt
@@ -74,4 +74,4 @@
fun layout() {
benchmarkRule.benchmarkLayoutPerf(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerTestCase.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerTestCase.kt
index 30fd769..b40f714 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerTestCase.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/selection/SelectionContainerTestCase.kt
@@ -38,4 +38,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/view/AndroidNestedScrollViewBenchmark.kt b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/view/AndroidNestedScrollViewBenchmark.kt
index 3018e16..f3fca79 100644
--- a/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/view/AndroidNestedScrollViewBenchmark.kt
+++ b/compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/view/AndroidNestedScrollViewBenchmark.kt
@@ -88,4 +88,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(nestedScrollCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/build.gradle b/compose/foundation/foundation/build.gradle
index 3126b99..60bba5d 100644
--- a/compose/foundation/foundation/build.gradle
+++ b/compose/foundation/foundation/build.gradle
@@ -131,7 +131,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
implementation(libs.truth)
implementation(libs.junit)
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/AnchoredDraggableDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/AnchoredDraggableDemo.kt
index cbf4991..f30eb59 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/AnchoredDraggableDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/AnchoredDraggableDemo.kt
@@ -39,4 +39,4 @@
Spacer(Modifier.height(50.dp))
AnchoredDraggableCustomAnchoredSample()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/BasicMarqueeDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/BasicMarqueeDemo.kt
index c7192ca..e563758 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/BasicMarqueeDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/BasicMarqueeDemo.kt
@@ -203,4 +203,4 @@
.focusRequester(focusRequester)
.then(if (animationMode == WhileFocused) Modifier.focusable() else Modifier)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FocusedBoundsDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FocusedBoundsDemo.kt
index ced9464..94fea4b 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FocusedBoundsDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FocusedBoundsDemo.kt
@@ -356,4 +356,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt
index 61254a9..0a710a5 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/HighLevelGesturesDemo.kt
@@ -48,4 +48,4 @@
Spacer(Modifier.height(50.dp))
HoverableSample()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt
index c375e4e..56d322d 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/OverscrollDemo.kt
@@ -43,4 +43,4 @@
Spacer(Modifier.height(50.dp))
OverscrollWithDraggable_After()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PointerIconDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PointerIconDemo.kt
index 4c73cb5..4ce3e6a7 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PointerIconDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/PointerIconDemo.kt
@@ -229,4 +229,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
index 92d0c13..b333d14 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
@@ -277,4 +277,4 @@
layout(placeable.width, placeable.height) {
placeable.place(IntOffset.Zero)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/WindowInsetsDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/WindowInsetsDemo.kt
index 2f682ff..030e322 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/WindowInsetsDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/WindowInsetsDemo.kt
@@ -95,4 +95,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerCarrouselDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerCarrouselDemos.kt
index 326bac5..c5122ee 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerCarrouselDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerCarrouselDemos.kt
@@ -154,4 +154,4 @@
): Int {
return (availableSpace - 2 * pageSpacing) / 3
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerDemos.kt
index 242498a..c0e3211 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerDemos.kt
@@ -142,4 +142,4 @@
}
}
-internal const val PagesCount = 40
\ No newline at end of file
+internal const val PagesCount = 40
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerStateInteractionsDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerStateInteractionsDemos.kt
index 5922b08..540e7f5 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerStateInteractionsDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/pager/PagerStateInteractionsDemos.kt
@@ -121,4 +121,4 @@
}
PageMonitor(Modifier, pagerState)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewAndroidInteropDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewAndroidInteropDemo.kt
index 589d9ca..31a1594 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewAndroidInteropDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewAndroidInteropDemo.kt
@@ -108,4 +108,4 @@
fun setContent(content: @Composable () -> Unit) {
composeView.setContent(content)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewResponderDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewResponderDemo.kt
index 85d2663..37adf80 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewResponderDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewResponderDemo.kt
@@ -116,4 +116,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringNestedIntoViewDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringNestedIntoViewDemo.kt
index cb26929..a941f51 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringNestedIntoViewDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringNestedIntoViewDemo.kt
@@ -143,4 +143,4 @@
modifier = Modifier.align(Alignment.Center)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringRectangleIntoViewDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringRectangleIntoViewDemo.kt
index 63c563e..045a916 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringRectangleIntoViewDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringRectangleIntoViewDemo.kt
@@ -30,4 +30,4 @@
)
BringPartOfComposableIntoViewSample()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/LazyListSnappingDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/LazyListSnappingDemos.kt
index 58c29e2..962eaf7 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/LazyListSnappingDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/LazyListSnappingDemos.kt
@@ -154,4 +154,4 @@
}
}
-private val PagesSizes = (0..ItemNumber).toList().map { (50..500).random().dp }
\ No newline at end of file
+private val PagesSizes = (0..ItemNumber).toList().map { (50..500).random().dp }
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnapLayoutInfoProvider.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnapLayoutInfoProvider.kt
index 203eae5..f2e5bae 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnapLayoutInfoProvider.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnapLayoutInfoProvider.kt
@@ -85,4 +85,4 @@
} else {
0f
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnappingDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnappingDemos.kt
index ef0f3387..e28f6a6 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnappingDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/snapping/RowSnappingDemos.kt
@@ -191,4 +191,4 @@
}
}
-private val RowItemSize = 250.dp
\ No newline at end of file
+private val RowItemSize = 250.dp
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/BasicTextMinMaxLinesDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/BasicTextMinMaxLinesDemo.kt
index a4a4281..b837381 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/BasicTextMinMaxLinesDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/BasicTextMinMaxLinesDemo.kt
@@ -135,4 +135,4 @@
minLines = minLines,
maxLines = maxLines
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
index a8ac543..5b79b87 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/CapitalizationAutoCorrectDemo.kt
@@ -104,4 +104,4 @@
textStyle = TextStyle(fontSize = fontSize8),
cursorBrush = SolidColor(Color.Red)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
index 6186f91..9d90318 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
@@ -103,4 +103,4 @@
val demoTextFieldModifiers = Modifier
.padding(6.dp)
.border(1.dp, Color.LightGray, RoundedCornerShape(6.dp))
- .padding(6.dp)
\ No newline at end of file
+ .padding(6.dp)
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputFieldMinMaxLines.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputFieldMinMaxLines.kt
index d760925..b29943c 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputFieldMinMaxLines.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputFieldMinMaxLines.kt
@@ -158,4 +158,4 @@
}
private fun createMultilineText(lineCount: Int) =
- (1..lineCount).joinToString("\n") { "Line $it" }
\ No newline at end of file
+ (1..lineCount).joinToString("\n") { "Line $it" }
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
index 5a10e21..554f07a 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
@@ -891,4 +891,4 @@
overflow = if (ellipsis) TextOverflow.Ellipsis else TextOverflow.Clip
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextAccessibility.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextAccessibility.kt
index f3ccb2e..3233e37 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextAccessibility.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextAccessibility.kt
@@ -83,4 +83,4 @@
style = TextStyle(fontSize = fontSize8)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextOverflownSelection.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextOverflownSelection.kt
index 3055a47..422f01e 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextOverflownSelection.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeTextOverflownSelection.kt
@@ -243,4 +243,4 @@
onTextLayout = onTextLayout,
style = style
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/EmojiCompatDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/EmojiCompatDemo.kt
index 0b97cfc..8f45f11 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/EmojiCompatDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/EmojiCompatDemo.kt
@@ -58,4 +58,4 @@
onValueChange = { textFieldValue.value = it }
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FocusTextFieldImmediatelyDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FocusTextFieldImmediatelyDemo.kt
index c750f11..ad82db8 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FocusTextFieldImmediatelyDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FocusTextFieldImmediatelyDemo.kt
@@ -45,4 +45,4 @@
.wrapContentSize()
.focusRequester(focusRequester)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FullScreenTextFieldDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FullScreenTextFieldDemo.kt
index ab5d1e1..fa26f8f 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FullScreenTextFieldDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FullScreenTextFieldDemo.kt
@@ -39,4 +39,4 @@
.border(3.dp, MaterialTheme.colors.primary)
.fillMaxSize()
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
index 07d79f0..d94de02 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/KeyboardSingleLineDemo.kt
@@ -147,4 +147,4 @@
textStyle = TextStyle(fontSize = fontSize8),
cursorBrush = SolidColor(Color.Red)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
index f571dc0..f62350d 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
@@ -91,4 +91,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LoremIpsum.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LoremIpsum.kt
index cf1da10..ac9670c 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LoremIpsum.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LoremIpsum.kt
@@ -95,4 +95,4 @@
ישראל בקלות לטיפול בה שמו. שנתי בגרסה האנציקלופדיה זכר של, של חשמל לימודים האטמוספירה מתן, לוח
על ובמתן קישורים עקרונות. סדר את החול רוסית, תנך למנוע ברוכים דת, מדע אל ניווט ניהול והנדסה.
בה צעד בקלות אנגלית שימושיים. על ערכים נבחרים הספרות כדי, ארץ ליום טיפול ברוכים מה.
-""".trimIndent()
\ No newline at end of file
+""".trimIndent()
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/PlatformTextInputAdapterDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/PlatformTextInputAdapterDemo.kt
index c5f1175..01395db 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/PlatformTextInputAdapterDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/PlatformTextInputAdapterDemo.kt
@@ -384,4 +384,4 @@
block()
endBatchEdit()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/RejectTextChangeDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/RejectTextChangeDemo.kt
index 442fe98..d5f1028 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/RejectTextChangeDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/RejectTextChangeDemo.kt
@@ -70,4 +70,4 @@
state.value = it
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
index bc0cda0..9573d68 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
@@ -174,4 +174,4 @@
pathEffect: PathEffect? = this.pathEffect
): Stroke {
return Stroke(width, miter, cap, join, pathEffect)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TailFollowingTextField.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TailFollowingTextField.kt
index 4df0c2c..e680aa4 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TailFollowingTextField.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TailFollowingTextField.kt
@@ -134,4 +134,4 @@
p.placeRelative(0, yOffset)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt
index 11ff3eb..5832afa 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt
@@ -24,6 +24,7 @@
import androidx.compose.foundation.demos.text2.KeyboardOptionsDemos
import androidx.compose.foundation.demos.text2.ScrollableDemos
import androidx.compose.foundation.demos.text2.SwapFieldSameStateDemo
+import androidx.compose.foundation.demos.text2.TextFieldLineLimitsDemos
import androidx.compose.integration.demos.common.ComposableDemo
import androidx.compose.integration.demos.common.DemoCategory
@@ -134,6 +135,7 @@
ComposableDemo("Basic text input") { BasicTextField2Demos() },
ComposableDemo("Keyboard Options") { KeyboardOptionsDemos() },
ComposableDemo("Decoration Box") { DecorationBoxDemos() },
+ ComposableDemo("Line limits") { TextFieldLineLimitsDemos() },
ComposableDemo("Scroll") { ScrollableDemos() },
ComposableDemo("Filters") { BasicTextField2FilterDemos() },
ComposableDemo("Secure Field") { BasicSecureTextFieldDemos() },
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldCursorBlinkingDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldCursorBlinkingDemo.kt
index 880f509..256e745c 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldCursorBlinkingDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldCursorBlinkingDemo.kt
@@ -197,4 +197,4 @@
textStyle = TextStyle.Default.copy(fontFamily = FontFamily.Monospace)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldFocusKeyboardInteraction.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldFocusKeyboardInteraction.kt
index 0d01e6b..763a665 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldFocusKeyboardInteraction.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldFocusKeyboardInteraction.kt
@@ -169,4 +169,4 @@
}
addView(innerCompose, LayoutParams(MATCH_PARENT, WRAP_CONTENT))
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldWIthScroller.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldWIthScroller.kt
index 7d8c550..612aebe 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldWIthScroller.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldWIthScroller.kt
@@ -68,4 +68,4 @@
singleLine = true,
textStyle = TextStyle(fontSize = fontSize8)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
index 9160ae4..d7244bb 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
@@ -155,4 +155,4 @@
onValueChange = { text = it },
modifier = Modifier.focusRequester(focusRequester)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
index 8e052ff..970c573 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
@@ -297,4 +297,4 @@
fun TextPaint.compatSetFontVariationSettings(variationSettings: String) {
fontVariationSettings = variationSettings
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VisualTransformationDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VisualTransformationDemo.kt
index 7889ff5..8189632 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VisualTransformationDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VisualTransformationDemo.kt
@@ -294,4 +294,4 @@
textStyle = TextStyle(fontSize = fontSize8)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicSecureTextFieldDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicSecureTextFieldDemos.kt
index c4030ea..1da74a7 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicSecureTextFieldDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicSecureTextFieldDemos.kt
@@ -127,4 +127,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2CustomPinFieldDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2CustomPinFieldDemo.kt
index 6019627..117335b 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2CustomPinFieldDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2CustomPinFieldDemo.kt
@@ -223,4 +223,4 @@
}
}
Text(text, fontFamily = FontFamily.Monospace)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2FilterDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2FilterDemos.kt
index dd2377b..d394e9e 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2FilterDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/BasicTextField2FilterDemos.kt
@@ -133,4 +133,4 @@
modifier = demoTextFieldModifiers
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/DecorationBoxDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/DecorationBoxDemos.kt
index 8e69817..af8e58c 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/DecorationBoxDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/DecorationBoxDemos.kt
@@ -90,4 +90,4 @@
)
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/KeyboardOptionsDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/KeyboardOptionsDemos.kt
index 3590e8e..099d1e6 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/KeyboardOptionsDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/KeyboardOptionsDemos.kt
@@ -82,4 +82,4 @@
.fillMaxWidth()
.padding(6.dp)
.border(1.dp, Color.LightGray, RoundedCornerShape(6.dp))
- .padding(6.dp)
\ No newline at end of file
+ .padding(6.dp)
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/ScrollDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/ScrollDemos.kt
index edd9b9c..b144879 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/ScrollDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/ScrollDemos.kt
@@ -18,6 +18,8 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.demos.text.TagLine
+import androidx.compose.foundation.demos.text.fontSize8
+import androidx.compose.foundation.demos.text.loremIpsum
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@@ -29,12 +31,18 @@
import androidx.compose.foundation.text2.input.TextFieldLineLimits.MultiLine
import androidx.compose.foundation.text2.input.TextFieldLineLimits.SingleLine
import androidx.compose.foundation.text2.input.TextFieldState
+import androidx.compose.material.Button
import androidx.compose.material.Slider
+import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.focus.focusRequester
+import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.coerceIn
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import kotlin.math.roundToInt
@@ -72,6 +80,11 @@
TagLine(tag = "Shared Hoisted ScrollState")
SharedHoistedScroll()
}
+
+ item {
+ TagLine(tag = "Selectable with no interaction")
+ SelectionWithNoInteraction()
+ }
}
}
@@ -79,12 +92,13 @@
@Composable
fun SingleLineHorizontalScrollableTextField() {
val state = remember {
- TextFieldState("When content gets long,this field should scroll horizontally")
+ TextFieldState(loremIpsum(wordCount = 100))
}
BasicTextField2(
state = state,
lineLimits = SingleLine,
- textStyle = TextStyle(fontSize = 24.sp)
+ textStyle = TextStyle(fontSize = 24.sp),
+ modifier = Modifier.padding(horizontal = 32.dp)
)
}
@@ -106,12 +120,7 @@
@Composable
fun SingleLineVerticalScrollableTextField() {
val state = remember {
- TextFieldState(
- buildString {
- repeat(10) {
- appendLine("When content gets long, this field should scroll vertically")
- }
- })
+ TextFieldState("When content gets long, this field should scroll vertically\n".repeat(10))
}
BasicTextField2(
state = state,
@@ -124,13 +133,7 @@
@Composable
fun MultiLineVerticalScrollableTextField() {
val state = remember {
- TextFieldState(
- buildString {
- repeat(10) {
- appendLine("When content gets long, this field should scroll vertically")
- }
- }
- )
+ TextFieldState(loremIpsum(wordCount = 200))
}
BasicTextField2(
state = state,
@@ -200,4 +203,47 @@
lineLimits = SingleLine
)
}
-}
\ No newline at end of file
+}
+
+@OptIn(ExperimentalFoundationApi::class)
+@Composable
+fun SelectionWithNoInteraction() {
+ val state =
+ remember { TextFieldState("Hello, World!", initialSelectionInChars = TextRange(1, 5)) }
+ val focusRequester = remember { FocusRequester() }
+ Column {
+ Button(onClick = { focusRequester.requestFocus() }) {
+ Text("Focus")
+ }
+ Button(onClick = {
+ state.edit {
+ selectCharsIn(
+ TextRange(
+ state.text.selectionInChars.start - 1,
+ state.text.selectionInChars.end
+ ).coerceIn(0, state.text.length)
+ )
+ }
+ }) {
+ Text("Increase Selection to Left")
+ }
+ Button(onClick = {
+ state.edit {
+ selectCharsIn(
+ TextRange(
+ state.text.selectionInChars.start,
+ state.text.selectionInChars.end + 1
+ ).coerceIn(0, state.text.length)
+ )
+ }
+ }) {
+ Text("Increase Selection to Right")
+ }
+ BasicTextField2(
+ state = state,
+ modifier = demoTextFieldModifiers.focusRequester(focusRequester),
+ textStyle = TextStyle(fontSize = fontSize8),
+ lineLimits = SingleLine
+ )
+ }
+}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/TextFieldLineLimitsDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/TextFieldLineLimitsDemos.kt
new file mode 100644
index 0000000..bfd72d8
--- /dev/null
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text2/TextFieldLineLimitsDemos.kt
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.demos.text2
+
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.demos.text.TagLine
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.text2.BasicTextField2
+import androidx.compose.foundation.text2.input.TextFieldLineLimits
+import androidx.compose.foundation.text2.input.rememberTextFieldState
+import androidx.compose.material.LocalTextStyle
+import androidx.compose.material.Slider
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import kotlin.math.roundToInt
+
+@Composable
+fun TextFieldLineLimitsDemos() {
+ Column(Modifier.padding(16.dp)) {
+ TagLine(tag = "Default")
+ DefaultLineLimits()
+
+ TagLine(tag = "Single")
+ SingleLineLimits()
+
+ TagLine(tag = "MultiLine")
+ MultiLineLimits()
+ }
+}
+
+@OptIn(ExperimentalFoundationApi::class)
+@Composable
+fun DefaultLineLimits() {
+ Text("Default")
+
+ BasicTextField2(
+ state = rememberTextFieldState(),
+ lineLimits = TextFieldLineLimits.Default,
+ textStyle = LocalTextStyle.current,
+ modifier = demoTextFieldModifiers
+ )
+}
+
+@OptIn(ExperimentalFoundationApi::class)
+@Composable
+fun SingleLineLimits() {
+ Text("Single Line")
+
+ BasicTextField2(
+ state = rememberTextFieldState(),
+ lineLimits = TextFieldLineLimits.SingleLine,
+ textStyle = LocalTextStyle.current,
+ modifier = demoTextFieldModifiers
+ )
+}
+
+@OptIn(ExperimentalFoundationApi::class)
+@Composable
+fun MultiLineLimits() {
+ Text("Multi Line")
+
+ var minLines by remember { mutableIntStateOf(2) }
+ var maxLines by remember { mutableIntStateOf(5) }
+
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("Min: $minLines")
+ Slider(
+ value = minLines.toFloat(),
+ onValueChange = {
+ minLines = it.roundToInt()
+ },
+ valueRange = 1f..10f,
+ steps = 9
+ )
+ }
+
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("Max: $maxLines")
+ Slider(
+ value = maxLines.toFloat(),
+ onValueChange = {
+ maxLines = it.roundToInt()
+ },
+ valueRange = 1f..10f,
+ steps = 9
+ )
+ }
+
+ maxLines = maxLines.coerceAtLeast(minLines)
+
+ BasicTextField2(
+ state = rememberTextFieldState(),
+ lineLimits = TextFieldLineLimits.MultiLine(
+ minHeightInLines = minLines,
+ maxHeightInLines = maxLines
+ ),
+ textStyle = LocalTextStyle.current,
+ modifier = demoTextFieldModifiers
+ )
+}
diff --git a/compose/foundation/foundation/lint-baseline.xml b/compose/foundation/foundation/lint-baseline.xml
index 3e9de82..b7518e9 100644
--- a/compose/foundation/foundation/lint-baseline.xml
+++ b/compose/foundation/foundation/lint-baseline.xml
@@ -2010,6 +2010,42 @@
<issue
id="PrimitiveInLambda"
+ message="Use a functional interface instead of lambda syntax for lambdas with primitive values in constructor TransformableElement has parameter 'canPan' with type Function1<? super Offset, Boolean>."
+ errorLine1=" private val canPan: (Offset) -> Boolean,"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt"/>
+ </issue>
+
+ <issue
+ id="PrimitiveInLambda"
+ message="Use a functional interface instead of lambda syntax for lambdas with primitive values in constructor TransformableNode has parameter 'canPan' with type Function1<? super Offset, Boolean>."
+ errorLine1=" private var canPan: (Offset) -> Boolean,"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt"/>
+ </issue>
+
+ <issue
+ id="PrimitiveInLambda"
+ message="Use a functional interface instead of lambda syntax for lambdas with primitive values in method update has parameter 'canPan' with type Function1<? super Offset, Boolean>."
+ errorLine1=" canPan: (Offset) -> Boolean,"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt"/>
+ </issue>
+
+ <issue
+ id="PrimitiveInLambda"
+ message="Use a functional interface instead of lambda syntax for lambdas with primitive values in method detectZoom has parameter 'canPan' with type Function1<? super Offset, Boolean>."
+ errorLine1=" canPan: (Offset) -> Boolean"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt"/>
+ </issue>
+
+ <issue
+ id="PrimitiveInLambda"
message="Use a functional interface instead of lambda syntax for lambdas with primitive values in method TransformableState has parameter 'onTransformation' with type Function3<? super Float, ? super Offset, ? super Float, Unit>."
errorLine1=" onTransformation: (zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicMarqueeSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicMarqueeSamples.kt
index 68fb03c..400d565 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicMarqueeSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicMarqueeSamples.kt
@@ -114,4 +114,4 @@
)
.padding(start = edgeWidth)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextField2Samples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextField2Samples.kt
index 297625e..5164a0f 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextField2Samples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextField2Samples.kt
@@ -323,4 +323,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextFieldSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextFieldSamples.kt
index 643dbb6..d23c6354 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextFieldSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextFieldSamples.kt
@@ -173,4 +173,4 @@
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
visualTransformation = creditCardTransformation
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BringIntoViewSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BringIntoViewSamples.kt
index 2c69231..49f37aa 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BringIntoViewSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BringIntoViewSamples.kt
@@ -109,4 +109,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/CustomTouchSlopSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/CustomTouchSlopSample.kt
index 728b693..7da06be 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/CustomTouchSlopSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/CustomTouchSlopSample.kt
@@ -81,4 +81,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DraggableSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DraggableSamples.kt
index 0d930bd..2272be5 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DraggableSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DraggableSamples.kt
@@ -65,4 +65,4 @@
.background(Color.Red)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DrawBackgroundSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DrawBackgroundSamples.kt
index b876f7c..8e0b290 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DrawBackgroundSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/DrawBackgroundSamples.kt
@@ -49,4 +49,4 @@
Modifier.background(brush = gradientBrush, shape = CutCornerShape(8.dp))
.padding(10.dp)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/HoverableSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/HoverableSample.kt
index 411477d..1b12eeb 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/HoverableSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/HoverableSample.kt
@@ -49,4 +49,4 @@
) {
Text(if (isHovered) "Hovered" else "Unhovered")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ImageSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ImageSamples.kt
index 0210fd2..45d87f3 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ImageSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ImageSamples.kt
@@ -90,4 +90,4 @@
Paint().apply { this.color = Color.Cyan }
)
return ImageBitmap
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/IndicationSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/IndicationSamples.kt
index c179ae1..ce2ce25 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/IndicationSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/IndicationSamples.kt
@@ -59,4 +59,4 @@
.padding(10.dp)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/InlineTextContentSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/InlineTextContentSample.kt
index 0771d6e..68195dc 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/InlineTextContentSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/InlineTextContentSample.kt
@@ -64,4 +64,4 @@
)
BasicText(text = text, inlineContent = inlineContent)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/PagerSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/PagerSamples.kt
index 78597e0..5d26bb0 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/PagerSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/PagerSamples.kt
@@ -337,4 +337,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ProgressSemanticsSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ProgressSemanticsSamples.kt
index 1727eb8..e23506f 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ProgressSemanticsSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ProgressSemanticsSamples.kt
@@ -45,4 +45,4 @@
Box(Modifier.progressSemantics().background(color = Color.Cyan)) {
Text("Operation is on progress")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectableSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectableSamples.kt
index 6ccea23..887af98 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectableSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectableSamples.kt
@@ -56,4 +56,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectionSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectionSample.kt
index 38973fb..0fd45a2 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectionSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SelectionSample.kt
@@ -50,4 +50,4 @@
Text("Text 3")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SnapFlingBehaviorSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SnapFlingBehaviorSample.kt
index 63a0821..0b3b0e9 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SnapFlingBehaviorSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/SnapFlingBehaviorSample.kt
@@ -93,4 +93,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt
index b78ea5d..08020bd 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TapGestureSamples.kt
@@ -68,4 +68,4 @@
.border(BorderStroke(2.dp, Color.Black))
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ToggleableSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ToggleableSamples.kt
index 61470c1..0390aca 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ToggleableSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/ToggleableSamples.kt
@@ -54,4 +54,4 @@
),
text = checked.toString()
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt
index f0c3785..1c9eddb 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformGestureSamples.kt
@@ -203,4 +203,4 @@
}
.fillMaxSize()
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformableSample.kt b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformableSample.kt
index 7d3b75e..cd45706 100644
--- a/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformableSample.kt
+++ b/compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/TransformableSample.kt
@@ -175,4 +175,4 @@
.border(2.dp, Color.Black)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
index 7cc04da..574672e 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
@@ -309,4 +309,4 @@
LocalDensity.current.content()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BaseLazyLayoutTestWithOrientation.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BaseLazyLayoutTestWithOrientation.kt
index 7a60556..571c316 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BaseLazyLayoutTestWithOrientation.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BaseLazyLayoutTestWithOrientation.kt
@@ -166,4 +166,4 @@
companion object {
internal const val FrameDuration = 16L
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BasicMarqueeTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BasicMarqueeTest.kt
index 0bf0f46..b9d2d55 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BasicMarqueeTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BasicMarqueeTest.kt
@@ -1262,4 +1262,4 @@
}
return -1
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
index 1eb8626..8eb3ab4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BorderTest.kt
@@ -634,4 +634,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/CanvasTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/CanvasTest.kt
index 2af33e2..e7ff30b 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/CanvasTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/CanvasTest.kt
@@ -232,4 +232,4 @@
shapeOverlapPixelCount = 2.0f
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt
index eb18a04..d0f5579 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableInScrollableViewGroupTest.kt
@@ -269,4 +269,4 @@
.isEqualTo(interactions[0])
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt
index 9cb4e69..684016b 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt
@@ -49,7 +49,10 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import com.google.common.truth.Truth.assertThat
+import kotlin.test.assertTrue
import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.junit.After
@@ -920,6 +923,41 @@
}
@Test
+ fun onDragStopped_inputChanged_shouldNotCancelScope() {
+ val enabled = mutableStateOf(true)
+ lateinit var runningJob: Job
+ rule.setContent {
+ Box(
+ modifier = Modifier
+ .testTag(draggableBoxTag)
+ .size(100.dp)
+ .draggable(
+ enabled = enabled.value,
+ state = rememberDraggableState { },
+ orientation = Orientation.Vertical,
+ onDragStopped = { _ ->
+ runningJob = launch { delay(10_000L) } // long running operation
+ }
+ )
+ )
+ }
+
+ rule.onNodeWithTag(draggableBoxTag).performTouchInput {
+ down(center)
+ moveBy(Offset(100f, 100f))
+ up()
+ }
+
+ rule.runOnIdle {
+ enabled.value = false // cancels pointer input scope
+ }
+
+ rule.runOnIdle {
+ assertTrue { runningJob.isActive } // check if scope is still active
+ }
+ }
+
+ @Test
fun testInspectableValue() {
rule.setContent {
val modifier = Modifier.draggable(
@@ -978,4 +1016,4 @@
state = state
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusGroupTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusGroupTest.kt
index 5d6a7491..b57493a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusGroupTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusGroupTest.kt
@@ -458,4 +458,4 @@
@OptIn(ExperimentalFoundationApi::class)
Box(modifier.focusGroup(), content)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableBoundsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableBoundsTest.kt
index 24fa74b..73e2677 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableBoundsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableBoundsTest.kt
@@ -555,4 +555,4 @@
).inOrder()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/GoldenCommon.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/GoldenCommon.kt
index 16051e6..9d96777 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/GoldenCommon.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/GoldenCommon.kt
@@ -16,4 +16,4 @@
package androidx.compose.foundation
-internal const val GOLDEN_UI = "compose/foundation/foundation"
\ No newline at end of file
+internal const val GOLDEN_UI = "compose/foundation/foundation"
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/HoverableTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/HoverableTest.kt
index 3b480d2..f07ce54 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/HoverableTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/HoverableTest.kt
@@ -325,4 +325,4 @@
.isEqualTo(interactions[0])
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ImageTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ImageTest.kt
index d0bd0e5..131103e 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ImageTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ImageTest.kt
@@ -698,4 +698,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/LazyListFocusableInteractionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/LazyListFocusableInteractionTest.kt
index 0c7279d..4a83d52 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/LazyListFocusableInteractionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/LazyListFocusableInteractionTest.kt
@@ -700,4 +700,4 @@
Vertical -> assertTopPositionInRootIsEqualTo(expected)
Horizontal -> assertLeftPositionInRootIsEqualTo(expected)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt
index a7aa350..056f526 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/OverscrollScreenshotTest.kt
@@ -205,4 +205,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ProgressSemanticsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ProgressSemanticsTest.kt
index eadd420..3392a48 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ProgressSemanticsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ProgressSemanticsTest.kt
@@ -99,4 +99,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt
index 23fae09..986b0cc 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt
@@ -686,4 +686,4 @@
Vertical -> assertTopPositionInRootIsEqualTo(expected)
Horizontal -> assertLeftPositionInRootIsEqualTo(expected)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
index 234a4c5..b5fe0b2 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
@@ -2776,4 +2776,4 @@
)
}
-internal class TestScrollMotionDurationScale(override val scaleFactor: Float) : MotionDurationScale
\ No newline at end of file
+internal class TestScrollMotionDurationScale(override val scaleFactor: Float) : MotionDurationScale
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt
index 76e5125..3feaf98 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/StretchOverscrollTest.kt
@@ -266,4 +266,4 @@
get() = scrollableState.isScrollInProgress
}
-private const val OverscrollBox = "box"
\ No newline at end of file
+private const val OverscrollBox = "box"
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SystemGestureExclusionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SystemGestureExclusionTest.kt
index 8314fe4..bd9753d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SystemGestureExclusionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SystemGestureExclusionTest.kt
@@ -234,4 +234,4 @@
}
return null
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
index 6565d4e..536921e 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableStateTest.kt
@@ -983,4 +983,4 @@
private val defaultVelocityThreshold: () -> Float = { with(rule.density) { 125.dp.toPx() } }
private val defaultAnimationSpec = tween<Float>()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableTestValue.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableTestValue.kt
index 54bfc02..e238c58 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableTestValue.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/anchoredDraggable/AnchoredDraggableTestValue.kt
@@ -16,4 +16,4 @@
package androidx.compose.foundation.anchoredDraggable
-internal enum class AnchoredDraggableTestValue { A, B, C }
\ No newline at end of file
+internal enum class AnchoredDraggableTestValue { A, B, C }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/DragGestureDetectorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/DragGestureDetectorTest.kt
index edd29e1..3fd332c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/DragGestureDetectorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/DragGestureDetectorTest.kt
@@ -685,4 +685,4 @@
}
assertTrue(gestureCanceled)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/TransformGestureDetectorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/TransformGestureDetectorTest.kt
index 44a51df..031cabe 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/TransformGestureDetectorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/TransformGestureDetectorTest.kt
@@ -603,4 +603,4 @@
assertFalse(rotated)
assertEquals(50f, panAmount.x, 0.1f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapFlingBehaviorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapFlingBehaviorTest.kt
index af3679b..6294141 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapFlingBehaviorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapFlingBehaviorTest.kt
@@ -520,4 +520,4 @@
val ItemSize = 200.dp
const val TestTag = "MainList"
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapLayoutInfoProviderTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapLayoutInfoProviderTest.kt
index 4bbab00..b828a84 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapLayoutInfoProviderTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyGridSnapLayoutInfoProviderTest.kt
@@ -257,4 +257,4 @@
val FixedItemSize = 200.dp
val DynamicItemSizes = (200..500).map { it.dp }
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapFlingBehaviorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapFlingBehaviorTest.kt
index 603bbf7..e33c7cc 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapFlingBehaviorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapFlingBehaviorTest.kt
@@ -518,4 +518,4 @@
performFling(initialVelocity, onAnimationStep)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapLayoutInfoProviderTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapLayoutInfoProviderTest.kt
index 543a606..259f657 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapLayoutInfoProviderTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/LazyListSnapLayoutInfoProviderTest.kt
@@ -216,4 +216,4 @@
val FixedItemSize = 200.dp
val DynamicItemSizes = (200..500).map { it.dp }
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/SnapFlingBehaviorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/SnapFlingBehaviorTest.kt
index e3c7a2a..cc10f6f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/SnapFlingBehaviorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/snapping/SnapFlingBehaviorTest.kt
@@ -568,4 +568,4 @@
density = density
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
index dcb34e1..0bf7bf5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
@@ -138,4 +138,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPinnableContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPinnableContainerTest.kt
index a2ce246..38a076d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPinnableContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridPinnableContainerTest.kt
@@ -663,4 +663,4 @@
assertThat(parent2Pinned).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanTest.kt
index 43b355e..71da15f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanTest.kt
@@ -298,4 +298,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/BaseLazyListTestWithOrientation.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
index b96ee7a..53a5d47 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
@@ -265,4 +265,4 @@
beyondBoundsItemCount = beyondBoundsItemCount,
content = content
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
index 67556ba..978019a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyColumnTest.kt
@@ -505,4 +505,4 @@
Offset(-inflate, -inflate),
Size(size.width + inflate * 2, size.height + inflate * 2)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
index 9c97094..d425262 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
@@ -485,4 +485,4 @@
private class MyClass(val id: Int)
}
-val LazyListState.visibleKeys: List<Any> get() = layoutInfo.visibleItemsInfo.map { it.key }
\ No newline at end of file
+val LazyListState.visibleKeys: List<Any> get() = layoutInfo.visibleItemsInfo.map { it.key }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListAnimateItemPlacementTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListAnimateItemPlacementTest.kt
index 416fc19..56e4118 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListAnimateItemPlacementTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListAnimateItemPlacementTest.kt
@@ -2043,4 +2043,4 @@
)
)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsAndExtraItemsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsAndExtraItemsTest.kt
index 3be7e19..9c541a1 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsAndExtraItemsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsAndExtraItemsTest.kt
@@ -245,4 +245,4 @@
private fun Modifier.trackPlaced(index: Int): Modifier =
this then TrackPlacedElement(placedItems, index)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsItemCountTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsItemCountTest.kt
index 83d87ed..2daecbe 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsItemCountTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListBeyondBoundsItemCountTest.kt
@@ -172,4 +172,4 @@
throw AssertionError(errorMessageOnFail)
}
return this
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListHeadersTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListHeadersTest.kt
index 958ca81..881dd61 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListHeadersTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListHeadersTest.kt
@@ -514,4 +514,4 @@
beyondBoundsItemCount = beyondBoundsItemCount,
content = content
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListPinnableContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListPinnableContainerTest.kt
index 1b9ebac..ebfa52d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListPinnableContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListPinnableContainerTest.kt
@@ -642,4 +642,4 @@
throw AssertionError(errorMessageOnFail)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListTest.kt
index 19191a5..04abbf2 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListTest.kt
@@ -2960,4 +2960,4 @@
}
}
-private const val ItemSize = 100
\ No newline at end of file
+private const val ItemSize = 100
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListsIndexedTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListsIndexedTest.kt
index 41fc6d4..0f07e16 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListsIndexedTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListsIndexedTest.kt
@@ -258,4 +258,4 @@
beyondBoundsItemCount = beyondBoundsItemCount,
content = content
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyScrollTest.kt
index 14fe3b1..02e397e 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyScrollTest.kt
@@ -414,4 +414,4 @@
@Parameterized.Parameters(name = "{0}")
fun params() = arrayOf(Orientation.Vertical, Orientation.Horizontal)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/BaseLazyStaggeredGridWithOrientation.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/BaseLazyStaggeredGridWithOrientation.kt
index eefbbc4..10931e1 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/BaseLazyStaggeredGridWithOrientation.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/BaseLazyStaggeredGridWithOrientation.kt
@@ -120,4 +120,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimatedScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimatedScrollTest.kt
index d68ad55..f5e5bb5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimatedScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimatedScrollTest.kt
@@ -323,4 +323,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridContentPaddingTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridContentPaddingTest.kt
index 0fd910b..81589b6 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridContentPaddingTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridContentPaddingTest.kt
@@ -364,4 +364,4 @@
rule.onNodeWithTag(LazyStaggeredGrid)
.assertMainAxisSizeIsEqualTo(itemSizeDp * 6)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfoTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfoTest.kt
index aac67a3..3c15d97 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfoTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfoTest.kt
@@ -108,4 +108,4 @@
laneInfo.setGaps(0, null)
assertThat(laneInfo.getGaps(0)).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLayoutInfoTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLayoutInfoTest.kt
index f078506..2dfc120 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLayoutInfoTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLayoutInfoTest.kt
@@ -52,4 +52,4 @@
.isEqualTo(listOf(0, 1, null))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridPinnableContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridPinnableContainerTest.kt
index 5796438..8389142 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridPinnableContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridPinnableContainerTest.kt
@@ -665,4 +665,4 @@
assertThat(parent2Pinned).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridReverseLayoutTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridReverseLayoutTest.kt
index 344ebe3..3ce5850 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridReverseLayoutTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridReverseLayoutTest.kt
@@ -463,4 +463,4 @@
.assertMainAxisStartPositionInRootIsEqualTo(itemSize * 1.5f)
}
// initial position
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScrollTest.kt
index d52aa77..05ba1df 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScrollTest.kt
@@ -247,4 +247,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/EmptyPagerTests.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/EmptyPagerTests.kt
index 3527b40..044636b 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/EmptyPagerTests.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/EmptyPagerTests.kt
@@ -45,4 +45,4 @@
@Parameterized.Parameters(name = "{0}")
fun params() = AllOrientationsParams
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageLayoutPositionOnScrollingTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageLayoutPositionOnScrollingTest.kt
index ef8e8fa..69ef744 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageLayoutPositionOnScrollingTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageLayoutPositionOnScrollingTest.kt
@@ -102,4 +102,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageSizeTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageSizeTest.kt
index 988a695..7f9e466 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageSizeTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PageSizeTest.kt
@@ -97,4 +97,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerAccessibilityTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerAccessibilityTest.kt
index 06cd075..752614c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerAccessibilityTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerAccessibilityTest.kt
@@ -153,4 +153,4 @@
@Parameterized.Parameters(name = "{0}")
fun params() = AllOrientationsParams
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerContentTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerContentTest.kt
index 4f02a20..d4ca45f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerContentTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerContentTest.kt
@@ -178,4 +178,4 @@
Truth.assertThat(previousScrollStateValue).isNotEqualTo(states[0]!!.value)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCrossAxisTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCrossAxisTest.kt
index e9c8ddf..cf91ee7 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCrossAxisTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCrossAxisTest.kt
@@ -107,4 +107,4 @@
@Parameterized.Parameters(name = "{0}")
fun params() = AllOrientationsParams
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerNestedScrollContentTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerNestedScrollContentTest.kt
index 5a638f2..2dd2726 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerNestedScrollContentTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerNestedScrollContentTest.kt
@@ -494,4 +494,4 @@
}
}
-private const val TestTag = "pager"
\ No newline at end of file
+private const val TestTag = "pager"
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerOffscreenPageLimitPlacingTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerOffscreenPageLimitPlacingTest.kt
index 5967023..db60199 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerOffscreenPageLimitPlacingTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerOffscreenPageLimitPlacingTest.kt
@@ -136,4 +136,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPinnableContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPinnableContainerTest.kt
index abd50db..3de9193 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPinnableContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerPinnableContainerTest.kt
@@ -656,4 +656,4 @@
assertThat(parent2Pinned).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerScrollingTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerScrollingTest.kt
index 103f9c7..8d4a2b4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerScrollingTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerScrollingTest.kt
@@ -722,4 +722,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateNonGestureScrollingTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateNonGestureScrollingTest.kt
index 33c0eb7..58fcbec 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateNonGestureScrollingTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateNonGestureScrollingTest.kt
@@ -267,4 +267,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateTest.kt
index fbcbe8b..3c397d7 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerStateTest.kt
@@ -693,4 +693,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerSwipeEdgeTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerSwipeEdgeTest.kt
index 2668529..cf2aad1 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerSwipeEdgeTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerSwipeEdgeTest.kt
@@ -110,4 +110,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerTest.kt
index 753c0a2..b7a50b8 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerTest.kt
@@ -17,7 +17,9 @@
package androidx.compose.foundation.pager
import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
@@ -26,6 +28,7 @@
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performTouchInput
+import androidx.compose.ui.test.swipeLeft
import androidx.test.filters.LargeTest
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.launch
@@ -250,9 +253,49 @@
}
}
+ @Test
+ fun keyLambdaShouldUpdateWhenDatasetChanges() {
+ lateinit var pagerState: PagerState
+ val listA = mutableStateOf(listOf(1))
+
+ @Composable
+ fun MyComposable(data: List<Int>) {
+ pagerState = rememberPagerState { data.size }
+ HorizontalPager(
+ modifier = Modifier
+ .fillMaxSize()
+ .testTag("pager"),
+ state = pagerState,
+ key = { data[it] }
+ ) {
+ Spacer(
+ Modifier
+ .fillMaxSize())
+ }
+ }
+
+ rule.setContent {
+ MyComposable(listA.value)
+ }
+
+ rule.runOnIdle {
+ listA.value = listOf(1, 2)
+ }
+
+ assertThat(listA.value.size).isEqualTo(2)
+
+ rule.onNodeWithTag("pager").performTouchInput {
+ swipeLeft()
+ }
+
+ rule.runOnIdle {
+ assertThat(pagerState.currentPage).isEqualTo(1)
+ }
+ }
+
companion object {
@JvmStatic
@Parameterized.Parameters(name = "{0}")
fun params() = AllOrientationsParams
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequesterViewIntegrationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequesterViewIntegrationTest.kt
index 37436c9..a39b9af 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequesterViewIntegrationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequesterViewIntegrationTest.kt
@@ -201,4 +201,4 @@
return false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponderTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponderTest.kt
index dd4bd8e..80ab99a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponderTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponderTest.kt
@@ -577,4 +577,4 @@
private fun Job.isChildOf(expectedParent: Job): Boolean =
expectedParent.children.any { it === this || this.isChildOf(it) }
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewScrollableInteractionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewScrollableInteractionTest.kt
index e690ab0..dd10d64 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewScrollableInteractionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewScrollableInteractionTest.kt
@@ -1369,4 +1369,4 @@
assertThat(visibleBounds).isEqualTo(expectedVisibleBounds)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/FakeScrollable.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/FakeScrollable.kt
index 253454b..c01ce98 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/FakeScrollable.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/FakeScrollable.kt
@@ -43,4 +43,4 @@
onBringIntoView(localRect)
}
})
- .wrapContentSize(align = Alignment.TopStart, unbounded = true)
\ No newline at end of file
+ .wrapContentSize(align = Alignment.TopStart, unbounded = true)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextHoverTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextHoverTest.kt
index 8afbdf7..39634f1 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextHoverTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextHoverTest.kt
@@ -116,4 +116,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextMinMaxLinesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextMinMaxLinesTest.kt
index bbce88a..aad39c5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextMinMaxLinesTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextMinMaxLinesTest.kt
@@ -229,4 +229,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt
index 8bf92f2..e53b47f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt
@@ -120,4 +120,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, "multiStyleText_setFontStyle")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldHoverTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldHoverTest.kt
index 1018b28..3157d39 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldHoverTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldHoverTest.kt
@@ -108,4 +108,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt
index 13415a1..71e3ac8 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt
@@ -211,4 +211,4 @@
yield(sequenceOf(firstValue) + subProduct)
}
}
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt
index f0e5dcb..c0f42ed 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt
@@ -176,4 +176,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
index e96325c..be99b34 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
@@ -119,4 +119,4 @@
assertThat(textLayout?.lineCount).isEqualTo(string.length)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextInlineContentTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextInlineContentTest.kt
index 3d76e18..63c6bc8 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextInlineContentTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextInlineContentTest.kt
@@ -232,4 +232,4 @@
assertThat(boxLeft - textLeft).isEqualTo(left)
assertThat(textRight - boxRight).isEqualTo(right)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DeadKeyCombinerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DeadKeyCombinerTest.kt
index 17ea8f0..c690db0 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DeadKeyCombinerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DeadKeyCombinerTest.kt
@@ -118,4 +118,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DrawPhaseAttributesToggleTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DrawPhaseAttributesToggleTest.kt
index e8582e3..8055349 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DrawPhaseAttributesToggleTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DrawPhaseAttributesToggleTest.kt
@@ -269,4 +269,4 @@
assertThat(finalBitmap).isEqualToBitmap(initialBitmap)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/FontScalingScreenshotTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/FontScalingScreenshotTest.kt
new file mode 100644
index 0000000..7869750
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/FontScalingScreenshotTest.kt
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text
+
+import android.os.Build
+import androidx.activity.ComponentActivity
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.GOLDEN_UI
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.Composable
+import androidx.compose.testutils.assertAgainstGolden
+import androidx.compose.ui.Modifier
+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.text.SpanStyle
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.drawText
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.rememberTextMeasurer
+import androidx.compose.ui.unit.TextUnit
+import androidx.compose.ui.unit.em
+import androidx.compose.ui.unit.sp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import androidx.test.filters.SdkSuppress
+import androidx.test.screenshot.AndroidXScreenshotTestRule
+import androidx.testutils.AndroidFontScaleHelper
+import org.junit.After
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+@SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+class FontScalingScreenshotTest {
+ @get:Rule
+ val rule = createAndroidComposeRule<ComponentActivity>()
+
+ @get:Rule
+ val screenshotRule = AndroidXScreenshotTestRule(GOLDEN_UI)
+
+ private val containerTag = "container"
+
+ @After
+ fun teardown() {
+ AndroidFontScaleHelper.resetSystemFontScale(rule.activityRule.scenario)
+ }
+
+ @Test
+ fun fontScaling1x_lineHeightDoubleSp() {
+ AndroidFontScaleHelper.setSystemFontScale(1f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestLayout(lineHeight = 28.sp)
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling1x_lineHeightDoubleSp")
+ }
+
+ @Test
+ fun fontScaling2x_lineHeightDoubleSp() {
+ AndroidFontScaleHelper.setSystemFontScale(2f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestLayout(lineHeight = 28.sp)
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling2x_lineHeightDoubleSp")
+ }
+
+ @Test
+ fun fontScaling1x_lineHeightDoubleEm() {
+ AndroidFontScaleHelper.setSystemFontScale(1f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestLayout(lineHeight = 2.em)
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling1x_lineHeightDoubleEm")
+ }
+
+ @Test
+ fun fontScaling2x_lineHeightDoubleEm() {
+ AndroidFontScaleHelper.setSystemFontScale(2f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestLayout(lineHeight = 2.em)
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling2x_lineHeightDoubleEm")
+ }
+
+ @Test
+ fun fontScaling1x_drawText() {
+ AndroidFontScaleHelper.setSystemFontScale(2f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestDrawTextLayout()
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling1x_drawText")
+ }
+
+ @Test
+ fun fontScaling2x_drawText() {
+ AndroidFontScaleHelper.setSystemFontScale(2f, rule.activityRule.scenario)
+ rule.waitForIdle()
+
+ rule.setContent {
+ TestDrawTextLayout()
+ }
+ rule.onNodeWithTag(containerTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "fontScaling2x_drawText")
+ }
+
+ @Composable
+ private fun TestLayout(lineHeight: TextUnit) {
+ Column(
+ modifier = Modifier.testTag(containerTag),
+ ) {
+ BasicText(
+ text = buildAnnotatedString {
+ append("Hello ")
+ pushStyle(SpanStyle(
+ fontSize = 28.sp,
+ fontWeight = FontWeight.Bold
+ ))
+ append("Accessibility")
+ pop()
+ },
+ style = TextStyle(
+ fontSize = 36.sp,
+ fontStyle = FontStyle.Italic,
+ fontFamily = FontFamily.Monospace
+ )
+ )
+ BasicText(
+ text = "Here's a subtitle",
+ style = TextStyle(
+ fontSize = 20.sp
+ )
+ )
+ BasicText(
+ text = sampleText,
+ style = TextStyle(
+ fontSize = 14.sp,
+ fontStyle = FontStyle.Italic,
+ lineHeight = lineHeight
+ )
+ )
+ }
+ }
+
+ @Composable
+ private fun TestDrawTextLayout() {
+ val textMeasurer = rememberTextMeasurer()
+
+ Column(
+ modifier = Modifier.testTag(containerTag),
+ ) {
+ Canvas(Modifier.fillMaxSize()) {
+ drawText(
+ textMeasurer = textMeasurer,
+ style = TextStyle(
+ fontSize = 14.sp,
+ lineHeight = 28.sp
+ ),
+ text = sampleText
+ )
+ }
+ }
+ }
+
+ companion object {
+ private val sampleText = """
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
+et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
+cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+culpa qui officia deserunt mollit anim id est laborum.
+
+Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
+totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae
+dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
+sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro
+quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non
+numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim
+ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid
+ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse
+quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
+ """.trimIndent()
+ }
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyEventHelpersTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyEventHelpersTest.kt
index c4ca98c..3b9dcce 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyEventHelpersTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyEventHelpersTest.kt
@@ -59,4 +59,4 @@
)
assertThat(event.cancelsTextSelection()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt
index f222389..8401332 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt
@@ -183,4 +183,4 @@
block()
super.onEnd(animation)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutTest.kt
index 0479889..2c21952 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextLayoutTest.kt
@@ -245,4 +245,4 @@
inlineContent = mapOf(),
onTextLayout = onTextLayout
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextOverflowTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextOverflowTest.kt
index 8be1eb6..56e8833 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextOverflowTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextOverflowTest.kt
@@ -157,4 +157,4 @@
)
croppedBoxBitmap.asImageBitmap().assertContainsColor(Color.Red)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextStyleInvalidationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextStyleInvalidationTest.kt
index b5b83db..4f27a5c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextStyleInvalidationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextStyleInvalidationTest.kt
@@ -345,4 +345,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextTestExtensions.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextTestExtensions.kt
index c9a5157..88e813a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextTestExtensions.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextTestExtensions.kt
@@ -31,4 +31,4 @@
style = FontStyle.Normal
)
-val TEST_FONT_FAMILY = TEST_FONT.toFontFamily()
\ No newline at end of file
+val TEST_FONT_FAMILY = TEST_FONT.toFontFamily()
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextUsingModifierMinMaxLinesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextUsingModifierMinMaxLinesTest.kt
index 4d94c86..5b88a91 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextUsingModifierMinMaxLinesTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextUsingModifierMinMaxLinesTest.kt
@@ -149,4 +149,4 @@
BasicText(text = "", minLines = 10, maxLines = 5)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/BitmapSubject.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/BitmapSubject.kt
index 82fdc27..adbf698 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/BitmapSubject.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/BitmapSubject.kt
@@ -62,4 +62,4 @@
super.actualCustomStringRepresentation()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/Matchers.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/Matchers.kt
index 2802597..31b8d1c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/Matchers.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/matchers/Matchers.kt
@@ -26,4 +26,4 @@
internal fun IntegerSubject.isZero() {
this.isEqualTo(0)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtilsKtTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtilsKtTest.kt
index 60c4132..6d8eba5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtilsKtTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtilsKtTest.kt
@@ -89,4 +89,4 @@
val subject = finalMaxLines(false, TextOverflow.Ellipsis, 4)
assertThat(subject).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/NodeInvalidationTestParent.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/NodeInvalidationTestParent.kt
index 9c8dd339..8ec5fc4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/NodeInvalidationTestParent.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/NodeInvalidationTestParent.kt
@@ -182,4 +182,4 @@
val brush: Brush? = null,
val alpha: Float = Float.NaN
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/SelectionControllerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/SelectionControllerTest.kt
index 8bfcfdb..8acdfa3 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/SelectionControllerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/SelectionControllerTest.kt
@@ -271,4 +271,4 @@
}
private fun FAKE(reason: String = "Unsupported fake method on fake"): Nothing =
- throw NotImplementedError("No support in fake: $reason")
\ No newline at end of file
+ throw NotImplementedError("No support in fake: $reason")
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNodeInvalidationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNodeInvalidationTest.kt
index f006017c..b425ef3 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNodeInvalidationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNodeInvalidationTest.kt
@@ -73,4 +73,4 @@
overrideColor = drawParams.color
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeInvalidationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeInvalidationTest.kt
index 2ab25f2..868b399 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeInvalidationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeInvalidationTest.kt
@@ -63,4 +63,4 @@
drawParams.color
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeTest.kt
index 2bf38c31..ce7687f 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNodeTest.kt
@@ -129,4 +129,4 @@
get() = FontStyle.Normal
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/AbstractSelectionMagnifierTests.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/AbstractSelectionMagnifierTests.kt
index e97716b..3160b86 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/AbstractSelectionMagnifierTests.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/AbstractSelectionMagnifierTests.kt
@@ -612,4 +612,4 @@
.map { it.config[MagnifierPositionInRoot].invoke() }
assertThat(magnifierNodes.all { it.isUnspecified }).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MotionEventTestUtils.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MotionEventTestUtils.kt
index dbec3ec5..a262ae0 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MotionEventTestUtils.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MotionEventTestUtils.kt
@@ -51,4 +51,4 @@
MotionEvent.PointerCoords().apply {
this.x = x
this.y = y
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegateTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegateTest.kt
index ae4ae34..10f9af8 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegateTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegateTest.kt
@@ -3430,4 +3430,4 @@
softWrap = softWrap
).layout(constraints, LayoutDirection.Ltr)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
index 540a13b..734a6e6 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
@@ -300,4 +300,4 @@
override val status: TextToolbarStatus
get() = _status
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
index 7096695..2c1821a 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
@@ -19,6 +19,8 @@
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.Handle
import androidx.compose.foundation.text.TEST_FONT_FAMILY
@@ -73,6 +75,7 @@
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.unit.width
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -374,7 +377,9 @@
Column {
BasicText(
AnnotatedString(longText),
- Modifier.fillMaxWidth().testTag(tag1),
+ Modifier
+ .fillMaxWidth()
+ .testTag(tag1),
style = TextStyle(fontFamily = fontFamily, fontSize = fontSize),
maxLines = 1
)
@@ -398,7 +403,9 @@
Column {
BasicText(
AnnotatedString(longText),
- Modifier.fillMaxWidth().testTag(tag1),
+ Modifier
+ .fillMaxWidth()
+ .testTag(tag1),
style = TextStyle(fontFamily = fontFamily, fontSize = fontSize),
maxLines = 1,
overflow = TextOverflow.Ellipsis
@@ -417,6 +424,78 @@
}
@Test
+ fun selectionIncludes_noHeightText() {
+ lateinit var clipboardManager: ClipboardManager
+ createSelectionContainer {
+ clipboardManager = LocalClipboardManager.current
+ clipboardManager.setText(AnnotatedString("Clipboard content at start of test."))
+ Column {
+ BasicText(
+ text = "Hello",
+ modifier = Modifier
+ .fillMaxWidth()
+ .testTag(tag1),
+ )
+ BasicText(
+ text = "THIS SHOULD NOT CAUSE CRASH",
+ modifier = Modifier.height(0.dp)
+ )
+ BasicText(
+ text = "World",
+ modifier = Modifier
+ .fillMaxWidth()
+ .testTag(tag2),
+ )
+ }
+ }
+
+ startSelection(tag1)
+ dragHandleTo(
+ handle = Handle.SelectionEnd,
+ offset = characterBox(tag2, 4).bottomRight
+ )
+
+ assertAnchorInfo(selection.value?.start, offset = 0, selectableId = 1)
+ assertAnchorInfo(selection.value?.end, offset = 5, selectableId = 3)
+ }
+
+ @Test
+ fun selectionIncludes_noWidthText() {
+ lateinit var clipboardManager: ClipboardManager
+ createSelectionContainer {
+ clipboardManager = LocalClipboardManager.current
+ clipboardManager.setText(AnnotatedString("Clipboard content at start of test."))
+ Column {
+ BasicText(
+ text = "Hello",
+ modifier = Modifier
+ .fillMaxWidth()
+ .testTag(tag1),
+ )
+ BasicText(
+ text = "THIS SHOULD NOT CAUSE CRASH",
+ modifier = Modifier.width(0.dp)
+ )
+ BasicText(
+ text = "World",
+ modifier = Modifier
+ .fillMaxWidth()
+ .testTag(tag2),
+ )
+ }
+ }
+
+ startSelection(tag1)
+ dragHandleTo(
+ handle = Handle.SelectionEnd,
+ offset = characterBox(tag2, 4).bottomRight
+ )
+
+ assertAnchorInfo(selection.value?.start, offset = 0, selectableId = 1)
+ assertAnchorInfo(selection.value?.end, offset = 5, selectableId = 3)
+ }
+
+ @Test
@OptIn(ExperimentalTestApi::class, ExperimentalComposeUiApi::class)
fun selection_doesCopy_whenCopyKeyEventSent() {
lateinit var clipboardManager: ClipboardManager
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
index 55b4d0e..f4f7884 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlePopupPositionTest.kt
@@ -318,4 +318,4 @@
}
return matches
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandleTestUtils.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandleTestUtils.kt
index 3a4a843..1c512ca 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandleTestUtils.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandleTestUtils.kt
@@ -59,3 +59,13 @@
.isWithin(5f).of(expectedY.value)
}
}
+
+internal fun SemanticsNodeInteraction.assertHandleAnchorMatches(
+ anchor: SelectionHandleAnchor
+) {
+ val node = fetchSemanticsNode()
+ val actualAnchor = node.config[SelectionHandleInfoKey].anchor
+ val message = "Expected anchor ($anchor), " +
+ "but found ($actualAnchor)"
+ assertWithMessage(message).that(actualAnchor).isEqualTo(anchor)
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlesTest.kt
index 8e8cdac..80354e6 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlesTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionHandlesTest.kt
@@ -298,4 +298,4 @@
assertTrue("Pixel copy latch timed out", latch.await(1, TimeUnit.SECONDS))
assertEquals(PixelCopy.SUCCESS, copyResult)
return dest
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesTest.kt
index cc82ae2..28bd729 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesTest.kt
@@ -133,4 +133,4 @@
asserter.assert()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextWithSpaceSelectionGesturesRegressionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextWithSpaceSelectionGesturesRegressionTest.kt
index fcb3e2b..b06598b2 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextWithSpaceSelectionGesturesRegressionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextWithSpaceSelectionGesturesRegressionTest.kt
@@ -149,4 +149,4 @@
asserter.assert()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/SingleTextSelectionGesturesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/SingleTextSelectionGesturesTest.kt
index fc5ea72..af1d9f2 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/SingleTextSelectionGesturesTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/gestures/SingleTextSelectionGesturesTest.kt
@@ -109,4 +109,4 @@
textToolbarShown = true
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicSecureTextFieldTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicSecureTextFieldTest.kt
index fb6a224..1ea8cac 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicSecureTextFieldTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicSecureTextFieldTest.kt
@@ -269,4 +269,4 @@
.isEqualTo("\u2022\u2022\u2022")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicTextField2Test.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicTextField2Test.kt
index 8a919d8..ac5bc56 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicTextField2Test.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/BasicTextField2Test.kt
@@ -907,6 +907,9 @@
// hide it again.
keyboardHelper.hideKeyboardIfShown()
rule.onNodeWithTag(Tag).assertIsFocused()
+
+ rule.mainClock.advanceTimeBy(1000) // to not cause double click
+
rule.onNodeWithTag(Tag).performClick()
// expect keyboard to show up again.
@@ -925,7 +928,7 @@
rule.onNodeWithTag(Tag).performTouchInput {
// swipe through
- swipeRight(endX = right + 200, durationMillis = 1000)
+ swipeRight(endX = right + 200, durationMillis = 100)
}
rule.onNodeWithTag(Tag).assertIsNotFocused()
}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/ComposeInputMethodManagerTestRule.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/ComposeInputMethodManagerTestRule.kt
index 537aabd..7e829b3 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/ComposeInputMethodManagerTestRule.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/ComposeInputMethodManagerTestRule.kt
@@ -49,4 +49,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/DecorationBoxTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/DecorationBoxTest.kt
index f66ec98..0cd0f40 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/DecorationBoxTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/DecorationBoxTest.kt
@@ -278,4 +278,4 @@
assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 5))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/HeightInLinesModifierTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/HeightInLinesModifierTest.kt
index 4f255d7..4676b33 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/HeightInLinesModifierTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/HeightInLinesModifierTest.kt
@@ -353,4 +353,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCodepointTransformationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCodepointTransformationTest.kt
index 45f4155..c3aa823 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCodepointTransformationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCodepointTransformationTest.kt
@@ -215,4 +215,4 @@
assertThat(rule.onNodeWithTag(Tag).fetchTextLayoutResult().layoutInput.text.text)
.isEqualTo(text)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCursorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCursorTest.kt
index 0650e63..d668835 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCursorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldCursorTest.kt
@@ -731,4 +731,4 @@
rule.onNode(hasSetTextAction()).assertTextEquals("")
// this test just needs to finish without crashing. There is no other assertion
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyEventTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyEventTest.kt
index c313f67..a3379dd 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyEventTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyEventTest.kt
@@ -675,4 +675,4 @@
sequence(SequenceScope(state, this@performKeyInput))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyboardActionsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyboardActionsTest.kt
index 90840d7..424e455 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyboardActionsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldKeyboardActionsTest.kt
@@ -427,4 +427,4 @@
onPrevious = { onAny(ImeAction.Previous) },
onSearch = { onAny(ImeAction.Search) },
onSend = { onAny(ImeAction.Send) }
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldScrollTest.kt
index 1d73606..0e906f5 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldScrollTest.kt
@@ -607,4 +607,4 @@
job.join()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldStateRestorationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldStateRestorationTest.kt
index cae64e7..8e49735 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldStateRestorationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/TextFieldStateRestorationTest.kt
@@ -68,4 +68,4 @@
assertThat(restoredState.text.selectionInChars).isEqualTo(TextRange(0, 12))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/AndroidTextInputSessionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/AndroidTextInputSessionTest.kt
index a6d2465..87ed2b4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/AndroidTextInputSessionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/AndroidTextInputSessionTest.kt
@@ -240,4 +240,4 @@
textInputNode = this
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/BackspaceCommandTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/BackspaceCommandTest.kt
index d20e643..81b5ee0 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/BackspaceCommandTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/BackspaceCommandTest.kt
@@ -130,4 +130,4 @@
assertThat(eb.cursor).isEqualTo(0)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/ComposeInputMethodManagerTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/ComposeInputMethodManagerTest.kt
index 1f86e04..ea9d115 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/ComposeInputMethodManagerTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/ComposeInputMethodManagerTest.kt
@@ -119,4 +119,4 @@
override fun isInEditMode(): Boolean {
return true
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/EditorInfoTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/EditorInfoTest.kt
index dc4fe4c..15ef710 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/EditorInfoTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/EditorInfoTest.kt
@@ -541,4 +541,4 @@
private fun EditorInfo.update(imeOptions: ImeOptions) {
this.update(TextFieldCharSequence(), imeOptions)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/MoveCursorCommandTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/MoveCursorCommandTest.kt
index 79f0a81..e851ac0 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/MoveCursorCommandTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/MoveCursorCommandTest.kt
@@ -169,4 +169,4 @@
assertThat(eb.cursor).isEqualTo(2 * FAMILY.length)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnectionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnectionTest.kt
index 3c0afac..c8a8fc4 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnectionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnectionTest.kt
@@ -587,4 +587,4 @@
"been there. Just remember to turn it off before you deploy your code."
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapTest.kt
new file mode 100644
index 0000000..3e8116b
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapTest.kt
@@ -0,0 +1,452 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text2.selection
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.wrapContentSize
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.testutils.TestViewConfiguration
+import androidx.compose.ui.AbsoluteAlignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.input.pointer.PointerEventPass
+import androidx.compose.ui.input.pointer.PointerInputChange
+import androidx.compose.ui.input.pointer.PointerInputScope
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.platform.LocalViewConfiguration
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.TouchInjectionScope
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performTouchInput
+import androidx.compose.ui.unit.Density
+import androidx.compose.ui.unit.DpSize
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+private const val TargetTag = "TargetLayout"
+
+/**
+ * These tests are mostly copied from TapGestureDetectorTest.
+ */
+@RunWith(JUnit4::class)
+class TapAndDoubleTapTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ private var tapped = false
+ private var doubleTapped = false
+
+ /** The time before a long press gesture attempts to win. */
+ private val LongPressTimeoutMillis: Long = 500L
+
+ /**
+ * The maximum time from the start of the first tap to the start of the second
+ * tap in a double-tap gesture.
+ */
+ private val DoubleTapTimeoutMillis: Long = 300L
+
+ private val util = layoutWithGestureDetector {
+ detectTapAndDoubleTap(
+ onTap = {
+ tapped = true
+ }
+ )
+ }
+
+ private val utilWithDoubleTap = layoutWithGestureDetector {
+ detectTapAndDoubleTap(
+ onTap = {
+ tapped = true
+ },
+ onDoubleTap = {
+ doubleTapped = true
+ }
+ )
+ }
+
+ private val nothingHandler: PointerInputChange.() -> Unit = {}
+
+ private var initialPass: PointerInputChange.() -> Unit = nothingHandler
+ private var finalPass: PointerInputChange.() -> Unit = nothingHandler
+
+ @Before
+ fun setup() {
+ tapped = false
+ doubleTapped = false
+ }
+
+ private fun layoutWithGestureDetector(
+ gestureDetector: suspend PointerInputScope.() -> Unit,
+ ): @Composable () -> Unit = {
+ CompositionLocalProvider(
+ LocalDensity provides Density(1f),
+ LocalViewConfiguration provides TestViewConfiguration(
+ minimumTouchTargetSize = DpSize.Zero
+ )
+ ) {
+ with(LocalDensity.current) {
+ Box(
+ Modifier
+ .fillMaxSize()
+ // Some tests execute a lambda before the initial and final passes
+ // so they are called here, higher up the chain, so that the
+ // calls happen prior to the gestureDetector below. The lambdas
+ // do things like consume events on the initial pass or validate
+ // consumption on the final pass.
+ .pointerInput(Unit) {
+ awaitPointerEventScope {
+ while (true) {
+ val event = awaitPointerEvent(PointerEventPass.Initial)
+ event.changes.forEach {
+ initialPass(it)
+ }
+ awaitPointerEvent(PointerEventPass.Final)
+ event.changes.forEach {
+ finalPass(it)
+ }
+ }
+ }
+ }
+ .wrapContentSize(AbsoluteAlignment.TopLeft)
+ .size(10.toDp())
+ .pointerInput(gestureDetector, gestureDetector)
+ .testTag(TargetTag)
+ )
+ }
+ }
+ }
+
+ private fun performTouch(
+ initialPass: PointerInputChange.() -> Unit = nothingHandler,
+ finalPass: PointerInputChange.() -> Unit = nothingHandler,
+ block: TouchInjectionScope.() -> Unit
+ ) {
+ this.initialPass = initialPass
+ this.finalPass = finalPass
+ rule.onNodeWithTag(TargetTag).performTouchInput(block)
+ rule.waitForIdle()
+ this.initialPass = nothingHandler
+ this.finalPass = nothingHandler
+ }
+
+ @Test
+ fun normalTap() {
+ rule.setContent(util)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(5f, 5f))
+ }
+
+ assertFalse(tapped)
+
+ rule.mainClock.advanceTimeBy(50)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ up(0)
+ }
+
+ assertTrue(tapped)
+ }
+
+ @Test
+ fun normalTapWithDoubleTapDefined_butNotExecuted() {
+ rule.setContent(utilWithDoubleTap)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(5f, 5f))
+ }
+
+ rule.mainClock.advanceTimeBy(50)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ up(0)
+ }
+
+ // we don't wait for double tap, tap should be called immediately.
+ assertTrue(tapped)
+ assertFalse(doubleTapped)
+
+ rule.mainClock.advanceTimeBy(DoubleTapTimeoutMillis + 10)
+
+ assertTrue(tapped)
+ assertFalse(doubleTapped)
+ }
+
+ @Test
+ fun normalDoubleTap() {
+ rule.setContent(utilWithDoubleTap)
+
+ performTouch { down(0, Offset(5f, 5f)) }
+ performTouch(finalPass = { assertTrue(isConsumed) }) { up(0) }
+
+ assertTrue(tapped)
+ assertFalse(doubleTapped)
+
+ rule.mainClock.advanceTimeBy(50)
+
+ performTouch { down(0, Offset(5f, 5f)) }
+ performTouch(finalPass = { assertTrue(isConsumed) }) { up(0) }
+
+ assertTrue(tapped)
+ assertTrue(doubleTapped)
+ }
+
+ @Test
+ fun normalLongPress() {
+ rule.setContent(utilWithDoubleTap)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(5f, 5f))
+ }
+
+ assertFalse(tapped)
+ assertFalse(doubleTapped)
+
+ rule.mainClock.advanceTimeBy(LongPressTimeoutMillis + 10)
+
+ assertFalse(tapped)
+ assertFalse(doubleTapped)
+
+ rule.mainClock.advanceTimeBy(500)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+ assertFalse(doubleTapped)
+ }
+
+ /**
+ * Pressing in the region, sliding out and then lifting should result in
+ * the callback not being invoked
+ */
+ @Test
+ fun tapMiss() {
+ rule.setContent(util)
+
+ performTouch {
+ down(0, Offset(5f, 5f))
+ moveTo(0, Offset(15f, 15f))
+ }
+
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+ }
+
+ /**
+ * Pressing in the region, sliding out and then lifting should result in
+ * the callback not being invoked
+ */
+ @Test
+ fun longPressMiss() {
+ rule.setContent(utilWithDoubleTap)
+
+ performTouch {
+ down(0, Offset(5f, 5f))
+ moveTo(0, Offset(15f, 15f))
+ }
+
+ rule.mainClock.advanceTimeBy(LongPressTimeoutMillis + 10)
+
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+ assertFalse(doubleTapped)
+ }
+
+ /**
+ * Pressing in the region, sliding out and then lifting should result in
+ * the callback not being invoked for double-tap
+ */
+ @Test
+ fun doubleTapMiss() {
+ rule.setContent(utilWithDoubleTap)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(5f, 5f))
+ up(0)
+ }
+
+ assertTrue(tapped)
+
+ rule.mainClock.advanceTimeBy(50)
+
+ performTouch {
+ down(1, Offset(5f, 5f))
+ moveTo(1, Offset(15f, 15f))
+ }
+
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(1)
+ }
+
+ assertTrue(tapped)
+ assertFalse(doubleTapped)
+ }
+
+ /**
+ * After a first tap, a second tap should also be detected.
+ */
+ @Test
+ fun secondTap() {
+ rule.setContent(util)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(5f, 5f))
+ up(0)
+ }
+
+ assertTrue(tapped)
+
+ tapped = false
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(1, Offset(4f, 4f))
+ up(1)
+ }
+
+ assertTrue(tapped)
+ }
+
+ /**
+ * Clicking in the region with the up already consumed should result in the callback not
+ * being invoked.
+ */
+ @Test
+ fun consumedUpTap() {
+ rule.setContent(util)
+
+ performTouch {
+ down(0, Offset(5f, 5f))
+ }
+
+ assertFalse(tapped)
+
+ performTouch(initialPass = { if (pressed != previousPressed) consume() }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+ }
+
+ /**
+ * Clicking in the region with the motion consumed should result in the callback not
+ * being invoked.
+ */
+ @Test
+ fun consumedMotionTap() {
+ rule.setContent(util)
+
+ performTouch {
+ down(0, Offset(5f, 5f))
+ }
+
+ performTouch(initialPass = { consume() }) {
+ moveTo(0, Offset(6f, 2f))
+ }
+
+ rule.mainClock.advanceTimeBy(50)
+
+ performTouch {
+ up(0)
+ }
+
+ assertFalse(tapped)
+ }
+
+ /**
+ * Ensure that two-finger taps work.
+ */
+ @Test
+ fun twoFingerTap() {
+ rule.setContent(util)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ down(0, Offset(1f, 1f))
+ }
+
+ assertFalse(tapped)
+
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ down(1, Offset(9f, 5f))
+ }
+
+ assertFalse(tapped)
+
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+
+ performTouch(finalPass = { assertTrue(isConsumed) }) {
+ up(1)
+ }
+
+ assertTrue(tapped)
+ }
+
+ /**
+ * A position change consumption on any finger should cause tap to cancel.
+ */
+ @Test
+ fun twoFingerTapCancel() {
+ rule.setContent(util)
+
+ performTouch {
+ down(0, Offset(1f, 1f))
+ }
+ assertFalse(tapped)
+
+ performTouch {
+ down(1, Offset(9f, 5f))
+ }
+
+ performTouch(initialPass = { consume() }) {
+ moveTo(0, Offset(5f, 5f))
+ }
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(0)
+ }
+
+ assertFalse(tapped)
+
+ rule.mainClock.advanceTimeBy(50)
+ performTouch(finalPass = { assertFalse(isConsumed) }) {
+ up(1)
+ }
+
+ assertFalse(tapped)
+ }
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldClickToMoveCursorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldClickToMoveCursorTest.kt
index 7335196..f7d0215 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldClickToMoveCursorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldClickToMoveCursorTest.kt
@@ -247,4 +247,4 @@
assertThat(state.text.selectionInChars).isEqualTo(TextRange(5))
assertThat(scrollState.value).isGreaterThan(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldCursorHandleTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldCursorHandleTest.kt
index 05c027e..e9c6323 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldCursorHandleTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldCursorHandleTest.kt
@@ -570,9 +570,10 @@
rule.onNode(isSelectionHandle(Handle.Cursor)).assertIsDisplayed()
swipeToLeft(fontSizePx)
- rule.waitForIdle()
- assertThat(state.text.selectionInChars).isEqualTo(TextRange(2))
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(2))
+ }
}
@Test
@@ -829,4 +830,4 @@
}
runBlocking { job.join() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldLongClickTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldLongClickTest.kt
new file mode 100644
index 0000000..64cb81d
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldLongClickTest.kt
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text2.selection
+
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.ScrollState
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.text.Handle
+import androidx.compose.foundation.text.TEST_FONT_FAMILY
+import androidx.compose.foundation.text.selection.isSelectionHandle
+import androidx.compose.foundation.text2.BasicTextField2
+import androidx.compose.foundation.text2.input.TextFieldLineLimits
+import androidx.compose.foundation.text2.input.TextFieldState
+import androidx.compose.foundation.text2.input.rememberTextFieldState
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.longClick
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performTouchInput
+import androidx.compose.ui.text.TextRange
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
+import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+import org.junit.Rule
+import org.junit.Test
+
+/**
+ * Tests for long click interactions on BasicTextField2.
+ */
+@OptIn(ExperimentalFoundationApi::class)
+@LargeTest
+class TextFieldLongClickTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ private lateinit var state: TextFieldState
+
+ private val TAG = "BasicTextField2"
+
+ private val fontSize = 10.sp
+
+ private val defaultTextStyle = TextStyle(fontFamily = TEST_FONT_FAMILY, fontSize = fontSize)
+
+ @Test
+ fun emptyTextField_longClickShowsCursor() {
+ rule.setContent {
+ BasicTextField2(
+ state = rememberTextFieldState(),
+ textStyle = defaultTextStyle,
+ modifier = Modifier.testTag(TAG)
+ )
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput { longClick() }
+
+ rule.onNode(isSelectionHandle(Handle.Cursor)).assertIsDisplayed()
+ }
+
+ @Test
+ fun longClickOnEmptyRegion_showsCursorAtTheEnd() {
+ val state = TextFieldState("abc")
+ rule.setContent {
+ BasicTextField2(
+ state = state,
+ textStyle = defaultTextStyle,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ longClick(Offset(fontSize.toPx() * 5, fontSize.toPx() / 2))
+ }
+
+ rule.onNode(isSelectionHandle(Handle.Cursor)).assertIsDisplayed()
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(3))
+ }
+
+ @Test
+ fun longClickOnWord_selectsWord() {
+ val state = TextFieldState("abc def ghi")
+ rule.setContent {
+ BasicTextField2(
+ state = state,
+ textStyle = defaultTextStyle,
+ modifier = Modifier.testTag(TAG)
+ )
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ longClick(Offset(fontSize.toPx() * 5, fontSize.toPx() / 2))
+ }
+
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertIsDisplayed()
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertIsDisplayed()
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 7))
+ }
+
+ @SdkSuppress(minSdkVersion = 23)
+ @Test
+ fun longClickOnWhitespace_selectsNextWord() {
+ val state = TextFieldState("abc def ghi")
+ rule.setContent {
+ BasicTextField2(
+ state = state,
+ textStyle = defaultTextStyle,
+ modifier = Modifier.testTag(TAG)
+ )
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ longClick(Offset(fontSize.toPx() * 7.5f, fontSize.toPx() / 2))
+ }
+
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertIsDisplayed()
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertIsDisplayed()
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(8, 11))
+ }
+
+ @Test
+ fun longClickOnScrolledTextField_selectsWord() {
+ val state = TextFieldState("abc def ghi abc def ghi")
+ val scrollState = ScrollState(0)
+ lateinit var scope: CoroutineScope
+ rule.setContent {
+ scope = rememberCoroutineScope()
+ BasicTextField2(
+ state = state,
+ textStyle = defaultTextStyle,
+ scrollState = scrollState,
+ lineLimits = TextFieldLineLimits.SingleLine,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(30.dp)
+ )
+ }
+
+ assertThat(scrollState.maxValue).isGreaterThan(0)
+ scope.launch { scrollState.scrollTo(scrollState.maxValue) }
+
+ rule.onNodeWithTag(TAG).performTouchInput { longClick(centerRight) }
+
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertIsDisplayed()
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertIsDisplayed()
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(20, 23))
+ }
+
+ @Test
+ fun longClickOnDecoratedTextField_selectsWord() {
+ val state = TextFieldState("abc def ghi")
+ rule.setContent {
+ BasicTextField2(
+ state = state,
+ textStyle = defaultTextStyle,
+ modifier = Modifier.testTag(TAG),
+ decorationBox = {
+ Box(modifier = Modifier.padding(32.dp)) {
+ it()
+ }
+ }
+ )
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ longClick(Offset(
+ x = 32.dp.toPx() + fontSize.toPx() * 5f,
+ y = 32.dp.toPx() + fontSize.toPx() / 2
+ ))
+ }
+
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertIsDisplayed()
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertIsDisplayed()
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 7))
+ }
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionHandlesTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionHandlesTest.kt
new file mode 100644
index 0000000..0444338
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionHandlesTest.kt
@@ -0,0 +1,780 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text2.selection
+
+import android.os.Build
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.ScrollState
+import androidx.compose.foundation.focusable
+import androidx.compose.foundation.gestures.Orientation
+import androidx.compose.foundation.horizontalScroll
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.text.Handle
+import androidx.compose.foundation.text.TEST_FONT_FAMILY
+import androidx.compose.foundation.text.selection.SelectionHandleAnchor
+import androidx.compose.foundation.text.selection.assertHandleAnchorMatches
+import androidx.compose.foundation.text.selection.assertHandlePositionMatches
+import androidx.compose.foundation.text.selection.isSelectionHandle
+import androidx.compose.foundation.text2.BasicTextField2
+import androidx.compose.foundation.text2.input.TextFieldLineLimits
+import androidx.compose.foundation.text2.input.TextFieldState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.focus.focusRequester
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.semantics.SemanticsActions
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.doubleClick
+import androidx.compose.ui.test.hasSetTextAction
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performSemanticsAction
+import androidx.compose.ui.test.performTouchInput
+import androidx.compose.ui.test.swipeDown
+import androidx.compose.ui.test.swipeLeft
+import androidx.compose.ui.test.swipeRight
+import androidx.compose.ui.test.swipeUp
+import androidx.compose.ui.text.TextLayoutResult
+import androidx.compose.ui.text.TextRange
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
+import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.launch
+import org.junit.Rule
+import org.junit.Test
+
+@OptIn(ExperimentalFoundationApi::class)
+@LargeTest
+class TextFieldSelectionHandlesTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ private lateinit var state: TextFieldState
+
+ private val TAG = "BasicTextField2"
+
+ private val fontSize = 10.sp
+ private val fontSizePx = with(rule.density) { fontSize.toPx() }
+
+ @Test
+ fun selectionHandles_doNotShow_whenFieldNotFocused() {
+ state = TextFieldState("hello, world", initialSelectionInChars = TextRange(2, 5))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ assertHandlesNotExist()
+ }
+
+ @Test
+ fun selectionHandles_appears_whenFieldGetsFocused() {
+ state = TextFieldState("hello, world", initialSelectionInChars = TextRange(2, 5))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+ }
+
+ @Test
+ fun selectionHandles_disappear_whenFieldLosesFocus() {
+ state = TextFieldState("hello, world", initialSelectionInChars = TextRange(2, 5))
+ val focusRequester = FocusRequester()
+ rule.setContent {
+ Column {
+ Box(
+ Modifier
+ .size(100.dp)
+ .focusRequester(focusRequester)
+ .focusable())
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+ rule.runOnIdle {
+ focusRequester.requestFocus()
+ }
+ assertHandlesNotExist()
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+ @Test
+ fun selectionHandles_locatedAtTheRightPosition_ltr_ltr() {
+ state = TextFieldState("hello, world", initialSelectionInChars = TextRange(2, 5))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ focusAndWait()
+
+ with(rule.onNode(isSelectionHandle(Handle.SelectionStart))) {
+ assertHandlePositionMatches(
+ (2 * fontSize.value).dp,
+ fontSize.value.dp
+ )
+ assertHandleAnchorMatches(SelectionHandleAnchor.Left)
+ }
+
+ with(rule.onNode(isSelectionHandle(Handle.SelectionEnd))) {
+ assertHandlePositionMatches(
+ (5 * fontSize.value).dp,
+ fontSize.value.dp
+ )
+ assertHandleAnchorMatches(SelectionHandleAnchor.Right)
+ }
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+ @Test
+ fun selectionHandles_locatedAtTheRightPosition_ltr_rtl() {
+ state = TextFieldState("abc \u05D0\u05D1\u05D2", initialSelectionInChars = TextRange(1, 6))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ focusAndWait()
+
+ with(rule.onNode(isSelectionHandle(Handle.SelectionStart))) {
+ assertHandlePositionMatches(
+ (1 * fontSize.value).dp,
+ fontSize.value.dp
+ )
+ assertHandleAnchorMatches(SelectionHandleAnchor.Left)
+ }
+
+ with(rule.onNode(isSelectionHandle(Handle.SelectionEnd))) {
+ assertHandlePositionMatches(
+ (5 * fontSize.value).dp,
+ fontSize.value.dp
+ )
+ assertHandleAnchorMatches(SelectionHandleAnchor.Left)
+ }
+ }
+
+ @Test
+ fun selectionHandlesDisappear_whenScrolledOutOfView_horizontally() {
+ // make it scrollable
+ state = TextFieldState("hello ".repeat(10), initialSelectionInChars = TextRange(1, 2))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.SingleLine,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+
+ rule.onNodeWithTag(TAG).performTouchInput { swipeLeft() }
+ assertHandlesNotExist()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput { swipeRight() }
+ assertHandlesDisplayed()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+ }
+
+ @Test
+ fun selectionHandlesDisappear_whenScrolledOutOfView_vertically() {
+ // make it scrollable
+ state = TextFieldState("hello ".repeat(10), initialSelectionInChars = TextRange(1, 2))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 2),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ swipeUp()
+ }
+ assertHandlesNotExist()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ swipeDown()
+ }
+ assertHandlesDisplayed()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+ }
+
+ @Test
+ fun selectionHandlesDisappear_whenScrolledOutOfView_horizontally_inContainer() {
+ // make it scrollable
+ val containerTag = "container"
+ state = TextFieldState("hello", initialSelectionInChars = TextRange(1, 2))
+ rule.setContent {
+ Row(modifier = Modifier
+ .width(200.dp)
+ .horizontalScroll(rememberScrollState())
+ .testTag(containerTag)
+ ) {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ Box(modifier = Modifier
+ .height(12.dp)
+ .width(400.dp))
+ }
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+
+ rule.onNodeWithTag(containerTag).performTouchInput {
+ swipeLeft()
+ }
+ assertHandlesNotExist()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+
+ rule.onNodeWithTag(containerTag).performTouchInput {
+ swipeRight()
+ }
+ assertHandlesDisplayed()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+ }
+
+ @Test
+ fun selectionHandlesDisappear_whenScrolledOutOfView_vertically_inContainer() {
+ // make it scrollable
+ val containerTag = "container"
+ state = TextFieldState("hello", initialSelectionInChars = TextRange(1, 2))
+ rule.setContent {
+ Column(modifier = Modifier
+ .height(200.dp)
+ .verticalScroll(rememberScrollState())
+ .testTag(containerTag)
+ ) {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .height(100.dp)
+ )
+ Box(modifier = Modifier
+ .width(12.dp)
+ .height(400.dp))
+ }
+ }
+
+ focusAndWait()
+ assertHandlesDisplayed()
+
+ rule.onNodeWithTag(containerTag).performTouchInput {
+ swipeUp()
+ }
+ assertHandlesNotExist()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+
+ rule.onNodeWithTag(containerTag).performTouchInput {
+ swipeDown()
+ }
+ assertHandlesDisplayed()
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(1, 2))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_toExtendSelection() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToLeft(Handle.SelectionStart, fontSizePx * 4)
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 7))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_toExtendSelection() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToRight(Handle.SelectionEnd, fontSizePx * 4)
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 11))
+ }
+ }
+
+ @Test
+ fun doubleClickOnWord_toSelectWord() {
+ state = TextFieldState("abc def ghj")
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ doubleClick(Offset(fontSizePx * 5, fontSizePx / 2)) // middle word
+ }
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 7))
+ }
+ }
+
+ @SdkSuppress(minSdkVersion = 23)
+ @Test
+ fun doubleClickOnWhitespace_toSelectNextWord() {
+ state = TextFieldState("abc def ghj")
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ rule.onNodeWithTag(TAG).performTouchInput {
+ // space between first and second words
+ doubleClick(Offset(fontSizePx * 3.5f, fontSizePx / 2))
+ }
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 7))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_outOfBounds_horizontally() {
+ state = TextFieldState("abc def ".repeat(10), initialSelectionInChars = TextRange(77, 80))
+ val scrollState = ScrollState(0)
+ lateinit var scope: CoroutineScope
+ rule.setContent {
+ scope = rememberCoroutineScope()
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.SingleLine,
+ scrollState = scrollState,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ rule.waitForIdle()
+ scope.launch { scrollState.scrollTo(scrollState.maxValue) } // scroll to the most right
+ focusAndWait() // selection handles show up
+
+ repeat(80) {
+ swipeToLeft(Handle.SelectionStart, fontSizePx)
+ }
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 80))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_outOfBounds_vertically() {
+ state = TextFieldState("abc def ".repeat(10), initialSelectionInChars = TextRange(77, 80))
+ val scrollState = ScrollState(0)
+ lateinit var scope: CoroutineScope
+ rule.setContent {
+ scope = rememberCoroutineScope()
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 3),
+ scrollState = scrollState,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(50.dp)
+ )
+ }
+
+ rule.waitForIdle()
+ scope.launch { scrollState.scrollTo(scrollState.maxValue) } // scroll to the bottom
+ focusAndWait() // selection handles show up
+
+ swipeUp(Handle.SelectionStart, scrollState.maxValue.toFloat() * 2)
+ // make sure that we also swipe to start on the first line
+ swipeToLeft(Handle.SelectionStart, fontSizePx * 10)
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 80))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_outOfBounds_horizontally() {
+ state = TextFieldState("abc def ".repeat(10), initialSelectionInChars = TextRange(0, 3))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.SingleLine,
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ rule.waitForIdle()
+ focusAndWait() // selection handles show up
+
+ repeat(80) {
+ swipeToRight(Handle.SelectionEnd, fontSizePx)
+ }
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 80))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_outOfBounds_vertically() {
+ state = TextFieldState("abc def ".repeat(10), initialSelectionInChars = TextRange(0, 3))
+ lateinit var layoutResult: TextLayoutResult
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ lineLimits = TextFieldLineLimits.MultiLine(maxHeightInLines = 3),
+ onTextLayout = { layoutResult = it },
+ modifier = Modifier
+ .testTag(TAG)
+ .width(100.dp)
+ )
+ }
+
+ rule.waitForIdle()
+ focusAndWait() // selection handles show up
+
+ swipeDown(Handle.SelectionEnd, layoutResult.size.height.toFloat())
+ swipeToRight(Handle.SelectionEnd, layoutResult.size.width.toFloat())
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 80))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_extendsByWord() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToLeft(Handle.SelectionStart, fontSizePx * 2) // only move by 2 characters
+ rule.runOnIdle {
+ // selection extends by a word
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(0, 7))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_extendsByWord() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToRight(Handle.SelectionEnd, fontSizePx * 2) // only move by 2 characters
+ rule.runOnIdle {
+ // selection extends by a word
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 11))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_shrinksByCharacter() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToRight(Handle.SelectionStart, fontSizePx) // only move by a single character
+ rule.runOnIdle {
+ // selection shrinks by a character
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(5, 7))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_shrinksByCharacter() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToLeft(Handle.SelectionEnd, fontSizePx) // only move by a single character
+ rule.runOnIdle {
+ // selection shrinks by a character
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4, 6))
+ }
+ }
+
+ @Test
+ fun dragStartSelectionHandle_cannotExtendSelectionPastEndHandle() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToRight(Handle.SelectionStart, fontSizePx * 7)
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(7))
+ }
+ }
+
+ @Test
+ fun dragEndSelectionHandle_cannotExtendSelectionPastStartHandle() {
+ state = TextFieldState("abc def ghj", initialSelectionInChars = TextRange(4, 7))
+ rule.setContent {
+ BasicTextField2(
+ state,
+ textStyle = TextStyle(fontSize = fontSize, fontFamily = TEST_FONT_FAMILY),
+ modifier = Modifier
+ .testTag(TAG)
+ .width(200.dp)
+ )
+ }
+
+ focusAndWait()
+
+ swipeToLeft(Handle.SelectionEnd, fontSizePx * 7)
+ rule.runOnIdle {
+ assertThat(state.text.selectionInChars).isEqualTo(TextRange(4))
+ }
+ }
+
+ private fun focusAndWait() {
+ rule.onNode(hasSetTextAction()).performSemanticsAction(SemanticsActions.RequestFocus)
+ }
+
+ private fun assertHandlesDisplayed(
+ assertStartHandle: Boolean = true,
+ assertEndHandle: Boolean = true
+ ) {
+ if (assertStartHandle) {
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertIsDisplayed()
+ }
+ if (assertEndHandle) {
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertIsDisplayed()
+ }
+ }
+
+ private fun assertHandlesNotExist(
+ assertStartHandle: Boolean = true,
+ assertEndHandle: Boolean = true
+ ) {
+ if (assertStartHandle) {
+ rule.onNode(isSelectionHandle(Handle.SelectionStart)).assertDoesNotExist()
+ }
+ if (assertEndHandle) {
+ rule.onNode(isSelectionHandle(Handle.SelectionEnd)).assertDoesNotExist()
+ }
+ }
+
+ private fun swipeUp(handle: Handle, swipeDistance: Float) =
+ performHandleDrag(handle, true, swipeDistance, Orientation.Vertical)
+
+ private fun swipeDown(handle: Handle, swipeDistance: Float) =
+ performHandleDrag(handle, false, swipeDistance, Orientation.Vertical)
+
+ private fun swipeToLeft(handle: Handle, swipeDistance: Float) =
+ performHandleDrag(handle, true, swipeDistance)
+
+ private fun swipeToRight(handle: Handle, swipeDistance: Float) =
+ performHandleDrag(handle, false, swipeDistance)
+
+ private fun performHandleDrag(
+ handle: Handle,
+ toStart: Boolean,
+ swipeDistance: Float = 1f,
+ orientation: Orientation = Orientation.Horizontal
+ ) {
+ val handleNode = rule.onNode(isSelectionHandle(handle))
+
+ handleNode.performTouchInput {
+ if (orientation == Orientation.Horizontal) {
+ if (toStart) {
+ swipeLeft(
+ startX = centerX,
+ endX = centerX - viewConfiguration.touchSlop - swipeDistance,
+ durationMillis = 1000
+ )
+ } else {
+ swipeRight(
+ startX = centerX,
+ endX = centerX + viewConfiguration.touchSlop + swipeDistance,
+ durationMillis = 1000
+ )
+ }
+ } else {
+ if (toStart) {
+ swipeUp(
+ startY = centerY,
+ endY = centerY - viewConfiguration.touchSlop - swipeDistance,
+ durationMillis = 1000
+ )
+ } else {
+ swipeDown(
+ startY = centerY,
+ endY = centerY + viewConfiguration.touchSlop + swipeDistance,
+ durationMillis = 1000
+ )
+ }
+ }
+ }
+ }
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldTextToolbarTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldTextToolbarTest.kt
index 3ba9950..31bcb9c 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldTextToolbarTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text2/selection/TextFieldTextToolbarTest.kt
@@ -91,9 +91,13 @@
setupContent(state, textToolbar)
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
}
@Test
@@ -104,9 +108,13 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ }
}
@Test
@@ -117,7 +125,9 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
state.edit {
append(" World!")
@@ -137,7 +147,9 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
rule.onNodeWithTag(TAG).performTextInput(" World!")
@@ -155,7 +167,10 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
rule.onNodeWithTag(TAG).performKeyInput {
pressKey(Key.W)
@@ -176,7 +191,9 @@
with(rule.onNode(isSelectionHandle(Handle.Cursor))) {
performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
performTouchInput {
down(center)
moveBy(Offset(viewConfiguration.touchSlop, 0f))
@@ -380,10 +397,15 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
+ rule.mainClock.advanceTimeBy(1000) // to not cause double click
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
+ }
}
@OptIn(ExperimentalTestApi::class)
@@ -430,12 +452,13 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
rule.runOnIdle {
- focusRequester.requestFocus()
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
}
+ focusRequester.requestFocus()
+
rule.runOnIdle {
assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Hidden)
}
@@ -467,7 +490,10 @@
rule.onNodeWithTag(TAG).performTouchInput { click(Offset(fontSizePx * 2, fontSizePx / 2)) }
rule.onNode(isSelectionHandle(Handle.Cursor)).performClick()
- assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+
+ rule.runOnIdle {
+ assertThat(textToolbar.status).isEqualTo(TextToolbarStatus.Shown)
+ }
toggleState.value = false
@@ -545,4 +571,4 @@
override fun getText(): AnnotatedString? {
return currentText
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HardwareKeyboardTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HardwareKeyboardTest.kt
index 688c2e8..fe681a0 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HardwareKeyboardTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HardwareKeyboardTest.kt
@@ -617,4 +617,4 @@
return androidx.compose.ui.input.key.KeyEvent(
KeyEvent(0L, 0L, KeyEvent.ACTION_UP, key.nativeKeyCode, 0, metaState)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HeightInLinesModifierTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HeightInLinesModifierTest.kt
index 93098e5..1c3deea 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HeightInLinesModifierTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/HeightInLinesModifierTest.kt
@@ -371,4 +371,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldCursorTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldCursorTest.kt
index 3ed0be0..decd8ab 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldCursorTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldCursorTest.kt
@@ -475,4 +475,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldScrollTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldScrollTest.kt
index 2db9120..46050aa 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldScrollTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldScrollTest.kt
@@ -716,4 +716,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldSelectionTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldSelectionTest.kt
index cdc626d..7d1a70d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldSelectionTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldSelectionTest.kt
@@ -387,4 +387,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
index 032d301..9d70fe6 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
@@ -1473,4 +1473,4 @@
pixel.assertPixelColor(leftPixel, width - 1 - x, y)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldUndoTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldUndoTest.kt
index 4d82c56..a802294 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldUndoTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldUndoTest.kt
@@ -110,4 +110,4 @@
return androidx.compose.ui.input.key.KeyEvent(
KeyEvent(0L, 0L, KeyEvent.ACTION_DOWN, key.nativeKeyCode, 0, metaState)
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldVisualTransformationSelectionBoundsTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldVisualTransformationSelectionBoundsTest.kt
index 2d28354..6ef4e2d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldVisualTransformationSelectionBoundsTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldVisualTransformationSelectionBoundsTest.kt
@@ -305,4 +305,4 @@
"\\[0, ${text.length}]"
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt
index 2e7cb00..0d57e2b 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/Clickable.android.kt
@@ -68,4 +68,4 @@
get() = when (key.nativeKeyCode) {
KEYCODE_DPAD_CENTER, KEYCODE_ENTER, KEYCODE_NUMPAD_ENTER -> true
else -> false
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt
index 6f18370..e8946fd 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/EdgeEffectCompat.kt
@@ -153,4 +153,4 @@
0f // Old preview release
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt
index 4df2b9f..56ee290 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/OverscrollConfiguration.kt
@@ -67,4 +67,4 @@
@get:ExperimentalFoundationApi
val LocalOverscrollConfiguration = compositionLocalOf<OverscrollConfiguration?> {
OverscrollConfiguration()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/AndroidScrollable.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/AndroidScrollable.android.kt
index 3c4a1c1..c047b0d 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/AndroidScrollable.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/gestures/AndroidScrollable.android.kt
@@ -32,4 +32,4 @@
// 64 dp value is taken from ViewConfiguration.java, replace with better solution
return event.changes.fastFold(Offset.Zero) { acc, c -> acc + c.scrollDelta } * -64.dp.toPx()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.android.kt
index 4da7839..aa155b3 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.android.kt
@@ -34,4 +34,4 @@
}
}
-private fun Rect.toRect() = AndroidRect(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
\ No newline at end of file
+private fun Rect.toRect() = AndroidRect(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/AndroidCursorHandle.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/AndroidCursorHandle.android.kt
index 9cd3f60..c5dacb6 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/AndroidCursorHandle.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/AndroidCursorHandle.android.kt
@@ -78,4 +78,4 @@
}
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/BasicText.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/BasicText.android.kt
index 1a5f134..642972e 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/BasicText.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/BasicText.android.kt
@@ -22,4 +22,4 @@
internal actual fun Modifier.textPointerHoverIcon(
selectionRegistrar: SelectionRegistrar?
-): Modifier = if (selectionRegistrar == null) this else pointerHoverIcon(textPointerIcon)
\ No newline at end of file
+): Modifier = if (selectionRegistrar == null) this else pointerHoverIcon(textPointerIcon)
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/ContextMenu.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/ContextMenu.android.kt
index 077a75f..7c03389 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/ContextMenu.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/ContextMenu.android.kt
@@ -36,4 +36,4 @@
content: @Composable () -> Unit
) {
content()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.android.kt
index 29d09f6..a6b4e5d 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.android.kt
@@ -26,4 +26,4 @@
}
// It's platform-specific behavior, Android doesn't have such a concept
-internal actual fun showCharacterPalette() { }
\ No newline at end of file
+internal actual fun showCharacterPalette() { }
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/StringHelpers.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/StringHelpers.android.kt
index 540ed55..d13a05b 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/StringHelpers.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/StringHelpers.android.kt
@@ -41,4 +41,4 @@
private fun getEmojiCompatIfLoaded(): EmojiCompat? =
if (EmojiCompat.isConfigured())
EmojiCompat.get().takeIf { it.loadState == EmojiCompat.LOAD_STATE_SUCCEEDED }
- else null
\ No newline at end of file
+ else null
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.android.kt
index d18270c..5562e60 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.android.kt
@@ -77,4 +77,4 @@
}
private fun KeyEvent.isKeyCode(keyCode: Int): Boolean =
- this.key.nativeKeyCode == keyCode
\ No newline at end of file
+ this.key.nativeKeyCode == keyCode
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/AndroidSelectionHandles.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/AndroidSelectionHandles.android.kt
index 70000af..b4f0669 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/AndroidSelectionHandles.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/AndroidSelectionHandles.android.kt
@@ -78,7 +78,12 @@
} else {
Handle.SelectionEnd
},
- position = position
+ position = position,
+ anchor = if (isLeft) {
+ SelectionHandleAnchor.Left
+ } else {
+ SelectionHandleAnchor.Right
+ }
)
},
isStartHandle = isStartHandle,
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.android.kt
index 2227609..cfac198 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text/selection/SelectionManager.android.kt
@@ -64,4 +64,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnection.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnection.android.kt
index 0bdecc2..ead875a 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnection.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/StatelessInputConnection.android.kt
@@ -371,4 +371,4 @@
res.selectionEnd = selectionInChars.max
res.flags = if ('\n' in this) 0 else ExtractedText.FLAG_SINGLE_LINE
return res
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.android.kt b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.android.kt
index 72c74f8..fec2aee 100644
--- a/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.android.kt
+++ b/compose/foundation/foundation/src/androidMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.android.kt
@@ -33,4 +33,4 @@
} else {
TextUtils.getChars(this, startIndex, endIndex, destination, destinationOffset)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
index 83ed93c..2a770bc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation
+import androidx.annotation.FloatRange
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
@@ -72,7 +73,7 @@
fun Modifier.background(
brush: Brush,
shape: Shape = RectangleShape,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
alpha: Float = 1.0f
) = this.then(
BackgroundElement(
@@ -174,4 +175,4 @@
lastLayoutDirection = layoutDirection
lastShape = shape
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
index c96bdb3..4a66847 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
@@ -494,4 +494,4 @@
private object FixedMotionDurationScale : MotionDurationScale {
override val scaleFactor: Float
get() = 1f
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BorderStroke.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BorderStroke.kt
index eb37ed4..9324f18 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BorderStroke.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BorderStroke.kt
@@ -69,4 +69,4 @@
* @param color color to paint the border with
*/
@Stable
-fun BorderStroke(width: Dp, color: Color) = BorderStroke(width, SolidColor(color))
\ No newline at end of file
+fun BorderStroke(width: Dp, color: Color) = BorderStroke(width, SolidColor(color))
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Canvas.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Canvas.kt
index c757c15..4c57fef 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Canvas.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Canvas.kt
@@ -62,4 +62,4 @@
@ExperimentalFoundationApi
@Composable
fun Canvas(modifier: Modifier, contentDescription: String, onDraw: DrawScope.() -> Unit) =
- Spacer(modifier.drawBehind(onDraw).semantics { this.contentDescription = contentDescription })
\ No newline at end of file
+ Spacer(modifier.drawBehind(onDraw).semantics { this.contentDescription = contentDescription })
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt
index b779125..d817e37 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ClipScrollableContainer.kt
@@ -94,4 +94,4 @@
)
)
}
-})
\ No newline at end of file
+})
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Expect.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Expect.kt
index ad0c1e9..532d1f2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Expect.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Expect.kt
@@ -29,4 +29,4 @@
fun get(): Long
fun set(value: Long)
fun getAndIncrement(): Long
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ExperimentalFoundationApi.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ExperimentalFoundationApi.kt
index 193eaab..72bc6b1 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ExperimentalFoundationApi.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ExperimentalFoundationApi.kt
@@ -21,4 +21,4 @@
"future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalFoundationApi
\ No newline at end of file
+annotation class ExperimentalFoundationApi
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
index de22bba..4b2e41d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
@@ -369,4 +369,4 @@
this@FocusableSemanticsNode.requestFocus()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Indication.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Indication.kt
index d0ab687..de6e3e6 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Indication.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Indication.kt
@@ -183,4 +183,4 @@
drawIndication()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
index b38bba1..a6a7b72 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation
+import androidx.annotation.IntRange
import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.ProgressBarRangeInfo
@@ -41,7 +42,7 @@
fun Modifier.progressSemantics(
value: Float,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
- /*@IntRange(from = 0)*/
+ @IntRange(from = 0)
steps: Int = 0
): Modifier {
// Older versions of Talkback will ignore nodes with range info which aren't focusable or
@@ -71,4 +72,4 @@
return semantics(mergeDescendants = true) {
progressBarRangeInfo = ProgressBarRangeInfo.Indeterminate
}
-}
\ No newline at end of file
+}
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 f54c401..327eed6 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
@@ -16,6 +16,7 @@
package androidx.compose.foundation.gestures
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.animate
import androidx.compose.foundation.ExperimentalFoundationApi
@@ -352,7 +353,7 @@
* The fraction of the progress going from [currentValue] to [closestValue], within [0f..1f]
* bounds, or 1f if the [AnchoredDraggableState] is in a settled state.
*/
- /*@FloatRange(from = 0f, to = 1f)*/
+ @get:FloatRange(from = 0.0, to = 1.0)
val progress: Float by derivedStateOf(structuralEqualityPolicy()) {
val a = anchors.positionOf(currentValue)
val b = anchors.positionOf(closestValue)
@@ -761,4 +762,4 @@
override fun hashCode() = 31 * anchors.hashCode()
override fun toString() = "MapDraggableAnchors($anchors)"
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueue.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueue.kt
index 6f023af..10e700c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueue.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueue.kt
@@ -134,4 +134,4 @@
}
check(requests.isEmpty()) { "uncancelled requests present" }
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt
index d564e17..441dd46 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt
@@ -423,4 +423,4 @@
"continuation=$continuation)"
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt
index 5826647..3e8c4f5 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/DragGestureDetector.kt
@@ -870,4 +870,4 @@
PointerType.Mouse -> touchSlop * mouseToTouchSlopRatio
else -> touchSlop
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt
index ca3d8a2..05da99d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Draggable.kt
@@ -51,7 +51,6 @@
import kotlin.coroutines.cancellation.CancellationException
import kotlin.math.sign
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.coroutineScope
@@ -168,10 +167,15 @@
* pressing on it. It's useful to set it when value you're dragging is settling / animating.
* @param onDragStarted callback that will be invoked when drag is about to start at the starting
* position, allowing user to suspend and perform preparation for drag, if desired. This suspend
- * function is invoked with the draggable scope, allowing for async processing, if desired
+ * function is invoked with the draggable scope, allowing for async processing, if desired. Note
+ * that the scope used here is the one provided by the draggable node, for long running work that
+ * needs to outlast the modifier being in the composition you should use a scope that fits the
+ * lifecycle needed.
* @param onDragStopped callback that will be invoked when drag is finished, allowing the
* user to react on velocity and process it. This suspend function is invoked with the draggable
- * scope, allowing for async processing, if desired
+ * scope, allowing for async processing, if desired. Note that the scope used here is the one
+ * provided by the draggable node, for long running work that needs to outlast the modifier being
+ * in the composition you should use a scope that fits the lifecycle needed.
* @param reverseDirection reverse the direction of the scroll, so top to bottom scroll will
* behave like bottom to top and left to right will behave like right to left.
*/
@@ -296,32 +300,42 @@
private val _startDragImmediately: () -> Boolean = { startDragImmediately() }
private val velocityTracker = VelocityTracker()
+ /**
+ * To preserve the original behavior we had (before the Modifier.Node migration) we need to
+ * scope the DragStopped and DragCancel methods to the node's coroutine scope instead of using
+ * the one provided by the pointer input modifier, this is to ensure that even when the pointer
+ * input scope is reset we will continue any coroutine scope scope that we started from these
+ * methods while the pointer input scope was active.
+ */
+ override fun onAttach() {
+ coroutineScope.launch {
+ while (isActive) {
+ var event = channel.receive()
+ if (event !is DragStarted) continue
+ processDragStart(event)
+ try {
+ state.drag(MutatePriority.UserInput) {
+ while (event !is DragStopped && event !is DragCancelled) {
+ (event as? DragDelta)?.let { dragBy(it.delta.toFloat(orientation)) }
+ event = channel.receive()
+ }
+ }
+ if (event is DragStopped) {
+ processDragStop(event as DragStopped)
+ } else if (event is DragCancelled) {
+ processDragCancel()
+ }
+ } catch (c: CancellationException) {
+ processDragCancel()
+ }
+ }
+ }
+ }
+
private val pointerInputNode = delegate(SuspendingPointerInputModifierNode {
// TODO: conditionally undelegate when aosp/2462416 lands?
if (!enabled) return@SuspendingPointerInputModifierNode
coroutineScope {
- launch(start = CoroutineStart.UNDISPATCHED) {
- while (isActive) {
- var event = channel.receive()
- if (event !is DragStarted) continue
- processDragStart(event)
- try {
- state.drag(MutatePriority.UserInput) {
- while (event !is DragStopped && event !is DragCancelled) {
- (event as? DragDelta)?.let { dragBy(it.delta.toFloat(orientation)) }
- event = channel.receive()
- }
- }
- if (event is DragStopped) {
- processDragStop(event as DragStopped)
- } else if (event is DragCancelled) {
- processDragCancel()
- }
- } catch (c: CancellationException) {
- processDragCancel()
- }
- }
- }
try {
awaitPointerEventScope {
while (isActive) {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/FlingBehavior.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/FlingBehavior.kt
index 733b4f4..46bedcc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/FlingBehavior.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/FlingBehavior.kt
@@ -42,4 +42,4 @@
* @return remaining velocity after fling operation has ended
*/
suspend fun ScrollScope.performFling(initialVelocity: Float): Float
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt
index fde5758..8929d7a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ForEachGesture.kt
@@ -118,4 +118,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Orientation.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Orientation.kt
index e9520b9..7940a0f 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Orientation.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Orientation.kt
@@ -34,4 +34,4 @@
* [draggable].
*/
Horizontal
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ScrollExtensions.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ScrollExtensions.kt
index af7f47b..9521a45 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ScrollExtensions.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ScrollExtensions.kt
@@ -74,4 +74,4 @@
scroll(scrollPriority) {
// do nothing, just lock the mutex so other scroll actors are cancelled
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
index 2de11bc..2c639ab 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
@@ -947,4 +947,4 @@
get() = 1f
override val fontScale: Float
get() = 1f
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt
index b183823..5c4f420 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Transformable.kt
@@ -21,27 +21,25 @@
import androidx.compose.foundation.gestures.TransformEvent.TransformDelta
import androidx.compose.foundation.gestures.TransformEvent.TransformStarted
import androidx.compose.foundation.gestures.TransformEvent.TransformStopped
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.State
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
-import androidx.compose.ui.composed
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.AwaitPointerEventScope
import androidx.compose.ui.input.pointer.PointerEventPass
-import androidx.compose.ui.input.pointer.PointerInputScope
-import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNode
import androidx.compose.ui.input.pointer.positionChanged
-import androidx.compose.ui.platform.debugInspectorInfo
+import androidx.compose.ui.node.DelegatingNode
+import androidx.compose.ui.node.ModifierNodeElement
+import androidx.compose.ui.platform.InspectorInfo
import androidx.compose.ui.util.fastAny
import androidx.compose.ui.util.fastForEach
import kotlin.math.PI
import kotlin.math.abs
import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
/**
* Enable transformation gestures of the modified UI element.
@@ -94,13 +92,67 @@
canPan: (Offset) -> Boolean,
lockRotationOnZoomPan: Boolean = false,
enabled: Boolean = true
-) = composed(
- factory = {
- val updatePanZoomLock = rememberUpdatedState(lockRotationOnZoomPan)
- val updatedCanPan = rememberUpdatedState(canPan)
- val channel = remember { Channel<TransformEvent>(capacity = Channel.UNLIMITED) }
- if (enabled) {
- LaunchedEffect(state) {
+) = this then TransformableElement(state, canPan, lockRotationOnZoomPan, enabled)
+
+private class TransformableElement(
+ private val state: TransformableState,
+ private val canPan: (Offset) -> Boolean,
+ private val lockRotationOnZoomPan: Boolean,
+ private val enabled: Boolean
+) : ModifierNodeElement<TransformableNode>() {
+ override fun create(): TransformableNode = TransformableNode(
+ state, canPan, lockRotationOnZoomPan, enabled
+ )
+
+ override fun update(node: TransformableNode) {
+ node.update(state, canPan, lockRotationOnZoomPan, enabled)
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+
+ other as TransformableElement
+
+ if (state != other.state) return false
+ if (canPan != other.canPan) return false
+ if (lockRotationOnZoomPan != other.lockRotationOnZoomPan) return false
+ if (enabled != other.enabled) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = state.hashCode()
+ result = 31 * result + canPan.hashCode()
+ result = 31 * result + lockRotationOnZoomPan.hashCode()
+ result = 31 * result + enabled.hashCode()
+ return result
+ }
+
+ override fun InspectorInfo.inspectableProperties() {
+ name = "transformable"
+ properties["state"] = state
+ properties["canPan"] = canPan
+ properties["enabled"] = enabled
+ properties["lockRotationOnZoomPan"] = lockRotationOnZoomPan
+ }
+}
+
+private class TransformableNode(
+ private var state: TransformableState,
+ private var canPan: (Offset) -> Boolean,
+ private var lockRotationOnZoomPan: Boolean,
+ private var enabled: Boolean
+) : DelegatingNode() {
+
+ private val updatedCanPan: (Offset) -> Boolean = { canPan.invoke(it) }
+ private val channel = Channel<TransformEvent>(capacity = Channel.UNLIMITED)
+
+ private val pointerInputNode = delegate(SuspendingPointerInputModifierNode {
+ if (!enabled) return@SuspendingPointerInputModifierNode
+ coroutineScope {
+ launch(start = CoroutineStart.UNDISPATCHED) {
while (isActive) {
var event = channel.receive()
if (event !is TransformStarted) continue
@@ -118,47 +170,41 @@
}
}
}
- }
- val block: suspend PointerInputScope.() -> Unit = remember {
- {
- coroutineScope {
- awaitEachGesture {
- try {
- detectZoom(updatePanZoomLock, channel, updatedCanPan)
- } catch (exception: CancellationException) {
- if (!isActive) throw exception
- } finally {
- channel.trySend(TransformStopped)
- }
- }
+ awaitEachGesture {
+ try {
+ detectZoom(lockRotationOnZoomPan, channel, updatedCanPan)
+ } catch (exception: CancellationException) {
+ if (!isActive) throw exception
+ } finally {
+ channel.trySend(TransformStopped)
}
}
}
- if (enabled) Modifier.pointerInput(channel, block) else Modifier
- },
- inspectorInfo = debugInspectorInfo {
- name = "transformable"
- properties["state"] = state
- properties["canPan"] = canPan
- properties["enabled"] = enabled
- properties["lockRotationOnZoomPan"] = lockRotationOnZoomPan
- }
-)
+ })
-private sealed class TransformEvent {
- object TransformStarted : TransformEvent()
- object TransformStopped : TransformEvent()
- class TransformDelta(
- val zoomChange: Float,
- val panChange: Offset,
- val rotationChange: Float
- ) : TransformEvent()
+ fun update(
+ state: TransformableState,
+ canPan: (Offset) -> Boolean,
+ lockRotationOnZoomPan: Boolean,
+ enabled: Boolean
+ ) {
+ this.canPan = canPan
+ val needsReset = this.state != state ||
+ this.enabled != enabled ||
+ this.lockRotationOnZoomPan != lockRotationOnZoomPan
+ if (needsReset) {
+ this.state = state
+ this.enabled = enabled
+ this.lockRotationOnZoomPan = lockRotationOnZoomPan
+ pointerInputNode.resetPointerInputHandler()
+ }
+ }
}
private suspend fun AwaitPointerEventScope.detectZoom(
- panZoomLock: State<Boolean>,
+ panZoomLock: Boolean,
channel: Channel<TransformEvent>,
- canPan: State<(Offset) -> Boolean>
+ canPan: (Offset) -> Boolean
) {
var rotation = 0f
var zoom = 1f
@@ -187,10 +233,10 @@
if (zoomMotion > touchSlop ||
rotationMotion > touchSlop ||
- (panMotion > touchSlop && canPan.value.invoke(panChange))
+ (panMotion > touchSlop && canPan.invoke(panChange))
) {
pastTouchSlop = true
- lockedToPanZoom = panZoomLock.value && rotationMotion < touchSlop
+ lockedToPanZoom = panZoomLock && rotationMotion < touchSlop
channel.trySend(TransformStarted)
}
}
@@ -199,7 +245,7 @@
val effectiveRotation = if (lockedToPanZoom) 0f else rotationChange
if (effectiveRotation != 0f ||
zoomChange != 1f ||
- (panChange != Offset.Zero && canPan.value.invoke(panChange))
+ (panChange != Offset.Zero && canPan.invoke(panChange))
) {
channel.trySend(TransformDelta(zoomChange, panChange, effectiveRotation))
}
@@ -217,3 +263,13 @@
val finallyCanceled = finalEvent.changes.fastAny { it.isConsumed } && !pastTouchSlop
} while (!canceled && !finallyCanceled && event.changes.fastAny { it.pressed })
}
+
+private sealed class TransformEvent {
+ object TransformStarted : TransformEvent()
+ object TransformStopped : TransformEvent()
+ class TransformDelta(
+ val zoomChange: Float,
+ val panChange: Offset,
+ val rotationChange: Float
+ ) : TransformEvent()
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformableState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformableState.kt
index 39b957b..93b1cec 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformableState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TransformableState.kt
@@ -258,4 +258,4 @@
override val isTransformInProgress: Boolean
get() = isTransformingState.value
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationState.kt
index e35bf2d..d6a703e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationState.kt
@@ -166,4 +166,4 @@
fun Float.isZeroish() = absoluteValue < VisibilityThreshold
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyGridSnapLayoutInfoProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyGridSnapLayoutInfoProvider.kt
index 251cd9b..995e2b7 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyGridSnapLayoutInfoProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyGridSnapLayoutInfoProvider.kt
@@ -143,4 +143,4 @@
} else {
offset.x
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyListSnapLayoutInfoProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyListSnapLayoutInfoProvider.kt
index 5df071b..20ad4cf 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyListSnapLayoutInfoProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/LazyListSnapLayoutInfoProvider.kt
@@ -118,4 +118,4 @@
}
internal val LazyListLayoutInfo.singleAxisViewportSize: Int
- get() = if (orientation == Orientation.Vertical) viewportSize.height else viewportSize.width
\ No newline at end of file
+ get() = if (orientation == Orientation.Vertical) viewportSize.height else viewportSize.width
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapFlingBehavior.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapFlingBehavior.kt
index a9a6dc3..76e4f37 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapFlingBehavior.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapFlingBehavior.kt
@@ -528,4 +528,4 @@
if (DEBUG) {
println("SnapFlingBehavior: ${generateMsg()}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapLayoutInfoProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapLayoutInfoProvider.kt
index 83650ba..5f05d42 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapLayoutInfoProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapLayoutInfoProvider.kt
@@ -51,4 +51,4 @@
* fling animation.
*/
fun Density.calculateSnappingOffset(currentVelocity: Float): Float
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapPositionInLayout.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapPositionInLayout.kt
index 6a16ff9..f881aba 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapPositionInLayout.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/snapping/SnapPositionInLayout.kt
@@ -58,4 +58,4 @@
}.toFloat()
return itemOffset - desiredDistance
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.kt
index ea4f31a8..e34bab9 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.foundation.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
index adba3f6..bca3df6 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.lazy
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.VisibilityThreshold
@@ -46,7 +47,7 @@
* measured with [Constraints.Infinity] as the constraints for the main axis.
*/
fun Modifier.fillParentMaxSize(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
fraction: Float = 1f
): Modifier
@@ -61,7 +62,7 @@
* items are measured with [Constraints.Infinity] as the constraints for the main axis.
*/
fun Modifier.fillParentMaxWidth(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
fraction: Float = 1f
): Modifier
@@ -76,7 +77,7 @@
* items are measured with [Constraints.Infinity] as the constraints for the main axis.
*/
fun Modifier.fillParentMaxHeight(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
fraction: Float = 1f
): Modifier
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListAnimateScrollScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListAnimateScrollScope.kt
index 24e8bd2..ffb2e95 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListAnimateScrollScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListAnimateScrollScope.kt
@@ -64,4 +64,4 @@
override suspend fun scroll(block: suspend ScrollScope.() -> Unit) {
state.scroll(block = block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListBeyondBoundsModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListBeyondBoundsModifier.kt
index 5ef94fe..68f1b0d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListBeyondBoundsModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListBeyondBoundsModifier.kt
@@ -78,4 +78,4 @@
itemCount - 1,
state.layoutInfo.visibleItemsInfo.last().index + beyondBoundsItemCount
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasureResult.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasureResult.kt
index 9a7c9999..5eb612e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasureResult.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasureResult.kt
@@ -35,7 +35,7 @@
val consumedScroll: Float,
/** MeasureResult defining the layout.*/
measureResult: MeasureResult,
- /** The amount of scroll-back that happened due to reaching the end of the list. **/
+ /** The amount of scroll-back that happened due to reaching the end of the list. */
val scrollBackAmount: Float,
// properties representing the info needed for LazyListLayoutInfo:
/** see [LazyListLayoutInfo.visibleItemsInfo] */
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItem.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItem.kt
index 70f38cc..f13fa49 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItem.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItem.kt
@@ -186,4 +186,4 @@
IntOffset(if (isVertical) x else mainAxisMap(x), if (isVertical) mainAxisMap(y) else y)
}
-private const val Unset = Int.MIN_VALUE
\ No newline at end of file
+private const val Unset = Int.MIN_VALUE
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
index d983cd7..0fe137d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
@@ -52,7 +52,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyIndexMap
abstract fun createItem(
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListSemantics.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListSemantics.kt
index 5864b07..d3a27e3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListSemantics.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListSemantics.kt
@@ -28,4 +28,4 @@
return remember(state, isVertical) {
LazyLayoutSemanticState(state = state, isVertical = isVertical)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
index fb2fe0a..e4b170a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.lazy
+import androidx.annotation.IntRange as AndroidXIntRange
import androidx.compose.animation.core.AnimationState
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.Spring
@@ -254,7 +255,7 @@
* scroll the item further upward (taking it partly offscreen).
*/
suspend fun scrollToItem(
- /*@IntRange(from = 0)*/
+ @AndroidXIntRange(from = 0)
index: Int,
scrollOffset: Int = 0
) {
@@ -391,7 +392,7 @@
* scroll the item further upward (taking it partly offscreen).
*/
suspend fun animateScrollToItem(
- /*@IntRange(from = 0)*/
+ @AndroidXIntRange(from = 0)
index: Int,
scrollOffset: Int = 0
) {
@@ -505,4 +506,4 @@
override val beforeContentPadding = 0
override val afterContentPadding = 0
override val mainAxisItemSpacing = 0
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridAnimateScrollScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridAnimateScrollScope.kt
index b29a04f..5110784 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridAnimateScrollScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridAnimateScrollScope.kt
@@ -119,4 +119,4 @@
override suspend fun scroll(block: suspend ScrollScope.() -> Unit) {
state.scroll(block = block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridBeyondBoundsModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridBeyondBoundsModifier.kt
index 816d08d..d48a4f0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridBeyondBoundsModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridBeyondBoundsModifier.kt
@@ -72,4 +72,4 @@
get() = state.firstVisibleItemIndex
override val lastPlacedIndex: Int
get() = state.layoutInfo.visibleItemsInfo.last().index
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemScope.kt
index 208ee3f..236845a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemScope.kt
@@ -47,4 +47,4 @@
visibilityThreshold = IntOffset.VisibilityThreshold
)
): Modifier
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
index ecf9ff7..9798f78 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
@@ -164,4 +164,4 @@
IntOffset(if (isVertical) x else mainAxisMap(x), if (isVertical) mainAxisMap(y) else y)
}
-private const val Unset = Int.MIN_VALUE
\ No newline at end of file
+private const val Unset = Int.MIN_VALUE
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
index 9237016..f38e802 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
@@ -62,7 +62,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyIndexMap
abstract fun createItem(
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
index c852c3f..083c717 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
@@ -94,7 +94,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyIndexMap: LazyLayoutKeyIndexMap get() = measuredItemProvider.keyIndexMap
abstract fun createLine(
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
index d72d099..382a40e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
@@ -242,4 +242,4 @@
override var maxCurrentLineSpan = 0
override var maxLineSpan = 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
index 2ab8a16..1b18637 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.lazy.grid
+import androidx.annotation.IntRange as AndroidXIntRange
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.MutatePriority
import androidx.compose.foundation.gestures.Orientation
@@ -249,7 +250,7 @@
* scroll the item further upward (taking it partly offscreen).
*/
suspend fun scrollToItem(
- /*@IntRange(from = 0)*/
+ @AndroidXIntRange(from = 0)
index: Int,
scrollOffset: Int = 0
) {
@@ -402,7 +403,7 @@
* scroll the item further upward (taking it partly offscreen).
*/
suspend fun animateScrollToItem(
- /*@IntRange(from = 0)*/
+ @AndroidXIntRange(from = 0)
index: Int,
scrollOffset: Int = 0
) {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyAnimateScroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyAnimateScroll.kt
index 78fd421..0a344254 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyAnimateScroll.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyAnimateScroll.kt
@@ -45,7 +45,7 @@
/**
* Abstraction over animated scroll for using [animateScrollToItem] in different layouts.
* todo(b/243786897): revisit this API and make it public
- **/
+ */
internal interface LazyAnimateScrollScope {
val density: Density
@@ -265,4 +265,4 @@
snapToItem(index = index, scrollOffset = scrollOffset)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutBeyondBoundsModifierLocal.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutBeyondBoundsModifierLocal.kt
index 854dee2..982d7c5 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutBeyondBoundsModifierLocal.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutBeyondBoundsModifierLocal.kt
@@ -139,4 +139,4 @@
private fun unsupportedDirection(): Nothing = error(
"Lazy list does not support beyond bounds layout for the specified direction"
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
index c6a41ab..057d0d3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
@@ -43,7 +43,7 @@
/**
* Returns the content type for the item with the given key. It is used to improve the item
* compositions reusing efficiency.
- **/
+ */
fun getContentType(key: Any?): Any? {
if (key == null) return null
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
index e9f2858..dbfa4e9 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
@@ -96,4 +96,4 @@
*/
@ExperimentalFoundationApi
@Suppress("MissingNullability")
-expect fun getDefaultLazyLayoutKey(index: Int): Any
\ No newline at end of file
+expect fun getDefaultLazyLayoutKey(index: Int): Any
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutSemantics.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutSemantics.kt
index b7e1ca9..3861647 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutSemantics.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutSemantics.kt
@@ -153,4 +153,4 @@
fun collectionInfo(): CollectionInfo
suspend fun animateScrollBy(delta: Float)
suspend fun scrollToItem(index: Int)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGrid.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGrid.kt
index 50ae912..8eb1453 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGrid.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGrid.kt
@@ -128,8 +128,8 @@
}
}
-/** Slot configuration of staggered grid **/
+/** Slot configuration of staggered grid */
internal class LazyStaggeredGridSlots(
val positions: IntArray,
val sizes: IntArray
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimateScrollScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimateScrollScope.kt
index eb7fc8c..3af0604 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimateScrollScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridAnimateScrollScope.kt
@@ -70,4 +70,4 @@
override suspend fun scroll(block: suspend ScrollScope.() -> Unit) {
state.scroll(block = block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridBeyondBoundsModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridBeyondBoundsModifier.kt
index 445098f..fbe9ca0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridBeyondBoundsModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridBeyondBoundsModifier.kt
@@ -72,4 +72,4 @@
get() = state.firstVisibleItemIndex
override val lastPlacedIndex: Int
get() = state.layoutInfo.visibleItemsInfo.last().index
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCells.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCells.kt
index d401085..0d3b886 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCells.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCells.kt
@@ -150,4 +150,4 @@
return IntArray(slotCount) {
slotSize + if (it < remainingPixels) 1 else 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridDsl.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridDsl.kt
index cca7a11..6b78f05 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridDsl.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridDsl.kt
@@ -236,7 +236,7 @@
}
}
-/** Dsl marker for [LazyStaggeredGridScope] below **/
+/** Dsl marker for [LazyStaggeredGridScope] below */
@DslMarker
internal annotation class LazyStaggeredGridScopeMarker
@@ -453,4 +453,4 @@
},
itemContent = { index -> itemContent(index, items[index]) }
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridIntervalContent.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridIntervalContent.kt
index dc7406d..0217bfc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridIntervalContent.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridIntervalContent.kt
@@ -74,4 +74,4 @@
override val type: ((index: Int) -> Any?),
val span: ((index: Int) -> StaggeredGridItemSpan)?,
val item: @Composable LazyStaggeredGridItemScope.(Int) -> Unit
-) : LazyLayoutIntervalContent.Interval
\ No newline at end of file
+) : LazyLayoutIntervalContent.Interval
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
index c1569e3..7d1ab13 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
@@ -96,4 +96,4 @@
override fun hashCode(): Int {
return intervalContent.hashCode()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfo.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfo.kt
index eee96e9..5f69d36 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfo.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridLaneInfo.kt
@@ -204,4 +204,4 @@
internal const val Unset = -1
internal const val FullSpan = -2
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasurePolicy.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasurePolicy.kt
index 2ef1a74..2ba719b93 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasurePolicy.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasurePolicy.kt
@@ -161,4 +161,4 @@
} else {
calculateEndPadding(layoutDirection)
}
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt
index 50121ed..ab0a9be 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt
@@ -164,4 +164,4 @@
override val afterContentPadding: Int = 0
override val mainAxisItemSpacing: Int = 0
override val orientation: Orientation = Orientation.Vertical
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSemantics.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSemantics.kt
index 459702f..ef6fcda 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSemantics.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSemantics.kt
@@ -47,4 +47,4 @@
override fun collectionInfo(): CollectionInfo =
CollectionInfo(-1, -1)
}
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSpan.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSpan.kt
index 11a754a..b3260e3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSpan.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridSpan.kt
@@ -55,4 +55,4 @@
return span != null && span(localIndex) === FullLine
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState.kt
index f37ea64..754220e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState.kt
@@ -128,7 +128,7 @@
}
}
- /** holder for current scroll position **/
+ /** holder for current scroll position */
internal val scrollPosition = LazyStaggeredGridScrollPosition(
initialFirstVisibleItems,
initialFirstVisibleOffsets,
@@ -144,11 +144,11 @@
*/
val layoutInfo: LazyStaggeredGridLayoutInfo get() = layoutInfoState.value
- /** backing state for [layoutInfo] **/
+ /** backing state for [layoutInfo] */
private val layoutInfoState: MutableState<LazyStaggeredGridLayoutInfo> =
mutableStateOf(EmptyLazyStaggeredGridLayoutInfo)
- /** storage for lane assignments for each item for consistent scrolling in both directions **/
+ /** storage for lane assignments for each item for consistent scrolling in both directions */
internal val laneInfo = LazyStaggeredGridLaneInfo()
override var canScrollForward: Boolean by mutableStateOf(false)
@@ -156,7 +156,7 @@
override var canScrollBackward: Boolean by mutableStateOf(false)
private set
- /** implementation of [LazyAnimateScrollScope] scope required for [animateScrollToItem] **/
+ /** implementation of [LazyAnimateScrollScope] scope required for [animateScrollToItem] */
private val animateScrollScope = LazyStaggeredGridAnimateScrollScope(this)
internal var remeasurement: Remeasurement? = null
@@ -182,28 +182,28 @@
/*@VisibleForTesting*/
internal var prefetchingEnabled: Boolean = true
- /** prefetch state used for precomputing items in the direction of scroll **/
+ /** prefetch state used for precomputing items in the direction of scroll */
internal val prefetchState: LazyLayoutPrefetchState = LazyLayoutPrefetchState()
- /** state controlling the scroll **/
+ /** state controlling the scroll */
private val scrollableState = ScrollableState { -onScroll(-it) }
- /** scroll to be consumed during next/current layout pass **/
+ /** scroll to be consumed during next/current layout pass */
internal var scrollToBeConsumed = 0f
private set
/* @VisibleForTesting */
internal var measurePassCount = 0
- /** transient information from measure required for prefetching **/
+ /** transient information from measure required for prefetching */
internal var isVertical = false
internal var slots: LazyStaggeredGridSlots? = null
internal var spanProvider: LazyStaggeredGridSpanProvider? = null
- /** prefetch state **/
+ /** prefetch state */
private var prefetchBaseIndex: Int = -1
private val currentItemPrefetchHandles = mutableMapOf<Int, PrefetchHandle>()
- /** state required for implementing [animateScrollScope] **/
+ /** state required for implementing [animateScrollScope] */
internal var density: Density = Density(1f, 1f)
internal val laneCount get() = slots?.sizes?.size ?: 0
@@ -214,7 +214,7 @@
*/
val interactionSource get(): InteractionSource = mutableInteractionSource
- /** backing field mutable field for [interactionSource] **/
+ /** backing field mutable field for [interactionSource] */
internal val mutableInteractionSource = MutableInteractionSource()
/**
@@ -249,7 +249,7 @@
override val isScrollInProgress: Boolean
get() = scrollableState.isScrollInProgress
- /** Main scroll callback which adjusts scroll delta and remeasures layout **/
+ /** Main scroll callback which adjusts scroll delta and remeasures layout */
private fun onScroll(distance: Float): Float {
if (distance < 0 && !canScrollForward || distance > 0 && !canScrollBackward) {
return 0f
@@ -343,7 +343,7 @@
override fun dispatchRawDelta(delta: Float): Float =
scrollableState.dispatchRawDelta(delta)
- /** Start prefetch of the items based on provided delta **/
+ /** Start prefetch of the items based on provided delta */
private fun notifyPrefetch(delta: Float) {
val info = layoutInfoState.value
if (info.visibleItemsInfo.isNotEmpty()) {
@@ -438,7 +438,7 @@
}
}
- /** updates state after measure pass **/
+ /** updates state after measure pass */
internal fun applyMeasureResult(result: LazyStaggeredGridMeasureResult) {
scrollToBeConsumed -= result.consumedScroll
canScrollBackward = result.canScrollBackward
@@ -501,4 +501,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
index 9f49b62..2730111 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
@@ -77,13 +77,13 @@
userScrollEnabled: Boolean,
/** Number of pages to layout before and after the visible pages */
beyondBoundsPageCount: Int = 0,
- /** Space between pages **/
+ /** Space between pages */
pageSpacing: Dp = 0.dp,
- /** Allows to change how to calculate the Page size **/
+ /** Allows to change how to calculate the Page size */
pageSize: PageSize,
- /** A [NestedScrollConnection] that dictates how this [Pager] behaves with nested lists. **/
+ /** A [NestedScrollConnection] that dictates how this [Pager] behaves with nested lists. */
pageNestedScrollConnection: NestedScrollConnection,
- /** a stable and unique key representing the Page **/
+ /** a stable and unique key representing the Page */
key: ((index: Int) -> Any)?,
/** The alignment to align pages horizontally. Required when isVertical is true */
horizontalAlignment: Alignment.Horizontal,
@@ -246,9 +246,10 @@
pageCount: () -> Int
): () -> PagerLazyLayoutItemProvider {
val latestContent = rememberUpdatedState(pageContent)
- return remember(state, latestContent, key, pageCount) {
+ val latestKey = rememberUpdatedState(key)
+ return remember(state, latestContent, latestKey, pageCount) {
val intervalContentState = derivedStateOf(referentialEqualityPolicy()) {
- PagerLayoutIntervalContent(latestContent.value, key, pageCount())
+ PagerLayoutIntervalContent(latestContent.value, latestKey.value, pageCount())
}
val itemProviderState = derivedStateOf(referentialEqualityPolicy()) {
val intervalContent = intervalContentState.value
@@ -321,4 +322,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutSemanticState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutSemanticState.kt
index ab6795b..6f98340 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutSemanticState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutSemanticState.kt
@@ -46,4 +46,4 @@
} else {
CollectionInfo(rowCount = 1, columnCount = -1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PageInfo.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PageInfo.kt
index e37fb46..a4fd6b3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PageInfo.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PageInfo.kt
@@ -22,4 +22,4 @@
internal interface PageInfo {
val index: Int
val offset: Int
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt
index d64b834..946e681 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/Pager.kt
@@ -927,4 +927,4 @@
upDownDifference.x
} else {
upDownDifference.y
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerBeyondBoundsModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerBeyondBoundsModifier.kt
index 84d4297..323ad15 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerBeyondBoundsModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerBeyondBoundsModifier.kt
@@ -75,4 +75,4 @@
itemCount - 1,
state.layoutInfo.visiblePagesInfo.last().index + beyondBoundsPageCount
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerLayoutInfo.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerLayoutInfo.kt
index 27009c4..f3e2dbd 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerLayoutInfo.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerLayoutInfo.kt
@@ -38,4 +38,4 @@
@ExperimentalFoundationApi
internal val PagerLayoutInfo.mainAxisViewportSize: Int
- get() = if (orientation == Orientation.Vertical) viewportSize.height else viewportSize.width
\ No newline at end of file
+ get() = if (orientation == Orientation.Vertical) viewportSize.height else viewportSize.width
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasure.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasure.kt
index 264680a..9142421 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasure.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasure.kt
@@ -584,4 +584,4 @@
if (DEBUG) {
println("PagerMeasure: ${generateMsg()}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasurePolicy.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasurePolicy.kt
index d803fb0b..b8e31dc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasurePolicy.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasurePolicy.kt
@@ -187,4 +187,4 @@
state.applyMeasureResult(it)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasureResult.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasureResult.kt
index 3a2d241..ac69349 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasureResult.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerMeasureResult.kt
@@ -42,4 +42,4 @@
override val viewportSize: IntSize
get() = IntSize(width, height)
override val beforeContentPadding: Int get() = -viewportStartOffset
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScope.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScope.kt
index 7eeae76..9790ff5 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScope.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScope.kt
@@ -25,4 +25,4 @@
sealed interface PagerScope
@OptIn(ExperimentalFoundationApi::class)
-internal object PagerScopeImpl : PagerScope
\ No newline at end of file
+internal object PagerScopeImpl : PagerScope
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerSemantics.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerSemantics.kt
index ed274f6..4647096 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerSemantics.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerSemantics.kt
@@ -31,4 +31,4 @@
return remember(state, reverseScrolling, isVertical) {
LazyLayoutSemanticState(state, isVertical)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
index 37aafef0..d7d2187 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
@@ -170,7 +170,8 @@
) : ScrollableState {
/**
- * The total amount of pages present in this pager
+ * The total amount of pages present in this pager. The source of this data should be
+ * observable.
*/
abstract val pageCount: Int
@@ -229,7 +230,7 @@
*/
private var wasScrollingForward = false
- /** Backing state for PagerLayoutInfo **/
+ /** Backing state for PagerLayoutInfo */
private var pagerLayoutInfoState = mutableStateOf(EmptyLayoutInfo)
internal val layoutInfo: PagerLayoutInfo get() = pagerLayoutInfoState.value
@@ -683,4 +684,4 @@
if (DEBUG) {
println("PagerState: ${generateMsg()}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoView.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoView.kt
index ca27e6f..90894eb 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoView.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoView.kt
@@ -85,4 +85,4 @@
override fun onPlaced(coordinates: LayoutCoordinates) {
layoutCoordinates = coordinates
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt
index 2288769..8041415 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt
@@ -184,4 +184,4 @@
rect ?: layoutCoordinates?.size?.toSize()?.toRect()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
index fcdba64..38b769f 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
@@ -131,4 +131,4 @@
this.selected = selected
}
}
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt
index 1ff8402..913d91f 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt
@@ -28,4 +28,4 @@
*/
fun Modifier.selectableGroup() = this.semantics {
selectableGroup()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape.kt
index 0f40fab..22e5952 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.shape
+import androidx.annotation.IntRange
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.geometry.toRect
import androidx.compose.ui.graphics.Outline
@@ -181,13 +182,13 @@
* with a range of 0 - 100.
*/
fun AbsoluteCutCornerShape(
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topLeftPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topRightPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomRightPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomLeftPercent: Int = 0
) = AbsoluteCutCornerShape(
topLeft = CornerSize(topLeftPercent),
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape.kt
index 07dad48..bf5fa04 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.shape
+import androidx.annotation.IntRange
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.RoundRect
import androidx.compose.ui.geometry.Size
@@ -178,13 +179,13 @@
* with a range of 0 - 100.
*/
fun AbsoluteRoundedCornerShape(
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topLeftPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topRightPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomRightPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomLeftPercent: Int = 0
) = AbsoluteRoundedCornerShape(
topLeft = CornerSize(topLeftPercent),
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CornerSize.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CornerSize.kt
index 3e2bb03..3614b58 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CornerSize.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CornerSize.kt
@@ -16,6 +16,8 @@
package androidx.compose.foundation.shape
+import androidx.annotation.FloatRange
+import androidx.annotation.IntRange
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.compose.ui.geometry.Size
@@ -78,7 +80,7 @@
* Can't be negative or larger then 100 percents.
*/
@Stable
-fun CornerSize(/*@IntRange(from = 0, to = 100)*/ percent: Int): CornerSize =
+fun CornerSize(@IntRange(from = 0, to = 100) percent: Int): CornerSize =
PercentCornerSize(percent.toFloat())
/**
@@ -87,7 +89,7 @@
* Can't be negative or larger then 100 percents.
*/
private data class PercentCornerSize(
- /*@FloatRange(from = 0.0, to = 100.0)*/
+ @FloatRange(from = 0.0, to = 100.0)
private val percent: Float
) : CornerSize, InspectableValue {
init {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CutCornerShape.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CutCornerShape.kt
index d1e1636..7bb7b76 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CutCornerShape.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/CutCornerShape.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.shape
+import androidx.annotation.IntRange
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.geometry.toRect
import androidx.compose.ui.graphics.Outline
@@ -181,13 +182,13 @@
* with a range of 0 - 100.
*/
fun CutCornerShape(
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topStartPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topEndPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomEndPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomStartPercent: Int = 0
) = CutCornerShape(
topStart = CornerSize(topStartPercent),
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/RoundedCornerShape.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/RoundedCornerShape.kt
index 388eaed..d234583 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/RoundedCornerShape.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/shape/RoundedCornerShape.kt
@@ -16,6 +16,7 @@
package androidx.compose.foundation.shape
+import androidx.annotation.IntRange
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.RoundRect
import androidx.compose.ui.geometry.Size
@@ -183,13 +184,13 @@
* with a range of 0 - 100.
*/
fun RoundedCornerShape(
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topStartPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
topEndPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomEndPercent: Int = 0,
- /*@IntRange(from = 0, to = 100)*/
+ @IntRange(from = 0, to = 100)
bottomStartPercent: Int = 0
) = RoundedCornerShape(
topStart = CornerSize(topStartPercent),
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt
index e68d5b4..e0bd515 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt
@@ -387,4 +387,4 @@
cursorBrush = cursorBrush,
decorationBox = decorationBox
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ClickableText.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ClickableText.kt
index 05b8dad..6508a37 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ClickableText.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ClickableText.kt
@@ -189,4 +189,4 @@
}
private fun MultiParagraph.containsWithinBounds(positionOffset: Offset): Boolean =
- positionOffset.let { (x, y) -> x > 0 && y >= 0 && x <= width && y <= height }
\ No newline at end of file
+ positionOffset.let { (x, y) -> x > 0 && y >= 0 && x <= width && y <= height }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ContextMenu.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ContextMenu.kt
index 2464b86..f543e8b 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ContextMenu.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ContextMenu.kt
@@ -30,4 +30,4 @@
internal expect fun ContextMenuArea(
manager: SelectionManager,
content: @Composable () -> Unit
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
index 2967ba6..154e98e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
@@ -26,6 +26,7 @@
import androidx.compose.foundation.relocation.BringIntoViewRequester
import androidx.compose.foundation.relocation.bringIntoViewRequester
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
+import androidx.compose.foundation.text.selection.SelectionHandleAnchor
import androidx.compose.foundation.text.selection.SelectionHandleInfo
import androidx.compose.foundation.text.selection.SelectionHandleInfoKey
import androidx.compose.foundation.text.selection.SimpleLayout
@@ -1104,7 +1105,8 @@
.semantics {
this[SelectionHandleInfoKey] = SelectionHandleInfo(
handle = Handle.Cursor,
- position = position
+ position = position,
+ anchor = SelectionHandleAnchor.Middle
)
},
content = null
@@ -1143,4 +1145,4 @@
offsetMapping
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/HeightInLinesModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/HeightInLinesModifier.kt
index 16e2018..0b8834474 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/HeightInLinesModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/HeightInLinesModifier.kt
@@ -131,4 +131,4 @@
require(minLines <= maxLines) {
"minLines $minLines must be less than or equal to maxLines $maxLines"
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/InlineTextContent.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/InlineTextContent.kt
index 728b5ca..52c7a56 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/InlineTextContent.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/InlineTextContent.kt
@@ -83,4 +83,4 @@
* The string parameter passed to it will the alternateText given to [appendInlineContent].
*/
val children: @Composable (String) -> Unit
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyCommand.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyCommand.kt
index 4d3f9bc..a146a6a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyCommand.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyCommand.kt
@@ -89,4 +89,4 @@
UNDO(true),
REDO(true),
CHARACTER_PALETTE(true)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.kt
index 9aebb2c..e58dfff 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.kt
@@ -34,4 +34,4 @@
* macOS has a character/emoji palette, which has to be ordered by application. This
* platform-specific helper implements this action on MacOS and noop on other platforms.
*/
-internal expect fun showCharacterPalette()
\ No newline at end of file
+internal expect fun showCharacterPalette()
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt
index 43df93c..c1f4bda 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt
@@ -163,4 +163,4 @@
} ?: common.map(event)
}
}
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyboardOptions.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyboardOptions.kt
index 58e40cf..ec5478c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyboardOptions.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyboardOptions.kt
@@ -110,4 +110,4 @@
return "KeyboardOptions(capitalization=$capitalization, autoCorrect=$autoCorrect, " +
"keyboardType=$keyboardType, imeAction=$imeAction)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt
index fa1811f..142a3fc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/LongPressTextDragObserver.kt
@@ -122,4 +122,4 @@
},
onDragCancel = { observer.onCancel() }
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/StringHelpers.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/StringHelpers.kt
index 0cf888e..9cb7a5a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/StringHelpers.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/StringHelpers.kt
@@ -57,4 +57,4 @@
*/
internal fun CharSequence.getParagraphBoundary(index: Int): TextRange {
return TextRange(findParagraphStart(index), findParagraphEnd(index))
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextDelegate.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextDelegate.kt
index 837b118..41027f0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextDelegate.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextDelegate.kt
@@ -344,4 +344,4 @@
} else {
current
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldCursor.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldCursor.kt
index 703aa24..4eb829c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldCursor.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldCursor.kt
@@ -96,4 +96,4 @@
private object FixedMotionDurationScale : MotionDurationScale {
override val scaleFactor: Float
get() = 1f
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.kt
index c5d8e67..ceb68a2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.kt
@@ -28,4 +28,4 @@
internal expect fun Modifier.interceptDPadAndMoveFocus(
state: TextFieldState,
focusManager: FocusManager
-): Modifier
\ No newline at end of file
+): Modifier
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
index e238c52..20c8055 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
@@ -367,4 +367,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldSize.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldSize.kt
index 124fdb7..e814a84 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldSize.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldSize.kt
@@ -112,4 +112,4 @@
fontFamilyResolver = fontFamilyResolver
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextLayoutResultProxy.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextLayoutResultProxy.kt
index e17f108..2fd4bce 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextLayoutResultProxy.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextLayoutResultProxy.kt
@@ -122,4 +122,4 @@
else -> y
}
return Offset(xOffset, yOffset)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt
index 7072692..3034f6b 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt
@@ -18,4 +18,4 @@
import androidx.compose.ui.input.pointer.PointerIcon
-internal expect val textPointerIcon: PointerIcon
\ No newline at end of file
+internal expect val textPointerIcon: PointerIcon
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TouchMode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TouchMode.kt
index 234b500..9840fec 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TouchMode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TouchMode.kt
@@ -20,4 +20,4 @@
* This is a temporary workaround and should be removed after proper mouse handling is settled
* (b/171402426).
*/
-internal expect val isInTouchMode: Boolean
\ No newline at end of file
+internal expect val isInTouchMode: Boolean
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/UndoManager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/UndoManager.kt
index d8f38fb..1c0e014 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/UndoManager.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/UndoManager.kt
@@ -126,4 +126,4 @@
redoEntry.value
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ValidatingOffsetMapping.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ValidatingOffsetMapping.kt
index 59abd2e..ef591fe 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ValidatingOffsetMapping.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/ValidatingOffsetMapping.kt
@@ -73,4 +73,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtils.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtils.kt
index 2104a17..93823de 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtils.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/LayoutUtils.kt
@@ -85,4 +85,4 @@
// maxLines 1 to implement the similar behavior.
val overwriteMaxLines = !softWrap && overflow == TextOverflow.Ellipsis
return if (overwriteMaxLines) 1 else maxLinesIn.coerceAtLeast(1)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ModifierUtils.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ModifierUtils.kt
index 050ff6d..f4a6cc0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ModifierUtils.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ModifierUtils.kt
@@ -30,4 +30,4 @@
Constraints.Infinity
}
return maxWidth
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
index 27eeafe..d18c470 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
@@ -346,4 +346,4 @@
fun minIntrinsicWidth(layoutDirection: LayoutDirection): Int {
return setLayoutDirection(layoutDirection).minIntrinsicWidth.ceilToIntPx()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ParagraphLayoutCache.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ParagraphLayoutCache.kt
index b0e8843..2c5d63d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ParagraphLayoutCache.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/ParagraphLayoutCache.kt
@@ -382,4 +382,4 @@
fun maxIntrinsicWidth(layoutDirection: LayoutDirection): Int {
return setLayoutDirection(layoutDirection).maxIntrinsicWidth.ceilToIntPx()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringElement.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringElement.kt
index a7554de..fd739d6 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringElement.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringElement.kt
@@ -125,4 +125,4 @@
override fun InspectorInfo.inspectableProperties() {
// Show nothing in the inspector.
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringNode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringNode.kt
index 3616033..e54ae82 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringNode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/SelectableTextAnnotatedStringNode.kt
@@ -150,4 +150,4 @@
// we always relayout when we're selectable
invalidateMeasurement()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringElement.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringElement.kt
index 127e996..4530d5a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringElement.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringElement.kt
@@ -131,4 +131,4 @@
override fun InspectorInfo.inspectableProperties() {
// Show nothing in the inspector.
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNode.kt
index 6a52754..67f75f7 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextAnnotatedStringNode.kt
@@ -538,4 +538,4 @@
drawContent()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleElement.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleElement.kt
index 85e3272..dd28248 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleElement.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleElement.kt
@@ -107,4 +107,4 @@
override fun InspectorInfo.inspectableProperties() {
// Show nothing in the inspector.
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegate.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegate.kt
index 3791520..3061137 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegate.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/MultiWidgetSelectionDelegate.kt
@@ -55,8 +55,11 @@
// if final visible line's top is equal to or larger than text layout
// result's height, we need to check above lines one by one until we find
// a line that fits in boundaries.
- while (getLineTop(finalVisibleLine) >= size.height) finalVisibleLine--
- finalVisibleLine
+ while (
+ finalVisibleLine >= 0 &&
+ getLineTop(finalVisibleLine) >= size.height
+ ) finalVisibleLine--
+ finalVisibleLine.coerceAtLeast(0)
}
}
_previousLastVisibleOffset = getLineEnd(lastVisibleLine, true)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustment.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustment.kt
index b108673..c35e650 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustment.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustment.kt
@@ -463,4 +463,4 @@
TextRange(offset, text.findPrecedingBreak(offset))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionHandles.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionHandles.kt
index 97a367d..348f37e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionHandles.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionHandles.kt
@@ -44,9 +44,23 @@
*/
internal data class SelectionHandleInfo(
val handle: Handle,
- val position: Offset
+ val position: Offset,
+ val anchor: SelectionHandleAnchor
)
+/**
+ * How the selection handle is anchored to its position
+ *
+ * In a regular text selection, selection start is anchored to left.
+ * Only cursor handle is always anchored at the middle.
+ * In a regular text selection, selection end is anchored to right.
+ */
+internal enum class SelectionHandleAnchor {
+ Left,
+ Middle,
+ Right
+}
+
@Composable
internal expect fun SelectionHandle(
position: Offset,
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionRegistrarImpl.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionRegistrarImpl.kt
index 5622db3..907c15f 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionRegistrarImpl.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/SelectionRegistrarImpl.kt
@@ -211,4 +211,4 @@
override fun notifySelectableChange(selectableId: Long) {
onSelectableChangeCallback?.invoke(selectableId)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextFieldSelectionManager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextFieldSelectionManager.kt
index ad143f2..6d55c9c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextFieldSelectionManager.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextFieldSelectionManager.kt
@@ -1004,4 +1004,4 @@
}
return Offset(centerX, offsetCenter.y)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextPreparedSelection.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextPreparedSelection.kt
index 523054e..216af82 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextPreparedSelection.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/selection/TextPreparedSelection.kt
@@ -433,4 +433,4 @@
value.getOffsetForPosition(Offset(x, y))
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicSecureTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicSecureTextField.kt
index 2ea7e2c..1a8cc48 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicSecureTextField.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicSecureTextField.kt
@@ -303,4 +303,4 @@
onPrevious = { if (!onSubmit(ImeAction.Previous)) defaultKeyboardAction(ImeAction.Previous) },
onSearch = { if (!onSubmit(ImeAction.Search)) defaultKeyboardAction(ImeAction.Search) },
onSend = { if (!onSubmit(ImeAction.Send)) defaultKeyboardAction(ImeAction.Send) },
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicTextField2.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicTextField2.kt
index 40c2d5e..1a4d160 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicTextField2.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/BasicTextField2.kt
@@ -32,6 +32,8 @@
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.heightInLines
+import androidx.compose.foundation.text.selection.SelectionHandle
+import androidx.compose.foundation.text.selection.SelectionHandleAnchor
import androidx.compose.foundation.text.selection.SelectionHandleInfo
import androidx.compose.foundation.text.selection.SelectionHandleInfoKey
import androidx.compose.foundation.text.textFieldMinSize
@@ -156,6 +158,8 @@
val orientation = if (singleLine) Orientation.Horizontal else Orientation.Vertical
+ val isFocused = interactionSource.collectIsFocusedAsState().value
+
val textLayoutState = remember { TextLayoutState() }
val textFieldSelectionState = remember(state, textLayoutState) {
@@ -164,7 +168,8 @@
textLayoutState = textLayoutState,
textEditFilter = filter,
density = density,
- editable = enabled && !readOnly
+ editable = enabled && !readOnly,
+ isFocused = isFocused
)
}
textFieldSelectionState.hapticFeedBack = LocalHapticFeedback.current
@@ -208,8 +213,6 @@
enabled = enabled && scrollState.maxValue > 0
)
- val isFocused = interactionSource.collectIsFocusedAsState().value
-
Box(decorationModifiers, propagateMinConstraints = true) {
decorationBox {
val minLines: Int
@@ -256,10 +259,15 @@
)
)
- if (enabled && isFocused && !readOnly && textFieldSelectionState.isInTouchMode) {
- TextFieldCursorHandle(
+ if (enabled && isFocused && textFieldSelectionState.isInTouchMode) {
+ TextFieldSelectionHandles(
selectionState = textFieldSelectionState
)
+ if (!readOnly) {
+ TextFieldCursorHandle(
+ selectionState = textFieldSelectionState
+ )
+ }
}
}
}
@@ -268,14 +276,16 @@
@Composable
internal fun TextFieldCursorHandle(selectionState: TextFieldSelectionState) {
- if (selectionState.cursorHandleVisible) {
+ val cursorHandleState = selectionState.cursorHandle
+ if (cursorHandleState.visible) {
CursorHandle(
- handlePosition = selectionState.cursorRect.bottomCenter,
+ handlePosition = cursorHandleState.position,
modifier = Modifier
.semantics {
this[SelectionHandleInfoKey] = SelectionHandleInfo(
handle = Handle.Cursor,
- position = selectionState.cursorRect.bottomCenter
+ position = cursorHandleState.position,
+ anchor = SelectionHandleAnchor.Middle
)
}
.pointerInput(selectionState) {
@@ -284,4 +294,37 @@
content = null
)
}
-}
\ No newline at end of file
+}
+
+@Composable
+internal fun TextFieldSelectionHandles(
+ selectionState: TextFieldSelectionState
+) {
+ val startHandleState = selectionState.startSelectionHandle
+ if (startHandleState.visible) {
+ SelectionHandle(
+ position = startHandleState.position,
+ isStartHandle = true,
+ direction = startHandleState.direction,
+ handlesCrossed = startHandleState.handlesCrossed,
+ modifier = Modifier.pointerInput(selectionState) {
+ with(selectionState) { detectSelectionHandleDrag(true) }
+ },
+ content = null
+ )
+ }
+
+ val endHandleState = selectionState.endSelectionHandle
+ if (endHandleState.visible) {
+ SelectionHandle(
+ position = endHandleState.position,
+ isStartHandle = false,
+ direction = endHandleState.direction,
+ handlesCrossed = endHandleState.handlesCrossed,
+ modifier = Modifier.pointerInput(selectionState) {
+ with(selectionState) { detectSelectionHandleDrag(false) }
+ },
+ content = null
+ )
+ }
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/AllCapsFilter.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/AllCapsFilter.kt
index c087028..bcc68a2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/AllCapsFilter.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/AllCapsFilter.kt
@@ -55,4 +55,4 @@
}
override fun toString(): String = "TextEditFilter.allCaps(locale=$locale)"
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/CodepointTransformation.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/CodepointTransformation.kt
index df7909b..bac6a8a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/CodepointTransformation.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/CodepointTransformation.kt
@@ -116,4 +116,4 @@
appendCodePointX(codepoint)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/MaxLengthFilter.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/MaxLengthFilter.kt
index 56d5b9a..fe2011e 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/MaxLengthFilter.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/MaxLengthFilter.kt
@@ -67,4 +67,4 @@
val name = if (inCodepoints) "maxLengthInCodepoints" else "maxLengthInChars"
return "TextEditFilter.$name(maxLength=$maxLength)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextEditFilter.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextEditFilter.kt
index 79a4ebd..eb1532b 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextEditFilter.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextEditFilter.kt
@@ -116,4 +116,4 @@
result = 32 * result + keyboardOptions.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldBuffer.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldBuffer.kt
index 299fba9..81e1aae 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldBuffer.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldBuffer.kt
@@ -542,4 +542,4 @@
override fun getOriginalRange(changeIndex: Int): TextRange {
throw IndexOutOfBoundsException()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequence.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequence.kt
index 71de42f..4a4f8c0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequence.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequence.kt
@@ -180,4 +180,4 @@
*/
@OptIn(ExperimentalFoundationApi::class)
internal fun TextFieldCharSequence.getSelectedText(): CharSequence =
- subSequence(selectionInChars.min, selectionInChars.max)
\ No newline at end of file
+ subSequence(selectionInChars.min, selectionInChars.max)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldLineLimits.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldLineLimits.kt
index e2e151f..fcb8edc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldLineLimits.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextFieldLineLimits.kt
@@ -80,4 +80,4 @@
companion object {
val Default: TextFieldLineLimits = MultiLine()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextObfuscationMode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextObfuscationMode.kt
index be6fe5a..89ed6bc 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextObfuscationMode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/TextObfuscationMode.kt
@@ -55,4 +55,4 @@
*/
val Hidden = TextObfuscationMode(2)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ApplyEditCommand.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ApplyEditCommand.kt
index 70479a9..4e3c363 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ApplyEditCommand.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ApplyEditCommand.kt
@@ -239,4 +239,4 @@
* is a Unicode low-surrogate code unit.
*/
private fun isSurrogatePair(high: Char, low: Char): Boolean =
- high.isHighSurrogate() && low.isLowSurrogate()
\ No newline at end of file
+ high.isHighSurrogate() && low.isLowSurrogate()
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTracker.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTracker.kt
index 1649497..a3f31a5 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTracker.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTracker.kt
@@ -189,4 +189,4 @@
var originalStart: Int,
var originalEnd: Int
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditCommand.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditCommand.kt
index fae3413..6381663 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditCommand.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditCommand.kt
@@ -238,4 +238,4 @@
override fun toString(): String {
return "DeleteAllCommand()"
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessor.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessor.kt
index 32835db..2862d17 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessor.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessor.kt
@@ -248,4 +248,4 @@
is BackspaceCommand -> toString()
is MoveCursorCommand -> toString()
is DeleteAllCommand -> toString()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/MathUtils.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/MathUtils.kt
index 4a2851a..ba1dcff1 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/MathUtils.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/MathUtils.kt
@@ -33,4 +33,4 @@
// HD 2-12 Overflow iff the arguments have different signs and
// the sign of the result is different from the sign of x
return if (this xor right and (this xor result) < 0) defaultValue() else result
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldCoreModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldCoreModifier.kt
index 0012385..afbb3f2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldCoreModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldCoreModifier.kt
@@ -152,6 +152,7 @@
// TODO: kdoc
private var previousSelection: TextRange = TextRange.Zero
+ private var lastFollowing: Int = -1
private var previousCursorRect: Rect = Rect.Zero
/**
@@ -238,10 +239,12 @@
): MeasureResult {
val currSelection = textFieldState.text.selectionInChars
val offsetToFollow = when {
- currSelection.start != previousSelection.start -> currSelection.start
currSelection.end != previousSelection.end -> currSelection.end
+ currSelection.start != previousSelection.start -> currSelection.start
+ lastFollowing >= 0 -> lastFollowing
else -> currSelection.min
}
+ lastFollowing = offsetToFollow
previousSelection = currSelection
// remove any height constraints for TextField since it'll be able to scroll vertically.
@@ -272,13 +275,15 @@
measurable: Measurable,
constraints: Constraints
): MeasureResult {
- val value = textFieldState.text
+ val currSelection = textFieldState.text.selectionInChars
val offsetToFollow = when {
- value.selectionInChars.start != previousSelection.start -> value.selectionInChars.start
- value.selectionInChars.end != previousSelection.end -> value.selectionInChars.end
- else -> value.selectionInChars.min
+ currSelection.end != previousSelection.end -> currSelection.end
+ currSelection.start != previousSelection.start -> currSelection.start
+ lastFollowing >= 0 -> lastFollowing
+ else -> currSelection.min
}
- previousSelection = value.selectionInChars
+ lastFollowing = offsetToFollow
+ previousSelection = currSelection
// If the maxIntrinsicWidth of the children is already smaller than the constraint, pass
// the original constraints so that the children has more information to determine its
@@ -512,4 +517,4 @@
this.isNaN() || this.isInfinite() -> this
this > 0 -> ceil(this)
else -> floor(this)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldDecoratorModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldDecoratorModifier.kt
index c37aff2..e2682b1 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldDecoratorModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldDecoratorModifier.kt
@@ -17,7 +17,6 @@
package androidx.compose.foundation.text2.input.internal
import androidx.compose.foundation.ExperimentalFoundationApi
-import androidx.compose.foundation.gestures.detectTapAndPress
import androidx.compose.foundation.text.KeyboardActionScope
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
@@ -72,7 +71,6 @@
import androidx.compose.ui.unit.IntSize
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Job
-import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
/**
@@ -148,22 +146,15 @@
CompositionLocalConsumerModifierNode {
private val pointerInputNode = delegate(SuspendingPointerInputModifierNode {
- coroutineScope {
- launch(start = CoroutineStart.UNDISPATCHED) {
- with(textFieldSelectionState) { detectTouchMode() }
- }
- launch(start = CoroutineStart.UNDISPATCHED) {
- detectTapAndPress(onTap = { offset ->
- if (!isFocused) {
- requestFocus()
- }
-
- if (enabled && !readOnly && isFocused) {
- requireKeyboardController().show()
- textFieldSelectionState.onTapTextField(offset)
- }
- })
- }
+ with(textFieldSelectionState) {
+ textFieldGestures(
+ requestFocus = {
+ if (!isFocused) requestFocus()
+ },
+ showKeyboard = {
+ requireKeyboardController().show()
+ }
+ )
}
})
@@ -358,6 +349,7 @@
return
}
isFocused = focusState.isFocused
+ textFieldSelectionState.isFocused = focusState.isFocused
if (focusState.isFocused) {
startInputSession()
@@ -473,4 +465,4 @@
defaults.imeAction
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldTextLayoutModifier.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldTextLayoutModifier.kt
index e9b8972..5ad9d39 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldTextLayoutModifier.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextFieldTextLayoutModifier.kt
@@ -162,4 +162,4 @@
placeable.place(0, 0)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextLayoutState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextLayoutState.kt
index 3320388..ea1e8fb 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextLayoutState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextLayoutState.kt
@@ -138,6 +138,19 @@
}
/**
+ * Returns true if the screen coordinates position (x,y) corresponds to a character displayed
+ * in the view. Returns false when the position is in the empty space of left/right of text.
+ * This function may return true even when [offset] is below or above the text layout.
+ */
+ fun isPositionOnText(offset: Offset): Boolean {
+ val layoutResult = layoutResult ?: return false
+ val relativeOffset = offset.coercedInVisibleBoundsOfInputText().relativeToInputText()
+ val line = layoutResult.getLineForVerticalPosition(relativeOffset.y)
+ return relativeOffset.x >= layoutResult.getLineLeft(line) &&
+ relativeOffset.x <= layoutResult.getLineRight(line)
+ }
+
+ /**
* Translates the click happened on the decoration box to the position in the inner text
* field coordinates. This relative position is then used to determine symbol position in
* text using TextLayoutResult object.
@@ -185,4 +198,4 @@
else -> y
}
return Offset(xOffset, yOffset)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextPreparedSelection.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextPreparedSelection.kt
index b2ed243..a590fd2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextPreparedSelection.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/TextPreparedSelection.kt
@@ -428,4 +428,4 @@
*/
const val NoCharacterFound = -1
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.kt
index ed73951..3b3f0b2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.kt
@@ -41,4 +41,4 @@
destinationOffset: Int,
startIndex: Int,
endIndex: Int
-)
\ No newline at end of file
+)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapGesture.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapGesture.kt
new file mode 100644
index 0000000..123b03c
--- /dev/null
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TapAndDoubleTapGesture.kt
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text2.selection
+
+import androidx.compose.foundation.gestures.awaitEachGesture
+import androidx.compose.foundation.gestures.awaitFirstDown
+import androidx.compose.foundation.gestures.detectTapGestures
+import androidx.compose.foundation.gestures.waitForUpOrCancellation
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.input.pointer.AwaitPointerEventScope
+import androidx.compose.ui.input.pointer.PointerEventTimeoutCancellationException
+import androidx.compose.ui.input.pointer.PointerInputChange
+import androidx.compose.ui.input.pointer.PointerInputScope
+import androidx.compose.ui.platform.ViewConfiguration
+import androidx.compose.ui.util.fastAny
+import androidx.compose.ui.util.fastForEach
+import kotlinx.coroutines.coroutineScope
+
+/**
+ * Detect tap and double tap gestures. This is a special gesture detector that's copied from
+ * [PointerInputScope.detectTapGestures] to always call [onTap] even when a double tap is detected.
+ * In that case both [onTap] and [onDoubleTap] are called successively. However, if there is a long
+ * tap, neither of the callbacks are called.
+ */
+internal suspend fun PointerInputScope.detectTapAndDoubleTap(
+ onTap: TapOnPosition? = null,
+ onDoubleTap: TapOnPosition? = null,
+) = coroutineScope {
+ awaitEachGesture {
+ val down = awaitFirstDown()
+ down.consume()
+ val longPressTimeout = viewConfiguration.longPressTimeoutMillis
+ var upOrCancel: PointerInputChange? = null
+ try {
+ // wait for first tap up or long press
+ upOrCancel = withTimeout(longPressTimeout) {
+ waitForUpOrCancellation()
+ }
+ } catch (_: PointerEventTimeoutCancellationException) {
+ consumeUntilUp()
+ }
+
+ if (upOrCancel != null) {
+ upOrCancel.consume()
+ // Tap was successful. There was no long click. Now evaluate whether it's gonna be
+ // a double tap.
+ onTap?.onEvent(upOrCancel.position)
+ if (onDoubleTap != null) {
+ // check for second tap
+ val secondDown = awaitSecondDown(upOrCancel)
+
+ if (secondDown != null) {
+ try {
+ // Might have a long second press as the second tap
+ withTimeout(longPressTimeout) {
+ val secondUp = waitForUpOrCancellation()
+ if (secondUp != null) {
+ secondUp.consume()
+ onDoubleTap.onEvent(secondUp.position)
+ }
+ }
+ } catch (e: PointerEventTimeoutCancellationException) {
+ consumeUntilUp()
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Waits for [ViewConfiguration.doubleTapTimeoutMillis] for a second press event. If a
+ * second press event is received before the time out, it is returned or `null` is returned
+ * if no second press is received.
+ */
+private suspend fun AwaitPointerEventScope.awaitSecondDown(
+ firstUp: PointerInputChange
+): PointerInputChange? = withTimeoutOrNull(viewConfiguration.doubleTapTimeoutMillis) {
+ val minUptime = firstUp.uptimeMillis + viewConfiguration.doubleTapMinTimeMillis
+ var change: PointerInputChange
+ // The second tap doesn't count if it happens before DoubleTapMinTime of the first tap
+ do {
+ change = awaitFirstDown()
+ } while (change.uptimeMillis < minUptime)
+ change
+}
+
+/**
+ * Consumes all pointer events until nothing is pressed and then returns. This method assumes
+ * that something is currently pressed.
+ */
+private suspend fun AwaitPointerEventScope.consumeUntilUp() {
+ do {
+ val event = awaitPointerEvent()
+ event.changes.fastForEach { it.consume() }
+ } while (event.changes.fastAny { it.pressed })
+}
+
+internal fun interface TapOnPosition {
+ fun onEvent(offset: Offset)
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldHandleState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldHandleState.kt
new file mode 100644
index 0000000..910130d
--- /dev/null
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldHandleState.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text2.selection
+
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.text.style.ResolvedTextDirection
+
+/**
+ * Defines how to render a selection or cursor handle on a TextField.
+ */
+internal data class TextFieldHandleState(
+ val visible: Boolean,
+ val position: Offset,
+ val direction: ResolvedTextDirection,
+ val handlesCrossed: Boolean
+) {
+ companion object {
+ val Hidden = TextFieldHandleState(
+ visible = false,
+ position = Offset.Unspecified,
+ direction = ResolvedTextDirection.Ltr,
+ handlesCrossed = false
+ )
+ }
+}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionState.kt
index 74589cc..3e10bbe 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text2/selection/TextFieldSelectionState.kt
@@ -18,11 +18,15 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.detectDragGestures
-import androidx.compose.foundation.gestures.detectTapAndPress
+import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress
+import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.text.DefaultCursorThickness
+import androidx.compose.foundation.text.Handle
+import androidx.compose.foundation.text.selection.SelectionAdjustment
import androidx.compose.foundation.text.selection.containsInclusive
import androidx.compose.foundation.text.selection.getAdjustedCoordinates
import androidx.compose.foundation.text.selection.getSelectionHandleCoordinates
+import androidx.compose.foundation.text.selection.getTextFieldSelection
import androidx.compose.foundation.text.selection.isPrecisePointer
import androidx.compose.foundation.text.selection.visibleBounds
import androidx.compose.foundation.text2.input.TextEditFilter
@@ -37,19 +41,21 @@
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.runtime.snapshots.Snapshot
+import androidx.compose.runtime.structuralEqualityPolicy
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.hapticfeedback.HapticFeedback
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.PointerInputScope
+import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.platform.ClipboardManager
import androidx.compose.ui.platform.TextToolbar
import androidx.compose.ui.platform.TextToolbarStatus
import androidx.compose.ui.text.TextRange
+import androidx.compose.ui.text.style.ResolvedTextDirection
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection
-import androidx.compose.ui.unit.dp
import kotlin.math.max
import kotlin.math.min
import kotlinx.coroutines.CoroutineStart
@@ -64,7 +70,8 @@
private val textLayoutState: TextLayoutState,
var textEditFilter: TextEditFilter?,
var density: Density,
- var editable: Boolean
+ var editable: Boolean,
+ var isFocused: Boolean
) {
/**
* [HapticFeedback] handle to perform haptic feedback.
@@ -87,45 +94,63 @@
var isInTouchMode: Boolean by mutableStateOf(true)
/**
- * The gesture detector state, to indicate whether to show the appropriate handles for current
- * selection or just the cursor.
- *
- * In the false state, no selection or cursor handle is shown, only the cursor is shown.
- * TextField is initially in this state. To enter this state, input anything from the
- * keyboard and modify the text.
- *
- * In the true state, either selection or cursor handle is shown according to current selection
- * state of the TextField.
+ * Whether to show the cursor handle below cursor indicator when the TextField is focused.
*/
- var showHandles by mutableStateOf(false)
+ private var showCursorHandle by mutableStateOf(false)
/**
- * Whether cursor handle is currently being dragged.
+ * Request to show the text toolbar right now, anchored to the cursor handle. This is not the
+ * final decider for showing the toolbar. Please refer to [observeTextToolbarVisibility] docs.
*/
- private var isCursorDragging by mutableStateOf(false)
+ private var cursorHandleShowToolbar by mutableStateOf(false)
/**
- * Request to show the text toolbar right now. This is not the final decider for showing the
- * toolbar. Please refer to [observeTextToolbarVisibility] docs.
+ * Which selection handle is currently being dragged.
*/
- private var textToolbarVisible by mutableStateOf(false)
+ private var draggingHandle by mutableStateOf<Handle?>(null)
/**
- * True if the position of the cursor is within a visible part of the window (i.e. not scrolled
- * out of view) and the handle should be drawn.
+ * Access helper for inner text field coordinates that checks attached state.
*/
- val cursorHandleVisible: Boolean by derivedStateOf {
- val existsCondition = showHandles && textFieldState.text.selectionInChars.collapsed
- if (!existsCondition) return@derivedStateOf false
+ private val innerCoordinates: LayoutCoordinates?
+ get() = textLayoutState.innerTextFieldCoordinates?.takeIf { it.isAttached }
- // either cursor is dragging or inside visible bounds.
- return@derivedStateOf isCursorDragging ||
- textLayoutState.innerTextFieldCoordinates
- ?.visibleBounds()
- // Visibility of cursor handle should only be decided by changes to showHandles and
- // innerTextFieldCoordinates. If we also react to position changes of cursor, cursor
- // handle may start flickering while moving and scrolling the text field.
- ?.containsInclusive(Snapshot.withoutReadObservation { cursorRect.bottomCenter })
+ /**
+ * State of the cursor handle that includes its visibility and position.
+ */
+ val cursorHandle by derivedStateOf {
+ // For cursor handle to be visible, [showCursorHandle] must be true and the selection
+ // must be collapsed.
+ // Also, cursor handle should be in visible bounds of inner TextField. However, if cursor
+ // is dragging and gets out of bounds, we cannot remove it from composition because that
+ // would stop the drag gesture defined on it. Instead, we allow the handle to be visible
+ // as long as it's being dragged.
+ // Visible bounds calculation lags one frame behind to let auto-scrolling settle.
+ val visible = showCursorHandle && textFieldState.text.selectionInChars.collapsed &&
+ (draggingHandle == Handle.Cursor || cursorHandleInBounds)
+
+ if (!visible) return@derivedStateOf TextFieldHandleState.Hidden
+
+ // text direction is useless for cursor handle, any value is fine.
+ TextFieldHandleState(
+ visible = true,
+ position = cursorRect.bottomCenter,
+ direction = ResolvedTextDirection.Ltr,
+ handlesCrossed = false
+ )
+ }
+
+ /**
+ * Whether currently cursor handle is in visible bounds. This derived state does not react to
+ * selection changes immediately because every selection change is processed in layout phase
+ * by auto-scroll behavior.
+ */
+ private val cursorHandleInBounds by derivedStateOf(policy = structuralEqualityPolicy()) {
+ val position = Snapshot.withoutReadObservation { cursorRect.bottomCenter }
+
+ innerCoordinates
+ ?.visibleBounds()
+ ?.containsInclusive(position)
?: false
}
@@ -148,15 +173,13 @@
(cursorRect.right - cursorWidth / 2)
}
- val coercedCursorCenterX = textLayoutState.innerTextFieldCoordinates?.let { coordinates ->
- // don't let cursor go beyond the bounds of inner text field or cursor will be clipped.
- // but also make sure that empty Text Layout still draws a cursor.
- cursorCenterX
- // do not use coerceIn because it is not guaranteed that minimum value is smaller
- // than the maximum value.
- .coerceAtMost(coordinates.size.width - cursorWidth / 2)
- .coerceAtLeast(cursorWidth / 2)
- } ?: cursorCenterX
+ // don't let cursor go beyond the bounds of inner text field or cursor will be clipped.
+ // but also make sure that empty Text Layout still draws a cursor.
+ val coercedCursorCenterX = cursorCenterX
+ // do not use coerceIn because it is not guaranteed that minimum value is smaller
+ // than the maximum value.
+ .coerceAtMost(layoutResult.size.width - cursorWidth / 2)
+ .coerceAtLeast(cursorWidth / 2)
Rect(
left = coercedCursorCenterX - cursorWidth / 2,
@@ -166,24 +189,12 @@
)
}
- /**
- * Responsible for responding to tap events on TextField.
- */
- fun onTapTextField(offset: Offset) {
- if (textFieldState.text.isNotEmpty()) {
- showHandles = true
- }
+ val startSelectionHandle by derivedStateOf {
+ getSelectionHandleState(isStartHandle = true)
+ }
- textToolbarVisible = false
-
- // find the cursor position
- val cursorIndex = textLayoutState.getOffsetForPosition(offset)
- // update the state
- if (cursorIndex >= 0) {
- editWithFilter {
- selectCharsIn(TextRange(cursorIndex))
- }
- }
+ val endSelectionHandle by derivedStateOf {
+ getSelectionHandleState(isStartHandle = false)
}
/**
@@ -198,22 +209,133 @@
detectCursorHandleDragGestures()
}
launch(start = CoroutineStart.UNDISPATCHED) {
- detectTapAndPress { textToolbarVisible = !textToolbarVisible }
+ detectTapGestures(onTap = {
+ cursorHandleShowToolbar = !cursorHandleShowToolbar
+ })
}
}
}
/**
- * Detects the current pointer type in this [PointerInputScope] to update the touch mode state.
- * This helper gesture detector should be added to all TextField pointer input receivers such
- * as TextFieldDecorator, cursor handle, and selection handles.
+ * Implements the complete set of gestures supported by the TextField area.
*/
- suspend fun PointerInputScope.detectTouchMode() {
- awaitPointerEventScope {
- while (true) {
- val event = awaitPointerEvent(PointerEventPass.Initial)
- isInTouchMode = !event.isPrecisePointer
+ suspend fun PointerInputScope.textFieldGestures(
+ requestFocus: () -> Unit,
+ showKeyboard: () -> Unit
+ ) {
+ coroutineScope {
+ launch(start = CoroutineStart.UNDISPATCHED) {
+ detectTouchMode()
}
+ launch(start = CoroutineStart.UNDISPATCHED) {
+ detectTextFieldTapGestures(requestFocus, showKeyboard)
+ }
+ launch(start = CoroutineStart.UNDISPATCHED) {
+ detectTextFieldLongPressAndAfterDrag(requestFocus)
+ }
+ }
+ }
+
+ /**
+ * Gesture detector for dragging the selection handles to change the selection in TextField.
+ */
+ suspend fun PointerInputScope.detectSelectionHandleDrag(isStartHandle: Boolean) {
+ // keep track of how visible bounds change while moving the selection handle.
+ var startContentVisibleOffset: Offset = Offset.Zero
+
+ var dragBeginPosition: Offset = Offset.Unspecified
+ var dragTotalDistance: Offset = Offset.Unspecified
+ var previousDragOffset = -1
+ val handle = if (isStartHandle) Handle.SelectionStart else Handle.SelectionEnd
+
+ // b/288931376: detectDragGestures do not call onDragCancel when composable is disposed.
+ try {
+ detectDragGestures(
+ onDragStart = {
+ draggingHandle = handle
+ // The position of the character where the drag gesture should begin. This is in
+ // the composable coordinates.
+ dragBeginPosition = getAdjustedCoordinates(getHandlePosition(isStartHandle))
+
+ startContentVisibleOffset = innerCoordinates
+ ?.visibleBounds()
+ ?.topLeft ?: Offset.Zero
+
+ // Zero out the total distance that being dragged.
+ dragTotalDistance = Offset.Zero
+ previousDragOffset = if (isStartHandle) {
+ textFieldState.text.selectionInChars.start
+ } else {
+ textFieldState.text.selectionInChars.end
+ }
+ },
+ onDragEnd = {
+ draggingHandle = null
+ dragBeginPosition = Offset.Unspecified
+ dragTotalDistance = Offset.Zero
+ startContentVisibleOffset = Offset.Zero
+ },
+ onDragCancel = {
+ draggingHandle = null
+ dragBeginPosition = Offset.Unspecified
+ dragTotalDistance = Offset.Zero
+ startContentVisibleOffset = Offset.Zero
+ },
+ onDrag = onDrag@{ _, delta ->
+ draggingHandle = handle
+ dragTotalDistance += delta
+ val layoutResult = textLayoutState.layoutResult ?: return@onDrag
+
+ val currentContentVisibleOffset = innerCoordinates
+ ?.visibleBounds()
+ ?.topLeft ?: startContentVisibleOffset
+
+ // "start position + total delta" is not enough to understand the current
+ // pointer position relative to text layout. We need to also account for any
+ // changes to visible offset that's caused by auto-scrolling while dragging.
+ val currentDragPosition = dragBeginPosition + dragTotalDistance +
+ (currentContentVisibleOffset - startContentVisibleOffset)
+
+ val startOffset = if (isStartHandle) {
+ layoutResult.getOffsetForPosition(currentDragPosition)
+ } else {
+ textFieldState.text.selectionInChars.start
+ }
+
+ val endOffset = if (isStartHandle) {
+ textFieldState.text.selectionInChars.end
+ } else {
+ layoutResult.getOffsetForPosition(currentDragPosition)
+ }
+
+ val prevSelection = textFieldState.text.selectionInChars
+ var newSelection = updateSelection(
+ textFieldCharSequence = textFieldState.text,
+ startOffset = startOffset,
+ endOffset = endOffset,
+ isStartHandle = isStartHandle,
+ previousHandleOffset = previousDragOffset,
+ adjustment = SelectionAdjustment.CharacterWithWordAccelerate,
+ )
+ // selection drag should never reverse the selection. It can only collapse the
+ // selection as the handles are about to pass each other.
+ if (newSelection.reversed != prevSelection.reversed) {
+ // the common offset should be the one that is not being dragged
+ val offset = if (isStartHandle) prevSelection.end else prevSelection.start
+ newSelection = TextRange(offset)
+ }
+ editWithFilter {
+ selectCharsIn(newSelection)
+ }
+ previousDragOffset = if (isStartHandle) startOffset else endOffset
+ }
+ )
+ } finally {
+ logDebug {
+ "Selection Handle drag cancelled for " +
+ "draggingHandle: $draggingHandle definedOn: $handle"
+ }
+ if (draggingHandle == handle) draggingHandle = null
}
}
@@ -228,23 +350,90 @@
launch { observeTextToolbarVisibility() }
}
} finally {
- showHandles = false
- if (textToolbarVisible) {
+ showCursorHandle = false
+ if (cursorHandleShowToolbar) {
hideTextToolbar()
}
}
}
fun dispose() {
- if (textToolbarVisible) {
- hideTextToolbar()
- }
+ hideTextToolbar()
textToolbar = null
clipboardManager = null
hapticFeedBack = null
}
+ /**
+ * Detects the current pointer type in this [PointerInputScope] to update the touch mode state.
+ * This helper gesture detector should be added to all TextField pointer input receivers such
+ * as TextFieldDecorator, cursor handle, and selection handles.
+ */
+ private suspend fun PointerInputScope.detectTouchMode() {
+ awaitPointerEventScope {
+ while (true) {
+ val event = awaitPointerEvent(PointerEventPass.Initial)
+ isInTouchMode = !event.isPrecisePointer
+ }
+ }
+ }
+
+ private suspend fun PointerInputScope.detectTextFieldTapGestures(
+ requestFocus: () -> Unit,
+ showKeyboard: () -> Unit
+ ) {
+ detectTapAndDoubleTap(
+ onTap = { offset ->
+ logDebug { "onTapTextField" }
+ requestFocus()
+
+ if (editable && isFocused) {
+ showKeyboard()
+ if (textFieldState.text.isNotEmpty()) {
+ showCursorHandle = true
+ }
+
+ cursorHandleShowToolbar = false
+
+ // find the cursor position
+ val cursorIndex = textLayoutState.getOffsetForPosition(offset)
+ // update the state
+ if (cursorIndex >= 0) {
+ editWithFilter {
+ selectCharsIn(TextRange(cursorIndex))
+ }
+ }
+ }
+ },
+ onDoubleTap = { offset ->
+ logDebug { "onDoubleTapTextField" }
+ // onTap is already called at this point. Focus is requested.
+
+ showCursorHandle = false
+ cursorHandleShowToolbar = false
+
+ val index = textLayoutState.getOffsetForPosition(offset)
+ val newSelection = updateSelection(
+ // reset selection, otherwise a previous selection may be used
+ // as context for creating the next selection
+ textFieldCharSequence = TextFieldCharSequence(
+ textFieldState.text,
+ TextRange.Zero
+ ),
+ startOffset = index,
+ endOffset = index,
+ isStartHandle = false,
+ previousHandleOffset = -1, // there is no previous drag.
+ adjustment = SelectionAdjustment.Word,
+ )
+ editWithFilter {
+ selectCharsIn(newSelection)
+ }
+ }
+ )
+ }
+
private suspend fun PointerInputScope.detectCursorHandleDragGestures() {
// keep track of how visible bounds change while moving the cursor handle.
var startContentVisibleOffset: Offset = Offset.Zero
@@ -257,33 +446,31 @@
// mark start drag point
cursorDragStart = getAdjustedCoordinates(cursorRect.bottomCenter)
cursorDragDelta = Offset.Zero
- startContentVisibleOffset = textLayoutState.innerTextFieldCoordinates
- ?.takeIf { textLayoutState.innerTextFieldCoordinates?.isAttached == true }
+ startContentVisibleOffset = innerCoordinates
?.visibleBounds()
?.topLeft ?: Offset.Zero
isInTouchMode = true
- isCursorDragging = true
+ draggingHandle = Handle.Cursor
},
onDragEnd = {
// clear any dragging state
cursorDragStart = Offset.Unspecified
cursorDragDelta = Offset.Unspecified
startContentVisibleOffset = Offset.Zero
- isCursorDragging = false
+ draggingHandle = null
},
onDragCancel = {
// another gesture consumed the pointer, or composable is disposed
cursorDragStart = Offset.Unspecified
cursorDragDelta = Offset.Unspecified
startContentVisibleOffset = Offset.Zero
- isCursorDragging = false
+ draggingHandle = null
},
onDrag = onDrag@{ change, dragAmount ->
cursorDragDelta += dragAmount
- val currentContentVisibleOffset = textLayoutState.innerTextFieldCoordinates
+ val currentContentVisibleOffset = innerCoordinates
?.visibleBounds()
- ?.takeIf { textLayoutState.innerTextFieldCoordinates?.isAttached == true }
?.topLeft ?: startContentVisibleOffset
// "start position + total delta" is not enough to understand the current pointer
@@ -301,6 +488,7 @@
if (newSelection == textFieldState.text.selectionInChars) return@onDrag
change.consume()
+ // TODO: only perform haptic feedback if filter does not override the change
hapticFeedBack?.performHapticFeedback(HapticFeedbackType.TextHandleMove)
editWithFilter {
selectCharsIn(newSelection)
@@ -309,14 +497,62 @@
)
}
+ private suspend fun PointerInputScope.detectTextFieldLongPressAndAfterDrag(
+ requestFocus: () -> Unit
+ ) {
+ detectDragGesturesAfterLongPress(
+ onDragStart = onDragStart@{ dragStartOffset ->
+ logDebug { "onDragStart after longPress" }
+ // at the beginning of selection disable toolbar, re-evaluate visibility after
+ // drag gesture is finished
+ cursorHandleShowToolbar = false
+ requestFocus()
+
+ // Long Press at the blank area, the cursor should show up at the end of the line.
+ if (!textLayoutState.isPositionOnText(dragStartOffset)) {
+ val offset = textLayoutState.getOffsetForPosition(dragStartOffset)
+
+ hapticFeedBack?.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ editWithFilter {
+ selectCharsIn(TextRange(offset))
+ }
+ showCursorHandle = true
+ } else {
+ if (textFieldState.text.isEmpty()) return@onDragStart
+ val offset = textLayoutState.getOffsetForPosition(dragStartOffset)
+ val newSelection = updateSelection(
+ // reset selection, otherwise a previous selection may be used
+ // as context for creating the next selection
+ textFieldCharSequence = TextFieldCharSequence(
+ textFieldState.text,
+ TextRange.Zero
+ ),
+ startOffset = offset,
+ endOffset = offset,
+ isStartHandle = false,
+ previousHandleOffset = -1, // there is no previous drag.
+ adjustment = SelectionAdjustment.CharacterWithWordAccelerate,
+ )
+ editWithFilter {
+ selectCharsIn(newSelection)
+ }
+ showCursorHandle = false
+ }
+ },
+ onDragEnd = {},
+ onDragCancel = {},
+ onDrag = onDrag@{ _, _ -> }
+ )
+ }
+
private suspend fun observeTextChanges() {
snapshotFlow { textFieldState.text }
.distinctUntilChanged(TextFieldCharSequence::contentEquals)
// first value needs to be dropped because it cannot be compared to a prior value
.drop(1)
.collect {
- showHandles = false
- textToolbarVisible = false
+ showCursorHandle = false
+ cursorHandleShowToolbar = false
}
}
@@ -324,35 +560,44 @@
* Manages the visibility of text toolbar according to current state and received events from
* various sources.
*
- * - Tapping the cursor handle toggles the visibility of the toolbar [textToolbarVisible].
- * - Dragging the cursor handle temporarily hides the toolbar [isCursorDragging].
+ * - Tapping the cursor handle toggles the visibility of the toolbar [cursorHandleShowToolbar].
+ * - Dragging the cursor handle or selection handles temporarily hides the toolbar
+ * [draggingHandle].
* - Tapping somewhere on the textfield, whether it causes a cursor position change or not,
- * fully hides the toolbar [textToolbarVisible].
+ * fully hides the toolbar [cursorHandleShowToolbar].
* - Scrolling the textfield temporarily hides the toolbar [getContentRect].
* - When cursor leaves the visible bounds, text toolbar is temporarily hidden.
*/
private suspend fun observeTextToolbarVisibility() {
snapshotFlow {
- val toolbarVisibility = textToolbarVisible && // toolbar is requested
- !isCursorDragging && // not dragging the cursor handle
- isInTouchMode
+ val isCollapsed = textFieldState.text.selectionInChars.collapsed
+ val toolbarVisibility =
+ // either toolbar is requested specifically or selection is active
+ (cursorHandleShowToolbar || !isCollapsed) &&
+ draggingHandle == null && // not dragging any selection handles
+ isInTouchMode
// final visibility decision is made by contentRect visibility.
// if contentRect is not in visible bounds, just pass Rect.Zero to the observer so that
// it hides the toolbar. If Rect is successfully passed to the observer, toolbar will
- // be shown.
+ // be displayed.
if (!toolbarVisibility) {
Rect.Zero
} else {
// contentRect is calculated in root coordinates. VisibleBounds are in parent
// coordinates. Convert visibleBounds to root before checking the overlap.
- val visibleBounds = textLayoutState.innerTextFieldCoordinates?.visibleBounds()
+ val visibleBounds = innerCoordinates?.visibleBounds()
if (visibleBounds != null) {
val visibleBoundsTopLeftInRoot = textLayoutState
.innerTextFieldCoordinates
?.localToRoot(visibleBounds.topLeft)
val visibleBoundsInRoot = Rect(visibleBoundsTopLeftInRoot!!, visibleBounds.size)
- getContentRect().takeIf { visibleBoundsInRoot.overlaps(it) } ?: Rect.Zero
+ val contentRect = getContentRect().takeIf { visibleBoundsInRoot.overlaps(it) }
+ ?: Rect.Zero
+
+ // contentRect can be very wide if a huge text content is selected. Our toolbar
+ // should be aligned only to visible region.
+ contentRect.intersect(visibleBoundsInRoot)
} else {
Rect.Zero
}
@@ -383,19 +628,15 @@
// contentRect is defined in innerTextField coordinates, so it needs to be realigned to
// root container.
if (text.selectionInChars.collapsed) {
- val topLeft = textLayoutState.innerTextFieldCoordinates?.localToRoot(
- cursorRect.topLeft
- ) ?: Offset.Zero
+ val topLeft = innerCoordinates?.localToRoot(cursorRect.topLeft) ?: Offset.Zero
return Rect(topLeft, cursorRect.size)
}
val startOffset =
- textLayoutState.innerTextFieldCoordinates?.localToRoot(getHandlePosition(true))
- ?: Offset.Zero
+ innerCoordinates?.localToRoot(getHandlePosition(true)) ?: Offset.Zero
val endOffset =
- textLayoutState.innerTextFieldCoordinates?.localToRoot(getHandlePosition(false))
- ?: Offset.Zero
+ innerCoordinates?.localToRoot(getHandlePosition(false)) ?: Offset.Zero
val startTop =
- textLayoutState.innerTextFieldCoordinates?.localToRoot(
+ innerCoordinates?.localToRoot(
Offset(
0f,
textLayoutState.layoutResult?.getCursorRect(
@@ -404,7 +645,7 @@
)
)?.y ?: 0f
val endTop =
- textLayoutState.innerTextFieldCoordinates?.localToRoot(
+ innerCoordinates?.localToRoot(
Offset(
0f,
textLayoutState.layoutResult?.getCursorRect(
@@ -417,21 +658,48 @@
left = min(startOffset.x, endOffset.x),
right = max(startOffset.x, endOffset.x),
top = min(startTop, endTop),
- bottom = max(startOffset.y, endOffset.y) + with(density) { 25.dp.roundToPx() }
+ bottom = max(startOffset.y, endOffset.y)
)
}
+ private fun getSelectionHandleState(isStartHandle: Boolean): TextFieldHandleState {
+ val handle = if (isStartHandle) Handle.SelectionStart else Handle.SelectionEnd
+
+ val layoutResult = textLayoutState.layoutResult ?: return TextFieldHandleState.Hidden
+
+ val selection = textFieldState.text.selectionInChars
+
+ if (selection.collapsed) return TextFieldHandleState.Hidden
+
+ val position = getHandlePosition(isStartHandle)
+
+ val visible = draggingHandle == handle ||
+ (innerCoordinates
+ ?.visibleBounds()
+ ?.containsInclusive(position)
+ ?: false)
+
+ if (!visible) return TextFieldHandleState.Hidden
+
+ val directionOffset = if (isStartHandle) selection.start else max(selection.end - 1, 0)
+ val direction = layoutResult.getBidiRunDirection(directionOffset)
+ val handlesCrossed = selection.reversed
+ return TextFieldHandleState(true, position, direction, handlesCrossed)
+ }
+
private fun getHandlePosition(isStartHandle: Boolean): Offset {
+ val layoutResult = textLayoutState.layoutResult ?: return Offset.Zero
+ val selection = textFieldState.text.selectionInChars
val offset = if (isStartHandle) {
- textFieldState.text.selectionInChars.start
+ selection.start
} else {
- textFieldState.text.selectionInChars.end
+ selection.end
}
return getSelectionHandleCoordinates(
- textLayoutResult = textLayoutState.layoutResult!!,
+ textLayoutResult = layoutResult,
offset = offset,
isStart = isStartHandle,
- areHandlesCrossed = textFieldState.text.selectionInChars.reversed
+ areHandlesCrossed = selection.reversed
)
}
@@ -456,8 +724,6 @@
)
selectCharsIn(TextRange(selection.min + clipboardText.length))
}
-
- showHandles = false
// TODO(halilibo): undoManager force snapshot
}
@@ -474,7 +740,7 @@
val paste: (() -> Unit)? = if (editable && clipboardManager?.hasText() == true) {
{
paste()
- textToolbarVisible = false
+ cursorHandleShowToolbar = false
}
} else null
@@ -518,4 +784,60 @@
textToolbar?.hide()
}
}
-}
\ No newline at end of file
+
+ /**
+ * Update the text field's selection based on new offsets.
+ *
+ * @param textFieldCharSequence the current text editing state
+ * @param startOffset the start offset to use
+ * @param endOffset the end offset to use
+ * @param isStartHandle whether the start handle is being updated
+ * @param adjustment The selection adjustment to use
+ * @param allowPreviousSelectionCollapsed Allow a collapsed selection to be passed to selection
+ * adjustment. In most cases, a collapsed selection should be considered "no previous
+ * selection" for selection adjustment. However, in some cases - like starting a selection in
+ * end padding - a collapsed selection may be necessary context to avoid selection flickering.
+ */
+ private fun updateSelection(
+ textFieldCharSequence: TextFieldCharSequence,
+ startOffset: Int,
+ endOffset: Int,
+ isStartHandle: Boolean,
+ adjustment: SelectionAdjustment,
+ previousHandleOffset: Int,
+ allowPreviousSelectionCollapsed: Boolean = false,
+ ): TextRange {
+ val newSelection = getTextFieldSelection(
+ textLayoutResult = textLayoutState.layoutResult,
+ rawStartOffset = startOffset,
+ rawEndOffset = endOffset,
+ previousHandleOffset = previousHandleOffset,
+ previousSelection = textFieldCharSequence.selectionInChars
+ .takeIf { allowPreviousSelectionCollapsed || !it.collapsed },
+ isStartHandle = isStartHandle,
+ adjustment = adjustment,
+ )
+
+ if (newSelection == textFieldCharSequence.selectionInChars) return newSelection
+
+ val onlyChangeIsReversed =
+ newSelection.reversed != textFieldCharSequence.selectionInChars.reversed &&
+ newSelection.run { TextRange(end, start) } == textFieldCharSequence.selectionInChars
+
+ // don't haptic if we are using a mouse or if we aren't moving the selection bounds
+ if (isInTouchMode && !onlyChangeIsReversed) {
+ hapticFeedBack?.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ }
+
+ return newSelection
+ }
+}
+
+private val DEBUG = true
+private val DEBUG_TAG = "TextFieldSelectionState"
+
+private fun logDebug(text: () -> String) {
+ if (DEBUG) {
+ println("$DEBUG_TAG: ${text()}")
+ }
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/BasicContextMenuRepresentation.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/BasicContextMenuRepresentation.desktop.kt
index 7b68366..5b16fcc 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/BasicContextMenuRepresentation.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/BasicContextMenuRepresentation.desktop.kt
@@ -141,4 +141,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt
index 2a7fa89..814e12e 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/ContextMenuProvider.desktop.kt
@@ -256,4 +256,4 @@
val LocalContextMenuRepresentation:
ProvidableCompositionLocal<ContextMenuRepresentation> = staticCompositionLocalOf {
LightDefaultContextMenuRepresentation
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopPlatform.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopPlatform.desktop.kt
index 409dae1..98ad375 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopPlatform.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/DesktopPlatform.desktop.kt
@@ -36,4 +36,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopScrollable.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopScrollable.desktop.kt
index 6e08d4e..ba28512 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopScrollable.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/gestures/DesktopScrollable.desktop.kt
@@ -104,4 +104,4 @@
(mouseEvent as? MouseWheelEvent)?.scrollType == MouseWheelEvent.WHEEL_BLOCK_SCROLL
private val PointerEvent.totalScrollDelta
- get() = this.changes.fastFold(Offset.Zero) { acc, c -> acc + c.scrollDelta }
\ No newline at end of file
+ get() = this.changes.fastFold(Offset.Zero) { acc, c -> acc + c.scrollDelta }
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.desktop.kt
index 736956c..7c4517f 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.desktop.kt
@@ -26,4 +26,4 @@
BringIntoViewParent { _, _ ->
// TODO(b/203204124): Implement this if desktop has a
// concept similar to Android's View.requestRectangleOnScreen.
- }
\ No newline at end of file
+ }
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/BasicText.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/BasicText.desktop.kt
index d6639e8..447ee5e 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/BasicText.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/BasicText.desktop.kt
@@ -21,4 +21,4 @@
internal actual fun Modifier.textPointerHoverIcon(
selectionRegistrar: SelectionRegistrar?
-): Modifier = this
\ No newline at end of file
+): Modifier = this
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/ContextMenu.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/ContextMenu.desktop.kt
index ba6a368..f6429d4 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/ContextMenu.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/ContextMenu.desktop.kt
@@ -121,4 +121,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/DesktopCursorHandle.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/DesktopCursorHandle.desktop.kt
index cc0556f..e291749 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/DesktopCursorHandle.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/DesktopCursorHandle.desktop.kt
@@ -28,4 +28,4 @@
content: @Composable (() -> Unit)?
) {
/* Not implemented. */
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.desktop.kt
index 1461736..a0b53a0 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyEventHelpers.desktop.kt
@@ -21,4 +21,4 @@
internal actual fun KeyEvent.cancelsTextSelection(): Boolean = false
-internal actual fun showCharacterPalette() = orderEmojiAndSymbolsPopup()
\ No newline at end of file
+internal actual fun showCharacterPalette() = orderEmojiAndSymbolsPopup()
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/StringHelpers.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/StringHelpers.desktop.kt
index 025cbf2..43c84e4 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/StringHelpers.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/StringHelpers.desktop.kt
@@ -28,4 +28,4 @@
val it = BreakIterator.makeCharacterInstance()
it.setText(this)
return it.following(index)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.desktop.kt
index b68c5b8..5fb4b7c 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldFocusModifier.desktop.kt
@@ -30,4 +30,4 @@
internal actual fun Modifier.interceptDPadAndMoveFocus(
state: TextFieldState,
focusManager: FocusManager
-): Modifier = this
\ No newline at end of file
+): Modifier = this
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldKeyInput.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldKeyInput.desktop.kt
index 7e88a87..63cc81c 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldKeyInput.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextFieldKeyInput.desktop.kt
@@ -28,4 +28,4 @@
actual val KeyEvent.isTypedEvent: Boolean
get() = nativeKeyEvent.id == java.awt.event.KeyEvent.KEY_TYPED &&
- nativeKeyEvent.keyChar.isPrintable()
\ No newline at end of file
+ nativeKeyEvent.keyChar.isPrintable()
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.desktop.kt
index 42fc945..07d44db 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.desktop.kt
@@ -20,4 +20,4 @@
import java.awt.Cursor
internal actual val textPointerIcon: PointerIcon =
- PointerIcon(Cursor(Cursor.TEXT_CURSOR))
\ No newline at end of file
+ PointerIcon(Cursor(Cursor.TEXT_CURSOR))
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelectionHandles.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelectionHandles.desktop.kt
index aa54121..31eacb6 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelectionHandles.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/selection/DesktopSelectionHandles.desktop.kt
@@ -31,4 +31,4 @@
content: (@Composable () -> Unit)?
) {
// TODO
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/DesktopTextInputSession.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/DesktopTextInputSession.desktop.kt
index 8c3c0b7..d0a9509 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/DesktopTextInputSession.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/DesktopTextInputSession.desktop.kt
@@ -37,4 +37,4 @@
): Nothing {
// TODO(b/267235947) Wire up desktop.
awaitCancellation()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.desktop.kt
index c5ed40a..2e2dd1c 100644
--- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.desktop.kt
+++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArray.desktop.kt
@@ -56,4 +56,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
index 7edf141..0d918c1 100644
--- a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
+++ b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
@@ -583,4 +583,4 @@
@OptIn(ExperimentalComposeUiApi::class)
private val PointerEvent.totalScrollDelta
- get() = this.changes.fastFold(Offset.Zero) { acc, c -> acc + c.scrollDelta }
\ No newline at end of file
+ get() = this.changes.fastFold(Offset.Zero) { acc, c -> acc + c.scrollDelta }
diff --git a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/gestures/DesktopScrollableTest.kt b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/gestures/DesktopScrollableTest.kt
index b9b7073..deb940b 100644
--- a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/gestures/DesktopScrollableTest.kt
+++ b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/gestures/DesktopScrollableTest.kt
@@ -237,4 +237,4 @@
return delta
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/DesktopTextFieldSelectionManagerTest.kt b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/DesktopTextFieldSelectionManagerTest.kt
index 72b92ca..4baada6 100644
--- a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/DesktopTextFieldSelectionManagerTest.kt
+++ b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/DesktopTextFieldSelectionManagerTest.kt
@@ -167,4 +167,4 @@
verify(clipboardManager, times(1)).setText(AnnotatedString("Hello Wo"))
assertThat(value.selection).isEqualTo(TextRange(0, 8))
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
index 1de6bae..3f52c3b 100644
--- a/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
+++ b/compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
@@ -38,4 +38,4 @@
val result = complexString.findPrecedingBreak(7)
assertThat(result).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/ActualJvm.kt b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/ActualJvm.kt
index ae5c0c1..151df35 100644
--- a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/ActualJvm.kt
+++ b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/ActualJvm.kt
@@ -20,4 +20,4 @@
internal actual typealias AtomicReference<V> = java.util.concurrent.atomic.AtomicReference<V>
-internal actual typealias AtomicLong = java.util.concurrent.atomic.AtomicLong
\ No newline at end of file
+internal actual typealias AtomicLong = java.util.concurrent.atomic.AtomicLong
diff --git a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.jvm.kt
index 0f92532..e7f3200c 100644
--- a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.foundation.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/StringHelpers.jvm.kt b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/StringHelpers.jvm.kt
index 410519b..5d5b02d 100644
--- a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/StringHelpers.jvm.kt
+++ b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/StringHelpers.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.foundation.text
internal actual fun StringBuilder.appendCodePointX(codePoint: Int): StringBuilder =
- this.appendCodePoint(codePoint)
\ No newline at end of file
+ this.appendCodePoint(codePoint)
diff --git a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/UndoManager.jvm.kt b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/UndoManager.jvm.kt
index 973b6c9a..c68c0ec 100644
--- a/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/UndoManager.jvm.kt
+++ b/compose/foundation/foundation/src/jvmMain/kotlin/androidx/compose/foundation/text/UndoManager.jvm.kt
@@ -16,4 +16,4 @@
package androidx.compose.foundation.text
-internal actual fun timeNowMillis(): Long = System.currentTimeMillis()
\ No newline at end of file
+internal actual fun timeNowMillis(): Long = System.currentTimeMillis()
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueueTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueueTest.kt
index 1839648..40b0f29 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueueTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueueTest.kt
@@ -286,4 +286,4 @@
add(it)
}
}.asReversed()
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DraggableAnchorsTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DraggableAnchorsTest.kt
index cc2bba3..cef8f48 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DraggableAnchorsTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/DraggableAnchorsTest.kt
@@ -98,4 +98,4 @@
}
}
-private enum class TestValue { A, B, C }
\ No newline at end of file
+private enum class TestValue { A, B, C }
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationStateTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationStateTest.kt
index 893b62c..7c21147 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationStateTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationStateTest.kt
@@ -163,4 +163,4 @@
frame += 16_000_000L
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/BasicTextPaparazziTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/BasicTextPaparazziTest.kt
index 90c62ed..c65c711 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/BasicTextPaparazziTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/BasicTextPaparazziTest.kt
@@ -173,4 +173,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldBringIntoViewTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldBringIntoViewTest.kt
index e80c61f..7697ed4 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldBringIntoViewTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldBringIntoViewTest.kt
@@ -270,4 +270,4 @@
override fun get(alignmentLine: AlignmentLine): Int = 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
index f38fa30..e2096a6 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
@@ -268,4 +268,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldStateTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldStateTest.kt
index c8ab92b..d43d54d 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldStateTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldStateTest.kt
@@ -42,4 +42,4 @@
}
Truth.assertThat(subject.layoutResult).isSameInstanceAs(null)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/UndoManagerTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/UndoManagerTest.kt
index d7d7963..55a7818 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/UndoManagerTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/UndoManagerTest.kt
@@ -101,4 +101,4 @@
TextFieldValue("hello")
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/ValidatingOffsetMappingTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/ValidatingOffsetMappingTest.kt
index b0cad44..a08bed0 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/ValidatingOffsetMappingTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/ValidatingOffsetMappingTest.kt
@@ -131,4 +131,4 @@
"1 -> $invalidIndex is not in range of original text [0, ${text.length}]"
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/InlineAnswer.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/InlineAnswer.kt
index a7a24f8..949e81e 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/InlineAnswer.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/InlineAnswer.kt
@@ -28,4 +28,4 @@
infix fun <T> OngoingStubbing<T>.doAnswer(offset: Offset): OngoingStubbing<T> {
return thenAnswer(LongAnswer(packFloats(offset.x, offset.y)))
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/MockCoordinates.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/MockCoordinates.kt
index ec961c2..027739d 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/MockCoordinates.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/MockCoordinates.kt
@@ -77,4 +77,4 @@
): Rect = Rect.Zero
override fun get(alignmentLine: AlignmentLine): Int = 0
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustmentTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustmentTest.kt
index 52ffbd9..9c6649e 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustmentTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionAdjustmentTest.kt
@@ -1510,4 +1510,4 @@
size = IntSize.Zero
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerDragTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerDragTest.kt
index 9bcffd9..d33f417 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerDragTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerDragTest.kt
@@ -306,4 +306,4 @@
textToReturn = null
lastVisibleOffsetToReturn = 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerTest.kt
index 80bc00d..7e6d97e 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/SelectionManagerTest.kt
@@ -844,4 +844,4 @@
return argThat { any: Any? ->
any == null || any is Long || any is Offset
} as Offset? ?: Offset.Zero
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
index 333c95a..c17242c 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/selection/StringHelpersTest.kt
@@ -48,4 +48,4 @@
assertThat(string.findParagraphEnd(string.indexOf("c"))).isEqualTo(string.length)
assertThat(string.findParagraphEnd(string.indexOf("d"))).isEqualTo(string.length)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextEditFilterTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextEditFilterTest.kt
index b6fd7c1..d5c1c74 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextEditFilterTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextEditFilterTest.kt
@@ -84,4 +84,4 @@
assertThat(chain1).isNotEqualTo(chain2)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldBufferTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldBufferTest.kt
index 9f7dc54..8f49834 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldBufferTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldBufferTest.kt
@@ -355,4 +355,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequenceTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequenceTest.kt
index aa490d8..ed73ebc 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequenceTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldCharSequenceTest.kt
@@ -118,4 +118,4 @@
private fun TextEditState(text: String, composition: TextRange) =
TextFieldCharSequence(text, selection = TextRange.Zero, composition = composition)
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateSaverTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateSaverTest.kt
index 4325a6a..308918e 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateSaverTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateSaverTest.kt
@@ -42,4 +42,4 @@
private object TestSaverScope : SaverScope {
override fun canBeSaved(value: Any): Boolean = true
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateTest.kt
index 15de948..a2a789b 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/TextFieldStateTest.kt
@@ -511,4 +511,4 @@
globalWriteObserverHandle.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTrackerTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTrackerTest.kt
index b53c2b7..5c08053 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTrackerTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ChangeTrackerTest.kt
@@ -205,4 +205,4 @@
override fun toString(): String = builder.toString()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/CommitTextCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/CommitTextCommandTest.kt
index 08dd724..543a242 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/CommitTextCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/CommitTextCommandTest.kt
@@ -182,4 +182,4 @@
assertThat(eb.cursor).isEqualTo(6)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextCommandTest.kt
index 368b1d0..cb26cf1 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextCommandTest.kt
@@ -235,4 +235,4 @@
}
assertThat(error).hasMessageThat().contains("-42")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextInCodePointsCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextInCodePointsCommandTest.kt
index 14ee7f5..a8fbb15 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextInCodePointsCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/DeleteSurroundingTextInCodePointsCommandTest.kt
@@ -246,4 +246,4 @@
}
assertThat(error).hasMessageThat().contains("-42")
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessorTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessorTest.kt
index cb1b9e8..a8d8db8 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessorTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditProcessorTest.kt
@@ -495,4 +495,4 @@
) {
update(editCommand.toList(), filter)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditingBufferTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditingBufferTest.kt
index 90d5cb5..905d35f3 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditingBufferTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/EditingBufferTest.kt
@@ -433,4 +433,4 @@
assertThat(eb.cursor).isEqualTo(0)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/FinishComposingTextCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/FinishComposingTextCommandTest.kt
index fa67d4c..67f4bf3 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/FinishComposingTextCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/FinishComposingTextCommandTest.kt
@@ -49,4 +49,4 @@
assertThat(eb.selectionEnd).isEqualTo(4)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/GapBufferTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/GapBufferTest.kt
index b54e5ad..1c858bd 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/GapBufferTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/GapBufferTest.kt
@@ -682,4 +682,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingRegionCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingRegionCommandTest.kt
index e78f64f..79eaca0 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingRegionCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingRegionCommandTest.kt
@@ -127,4 +127,4 @@
assertThat(eb.compositionStart).isEqualTo(0)
assertThat(eb.compositionEnd).isEqualTo(5)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingTextCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingTextCommandTest.kt
index 98d388e..a684ff3 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingTextCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetComposingTextCommandTest.kt
@@ -202,4 +202,4 @@
assertThat(eb.compositionStart).isEqualTo(5)
assertThat(eb.compositionEnd).isEqualTo(6)
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetSelectionCommandTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetSelectionCommandTest.kt
index fb6877d..6a97ac4 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetSelectionCommandTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/SetSelectionCommandTest.kt
@@ -122,4 +122,4 @@
assertThat(eb.selectionEnd).isEqualTo(5)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArrayTest.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArrayTest.kt
index b80206f..46be131 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArrayTest.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/ToCharArrayTest.kt
@@ -95,4 +95,4 @@
}
private class CustomCharSequence(text: String) : CharSequence by text
-}
\ No newline at end of file
+}
diff --git a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/matchers/EditBufferSubject.kt b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/matchers/EditBufferSubject.kt
index 1c751811..d0ff952 100644
--- a/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/matchers/EditBufferSubject.kt
+++ b/compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text2/input/internal/matchers/EditBufferSubject.kt
@@ -71,4 +71,4 @@
assertThat(subject[i]).isEqualTo(expected[i])
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt
index 140b281..c22756c 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoApp.kt
@@ -299,4 +299,4 @@
.wrapContentHeight(Alignment.CenterVertically),
contentAlignment = Alignment.CenterStart
) { content() }
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoSettingsActivity.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoSettingsActivity.kt
index 2bb8bd5..87e5a57 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoSettingsActivity.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/DemoSettingsActivity.kt
@@ -64,4 +64,4 @@
preferenceScreen = screen
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/Demos.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/Demos.kt
index 1b24f7e..a52e2ef 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/Demos.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/Demos.kt
@@ -47,4 +47,4 @@
AccessibilityDemos,
PerformanceDemos
)
-)
\ No newline at end of file
+)
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DecorFitsSystemWindowsSetting.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DecorFitsSystemWindowsSetting.kt
index 5a6e3ae..5d89b99 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DecorFitsSystemWindowsSetting.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DecorFitsSystemWindowsSetting.kt
@@ -71,4 +71,4 @@
setDecorFitsSystemWindows(window, true)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DemoSetting.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DemoSetting.kt
index 9fd88fb..8534334 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DemoSetting.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DemoSetting.kt
@@ -25,4 +25,4 @@
*/
interface DemoSetting<T> {
fun createPreference(context: Context): Preference
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DynamicThemeSetting.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DynamicThemeSetting.kt
index c897d86..abd57e7 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DynamicThemeSetting.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/DynamicThemeSetting.kt
@@ -37,4 +37,4 @@
fun asState() = preferenceAsState(IsDynamicThemeOnKey) {
getBoolean(IsDynamicThemeOnKey, IsDynamicThemingAvailable)
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/LayoutDirectionSetting.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/LayoutDirectionSetting.kt
index 6805e218..5210632 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/LayoutDirectionSetting.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/LayoutDirectionSetting.kt
@@ -47,4 +47,4 @@
val value = getString(Key, Ltr.name) ?: Ltr.name
LayoutDirection.valueOf(value)
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/PreferenceAsState.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/PreferenceAsState.kt
index 1da4f3d..12b0a9d 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/PreferenceAsState.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/PreferenceAsState.kt
@@ -77,4 +77,4 @@
return@key value
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/SoftInputModeSetting.kt b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/SoftInputModeSetting.kt
index 2309183..da20cd1 100644
--- a/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/SoftInputModeSetting.kt
+++ b/compose/integration-tests/demos/src/main/java/androidx/compose/integration/demos/settings/SoftInputModeSetting.kt
@@ -96,4 +96,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
index 1f5a4ef..369ff5f 100644
--- a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
+++ b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
@@ -178,7 +178,7 @@
CustomView(context).apply {
// Sets up listeners for View -> Compose communication
myView.setOnClickListener {
- selectedItem.value = 1
+ selectedItem.intValue = 1
}
}
},
@@ -189,7 +189,7 @@
// As selectedItem is read here, AndroidView will recompose
// whenever the state changes
// Example of Compose -> View communication
- view.coordinator.selectedItem = selectedItem.value
+ view.coordinator.selectedItem = selectedItem.intValue
}
)
}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/AndroidViewListActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/AndroidViewListActivity.kt
index 7524bc4..39dace586 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/AndroidViewListActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/AndroidViewListActivity.kt
@@ -69,4 +69,4 @@
) { view ->
view.findViewById<AppCompatTextView>(R.id.content).text = entry.contents
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/BaselineProfileActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/BaselineProfileActivity.kt
index a94f36b..2178cd2 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/BaselineProfileActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/BaselineProfileActivity.kt
@@ -99,4 +99,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyVerticalGridActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyVerticalGridActivity.kt
index 9f0da27..c201d05 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyVerticalGridActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/LazyVerticalGridActivity.kt
@@ -76,4 +76,4 @@
modifier = Modifier.padding(16.dp)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/PagerAsCarouselActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/PagerAsCarouselActivity.kt
index df252e7..6bfa566 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/PagerAsCarouselActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/PagerAsCarouselActivity.kt
@@ -82,4 +82,4 @@
) {
Text(text = index.toString(), color = Color.White)
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewAsCarouselActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewAsCarouselActivity.kt
index 3766e35..400ed7c 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewAsCarouselActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewAsCarouselActivity.kt
@@ -70,4 +70,4 @@
fun bind(item: String) {
itemView.findViewById<TextView>(R.id.view_carousel_item).text = item
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewListActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewListActivity.kt
index 693b7ac..0c141f2 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewListActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/RecyclerViewListActivity.kt
@@ -115,4 +115,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt
index b187a01..9039903 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/TrivialStartupActivity.kt
@@ -29,4 +29,4 @@
Text("Compose Macrobenchmark Target")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/ViewPagerActivity.kt b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/ViewPagerActivity.kt
index 01ac67f..65a7d30 100644
--- a/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/ViewPagerActivity.kt
+++ b/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/compose/integration/macrobenchmark/target/ViewPagerActivity.kt
@@ -61,4 +61,4 @@
fun bind(item: String) {
itemView.findViewById<TextView>(R.id.view_pager_item).text = item
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/AndroidViewPagerBenchmark.kt b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/AndroidViewPagerBenchmark.kt
index 916b3cf..e81532f 100644
--- a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/AndroidViewPagerBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/AndroidViewPagerBenchmark.kt
@@ -86,4 +86,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerAsCarouselBenchmark.kt b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerAsCarouselBenchmark.kt
index f28d5ac..becf364 100644
--- a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerAsCarouselBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerAsCarouselBenchmark.kt
@@ -97,4 +97,4 @@
onSwipeFinished()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerBenchmark.kt b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerBenchmark.kt
index cca2bba..2b74c72 100644
--- a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/PagerBenchmark.kt
@@ -84,4 +84,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/RecyclerViewAsCarouselBenchmark.kt b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/RecyclerViewAsCarouselBenchmark.kt
index ac953f6..0316577 100644
--- a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/RecyclerViewAsCarouselBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/RecyclerViewAsCarouselBenchmark.kt
@@ -67,4 +67,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
index e76e719..79e8618 100644
--- a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
+++ b/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
@@ -70,4 +70,4 @@
@JvmStatic
fun parameters() = createStartupCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ExceptionMessageDetector.kt b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ExceptionMessageDetector.kt
index 232a309..8e1b11e 100644
--- a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ExceptionMessageDetector.kt
+++ b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ExceptionMessageDetector.kt
@@ -79,4 +79,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ListIteratorDetector.kt b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ListIteratorDetector.kt
index 219efcf..b3a2280 100644
--- a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ListIteratorDetector.kt
+++ b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/ListIteratorDetector.kt
@@ -146,4 +146,4 @@
private val KotlinCollectionsPackageName = Package("kotlin.collections")
private val KotlinIterable = Name(KotlinCollectionsPackageName, "Iterable")
-private val KotlinIterableClassifier = KmClassifier.Class(KotlinIterable.kmClassName)
\ No newline at end of file
+private val KotlinIterableClassifier = KmClassifier.Class(KotlinIterable.kmClassName)
diff --git a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/PlatformImportInCommonModuleDetector.kt b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/PlatformImportInCommonModuleDetector.kt
index 0e73ca6..856bc57 100644
--- a/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/PlatformImportInCommonModuleDetector.kt
+++ b/compose/lint/internal-lint-checks/src/main/java/androidx/compose/lint/PlatformImportInCommonModuleDetector.kt
@@ -87,4 +87,4 @@
"android"
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/lint/internal-lint-checks/src/test/java/androidx/compose/lint/ExceptionMessageDetectorTest.kt b/compose/lint/internal-lint-checks/src/test/java/androidx/compose/lint/ExceptionMessageDetectorTest.kt
index cf2d8176..5b6b6a8 100644
--- a/compose/lint/internal-lint-checks/src/test/java/androidx/compose/lint/ExceptionMessageDetectorTest.kt
+++ b/compose/lint/internal-lint-checks/src/test/java/androidx/compose/lint/ExceptionMessageDetectorTest.kt
@@ -570,4 +570,4 @@
.run()
.expectClean()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material-icons-core/build.gradle b/compose/material/material-icons-core/build.gradle
index dc8b062..fe670b2 100644
--- a/compose/material/material-icons-core/build.gradle
+++ b/compose/material/material-icons-core/build.gradle
@@ -100,7 +100,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/compose/material/material-icons-extended/build.gradle b/compose/material/material-icons-extended/build.gradle
index 89ea04b..ddff520 100644
--- a/compose/material/material-icons-extended/build.gradle
+++ b/compose/material/material-icons-extended/build.gradle
@@ -119,7 +119,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/compose/material/material-icons-extended/src/androidAndroidTest/kotlin/androidx/compose/material/icons/BaseIconComparisonTest.kt b/compose/material/material-icons-extended/src/androidAndroidTest/kotlin/androidx/compose/material/icons/BaseIconComparisonTest.kt
index 08acde0..0f4eae7d 100644
--- a/compose/material/material-icons-extended/src/androidAndroidTest/kotlin/androidx/compose/material/icons/BaseIconComparisonTest.kt
+++ b/compose/material/material-icons-extended/src/androidAndroidTest/kotlin/androidx/compose/material/icons/BaseIconComparisonTest.kt
@@ -267,4 +267,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material-lint/src/main/java/androidx/compose/material/lint/ScaffoldPaddingDetector.kt b/compose/material/material-lint/src/main/java/androidx/compose/material/lint/ScaffoldPaddingDetector.kt
index 870a673..69b94b4 100644
--- a/compose/material/material-lint/src/main/java/androidx/compose/material/lint/ScaffoldPaddingDetector.kt
+++ b/compose/material/material-lint/src/main/java/androidx/compose/material/lint/ScaffoldPaddingDetector.kt
@@ -86,4 +86,4 @@
}
}
-private val Scaffold = Name(Material.PackageName, "Scaffold")
\ No newline at end of file
+private val Scaffold = Name(Material.PackageName, "Scaffold")
diff --git a/compose/material/material-ripple/benchmark/build.gradle b/compose/material/material-ripple/benchmark/build.gradle
new file mode 100644
index 0000000..ef1a72f
--- /dev/null
+++ b/compose/material/material-ripple/benchmark/build.gradle
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import androidx.build.LibraryType
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.library")
+ id("AndroidXComposePlugin")
+ id("org.jetbrains.kotlin.android")
+ id("androidx.benchmark")
+}
+
+dependencies {
+ androidTestImplementation project(":benchmark:benchmark-junit4")
+ androidTestImplementation project(":compose:benchmark-utils")
+ androidTestImplementation project(":compose:foundation:foundation")
+ androidTestImplementation project(":compose:material:material-ripple")
+ androidTestImplementation project(":compose:runtime:runtime")
+ androidTestImplementation(libs.testRules)
+ androidTestImplementation(libs.junit)
+ androidTestImplementation(libs.kotlinStdlib)
+ androidTestImplementation(libs.kotlinReflect)
+ androidTestImplementation(libs.kotlinTestCommon)
+ androidTestImplementation(libs.truth)
+}
+
+android {
+ namespace "androidx.compose.material.ripple.benchmark"
+ defaultConfig {
+ // must be one of: 'None', 'StackSampling', or 'MethodTracing'
+ testInstrumentationRunnerArguments["androidx.benchmark.profiling.mode"]= 'None'
+ }
+}
+
+androidx {
+ type = LibraryType.INTERNAL_TEST_LIBRARY
+}
diff --git a/compose/material/material-ripple/benchmark/src/androidTest/AndroidManifest.xml b/compose/material/material-ripple/benchmark/src/androidTest/AndroidManifest.xml
new file mode 100644
index 0000000..9face20
--- /dev/null
+++ b/compose/material/material-ripple/benchmark/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <application>
+ <!-- enable profiling by shell for non-intrusive profiling tools -->
+ <profileable android:shell="true"/>
+ </application>
+</manifest>
diff --git a/compose/material/material-ripple/benchmark/src/androidTest/java/androidx/compose/material/ripple/benchmark/RippleBenchmark.kt b/compose/material/material-ripple/benchmark/src/androidTest/java/androidx/compose/material/ripple/benchmark/RippleBenchmark.kt
new file mode 100644
index 0000000..21647ce
--- /dev/null
+++ b/compose/material/material-ripple/benchmark/src/androidTest/java/androidx/compose/material/ripple/benchmark/RippleBenchmark.kt
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.ripple.benchmark
+
+import androidx.compose.foundation.Indication
+import androidx.compose.foundation.interaction.HoverInteraction
+import androidx.compose.foundation.interaction.Interaction
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.interaction.PressInteraction
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.ripple.rememberRipple
+import androidx.compose.runtime.Composable
+import androidx.compose.testutils.ComposeBenchmarkScope
+import androidx.compose.testutils.LayeredComposeTestCase
+import androidx.compose.testutils.benchmark.ComposeBenchmarkRule
+import androidx.compose.testutils.benchmark.benchmarkFirstCompose
+import androidx.compose.testutils.doFramesUntilNoChangesPending
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.drawWithContent
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.platform.ViewRootForTest
+import androidx.compose.ui.unit.dp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.LargeTest
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.runBlocking
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * Benchmark for Android ripple performance
+ */
+@LargeTest
+@RunWith(AndroidJUnit4::class)
+class RippleBenchmark {
+
+ @get:Rule
+ val benchmarkRule = ComposeBenchmarkRule()
+
+ /**
+ * Composition cost of rememberRipple() - this is just a remembered factory object so it
+ * doesn't do much.
+ */
+ @Test
+ fun rememberRippleFirstComposition() {
+ benchmarkRule.benchmarkFirstCompose {
+ object : LayeredComposeTestCase() {
+ @Composable
+ override fun MeasuredContent() {
+ rememberRipple()
+ }
+ }
+ }
+ }
+
+ /**
+ * Composition cost of creating a ripple instance - this is what actually allocates
+ * ripple-related machinery and is later responsible for drawing ripples.
+ */
+ @Test
+ fun initialRippleRememberUpdatedInstanceFirstComposition() {
+ benchmarkRule.benchmarkFirstCompose {
+ object : LayeredComposeTestCase() {
+ val interactionSource = MutableInteractionSource()
+ var ripple: Indication? = null
+
+ @Composable
+ override fun ContentWrappers(content: @Composable () -> Unit) {
+ // Create a ripple from outside the measured content
+ ripple = rememberRipple()
+ content()
+ }
+
+ @Composable
+ override fun MeasuredContent() {
+ ripple!!.rememberUpdatedInstance(interactionSource = interactionSource)
+ }
+ }
+ }
+ }
+
+ /**
+ * Composition cost of creating a second ripple instance, after one has already been created,
+ * discounting any first-ripple performance costs.
+ */
+ @Test
+ fun additionalRippleRememberUpdatedInstanceFirstComposition() {
+ benchmarkRule.benchmarkFirstCompose {
+ object : LayeredComposeTestCase() {
+ val interactionSource = MutableInteractionSource()
+ var ripple: Indication? = null
+
+ @Composable
+ override fun ContentWrappers(content: @Composable () -> Unit) {
+ // Create a ripple from outside the measured content
+ ripple = rememberRipple()
+ // Create another ripple and call rememberUpdatedInstance()
+ rememberRipple().rememberUpdatedInstance(interactionSource = interactionSource)
+ content()
+ }
+
+ @Composable
+ override fun MeasuredContent() {
+ ripple!!.rememberUpdatedInstance(interactionSource = interactionSource)
+ }
+ }
+ }
+ }
+
+ /**
+ * Cost of emitting a [PressInteraction] for the first time (so including any work done as part
+ * of collecting the interaction and creating a ripple) and then rendering a frame after that.
+ *
+ * [PressInteraction] tests the RippleDrawable codepath - other [Interaction]s use a simplified
+ * common-code StateLayer.
+ */
+ @Test
+ fun initialEmitPressInteraction() {
+ val press = PressInteraction.Press(Offset.Zero)
+
+ with(benchmarkRule) {
+ runBenchmarkFor({ RippleInteractionTestCase() }) {
+ measureRepeated {
+ runWithTimingDisabled {
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ }
+
+ runBlocking { getTestCase().emitInteraction(press) }
+ doFrame()
+
+ // We explicitly tear down after each iteration so we incur costs for anything
+ // cached at the view hierarchy level, in this case the RippleContainer.
+ runWithTimingDisabled {
+ disposeContent()
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Cost of emitting another [PressInteraction] and rendering a frame after we have already
+ * emitted one.
+ */
+ @Test
+ fun additionalEmitPressInteraction() {
+ val press1 = PressInteraction.Press(Offset.Zero)
+ val release1 = PressInteraction.Release(press1)
+ val press2 = PressInteraction.Press(Offset.Zero)
+
+ with(benchmarkRule) {
+ runBenchmarkFor({ RippleInteractionTestCase() }) {
+ measureRepeated {
+ runWithTimingDisabled {
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ runBlocking {
+ getTestCase().emitInteraction(press1)
+ // Account for RippleHostView#setRippleState logic that will delay
+ // an exit that happens on the same frame as an enter which will cause
+ // a callback to be posted, breaking synchronization in this case /
+ // causing a more costly and rare codepath.
+ delay(100)
+ getTestCase().emitInteraction(release1)
+ }
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ }
+
+ runBlocking { getTestCase().emitInteraction(press2) }
+ doFrame()
+
+ runWithTimingDisabled {
+ disposeContent()
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Cost of emitting a [HoverInteraction] for the first time and then rendering a frame after
+ * that.
+ *
+ * [HoverInteraction] ends up being drawn by a common-code StateLayer, as with focus and drag -
+ * so there is no need to test those cases separately.
+ */
+ @Test
+ fun initialEmitHoverInteraction() {
+ val hover = HoverInteraction.Enter()
+
+ with(benchmarkRule) {
+ runBenchmarkFor({ RippleInteractionTestCase() }) {
+ measureRepeated {
+ runWithTimingDisabled {
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ }
+
+ runBlocking { getTestCase().emitInteraction(hover) }
+ doFrame()
+
+ // We explicitly tear down after each iteration so we incur costs for anything
+ // cached at the view hierarchy level. There shouldn't be anything cached in
+ // this way for the hover case, but we do it to be consistent with the press
+ // case.
+ runWithTimingDisabled {
+ disposeContent()
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Cost of emitting another [HoverInteraction] and rendering a frame after we have already
+ * emitted one.
+ */
+ @Test
+ fun additionalEmitHoverInteraction() {
+ val hover1 = HoverInteraction.Enter()
+ val unhover1 = HoverInteraction.Exit(hover1)
+ val hover2 = HoverInteraction.Enter()
+
+ with(benchmarkRule) {
+ runBenchmarkFor({ RippleInteractionTestCase() }) {
+ measureRepeated {
+ runWithTimingDisabled {
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ runBlocking {
+ getTestCase().emitInteraction(hover1)
+ getTestCase().emitInteraction(unhover1)
+ }
+ doFramesUntilNoChangesMeasureLayoutOrDrawPending()
+ }
+
+ runBlocking { getTestCase().emitInteraction(hover2) }
+ doFrame()
+
+ runWithTimingDisabled {
+ disposeContent()
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Test case for a manually-drawn ripple (no [androidx.compose.foundation.indication]) that allows
+ * emitting [Interaction]s with [emitInteraction].
+ */
+private class RippleInteractionTestCase : LayeredComposeTestCase() {
+ private val interactionSource = MutableInteractionSource()
+
+ @Composable
+ override fun MeasuredContent() {
+ val instance = rememberRipple().rememberUpdatedInstance(interactionSource)
+
+ Box(
+ Modifier
+ .size(100.dp)
+ .drawWithContent {
+ with(instance) {
+ drawIndication()
+ }
+ })
+ }
+
+ suspend fun emitInteraction(interaction: Interaction) {
+ interactionSource.emit(interaction)
+ }
+}
+
+/**
+ * [doFramesUntilNoChangesPending] but also accounts for pending measure or layout passes, and
+ * whether the view itself is dirty
+ */
+private fun ComposeBenchmarkScope<*>.doFramesUntilNoChangesMeasureLayoutOrDrawPending() {
+ val maxAmountOfFrames = 10
+ var framesDone = 0
+ while (framesDone < maxAmountOfFrames) {
+ doFrame()
+ framesDone++
+
+ fun hasPending(): Boolean {
+ var hasPending = hasPendingChanges()
+ val hostView = getHostView()
+ hasPending = hasPending || (hostView as ViewRootForTest).hasPendingMeasureOrLayout
+ hasPending = hasPending || hostView.isDirty
+ return hasPending
+ }
+
+ if (!(hasPending())) {
+ // We are stable!
+ return
+ }
+ }
+
+ // Still not stable
+ throw AssertionError("Changes are still pending after '$maxAmountOfFrames' frames.")
+}
diff --git a/compose/material/material-ripple/benchmark/src/main/AndroidManifest.xml b/compose/material/material-ripple/benchmark/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6c631ea
--- /dev/null
+++ b/compose/material/material-ripple/benchmark/src/main/AndroidManifest.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <application/>
+</manifest>
diff --git a/compose/material/material-ripple/build.gradle b/compose/material/material-ripple/build.gradle
index 9e6fbe8..c2a484d 100644
--- a/compose/material/material-ripple/build.gradle
+++ b/compose/material/material-ripple/build.gradle
@@ -117,7 +117,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/Ripple.android.kt b/compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/Ripple.android.kt
index 928b4ff..5708558 100644
--- a/compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/Ripple.android.kt
+++ b/compose/material/material-ripple/src/androidMain/kotlin/androidx/compose/material/ripple/Ripple.android.kt
@@ -70,26 +70,8 @@
}
}
- // Create or get the RippleContainer attached to the nearest root Compose view
-
- var rippleContainer: RippleContainer? = null
-
- for (index in 0 until view.childCount) {
- val child = view.getChildAt(index)
- if (child is RippleContainer) {
- rippleContainer = child
- break
- }
- }
-
- if (rippleContainer == null) {
- rippleContainer = RippleContainer(view.context).apply {
- view.addView(this)
- }
- }
-
- return remember(interactionSource, this, rippleContainer) {
- AndroidRippleIndicationInstance(bounded, radius, color, rippleAlpha, rippleContainer)
+ return remember(interactionSource, this, view) {
+ AndroidRippleIndicationInstance(bounded, radius, color, rippleAlpha, view)
}
}
@@ -129,9 +111,15 @@
private val radius: Dp,
private val color: State<Color>,
private val rippleAlpha: State<RippleAlpha>,
- private val rippleContainer: RippleContainer
+ private val view: ViewGroup
) : RippleIndicationInstance(bounded, rippleAlpha), RememberObserver {
/**
+ * [RippleContainer] attached to the nearest [ViewGroup]: [view]. If it hasn't already been
+ * created by a another ripple, we will create it and attach it to the hierarchy.
+ */
+ private var rippleContainer: RippleContainer? = null
+
+ /**
* Backing [RippleHostView] used to draw ripples for this [RippleIndicationInstance].
* [mutableStateOf] as we want changes to this to invalidate drawing, and cause us to draw /
* stop drawing a ripple.
@@ -207,7 +195,7 @@
}
override fun addRipple(interaction: PressInteraction.Press, scope: CoroutineScope) {
- rippleHostView = with(rippleContainer) {
+ rippleHostView = with(getOrCreateRippleContainer()) {
getRippleHostView().apply {
addRipple(
interaction = interaction,
@@ -237,7 +225,7 @@
}
private fun dispose() {
- with(rippleContainer) {
+ rippleContainer?.run {
disposeRippleIfNeeded()
}
}
@@ -249,4 +237,26 @@
fun resetHostView() {
rippleHostView = null
}
+
+ private fun getOrCreateRippleContainer(): RippleContainer {
+ if (rippleContainer != null) return rippleContainer!!
+
+ // Find existing RippleContainer in the view hierarchy
+ for (index in 0 until view.childCount) {
+ val child = view.getChildAt(index)
+ if (child is RippleContainer) {
+ rippleContainer = child
+ break
+ }
+ }
+
+ // Create a new RippleContainer if needed
+ if (rippleContainer == null) {
+ rippleContainer = RippleContainer(view.context).apply {
+ view.addView(this)
+ }
+ }
+
+ return rippleContainer!!
+ }
}
diff --git a/compose/material/material/api/current.txt b/compose/material/material/api/current.txt
index 5f99188..aa36fd8 100644
--- a/compose/material/material/api/current.txt
+++ b/compose/material/material/api/current.txt
@@ -82,7 +82,7 @@
method public suspend Object? expand(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.BottomDrawerValue getCurrentValue();
method public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.BottomDrawerValue getTargetValue();
method public boolean isClosed();
method public boolean isExpanded();
@@ -93,7 +93,7 @@
property public final boolean isExpanded;
property public final boolean isOpen;
property public final float offset;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.BottomDrawerValue targetValue;
field public static final androidx.compose.material.BottomDrawerState.Companion Companion;
}
@@ -154,7 +154,7 @@
method public suspend Object? expand(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.BottomSheetValue getCurrentValue();
method @Deprecated public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.BottomSheetValue getTargetValue();
method public boolean isCollapsed();
method public boolean isExpanded();
@@ -163,7 +163,7 @@
property public final boolean isCollapsed;
property public final boolean isExpanded;
property @Deprecated public final float offset;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.BottomSheetValue targetValue;
field public static final androidx.compose.material.BottomSheetState.Companion Companion;
}
@@ -550,14 +550,14 @@
ctor @Deprecated public ModalBottomSheetState(androidx.compose.material.ModalBottomSheetValue initialValue, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> animationSpec, optional boolean isSkipHalfExpanded, kotlin.jvm.functions.Function1<? super androidx.compose.material.ModalBottomSheetValue,java.lang.Boolean> confirmStateChange);
ctor @Deprecated public ModalBottomSheetState(androidx.compose.material.ModalBottomSheetValue initialValue, androidx.compose.animation.core.AnimationSpec<java.lang.Float> animationSpec, kotlin.jvm.functions.Function1<? super androidx.compose.material.ModalBottomSheetValue,java.lang.Boolean> confirmStateChange);
method public androidx.compose.material.ModalBottomSheetValue getCurrentValue();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.ModalBottomSheetValue getTargetValue();
method public suspend Object? hide(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public boolean isVisible();
method public suspend Object? show(kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public final androidx.compose.material.ModalBottomSheetValue currentValue;
property public final boolean isVisible;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.ModalBottomSheetValue targetValue;
field public static final androidx.compose.material.ModalBottomSheetState.Companion Companion;
}
@@ -607,11 +607,11 @@
method @Deprecated @androidx.compose.runtime.Composable public static void CircularProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth);
method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void CircularProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth);
- method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
+ method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(@FloatRange(from=0.0, to=1.0) float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void LinearProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor);
method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void LinearProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor);
- method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
+ method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(@FloatRange(from=0.0, to=1.0) float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
}
@androidx.compose.runtime.Stable public interface RadioButtonColors {
@@ -685,8 +685,8 @@
}
public final class SliderKt {
- method @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
- method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material.SliderColors colors);
+ method @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
+ method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material.SliderColors colors);
}
public interface SnackbarData {
diff --git a/compose/material/material/api/restricted_current.txt b/compose/material/material/api/restricted_current.txt
index 5f99188..aa36fd8 100644
--- a/compose/material/material/api/restricted_current.txt
+++ b/compose/material/material/api/restricted_current.txt
@@ -82,7 +82,7 @@
method public suspend Object? expand(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.BottomDrawerValue getCurrentValue();
method public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.BottomDrawerValue getTargetValue();
method public boolean isClosed();
method public boolean isExpanded();
@@ -93,7 +93,7 @@
property public final boolean isExpanded;
property public final boolean isOpen;
property public final float offset;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.BottomDrawerValue targetValue;
field public static final androidx.compose.material.BottomDrawerState.Companion Companion;
}
@@ -154,7 +154,7 @@
method public suspend Object? expand(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.BottomSheetValue getCurrentValue();
method @Deprecated public float getOffset();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.BottomSheetValue getTargetValue();
method public boolean isCollapsed();
method public boolean isExpanded();
@@ -163,7 +163,7 @@
property public final boolean isCollapsed;
property public final boolean isExpanded;
property @Deprecated public final float offset;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.BottomSheetValue targetValue;
field public static final androidx.compose.material.BottomSheetState.Companion Companion;
}
@@ -550,14 +550,14 @@
ctor @Deprecated public ModalBottomSheetState(androidx.compose.material.ModalBottomSheetValue initialValue, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> animationSpec, optional boolean isSkipHalfExpanded, kotlin.jvm.functions.Function1<? super androidx.compose.material.ModalBottomSheetValue,java.lang.Boolean> confirmStateChange);
ctor @Deprecated public ModalBottomSheetState(androidx.compose.material.ModalBottomSheetValue initialValue, androidx.compose.animation.core.AnimationSpec<java.lang.Float> animationSpec, kotlin.jvm.functions.Function1<? super androidx.compose.material.ModalBottomSheetValue,java.lang.Boolean> confirmStateChange);
method public androidx.compose.material.ModalBottomSheetValue getCurrentValue();
- method public float getProgress();
+ method @FloatRange(from=0.0, to=1.0) public float getProgress();
method public androidx.compose.material.ModalBottomSheetValue getTargetValue();
method public suspend Object? hide(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public boolean isVisible();
method public suspend Object? show(kotlin.coroutines.Continuation<? super kotlin.Unit>);
property public final androidx.compose.material.ModalBottomSheetValue currentValue;
property public final boolean isVisible;
- property @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi public final float progress;
+ property @SuppressCompatibility @FloatRange(from=0.0, to=1.0) @androidx.compose.material.ExperimentalMaterialApi public final float progress;
property public final androidx.compose.material.ModalBottomSheetValue targetValue;
field public static final androidx.compose.material.ModalBottomSheetState.Companion Companion;
}
@@ -607,11 +607,11 @@
method @Deprecated @androidx.compose.runtime.Composable public static void CircularProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth);
method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void CircularProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth);
- method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
+ method @androidx.compose.runtime.Composable public static void CircularProgressIndicator(@FloatRange(from=0.0, to=1.0) float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional float strokeWidth, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void LinearProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor);
method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
method @Deprecated @androidx.compose.runtime.Composable public static void LinearProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor);
- method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
+ method @androidx.compose.runtime.Composable public static void LinearProgressIndicator(@FloatRange(from=0.0, to=1.0) float progress, optional androidx.compose.ui.Modifier modifier, optional long color, optional long backgroundColor, optional int strokeCap);
}
@androidx.compose.runtime.Stable public interface RadioButtonColors {
@@ -685,8 +685,8 @@
}
public final class SliderKt {
- method @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
- method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material.SliderColors colors);
+ method @SuppressCompatibility @androidx.compose.material.ExperimentalMaterialApi @androidx.compose.runtime.Composable public static void RangeSlider(kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> value, kotlin.jvm.functions.Function1<? super kotlin.ranges.ClosedFloatingPointRange<java.lang.Float>,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.material.SliderColors colors);
+ method @androidx.compose.runtime.Composable public static void Slider(float value, kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> onValueChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.ranges.ClosedFloatingPointRange<java.lang.Float> valueRange, optional @IntRange(from=0L) int steps, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onValueChangeFinished, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.material.SliderColors colors);
}
public interface SnackbarData {
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsBenchmark.kt
index dec4d18..5dab3c3 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsBenchmark.kt
@@ -109,4 +109,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(checkboxCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsTestCase.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsTestCase.kt
index b590874..194abdd 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsTestCase.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/CheckboxesInRowsTestCase.kt
@@ -80,4 +80,4 @@
modifier = modifier
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/RadioGroupBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/RadioGroupBenchmark.kt
index 8cf50ec..33ea12f 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/RadioGroupBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/RadioGroupBenchmark.kt
@@ -136,4 +136,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnBenchmark.kt
index 4a07b63..9e0c73c 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnBenchmark.kt
@@ -97,4 +97,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(textInColumnCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnSizeToggleTestCase.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnSizeToggleTestCase.kt
index cba9169..bda674e 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnSizeToggleTestCase.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/TextInColumnSizeToggleTestCase.kt
@@ -68,4 +68,4 @@
20.sp
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutBenchmark.kt
index babe9e0..795a381 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutBenchmark.kt
@@ -78,4 +78,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(checkboxesCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutTestCase.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutTestCase.kt
index f387d64..76547cb 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutTestCase.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidCheckboxesInLinearLayoutTestCase.kt
@@ -76,4 +76,4 @@
val checkbox = checkboxes.first()
checkbox.isChecked = !checkbox.isChecked
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewBenchmark.kt
index c8ac2b4..632dc8a 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewBenchmark.kt
@@ -105,4 +105,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(caseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewTestCase.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewTestCase.kt
index 94f20d4..486369d 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewTestCase.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewTestCase.kt
@@ -56,4 +56,4 @@
}
return column
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutBenchmark.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutBenchmark.kt
index fa88cec..3446b62 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutBenchmark.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutBenchmark.kt
@@ -78,4 +78,4 @@
fun draw() {
benchmarkRule.benchmarkDrawPerf(rectanglesCaseFactory)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutTestCase.kt b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutTestCase.kt
index 12296193..2603b87 100644
--- a/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutTestCase.kt
+++ b/compose/material/material/benchmark/src/androidTest/java/androidx/compose/material/benchmark/view/AndroidTextViewsInLinearLayoutTestCase.kt
@@ -56,4 +56,4 @@
it.textSize = fontSize
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/build.gradle b/compose/material/material/build.gradle
index 4fc4668..ff74d8b 100644
--- a/compose/material/material/build.gradle
+++ b/compose/material/material/build.gradle
@@ -140,7 +140,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
implementation(project(":compose:ui:ui-test-junit4"))
implementation(libs.truth)
diff --git a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/IconProcessor.kt b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/IconProcessor.kt
index 7eeab01..4eae40a 100644
--- a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/IconProcessor.kt
+++ b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/IconProcessor.kt
@@ -203,4 +203,4 @@
// These icons have already shipped in a stable release, so it is too late to rename / remove one to
// fix the clash.
-private val AllowedDuplicateIconNames = listOf("AddChart", "Addchart")
\ No newline at end of file
+private val AllowedDuplicateIconNames = listOf("AddChart", "Addchart")
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ExposedDropdownMenuDemo.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ExposedDropdownMenuDemo.kt
index a2a8b5a..c387e16 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ExposedDropdownMenuDemo.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ExposedDropdownMenuDemo.kt
@@ -129,4 +129,4 @@
}
}
-private val DefaultSpace = 20.dp
\ No newline at end of file
+private val DefaultSpace = 20.dp
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MenuDemo.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MenuDemo.kt
index c5cb10f..040f8ab 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MenuDemo.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/MenuDemo.kt
@@ -92,4 +92,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/BottomSheetScaffoldSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/BottomSheetScaffoldSamples.kt
index d9155c8..116ab3e 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/BottomSheetScaffoldSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/BottomSheetScaffoldSamples.kt
@@ -137,4 +137,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/CardSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/CardSamples.kt
index 2f1a82a..98b08ca 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/CardSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/CardSamples.kt
@@ -42,4 +42,4 @@
Card(onClick = { count++ }) {
Text("Clickable card content with count: $count")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ChipSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ChipSamples.kt
index 7c6e71e5..9b0e0e8 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ChipSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ChipSamples.kt
@@ -179,4 +179,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
index cf1390c..2681624 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/DrawerSamples.kt
@@ -133,4 +133,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ElevationSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ElevationSamples.kt
index 066fa1c..9d50b68 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ElevationSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ElevationSamples.kt
@@ -34,4 +34,4 @@
val elevation = LocalAbsoluteElevation.current
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ExposedDropdownMenuSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ExposedDropdownMenuSamples.kt
index 67f435f..42434b1 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ExposedDropdownMenuSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ExposedDropdownMenuSamples.kt
@@ -122,4 +122,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/FloatingActionButtonSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/FloatingActionButtonSamples.kt
index da257ea..de84531 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/FloatingActionButtonSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/FloatingActionButtonSamples.kt
@@ -62,4 +62,4 @@
onClick = { /*do something*/ },
modifier = Modifier.fillMaxWidth()
)
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
index 66e071f..f399b4a 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/ScaffoldSamples.kt
@@ -300,4 +300,4 @@
)
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SelectionControlsSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SelectionControlsSamples.kt
index dd3ae10..ca9f13f 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SelectionControlsSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SelectionControlsSamples.kt
@@ -201,4 +201,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
index 3232aba..e2e6f8b 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SliderSample.kt
@@ -95,4 +95,4 @@
activeTrackColor = MaterialTheme.colors.secondary
)
)
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
index 98704d1b..b28e7f7 100644
--- a/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
+++ b/compose/material/material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
@@ -73,4 +73,4 @@
Text(swipeableState.currentValue, color = Color.White, fontSize = 24.sp)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
index 274fd8d..f8b99e2 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
@@ -696,4 +696,4 @@
assertThat(scaffoldState.currentValue).isEqualTo(Revealed)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
index 3843974..fa8f9c1 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
@@ -151,4 +151,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, "button_focus")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxTest.kt
index 64005ba..c30c491 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxTest.kt
@@ -319,4 +319,4 @@
click(position = Offset(-1f, -1f))
}.assertIsOn()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ColorsTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ColorsTest.kt
index 0d9ebda..0e412bf 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ColorsTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ColorsTest.kt
@@ -108,4 +108,4 @@
if (isLight != other.isLight) return false
return true
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DividerUiTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DividerUiTest.kt
index 5609447..4569c65 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DividerUiTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DividerUiTest.kt
@@ -106,4 +106,4 @@
Color.Blue
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ExposedDropdownMenuTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ExposedDropdownMenuTest.kt
index 025a3ba..a4b8ddc 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ExposedDropdownMenuTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ExposedDropdownMenuTest.kt
@@ -486,4 +486,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/GoldenCommon.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/GoldenCommon.kt
index ece0eda..507a9b0 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/GoldenCommon.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/GoldenCommon.kt
@@ -16,4 +16,4 @@
package androidx.compose.material
-internal const val GOLDEN_MATERIAL = "compose/material/material"
\ No newline at end of file
+internal const val GOLDEN_MATERIAL = "compose/material/material"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
index fbf5030..be665d3 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialRippleThemeTest.kt
@@ -1242,4 +1242,4 @@
private val RippleBoxBackgroundColor = Color.Blue
-private const val Tag = "Ripple"
\ No newline at end of file
+private const val Tag = "Ripple"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt
index dc04bd0..39d9fa0 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt
@@ -248,4 +248,4 @@
selection = TextRange(0, 8),
composition = TextRange(0, 8)
)
-private const val Tag = "TestTag"
\ No newline at end of file
+private const val Tag = "TestTag"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailScreenshotTest.kt
index 396228e..96c7496 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailScreenshotTest.kt
@@ -278,4 +278,4 @@
}
}
-private const val Tag = "NavigationRail"
\ No newline at end of file
+private const val Tag = "NavigationRail"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailTest.kt
index 52c72d9..e974548 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/NavigationRailTest.kt
@@ -404,4 +404,4 @@
Truth.assertThat(clicks).isEqualTo(0)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ObservableThemeTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ObservableThemeTest.kt
index b653c19..758f3f1 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ObservableThemeTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ObservableThemeTest.kt
@@ -207,4 +207,4 @@
private val LocalTestTheme = staticCompositionLocalOf<TestTheme> {
error("CompositionLocal LocalTestThemem not present")
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
index 41269e3..cbda09b 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
@@ -231,4 +231,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonTest.kt
index 04cd5e3..e09a044 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonTest.kt
@@ -298,4 +298,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
index db70aca..b0d8134 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderScreenshotTest.kt
@@ -246,4 +246,4 @@
}
assertSliderAgainstGolden("rangeSlider_steps_customColors")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarHostTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarHostTest.kt
index 7eff0db..fc208b9 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarHostTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarHostTest.kt
@@ -260,4 +260,4 @@
SnackbarDuration.Short.toMillis(false, null)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
index e1ebe2f..0f50354 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarTest.kt
@@ -401,4 +401,4 @@
assertThat(clicked).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
index dfb408b..5b012b5 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
@@ -287,4 +287,4 @@
assertThat(dismissState.currentValue).isEqualTo(DismissValue.Default)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
index cb03029..3ea6d05 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
@@ -284,4 +284,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableStateTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableStateTest.kt
index 66d17fb..d419916 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableStateTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableStateTest.kt
@@ -982,4 +982,4 @@
private val defaultVelocityThreshold: () -> Float = { with(rule.density) { 125.dp.toPx() } }
private val defaultAnimationSpec = tween<Float>()
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableTestValue.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableTestValue.kt
index 16bfc99..d655926 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableTestValue.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/anchoredDraggable/AnchoredDraggableTestValue.kt
@@ -20,4 +20,4 @@
import androidx.compose.material.ExperimentalMaterialApi
-internal enum class AnchoredDraggableTestValue { A, B, C }
\ No newline at end of file
+internal enum class AnchoredDraggableTestValue { A, B, C }
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTest.kt
index 9055b1d..732d4c5 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTest.kt
@@ -218,4 +218,4 @@
}
private const val PullRefreshTag = "pull-refresh"
-private const val IndicatorTag = "pull-refresh-indicator"
\ No newline at end of file
+private const val IndicatorTag = "pull-refresh-indicator"
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransformTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransformTest.kt
index 1cfa222..fc7af76 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransformTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransformTest.kt
@@ -188,4 +188,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
index c40c277..1658beb 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
@@ -559,4 +559,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
index 777adeb..c322df8 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
@@ -695,4 +695,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
index e9d4389..51baca6 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
@@ -556,4 +556,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
index 948b5a9..575180c 100644
--- a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
+++ b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
@@ -736,4 +736,4 @@
result = 31 * result + disabledPlaceholderColor.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Strings.android.kt b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Strings.android.kt
index 8ad98bb..fcae854 100644
--- a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Strings.android.kt
+++ b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/Strings.android.kt
@@ -35,4 +35,4 @@
Strings.SliderRangeEnd -> resources.getString(R.string.range_end)
else -> ""
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
index f888873..3ec1356 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.SpringSpec
import androidx.compose.animation.core.animate
@@ -352,7 +353,7 @@
* The fraction of the progress going from [currentValue] to [closestValue], within [0f..1f]
* bounds, or 1f if the [AnchoredDraggableState] is in a settled state.
*/
- /*@FloatRange(from = 0f, to = 1f)*/
+ @get:FloatRange(from = 0.0, to = 1.0)
val progress: Float by derivedStateOf(structuralEqualityPolicy()) {
val a = anchors.positionOf(currentValue)
val b = anchors.positionOf(closestValue)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
index cad60b6..ee0e23d 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.VectorizedAnimationSpec
@@ -254,7 +255,7 @@
private fun BottomNavigationItemBaselineLayout(
icon: @Composable () -> Unit,
label: @Composable (() -> Unit)?,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
iconPositionAnimationProgress: Float
) {
Layout(
@@ -332,7 +333,7 @@
labelPlaceable: Placeable,
iconPlaceable: Placeable,
constraints: Constraints,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
iconPositionAnimationProgress: Float
): MeasureResult {
val height = constraints.maxHeight
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt
index 84e642e..013adfe 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt
@@ -15,6 +15,7 @@
*/
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.layout.Column
@@ -185,7 +186,7 @@
* The fraction of the progress, within [0f..1f] bounds, or 1f if the [AnchoredDraggableState]
* is in a settled state.
*/
- /*@FloatRange(from = 0f, to = 1f)*/
+ @get:FloatRange(from = 0.0, to = 1.0)
@ExperimentalMaterialApi
val progress: Float
get() = anchoredDraggableState.progress
@@ -717,4 +718,4 @@
private val FabSpacing = 16.dp
private val BottomSheetScaffoldPositionalThreshold = 56.dp
-private val BottomSheetScaffoldVelocityThreshold = 125.dp
\ No newline at end of file
+private val BottomSheetScaffoldVelocityThreshold = 125.dp
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt
index b5f6dc0..919297a 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt
@@ -757,4 +757,4 @@
/**
* The size of a circle used to obscure the leading icon before a selected icon is displayed on top.
*/
-private val SelectedIconContainerSize = 24.dp
\ No newline at end of file
+private val SelectedIconContainerSize = 24.dp
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ContentAlpha.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ContentAlpha.kt
index 930b61e..a3091b1 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ContentAlpha.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ContentAlpha.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.runtime.Composable
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.graphics.luminance
@@ -69,9 +70,9 @@
*/
@Composable
private fun contentAlpha(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
highContrastAlpha: Float,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
lowContrastAlpha: Float
): Float {
val contentColor = LocalContentColor.current
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/DragGestureDetectorCopy.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/DragGestureDetectorCopy.kt
index 973fdf1..e00ecc0 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/DragGestureDetectorCopy.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/DragGestureDetectorCopy.kt
@@ -111,4 +111,4 @@
PointerType.Mouse -> touchSlop * mouseToTouchSlopRatio
else -> touchSlop
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
index 39517e6..6fbc761 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.animateFloatAsState
@@ -311,7 +312,7 @@
/**
* The current offset, or [Float.NaN] if it has not been initialized yet.
- **/
+ */
@Suppress("OPT_IN_MARKER_ON_WRONG_TARGET")
val offset: Float
get() = anchoredDraggableState.offset
@@ -327,7 +328,7 @@
* The fraction of the progress, within [0f..1f] bounds, or 1f if the [AnchoredDraggableState]
* is in a settled state.
*/
- /*@FloatRange(from = 0f, to = 1f)*/
+ @get:FloatRange(from = 0.0, to = 1.0)
@ExperimentalMaterialApi
val progress: Float
get() = anchoredDraggableState.progress
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ExperimentalMaterialApi.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ExperimentalMaterialApi.kt
index d0f78a0..6b4b137 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ExperimentalMaterialApi.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ExperimentalMaterialApi.kt
@@ -21,4 +21,4 @@
" the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalMaterialApi
\ No newline at end of file
+annotation class ExperimentalMaterialApi
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
index 081ca0b..dfe23a1 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.animateFloatAsState
@@ -226,7 +227,7 @@
* The fraction of the progress, within [0f..1f] bounds, or 1f if the [AnchoredDraggableState]
* is in a settled state.
*/
- /*@FloatRange(from = 0f, to = 1f)*/
+ @get:FloatRange(from = 0.0, to = 1.0)
@ExperimentalMaterialApi
val progress: Float
get() = anchoredDraggableState.progress
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
index 378d983..e2b37e2 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.TweenSpec
import androidx.compose.animation.core.VectorizedAnimationSpec
@@ -259,7 +260,7 @@
private fun NavigationRailItemBaselineLayout(
icon: @Composable () -> Unit,
label: @Composable (() -> Unit)?,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
iconPositionAnimationProgress: Float
) {
Layout(
@@ -335,7 +336,7 @@
labelPlaceable: Placeable,
iconPlaceable: Placeable,
constraints: Constraints,
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
iconPositionAnimationProgress: Float
): MeasureResult {
val baseline = labelPlaceable[LastBaseline]
@@ -402,4 +403,4 @@
/**
* The space between the icon and the top of the container when an item contains a label and icon.
*/
-private val ItemIconTopOffset = 14.dp
\ No newline at end of file
+private val ItemIconTopOffset = 14.dp
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
index 467a3d1..51876ef 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
@@ -978,4 +978,4 @@
/* @VisibleForTesting */
internal val OutlinedTextFieldTopPadding = 8.dp
-internal const val BorderId = "border"
\ No newline at end of file
+internal const val BorderId = "border"
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ProgressIndicator.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ProgressIndicator.kt
index 3139c65..9a30437 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ProgressIndicator.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ProgressIndicator.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.FloatRange
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.Spring
@@ -71,7 +72,7 @@
*/
@Composable
fun LinearProgressIndicator(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
progress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colors.primary,
@@ -284,7 +285,7 @@
*/
@Composable
fun CircularProgressIndicator(
- /*@FloatRange(from = 0.0, to = 1.0)*/
+ @FloatRange(from = 0.0, to = 1.0)
progress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colors.primary,
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
index 3f01485..aa3bd62 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
@@ -16,6 +16,7 @@
package androidx.compose.material
+import androidx.annotation.IntRange
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.TweenSpec
import androidx.compose.foundation.Canvas
@@ -149,7 +150,7 @@
modifier: Modifier = Modifier,
enabled: Boolean = true,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
- /*@IntRange(from = 0)*/
+ @IntRange(from = 0)
steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
@@ -294,7 +295,7 @@
modifier: Modifier = Modifier,
enabled: Boolean = true,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
- /*@IntRange(from = 0)*/
+ @IntRange(from = 0)
steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null,
colors: SliderColors = SliderDefaults.colors()
@@ -1187,4 +1188,4 @@
override fun dispatchRawDelta(delta: Float) {
return onDelta(delta)
}
-}
\ No newline at end of file
+}
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 e1af01b..e03647a 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
@@ -370,4 +370,4 @@
private const val SnackbarFadeInMillis = 150
private const val SnackbarFadeOutMillis = 75
-private const val SnackbarInBetweenDelayMillis = 0
\ No newline at end of file
+private const val SnackbarInBetweenDelayMillis = 0
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SwipeToDismiss.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SwipeToDismiss.kt
index a856a28..4df2b6c 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SwipeToDismiss.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SwipeToDismiss.kt
@@ -241,4 +241,4 @@
}
}
-private val DISMISS_THRESHOLD = 56.dp
\ No newline at end of file
+private val DISMISS_THRESHOLD = 56.dp
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
index 23f3381..fe11c44c 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
@@ -902,4 +902,4 @@
private const val SwipeableDeprecation = "Material's Swipeable has been replaced by Foundation's " +
"AnchoredDraggable APIs. Please see developer.android.com for an overview of the changes and " +
- "a migration guide."
\ No newline at end of file
+ "a migration guide."
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
index bce7a19..473442e 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
@@ -934,4 +934,4 @@
/** Padding from label's baseline (or FirstBaselineOffset) to the input field */
/*@VisibleForTesting*/
-internal val TextFieldTopPadding = 2.dp
\ No newline at end of file
+internal val TextFieldTopPadding = 2.dp
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
index 0bf4aea..197f1a41 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
@@ -902,4 +902,4 @@
return rememberUpdatedState(
BorderStroke(animatedThickness.value, SolidColor(indicatorColor.value))
)
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
index 89000d5..5c493f87 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
@@ -365,4 +365,4 @@
internal val TextFieldPadding = 16.dp
internal val HorizontalIconPadding = 12.dp
-internal val IconDefaultSizeModifier = Modifier.defaultMinSize(48.dp, 48.dp)
\ No newline at end of file
+internal val IconDefaultSizeModifier = Modifier.defaultMinSize(48.dp, 48.dp)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefresh.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefresh.kt
index 564d874..4751d172 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefresh.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefresh.kt
@@ -116,4 +116,4 @@
override suspend fun onPreFling(available: Velocity): Velocity {
return Velocity(0f, onRelease(available.y))
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransform.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransform.kt
index ad97176..f398c5a 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransform.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshIndicatorTransform.kt
@@ -72,4 +72,4 @@
scaleY = scaleFraction
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DefaultPlatformTextStyle.desktop.kt b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DefaultPlatformTextStyle.desktop.kt
index d8b6ef6..873b9e0 100644
--- a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DefaultPlatformTextStyle.desktop.kt
+++ b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DefaultPlatformTextStyle.desktop.kt
@@ -18,4 +18,4 @@
import androidx.compose.ui.text.PlatformTextStyle
-internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = null
\ No newline at end of file
+internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = null
diff --git a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopAlertDialog.desktop.kt b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopAlertDialog.desktop.kt
index 125aaed..9c8f953 100644
--- a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopAlertDialog.desktop.kt
+++ b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopAlertDialog.desktop.kt
@@ -240,4 +240,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt
index ba88fef..909f648 100644
--- a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt
+++ b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt
@@ -370,4 +370,4 @@
)
return IntOffset(x, y)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/Strings.desktop.kt b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/Strings.desktop.kt
index 6873b2d..b1f629d 100644
--- a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/Strings.desktop.kt
+++ b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/Strings.desktop.kt
@@ -27,4 +27,4 @@
Strings.DefaultErrorMessage -> "Invalid input"
else -> ""
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopAlertDialogTest.kt b/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopAlertDialogTest.kt
index cc5e759..2b3ac58 100644
--- a/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopAlertDialogTest.kt
+++ b/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopAlertDialogTest.kt
@@ -67,4 +67,4 @@
val y = (rootSize.height - childSize.height) / 2f
return Offset(x, y)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopMenuTest.kt b/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopMenuTest.kt
index 7ec3efcb..c0f94f5 100644
--- a/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopMenuTest.kt
+++ b/compose/material/material/src/desktopTest/kotlin/androidx/compose/material/DesktopMenuTest.kt
@@ -67,4 +67,4 @@
assertThat(position).isEqualTo(IntOffset(10, 0))
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/jvmMain/kotlin/androidx/compose/material/ActualJvm.kt b/compose/material/material/src/jvmMain/kotlin/androidx/compose/material/ActualJvm.kt
index 307fd82..0bd2191 100644
--- a/compose/material/material/src/jvmMain/kotlin/androidx/compose/material/ActualJvm.kt
+++ b/compose/material/material/src/jvmMain/kotlin/androidx/compose/material/ActualJvm.kt
@@ -19,4 +19,4 @@
package androidx.compose.material
internal actual typealias InternalAtomicReference<V> =
- java.util.concurrent.atomic.AtomicReference<V>
\ No newline at end of file
+ java.util.concurrent.atomic.AtomicReference<V>
diff --git a/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt b/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt
index 8f6e548..1aec7be 100644
--- a/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt
+++ b/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt
@@ -39,4 +39,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material/material/src/test/kotlin/androidx/compose/material/DraggableAnchorsTest.kt b/compose/material/material/src/test/kotlin/androidx/compose/material/DraggableAnchorsTest.kt
index 8c420f3..6025350 100644
--- a/compose/material/material/src/test/kotlin/androidx/compose/material/DraggableAnchorsTest.kt
+++ b/compose/material/material/src/test/kotlin/androidx/compose/material/DraggableAnchorsTest.kt
@@ -102,4 +102,4 @@
}
}
-private enum class TestValue { A, B, C }
\ No newline at end of file
+private enum class TestValue { A, B, C }
diff --git a/compose/material3/material3-adaptive/api/current.txt b/compose/material3/material3-adaptive/api/current.txt
index 08260f2..22e1264 100644
--- a/compose/material3/material3-adaptive/api/current.txt
+++ b/compose/material3/material3-adaptive/api/current.txt
@@ -11,11 +11,13 @@
property public final androidx.compose.material3.adaptive.AdaptStrategy Hide;
}
- @androidx.compose.runtime.Immutable public final class AdaptiveLayoutDirective {
- ctor public AdaptiveLayoutDirective(int maxHorizontalPartitions, androidx.compose.material3.adaptive.GutterSizes gutterSizes, optional int maxVerticalPartitions);
+ @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class AdaptiveLayoutDirective {
+ ctor public AdaptiveLayoutDirective(int maxHorizontalPartitions, androidx.compose.material3.adaptive.GutterSizes gutterSizes, optional int maxVerticalPartitions, optional java.util.List<androidx.compose.ui.geometry.Rect> excludedBounds);
+ method public java.util.List<androidx.compose.ui.geometry.Rect> getExcludedBounds();
method public androidx.compose.material3.adaptive.GutterSizes getGutterSizes();
method public int getMaxHorizontalPartitions();
method public int getMaxVerticalPartitions();
+ property public final java.util.List<androidx.compose.ui.geometry.Rect> excludedBounds;
property public final androidx.compose.material3.adaptive.GutterSizes gutterSizes;
property public final int maxHorizontalPartitions;
property public final int maxVerticalPartitions;
@@ -39,7 +41,7 @@
@SuppressCompatibility @kotlin.RequiresOptIn(message="This material3-adaptive API is experimental and is likely to change or to be" + "removed in the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalMaterial3AdaptiveApi {
}
- @androidx.compose.runtime.Immutable public final class GutterSizes {
+ @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class GutterSizes {
ctor public GutterSizes(float outerVertical, float innerVertical, optional float outerHorizontal, optional float innerHorizontal);
method public float getInnerHorizontal();
method public float getInnerVertical();
@@ -98,6 +100,10 @@
field public static final androidx.compose.material3.adaptive.ThreePaneScaffoldDefaults INSTANCE;
}
+ public final class ThreePaneScaffoldKt {
+ method @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Composable public static void ThreePaneScaffold(androidx.compose.ui.Modifier modifier, androidx.compose.material3.adaptive.AdaptiveLayoutDirective layoutDirective, androidx.compose.material3.adaptive.ThreePaneScaffoldValue scaffoldValue, androidx.compose.material3.adaptive.ThreePaneScaffoldArrangement arrangement, kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit> secondaryPane, optional kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit>? tertiaryPane, kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit> primaryPane);
+ }
+
@SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi public enum ThreePaneScaffoldRole {
method public static androidx.compose.material3.adaptive.ThreePaneScaffoldRole valueOf(String value) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;
method public static androidx.compose.material3.adaptive.ThreePaneScaffoldRole[] values();
@@ -106,6 +112,9 @@
enum_constant public static final androidx.compose.material3.adaptive.ThreePaneScaffoldRole Tertiary;
}
+ public interface ThreePaneScaffoldScope extends androidx.compose.material3.adaptive.PaneScaffoldScope {
+ }
+
@SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class ThreePaneScaffoldValue {
ctor public ThreePaneScaffoldValue(String primary, String secondary, String tertiary);
method public operator String get(androidx.compose.material3.adaptive.ThreePaneScaffoldRole role);
diff --git a/compose/material3/material3-adaptive/api/restricted_current.txt b/compose/material3/material3-adaptive/api/restricted_current.txt
index 08260f2..22e1264 100644
--- a/compose/material3/material3-adaptive/api/restricted_current.txt
+++ b/compose/material3/material3-adaptive/api/restricted_current.txt
@@ -11,11 +11,13 @@
property public final androidx.compose.material3.adaptive.AdaptStrategy Hide;
}
- @androidx.compose.runtime.Immutable public final class AdaptiveLayoutDirective {
- ctor public AdaptiveLayoutDirective(int maxHorizontalPartitions, androidx.compose.material3.adaptive.GutterSizes gutterSizes, optional int maxVerticalPartitions);
+ @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class AdaptiveLayoutDirective {
+ ctor public AdaptiveLayoutDirective(int maxHorizontalPartitions, androidx.compose.material3.adaptive.GutterSizes gutterSizes, optional int maxVerticalPartitions, optional java.util.List<androidx.compose.ui.geometry.Rect> excludedBounds);
+ method public java.util.List<androidx.compose.ui.geometry.Rect> getExcludedBounds();
method public androidx.compose.material3.adaptive.GutterSizes getGutterSizes();
method public int getMaxHorizontalPartitions();
method public int getMaxVerticalPartitions();
+ property public final java.util.List<androidx.compose.ui.geometry.Rect> excludedBounds;
property public final androidx.compose.material3.adaptive.GutterSizes gutterSizes;
property public final int maxHorizontalPartitions;
property public final int maxVerticalPartitions;
@@ -39,7 +41,7 @@
@SuppressCompatibility @kotlin.RequiresOptIn(message="This material3-adaptive API is experimental and is likely to change or to be" + "removed in the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalMaterial3AdaptiveApi {
}
- @androidx.compose.runtime.Immutable public final class GutterSizes {
+ @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class GutterSizes {
ctor public GutterSizes(float outerVertical, float innerVertical, optional float outerHorizontal, optional float innerHorizontal);
method public float getInnerHorizontal();
method public float getInnerVertical();
@@ -98,6 +100,10 @@
field public static final androidx.compose.material3.adaptive.ThreePaneScaffoldDefaults INSTANCE;
}
+ public final class ThreePaneScaffoldKt {
+ method @SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Composable public static void ThreePaneScaffold(androidx.compose.ui.Modifier modifier, androidx.compose.material3.adaptive.AdaptiveLayoutDirective layoutDirective, androidx.compose.material3.adaptive.ThreePaneScaffoldValue scaffoldValue, androidx.compose.material3.adaptive.ThreePaneScaffoldArrangement arrangement, kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit> secondaryPane, optional kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit>? tertiaryPane, kotlin.jvm.functions.Function2<? super androidx.compose.material3.adaptive.ThreePaneScaffoldScope,? super androidx.compose.material3.adaptive.PaneAdaptedValue,kotlin.Unit> primaryPane);
+ }
+
@SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi public enum ThreePaneScaffoldRole {
method public static androidx.compose.material3.adaptive.ThreePaneScaffoldRole valueOf(String value) throws java.lang.IllegalArgumentException, java.lang.NullPointerException;
method public static androidx.compose.material3.adaptive.ThreePaneScaffoldRole[] values();
@@ -106,6 +112,9 @@
enum_constant public static final androidx.compose.material3.adaptive.ThreePaneScaffoldRole Tertiary;
}
+ public interface ThreePaneScaffoldScope extends androidx.compose.material3.adaptive.PaneScaffoldScope {
+ }
+
@SuppressCompatibility @androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi @androidx.compose.runtime.Immutable public final class ThreePaneScaffoldValue {
ctor public ThreePaneScaffoldValue(String primary, String secondary, String tertiary);
method public operator String get(androidx.compose.material3.adaptive.ThreePaneScaffoldRole role);
diff --git a/compose/material3/material3-adaptive/build.gradle b/compose/material3/material3-adaptive/build.gradle
index 52bb592..8a86618 100644
--- a/compose/material3/material3-adaptive/build.gradle
+++ b/compose/material3/material3-adaptive/build.gradle
@@ -42,6 +42,7 @@
implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:material3:material3"))
implementation(project(":compose:material3:material3-window-size-class"))
+ implementation(project(":compose:ui:ui-util"))
}
}
@@ -111,3 +112,10 @@
inceptionYear = "2023"
description = "Compose Material Design Adaptive Library"
}
+
+// Screenshot tests related setup
+android {
+ sourceSets.androidTest.assets.srcDirs +=
+ project.rootDir.absolutePath + "/../../golden/compose/material3/material3-adaptive"
+ namespace "androidx.compose.material3.adaptive"
+}
diff --git a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/CalculateWindowAdaptiveInfoTest.kt b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/CalculateWindowAdaptiveInfoTest.kt
index db9c2a3..57c5303 100644
--- a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/CalculateWindowAdaptiveInfoTest.kt
+++ b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/CalculateWindowAdaptiveInfoTest.kt
@@ -116,4 +116,4 @@
private val MockDensity = Density(1f, 1f)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/GoldenCommon.kt
similarity index 81%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/GoldenCommon.kt
index 5d73136..a693e3a 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/GoldenCommon.kt
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package androidx.paging
+package androidx.compose.material3.adaptive
-public expect annotation class MainThread()
+internal const val GOLDEN_MATERIAL3_ADAPTIVE = "compose/material3/material3-adaptive"
diff --git a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldScreenshotTest.kt b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldScreenshotTest.kt
new file mode 100644
index 0000000..7ff97c2
--- /dev/null
+++ b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldScreenshotTest.kt
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.adaptive
+
+import android.os.Build
+import androidx.compose.testutils.assertAgainstGolden
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import androidx.test.filters.SdkSuppress
+import androidx.test.screenshot.AndroidXScreenshotTestRule
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+class ThreePaneScaffoldScreenshotTest {
+ @get:Rule
+ val rule = createComposeRule()
+
+ @get:Rule
+ val screenshotRule = AndroidXScreenshotTestRule(GOLDEN_MATERIAL3_ADAPTIVE)
+
+ @Test
+ fun threePaneScaffold_listDetailArrangement_standard() {
+ rule.setContent {
+ val layoutDirective = calculateStandardAdaptiveLayoutDirective(
+ calculateWindowAdaptiveInfo()
+ )
+ val scaffoldValue = calculateThreePaneScaffoldValue(
+ layoutDirective.maxHorizontalPartitions
+ )
+ SampleThreePaneScaffold(
+ layoutDirective,
+ scaffoldValue,
+ ThreePaneScaffoldDefaults.ListDetailLayoutArrangement
+ )
+ }
+
+ rule.onNodeWithTag(ThreePaneScaffoldTestTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "threePaneScaffold_listDetail_standard")
+ }
+
+ @Test
+ fun threePaneScaffold_listDetailArrangement_dense() {
+ rule.setContent {
+ val layoutDirective = calculateDenseAdaptiveLayoutDirective(
+ calculateWindowAdaptiveInfo()
+ )
+ val scaffoldValue = calculateThreePaneScaffoldValue(
+ layoutDirective.maxHorizontalPartitions
+ )
+ SampleThreePaneScaffold(
+ layoutDirective,
+ scaffoldValue,
+ ThreePaneScaffoldDefaults.ListDetailLayoutArrangement
+ )
+ }
+
+ rule.onNodeWithTag(ThreePaneScaffoldTestTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, "threePaneScaffold_listDetail_dense")
+ }
+}
diff --git a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldTest.kt b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldTest.kt
new file mode 100644
index 0000000..2242806
--- /dev/null
+++ b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldTest.kt
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.adaptive
+
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.unit.dp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+class ThreePaneScaffoldTest {
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun threePaneScaffold_allPanesHidden_noVisiblePanes() {
+ val testScaffoldValue = ThreePaneScaffoldValue(
+ PaneAdaptedValue.Hidden,
+ PaneAdaptedValue.Hidden,
+ PaneAdaptedValue.Hidden
+ )
+ rule.setContent {
+ SampleThreePaneScaffold(scaffoldValue = testScaffoldValue)
+ }
+
+ rule.onNodeWithTag("PrimaryPane").assertDoesNotExist()
+ rule.onNodeWithTag("SecondaryPane").assertDoesNotExist()
+ rule.onNodeWithTag("TertiaryPane").assertDoesNotExist()
+ }
+
+ @Test
+ fun threePaneScaffold_oneExpandedPane_onlyExpandedPanesAreVisible() {
+ val testScaffoldValue = ThreePaneScaffoldValue(
+ PaneAdaptedValue.Expanded,
+ PaneAdaptedValue.Hidden,
+ PaneAdaptedValue.Hidden
+ )
+ rule.setContent {
+ SampleThreePaneScaffold(scaffoldValue = testScaffoldValue)
+ }
+
+ rule.onNodeWithTag("PrimaryPane").assertExists()
+ rule.onNodeWithTag("SecondaryPane").assertDoesNotExist()
+ rule.onNodeWithTag("TertiaryPane").assertDoesNotExist()
+ }
+
+ @Test
+ fun threePaneScaffold_twoExpandedPanes_onlyExpandedPanesAreVisible() {
+ val testScaffoldValue = ThreePaneScaffoldValue(
+ PaneAdaptedValue.Hidden,
+ PaneAdaptedValue.Expanded,
+ PaneAdaptedValue.Expanded
+ )
+ rule.setContent {
+ SampleThreePaneScaffold(scaffoldValue = testScaffoldValue)
+ }
+
+ rule.onNodeWithTag("PrimaryPane").assertDoesNotExist()
+ rule.onNodeWithTag("SecondaryPane").assertExists()
+ rule.onNodeWithTag("TertiaryPane").assertExists()
+ }
+
+ @Test
+ fun threePaneScaffold_threeExpandedPanes_onlyExpandedPanesAreVisible() {
+ val testScaffoldValue = ThreePaneScaffoldValue(
+ PaneAdaptedValue.Expanded,
+ PaneAdaptedValue.Expanded,
+ PaneAdaptedValue.Expanded
+ )
+ rule.setContent {
+ SampleThreePaneScaffold(scaffoldValue = testScaffoldValue)
+ }
+
+ rule.onNodeWithTag("PrimaryPane").assertExists()
+ rule.onNodeWithTag("SecondaryPane").assertExists()
+ rule.onNodeWithTag("TertiaryPane").assertExists()
+ }
+}
+
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+private val MockLayoutDirective = AdaptiveLayoutDirective(
+ maxHorizontalPartitions = 1,
+ gutterSizes = GutterSizes(0.dp, 0.dp)
+)
+
+internal const val ThreePaneScaffoldTestTag = "SampleThreePaneScaffold"
+
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+@Composable
+private fun SampleThreePaneScaffold(scaffoldValue: ThreePaneScaffoldValue) {
+ SampleThreePaneScaffold(
+ MockLayoutDirective,
+ scaffoldValue,
+ ThreePaneScaffoldDefaults.ListDetailLayoutArrangement
+ )
+}
+
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+@Composable
+internal fun SampleThreePaneScaffold(
+ layoutDirective: AdaptiveLayoutDirective,
+ scaffoldValue: ThreePaneScaffoldValue,
+ arrangement: ThreePaneScaffoldArrangement
+) {
+ ThreePaneScaffold(
+ modifier = Modifier.fillMaxSize().testTag(ThreePaneScaffoldTestTag),
+ layoutDirective = layoutDirective,
+ scaffoldValue = scaffoldValue,
+ arrangement = arrangement,
+ secondaryPane = {
+ Surface(
+ modifier = Modifier.testTag(tag = "SecondaryPane"),
+ color = MaterialTheme.colorScheme.secondary
+ ) {}
+ },
+ tertiaryPane = {
+ Surface(
+ modifier = Modifier.testTag(tag = "TertiaryPane"),
+ color = MaterialTheme.colorScheme.tertiary
+ ) {}
+ }
+ ) {
+ Surface(
+ modifier = Modifier.testTag(tag = "PrimaryPane"),
+ color = MaterialTheme.colorScheme.primary
+ ) {}
+ }
+}
diff --git a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/WindowSizeAsStateTest.kt b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/WindowSizeAsStateTest.kt
index fed00fc..0b7d176 100644
--- a/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/WindowSizeAsStateTest.kt
+++ b/compose/material3/material3-adaptive/src/androidAndroidTest/kotlin/androidx/compose/material3/adaptive/WindowSizeAsStateTest.kt
@@ -105,4 +105,4 @@
Rect(0, 0, mockWindowSize.value.width, mockWindowSize.value.height)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3-adaptive/src/androidMain/kotlin/androidx/compose/material3/adaptive/ListDetailPaneScaffold.kt b/compose/material3/material3-adaptive/src/androidMain/kotlin/androidx/compose/material3/adaptive/ListDetailPaneScaffold.kt
new file mode 100644
index 0000000..1c9d6f7
--- /dev/null
+++ b/compose/material3/material3-adaptive/src/androidMain/kotlin/androidx/compose/material3/adaptive/ListDetailPaneScaffold.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.adaptive
+
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+
+/**
+ * A Material opinionated implementation of [ThreePaneScaffold] that will display the provided three
+ * panes in a canonical list-detail layout.
+ */
+@ExperimentalMaterial3AdaptiveApi
+@Composable
+internal fun ListDetailPaneScaffold(
+ modifier: Modifier = Modifier,
+ listPane: @Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit,
+ extraPane: (@Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit)? = null,
+ detailPane: @Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit
+) {
+ // TODO(conradchen): Add support of condition & strategy customization
+ val layoutDirective = calculateStandardAdaptiveLayoutDirective(calculateWindowAdaptiveInfo())
+ val scaffoldValue = calculateThreePaneScaffoldValue(
+ layoutDirective.maxHorizontalPartitions,
+ ListDetailPaneScaffoldDefaults.adaptStrategies()
+ )
+ ThreePaneScaffold(
+ modifier = Modifier.fillMaxSize().then(modifier),
+ layoutDirective = layoutDirective,
+ scaffoldValue = scaffoldValue,
+ arrangement = ThreePaneScaffoldDefaults.ListDetailLayoutArrangement,
+ secondaryPane = listPane,
+ tertiaryPane = extraPane,
+ primaryPane = detailPane
+ )
+}
+
+/**
+ * Provides default values of [ListDetailPaneScaffold].
+ */
+@ExperimentalMaterial3AdaptiveApi
+internal object ListDetailPaneScaffoldDefaults {
+ /**
+ * Creates a default [ThreePaneScaffoldAdaptStrategies] for [ListDetailPaneScaffold].
+ *
+ * @param detailPaneAdaptStrategy the adapt strategy of the primary pane
+ * @param listPaneAdaptStrategy the adapt strategy of the secondary pane
+ * @param extraPaneAdaptStrategy the adapt strategy of the tertiary pane
+ */
+ fun adaptStrategies(
+ detailPaneAdaptStrategy: AdaptStrategy = AdaptStrategy.Hide,
+ listPaneAdaptStrategy: AdaptStrategy = AdaptStrategy.Hide,
+ extraPaneAdaptStrategy: AdaptStrategy = AdaptStrategy.Hide,
+ ): ThreePaneScaffoldAdaptStrategies =
+ ThreePaneScaffoldAdaptStrategies(
+ detailPaneAdaptStrategy,
+ listPaneAdaptStrategy,
+ extraPaneAdaptStrategy
+ )
+}
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/AdaptiveLayoutDirective.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/AdaptiveLayoutDirective.kt
index e6d22cc..c7df049 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/AdaptiveLayoutDirective.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/AdaptiveLayoutDirective.kt
@@ -18,6 +18,7 @@
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.runtime.Immutable
+import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@@ -140,18 +141,23 @@
/**
* Top-level directives about how an adaptive layout should be arranged and spaced, like how many
* partitions the layout can be split into and what should be the gutter size.
+ *
+ * @constructor create an instance of [AdaptiveLayoutDirective]
+ * @param maxHorizontalPartitions the max number of partitions along the horizontal axis the layout
+ * can be split into.
+ * @param gutterSizes the gutter sizes between panes the layout should preserve.
+ * @param maxVerticalPartitions the max number of partitions along the vertical axis the layout can
+ * be split into.
+ * @param excludedBounds the bounds of all areas in the window that the layout needs to avoid
+ * displaying anything upon it. Usually these bounds represent where physical hinges are.
*/
+@ExperimentalMaterial3AdaptiveApi
@Immutable
class AdaptiveLayoutDirective(
- /** How many partitions along the horizontal axis the respective layout can be split into. */
val maxHorizontalPartitions: Int,
- /** The gutter size of the respective layout should preserve. */
val gutterSizes: GutterSizes,
- /**
- * How many partitions along the vertical axis the respective layout can be split into.
- * The default value is 1.
- */
- val maxVerticalPartitions: Int = 1
+ val maxVerticalPartitions: Int = 1,
+ val excludedBounds: List<Rect> = emptyList()
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -175,26 +181,23 @@
* between panes ([innerVertical] and [innerHorizontal]) and paddings of the layout itself
* ([outerVertical] and [outerHorizontal]). Usually we will expect larger gutter sizes to be set
* when the layout is larger and more panes are shown in the layout.
+ *
+ * @constructor create an instance of [GutterSizes]
+ * @param outerVertical Size of the outer vertical gutters. It's similar to left/right paddings of
+ * a normal layout.
+ * @param innerVertical Size of the inner vertical gutters. It's similar to left/right margins of
+ * the layout's children.
+ * @param outerHorizontal Size of the outer horizontal gutters. It's similar to top/bottom paddings
+ * of a normal layout.
+ * @param innerHorizontal Size of the inner horizontal gutters. It's similar to top/bottom margins
+ * of the layout's children.
*/
+@ExperimentalMaterial3AdaptiveApi
@Immutable
class GutterSizes(
- /**
- * Size of the outer vertical gutters. It's similar to left/right paddings of a normal layout.
- */
val outerVertical: Dp,
- /**
- * Size of the inner vertical gutters. It's similar to left/right margins of the layout's
- * children.
- */
val innerVertical: Dp,
- /**
- * Size of the outer horizontal gutters. It's similar to top/bottom paddings of a normal layout.
- */
val outerHorizontal: Dp = outerVertical,
- /**
- * Size of the inner horizontal gutters. It's similar to top/bottom margins of the layout's
- * children.
- */
val innerHorizontal: Dp = innerVertical
) {
override fun equals(other: Any?): Boolean {
@@ -214,4 +217,4 @@
result = 31 * result + innerHorizontal.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi.kt
index eb78310..4636316 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi.kt
@@ -21,4 +21,4 @@
"removed in the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalMaterial3AdaptiveApi
\ No newline at end of file
+annotation class ExperimentalMaterial3AdaptiveApi
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/NavigationSuite.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/NavigationSuite.kt
index f9d5b6e..d74a22a 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/NavigationSuite.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/NavigationSuite.kt
@@ -20,14 +20,24 @@
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.material3.BadgedBox
+import androidx.compose.material3.DrawerDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
+import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
+import androidx.compose.material3.NavigationBarDefaults
import androidx.compose.material3.NavigationBarItem
+import androidx.compose.material3.NavigationBarItemColors
+import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.NavigationDrawerItem
+import androidx.compose.material3.NavigationDrawerItemColors
+import androidx.compose.material3.NavigationDrawerItemDefaults
import androidx.compose.material3.NavigationRail
+import androidx.compose.material3.NavigationRailDefaults
import androidx.compose.material3.NavigationRailItem
+import androidx.compose.material3.NavigationRailItemColors
+import androidx.compose.material3.NavigationRailItemDefaults
import androidx.compose.material3.PermanentDrawerSheet
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@@ -60,7 +70,7 @@
* @param containerColor the color used for the background of the navigation suite. Use
* [Color.Transparent] to have no color
* @param contentColor the preferred color for content inside the navigation suite. Defaults to
- * either the matching content color for [containerColor], or to the current LocalContentColor if
+ * either the matching content color for [containerColor], or to the current [LocalContentColor] if
* [containerColor] is not a color from the theme
* @param content the content of your screen
*
@@ -176,9 +186,12 @@
*
* @param adaptiveInfo the current [WindowAdaptiveInfo] of the [NavigationSuite]
* @param modifier the [Modifier] to be applied to the navigation component
+ * @params colors [NavigationSuiteColors] that will be used to determine the container (background)
+ * color of the navigation component and the preferred color for content inside the navigation
+ * component
* @param layoutTypeProvider the current [NavigationLayoutTypeProvider] of the [NavigationSuite]
* @param content the content inside the current navigation component, typically
- * [navigationSuiteItem]s
+ * [NavigationSuiteComponentScope.item]s
*
* TODO: Remove "internal".
*/
@@ -188,14 +201,18 @@
adaptiveInfo: WindowAdaptiveInfo,
modifier: Modifier = Modifier,
layoutTypeProvider: NavigationLayoutTypeProvider = NavigationSuiteDefaults.layoutTypeProvider,
- // TODO: Add container and content color params.
+ colors: NavigationSuiteColors = NavigationSuiteDefaults.colors(),
content: NavigationSuiteComponentScope.() -> Unit
) {
val scope by rememberStateOfItems(content)
when (layoutTypeProvider.calculateFromAdaptiveInfo(adaptiveInfo)) {
NavigationLayoutType.NavigationBar -> {
- NavigationBar(modifier = modifier) {
+ NavigationBar(
+ modifier = modifier,
+ containerColor = colors.navigationBarContainerColor,
+ contentColor = colors.navigationBarContentColor
+ ) {
scope.itemList.forEach {
NavigationBarItem(
modifier = it.modifier,
@@ -205,14 +222,20 @@
enabled = it.enabled,
label = it.label,
alwaysShowLabel = it.alwaysShowLabel,
- interactionSource = it.interactionSource()
+ colors = it.colors?.navigationBarItemColors
+ ?: NavigationBarItemDefaults.colors(),
+ interactionSource = it.interactionSource
)
}
}
}
NavigationLayoutType.NavigationRail -> {
- NavigationRail(modifier = modifier) {
+ NavigationRail(
+ modifier = modifier,
+ containerColor = colors.navigationRailContainerColor,
+ contentColor = colors.navigationRailContentColor
+ ) {
scope.itemList.forEach {
NavigationRailItem(
modifier = it.modifier,
@@ -222,14 +245,20 @@
enabled = it.enabled,
label = it.label,
alwaysShowLabel = it.alwaysShowLabel,
- interactionSource = it.interactionSource()
+ colors = it.colors?.navigationRailItemColors
+ ?: NavigationRailItemDefaults.colors(),
+ interactionSource = it.interactionSource
)
}
}
}
NavigationLayoutType.NavigationDrawer -> {
- PermanentDrawerSheet(modifier = modifier) {
+ PermanentDrawerSheet(
+ modifier = modifier,
+ drawerContainerColor = colors.navigationDrawerContainerColor,
+ drawerContentColor = colors.navigationDrawerContentColor
+ ) {
scope.itemList.forEach {
NavigationDrawerItem(
modifier = it.modifier,
@@ -238,7 +267,9 @@
icon = it.icon,
badge = it.badge,
label = { it.label?.invoke() ?: Text("") },
- interactionSource = it.interactionSource()
+ colors = it.colors?.navigationDrawerItemColors
+ ?: NavigationDrawerItemDefaults.colors(),
+ interactionSource = it.interactionSource
)
}
}
@@ -350,72 +381,43 @@
* TODO: Remove "internal".
*/
internal interface NavigationSuiteComponentScope {
+
/**
* This function sets the parameters of the default Material navigation item to be used with the
* Navigation Suite. The item is called in [NavigationSuiteComponent], according to the current
* [NavigationLayoutType].
+ *
+ * For specifics about each item component, see [NavigationBarItem], [NavigationRailItem], and
+ * [NavigationDrawerItem].
+ *
+ * @param selected whether this item is selected
+ * @param onClick called when this item is clicked
+ * @param icon icon for this item, typically an [Icon]
+ * @param modifier the [Modifier] to be applied to this item
+ * @param enabled controls the enabled state of this item. When `false`, this component will not
+ * respond to user input, and it will appear visually disabled and disabled to accessibility
+ * services. Note: as of now, for [NavigationDrawerItem], this is always `true`.
+ * @param label the text label for this item
+ * @param alwaysShowLabel whether to always show the label for this item. If `false`, the label will
+ * only be shown when this item is selected. Note: for [NavigationDrawerItem] this is always `true`
+ * @param badge optional badge to show on this item
+ * @param colors [NavigationSuiteItemColors] that will be used to resolve the colors used for this
+ * item in different states.
+ * @param interactionSource the [MutableInteractionSource] representing the stream of [Interaction]s
+ * for this item. You can create and pass in your own `remember`ed instance to observe
+ * [Interaction]s and customize the appearance / behavior of this item in different states
*/
fun item(
selected: Boolean,
onClick: () -> Unit,
icon: @Composable () -> Unit,
- modifier: Modifier,
- enabled: Boolean,
- label: @Composable (() -> Unit)?,
- alwaysShowLabel: Boolean,
- badge: (@Composable () -> Unit)?,
- // TODO: Add colors params.
- interactionSource: MutableInteractionSource?
- )
-}
-
-/**
- * This function sets the parameters of the default Material navigation item to be used with the
- * Navigation Suite. The item is called in [NavigationSuiteComponent], according to the current
- * [NavigationLayoutType].
- *
- * For specifics about each item component, see [NavigationBarItem], [NavigationRailItem], and
- * [NavigationDrawerItem].
- *
- * @param selected whether this item is selected
- * @param onClick called when this item is clicked
- * @param icon icon for this item, typically an [Icon]
- * @param modifier the [Modifier] to be applied to this item
- * @param enabled controls the enabled state of this item. When `false`, this component will not
- * respond to user input, and it will appear visually disabled and disabled to accessibility
- * services. Note: as of now, for [NavigationDrawerItem], this is always `true`.
- * @param label the text label for this item
- * @param alwaysShowLabel whether to always show the label for this item. If `false`, the label will
- * only be shown when this item is selected. Note: for [NavigationDrawerItem] this is always `true`
- * @param badge optional badge to show on this item
- * @param interactionSource the [MutableInteractionSource] representing the stream of [Interaction]s
- * for this item. You can create and pass in your own `remember`ed instance to observe
- * [Interaction]s and customize the appearance / behavior of this item in different states
- *
- * TODO: Remove "internal".
- */
-internal fun NavigationSuiteComponentScope.navigationSuiteItem(
- selected: Boolean,
- onClick: () -> Unit,
- icon: @Composable () -> Unit,
- modifier: Modifier = Modifier,
- enabled: Boolean = true,
- label: @Composable (() -> Unit)? = null,
- alwaysShowLabel: Boolean = true,
- badge: (@Composable () -> Unit)? = null,
- // TODO: Add colors params.
- interactionSource: MutableInteractionSource? = null
-) {
- item(
- selected = selected,
- onClick = onClick,
- icon = icon,
- modifier = modifier,
- enabled = enabled,
- label = label,
- badge = badge,
- alwaysShowLabel = alwaysShowLabel,
- interactionSource = interactionSource
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ label: @Composable (() -> Unit)? = null,
+ alwaysShowLabel: Boolean = true,
+ badge: (@Composable () -> Unit)? = null,
+ colors: NavigationSuiteItemColors? = null,
+ interactionSource: MutableInteractionSource = MutableInteractionSource()
)
}
@@ -442,23 +444,111 @@
*
* TODO: Remove "internal".
*/
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
internal object NavigationSuiteDefaults {
/** The default implementation of the [NavigationLayoutTypeProvider]. */
- @OptIn(ExperimentalMaterial3AdaptiveApi::class)
val layoutTypeProvider = NavigationLayoutTypeProvider { adaptiveInfo ->
with(adaptiveInfo) {
- if (posture.isTabletop || windowSizeClass.heightSizeClass == Compact) {
- NavigationLayoutType.NavigationBar
- } else if (windowSizeClass.widthSizeClass == Expanded) {
- NavigationLayoutType.NavigationRail
- } else {
- NavigationLayoutType.NavigationBar
- }
+ if (posture.isTabletop || windowSizeClass.heightSizeClass == Compact) {
+ NavigationLayoutType.NavigationBar
+ } else if (windowSizeClass.widthSizeClass == Expanded) {
+ NavigationLayoutType.NavigationRail
+ } else {
+ NavigationLayoutType.NavigationBar
}
+ }
}
+
+ /**
+ * Creates a [NavigationSuiteColors] with the provided colors for the container color, according
+ * to the Material specification.
+ *
+ * Use [Color.Transparent] for the navigation*ContainerColor to have no color. The
+ * navigation*ContentColor will default to either the matching content color for
+ * navigation*ContainerColor, or to the current [LocalContentColor] if navigation*ContainerColor
+ * is not a color from the theme.
+ *
+ * @param navigationBarContainerColor the default container color for the [NavigationBar]
+ * @param navigationBarContentColor the default content color for the [NavigationBar]
+ * @param navigationRailContainerColor the default container color for the [NavigationRail]
+ * @param navigationRailContentColor the default content color for the [NavigationRail]
+ * @param navigationDrawerContainerColor the default container color for the
+ * [PermanentDrawerSheet]
+ * @param navigationDrawerContentColor the default content color for the [PermanentDrawerSheet]
+ */
+ @Composable
+ fun colors(
+ navigationBarContainerColor: Color = NavigationBarDefaults.containerColor,
+ navigationBarContentColor: Color = contentColorFor(navigationBarContainerColor),
+ navigationRailContainerColor: Color = NavigationRailDefaults.ContainerColor,
+ navigationRailContentColor: Color = contentColorFor(navigationRailContainerColor),
+ navigationDrawerContainerColor: Color = DrawerDefaults.containerColor,
+ navigationDrawerContentColor: Color = contentColorFor(navigationDrawerContainerColor),
+ ): NavigationSuiteColors =
+ NavigationSuiteColors(
+ navigationBarContainerColor = navigationBarContainerColor,
+ navigationBarContentColor = navigationBarContentColor,
+ navigationRailContainerColor = navigationRailContainerColor,
+ navigationRailContentColor = navigationRailContentColor,
+ navigationDrawerContainerColor = navigationDrawerContainerColor,
+ navigationDrawerContentColor = navigationDrawerContentColor
+ )
}
+/**
+ * Represents the colors of a [NavigationSuiteComponent].
+ *
+ * For specifics about each navigation component colors see [NavigationBarDefaults],
+ * [NavigationRailDefaults], and [DrawerDefaults].
+ *
+ * @param navigationBarContainerColor the container color for the [NavigationBar] of the
+ * [NavigationSuiteComponent]
+ * @param navigationBarContentColor the content color for the [NavigationBar] of the
+ * [NavigationSuiteComponent]
+ * @param navigationRailContainerColor the container color for the [NavigationRail] of the
+ * [NavigationSuiteComponent]
+ * @param navigationRailContentColor the content color for the [NavigationRail] of the
+ * [NavigationSuiteComponent]
+ * @param navigationDrawerContainerColor the container color for the [PermanentDrawerSheet] of the
+ * [NavigationSuiteComponent]
+ * @param navigationDrawerContentColor the content color for the [PermanentDrawerSheet] of the
+ * [NavigationSuiteComponent]
+ *
+ * TODO: Remove "internal".
+ */
+internal class NavigationSuiteColors
+internal constructor(
+ val navigationBarContainerColor: Color,
+ val navigationBarContentColor: Color,
+ val navigationRailContainerColor: Color,
+ val navigationRailContentColor: Color,
+ val navigationDrawerContainerColor: Color,
+ val navigationDrawerContentColor: Color
+)
+
+/**
+ * Represents the colors of a [NavigationSuiteComponentScope.item].
+ *
+ * For specifics about each navigation item colors see [NavigationBarItemColors],
+ * [NavigationRailItemColors], and [NavigationDrawerItemColors].
+ *
+ * @param navigationBarItemColors the [NavigationBarItemColors] associated with the
+ * [NavigationBarItem] of the [NavigationSuiteComponentScope.item]
+ * @param navigationRailItemColors the [NavigationRailItemColors] associated with the
+ * [NavigationRailItem] of the [NavigationSuiteComponentScope.item]
+ * @param navigationDrawerItemColors the [NavigationDrawerItemColors] associated with the
+ * [NavigationDrawerItem] of the [NavigationSuiteComponentScope.item]
+ *
+ * TODO: Remove "internal".
+ */
+internal class NavigationSuiteItemColors
+internal constructor(
+ val navigationBarItemColors: NavigationBarItemColors,
+ val navigationRailItemColors: NavigationRailItemColors,
+ val navigationDrawerItemColors: NavigationDrawerItemColors,
+)
+
private interface NavigationSuiteItemProvider {
val itemsCount: Int
val itemList: MutableVector<NavigationSuiteItem>
@@ -473,15 +563,9 @@
val label: @Composable (() -> Unit)?,
val alwaysShowLabel: Boolean,
val badge: (@Composable () -> Unit)?,
- // TODO: Add colors params.
- val interactionSource: MutableInteractionSource?
-) {
-
- @Composable
- fun interactionSource(): MutableInteractionSource {
- return interactionSource ?: remember { MutableInteractionSource() }
- }
-}
+ val colors: NavigationSuiteItemColors?,
+ val interactionSource: MutableInteractionSource
+)
private class NavigationSuiteComponentScopeImpl : NavigationSuiteComponentScope,
NavigationSuiteItemProvider {
@@ -495,20 +579,23 @@
label: @Composable (() -> Unit)?,
alwaysShowLabel: Boolean,
badge: (@Composable () -> Unit)?,
- // TODO: Add colors params.
- interactionSource: MutableInteractionSource?
+ colors: NavigationSuiteItemColors?,
+ interactionSource: MutableInteractionSource
) {
- itemList.add(NavigationSuiteItem(
- selected = selected,
- onClick = onClick,
- icon = icon,
- modifier = modifier,
- enabled = enabled,
- label = label,
- alwaysShowLabel = alwaysShowLabel,
- badge = badge,
- interactionSource = interactionSource
- ))
+ itemList.add(
+ NavigationSuiteItem(
+ selected = selected,
+ onClick = onClick,
+ icon = icon,
+ modifier = modifier,
+ enabled = enabled,
+ label = label,
+ alwaysShowLabel = alwaysShowLabel,
+ badge = badge,
+ colors = colors,
+ interactionSource = interactionSource
+ )
+ )
}
override val itemList: MutableVector<NavigationSuiteItem> = mutableVectorOf()
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneAdaptedValue.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneAdaptedValue.kt
index 8254fe1..5d21a80 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneAdaptedValue.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneAdaptedValue.kt
@@ -33,4 +33,4 @@
*/
val Hidden = PaneAdaptedValue("Hidden")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneScaffold.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneScaffold.kt
index 4e1658b..6832d50 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneScaffold.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/PaneScaffold.kt
@@ -38,7 +38,7 @@
}
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
-private object PaneScaffoldScopeInstance : PaneScaffoldScope {
+internal abstract class PaneScaffoldScopeImpl : PaneScaffoldScope {
override fun Modifier.preferredWidth(width: Dp): Modifier {
require(width == Dp.Unspecified || width > 0.dp) { "invalid width" }
return this.then(PreferredWidthElement(width))
@@ -83,6 +83,6 @@
}
}
-private data class PaneScaffoldParentData(
- var preferredWidth: Float = Float.NaN,
+internal data class PaneScaffoldParentData(
+ var preferredWidth: Float? = null,
)
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/Posture.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/Posture.kt
index 1e7c87e..3554e7b 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/Posture.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/Posture.kt
@@ -24,32 +24,27 @@
* the hinge area. We suggest to use [calculatePosture] to retrieve instances of this class in
* applications, unless you have a strong need of customization that cannot be fulfilled by the
* default implementation.
+ *
+ * @constructor create an instance of [Posture]
+ * @param hasVerticalHinge `true` if at least one vertical hinge is present in the middle of
+ * the current window. When this is `true`, it means the current window is separated into
+ * multiple partitions along the horizontal axis and developers may consider separating
+ * the layout into multiple partitions accordingly.
+ * @param isTabletop `true` if the current window is considered as in the table top mode, i.e. there
+ * is one half-opened horizontal hinge in the middle of the current window. When this is
+ * `true` it usually means it's hard for users to interact with the window area around
+ * the hinge and developers may consider separating the layout along the hinge and show
+ * software keyboard or other controls in the bottom half of the window.
+ * @param hasSeparatingHinge `true` if at least one hinge present in the current window is
+ * separating, i.e., content cannot be displayed on the hinge area. When this is `true`
+ * developer may want to avoid showing anything around the hinge area because the content
+ * will be cut or not visible.
*/
@ExperimentalMaterial3AdaptiveApi
@Immutable
class Posture(
- /**
- * `true` if at least one vertical hinge is present in the middle of the current window. When
- * this is `true`, it means the current window is separated into multiple partitions along the
- * horizontal axis and developers may consider separating the layout into multiple partitions
- * accordingly.
- */
val hasVerticalHinge: Boolean = false,
-
- /**
- * `true` if the current window is considered as in the table top mode, i.e. there is
- * one half-opened horizontal hinge in the middle of the current window. When this is `true` it
- * usually means it's hard for users to interact with the window area around the hinge and
- * developers may consider separating the layout along the hinge and show software keyboard or
- * other controls in the bottom half of the window.
- */
val isTabletop: Boolean = false,
-
- /**
- * `true` if at least one hinge present in the current window is separating, i.e., content
- * cannot be displayed on the hinge area. When this is `true` developer may want to avoid
- * showing anything around the hinge area because the content will be cut or not visible.
- */
val hasSeparatingHinge: Boolean = false
) {
override fun equals(other: Any?): Boolean {
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffold.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffold.kt
index 3ef3860..d4ef1cb 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffold.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffold.kt
@@ -17,12 +17,281 @@
package androidx.compose.material3.adaptive
import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.layout.Layout
+import androidx.compose.ui.layout.Measurable
+import androidx.compose.ui.layout.Placeable
+import androidx.compose.ui.layout.boundsInWindow
+import androidx.compose.ui.unit.Constraints
+import androidx.compose.ui.unit.IntRect
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.roundToIntRect
+import androidx.compose.ui.util.fastForEach
+import kotlin.math.max
+import kotlin.math.min
+/**
+ * A pane scaffold composable that can display up to three panes according to the instructions
+ * provided by [ThreePaneScaffoldValue] in the order that [ThreePaneScaffoldArrangement] specifies,
+ * and allocate margins and spacers according to [AdaptiveLayoutDirective].
+ *
+ * [ThreePaneScaffold] is the base composable functions of adaptive programming. Developers can
+ * freely pipeline the relevant adaptive signals and use them as input of the scaffold function
+ * to render the final adaptive layout.
+ *
+ * It's recommended to use [ThreePaneScaffold] with [calculateStandardAdaptiveLayoutDirective],
+ * [calculateThreePaneScaffoldValue] to follow the Material design guidelines on adaptive
+ * programming.
+ *
+ * @param modifier The modifier to be applied to the layout.
+ * @param layoutDirective The top-level directives about how the scaffold should arrange its panes.
+ * @param scaffoldValue The current adapted value of the scaffold.
+ * @param arrangement The arrangement of the panes in the scaffold.
+ * @param secondaryPane The content of the secondary pane that has a priority lower then the primary
+ * pane but higher than the tertiary pane.
+ * @param tertiaryPane The content of the tertiary pane that has the lowest priority.
+ * @param primaryPane The content of the primary pane that has the highest priority.
+ */
+@ExperimentalMaterial3AdaptiveApi
@Composable
-internal fun ThreePaneScaffold() {
- // TODO(conradchen): implement the actual func
+fun ThreePaneScaffold(
+ modifier: Modifier,
+ layoutDirective: AdaptiveLayoutDirective,
+ scaffoldValue: ThreePaneScaffoldValue,
+ arrangement: ThreePaneScaffoldArrangement,
+ secondaryPane: @Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit,
+ tertiaryPane: (@Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit)? = null,
+ primaryPane: @Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit
+) {
+ val contents = listOf<@Composable () -> Unit>(
+ { PaneWrapper(scaffoldValue[ThreePaneScaffoldRole.Primary], primaryPane) },
+ { PaneWrapper(scaffoldValue[ThreePaneScaffoldRole.Secondary], secondaryPane) },
+ { PaneWrapper(scaffoldValue[ThreePaneScaffoldRole.Tertiary], tertiaryPane) },
+ )
+
+ Layout(
+ contents = contents,
+ modifier = modifier,
+ ) { (primaryMeasurables, secondaryMeasurables, tertiaryMeasurables), constraints ->
+ layout(constraints.maxWidth, constraints.maxHeight) {
+ if (coordinates == null) {
+ return@layout
+ }
+ val paneMeasurables = buildList {
+ arrangement.forEach { role ->
+ when (role) {
+ ThreePaneScaffoldRole.Primary -> {
+ createPaneMeasurableIfNeeded(
+ primaryMeasurables,
+ ThreePaneScaffoldDefaults.PrimaryPanePriority,
+ ThreePaneScaffoldDefaults.PrimaryPanePreferredWidth.roundToPx()
+ )
+ }
+ ThreePaneScaffoldRole.Secondary -> {
+ createPaneMeasurableIfNeeded(
+ secondaryMeasurables,
+ ThreePaneScaffoldDefaults.SecondaryPanePriority,
+ ThreePaneScaffoldDefaults.SecondaryPanePreferredWidth.roundToPx()
+ )
+ }
+ ThreePaneScaffoldRole.Tertiary -> {
+ createPaneMeasurableIfNeeded(
+ tertiaryMeasurables,
+ ThreePaneScaffoldDefaults.TertiaryPanePriority,
+ ThreePaneScaffoldDefaults.TertiaryPanePreferredWidth.roundToPx()
+ )
+ }
+ }
+ }
+ }
+
+ val outerVerticalGutterSize = layoutDirective.gutterSizes.outerVertical.roundToPx()
+ val innerVerticalGutterSize = layoutDirective.gutterSizes.innerVertical.roundToPx()
+ val outerHorizontalGutterSize = layoutDirective.gutterSizes.outerHorizontal.roundToPx()
+
+ if (layoutDirective.excludedBounds.isNotEmpty()) {
+ val layoutBounds = coordinates!!.boundsInWindow()
+ val layoutPhysicalPartitions = mutableListOf<Rect>()
+ var actualLeft = layoutBounds.left + outerVerticalGutterSize
+ var actualRight = layoutBounds.right - outerVerticalGutterSize
+ // Assume hinge bounds are sorted from left to right, non-overlapped.
+ layoutDirective.excludedBounds.fastForEach { hingeBound ->
+ if (hingeBound.left <= actualLeft) {
+ // The hinge is at the left of the layout, adjust the left edge of
+ // the current partition to the actual displayable bounds.
+ actualLeft = max(actualLeft, hingeBound.right)
+ } else if (hingeBound.right >= actualRight) {
+ // The hinge is right at the right of the layout and there's no more room
+ // for more partitions, adjust the right edge of the current partition to
+ // the actual displayable bounds.
+ actualRight = min(hingeBound.left, actualRight)
+ return@fastForEach
+ } else {
+ // The hinge is inside the layout, add the current partition to the list and
+ // move the left edge of the next partition to the right of the hinge.
+ layoutPhysicalPartitions.add(
+ Rect(actualLeft, layoutBounds.top, hingeBound.left, layoutBounds.bottom)
+ )
+ actualLeft +=
+ max(hingeBound.right, hingeBound.left + innerVerticalGutterSize)
+ }
+ }
+ if (actualLeft < actualRight) {
+ // The last partition
+ layoutPhysicalPartitions.add(
+ Rect(actualLeft, layoutBounds.top, actualRight, layoutBounds.bottom)
+ )
+ }
+ if (layoutPhysicalPartitions.size == 1) {
+ measureAndPlacePanes(
+ layoutPhysicalPartitions[0],
+ innerVerticalGutterSize,
+ paneMeasurables
+ )
+ } else if (layoutPhysicalPartitions.size < paneMeasurables.size) {
+ // Note that the only possible situation is we have only two physical partitions
+ // but three expanded panes to show. In this case fit two panes in the larger
+ // partition.
+ if (layoutPhysicalPartitions[0].width > layoutPhysicalPartitions[1].width) {
+ measureAndPlacePanes(
+ layoutPhysicalPartitions[0],
+ innerVerticalGutterSize,
+ paneMeasurables.subList(0, 2)
+ )
+ measureAndPlacePane(layoutPhysicalPartitions[1], paneMeasurables[2])
+ } else {
+ measureAndPlacePane(layoutPhysicalPartitions[0], paneMeasurables[0])
+ measureAndPlacePanes(
+ layoutPhysicalPartitions[1],
+ innerVerticalGutterSize,
+ paneMeasurables.subList(1, 3)
+ )
+ }
+ } else {
+ // Layout each pane in a physical partition
+ paneMeasurables.forEachIndexed { index, paneMeasurable ->
+ measureAndPlacePane(layoutPhysicalPartitions[index], paneMeasurable)
+ }
+ }
+ } else {
+ measureAndPlacePanesWithLocalBounds(
+ IntRect(
+ outerVerticalGutterSize,
+ outerHorizontalGutterSize,
+ constraints.maxWidth - outerVerticalGutterSize,
+ constraints.maxHeight - outerHorizontalGutterSize),
+ innerVerticalGutterSize,
+ paneMeasurables
+ )
+ }
+ }
+ }
}
+@ExperimentalMaterial3AdaptiveApi
+@Composable
+private fun PaneWrapper(
+ adaptedValue: PaneAdaptedValue,
+ pane: (@Composable ThreePaneScaffoldScope.(PaneAdaptedValue) -> Unit)?
+) {
+ if (adaptedValue != PaneAdaptedValue.Hidden) {
+ pane?.invoke(ThreePaneScaffoldScopeImpl, adaptedValue)
+ }
+}
+
+private fun MutableList<PaneMeasurable>.createPaneMeasurableIfNeeded(
+ measurables: List<Measurable>,
+ priority: Int,
+ defaultPreferredWidth: Int
+) {
+ if (measurables.isNotEmpty()) {
+ add(PaneMeasurable(measurables[0], priority, defaultPreferredWidth))
+ }
+}
+private fun Placeable.PlacementScope.measureAndPlacePane(
+ partitionBounds: Rect,
+ measurable: PaneMeasurable
+) {
+ val localBounds = getLocalBounds(partitionBounds)
+ measurable.measuredWidth = localBounds.width
+ measurable.apply {
+ measure(Constraints.fixed(measuredWidth, localBounds.height))
+ .place(localBounds.left, localBounds.top)
+ }
+}
+
+private fun Placeable.PlacementScope.measureAndPlacePanes(
+ partitionBounds: Rect,
+ spacerSize: Int,
+ measurables: List<PaneMeasurable>
+) {
+ measureAndPlacePanesWithLocalBounds(
+ getLocalBounds(partitionBounds),
+ spacerSize,
+ measurables
+ )
+}
+
+private fun Placeable.PlacementScope.measureAndPlacePanesWithLocalBounds(
+ partitionBounds: IntRect,
+ spacerSize: Int,
+ measurables: List<PaneMeasurable>
+) {
+ if (measurables.isEmpty()) {
+ return
+ }
+ val allocatableWidth = partitionBounds.width - (measurables.size - 1) * spacerSize
+ val totalPreferredWidth = measurables.sumOf { it.measuredWidth }
+ if (allocatableWidth > totalPreferredWidth) {
+ // Allocate the remaining space to the pane with the highest priority.
+ measurables.maxBy {
+ it.priority
+ }.measuredWidth += allocatableWidth - totalPreferredWidth
+ } else if (allocatableWidth < totalPreferredWidth) {
+ // Scale down all panes to fit in the available space.
+ val scale = allocatableWidth / totalPreferredWidth
+ measurables.forEach {
+ it.measuredWidth *= scale
+ }
+ }
+ val spacerSizeInt = spacerSize.toInt()
+ var positionX = partitionBounds.left
+ measurables.forEach {
+ it.measure(Constraints.fixed(it.measuredWidth, partitionBounds.height))
+ .place(positionX, partitionBounds.top)
+ positionX += it.measuredWidth + spacerSizeInt
+ }
+}
+
+private fun Placeable.PlacementScope.getLocalBounds(bounds: Rect): IntRect {
+ return bounds.translate(coordinates!!.localToWindow(Offset.Zero)).roundToIntRect()
+}
+
+private class PaneMeasurable(
+ val measurable: Measurable,
+ val priority: Int,
+ defaultPreferredWidth: Int
+) : Measurable by measurable {
+ private val data = ((parentData as? PaneScaffoldParentData) ?: PaneScaffoldParentData())
+
+ // TODO(conradchen): Handle the case of a low priority pane with no preferred with
+ var measuredWidth = when (data.preferredWidth) {
+ null -> defaultPreferredWidth
+ Float.NaN -> 0
+ else -> data.preferredWidth!!.toInt()
+ }
+}
+
+/**
+ * Scope for the panes of [ThreePaneScaffold].
+ */
+@OptIn(ExperimentalMaterial3AdaptiveApi::class)
+interface ThreePaneScaffoldScope : PaneScaffoldScope
+
+private object ThreePaneScaffoldScopeImpl : ThreePaneScaffoldScope, PaneScaffoldScopeImpl()
+
/**
* Provides default values of [ThreePaneScaffold] and the calculation functions of
* [ThreePaneScaffoldValue].
@@ -39,6 +308,16 @@
ThreePaneScaffoldRole.Tertiary
)
+ // TODO(conradchen): confirm with designers before we make these values public
+ internal val PrimaryPanePreferredWidth = 360.dp
+ internal val SecondaryPanePreferredWidth = 360.dp
+ internal val TertiaryPanePreferredWidth = 360.dp
+
+ // TODO(conradchen): consider declaring a value class for priority
+ internal const val PrimaryPanePriority = 10
+ internal const val SecondaryPanePriority = 5
+ internal const val TertiaryPanePriority = 1
+
/**
* Creates a default [ThreePaneScaffoldAdaptStrategies].
*
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldAdaptStrategies.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldAdaptStrategies.kt
index 7b3360c..b0f43b1 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldAdaptStrategies.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldAdaptStrategies.kt
@@ -21,6 +21,7 @@
* [ThreePaneScaffold] should be adapted. It should be used as an input parameter of
* [calculateThreePaneScaffoldValue] to decide the [ThreePaneScaffoldValue].
*
+ * @constructor create an instance of [ThreePaneScaffoldAdaptStrategies]
* @param primaryPaneAdaptStrategy [AdaptStrategy] of the primary pane of [ThreePaneScaffold]
* @param secondaryPaneAdaptStrategy [AdaptStrategy] of the secondary pane of [ThreePaneScaffold]
* @param tertiaryPaneAdaptStrategy [AdaptStrategy] of the tertiary pane of [ThreePaneScaffold]
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldArrangement.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldArrangement.kt
index eb42e5e..51e8642 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldArrangement.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldArrangement.kt
@@ -23,6 +23,7 @@
* [firstPane], [secondPane] and [thirdPane] have to be different, otherwise
* [IllegalArgumentException] will be thrown.
*
+ * @constructor create an instance of [ThreePaneScaffoldArrangement]
* @param firstPane The first pane from the start of the [ThreePaneScaffold]
* @param secondPane The second pane from the start of the [ThreePaneScaffold]
* @param thirdPane The third pane from the start of the [ThreePaneScaffold]
@@ -58,6 +59,22 @@
}
}
+@ExperimentalMaterial3AdaptiveApi
+internal inline fun ThreePaneScaffoldArrangement.forEach(action: (ThreePaneScaffoldRole) -> Unit) {
+ action(firstPane)
+ action(secondPane)
+ action(thirdPane)
+}
+
+@ExperimentalMaterial3AdaptiveApi
+internal inline fun ThreePaneScaffoldArrangement.forEachIndexed(
+ action: (Int, ThreePaneScaffoldRole) -> Unit
+) {
+ action(0, firstPane)
+ action(1, secondPane)
+ action(2, thirdPane)
+}
+
/**
* The set of the available pane roles of [ThreePaneScaffold].
*/
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldValue.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldValue.kt
index c979682..66b6f06 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldValue.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/ThreePaneScaffoldValue.kt
@@ -79,6 +79,7 @@
* For a Material-opinionated layout, it's suggested to use [calculateThreePaneScaffoldValue] to
* calculate the current scaffold value.
*
+ * @constructor create an instance of [ThreePaneScaffoldValue]
* @param primary [PaneAdaptedValue] of the primary pane of [ThreePaneScaffold]
* @param secondary [PaneAdaptedValue] of the secondary pane of [ThreePaneScaffold]
* @param tertiary [PaneAdaptedValue] of the tertiary pane of [ThreePaneScaffold]
diff --git a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowAdaptiveInfo.kt b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowAdaptiveInfo.kt
index 57f24cb..cc76985 100644
--- a/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowAdaptiveInfo.kt
+++ b/compose/material3/material3-adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowAdaptiveInfo.kt
@@ -22,13 +22,15 @@
/**
* This class collects window info that affects adaptation decisions. An adaptive layout is supposed
* to use the info from this class to decide how the layout is supposed to be adapted.
+ *
+ * @constructor create an instance of [WindowAdaptiveInfo]
+ * @param windowSizeClass [WindowSizeClass] of the current window.
+ * @param posture [Posture] of the current window.
*/
@ExperimentalMaterial3AdaptiveApi
@Immutable
class WindowAdaptiveInfo(
- /** [WindowSizeClass] of the current window. */
val windowSizeClass: WindowSizeClass,
- /** [Posture] of the current window. */
val posture: Posture
) {
override fun equals(other: Any?): Boolean {
diff --git a/compose/material3/material3-lint/src/main/java/androidx/compose/material3/lint/ScaffoldPaddingDetector.kt b/compose/material3/material3-lint/src/main/java/androidx/compose/material3/lint/ScaffoldPaddingDetector.kt
index eba6ffd..6071065 100644
--- a/compose/material3/material3-lint/src/main/java/androidx/compose/material3/lint/ScaffoldPaddingDetector.kt
+++ b/compose/material3/material3-lint/src/main/java/androidx/compose/material3/lint/ScaffoldPaddingDetector.kt
@@ -86,4 +86,4 @@
}
}
-private val Scaffold = Name(Material3.PackageName, "Scaffold")
\ No newline at end of file
+private val Scaffold = Name(Material3.PackageName, "Scaffold")
diff --git a/compose/material3/material3-window-size-class/build.gradle b/compose/material3/material3-window-size-class/build.gradle
index 4d4f79c..76cbc23 100644
--- a/compose/material3/material3-window-size-class/build.gradle
+++ b/compose/material3/material3-window-size-class/build.gradle
@@ -114,7 +114,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
diff --git a/compose/material3/material3-window-size-class/src/androidAndroidTest/kotlin/androidx/compose/material3/windowsizeclass/AndroidWindowSizeClassTest.kt b/compose/material3/material3-window-size-class/src/androidAndroidTest/kotlin/androidx/compose/material3/windowsizeclass/AndroidWindowSizeClassTest.kt
index f5b837a..c72fcfa 100644
--- a/compose/material3/material3-window-size-class/src/androidAndroidTest/kotlin/androidx/compose/material3/windowsizeclass/AndroidWindowSizeClassTest.kt
+++ b/compose/material3/material3-window-size-class/src/androidAndroidTest/kotlin/androidx/compose/material3/windowsizeclass/AndroidWindowSizeClassTest.kt
@@ -117,4 +117,4 @@
val bounds = getWindowBounds()
return DpSize(bounds.width().toDp(), bounds.height().toDp())
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/ExperimentalMaterial3WindowSizeClassApi.kt b/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/ExperimentalMaterial3WindowSizeClassApi.kt
index 8f405e8..8a4148e 100644
--- a/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/ExperimentalMaterial3WindowSizeClassApi.kt
+++ b/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/ExperimentalMaterial3WindowSizeClassApi.kt
@@ -21,4 +21,4 @@
"be removed in the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalMaterial3WindowSizeClassApi
\ No newline at end of file
+annotation class ExperimentalMaterial3WindowSizeClassApi
diff --git a/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.kt b/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.kt
index 2f09358..9fb1865 100644
--- a/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.kt
+++ b/compose/material3/material3-window-size-class/src/commonMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.kt
@@ -17,4 +17,4 @@
package androidx.compose.material3.windowsizeclass
@MustBeDocumented
-expect annotation class TestOnly()
\ No newline at end of file
+expect annotation class TestOnly()
diff --git a/compose/material3/material3-window-size-class/src/jvmMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.jvm.kt b/compose/material3/material3-window-size-class/src/jvmMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.jvm.kt
index e8960b7..21f4dcb 100644
--- a/compose/material3/material3-window-size-class/src/jvmMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.jvm.kt
+++ b/compose/material3/material3-window-size-class/src/jvmMain/kotlin/androidx/compose/material3/windowsizeclass/TestOnly.jvm.kt
@@ -16,4 +16,4 @@
package androidx.compose.material3.windowsizeclass
-internal actual typealias TestOnly = org.jetbrains.annotations.TestOnly
\ No newline at end of file
+internal actual typealias TestOnly = org.jetbrains.annotations.TestOnly
diff --git a/compose/material3/material3-window-size-class/src/test/kotlin/androidx/compose/material3/windowsizeclass/WindowSizeClassTest.kt b/compose/material3/material3-window-size-class/src/test/kotlin/androidx/compose/material3/windowsizeclass/WindowSizeClassTest.kt
index e7619ee..a8ab1c1 100644
--- a/compose/material3/material3-window-size-class/src/test/kotlin/androidx/compose/material3/windowsizeclass/WindowSizeClassTest.kt
+++ b/compose/material3/material3-window-size-class/src/test/kotlin/androidx/compose/material3/windowsizeclass/WindowSizeClassTest.kt
@@ -363,4 +363,4 @@
companion object {
private val DefaultDensity = Density(1F, 1F)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/api/current.txt b/compose/material3/material3/api/current.txt
index 3f6cc31..227827f 100644
--- a/compose/material3/material3/api/current.txt
+++ b/compose/material3/material3/api/current.txt
@@ -907,6 +907,9 @@
method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static androidx.compose.material3.SheetState rememberModalBottomSheetState(optional boolean skipPartiallyExpanded, optional kotlin.jvm.functions.Function1<? super androidx.compose.material3.SheetValue,java.lang.Boolean> confirmValueChange);
}
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public interface MultiChoiceSegmentedButtonRowScope extends androidx.compose.foundation.layout.RowScope {
+ }
+
public final class NavigationBarDefaults {
method @androidx.compose.runtime.Composable public long getContainerColor();
method public float getElevation();
@@ -1179,35 +1182,37 @@
}
@SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Immutable public final class SegmentedButtonColors {
- ctor public SegmentedButtonColors(long checkedContainerColor, long checkedContentColor, long checkedBorderColor, long uncheckedContainerColor, long uncheckedContentColor, long uncheckedBorderColor, long disabledCheckedContainerColor, long disabledCheckedContentColor, long disabledCheckedBorderColor, long disabledUncheckedContainerColor, long disabledUncheckedContentColor, long disabledUncheckedBorderColor);
- method public long getCheckedBorderColor();
- method public long getCheckedContainerColor();
- method public long getCheckedContentColor();
- method public long getDisabledCheckedBorderColor();
- method public long getDisabledCheckedContainerColor();
- method public long getDisabledCheckedContentColor();
- method public long getDisabledUncheckedBorderColor();
- method public long getDisabledUncheckedContainerColor();
- method public long getDisabledUncheckedContentColor();
- method public long getUncheckedBorderColor();
- method public long getUncheckedContainerColor();
- method public long getUncheckedContentColor();
- property public final long checkedBorderColor;
- property public final long checkedContainerColor;
- property public final long checkedContentColor;
- property public final long disabledCheckedBorderColor;
- property public final long disabledCheckedContainerColor;
- property public final long disabledCheckedContentColor;
- property public final long disabledUncheckedBorderColor;
- property public final long disabledUncheckedContainerColor;
- property public final long disabledUncheckedContentColor;
- property public final long uncheckedBorderColor;
- property public final long uncheckedContainerColor;
- property public final long uncheckedContentColor;
+ ctor public SegmentedButtonColors(long activeContainerColor, long activeContentColor, long activeBorderColor, long inactiveContainerColor, long inactiveContentColor, long inactiveBorderColor, long disabledActiveContainerColor, long disabledActiveContentColor, long disabledActiveBorderColor, long disabledInactiveContainerColor, long disabledInactiveContentColor, long disabledInactiveBorderColor);
+ method public long getActiveBorderColor();
+ method public long getActiveContainerColor();
+ method public long getActiveContentColor();
+ method public long getDisabledActiveBorderColor();
+ method public long getDisabledActiveContainerColor();
+ method public long getDisabledActiveContentColor();
+ method public long getDisabledInactiveBorderColor();
+ method public long getDisabledInactiveContainerColor();
+ method public long getDisabledInactiveContentColor();
+ method public long getInactiveBorderColor();
+ method public long getInactiveContainerColor();
+ method public long getInactiveContentColor();
+ property public final long activeBorderColor;
+ property public final long activeContainerColor;
+ property public final long activeContentColor;
+ property public final long disabledActiveBorderColor;
+ property public final long disabledActiveContainerColor;
+ property public final long disabledActiveContentColor;
+ property public final long disabledInactiveBorderColor;
+ property public final long disabledInactiveContainerColor;
+ property public final long disabledInactiveContentColor;
+ property public final long inactiveBorderColor;
+ property public final long inactiveContainerColor;
+ property public final long inactiveContentColor;
}
- @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public final class SegmentedButtonDefaults {
- method @androidx.compose.runtime.Composable public androidx.compose.material3.SegmentedButtonColors colors(optional long checkedContainerColor, optional long checkedContentColor, optional long checkedBorderColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long uncheckedBorderColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledCheckedBorderColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor, optional long disabledUncheckedBorderColor);
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Stable public final class SegmentedButtonDefaults {
+ method @androidx.compose.runtime.Composable public void ActiveIcon();
+ method @androidx.compose.runtime.Composable public void SegmentedButtonIcon(boolean active, optional kotlin.jvm.functions.Function0<kotlin.Unit> activeContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? inactiveContent);
+ method @androidx.compose.runtime.Composable public androidx.compose.material3.SegmentedButtonColors colors(optional long activeContainerColor, optional long activeContentColor, optional long activeBorderColor, optional long inactiveContainerColor, optional long inactiveContentColor, optional long inactiveBorderColor, optional long disabledActiveContainerColor, optional long disabledActiveContentColor, optional long disabledActiveBorderColor, optional long disabledInactiveContainerColor, optional long disabledInactiveContentColor, optional long disabledInactiveBorderColor);
method public androidx.compose.material3.SegmentedButtonBorder getBorder();
method public float getIconSize();
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.compose.foundation.shape.CornerBasedShape getShape();
@@ -1219,8 +1224,10 @@
}
public final class SegmentedButtonKt {
- method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
- method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void MultiChoiceSegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function1<? super androidx.compose.material3.MultiChoiceSegmentedButtonRowScope,kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(androidx.compose.material3.MultiChoiceSegmentedButtonRowScope, boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional kotlin.jvm.functions.Function0<kotlin.Unit> icon, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(androidx.compose.material3.SingleChoiceSegmentedButtonRowScope, boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional kotlin.jvm.functions.Function0<kotlin.Unit> icon, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SingleChoiceSegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function1<? super androidx.compose.material3.SingleChoiceSegmentedButtonRowScope,kotlin.Unit> content);
}
@SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Immutable public final class SelectableChipBorder {
@@ -1311,6 +1318,9 @@
enum_constant public static final androidx.compose.material3.SheetValue PartiallyExpanded;
}
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public interface SingleChoiceSegmentedButtonRowScope extends androidx.compose.foundation.layout.RowScope {
+ }
+
@androidx.compose.runtime.Immutable public final class SliderColors {
ctor public SliderColors(long thumbColor, long activeTrackColor, long activeTickColor, long inactiveTrackColor, long inactiveTickColor, long disabledThumbColor, long disabledActiveTrackColor, long disabledActiveTickColor, long disabledInactiveTrackColor, long disabledInactiveTickColor);
method public long getActiveTickColor();
diff --git a/compose/material3/material3/api/restricted_current.txt b/compose/material3/material3/api/restricted_current.txt
index 3f6cc31..227827f 100644
--- a/compose/material3/material3/api/restricted_current.txt
+++ b/compose/material3/material3/api/restricted_current.txt
@@ -907,6 +907,9 @@
method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static androidx.compose.material3.SheetState rememberModalBottomSheetState(optional boolean skipPartiallyExpanded, optional kotlin.jvm.functions.Function1<? super androidx.compose.material3.SheetValue,java.lang.Boolean> confirmValueChange);
}
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public interface MultiChoiceSegmentedButtonRowScope extends androidx.compose.foundation.layout.RowScope {
+ }
+
public final class NavigationBarDefaults {
method @androidx.compose.runtime.Composable public long getContainerColor();
method public float getElevation();
@@ -1179,35 +1182,37 @@
}
@SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Immutable public final class SegmentedButtonColors {
- ctor public SegmentedButtonColors(long checkedContainerColor, long checkedContentColor, long checkedBorderColor, long uncheckedContainerColor, long uncheckedContentColor, long uncheckedBorderColor, long disabledCheckedContainerColor, long disabledCheckedContentColor, long disabledCheckedBorderColor, long disabledUncheckedContainerColor, long disabledUncheckedContentColor, long disabledUncheckedBorderColor);
- method public long getCheckedBorderColor();
- method public long getCheckedContainerColor();
- method public long getCheckedContentColor();
- method public long getDisabledCheckedBorderColor();
- method public long getDisabledCheckedContainerColor();
- method public long getDisabledCheckedContentColor();
- method public long getDisabledUncheckedBorderColor();
- method public long getDisabledUncheckedContainerColor();
- method public long getDisabledUncheckedContentColor();
- method public long getUncheckedBorderColor();
- method public long getUncheckedContainerColor();
- method public long getUncheckedContentColor();
- property public final long checkedBorderColor;
- property public final long checkedContainerColor;
- property public final long checkedContentColor;
- property public final long disabledCheckedBorderColor;
- property public final long disabledCheckedContainerColor;
- property public final long disabledCheckedContentColor;
- property public final long disabledUncheckedBorderColor;
- property public final long disabledUncheckedContainerColor;
- property public final long disabledUncheckedContentColor;
- property public final long uncheckedBorderColor;
- property public final long uncheckedContainerColor;
- property public final long uncheckedContentColor;
+ ctor public SegmentedButtonColors(long activeContainerColor, long activeContentColor, long activeBorderColor, long inactiveContainerColor, long inactiveContentColor, long inactiveBorderColor, long disabledActiveContainerColor, long disabledActiveContentColor, long disabledActiveBorderColor, long disabledInactiveContainerColor, long disabledInactiveContentColor, long disabledInactiveBorderColor);
+ method public long getActiveBorderColor();
+ method public long getActiveContainerColor();
+ method public long getActiveContentColor();
+ method public long getDisabledActiveBorderColor();
+ method public long getDisabledActiveContainerColor();
+ method public long getDisabledActiveContentColor();
+ method public long getDisabledInactiveBorderColor();
+ method public long getDisabledInactiveContainerColor();
+ method public long getDisabledInactiveContentColor();
+ method public long getInactiveBorderColor();
+ method public long getInactiveContainerColor();
+ method public long getInactiveContentColor();
+ property public final long activeBorderColor;
+ property public final long activeContainerColor;
+ property public final long activeContentColor;
+ property public final long disabledActiveBorderColor;
+ property public final long disabledActiveContainerColor;
+ property public final long disabledActiveContentColor;
+ property public final long disabledInactiveBorderColor;
+ property public final long disabledInactiveContainerColor;
+ property public final long disabledInactiveContentColor;
+ property public final long inactiveBorderColor;
+ property public final long inactiveContainerColor;
+ property public final long inactiveContentColor;
}
- @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public final class SegmentedButtonDefaults {
- method @androidx.compose.runtime.Composable public androidx.compose.material3.SegmentedButtonColors colors(optional long checkedContainerColor, optional long checkedContentColor, optional long checkedBorderColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long uncheckedBorderColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledCheckedBorderColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor, optional long disabledUncheckedBorderColor);
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Stable public final class SegmentedButtonDefaults {
+ method @androidx.compose.runtime.Composable public void ActiveIcon();
+ method @androidx.compose.runtime.Composable public void SegmentedButtonIcon(boolean active, optional kotlin.jvm.functions.Function0<kotlin.Unit> activeContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? inactiveContent);
+ method @androidx.compose.runtime.Composable public androidx.compose.material3.SegmentedButtonColors colors(optional long activeContainerColor, optional long activeContentColor, optional long activeBorderColor, optional long inactiveContainerColor, optional long inactiveContentColor, optional long inactiveBorderColor, optional long disabledActiveContainerColor, optional long disabledActiveContentColor, optional long disabledActiveBorderColor, optional long disabledInactiveContainerColor, optional long disabledInactiveContentColor, optional long disabledInactiveBorderColor);
method public androidx.compose.material3.SegmentedButtonBorder getBorder();
method public float getIconSize();
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.compose.foundation.shape.CornerBasedShape getShape();
@@ -1219,8 +1224,10 @@
}
public final class SegmentedButtonKt {
- method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
- method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void MultiChoiceSegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function1<? super androidx.compose.material3.MultiChoiceSegmentedButtonRowScope,kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(androidx.compose.material3.MultiChoiceSegmentedButtonRowScope, boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional kotlin.jvm.functions.Function0<kotlin.Unit> icon, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SegmentedButton(androidx.compose.material3.SingleChoiceSegmentedButtonRowScope, boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.material3.SegmentedButtonColors colors, optional androidx.compose.material3.SegmentedButtonBorder border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional kotlin.jvm.functions.Function0<kotlin.Unit> icon, kotlin.jvm.functions.Function0<kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Composable public static void SingleChoiceSegmentedButtonRow(optional androidx.compose.ui.Modifier modifier, optional float space, kotlin.jvm.functions.Function1<? super androidx.compose.material3.SingleChoiceSegmentedButtonRowScope,kotlin.Unit> content);
}
@SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api @androidx.compose.runtime.Immutable public final class SelectableChipBorder {
@@ -1311,6 +1318,9 @@
enum_constant public static final androidx.compose.material3.SheetValue PartiallyExpanded;
}
+ @SuppressCompatibility @androidx.compose.material3.ExperimentalMaterial3Api public interface SingleChoiceSegmentedButtonRowScope extends androidx.compose.foundation.layout.RowScope {
+ }
+
@androidx.compose.runtime.Immutable public final class SliderColors {
ctor public SliderColors(long thumbColor, long activeTrackColor, long activeTickColor, long inactiveTrackColor, long inactiveTickColor, long disabledThumbColor, long disabledActiveTrackColor, long disabledActiveTickColor, long disabledInactiveTrackColor, long disabledInactiveTickColor);
method public long getActiveTickColor();
diff --git a/compose/material3/material3/build.gradle b/compose/material3/material3/build.gradle
index e9f6e1c..5a7bbaa 100644
--- a/compose/material3/material3/build.gradle
+++ b/compose/material3/material3/build.gradle
@@ -42,6 +42,7 @@
implementation(project(":compose:animation:animation-core"))
api(project(":compose:foundation:foundation"))
+ api(project(":compose:foundation:foundation-layout"))
api(project(":compose:material:material-icons-core"))
api(project(":compose:material:material-ripple"))
api(project(":compose:runtime:runtime"))
@@ -49,7 +50,6 @@
api(project(":compose:ui:ui-text"))
implementation(project(":compose:ui:ui-util"))
- implementation(project(":compose:foundation:foundation-layout"))
}
}
@@ -72,8 +72,9 @@
api(project(":compose:runtime:runtime"))
api(project(":compose:ui:ui"))
api(project(":compose:ui:ui-text"))
+ api(project(":compose:foundation:foundation-layout"))
+
implementation(project(":compose:animation:animation"))
- implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:ui:ui-util"))
}
}
@@ -145,7 +146,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
implementation(project(":compose:ui:ui-test-junit4"))
implementation(libs.truth)
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
index 445789d..3fba476 100644
--- a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
@@ -120,6 +120,7 @@
import androidx.compose.material3.samples.ScrollingTextTabs
import androidx.compose.material3.samples.SearchBarSample
import androidx.compose.material3.samples.SecondaryTabs
+import androidx.compose.material3.samples.SegmentedButtonMultiSelectSample
import androidx.compose.material3.samples.SegmentedButtonSingleSelectSample
import androidx.compose.material3.samples.SimpleBottomAppBar
import androidx.compose.material3.samples.SimpleBottomSheetScaffoldSample
@@ -800,6 +801,13 @@
) {
SegmentedButtonSingleSelectSample()
},
+ Example(
+ name = ::SegmentedButtonMultiSelectSample.name,
+ description = SegmentedButtonExampleDescription,
+ sourceUrl = SegmentedButtonSourceUrl
+ ) {
+ SegmentedButtonMultiSelectSample()
+ },
)
private const val SlidersExampleDescription = "Sliders examples"
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
index 6275ad1..7c1888f 100644
--- a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
@@ -71,4 +71,4 @@
}
private val HomeCellMinSize = 180.dp
-private val HomePadding = 12.dp
\ No newline at end of file
+private val HomePadding = 12.dp
diff --git a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/ColorSchemeDemo.kt b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/ColorSchemeDemo.kt
index 18b888f..685ef98 100644
--- a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/ColorSchemeDemo.kt
+++ b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/ColorSchemeDemo.kt
@@ -309,4 +309,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/SwipeToDismissDemo.kt b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/SwipeToDismissDemo.kt
index 0cd93c7..26adb4f 100644
--- a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/SwipeToDismissDemo.kt
+++ b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/SwipeToDismissDemo.kt
@@ -163,4 +163,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/TooltipDemo.kt b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/TooltipDemo.kt
index 741de3d..e08d179 100644
--- a/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/TooltipDemo.kt
+++ b/compose/material3/material3/integration-tests/material3-demos/src/main/java/androidx/compose/material3/demos/TooltipDemo.kt
@@ -192,4 +192,4 @@
}
}
-private const val TOOLTIP_DURATION = 1000L
\ No newline at end of file
+private const val TOOLTIP_DURATION = 1000L
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ButtonSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ButtonSamples.kt
index 5521ab9..b6b5599 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ButtonSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ButtonSamples.kt
@@ -84,4 +84,4 @@
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
Text("Like")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/FloatingActionButtonSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/FloatingActionButtonSamples.kt
index 7df2f4a..efa61b3 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/FloatingActionButtonSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/FloatingActionButtonSamples.kt
@@ -133,4 +133,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationBarSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationBarSamples.kt
index c88bbf0..36502a5 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationBarSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationBarSamples.kt
@@ -25,7 +25,7 @@
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.tooling.preview.Preview
@@ -34,7 +34,7 @@
@Sampled
@Composable
fun NavigationBarSample() {
- var selectedItem by remember { mutableStateOf(0) }
+ var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Songs", "Artists", "Playlists")
NavigationBar {
@@ -51,7 +51,7 @@
@Composable
fun NavigationBarWithOnlySelectedLabelsSample() {
- var selectedItem by remember { mutableStateOf(0) }
+ var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Songs", "Artists", "Playlists")
NavigationBar {
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationRailSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationRailSamples.kt
index e1d66b4..f0f9b03 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationRailSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/NavigationRailSamples.kt
@@ -28,7 +28,7 @@
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -38,7 +38,7 @@
@Sampled
@Composable
fun NavigationRailSample() {
- var selectedItem by remember { mutableStateOf(0) }
+ var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Home", "Search", "Settings")
val icons = listOf(Icons.Filled.Home, Icons.Filled.Search, Icons.Filled.Settings)
NavigationRail {
@@ -55,7 +55,7 @@
@Composable
fun NavigationRailWithOnlySelectedLabelsSample() {
- var selectedItem by remember { mutableStateOf(0) }
+ var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Home", "Search", "Settings")
val icons = listOf(Icons.Filled.Home, Icons.Filled.Search, Icons.Filled.Settings)
NavigationRail {
@@ -73,7 +73,7 @@
@Composable
fun NavigationRailBottomAlignSample() {
- var selectedItem by remember { mutableStateOf(0) }
+ var selectedItem by remember { mutableIntStateOf(0) }
val items = listOf("Home", "Search", "Settings")
val icons = listOf(Icons.Filled.Home, Icons.Filled.Search, Icons.Filled.Settings)
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/RadioButtonSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/RadioButtonSamples.kt
index 087de56..3bfd446 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/RadioButtonSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/RadioButtonSamples.kt
@@ -97,4 +97,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt
index e5ca504..ebd1a75 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt
@@ -42,11 +42,11 @@
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.semantics.isContainer
+import androidx.compose.ui.semantics.isTraversalGroup
import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.semantics.traversalIndex
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
-import androidx.compose.ui.zIndex
@OptIn(ExperimentalMaterial3Api::class)
@Preview
@@ -56,45 +56,36 @@
var text by rememberSaveable { mutableStateOf("") }
var active by rememberSaveable { mutableStateOf(false) }
- Box(Modifier.fillMaxSize()) {
- // Talkback focus order sorts based on x and y position before considering z-index. The
- // extra Box with semantics and fillMaxWidth is a workaround to get the search bar to focus
- // before the content.
- Box(Modifier.semantics {
- @Suppress("DEPRECATION")
- isContainer = true
- }.zIndex(1f).fillMaxWidth()) {
- SearchBar(
- modifier = Modifier.align(Alignment.TopCenter),
- query = text,
- onQueryChange = { text = it },
- onSearch = { active = false },
- active = active,
- onActiveChange = {
- active = it
- },
- placeholder = { Text("Hinted search text") },
- leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
- trailingIcon = { Icon(Icons.Default.MoreVert, contentDescription = null) },
- ) {
- LazyColumn(
- modifier = Modifier.fillMaxWidth(),
- contentPadding = PaddingValues(16.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- items(4) { idx ->
- val resultText = "Suggestion $idx"
- ListItem(
- headlineContent = { Text(resultText) },
- supportingContent = { Text("Additional info") },
- leadingContent = { Icon(Icons.Filled.Star, contentDescription = null) },
- modifier = Modifier.clickable {
- text = resultText
- active = false
- }
- )
- }
- }
+ Box(Modifier.fillMaxSize().semantics { isTraversalGroup = true }) {
+ SearchBar(
+ modifier = Modifier
+ .align(Alignment.TopCenter)
+ .semantics { traversalIndex = -1f },
+ query = text,
+ onQueryChange = { text = it },
+ onSearch = { active = false },
+ active = active,
+ onActiveChange = {
+ active = it
+ },
+ placeholder = { Text("Hinted search text") },
+ leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
+ trailingIcon = { Icon(Icons.Default.MoreVert, contentDescription = null) },
+ ) {
+ repeat(4) { idx ->
+ val resultText = "Suggestion $idx"
+ ListItem(
+ headlineContent = { Text(resultText) },
+ supportingContent = { Text("Additional info") },
+ leadingContent = { Icon(Icons.Filled.Star, contentDescription = null) },
+ modifier = Modifier
+ .clickable {
+ text = resultText
+ active = false
+ }
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 4.dp)
+ )
}
}
@@ -118,43 +109,35 @@
var text by rememberSaveable { mutableStateOf("") }
var active by rememberSaveable { mutableStateOf(false) }
- Box(Modifier.fillMaxSize()) {
- // Talkback focus order sorts based on x and y position before considering z-index. The
- // extra Box with semantics and fillMaxWidth is a workaround to get the search bar to focus
- // before the content.
- Box(Modifier.semantics {
- @Suppress("DEPRECATION")
- isContainer = true
- }.zIndex(1f).fillMaxWidth()) {
- DockedSearchBar(
- modifier = Modifier.align(Alignment.TopCenter).padding(top = 8.dp),
- query = text,
- onQueryChange = { text = it },
- onSearch = { active = false },
- active = active,
- onActiveChange = { active = it },
- placeholder = { Text("Hinted search text") },
- leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
- trailingIcon = { Icon(Icons.Default.MoreVert, contentDescription = null) },
- ) {
- LazyColumn(
- modifier = Modifier.fillMaxWidth(),
- contentPadding = PaddingValues(16.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- items(4) { idx ->
- val resultText = "Suggestion $idx"
- ListItem(
- headlineContent = { Text(resultText) },
- supportingContent = { Text("Additional info") },
- leadingContent = { Icon(Icons.Filled.Star, contentDescription = null) },
- modifier = Modifier.clickable {
- text = resultText
- active = false
- }
- )
- }
- }
+ Box(Modifier.fillMaxSize().semantics { isTraversalGroup = true }) {
+ DockedSearchBar(
+ modifier = Modifier
+ .align(Alignment.TopCenter)
+ .padding(top = 8.dp)
+ .semantics { traversalIndex = -1f },
+ query = text,
+ onQueryChange = { text = it },
+ onSearch = { active = false },
+ active = active,
+ onActiveChange = { active = it },
+ placeholder = { Text("Hinted search text") },
+ leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
+ trailingIcon = { Icon(Icons.Default.MoreVert, contentDescription = null) },
+ ) {
+ repeat(4) { idx ->
+ val resultText = "Suggestion $idx"
+ ListItem(
+ headlineContent = { Text(resultText) },
+ supportingContent = { Text("Additional info") },
+ leadingContent = { Icon(Icons.Filled.Star, contentDescription = null) },
+ modifier = Modifier
+ .clickable {
+ text = resultText
+ active = false
+ }
+ .fillMaxWidth()
+ .padding(horizontal = 16.dp, vertical = 4.dp)
+ )
}
}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SegmentedButtonSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SegmentedButtonSamples.kt
index cb5896e..0ac189c 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SegmentedButtonSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SegmentedButtonSamples.kt
@@ -17,16 +17,25 @@
package androidx.compose.material3.samples
import androidx.annotation.Sampled
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.Icon
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.BookmarkBorder
+import androidx.compose.material.icons.filled.StarBorder
+import androidx.compose.material.icons.filled.TrendingUp
import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.MultiChoiceSegmentedButtonRow
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
-import androidx.compose.material3.SegmentedButtonRow
+import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@OptIn(ExperimentalMaterial3Api::class)
@@ -34,14 +43,54 @@
@Composable
@Preview
fun SegmentedButtonSingleSelectSample() {
- var checkedIndex by remember { mutableStateOf(0) }
- val options = listOf("$", "$$", "$$$")
- SegmentedButtonRow {
+ var selectedIndex by remember { mutableStateOf(0) }
+ val options = listOf("Day", "Month", "Week")
+ SingleChoiceSegmentedButtonRow {
options.forEachIndexed { index, label ->
SegmentedButton(
shape = SegmentedButtonDefaults.shape(position = index, count = options.size),
- onCheckedChange = { checkedIndex = index },
- checked = index == checkedIndex
+ onClick = { selectedIndex = index },
+ selected = index == selectedIndex
+ ) {
+ Text(label)
+ }
+ }
+ }
+}
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Sampled
+@Composable
+@Preview
+fun SegmentedButtonMultiSelectSample() {
+ val checkedList = remember { mutableStateListOf<Int>() }
+ val options = listOf("Favorites", "Trending", "Saved")
+ val icons = listOf(
+ Icons.Filled.StarBorder,
+ Icons.Filled.TrendingUp,
+ Icons.Filled.BookmarkBorder
+ )
+ MultiChoiceSegmentedButtonRow {
+ options.forEachIndexed { index, label ->
+ SegmentedButton(
+ shape = SegmentedButtonDefaults.shape(position = index, count = options.size),
+ icon = {
+ SegmentedButtonDefaults.SegmentedButtonIcon(active = index in checkedList) {
+ Icon(
+ imageVector = icons[index],
+ contentDescription = null,
+ modifier = Modifier.size(SegmentedButtonDefaults.IconSize)
+ )
+ }
+ },
+ onCheckedChange = {
+ if (index in checkedList) {
+ checkedList.remove(index)
+ } else {
+ checkedList.add(index)
+ }
+ },
+ checked = index in checkedList
) {
Text(label)
}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwipeToDismissSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwipeToDismissSamples.kt
index 627c4bf..dce330e 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwipeToDismissSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwipeToDismissSamples.kt
@@ -67,4 +67,4 @@
}
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwitchSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwitchSamples.kt
index 55842a4..9fbb12a 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwitchSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SwitchSamples.kt
@@ -68,4 +68,4 @@
onCheckedChange = { checked = it },
thumbContent = icon
)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TooltipSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TooltipSamples.kt
index 05630d7..8a45008 100644
--- a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TooltipSamples.kt
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/TooltipSamples.kt
@@ -159,4 +159,4 @@
"Configure permissions for selected service accounts. " +
"You can add and remove service account members and assign roles to them. " +
"Visit go/permissions for details"
-const val richTooltipActionText = "Request Access"
\ No newline at end of file
+const val richTooltipActionText = "Request Access"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AlertDialogTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AlertDialogTest.kt
index d3ed41d..5950e2c 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AlertDialogTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AlertDialogTest.kt
@@ -92,7 +92,7 @@
TextButton(onClick = { /* doSomething() */ }) {
Text("Confirm")
buttonContentColor = LocalContentColor.current
- expectedButtonContentColor = DialogTokens.ActionLabelTextColor.toColor()
+ expectedButtonContentColor = DialogTokens.ActionLabelTextColor.value
}
},
containerColor = Color.Yellow,
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AppBarTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AppBarTest.kt
index 80d43c8..ef6ffe4 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AppBarTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/AppBarTest.kt
@@ -1435,7 +1435,7 @@
scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
// Using the mediumTopAppBarColors for both Medium and Large top app bars, as the
// current content color settings are the same.
- expandedAppBarBackgroundColor = TopAppBarMediumTokens.ContainerColor.toColor()
+ expandedAppBarBackgroundColor = TopAppBarMediumTokens.ContainerColor.value
fullyCollapsedContainerColor =
TopAppBarDefaults.mediumTopAppBarColors()
.containerColor(colorTransitionFraction = 1f)
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BadgeTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BadgeTest.kt
index 21d3299..7805580 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BadgeTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BadgeTest.kt
@@ -115,8 +115,8 @@
var shape = RectangleShape
var errorColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- shape = BadgeTokens.Shape.toShape()
- errorColor = BadgeTokens.Color.toColor()
+ shape = BadgeTokens.Shape.value
+ errorColor = BadgeTokens.Color.value
Badge(modifier = Modifier.testTag(TestBadgeTag))
}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BottomSheetScaffoldTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BottomSheetScaffoldTest.kt
index 3dcafea..71aa2de 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BottomSheetScaffoldTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/BottomSheetScaffoldTest.kt
@@ -772,7 +772,7 @@
rule.setContent {
dragHandleContentDescription = getString(Strings.BottomSheetDragHandleDescription)
- dragHandleColor = SheetBottomTokens.DockedDragHandleColor.toColor()
+ dragHandleColor = SheetBottomTokens.DockedDragHandleColor.value
.copy(SheetBottomTokens.DockedDragHandleOpacity)
surface = MaterialTheme.colorScheme.surface
density = LocalDensity.current
@@ -846,4 +846,4 @@
with(density!!) { rule.rootHeight().toPx() - peekHeight.toPx() - snackbarSize!!.height }
assertThat(snackbarBottomOffset).isWithin(1f).of(expectedSnackbarBottomOffset)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/CheckboxTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/CheckboxTest.kt
index 9503aa1..ed984d5 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/CheckboxTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/CheckboxTest.kt
@@ -321,4 +321,4 @@
click(position = Offset(-1f, -1f))
}.assertIsOn()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ChipTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ChipTest.kt
index 19cef5d..697685b9 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ChipTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ChipTest.kt
@@ -272,7 +272,7 @@
var expectedLabelColor = Color.Unspecified
var contentColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- expectedLabelColor = AssistChipTokens.LabelTextColor.toColor()
+ expectedLabelColor = AssistChipTokens.LabelTextColor.value
AssistChip(onClick = {}, label = {
contentColor = LocalContentColor.current
})
@@ -289,7 +289,7 @@
fun elevatedDisabled_assistChip() {
var containerColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- containerColor = AssistChipTokens.ElevatedDisabledContainerColor.toColor()
+ containerColor = AssistChipTokens.ElevatedDisabledContainerColor.value
.copy(alpha = AssistChipTokens.ElevatedDisabledContainerOpacity)
.compositeOver(MaterialTheme.colorScheme.surface)
ElevatedAssistChip(
@@ -562,7 +562,7 @@
var expectedLabelColor = Color.Unspecified
var contentColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- expectedLabelColor = FilterChipTokens.UnselectedLabelTextColor.toColor()
+ expectedLabelColor = FilterChipTokens.UnselectedLabelTextColor.value
FilterChip(selected = false, onClick = {}, label = {
contentColor = LocalContentColor.current
})
@@ -578,7 +578,7 @@
var expectedLabelColor = Color.Unspecified
var contentColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- expectedLabelColor = FilterChipTokens.SelectedLabelTextColor.toColor()
+ expectedLabelColor = FilterChipTokens.SelectedLabelTextColor.value
FilterChip(selected = true, onClick = {}, label = {
contentColor = LocalContentColor.current
})
@@ -807,8 +807,8 @@
var contentColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
val selected = remember { mutableStateOf(false) }
- selectedLabelColor = InputChipTokens.SelectedLabelTextColor.toColor()
- unselectedLabelColor = InputChipTokens.UnselectedLabelTextColor.toColor()
+ selectedLabelColor = InputChipTokens.SelectedLabelTextColor.value
+ unselectedLabelColor = InputChipTokens.UnselectedLabelTextColor.value
InputChip(
selected = selected.value,
onClick = { selected.value = !selected.value },
@@ -967,7 +967,7 @@
var expectedLabelColor = Color.Unspecified
var contentColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- expectedLabelColor = SuggestionChipTokens.LabelTextColor.toColor()
+ expectedLabelColor = SuggestionChipTokens.LabelTextColor.value
SuggestionChip(onClick = {}, label = {
contentColor = LocalContentColor.current
})
@@ -984,7 +984,7 @@
fun elevatedDisabled_suggestionChip() {
var containerColor = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- containerColor = SuggestionChipTokens.ElevatedDisabledContainerColor.toColor()
+ containerColor = SuggestionChipTokens.ElevatedDisabledContainerColor.value
.copy(alpha = SuggestionChipTokens.ElevatedDisabledContainerOpacity)
.compositeOver(MaterialTheme.colorScheme.surface)
ElevatedSuggestionChip(
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ColorSchemeScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ColorSchemeScreenshotTest.kt
index 2b52272..50fe46d 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ColorSchemeScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ColorSchemeScreenshotTest.kt
@@ -447,4 +447,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt
index 17c0028..b9c7249 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DateRangePickerScreenshotTest.kt
@@ -214,4 +214,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DismissibleNavigationDrawerTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DismissibleNavigationDrawerTest.kt
index 2edb2e5..192db1e 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DismissibleNavigationDrawerTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DismissibleNavigationDrawerTest.kt
@@ -560,4 +560,4 @@
}
}
-private val DrawerTestTag = "drawer"
\ No newline at end of file
+private val DrawerTestTag = "drawer"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerTest.kt
index 00e0e1d..e010f7c 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerTest.kt
@@ -110,4 +110,4 @@
assertThat(heightPx).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
index 9ea4779..90ffd2d 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
@@ -494,4 +494,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonScreenshotTest.kt
index 59a999a..07dd785 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonScreenshotTest.kt
@@ -346,4 +346,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonTest.kt
index 46c3e79..4d11904 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/FloatingActionButtonTest.kt
@@ -550,4 +550,4 @@
fun assertWithinOnePixel(expected: Float, actual: Float) {
val diff = abs(expected - actual)
assertThat(diff).isLessThan(1.1f)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/IconButtonScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/IconButtonScreenshotTest.kt
index 66ea73e..84d1bca 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/IconButtonScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/IconButtonScreenshotTest.kt
@@ -556,4 +556,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemScreenshotTest.kt
index cebeda9..2e2a507 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemScreenshotTest.kt
@@ -252,4 +252,4 @@
}
}
-private const val Tag = "List"
\ No newline at end of file
+private const val Tag = "List"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemTest.kt
index 121e490..1b6aef8 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ListItemTest.kt
@@ -768,4 +768,4 @@
coords.value = coordinates.positionInRoot()
size.value = coordinates.size
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MaterialRippleThemeTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MaterialRippleThemeTest.kt
index 47fbfcb..e3556a4 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MaterialRippleThemeTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MaterialRippleThemeTest.kt
@@ -730,4 +730,4 @@
private val RippleBoxBackgroundColor = Color.Blue
-private const val Tag = "Ripple"
\ No newline at end of file
+private const val Tag = "Ripple"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MenuScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MenuScreenshotTest.kt
index e4fbc9d..fe24687 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MenuScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/MenuScreenshotTest.kt
@@ -157,4 +157,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
index 0fa34c8..8a34a90 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
@@ -1159,4 +1159,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerScreenshotTest.kt
index 94b8187..06d8653 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerScreenshotTest.kt
@@ -119,4 +119,4 @@
}
}
-private val ContainerTestTag = "container"
\ No newline at end of file
+private val ContainerTestTag = "container"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerTest.kt
index 409120f..db38109 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalNavigationDrawerTest.kt
@@ -658,4 +658,4 @@
}
}
-private val DrawerTestTag = "drawer"
\ No newline at end of file
+private val DrawerTestTag = "drawer"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarTest.kt
index 2f6c21f..5e9c9e5 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarTest.kt
@@ -265,6 +265,27 @@
}
@Test
+ fun navigationBarItem_withLongLabel_automaticallyResizesHeight() {
+ val defaultHeight = NavigationBarTokens.ContainerHeight
+
+ rule.setMaterialContent(lightColorScheme()) {
+ NavigationBar(modifier = Modifier.testTag("TAG")) {
+ repeat(4) { index ->
+ NavigationBarItem(
+ icon = { Icon(Icons.Filled.Favorite, null) },
+ label = { Text("Long\nLabel\nMultiple\nLines") },
+ selected = index == 0,
+ onClick = {},
+ )
+ }
+ }
+ }
+
+ assertThat(rule.onNodeWithTag("TAG").getUnclippedBoundsInRoot().height)
+ .isGreaterThan(defaultHeight)
+ }
+
+ @Test
fun navigationBarItemContent_withLabel_sizeAndPosition() {
rule.setMaterialContent(lightColorScheme()) {
NavigationBar {
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemScreenshotTest.kt
index c1c847e..431e03d 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemScreenshotTest.kt
@@ -207,4 +207,4 @@
}
}
-private const val Tag = "NavigationDrawerItem"
\ No newline at end of file
+private const val Tag = "NavigationDrawerItem"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemTest.kt
index 8fd4d81..3ecd26f 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationDrawerItemTest.kt
@@ -182,4 +182,4 @@
.assertIsNotSelected()
.assertHasClickAction()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailScreenshotTest.kt
index a2baa32..9d7867c 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailScreenshotTest.kt
@@ -307,4 +307,4 @@
}
}
-private const val Tag = "NavigationRail"
\ No newline at end of file
+private const val Tag = "NavigationRail"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailTest.kt
index 21c5372..56c8d14 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationRailTest.kt
@@ -56,7 +56,6 @@
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onParent
import androidx.compose.ui.test.performClick
-import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.height
import androidx.compose.ui.unit.width
@@ -236,21 +235,11 @@
}
}
- assertDimension(itemCoords, NavigationRailItemWidth, NavigationRailItemHeight)
- }
-
- private fun assertDimension(
- itemCoords: MutableMap<Int, LayoutCoordinates>,
- expectedItemWidth: Dp,
- expectedItemHeight: Dp
- ) {
rule.runOnIdleWithDensity {
- val expectedItemWidthPx = expectedItemWidth.roundToPx()
- val expectedItemHeightPx = expectedItemHeight.roundToPx()
+ val expectedItemWidthPx = NavigationRailItemWidth.roundToPx()
+ val expectedItemHeightPx = NavigationRailItemHeight.roundToPx()
val navigationRailPadding = NavigationRailItemVerticalPadding.roundToPx()
- Truth.assertThat(itemCoords.size).isEqualTo(4)
-
itemCoords.forEach { (index, coord) ->
Truth.assertThat(coord.size.width).isEqualTo(expectedItemWidthPx)
Truth.assertThat(coord.size.height).isEqualTo(expectedItemHeightPx)
@@ -262,6 +251,29 @@
}
@Test
+ fun navigationRailItem_withLongLabel_automaticallyResizesHeight() {
+ val defaultHeight = NavigationRailItemHeight
+
+ rule.setMaterialContent(lightColorScheme()) {
+ NavigationRail {
+ NavigationRailItem(
+ icon = { Icon(Icons.Filled.Favorite, null) },
+ label = { Text("Long\nLabel\nMultiple\nLines") },
+ selected = true,
+ onClick = {},
+ modifier = Modifier.testTag("TAG"),
+ )
+ }
+ }
+
+ Truth.assertThat(
+ rule.onNodeWithTag("TAG", useUnmergedTree = true)
+ .getUnclippedBoundsInRoot()
+ .height
+ ).isGreaterThan(defaultHeight)
+ }
+
+ @Test
fun navigationRailItemContent_withLabel_sizeAndPosition() {
rule.setMaterialContent(lightColorScheme()) {
Box {
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/OutlinedTextFieldScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/OutlinedTextFieldScreenshotTest.kt
index a4d3e16..115839a 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/OutlinedTextFieldScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/OutlinedTextFieldScreenshotTest.kt
@@ -777,4 +777,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/PermanentNavigationDrawerTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/PermanentNavigationDrawerTest.kt
index b183dd1..dc23dec 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/PermanentNavigationDrawerTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/PermanentNavigationDrawerTest.kt
@@ -187,4 +187,4 @@
}
}
-private val DrawerTestTag = "drawer"
\ No newline at end of file
+private val DrawerTestTag = "drawer"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ProgressIndicatorScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ProgressIndicatorScreenshotTest.kt
index 399d547..5495c624 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ProgressIndicatorScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ProgressIndicatorScreenshotTest.kt
@@ -143,4 +143,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonScreenshotTest.kt
index 81f44e1..2d9c3f6 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonScreenshotTest.kt
@@ -392,4 +392,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonTest.kt
index ac44341..04e3bfb 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/RadioButtonTest.kt
@@ -301,4 +301,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt
index 46ec30c..151c904 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt
@@ -335,4 +335,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarTest.kt
index 54fcb26..89721c6 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SearchBarTest.kt
@@ -28,6 +28,8 @@
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusRequester
+import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.node.Ref
import androidx.compose.ui.platform.testTag
@@ -99,6 +101,38 @@
}
@Test
+ fun searchBar_doesNotOverwriteFocusOfOtherComponents() {
+ val focusRequester = FocusRequester()
+ rule.setMaterialContent(lightColorScheme()) {
+ Column(Modifier.fillMaxSize()) {
+ SearchBar(
+ modifier = Modifier.testTag(SearchBarTestTag),
+ query = "Query",
+ onQueryChange = {},
+ onSearch = {},
+ active = false,
+ onActiveChange = {},
+ content = {},
+ )
+ TextField(
+ value = "",
+ onValueChange = {},
+ modifier = Modifier.testTag("SIBLING").focusRequester(focusRequester)
+ )
+ }
+ }
+
+ rule.runOnIdle {
+ focusRequester.requestFocus()
+ }
+
+ rule.onNodeWithTag("SIBLING").assertIsFocused()
+
+ rule.onNodeWithTag(SearchBarTestTag).performClick()
+ rule.onNodeWithText("Query").assertIsFocused()
+ }
+
+ @Test
fun searchBar_onImeAction_executesSearchCallback() {
var capturedSearchQuery = ""
@@ -246,6 +280,38 @@
}
@Test
+ fun dockedSearchBar_doesNotOverwriteFocusOfOtherComponents() {
+ val focusRequester = FocusRequester()
+ rule.setMaterialContent(lightColorScheme()) {
+ Column(Modifier.fillMaxSize()) {
+ DockedSearchBar(
+ modifier = Modifier.testTag(SearchBarTestTag),
+ query = "Query",
+ onQueryChange = {},
+ onSearch = {},
+ active = false,
+ onActiveChange = {},
+ content = {},
+ )
+ TextField(
+ value = "",
+ onValueChange = {},
+ modifier = Modifier.testTag("SIBLING").focusRequester(focusRequester)
+ )
+ }
+ }
+
+ rule.runOnIdle {
+ focusRequester.requestFocus()
+ }
+
+ rule.onNodeWithTag("SIBLING").assertIsFocused()
+
+ rule.onNodeWithTag(SearchBarTestTag).performClick()
+ rule.onNodeWithText("Query").assertIsFocused()
+ }
+
+ @Test
fun dockedSearchBar_onImeAction_executesSearchCallback() {
var capturedSearchQuery = ""
@@ -342,4 +408,4 @@
rule.onNodeWithTag(SearchBarTestTag).performClick()
rule.onNodeWithText("Content").assertIsDisplayed()
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonScreenshotTest.kt
index 5e50ac9..89ae9dd 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonScreenshotTest.kt
@@ -17,6 +17,9 @@
package androidx.compose.material3
import android.os.Build
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.Favorite
import androidx.compose.testutils.assertAgainstGolden
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -48,7 +51,7 @@
@Test
fun all_unselected() {
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEach {
SegmentedButton(checked = false, onCheckedChange = {}) {
Text(it)
@@ -63,7 +66,7 @@
@Test
fun all_selected() {
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEach {
SegmentedButton(checked = true, onCheckedChange = {}) {
Text(it)
@@ -78,7 +81,7 @@
@Test
fun middle_selected() {
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEachIndexed { index, item ->
SegmentedButton(checked = index == 1, onCheckedChange = {}) {
Text(item)
@@ -91,13 +94,42 @@
}
@Test
+ fun middle_selected_with_icon() {
+ rule.setMaterialContent(lightColorScheme()) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ values.forEachIndexed { index, item ->
+ SegmentedButton(
+ checked = index == 1,
+ onCheckedChange = {},
+ icon = if (index == 1) {
+ { SegmentedButtonDefaults.ActiveIcon() }
+ } else {
+ {
+ Icon(
+ imageVector = Icons.Outlined.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(SegmentedButtonDefaults.IconSize)
+ )
+ }
+ }
+ ) {
+ Text(item)
+ }
+ }
+ }
+ }
+
+ assertButtonAgainstGolden("middle_selected_with_icon")
+ }
+
+ @Test
fun stroke_zIndex() {
rule.setMaterialContent(lightColorScheme()) {
val colors = SegmentedButtonDefaults.colors(
- checkedBorderColor = Color.Blue,
- uncheckedBorderColor = Color.Yellow
+ activeBorderColor = Color.Blue,
+ inactiveBorderColor = Color.Yellow
)
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEachIndexed { index, item ->
SegmentedButton(
checked = index == 1,
@@ -117,10 +149,10 @@
fun button_shape() {
rule.setMaterialContent(lightColorScheme()) {
val colors = SegmentedButtonDefaults.colors(
- checkedBorderColor = Color.Blue,
- uncheckedBorderColor = Color.Yellow
+ activeBorderColor = Color.Blue,
+ inactiveBorderColor = Color.Yellow
)
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEachIndexed { index, item ->
val shape = SegmentedButtonDefaults.shape(index, values.size)
@@ -142,7 +174,7 @@
@Test
fun all_unselected_darkTheme() {
rule.setMaterialContent(darkColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEach {
SegmentedButton(checked = false, onCheckedChange = {}) {
Text(it)
@@ -157,7 +189,7 @@
@Test
fun all_selected_darkTheme() {
rule.setMaterialContent(darkColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag(testTag)) {
values.forEach {
SegmentedButton(checked = true, onCheckedChange = {}) {
Text(it)
@@ -178,4 +210,4 @@
private val values = listOf("Day", "Month", "Week")
private val testTag = "button"
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonTest.kt
index abb6ba0..37c5862 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SegmentedButtonTest.kt
@@ -53,11 +53,11 @@
val rule = createComposeRule()
@Test
- fun segmentedButton_itemsDisplay() {
+ fun toggleableSegmentedButton_itemsDisplay() {
val values = listOf("Day", "Month", "Week")
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow {
+ MultiChoiceSegmentedButtonRow {
values.forEach {
SegmentedButton(checked = false, onCheckedChange = {}) {
Text(it)
@@ -70,10 +70,27 @@
}
@Test
+ fun selectableSegmentedButton_itemsDisplay() {
+ val values = listOf("Day", "Month", "Week")
+
+ rule.setMaterialContent(lightColorScheme()) {
+ SingleChoiceSegmentedButtonRow {
+ values.forEach {
+ SegmentedButton(selected = false, onClick = {}) {
+ Text(it)
+ }
+ }
+ }
+ }
+
+ values.forEach { rule.onNodeWithText(it).assertIsDisplayed() }
+ }
+
+ @Test
fun segmentedButton_itemsChecked() {
var checked by mutableStateOf(true)
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow {
+ MultiChoiceSegmentedButtonRow {
SegmentedButton(onCheckedChange = { checked = it }, checked = checked) {
Text("Day")
}
@@ -95,13 +112,13 @@
}
@Test
- fun segmentedButton_semantics() {
+ fun selectableSegmentedButton_semantics() {
rule.setMaterialContent(lightColorScheme()) {
- SegmentedButtonRow(modifier = Modifier.testTag("row")) {
- SegmentedButton(checked = false, onCheckedChange = {}) {
+ SingleChoiceSegmentedButtonRow(modifier = Modifier.testTag("row")) {
+ SegmentedButton(selected = false, onClick = {}) {
Text("Day")
}
- SegmentedButton(checked = false, onCheckedChange = {}) {
+ SegmentedButton(selected = false, onClick = {}) {
Text("Month")
}
}
@@ -114,13 +131,36 @@
}
@Test
+ fun segmentedButton_icon() {
+ var checked by mutableStateOf(false)
+ rule.setMaterialContent(lightColorScheme()) {
+ MultiChoiceSegmentedButtonRow(modifier = Modifier.testTag("row")) {
+ SegmentedButton(
+ checked = checked,
+ onCheckedChange = {},
+ icon = { Text(if (checked) "checked" else "unchecked") },
+ ) {
+ Text("Day")
+ }
+ }
+ }
+
+ rule.onNodeWithText("unchecked").assertIsDisplayed()
+
+ rule.runOnIdle { checked = true }
+ rule.waitForIdle()
+
+ rule.onNodeWithText("checked").assertIsDisplayed()
+ }
+
+ @Test
fun segmentedButton_Sizing() {
val itemSize = 60.dp
rule.setMaterialContentForSizeAssertions(
parentMaxWidth = 300.dp, parentMaxHeight = 100.dp
) {
- SegmentedButtonRow {
+ MultiChoiceSegmentedButtonRow {
SegmentedButton(checked = false, onCheckedChange = {}) {
Text(modifier = Modifier.width(60.dp), text = "Day")
}
@@ -138,7 +178,7 @@
lateinit var border: BorderStroke
var specColor: Color = Color.Unspecified
rule.setMaterialContent(lightColorScheme()) {
- specColor = OutlinedSegmentedButtonTokens.OutlineColor.toColor()
+ specColor = OutlinedSegmentedButtonTokens.OutlineColor.value
border = SegmentedButtonDefaults.Border.borderStroke(
checked = true,
enabled = true,
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
index 87a93a3..36514dd 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderScreenshotTest.kt
@@ -349,4 +349,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
index d8f1324..8696ba5 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
@@ -1363,4 +1363,4 @@
SideEffect { ++innerRecomposition }
Text("InnerContent: ${state.activeRangeStart..state.activeRangeEnd}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SnackbarHostTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SnackbarHostTest.kt
index e67aa28..1a7af1d 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SnackbarHostTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SnackbarHostTest.kt
@@ -263,4 +263,4 @@
SnackbarDuration.Short.toMillis(false, null)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SwitchScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SwitchScreenshotTest.kt
index 5fcafa4..098aa4e 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SwitchScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SwitchScreenshotTest.kt
@@ -325,4 +325,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenName)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldDecorationBoxTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldDecorationBoxTest.kt
index 1938541..b6050ba 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldDecorationBoxTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldDecorationBoxTest.kt
@@ -681,4 +681,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldScreenshotTest.kt
index 927f5fb..3a9b194 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextFieldScreenshotTest.kt
@@ -770,4 +770,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextSelectionColorsScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextSelectionColorsScreenshotTest.kt
index abd4633..94a4d31 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextSelectionColorsScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TextSelectionColorsScreenshotTest.kt
@@ -247,4 +247,4 @@
selection = TextRange(0, 8),
composition = TextRange(0, 8)
)
-private const val Tag = "TestTag"
\ No newline at end of file
+private const val Tag = "TestTag"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TimeInputScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TimeInputScreenshotTest.kt
index 1de6eaa..e95a0f2 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TimeInputScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TimeInputScreenshotTest.kt
@@ -101,4 +101,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipScreenshotTest.kt
index 9f0f5e4..c9a6824 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipScreenshotTest.kt
@@ -166,4 +166,4 @@
}
private const val AnchorTestTag = "Anchor"
-private const val TooltipTestTag = "tooltip"
\ No newline at end of file
+private const val TooltipTestTag = "tooltip"
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipTest.kt
index d5729f1..70e6b64 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/TooltipTest.kt
@@ -494,4 +494,4 @@
private const val TextTestTag = "Text"
private const val SubheadTestTag = "Subhead"
private const val ActionTestTag = "Action"
-private const val AnchorTestTag = "Anchor"
\ No newline at end of file
+private const val AnchorTestTag = "Anchor"
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidAlertDialog.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidAlertDialog.android.kt
index 2fc5514..cb4c0e5 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidAlertDialog.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidAlertDialog.android.kt
@@ -110,7 +110,7 @@
// most cases, TextButtons should be used for dismiss and confirm buttons.
// TextButtons will not consume this provided content color value, and will used their
// own defined or default colors.
- buttonContentColor = DialogTokens.ActionLabelTextColor.toColor(),
+ buttonContentColor = DialogTokens.ActionLabelTextColor.value,
iconContentColor = iconContentColor,
titleContentColor = titleContentColor,
textContentColor = textContentColor,
@@ -169,19 +169,19 @@
*/
object AlertDialogDefaults {
/** The default shape for alert dialogs */
- val shape: Shape @Composable get() = DialogTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = DialogTokens.ContainerShape.value
/** The default container color for alert dialogs */
- val containerColor: Color @Composable get() = DialogTokens.ContainerColor.toColor()
+ val containerColor: Color @Composable get() = DialogTokens.ContainerColor.value
/** The default icon color for alert dialogs */
- val iconContentColor: Color @Composable get() = DialogTokens.IconColor.toColor()
+ val iconContentColor: Color @Composable get() = DialogTokens.IconColor.value
/** The default title color for alert dialogs */
- val titleContentColor: Color @Composable get() = DialogTokens.HeadlineColor.toColor()
+ val titleContentColor: Color @Composable get() = DialogTokens.HeadlineColor.value
/** The default text color for alert dialogs */
- val textContentColor: Color @Composable get() = DialogTokens.SupportingTextColor.toColor()
+ val textContentColor: Color @Composable get() = DialogTokens.SupportingTextColor.value
/** The default tonal elevation for alert dialogs */
val TonalElevation: Dp = DialogTokens.ContainerElevation
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DatePickerDialog.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DatePickerDialog.android.kt
index f77adef..b374406 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DatePickerDialog.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DatePickerDialog.android.kt
@@ -95,7 +95,7 @@
.padding(DialogButtonsPadding)
) {
CompositionLocalProvider(
- LocalContentColor provides DialogTokens.ActionLabelTextColor.toColor()
+ LocalContentColor provides DialogTokens.ActionLabelTextColor.value
) {
val textStyle =
MaterialTheme.typography.fromToken(DialogTokens.ActionLabelTextFont)
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.android.kt
index d8dcc5c..4221c05 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.android.kt
@@ -24,4 +24,4 @@
private val DefaultPlatformTextStyle = PlatformTextStyle(
includeFontPadding = DefaultIncludeFontPadding
)
-internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = DefaultPlatformTextStyle
\ No newline at end of file
+internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = DefaultPlatformTextStyle
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
index cd1d852..3a885da 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
@@ -358,67 +358,67 @@
*/
@Composable
fun textFieldColors(
- focusedTextColor: Color = FilledAutocompleteTokens.FieldFocusInputTextColor.toColor(),
- unfocusedTextColor: Color = FilledAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ focusedTextColor: Color = FilledAutocompleteTokens.FieldFocusInputTextColor.value,
+ unfocusedTextColor: Color = FilledAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledInputTextOpacity),
- errorTextColor: Color = FilledAutocompleteTokens.FieldErrorInputTextColor.toColor(),
- focusedContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- unfocusedContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- disabledContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- errorContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.toColor(),
- errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ errorTextColor: Color = FilledAutocompleteTokens.FieldErrorInputTextColor.value,
+ focusedContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ unfocusedContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ disabledContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ errorContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.value,
+ errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
focusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.value,
unfocusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldActiveIndicatorColor.value,
disabledIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorOpacity),
errorIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.value,
focusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.toColor(),
- errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.value,
+ errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.value,
focusedPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ FilledAutocompleteTokens.FieldSupportingTextColor.value,
unfocusedPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ FilledAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPlaceholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ errorPlaceholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledPrefixColor: Color = FilledAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledSuffixColor: Color = FilledAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
): TextFieldColors =
TextFieldDefaults.colors(
focusedTextColor = focusedTextColor,
@@ -511,67 +511,67 @@
*/
@Composable
fun outlinedTextFieldColors(
- focusedTextColor: Color = OutlinedAutocompleteTokens.FieldFocusInputTextColor.toColor(),
- unfocusedTextColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ focusedTextColor: Color = OutlinedAutocompleteTokens.FieldFocusInputTextColor.value,
+ unfocusedTextColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledInputTextOpacity),
- errorTextColor: Color = OutlinedAutocompleteTokens.FieldErrorInputTextColor.toColor(),
+ errorTextColor: Color = OutlinedAutocompleteTokens.FieldErrorInputTextColor.value,
focusedContainerColor: Color = Color.Transparent,
unfocusedContainerColor: Color = Color.Transparent,
disabledContainerColor: Color = Color.Transparent,
errorContainerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.toColor(),
+ cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.value,
errorCursorColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.toColor(),
+ focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.value,
disabledBorderColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.toColor(),
+ errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.value,
focusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledLabelTextOpacity),
- errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
+ errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.value,
focusedPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
unfocusedPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
errorPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledPrefixColor: Color = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledSuffixColor: Color = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
): TextFieldColors =
OutlinedTextFieldDefaults.colors(
focusedTextColor = focusedTextColor,
@@ -627,65 +627,65 @@
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
fun textFieldColors(
- focusedTextColor: Color = FilledAutocompleteTokens.FieldFocusInputTextColor.toColor(),
- unfocusedTextColor: Color = FilledAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ focusedTextColor: Color = FilledAutocompleteTokens.FieldFocusInputTextColor.value,
+ unfocusedTextColor: Color = FilledAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledInputTextOpacity),
- errorTextColor: Color = FilledAutocompleteTokens.FieldErrorInputTextColor.toColor(),
- containerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- errorContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.toColor(),
- errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ errorTextColor: Color = FilledAutocompleteTokens.FieldErrorInputTextColor.value,
+ containerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ errorContainerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.value,
+ errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
focusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.value,
unfocusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldActiveIndicatorColor.value,
disabledIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorOpacity),
errorIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.value,
focusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.toColor(),
- errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.value,
+ errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.value,
focusedPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ FilledAutocompleteTokens.FieldSupportingTextColor.value,
unfocusedPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ FilledAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPlaceholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ errorPlaceholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledPrefixColor: Color = FilledAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorPrefixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledSuffixColor: Color = FilledAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = FilledAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorSuffixColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
): TextFieldColors =
textFieldColors(
focusedTextColor = focusedTextColor,
@@ -732,65 +732,65 @@
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
fun outlinedTextFieldColors(
- focusedTextColor: Color = OutlinedAutocompleteTokens.FieldFocusInputTextColor.toColor(),
- unfocusedTextColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ focusedTextColor: Color = OutlinedAutocompleteTokens.FieldFocusInputTextColor.value,
+ unfocusedTextColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledInputTextOpacity),
- errorTextColor: Color = OutlinedAutocompleteTokens.FieldErrorInputTextColor.toColor(),
+ errorTextColor: Color = OutlinedAutocompleteTokens.FieldErrorInputTextColor.value,
containerColor: Color = Color.Transparent,
errorContainerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.toColor(),
+ cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.value,
errorCursorColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.toColor(),
+ focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.value,
disabledBorderColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.toColor(),
+ errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.value,
focusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledLabelTextOpacity),
- errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
+ errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.value,
focusedPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
unfocusedPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
errorPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledPrefixColor: Color = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorPrefixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledSuffixColor: Color = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor
- .toColor().copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ .value.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
+ errorSuffixColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
): TextFieldColors =
outlinedTextFieldColors(
focusedTextColor = focusedTextColor,
@@ -837,47 +837,47 @@
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
fun textFieldColors(
- textColor: Color = FilledAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ textColor: Color = FilledAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = FilledAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledInputTextOpacity),
- containerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.toColor(),
- cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.toColor(),
- errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ containerColor: Color = FilledAutocompleteTokens.TextFieldContainerColor.value,
+ cursorColor: Color = FilledAutocompleteTokens.TextFieldCaretColor.value,
+ errorCursorColor: Color = FilledAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
focusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusActiveIndicatorColor.value,
unfocusedIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldActiveIndicatorColor.value,
disabledIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledActiveIndicatorOpacity),
errorIndicatorColor: Color =
- FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorActiveIndicatorColor.value,
focusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ FilledAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ FilledAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = FilledAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.toColor(),
- errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
- placeholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ FilledAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = FilledAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = FilledAutocompleteTokens.FieldDisabledLabelTextColor.value,
+ errorLabelColor: Color = FilledAutocompleteTokens.FieldErrorLabelTextColor.value,
+ placeholderColor: Color = FilledAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- FilledAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ FilledAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = FilledAutocompleteTokens.FieldDisabledInputTextOpacity)
): TextFieldColors = textFieldColors(
focusedTextColor = textColor,
@@ -911,61 +911,61 @@
unfocusedPlaceholderColor = placeholderColor,
disabledPlaceholderColor = disabledPlaceholderColor,
errorPlaceholderColor = placeholderColor,
- focusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- disabledPrefixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ focusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ disabledPrefixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- disabledSuffixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ errorPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ disabledSuffixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ errorSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
)
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
fun outlinedTextFieldColors(
- textColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.toColor(),
- disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ textColor: Color = OutlinedAutocompleteTokens.FieldInputTextColor.value,
+ disabledTextColor: Color = OutlinedAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledInputTextOpacity),
containerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.toColor(),
+ cursorColor: Color = OutlinedAutocompleteTokens.TextFieldCaretColor.value,
errorCursorColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.toColor(),
+ focusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldFocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedAutocompleteTokens.TextFieldOutlineColor.value,
disabledBorderColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledOutlineColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.toColor(),
+ errorBorderColor: Color = OutlinedAutocompleteTokens.TextFieldErrorOutlineColor.value,
focusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusLeadingIconColor.value,
unfocusedLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldLeadingIconColor.value,
disabledLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledLeadingIconOpacity),
errorLeadingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldErrorLeadingIconColor.value,
focusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldFocusTrailingIconColor.value,
unfocusedTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldTrailingIconColor.toColor(),
+ OutlinedAutocompleteTokens.TextFieldTrailingIconColor.value,
disabledTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconColor.value
.copy(alpha = OutlinedAutocompleteTokens.TextFieldDisabledTrailingIconOpacity),
errorTrailingIconColor: Color =
- OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.toColor(),
- unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.toColor(),
- disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.toColor()
+ OutlinedAutocompleteTokens.TextFieldErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedAutocompleteTokens.FieldFocusLabelTextColor.value,
+ unfocusedLabelColor: Color = OutlinedAutocompleteTokens.FieldLabelTextColor.value,
+ disabledLabelColor: Color = OutlinedAutocompleteTokens.FieldDisabledLabelTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledLabelTextOpacity),
- errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.toColor(),
- placeholderColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ errorLabelColor: Color = OutlinedAutocompleteTokens.FieldErrorLabelTextColor.value,
+ placeholderColor: Color = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
disabledPlaceholderColor: Color =
- OutlinedAutocompleteTokens.FieldDisabledInputTextColor.toColor()
+ OutlinedAutocompleteTokens.FieldDisabledInputTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledInputTextOpacity)
): TextFieldColors = outlinedTextFieldColors(
focusedTextColor = textColor,
@@ -999,16 +999,16 @@
unfocusedPlaceholderColor = placeholderColor,
disabledPlaceholderColor = disabledPlaceholderColor,
errorPlaceholderColor = placeholderColor,
- focusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- disabledPrefixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ focusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ disabledPrefixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- focusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- unfocusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
- disabledSuffixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.toColor()
+ errorPrefixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ focusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ unfocusedSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
+ disabledSuffixColor = OutlinedAutocompleteTokens.FieldDisabledSupportingTextColor.value
.copy(alpha = OutlinedAutocompleteTokens.FieldDisabledSupportingTextOpacity),
- errorSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.toColor(),
+ errorSuffixColor = OutlinedAutocompleteTokens.FieldSupportingTextColor.value,
)
}
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.android.kt
index 6cebcc5..8be2585 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.android.kt
@@ -25,4 +25,4 @@
style: TextStyle,
includeFontPadding: Boolean
): TextStyle =
- style.copy(platformStyle = PlatformTextStyle(includeFontPadding = includeFontPadding))
\ No newline at end of file
+ style.copy(platformStyle = PlatformTextStyle(includeFontPadding = includeFontPadding))
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.kt
index 270f81a..c4afd00 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.kt
@@ -30,6 +30,7 @@
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.interaction.Interaction
import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
@@ -247,8 +248,8 @@
.offset(vertical = -animatedTopPadding))
layout(width, height) {
placeable.placeRelative(0, animatedTopPadding)
+ }
}
- }
) {
Column {
val animatedInputFieldPadding = remember {
@@ -281,8 +282,10 @@
}
}
+ val isFocused = interactionSource.collectIsFocusedAsState().value
+ val shouldClearFocus = !active && isFocused
LaunchedEffect(active) {
- if (!active) {
+ if (shouldClearFocus) {
// Not strictly needed according to the motion spec, but since the animation already has
// a delay, this works around b/261632544.
delay(AnimationDelayMillis.toLong())
@@ -408,8 +411,10 @@
}
}
+ val isFocused = interactionSource.collectIsFocusedAsState().value
+ val shouldClearFocus = !active && isFocused
LaunchedEffect(active) {
- if (!active) {
+ if (shouldClearFocus) {
// Not strictly needed according to the motion spec, but since the animation already has
// a delay, this works around b/261632544.
delay(AnimationDelayMillis.toLong())
@@ -516,14 +521,14 @@
val InputFieldHeight: Dp = SearchBarTokens.ContainerHeight
/** Default shape for a search bar's input field, or a search bar in the inactive state. */
- val inputFieldShape: Shape @Composable get() = SearchBarTokens.ContainerShape.toShape()
+ val inputFieldShape: Shape @Composable get() = SearchBarTokens.ContainerShape.value
/** Default shape for a [SearchBar] in the active state. */
val fullScreenShape: Shape
- @Composable get() = SearchViewTokens.FullScreenContainerShape.toShape()
+ @Composable get() = SearchViewTokens.FullScreenContainerShape.value
/** Default shape for a [DockedSearchBar]. */
- val dockedShape: Shape @Composable get() = SearchViewTokens.DockedContainerShape.toShape()
+ val dockedShape: Shape @Composable get() = SearchViewTokens.DockedContainerShape.value
/** Default window insets for a [SearchBar]. */
val windowInsets: WindowInsets @Composable get() = WindowInsets.statusBars
@@ -538,8 +543,8 @@
*/
@Composable
fun colors(
- containerColor: Color = SearchBarTokens.ContainerColor.toColor(),
- dividerColor: Color = SearchViewTokens.DividerColor.toColor(),
+ containerColor: Color = SearchBarTokens.ContainerColor.value,
+ dividerColor: Color = SearchViewTokens.DividerColor.value,
inputFieldColors: TextFieldColors = inputFieldColors(),
): SearchBarColors = SearchBarColors(
containerColor = containerColor,
@@ -573,23 +578,23 @@
*/
@Composable
fun inputFieldColors(
- focusedTextColor: Color = SearchBarTokens.InputTextColor.toColor(),
- unfocusedTextColor: Color = SearchBarTokens.InputTextColor.toColor(),
- disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ focusedTextColor: Color = SearchBarTokens.InputTextColor.value,
+ unfocusedTextColor: Color = SearchBarTokens.InputTextColor.value,
+ disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- cursorColor: Color = FilledTextFieldTokens.CaretColor.toColor(),
+ cursorColor: Color = FilledTextFieldTokens.CaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.toColor(),
+ focusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value,
disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor
- .toColor().copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
- focusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.toColor(),
+ .value.copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
+ focusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value,
disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor
- .toColor().copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
- focusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.toColor(),
- unfocusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.toColor(),
- disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ .value.copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
+ focusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.value,
+ unfocusedPlaceholderColor: Color = SearchBarTokens.SupportingTextColor.value,
+ disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
): TextFieldColors =
TextFieldDefaults.colors(
@@ -612,21 +617,21 @@
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
fun inputFieldColors(
- textColor: Color = SearchBarTokens.InputTextColor.toColor(),
- disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ textColor: Color = SearchBarTokens.InputTextColor.value,
+ disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- cursorColor: Color = FilledTextFieldTokens.CaretColor.toColor(),
+ cursorColor: Color = FilledTextFieldTokens.CaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.toColor(),
+ focusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = SearchBarTokens.LeadingIconColor.value,
disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor
- .toColor().copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
- focusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.toColor(),
+ .value.copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
+ focusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = SearchBarTokens.TrailingIconColor.value,
disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor
- .toColor().copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
- placeholderColor: Color = SearchBarTokens.SupportingTextColor.toColor(),
- disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ .value.copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
+ placeholderColor: Color = SearchBarTokens.SupportingTextColor.value,
+ disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
) = inputFieldColors(
focusedTextColor = textColor,
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.android.kt
index 9cb5c3c..d206d84 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.android.kt
@@ -22,4 +22,4 @@
internal actual val WindowInsets.Companion.systemBarsForVisualComponents: WindowInsets
@Composable
- get() = systemBars
\ No newline at end of file
+ get() = systemBars
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/TooltipPopup.android.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/TooltipPopup.android.kt
index 3b039c7..1074b7e 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/TooltipPopup.android.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/TooltipPopup.android.kt
@@ -33,4 +33,4 @@
onDismissRequest = onDismissRequest,
content = content,
properties = PopupProperties(focusable = focusable)
-)
\ No newline at end of file
+)
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
index 8e30c16..c63eeb4 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
@@ -469,7 +469,7 @@
contentColor = contentColor,
tonalElevation = tonalElevation,
// TODO(b/209583788): Consider adding a shape parameter if updated design guidance allows
- shape = BottomAppBarTokens.ContainerShape.toShape(),
+ shape = BottomAppBarTokens.ContainerShape.value,
modifier = modifier
) {
Row(
@@ -547,14 +547,14 @@
*/
@Composable
fun topAppBarColors(
- containerColor: Color = TopAppBarSmallTokens.ContainerColor.toColor(),
+ containerColor: Color = TopAppBarSmallTokens.ContainerColor.value,
scrolledContainerColor: Color = MaterialTheme.colorScheme.applyTonalElevation(
backgroundColor = containerColor,
elevation = TopAppBarSmallTokens.OnScrollContainerElevation
),
- navigationIconContentColor: Color = TopAppBarSmallTokens.LeadingIconColor.toColor(),
- titleContentColor: Color = TopAppBarSmallTokens.HeadlineColor.toColor(),
- actionIconContentColor: Color = TopAppBarSmallTokens.TrailingIconColor.toColor(),
+ navigationIconContentColor: Color = TopAppBarSmallTokens.LeadingIconColor.value,
+ titleContentColor: Color = TopAppBarSmallTokens.HeadlineColor.value,
+ actionIconContentColor: Color = TopAppBarSmallTokens.TrailingIconColor.value,
): TopAppBarColors =
TopAppBarColors(
containerColor,
@@ -586,14 +586,14 @@
)
@Composable
fun smallTopAppBarColors(
- containerColor: Color = TopAppBarSmallTokens.ContainerColor.toColor(),
+ containerColor: Color = TopAppBarSmallTokens.ContainerColor.value,
scrolledContainerColor: Color = MaterialTheme.colorScheme.applyTonalElevation(
backgroundColor = containerColor,
elevation = TopAppBarSmallTokens.OnScrollContainerElevation
),
- navigationIconContentColor: Color = TopAppBarSmallTokens.LeadingIconColor.toColor(),
- titleContentColor: Color = TopAppBarSmallTokens.HeadlineColor.toColor(),
- actionIconContentColor: Color = TopAppBarSmallTokens.TrailingIconColor.toColor(),
+ navigationIconContentColor: Color = TopAppBarSmallTokens.LeadingIconColor.value,
+ titleContentColor: Color = TopAppBarSmallTokens.HeadlineColor.value,
+ actionIconContentColor: Color = TopAppBarSmallTokens.TrailingIconColor.value,
): TopAppBarColors =
topAppBarColors(
containerColor,
@@ -624,14 +624,14 @@
*/
@Composable
fun centerAlignedTopAppBarColors(
- containerColor: Color = TopAppBarSmallCenteredTokens.ContainerColor.toColor(),
+ containerColor: Color = TopAppBarSmallCenteredTokens.ContainerColor.value,
scrolledContainerColor: Color = MaterialTheme.colorScheme.applyTonalElevation(
backgroundColor = containerColor,
elevation = TopAppBarSmallTokens.OnScrollContainerElevation
),
- navigationIconContentColor: Color = TopAppBarSmallCenteredTokens.LeadingIconColor.toColor(),
- titleContentColor: Color = TopAppBarSmallCenteredTokens.HeadlineColor.toColor(),
- actionIconContentColor: Color = TopAppBarSmallCenteredTokens.TrailingIconColor.toColor(),
+ navigationIconContentColor: Color = TopAppBarSmallCenteredTokens.LeadingIconColor.value,
+ titleContentColor: Color = TopAppBarSmallCenteredTokens.HeadlineColor.value,
+ actionIconContentColor: Color = TopAppBarSmallCenteredTokens.TrailingIconColor.value,
): TopAppBarColors =
TopAppBarColors(
containerColor,
@@ -655,14 +655,14 @@
*/
@Composable
fun mediumTopAppBarColors(
- containerColor: Color = TopAppBarMediumTokens.ContainerColor.toColor(),
+ containerColor: Color = TopAppBarMediumTokens.ContainerColor.value,
scrolledContainerColor: Color = MaterialTheme.colorScheme.applyTonalElevation(
backgroundColor = containerColor,
elevation = TopAppBarSmallTokens.OnScrollContainerElevation
),
- navigationIconContentColor: Color = TopAppBarMediumTokens.LeadingIconColor.toColor(),
- titleContentColor: Color = TopAppBarMediumTokens.HeadlineColor.toColor(),
- actionIconContentColor: Color = TopAppBarMediumTokens.TrailingIconColor.toColor(),
+ navigationIconContentColor: Color = TopAppBarMediumTokens.LeadingIconColor.value,
+ titleContentColor: Color = TopAppBarMediumTokens.HeadlineColor.value,
+ actionIconContentColor: Color = TopAppBarMediumTokens.TrailingIconColor.value,
): TopAppBarColors =
TopAppBarColors(
containerColor,
@@ -686,14 +686,14 @@
*/
@Composable
fun largeTopAppBarColors(
- containerColor: Color = TopAppBarLargeTokens.ContainerColor.toColor(),
+ containerColor: Color = TopAppBarLargeTokens.ContainerColor.value,
scrolledContainerColor: Color = MaterialTheme.colorScheme.applyTonalElevation(
backgroundColor = containerColor,
elevation = TopAppBarSmallTokens.OnScrollContainerElevation
),
- navigationIconContentColor: Color = TopAppBarLargeTokens.LeadingIconColor.toColor(),
- titleContentColor: Color = TopAppBarLargeTokens.HeadlineColor.toColor(),
- actionIconContentColor: Color = TopAppBarLargeTokens.TrailingIconColor.toColor(),
+ navigationIconContentColor: Color = TopAppBarLargeTokens.LeadingIconColor.value,
+ titleContentColor: Color = TopAppBarLargeTokens.HeadlineColor.value,
+ actionIconContentColor: Color = TopAppBarLargeTokens.TrailingIconColor.value,
): TopAppBarColors =
TopAppBarColors(
containerColor,
@@ -842,9 +842,9 @@
* Updates to the [heightOffset] value are coerced between zero and [heightOffsetLimit].
*/
var heightOffset: Float
- get() = _heightOffset.value
+ get() = _heightOffset.floatValue
set(newOffset) {
- _heightOffset.value = newOffset.coerceIn(
+ _heightOffset.floatValue = newOffset.coerceIn(
minimumValue = heightOffsetLimit,
maximumValue = 0f
)
@@ -981,10 +981,10 @@
/** Contains default values used for the bottom app bar implementations. */
object BottomAppBarDefaults {
- /** Default color used for [BottomAppBar] container **/
- val containerColor: Color @Composable get() = BottomAppBarTokens.ContainerColor.toColor()
+ /** Default color used for [BottomAppBar] container */
+ val containerColor: Color @Composable get() = BottomAppBarTokens.ContainerColor.value
- /** Default elevation used for [BottomAppBar] **/
+ /** Default elevation used for [BottomAppBar] */
val ContainerElevation: Dp = BottomAppBarTokens.ContainerElevation
/**
@@ -1010,7 +1010,7 @@
/** The color of a [BottomAppBar]'s [FloatingActionButton] */
val bottomAppBarFabColor: Color
@Composable get() =
- FabSecondaryTokens.ContainerColor.toColor()
+ FabSecondaryTokens.ContainerColor.value
}
// Padding minus IconButton's min touch target expansion
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Badge.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Badge.kt
index 811d6fa..9dee9d0 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Badge.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Badge.kt
@@ -186,9 +186,9 @@
) {
val size = if (content != null) BadgeTokens.LargeSize else BadgeTokens.Size
val shape = if (content != null) {
- BadgeTokens.LargeShape.toShape()
+ BadgeTokens.LargeShape.value
} else {
- BadgeTokens.Shape.toShape()
+ BadgeTokens.Shape.value
}
// Draw badge container.
@@ -229,7 +229,7 @@
@ExperimentalMaterial3Api
object BadgeDefaults {
/** Default container color for a badge. */
- val containerColor: Color @Composable get() = BadgeTokens.Color.toColor()
+ val containerColor: Color @Composable get() = BadgeTokens.Color.value
}
/*@VisibleForTesting*/
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt
index 20adb98..43e8c1a 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt
@@ -393,4 +393,4 @@
}
}
-private enum class BottomSheetScaffoldLayoutSlot { TopBar, Body, Sheet, Snackbar }
\ No newline at end of file
+private enum class BottomSheetScaffoldLayoutSlot { TopBar, Body, Sheet, Snackbar }
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt
index 47cbc44..88b46ce 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt
@@ -526,19 +526,19 @@
val IconSpacing = 8.dp
/** Default shape for a button. */
- val shape: Shape @Composable get() = FilledButtonTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = FilledButtonTokens.ContainerShape.value
/** Default shape for an elevated button. */
- val elevatedShape: Shape @Composable get() = ElevatedButtonTokens.ContainerShape.toShape()
+ val elevatedShape: Shape @Composable get() = ElevatedButtonTokens.ContainerShape.value
/** Default shape for a filled tonal button. */
- val filledTonalShape: Shape @Composable get() = FilledTonalButtonTokens.ContainerShape.toShape()
+ val filledTonalShape: Shape @Composable get() = FilledTonalButtonTokens.ContainerShape.value
/** Default shape for an outlined button. */
- val outlinedShape: Shape @Composable get() = OutlinedButtonTokens.ContainerShape.toShape()
+ val outlinedShape: Shape @Composable get() = OutlinedButtonTokens.ContainerShape.value
/** Default shape for a text button. */
- val textShape: Shape @Composable get() = TextButtonTokens.ContainerShape.toShape()
+ val textShape: Shape @Composable get() = TextButtonTokens.ContainerShape.value
/**
* Creates a [ButtonColors] that represents the default container and content colors used in a
@@ -551,12 +551,12 @@
*/
@Composable
fun buttonColors(
- containerColor: Color = FilledButtonTokens.ContainerColor.toColor(),
- contentColor: Color = FilledButtonTokens.LabelTextColor.toColor(),
+ containerColor: Color = FilledButtonTokens.ContainerColor.value,
+ contentColor: Color = FilledButtonTokens.LabelTextColor.value,
disabledContainerColor: Color =
- FilledButtonTokens.DisabledContainerColor.toColor()
+ FilledButtonTokens.DisabledContainerColor.value
.copy(alpha = FilledButtonTokens.DisabledContainerOpacity),
- disabledContentColor: Color = FilledButtonTokens.DisabledLabelTextColor.toColor()
+ disabledContentColor: Color = FilledButtonTokens.DisabledLabelTextColor.value
.copy(alpha = FilledButtonTokens.DisabledLabelTextOpacity),
): ButtonColors = ButtonColors(
containerColor = containerColor,
@@ -576,13 +576,13 @@
*/
@Composable
fun elevatedButtonColors(
- containerColor: Color = ElevatedButtonTokens.ContainerColor.toColor(),
- contentColor: Color = ElevatedButtonTokens.LabelTextColor.toColor(),
+ containerColor: Color = ElevatedButtonTokens.ContainerColor.value,
+ contentColor: Color = ElevatedButtonTokens.LabelTextColor.value,
disabledContainerColor: Color = ElevatedButtonTokens.DisabledContainerColor
- .toColor()
+ .value
.copy(alpha = ElevatedButtonTokens.DisabledContainerOpacity),
disabledContentColor: Color = ElevatedButtonTokens.DisabledLabelTextColor
- .toColor()
+ .value
.copy(alpha = ElevatedButtonTokens.DisabledLabelTextOpacity),
): ButtonColors = ButtonColors(
containerColor = containerColor,
@@ -602,13 +602,13 @@
*/
@Composable
fun filledTonalButtonColors(
- containerColor: Color = FilledTonalButtonTokens.ContainerColor.toColor(),
- contentColor: Color = FilledTonalButtonTokens.LabelTextColor.toColor(),
+ containerColor: Color = FilledTonalButtonTokens.ContainerColor.value,
+ contentColor: Color = FilledTonalButtonTokens.LabelTextColor.value,
disabledContainerColor: Color = FilledTonalButtonTokens.DisabledContainerColor
- .toColor()
+ .value
.copy(alpha = FilledTonalButtonTokens.DisabledContainerOpacity),
disabledContentColor: Color = FilledTonalButtonTokens.DisabledLabelTextColor
- .toColor()
+ .value
.copy(alpha = FilledTonalButtonTokens.DisabledLabelTextOpacity),
): ButtonColors = ButtonColors(
containerColor = containerColor,
@@ -629,10 +629,10 @@
@Composable
fun outlinedButtonColors(
containerColor: Color = Color.Transparent,
- contentColor: Color = OutlinedButtonTokens.LabelTextColor.toColor(),
+ contentColor: Color = OutlinedButtonTokens.LabelTextColor.value,
disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = OutlinedButtonTokens.DisabledLabelTextColor
- .toColor()
+ .value
.copy(alpha = OutlinedButtonTokens.DisabledLabelTextOpacity),
): ButtonColors = ButtonColors(
containerColor = containerColor,
@@ -653,10 +653,10 @@
@Composable
fun textButtonColors(
containerColor: Color = Color.Transparent,
- contentColor: Color = TextButtonTokens.LabelTextColor.toColor(),
+ contentColor: Color = TextButtonTokens.LabelTextColor.value,
disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = TextButtonTokens.DisabledLabelTextColor
- .toColor()
+ .value
.copy(alpha = TextButtonTokens.DisabledLabelTextOpacity),
): ButtonColors = ButtonColors(
containerColor = containerColor,
@@ -749,7 +749,7 @@
@Composable
get() = BorderStroke(
width = OutlinedButtonTokens.OutlineWidth,
- color = OutlinedButtonTokens.OutlineColor.toColor(),
+ color = OutlinedButtonTokens.OutlineColor.value,
)
}
@@ -960,4 +960,4 @@
result = 31 * result + disabledContentColor.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt
index cf4ce4c..8a55fb0 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt
@@ -352,13 +352,13 @@
object CardDefaults {
// shape Defaults
/** Default shape for a card. */
- val shape: Shape @Composable get() = FilledCardTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = FilledCardTokens.ContainerShape.value
/** Default shape for an elevated card. */
- val elevatedShape: Shape @Composable get() = ElevatedCardTokens.ContainerShape.toShape()
+ val elevatedShape: Shape @Composable get() = ElevatedCardTokens.ContainerShape.value
/** Default shape for an outlined card. */
- val outlinedShape: Shape @Composable get() = OutlinedCardTokens.ContainerShape.toShape()
+ val outlinedShape: Shape @Composable get() = OutlinedCardTokens.ContainerShape.value
/**
* Creates a [CardElevation] that will animate between the provided values according to the
@@ -454,10 +454,10 @@
*/
@Composable
fun cardColors(
- containerColor: Color = FilledCardTokens.ContainerColor.toColor(),
+ containerColor: Color = FilledCardTokens.ContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
disabledContainerColor: Color =
- FilledCardTokens.DisabledContainerColor.toColor()
+ FilledCardTokens.DisabledContainerColor.value
.copy(alpha = FilledCardTokens.DisabledContainerOpacity)
.compositeOver(
MaterialTheme.colorScheme.surfaceColorAtElevation(
@@ -483,10 +483,10 @@
*/
@Composable
fun elevatedCardColors(
- containerColor: Color = ElevatedCardTokens.ContainerColor.toColor(),
+ containerColor: Color = ElevatedCardTokens.ContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
disabledContainerColor: Color =
- ElevatedCardTokens.DisabledContainerColor.toColor()
+ ElevatedCardTokens.DisabledContainerColor.value
.copy(alpha = ElevatedCardTokens.DisabledContainerOpacity)
.compositeOver(
MaterialTheme.colorScheme.surfaceColorAtElevation(
@@ -513,7 +513,7 @@
*/
@Composable
fun outlinedCardColors(
- containerColor: Color = OutlinedCardTokens.ContainerColor.toColor(),
+ containerColor: Color = OutlinedCardTokens.ContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
disabledContainerColor: Color = containerColor,
disabledContentColor: Color = contentColor.copy(DisabledAlpha),
@@ -533,9 +533,9 @@
@Composable
fun outlinedCardBorder(enabled: Boolean = true): BorderStroke {
val color = if (enabled) {
- OutlinedCardTokens.OutlineColor.toColor()
+ OutlinedCardTokens.OutlineColor.value
} else {
- OutlinedCardTokens.DisabledOutlineColor.toColor()
+ OutlinedCardTokens.DisabledOutlineColor.value
.copy(alpha = OutlinedCardTokens.DisabledOutlineOpacity)
.compositeOver(
MaterialTheme.colorScheme.surfaceColorAtElevation(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt
index 897d1d4..4f00d2c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt
@@ -440,7 +440,7 @@
var shapedAvatar: @Composable (() -> Unit)? = null
if (avatar != null) {
val avatarOpacity = if (enabled) 1f else InputChipTokens.DisabledAvatarOpacity
- val avatarShape = InputChipTokens.AvatarShape.toShape()
+ val avatarShape = InputChipTokens.AvatarShape.value
shapedAvatar = @Composable {
Box(
modifier = Modifier.graphicsLayer {
@@ -646,14 +646,14 @@
@Composable
fun assistChipColors(
containerColor: Color = Color.Transparent,
- labelColor: Color = AssistChipTokens.LabelTextColor.toColor(),
- leadingIconContentColor: Color = AssistChipTokens.IconColor.toColor(),
+ labelColor: Color = AssistChipTokens.LabelTextColor.value,
+ leadingIconContentColor: Color = AssistChipTokens.IconColor.value,
trailingIconContentColor: Color = leadingIconContentColor,
disabledContainerColor: Color = Color.Transparent,
- disabledLabelColor: Color = AssistChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = AssistChipTokens.DisabledLabelTextColor.value
.copy(alpha = AssistChipTokens.DisabledLabelTextOpacity),
disabledLeadingIconContentColor: Color =
- AssistChipTokens.DisabledIconColor.toColor()
+ AssistChipTokens.DisabledIconColor.value
.copy(alpha = AssistChipTokens.DisabledIconOpacity),
disabledTrailingIconContentColor: Color = disabledLeadingIconContentColor,
): ChipColors = ChipColors(
@@ -705,8 +705,8 @@
*/
@Composable
fun assistChipBorder(
- borderColor: Color = AssistChipTokens.FlatOutlineColor.toColor(),
- disabledBorderColor: Color = AssistChipTokens.FlatDisabledOutlineColor.toColor()
+ borderColor: Color = AssistChipTokens.FlatOutlineColor.value,
+ disabledBorderColor: Color = AssistChipTokens.FlatDisabledOutlineColor.value
.copy(alpha = AssistChipTokens.FlatDisabledOutlineOpacity),
borderWidth: Dp = AssistChipTokens.FlatOutlineWidth,
): ChipBorder = ChipBorder(
@@ -730,16 +730,16 @@
*/
@Composable
fun elevatedAssistChipColors(
- containerColor: Color = AssistChipTokens.ElevatedContainerColor.toColor(),
- labelColor: Color = AssistChipTokens.LabelTextColor.toColor(),
- leadingIconContentColor: Color = AssistChipTokens.IconColor.toColor(),
+ containerColor: Color = AssistChipTokens.ElevatedContainerColor.value,
+ labelColor: Color = AssistChipTokens.LabelTextColor.value,
+ leadingIconContentColor: Color = AssistChipTokens.IconColor.value,
trailingIconContentColor: Color = leadingIconContentColor,
- disabledContainerColor: Color = AssistChipTokens.ElevatedDisabledContainerColor.toColor()
+ disabledContainerColor: Color = AssistChipTokens.ElevatedDisabledContainerColor.value
.copy(alpha = AssistChipTokens.ElevatedDisabledContainerOpacity),
- disabledLabelColor: Color = AssistChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = AssistChipTokens.DisabledLabelTextColor.value
.copy(alpha = AssistChipTokens.DisabledLabelTextOpacity),
disabledLeadingIconContentColor: Color =
- AssistChipTokens.DisabledIconColor.toColor()
+ AssistChipTokens.DisabledIconColor.value
.copy(alpha = AssistChipTokens.DisabledIconOpacity),
disabledTrailingIconContentColor: Color = disabledLeadingIconContentColor,
): ChipColors = ChipColors(
@@ -783,7 +783,7 @@
)
/** Default shape of an assist chip. */
- val shape: Shape @Composable get() = AssistChipTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = AssistChipTokens.ContainerShape.value
}
/**
@@ -823,20 +823,20 @@
@Composable
fun filterChipColors(
containerColor: Color = Color.Transparent,
- labelColor: Color = FilterChipTokens.UnselectedLabelTextColor.toColor(),
- iconColor: Color = FilterChipTokens.LeadingIconUnselectedColor.toColor(),
+ labelColor: Color = FilterChipTokens.UnselectedLabelTextColor.value,
+ iconColor: Color = FilterChipTokens.LeadingIconUnselectedColor.value,
disabledContainerColor: Color = Color.Transparent,
- disabledLabelColor: Color = FilterChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = FilterChipTokens.DisabledLabelTextColor.value
.copy(alpha = FilterChipTokens.DisabledLabelTextOpacity),
- disabledLeadingIconColor: Color = FilterChipTokens.DisabledLeadingIconColor.toColor()
+ disabledLeadingIconColor: Color = FilterChipTokens.DisabledLeadingIconColor.value
.copy(alpha = FilterChipTokens.DisabledLeadingIconOpacity),
disabledTrailingIconColor: Color = disabledLeadingIconColor,
- selectedContainerColor: Color = FilterChipTokens.FlatSelectedContainerColor.toColor(),
+ selectedContainerColor: Color = FilterChipTokens.FlatSelectedContainerColor.value,
disabledSelectedContainerColor: Color =
- FilterChipTokens.FlatDisabledSelectedContainerColor.toColor()
+ FilterChipTokens.FlatDisabledSelectedContainerColor.value
.copy(alpha = FilterChipTokens.FlatDisabledSelectedContainerOpacity),
- selectedLabelColor: Color = FilterChipTokens.SelectedLabelTextColor.toColor(),
- selectedLeadingIconColor: Color = FilterChipTokens.SelectedLeadingIconColor.toColor(),
+ selectedLabelColor: Color = FilterChipTokens.SelectedLabelTextColor.value,
+ selectedLeadingIconColor: Color = FilterChipTokens.SelectedLeadingIconColor.value,
selectedTrailingIconColor: Color = selectedLeadingIconColor
): SelectableChipColors = SelectableChipColors(
containerColor = containerColor,
@@ -898,9 +898,9 @@
*/
@Composable
fun filterChipBorder(
- borderColor: Color = FilterChipTokens.FlatUnselectedOutlineColor.toColor(),
+ borderColor: Color = FilterChipTokens.FlatUnselectedOutlineColor.value,
selectedBorderColor: Color = Color.Transparent,
- disabledBorderColor: Color = FilterChipTokens.FlatDisabledUnselectedOutlineColor.toColor()
+ disabledBorderColor: Color = FilterChipTokens.FlatDisabledUnselectedOutlineColor.value
.copy(alpha = FilterChipTokens.FlatDisabledUnselectedOutlineOpacity),
disabledSelectedBorderColor: Color = Color.Transparent,
borderWidth: Dp = FilterChipTokens.FlatUnselectedOutlineWidth,
@@ -934,20 +934,20 @@
*/
@Composable
fun elevatedFilterChipColors(
- containerColor: Color = FilterChipTokens.ElevatedUnselectedContainerColor.toColor(),
- labelColor: Color = FilterChipTokens.UnselectedLabelTextColor.toColor(),
- iconColor: Color = FilterChipTokens.LeadingIconUnselectedColor.toColor(),
- disabledContainerColor: Color = FilterChipTokens.ElevatedDisabledContainerColor.toColor()
+ containerColor: Color = FilterChipTokens.ElevatedUnselectedContainerColor.value,
+ labelColor: Color = FilterChipTokens.UnselectedLabelTextColor.value,
+ iconColor: Color = FilterChipTokens.LeadingIconUnselectedColor.value,
+ disabledContainerColor: Color = FilterChipTokens.ElevatedDisabledContainerColor.value
.copy(alpha = FilterChipTokens.ElevatedDisabledContainerOpacity),
- disabledLabelColor: Color = FilterChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = FilterChipTokens.DisabledLabelTextColor.value
.copy(alpha = FilterChipTokens.DisabledLabelTextOpacity),
- disabledLeadingIconColor: Color = FilterChipTokens.DisabledLeadingIconColor.toColor()
+ disabledLeadingIconColor: Color = FilterChipTokens.DisabledLeadingIconColor.value
.copy(alpha = FilterChipTokens.DisabledLeadingIconOpacity),
disabledTrailingIconColor: Color = disabledLeadingIconColor,
- selectedContainerColor: Color = FilterChipTokens.ElevatedSelectedContainerColor.toColor(),
+ selectedContainerColor: Color = FilterChipTokens.ElevatedSelectedContainerColor.value,
disabledSelectedContainerColor: Color = disabledContainerColor,
- selectedLabelColor: Color = FilterChipTokens.SelectedLabelTextColor.toColor(),
- selectedLeadingIconColor: Color = FilterChipTokens.SelectedLeadingIconColor.toColor(),
+ selectedLabelColor: Color = FilterChipTokens.SelectedLabelTextColor.value,
+ selectedLeadingIconColor: Color = FilterChipTokens.SelectedLeadingIconColor.value,
selectedTrailingIconColor: Color = selectedLeadingIconColor
): SelectableChipColors = SelectableChipColors(
containerColor = containerColor,
@@ -995,7 +995,7 @@
)
/** Default shape of a filter chip. */
- val shape: Shape @Composable get() = FilterChipTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = FilterChipTokens.ContainerShape.value
}
/**
@@ -1041,23 +1041,23 @@
@Composable
fun inputChipColors(
containerColor: Color = Color.Transparent,
- labelColor: Color = InputChipTokens.UnselectedLabelTextColor.toColor(),
- leadingIconColor: Color = InputChipTokens.UnselectedLeadingIconColor.toColor(),
- trailingIconColor: Color = InputChipTokens.UnselectedTrailingIconColor.toColor(),
+ labelColor: Color = InputChipTokens.UnselectedLabelTextColor.value,
+ leadingIconColor: Color = InputChipTokens.UnselectedLeadingIconColor.value,
+ trailingIconColor: Color = InputChipTokens.UnselectedTrailingIconColor.value,
disabledContainerColor: Color = Color.Transparent,
- disabledLabelColor: Color = InputChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = InputChipTokens.DisabledLabelTextColor.value
.copy(alpha = InputChipTokens.DisabledLabelTextOpacity),
- disabledLeadingIconColor: Color = InputChipTokens.DisabledLeadingIconColor.toColor()
+ disabledLeadingIconColor: Color = InputChipTokens.DisabledLeadingIconColor.value
.copy(alpha = InputChipTokens.DisabledLeadingIconOpacity),
- disabledTrailingIconColor: Color = InputChipTokens.DisabledTrailingIconColor.toColor()
+ disabledTrailingIconColor: Color = InputChipTokens.DisabledTrailingIconColor.value
.copy(alpha = InputChipTokens.DisabledTrailingIconOpacity),
- selectedContainerColor: Color = InputChipTokens.SelectedContainerColor.toColor(),
+ selectedContainerColor: Color = InputChipTokens.SelectedContainerColor.value,
disabledSelectedContainerColor: Color =
- InputChipTokens.DisabledSelectedContainerColor.toColor()
+ InputChipTokens.DisabledSelectedContainerColor.value
.copy(alpha = InputChipTokens.DisabledSelectedContainerOpacity),
- selectedLabelColor: Color = InputChipTokens.SelectedLabelTextColor.toColor(),
- selectedLeadingIconColor: Color = InputChipTokens.SelectedLeadingIconColor.toColor(),
- selectedTrailingIconColor: Color = InputChipTokens.SelectedTrailingIconColor.toColor()
+ selectedLabelColor: Color = InputChipTokens.SelectedLabelTextColor.value,
+ selectedLeadingIconColor: Color = InputChipTokens.SelectedLeadingIconColor.value,
+ selectedTrailingIconColor: Color = InputChipTokens.SelectedTrailingIconColor.value
): SelectableChipColors = SelectableChipColors(
containerColor = containerColor,
labelColor = labelColor,
@@ -1117,9 +1117,9 @@
*/
@Composable
fun inputChipBorder(
- borderColor: Color = InputChipTokens.UnselectedOutlineColor.toColor(),
+ borderColor: Color = InputChipTokens.UnselectedOutlineColor.value,
selectedBorderColor: Color = Color.Transparent,
- disabledBorderColor: Color = InputChipTokens.DisabledUnselectedOutlineColor.toColor()
+ disabledBorderColor: Color = InputChipTokens.DisabledUnselectedOutlineColor.value
.copy(alpha = InputChipTokens.DisabledUnselectedOutlineOpacity),
disabledSelectedBorderColor: Color = Color.Transparent,
borderWidth: Dp = InputChipTokens.UnselectedOutlineWidth,
@@ -1134,7 +1134,7 @@
)
/** Default shape of an input chip. */
- val shape: Shape @Composable get() = InputChipTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = InputChipTokens.ContainerShape.value
}
/**
@@ -1166,12 +1166,12 @@
@Composable
fun suggestionChipColors(
containerColor: Color = Color.Transparent,
- labelColor: Color = SuggestionChipTokens.LabelTextColor.toColor(),
- iconContentColor: Color = SuggestionChipTokens.LeadingIconColor.toColor(),
+ labelColor: Color = SuggestionChipTokens.LabelTextColor.value,
+ iconContentColor: Color = SuggestionChipTokens.LeadingIconColor.value,
disabledContainerColor: Color = Color.Transparent,
- disabledLabelColor: Color = SuggestionChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = SuggestionChipTokens.DisabledLabelTextColor.value
.copy(alpha = SuggestionChipTokens.DisabledLabelTextOpacity),
- disabledIconContentColor: Color = SuggestionChipTokens.DisabledLeadingIconColor.toColor()
+ disabledIconContentColor: Color = SuggestionChipTokens.DisabledLeadingIconColor.value
.copy(alpha = SuggestionChipTokens.DisabledLeadingIconOpacity)
): ChipColors = ChipColors(
containerColor = containerColor,
@@ -1222,8 +1222,8 @@
*/
@Composable
fun suggestionChipBorder(
- borderColor: Color = SuggestionChipTokens.FlatOutlineColor.toColor(),
- disabledBorderColor: Color = SuggestionChipTokens.FlatDisabledOutlineColor.toColor()
+ borderColor: Color = SuggestionChipTokens.FlatOutlineColor.value,
+ disabledBorderColor: Color = SuggestionChipTokens.FlatDisabledOutlineColor.value
.copy(alpha = SuggestionChipTokens.FlatDisabledOutlineOpacity),
borderWidth: Dp = SuggestionChipTokens.FlatOutlineWidth,
): ChipBorder = ChipBorder(
@@ -1245,15 +1245,15 @@
*/
@Composable
fun elevatedSuggestionChipColors(
- containerColor: Color = SuggestionChipTokens.ElevatedContainerColor.toColor(),
- labelColor: Color = SuggestionChipTokens.LabelTextColor.toColor(),
+ containerColor: Color = SuggestionChipTokens.ElevatedContainerColor.value,
+ labelColor: Color = SuggestionChipTokens.LabelTextColor.value,
// TODO(b/229778210) Read from the tokens when available
// (i.e. SuggestionChipTokens.IconColor.toColor()).
iconContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
disabledContainerColor: Color =
- SuggestionChipTokens.ElevatedDisabledContainerColor.toColor()
+ SuggestionChipTokens.ElevatedDisabledContainerColor.value
.copy(alpha = SuggestionChipTokens.ElevatedDisabledContainerOpacity),
- disabledLabelColor: Color = SuggestionChipTokens.DisabledLabelTextColor.toColor()
+ disabledLabelColor: Color = SuggestionChipTokens.DisabledLabelTextColor.value
.copy(alpha = SuggestionChipTokens.DisabledLabelTextOpacity),
// TODO(b/229778210): Read from the tokens when available.
disabledIconContentColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f)
@@ -1298,7 +1298,7 @@
)
/** Default shape of a suggestion chip. */
- val shape: Shape @Composable get() = SuggestionChipTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = SuggestionChipTokens.ContainerShape.value
}
@Composable
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ColorScheme.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ColorScheme.kt
index 279033a..1684398 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ColorScheme.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ColorScheme.kt
@@ -1005,9 +1005,11 @@
*/
internal const val DisabledAlpha = 0.38f
-/** Converts a color token key to the local color scheme provided by the theme */
-@ReadOnlyComposable
-@Composable
-internal fun ColorSchemeKeyTokens.toColor(): Color {
- return MaterialTheme.colorScheme.fromToken(this)
-}
+/**
+ * Converts a color token key to the local color scheme provided by the theme
+ * The color is subscribed to [LocalColorScheme] changes.
+ */
+internal val ColorSchemeKeyTokens.value: Color
+ @ReadOnlyComposable
+ @Composable
+ get() = MaterialTheme.colorScheme.fromToken(this)
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ContentColor.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ContentColor.kt
index f888572..1f9cfa9 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ContentColor.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ContentColor.kt
@@ -30,4 +30,4 @@
*
* Defaults to [Color.Black] if no color has been explicitly set.
*/
-val LocalContentColor = compositionLocalOf { Color.Black }
\ No newline at end of file
+val LocalContentColor = compositionLocalOf { Color.Black }
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
index 9b34d5e..67134c1 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
@@ -422,43 +422,43 @@
*/
@Composable
fun colors(
- containerColor: Color = DatePickerModalTokens.ContainerColor.toColor(),
- titleContentColor: Color = DatePickerModalTokens.HeaderSupportingTextColor.toColor(),
- headlineContentColor: Color = DatePickerModalTokens.HeaderHeadlineColor.toColor(),
- weekdayContentColor: Color = DatePickerModalTokens.WeekdaysLabelTextColor.toColor(),
+ containerColor: Color = DatePickerModalTokens.ContainerColor.value,
+ titleContentColor: Color = DatePickerModalTokens.HeaderSupportingTextColor.value,
+ headlineContentColor: Color = DatePickerModalTokens.HeaderHeadlineColor.value,
+ weekdayContentColor: Color = DatePickerModalTokens.WeekdaysLabelTextColor.value,
subheadContentColor: Color =
- DatePickerModalTokens.RangeSelectionMonthSubheadColor.toColor(),
+ DatePickerModalTokens.RangeSelectionMonthSubheadColor.value,
// TODO(b/234060211): Apply this from the MenuButton tokens or defaults.
navigationContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
yearContentColor: Color =
- DatePickerModalTokens.SelectionYearUnselectedLabelTextColor.toColor(),
+ DatePickerModalTokens.SelectionYearUnselectedLabelTextColor.value,
// TODO: Using DisabledAlpha as there are no token values for the disabled states.
disabledYearContentColor: Color = yearContentColor.copy(alpha = DisabledAlpha),
- currentYearContentColor: Color = DatePickerModalTokens.DateTodayLabelTextColor.toColor(),
+ currentYearContentColor: Color = DatePickerModalTokens.DateTodayLabelTextColor.value,
selectedYearContentColor: Color =
- DatePickerModalTokens.SelectionYearSelectedLabelTextColor.toColor(),
+ DatePickerModalTokens.SelectionYearSelectedLabelTextColor.value,
disabledSelectedYearContentColor: Color =
selectedYearContentColor.copy(alpha = DisabledAlpha),
selectedYearContainerColor: Color =
- DatePickerModalTokens.SelectionYearSelectedContainerColor.toColor(),
+ DatePickerModalTokens.SelectionYearSelectedContainerColor.value,
disabledSelectedYearContainerColor: Color =
selectedYearContainerColor.copy(alpha = DisabledAlpha),
- dayContentColor: Color = DatePickerModalTokens.DateUnselectedLabelTextColor.toColor(),
+ dayContentColor: Color = DatePickerModalTokens.DateUnselectedLabelTextColor.value,
disabledDayContentColor: Color = dayContentColor.copy(alpha = DisabledAlpha),
- selectedDayContentColor: Color = DatePickerModalTokens.DateSelectedLabelTextColor.toColor(),
+ selectedDayContentColor: Color = DatePickerModalTokens.DateSelectedLabelTextColor.value,
disabledSelectedDayContentColor: Color =
selectedDayContentColor.copy(alpha = DisabledAlpha),
selectedDayContainerColor: Color =
- DatePickerModalTokens.DateSelectedContainerColor.toColor(),
+ DatePickerModalTokens.DateSelectedContainerColor.value,
disabledSelectedDayContainerColor: Color =
selectedDayContainerColor.copy(alpha = DisabledAlpha),
- todayContentColor: Color = DatePickerModalTokens.DateTodayLabelTextColor.toColor(),
+ todayContentColor: Color = DatePickerModalTokens.DateTodayLabelTextColor.value,
todayDateBorderColor: Color =
- DatePickerModalTokens.DateTodayContainerOutlineColor.toColor(),
+ DatePickerModalTokens.DateTodayContainerOutlineColor.value,
dayInSelectionRangeContentColor: Color =
- DatePickerModalTokens.SelectionDateInRangeLabelTextColor.toColor(),
+ DatePickerModalTokens.SelectionDateInRangeLabelTextColor.value,
dayInSelectionRangeContainerColor: Color =
- DatePickerModalTokens.RangeSelectionActiveIndicatorContainerColor.toColor(),
+ DatePickerModalTokens.RangeSelectionActiveIndicatorContainerColor.value,
dividerColor: Color = DividerDefaults.color,
dateTextFieldColors: TextFieldColors = OutlinedTextFieldDefaults.colors()
): DatePickerColors =
@@ -622,7 +622,7 @@
val TonalElevation: Dp = DatePickerModalTokens.ContainerElevation
/** The default shape for date picker dialogs. */
- val shape: Shape @Composable get() = DatePickerModalTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = DatePickerModalTokens.ContainerShape.value
/**
* A date format skeleton used to format the date picker's year selection menu button (e.g.
@@ -1773,7 +1773,7 @@
role = Role.Button
},
enabled = enabled,
- shape = DatePickerModalTokens.DateContainerShape.toShape(),
+ shape = DatePickerModalTokens.DateContainerShape.value,
color = colors.dayContainerColor(
selected = selected,
enabled = enabled,
@@ -1925,7 +1925,7 @@
role = Role.Button
},
enabled = enabled,
- shape = DatePickerModalTokens.SelectionYearStateLayerShape.toShape(),
+ shape = DatePickerModalTokens.SelectionYearStateLayerShape.value,
color = colors.yearContainerColor(selected = selected, enabled = enabled).value,
contentColor = colors.yearContentColor(
currentYear = currentYear,
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.kt
index 256aae5..3cbd421 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.kt
@@ -21,4 +21,4 @@
/**
* Returns Default [PlatformTextStyle].
*/
-internal expect fun defaultPlatformTextStyle(): PlatformTextStyle?
\ No newline at end of file
+internal expect fun defaultPlatformTextStyle(): PlatformTextStyle?
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Divider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Divider.kt
index c2fd8b1..b99a1291 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Divider.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Divider.kt
@@ -113,5 +113,5 @@
val Thickness: Dp = DividerTokens.Thickness
/** Default color of a divider. */
- val color: Color @Composable get() = DividerTokens.Color.toColor()
+ val color: Color @Composable get() = DividerTokens.Color.value
}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DragGestureDetectorCopy.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DragGestureDetectorCopy.kt
index 410bc38..98af1c3 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DragGestureDetectorCopy.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DragGestureDetectorCopy.kt
@@ -132,4 +132,4 @@
PointerType.Mouse -> touchSlop * mouseToTouchSlopRatio
else -> touchSlop
}
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt
index 42f3f07..127c07b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt
@@ -395,20 +395,20 @@
val LargeIconSize = FabPrimaryLargeTokens.IconSize
/** Default shape for a floating action button. */
- val shape: Shape @Composable get() = FabPrimaryTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = FabPrimaryTokens.ContainerShape.value
/** Default shape for a small floating action button. */
- val smallShape: Shape @Composable get() = FabPrimarySmallTokens.ContainerShape.toShape()
+ val smallShape: Shape @Composable get() = FabPrimarySmallTokens.ContainerShape.value
/** Default shape for a large floating action button. */
- val largeShape: Shape @Composable get() = FabPrimaryLargeTokens.ContainerShape.toShape()
+ val largeShape: Shape @Composable get() = FabPrimaryLargeTokens.ContainerShape.value
/** Default shape for an extended floating action button. */
val extendedFabShape: Shape @Composable get() =
- ExtendedFabPrimaryTokens.ContainerShape.toShape()
+ ExtendedFabPrimaryTokens.ContainerShape.value
/** Default container color for a floating action button. */
- val containerColor: Color @Composable get() = FabPrimaryTokens.ContainerColor.toColor()
+ val containerColor: Color @Composable get() = FabPrimaryTokens.ContainerColor.value
/**
* Creates a [FloatingActionButtonElevation] that represents the elevation of a
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Icon.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Icon.kt
index 3d5343f..95ea0666 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Icon.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Icon.kt
@@ -166,4 +166,4 @@
private fun Size.isInfinite() = width.isInfinite() && height.isInfinite()
// Default icon size, for icons with no intrinsic size information
-private val DefaultIconSizeModifier = Modifier.size(IconButtonTokens.IconSize)
\ No newline at end of file
+private val DefaultIconSizeModifier = Modifier.size(IconButtonTokens.IconSize)
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
index 51ae14d..57c2bbc 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
@@ -83,7 +83,7 @@
modifier = modifier
.minimumInteractiveComponentSize()
.size(IconButtonTokens.StateLayerSize)
- .clip(IconButtonTokens.StateLayerShape.toShape())
+ .clip(IconButtonTokens.StateLayerShape.value)
.background(color = colors.containerColor(enabled).value)
.clickable(
onClick = onClick,
@@ -144,7 +144,7 @@
modifier = modifier
.minimumInteractiveComponentSize()
.size(IconButtonTokens.StateLayerSize)
- .clip(IconButtonTokens.StateLayerShape.toShape())
+ .clip(IconButtonTokens.StateLayerShape.value)
.background(color = colors.containerColor(enabled, checked).value)
.toggleable(
value = checked,
@@ -535,12 +535,12 @@
*/
object IconButtonDefaults {
/** Default shape for a filled icon button. */
- val filledShape: Shape @Composable get() = FilledIconButtonTokens.ContainerShape.toShape()
+ val filledShape: Shape @Composable get() = FilledIconButtonTokens.ContainerShape.value
/** Default shape for an outlined icon button. */
val outlinedShape: Shape
@Composable get() =
- OutlinedIconButtonTokens.ContainerShape.toShape()
+ OutlinedIconButtonTokens.ContainerShape.value
/**
* Creates a [IconButtonColors] that represents the default colors used in a [IconButton].
@@ -584,7 +584,7 @@
disabledContentColor: Color =
contentColor.copy(alpha = IconButtonTokens.DisabledIconOpacity),
checkedContainerColor: Color = Color.Transparent,
- checkedContentColor: Color = IconButtonTokens.SelectedIconColor.toColor()
+ checkedContentColor: Color = IconButtonTokens.SelectedIconColor.value
): IconToggleButtonColors =
IconToggleButtonColors(
containerColor = containerColor,
@@ -605,11 +605,11 @@
*/
@Composable
fun filledIconButtonColors(
- containerColor: Color = FilledIconButtonTokens.ContainerColor.toColor(),
+ containerColor: Color = FilledIconButtonTokens.ContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
- disabledContainerColor: Color = FilledIconButtonTokens.DisabledContainerColor.toColor()
+ disabledContainerColor: Color = FilledIconButtonTokens.DisabledContainerColor.value
.copy(alpha = FilledIconButtonTokens.DisabledContainerOpacity),
- disabledContentColor: Color = FilledIconButtonTokens.DisabledColor.toColor()
+ disabledContentColor: Color = FilledIconButtonTokens.DisabledColor.value
.copy(alpha = FilledIconButtonTokens.DisabledOpacity)
): IconButtonColors =
IconButtonColors(
@@ -632,15 +632,15 @@
*/
@Composable
fun filledIconToggleButtonColors(
- containerColor: Color = FilledIconButtonTokens.UnselectedContainerColor.toColor(),
+ containerColor: Color = FilledIconButtonTokens.UnselectedContainerColor.value,
// TODO(b/228455081): Using contentColorFor here will return OnSurfaceVariant,
// while the token value is Primary.
- contentColor: Color = FilledIconButtonTokens.ToggleUnselectedColor.toColor(),
- disabledContainerColor: Color = FilledIconButtonTokens.DisabledContainerColor.toColor()
+ contentColor: Color = FilledIconButtonTokens.ToggleUnselectedColor.value,
+ disabledContainerColor: Color = FilledIconButtonTokens.DisabledContainerColor.value
.copy(alpha = FilledIconButtonTokens.DisabledContainerOpacity),
- disabledContentColor: Color = FilledIconButtonTokens.DisabledColor.toColor()
+ disabledContentColor: Color = FilledIconButtonTokens.DisabledColor.value
.copy(alpha = FilledIconButtonTokens.DisabledOpacity),
- checkedContainerColor: Color = FilledIconButtonTokens.SelectedContainerColor.toColor(),
+ checkedContainerColor: Color = FilledIconButtonTokens.SelectedContainerColor.value,
checkedContentColor: Color = contentColorFor(checkedContainerColor)
): IconToggleButtonColors =
IconToggleButtonColors(
@@ -663,11 +663,11 @@
*/
@Composable
fun filledTonalIconButtonColors(
- containerColor: Color = FilledTonalIconButtonTokens.ContainerColor.toColor(),
+ containerColor: Color = FilledTonalIconButtonTokens.ContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
- disabledContainerColor: Color = FilledTonalIconButtonTokens.DisabledContainerColor.toColor()
+ disabledContainerColor: Color = FilledTonalIconButtonTokens.DisabledContainerColor.value
.copy(alpha = FilledTonalIconButtonTokens.DisabledContainerOpacity),
- disabledContentColor: Color = FilledTonalIconButtonTokens.DisabledColor.toColor()
+ disabledContentColor: Color = FilledTonalIconButtonTokens.DisabledColor.value
.copy(alpha = FilledTonalIconButtonTokens.DisabledOpacity)
): IconButtonColors =
IconButtonColors(
@@ -690,15 +690,15 @@
*/
@Composable
fun filledTonalIconToggleButtonColors(
- containerColor: Color = FilledTonalIconButtonTokens.UnselectedContainerColor.toColor(),
+ containerColor: Color = FilledTonalIconButtonTokens.UnselectedContainerColor.value,
contentColor: Color = contentColorFor(containerColor),
- disabledContainerColor: Color = FilledTonalIconButtonTokens.DisabledContainerColor.toColor()
+ disabledContainerColor: Color = FilledTonalIconButtonTokens.DisabledContainerColor.value
.copy(alpha = FilledTonalIconButtonTokens.DisabledContainerOpacity),
- disabledContentColor: Color = FilledTonalIconButtonTokens.DisabledColor.toColor()
+ disabledContentColor: Color = FilledTonalIconButtonTokens.DisabledColor.value
.copy(alpha = FilledTonalIconButtonTokens.DisabledOpacity),
checkedContainerColor: Color =
- FilledTonalIconButtonTokens.SelectedContainerColor.toColor(),
- checkedContentColor: Color = FilledTonalIconButtonTokens.ToggleSelectedColor.toColor()
+ FilledTonalIconButtonTokens.SelectedContainerColor.value,
+ checkedContentColor: Color = FilledTonalIconButtonTokens.ToggleSelectedColor.value
): IconToggleButtonColors =
IconToggleButtonColors(
containerColor = containerColor,
@@ -752,7 +752,7 @@
disabledContentColor: Color =
contentColor.copy(alpha = OutlinedIconButtonTokens.DisabledOpacity),
checkedContainerColor: Color =
- OutlinedIconButtonTokens.SelectedContainerColor.toColor(),
+ OutlinedIconButtonTokens.SelectedContainerColor.value,
checkedContentColor: Color = contentColorFor(checkedContainerColor)
): IconToggleButtonColors =
IconToggleButtonColors(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt
index f083945..20588bd 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt
@@ -386,17 +386,17 @@
/** The default shape of a list item */
val shape: Shape
@Composable
- @ReadOnlyComposable get() = ListTokens.ListItemContainerShape.toShape()
+ @ReadOnlyComposable get() = ListTokens.ListItemContainerShape.value
/** The container color of a list item */
val containerColor: Color
@Composable
- @ReadOnlyComposable get() = ListTokens.ListItemContainerColor.toColor()
+ @ReadOnlyComposable get() = ListTokens.ListItemContainerColor.value
/** The content color of a list item */
val contentColor: Color
@Composable
- @ReadOnlyComposable get() = ListTokens.ListItemLabelTextColor.toColor()
+ @ReadOnlyComposable get() = ListTokens.ListItemLabelTextColor.value
/**
* Creates a [ListItemColors] that represents the default container and content colors used in a
@@ -417,17 +417,17 @@
*/
@Composable
fun colors(
- containerColor: Color = ListTokens.ListItemContainerColor.toColor(),
- headlineColor: Color = ListTokens.ListItemLabelTextColor.toColor(),
- leadingIconColor: Color = ListTokens.ListItemLeadingIconColor.toColor(),
- overlineColor: Color = ListTokens.ListItemOverlineColor.toColor(),
- supportingColor: Color = ListTokens.ListItemSupportingTextColor.toColor(),
- trailingIconColor: Color = ListTokens.ListItemTrailingIconColor.toColor(),
- disabledHeadlineColor: Color = ListTokens.ListItemDisabledLabelTextColor.toColor()
+ containerColor: Color = ListTokens.ListItemContainerColor.value,
+ headlineColor: Color = ListTokens.ListItemLabelTextColor.value,
+ leadingIconColor: Color = ListTokens.ListItemLeadingIconColor.value,
+ overlineColor: Color = ListTokens.ListItemOverlineColor.value,
+ supportingColor: Color = ListTokens.ListItemSupportingTextColor.value,
+ trailingIconColor: Color = ListTokens.ListItemTrailingIconColor.value,
+ disabledHeadlineColor: Color = ListTokens.ListItemDisabledLabelTextColor.value
.copy(alpha = ListTokens.ListItemDisabledLabelTextOpacity),
- disabledLeadingIconColor: Color = ListTokens.ListItemDisabledLeadingIconColor.toColor()
+ disabledLeadingIconColor: Color = ListTokens.ListItemDisabledLeadingIconColor.value
.copy(alpha = ListTokens.ListItemDisabledLeadingIconOpacity),
- disabledTrailingIconColor: Color = ListTokens.ListItemDisabledTrailingIconColor.toColor()
+ disabledTrailingIconColor: Color = ListTokens.ListItemDisabledTrailingIconColor.value
.copy(alpha = ListTokens.ListItemDisabledTrailingIconOpacity)
): ListItemColors =
ListItemColors(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MappedInteractionSource.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MappedInteractionSource.kt
index 3004270..daaccce 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MappedInteractionSource.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MappedInteractionSource.kt
@@ -61,4 +61,4 @@
private fun mapPress(press: PressInteraction.Press): PressInteraction.Press =
PressInteraction.Press(press.pressPosition - delta)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
index 3788a3b..11b15675 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
@@ -124,7 +124,7 @@
this.alpha = alpha
transformOrigin = transformOriginState.value
},
- shape = MenuTokens.ContainerShape.toShape(),
+ shape = MenuTokens.ContainerShape.value,
color = MaterialTheme.colorScheme.fromToken(MenuTokens.ContainerColor),
tonalElevation = MenuTokens.ContainerElevation,
shadowElevation = MenuTokens.ContainerElevation
@@ -233,15 +233,15 @@
*/
@Composable
fun itemColors(
- textColor: Color = MenuTokens.ListItemLabelTextColor.toColor(),
- leadingIconColor: Color = MenuTokens.ListItemLeadingIconColor.toColor(),
- trailingIconColor: Color = MenuTokens.ListItemTrailingIconColor.toColor(),
+ textColor: Color = MenuTokens.ListItemLabelTextColor.value,
+ leadingIconColor: Color = MenuTokens.ListItemLeadingIconColor.value,
+ trailingIconColor: Color = MenuTokens.ListItemTrailingIconColor.value,
disabledTextColor: Color =
- MenuTokens.ListItemDisabledLabelTextColor.toColor()
+ MenuTokens.ListItemDisabledLabelTextColor.value
.copy(alpha = MenuTokens.ListItemDisabledLabelTextOpacity),
- disabledLeadingIconColor: Color = MenuTokens.ListItemDisabledLeadingIconColor.toColor()
+ disabledLeadingIconColor: Color = MenuTokens.ListItemDisabledLeadingIconColor.value
.copy(alpha = MenuTokens.ListItemDisabledLeadingIconOpacity),
- disabledTrailingIconColor: Color = MenuTokens.ListItemDisabledTrailingIconColor.toColor()
+ disabledTrailingIconColor: Color = MenuTokens.ListItemDisabledTrailingIconColor.value
.copy(alpha = MenuTokens.ListItemDisabledTrailingIconOpacity),
): MenuItemColors = MenuItemColors(
textColor = textColor,
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MutableWindowInsets.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MutableWindowInsets.kt
index 95ac756d..82e8fcc 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MutableWindowInsets.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MutableWindowInsets.kt
@@ -45,4 +45,4 @@
override fun getRight(density: Density, layoutDirection: LayoutDirection): Int =
insets.getRight(density, layoutDirection)
override fun getBottom(density: Density): Int = insets.getBottom(density)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
index bb9e6a2..a6c347d 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
@@ -29,8 +29,8 @@
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
+import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsPadding
@@ -63,6 +63,7 @@
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.constrainHeight
import androidx.compose.ui.unit.dp
import kotlin.math.roundToInt
@@ -114,9 +115,10 @@
modifier = Modifier
.fillMaxWidth()
.windowInsetsPadding(windowInsets)
- .height(NavigationBarHeight)
+ .defaultMinSize(minHeight = NavigationBarHeight)
.selectableGroup(),
horizontalArrangement = Arrangement.spacedBy(NavigationBarItemHorizontalPadding),
+ verticalAlignment = Alignment.CenterVertically,
content = content
)
}
@@ -199,11 +201,13 @@
interactionSource = interactionSource,
indication = null,
)
+ .defaultMinSize(minHeight = NavigationBarHeight)
.weight(1f)
.onSizeChanged {
itemWidth = it.width
},
- contentAlignment = Alignment.Center
+ contentAlignment = Alignment.Center,
+ propagateMinConstraints = true,
) {
val animationProgress: Float by animateFloatAsState(
targetValue = if (selected) 1f else 0f,
@@ -231,7 +235,7 @@
Box(
Modifier
.layoutId(IndicatorRippleLayoutIdTag)
- .clip(NavigationBarTokens.ActiveIndicatorShape.toShape())
+ .clip(NavigationBarTokens.ActiveIndicatorShape.value)
.indication(offsetInteractionSource, rememberRipple())
)
}
@@ -241,12 +245,12 @@
.layoutId(IndicatorLayoutIdTag)
.background(
color = colors.indicatorColor.copy(alpha = animationProgress),
- shape = NavigationBarTokens.ActiveIndicatorShape.toShape(),
+ shape = NavigationBarTokens.ActiveIndicatorShape.value,
)
)
}
- NavigationBarItemBaselineLayout(
+ NavigationBarItemLayout(
indicatorRipple = indicatorRipple,
indicator = indicator,
icon = styledIcon,
@@ -263,7 +267,7 @@
val Elevation: Dp = NavigationBarTokens.ContainerElevation
/** Default color for a navigation bar. */
- val containerColor: Color @Composable get() = NavigationBarTokens.ContainerColor.toColor()
+ val containerColor: Color @Composable get() = NavigationBarTokens.ContainerColor.value
/**
* Default window insets to be used and consumed by navigation bar
@@ -292,11 +296,11 @@
*/
@Composable
fun colors(
- selectedIconColor: Color = NavigationBarTokens.ActiveIconColor.toColor(),
- selectedTextColor: Color = NavigationBarTokens.ActiveLabelTextColor.toColor(),
- indicatorColor: Color = NavigationBarTokens.ActiveIndicatorColor.toColor(),
- unselectedIconColor: Color = NavigationBarTokens.InactiveIconColor.toColor(),
- unselectedTextColor: Color = NavigationBarTokens.InactiveLabelTextColor.toColor(),
+ selectedIconColor: Color = NavigationBarTokens.ActiveIconColor.value,
+ selectedTextColor: Color = NavigationBarTokens.ActiveLabelTextColor.value,
+ indicatorColor: Color = NavigationBarTokens.ActiveIndicatorColor.value,
+ unselectedIconColor: Color = NavigationBarTokens.InactiveIconColor.value,
+ unselectedTextColor: Color = NavigationBarTokens.InactiveLabelTextColor.value,
disabledIconColor: Color = unselectedIconColor.copy(alpha = DisabledAlpha),
disabledTextColor: Color = unselectedTextColor.copy(alpha = DisabledAlpha),
): NavigationBarItemColors = NavigationBarItemColors(
@@ -315,11 +319,11 @@
)
@Composable
fun colors(
- selectedIconColor: Color = NavigationBarTokens.ActiveIconColor.toColor(),
- selectedTextColor: Color = NavigationBarTokens.ActiveLabelTextColor.toColor(),
- indicatorColor: Color = NavigationBarTokens.ActiveIndicatorColor.toColor(),
- unselectedIconColor: Color = NavigationBarTokens.InactiveIconColor.toColor(),
- unselectedTextColor: Color = NavigationBarTokens.InactiveLabelTextColor.toColor(),
+ selectedIconColor: Color = NavigationBarTokens.ActiveIconColor.value,
+ selectedTextColor: Color = NavigationBarTokens.ActiveLabelTextColor.value,
+ indicatorColor: Color = NavigationBarTokens.ActiveIndicatorColor.value,
+ unselectedIconColor: Color = NavigationBarTokens.InactiveIconColor.value,
+ unselectedTextColor: Color = NavigationBarTokens.InactiveLabelTextColor.value,
): NavigationBarItemColors = NavigationBarItemColors(
selectedIconColor = selectedIconColor,
selectedTextColor = selectedTextColor,
@@ -437,7 +441,7 @@
* size, icon and label positions, etc.
*/
@Composable
-private fun NavigationBarItemBaselineLayout(
+private fun NavigationBarItemLayout(
indicatorRipple: @Composable () -> Unit,
indicator: @Composable () -> Unit,
icon: @Composable () -> Unit,
@@ -462,8 +466,9 @@
) { label() }
}
}) { measurables, constraints ->
+ val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0)
val iconPlaceable =
- measurables.first { it.layoutId == IconLayoutIdTag }.measure(constraints)
+ measurables.first { it.layoutId == IconLayoutIdTag }.measure(looseConstraints)
val totalIndicatorWidth = iconPlaceable.width + (IndicatorHorizontalPadding * 2).roundToPx()
val animatedIndicatorWidth = (totalIndicatorWidth * animationProgress).roundToInt()
@@ -491,11 +496,7 @@
label?.let {
measurables
.first { it.layoutId == LabelLayoutIdTag }
- .measure(
- // Measure with loose constraints for height as we don't want the label to
- // take up more space than it needs
- constraints.copy(minHeight = 0)
- )
+ .measure(looseConstraints)
}
if (label == null) {
@@ -524,7 +525,7 @@
constraints: Constraints
): MeasureResult {
val width = constraints.maxWidth
- val height = constraints.maxHeight
+ val height = constraints.constrainHeight(NavigationBarHeight.roundToPx())
val iconX = (width - iconPlaceable.width) / 2
val iconY = (height - iconPlaceable.height) / 2
@@ -547,9 +548,9 @@
* Places the provided [Placeable]s in the correct position, depending on [alwaysShowLabel] and
* [animationProgress].
*
- * When [alwaysShowLabel] is true, the positions do not move. The [iconPlaceable] will be placed
- * near the top of the item and the [labelPlaceable] will be placed beneath it with padding,
- * according to the spec.
+ * When [alwaysShowLabel] is true, the positions do not move. The [iconPlaceable] and
+ * [labelPlaceable] will be placed together in the center with padding between them, according to
+ * the spec.
*
* When [animationProgress] is 1 (representing the selected state), the positions will be the same
* as above.
@@ -584,12 +585,11 @@
alwaysShowLabel: Boolean,
animationProgress: Float,
): MeasureResult {
- val height = constraints.maxHeight
-
- val contentTotalHeight = iconPlaceable.height + IndicatorVerticalPadding.roundToPx() +
- NavigationBarIndicatorToLabelPadding.roundToPx() + labelPlaceable.height
- val contentVerticalPadding = ((height - contentTotalHeight) / 2)
- .coerceAtLeast(IndicatorVerticalPadding.roundToPx())
+ val contentHeight = iconPlaceable.height + IndicatorVerticalPadding.toPx() +
+ NavigationBarIndicatorToLabelPadding.toPx() + labelPlaceable.height
+ val contentVerticalPadding = ((constraints.minHeight - contentHeight) / 2)
+ .coerceAtLeast(IndicatorVerticalPadding.toPx())
+ val height = contentHeight + contentVerticalPadding * 2
// Icon (when selected) should be `contentVerticalPadding` from top
val selectedIconY = contentVerticalPadding
@@ -601,11 +601,11 @@
// The interpolated fraction of iconDistance that all placeables need to move based on
// animationProgress.
- val offset = (iconDistance * (1 - animationProgress)).roundToInt()
+ val offset = iconDistance * (1 - animationProgress)
// Label should be fixed padding below icon
- val labelY = selectedIconY + iconPlaceable.height + IndicatorVerticalPadding.roundToPx() +
- NavigationBarIndicatorToLabelPadding.roundToPx()
+ val labelY = selectedIconY + iconPlaceable.height + IndicatorVerticalPadding.toPx() +
+ NavigationBarIndicatorToLabelPadding.toPx()
val containerWidth = constraints.maxWidth
@@ -613,19 +613,19 @@
val iconX = (containerWidth - iconPlaceable.width) / 2
val rippleX = (containerWidth - indicatorRipplePlaceable.width) / 2
- val rippleY = selectedIconY - IndicatorVerticalPadding.roundToPx()
+ val rippleY = selectedIconY - IndicatorVerticalPadding.toPx()
- return layout(containerWidth, height) {
+ return layout(containerWidth, height.roundToInt()) {
indicatorPlaceable?.let {
val indicatorX = (containerWidth - it.width) / 2
val indicatorY = selectedIconY - IndicatorVerticalPadding.roundToPx()
- it.placeRelative(indicatorX, indicatorY + offset)
+ it.placeRelative(indicatorX, (indicatorY + offset).roundToInt())
}
if (alwaysShowLabel || animationProgress != 0f) {
- labelPlaceable.placeRelative(labelX, labelY + offset)
+ labelPlaceable.placeRelative(labelX, (labelY + offset).roundToInt())
}
- iconPlaceable.placeRelative(iconX, selectedIconY + offset)
- indicatorRipplePlaceable.placeRelative(rippleX, rippleY + offset)
+ iconPlaceable.placeRelative(iconX, (selectedIconY + offset).roundToInt())
+ indicatorRipplePlaceable.placeRelative(rippleX, (rippleY + offset).roundToInt())
}
}
@@ -654,4 +654,4 @@
internal val IndicatorVerticalPadding: Dp =
(NavigationBarTokens.ActiveIndicatorHeight - NavigationBarTokens.IconSize) / 2
-private val IndicatorVerticalOffset: Dp = 12.dp
\ No newline at end of file
+private val IndicatorVerticalOffset: Dp = 12.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
index 6ae4764..3f585fd 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
@@ -606,16 +606,16 @@
val DismissibleDrawerElevation = NavigationDrawerTokens.StandardContainerElevation
/** Default shape for a navigation drawer. */
- val shape: Shape @Composable get() = NavigationDrawerTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = NavigationDrawerTokens.ContainerShape.value
/** Default color of the scrim that obscures content when the drawer is open */
val scrimColor: Color
- @Composable get() = ScrimTokens.ContainerColor.toColor().copy(ScrimTokens.ContainerOpacity)
+ @Composable get() = ScrimTokens.ContainerColor.value.copy(ScrimTokens.ContainerOpacity)
/** Default container color for a navigation drawer */
- val containerColor: Color @Composable get() = NavigationDrawerTokens.ContainerColor.toColor()
+ val containerColor: Color @Composable get() = NavigationDrawerTokens.ContainerColor.value
- /** Default and maximum width of a navigation drawer **/
+ /** Default and maximum width of a navigation drawer */
val MaximumDrawerWidth = NavigationDrawerTokens.ContainerWidth
/**
@@ -655,7 +655,7 @@
modifier: Modifier = Modifier,
icon: (@Composable () -> Unit)? = null,
badge: (@Composable () -> Unit)? = null,
- shape: Shape = NavigationDrawerTokens.ActiveIndicatorShape.toShape(),
+ shape: Shape = NavigationDrawerTokens.ActiveIndicatorShape.value,
colors: NavigationDrawerItemColors = NavigationDrawerItemDefaults.colors(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
) {
@@ -747,12 +747,12 @@
*/
@Composable
fun colors(
- selectedContainerColor: Color = NavigationDrawerTokens.ActiveIndicatorColor.toColor(),
- unselectedContainerColor: Color = NavigationDrawerTokens.ContainerColor.toColor(),
- selectedIconColor: Color = NavigationDrawerTokens.ActiveIconColor.toColor(),
- unselectedIconColor: Color = NavigationDrawerTokens.InactiveIconColor.toColor(),
- selectedTextColor: Color = NavigationDrawerTokens.ActiveLabelTextColor.toColor(),
- unselectedTextColor: Color = NavigationDrawerTokens.InactiveLabelTextColor.toColor(),
+ selectedContainerColor: Color = NavigationDrawerTokens.ActiveIndicatorColor.value,
+ unselectedContainerColor: Color = NavigationDrawerTokens.ContainerColor.value,
+ selectedIconColor: Color = NavigationDrawerTokens.ActiveIconColor.value,
+ unselectedIconColor: Color = NavigationDrawerTokens.InactiveIconColor.value,
+ selectedTextColor: Color = NavigationDrawerTokens.ActiveLabelTextColor.value,
+ unselectedTextColor: Color = NavigationDrawerTokens.InactiveLabelTextColor.value,
selectedBadgeColor: Color = selectedTextColor,
unselectedBadgeColor: Color = unselectedTextColor,
): NavigationDrawerItemColors = DefaultDrawerItemsColor(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
index fcee888..d5caf4e 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
@@ -30,6 +30,7 @@
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
+import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.only
@@ -62,6 +63,7 @@
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.constrainHeight
import androidx.compose.ui.unit.constrainWidth
import androidx.compose.ui.unit.dp
import kotlin.math.roundToInt
@@ -198,9 +200,10 @@
interactionSource = interactionSource,
indication = null,
)
- .height(height = NavigationRailItemHeight)
+ .defaultMinSize(minHeight = NavigationRailItemHeight)
.widthIn(min = NavigationRailItemWidth),
- contentAlignment = Alignment.Center
+ contentAlignment = Alignment.Center,
+ propagateMinConstraints = true,
) {
val animationProgress: Float by animateFloatAsState(
targetValue = if (selected) 1f else 0f,
@@ -221,9 +224,9 @@
}
val indicatorShape = if (label != null) {
- NavigationRailTokens.ActiveIndicatorShape.toShape()
+ NavigationRailTokens.ActiveIndicatorShape.value
} else {
- NavigationRailTokens.NoLabelActiveIndicatorShape.toShape()
+ NavigationRailTokens.NoLabelActiveIndicatorShape.value
}
// The indicator has a width-expansion animation which interferes with the timing of the
@@ -247,7 +250,7 @@
)
}
- NavigationRailItemBaselineLayout(
+ NavigationRailItemLayout(
indicatorRipple = indicatorRipple,
indicator = indicator,
icon = styledIcon,
@@ -261,7 +264,7 @@
/** Defaults used in [NavigationRail] */
object NavigationRailDefaults {
/** Default container color of a navigation rail. */
- val ContainerColor: Color @Composable get() = NavigationRailTokens.ContainerColor.toColor()
+ val ContainerColor: Color @Composable get() = NavigationRailTokens.ContainerColor.value
/**
* Default window insets for navigation rail.
@@ -289,11 +292,11 @@
*/
@Composable
fun colors(
- selectedIconColor: Color = NavigationRailTokens.ActiveIconColor.toColor(),
- selectedTextColor: Color = NavigationRailTokens.ActiveLabelTextColor.toColor(),
- indicatorColor: Color = NavigationRailTokens.ActiveIndicatorColor.toColor(),
- unselectedIconColor: Color = NavigationRailTokens.InactiveIconColor.toColor(),
- unselectedTextColor: Color = NavigationRailTokens.InactiveLabelTextColor.toColor(),
+ selectedIconColor: Color = NavigationRailTokens.ActiveIconColor.value,
+ selectedTextColor: Color = NavigationRailTokens.ActiveLabelTextColor.value,
+ indicatorColor: Color = NavigationRailTokens.ActiveIndicatorColor.value,
+ unselectedIconColor: Color = NavigationRailTokens.InactiveIconColor.value,
+ unselectedTextColor: Color = NavigationRailTokens.InactiveLabelTextColor.value,
disabledIconColor: Color = unselectedIconColor.copy(alpha = DisabledAlpha),
disabledTextColor: Color = unselectedTextColor.copy(alpha = DisabledAlpha),
): NavigationRailItemColors = NavigationRailItemColors(
@@ -312,11 +315,11 @@
)
@Composable
fun colors(
- selectedIconColor: Color = NavigationRailTokens.ActiveIconColor.toColor(),
- selectedTextColor: Color = NavigationRailTokens.ActiveLabelTextColor.toColor(),
- indicatorColor: Color = NavigationRailTokens.ActiveIndicatorColor.toColor(),
- unselectedIconColor: Color = NavigationRailTokens.InactiveIconColor.toColor(),
- unselectedTextColor: Color = NavigationRailTokens.InactiveLabelTextColor.toColor(),
+ selectedIconColor: Color = NavigationRailTokens.ActiveIconColor.value,
+ selectedTextColor: Color = NavigationRailTokens.ActiveLabelTextColor.value,
+ indicatorColor: Color = NavigationRailTokens.ActiveIndicatorColor.value,
+ unselectedIconColor: Color = NavigationRailTokens.InactiveIconColor.value,
+ unselectedTextColor: Color = NavigationRailTokens.InactiveLabelTextColor.value,
): NavigationRailItemColors = NavigationRailItemColors(
selectedIconColor = selectedIconColor,
selectedTextColor = selectedTextColor,
@@ -436,7 +439,7 @@
* size, icon and label positions, etc.
*/
@Composable
-private fun NavigationRailItemBaselineLayout(
+private fun NavigationRailItemLayout(
indicatorRipple: @Composable () -> Unit,
indicator: @Composable () -> Unit,
icon: @Composable () -> Unit,
@@ -460,8 +463,9 @@
) { label() }
}
}) { measurables, constraints ->
+ val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0)
val iconPlaceable =
- measurables.first { it.layoutId == IconLayoutIdTag }.measure(constraints)
+ measurables.first { it.layoutId == IconLayoutIdTag }.measure(looseConstraints)
val totalIndicatorWidth = iconPlaceable.width + (IndicatorHorizontalPadding * 2).roundToPx()
val animatedIndicatorWidth = (totalIndicatorWidth * animationProgress).roundToInt()
@@ -495,11 +499,7 @@
label?.let {
measurables
.first { it.layoutId == LabelLayoutIdTag }
- .measure(
- // Measure with loose constraints for height as we don't want the label to
- // take up more space than it needs
- constraints.copy(minHeight = 0)
- )
+ .measure(looseConstraints)
}
if (label == null) {
@@ -534,7 +534,7 @@
indicatorPlaceable?.width ?: 0
)
)
- val height = constraints.maxHeight
+ val height = constraints.constrainHeight(NavigationRailItemHeight.roundToPx())
val iconX = (width - iconPlaceable.width) / 2
val iconY = (height - iconPlaceable.height) / 2
@@ -557,8 +557,8 @@
* Places the provided [Placeable]s in the correct position, depending on [alwaysShowLabel] and
* [animationProgress].
*
- * When [alwaysShowLabel] is true, the positions do not move. The [iconPlaceable] will be placed
- * near the top of the item and the [labelPlaceable] will be placed near the bottom, according to
+ * When [alwaysShowLabel] is true, the positions do not move. The [iconPlaceable] and
+ * [labelPlaceable] will be placed together in the center with padding between them, according to
* the spec.
*
* When [animationProgress] is 1 (representing the selected state), the positions will be the same
@@ -594,13 +594,14 @@
alwaysShowLabel: Boolean,
animationProgress: Float,
): MeasureResult {
- val height = constraints.maxHeight
+ val contentHeight = iconPlaceable.height + IndicatorVerticalPaddingWithLabel.toPx() +
+ NavigationRailItemVerticalPadding.toPx() + labelPlaceable.height
+ val contentVerticalPadding = ((constraints.minHeight - contentHeight) / 2)
+ .coerceAtLeast(IndicatorVerticalPaddingWithLabel.toPx())
+ val height = contentHeight + contentVerticalPadding * 2
- // Label should be `ItemVerticalPadding` from the bottom
- val labelY = height - labelPlaceable.height - NavigationRailItemVerticalPadding.roundToPx()
-
- // Icon (when selected) should be `ItemVerticalPadding` from the top
- val selectedIconY = NavigationRailItemVerticalPadding.roundToPx()
+ // Icon (when selected) should be `contentVerticalPadding` from the top
+ val selectedIconY = contentVerticalPadding
val unselectedIconY =
if (alwaysShowLabel) selectedIconY else (height - iconPlaceable.height) / 2
@@ -609,7 +610,13 @@
// The interpolated fraction of iconDistance that all placeables need to move based on
// animationProgress, since the icon is higher in the selected state.
- val offset = (iconDistance * (1 - animationProgress)).roundToInt()
+ val offset = iconDistance * (1 - animationProgress)
+
+ // Label should be fixed padding below icon
+ val labelY = selectedIconY + iconPlaceable.height +
+ IndicatorVerticalPaddingWithLabel.toPx() +
+ NavigationRailItemVerticalPadding.toPx()
+
val width = constraints.constrainWidth(
maxOf(
iconPlaceable.width,
@@ -620,19 +627,19 @@
val labelX = (width - labelPlaceable.width) / 2
val iconX = (width - iconPlaceable.width) / 2
val rippleX = (width - indicatorRipplePlaceable.width) / 2
- val rippleY = selectedIconY - IndicatorVerticalPaddingWithLabel.roundToPx()
+ val rippleY = selectedIconY - IndicatorVerticalPaddingWithLabel.toPx()
- return layout(width, height) {
+ return layout(width, height.roundToInt()) {
indicatorPlaceable?.let {
val indicatorX = (width - it.width) / 2
- val indicatorY = selectedIconY - IndicatorVerticalPaddingWithLabel.roundToPx()
- it.placeRelative(indicatorX, indicatorY + offset)
+ val indicatorY = selectedIconY - IndicatorVerticalPaddingWithLabel.toPx()
+ it.placeRelative(indicatorX, (indicatorY + offset).roundToInt())
}
if (alwaysShowLabel || animationProgress != 0f) {
- labelPlaceable.placeRelative(labelX, labelY + offset)
+ labelPlaceable.placeRelative(labelX, (labelY + offset).roundToInt())
}
- iconPlaceable.placeRelative(iconX, selectedIconY + offset)
- indicatorRipplePlaceable.placeRelative(rippleX, rippleY + offset)
+ iconPlaceable.placeRelative(iconX, (selectedIconY + offset).roundToInt())
+ indicatorRipplePlaceable.placeRelative(rippleX, (rippleY + offset).roundToInt())
}
}
@@ -677,4 +684,4 @@
(NavigationRailTokens.ActiveIndicatorHeight - NavigationRailTokens.IconSize) / 2
private val IndicatorVerticalPaddingNoLabel: Dp =
- (NavigationRailTokens.NoLabelActiveIndicatorHeight - NavigationRailTokens.IconSize) / 2
\ No newline at end of file
+ (NavigationRailTokens.NoLabelActiveIndicatorHeight - NavigationRailTokens.IconSize) / 2
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt
index a148a0f..9dfb9eac 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt
@@ -1135,4 +1135,4 @@
need to add additional padding themselves
*/
/* @VisibleForTesting */
-internal val OutlinedTextFieldTopPadding = 8.dp
\ No newline at end of file
+internal val OutlinedTextFieldTopPadding = 8.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt
index 2ed1ace..f2f40e4 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt
@@ -504,15 +504,15 @@
object ProgressIndicatorDefaults {
/** Default color for a linear progress indicator. */
val linearColor: Color @Composable get() =
- LinearProgressIndicatorTokens.ActiveIndicatorColor.toColor()
+ LinearProgressIndicatorTokens.ActiveIndicatorColor.value
/** Default color for a circular progress indicator. */
val circularColor: Color @Composable get() =
- CircularProgressIndicatorTokens.ActiveIndicatorColor.toColor()
+ CircularProgressIndicatorTokens.ActiveIndicatorColor.value
/** Default track color for a linear progress indicator. */
val linearTrackColor: Color @Composable get() =
- LinearProgressIndicatorTokens.TrackColor.toColor()
+ LinearProgressIndicatorTokens.TrackColor.value
/** Default track color for a circular progress indicator. */
val circularTrackColor: Color @Composable get() = Color.Transparent
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
index 101aed1..d55064c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
@@ -143,13 +143,13 @@
*/
@Composable
fun colors(
- selectedColor: Color = RadioButtonTokens.SelectedIconColor.toColor(),
- unselectedColor: Color = RadioButtonTokens.UnselectedIconColor.toColor(),
+ selectedColor: Color = RadioButtonTokens.SelectedIconColor.value,
+ unselectedColor: Color = RadioButtonTokens.UnselectedIconColor.value,
disabledSelectedColor: Color = RadioButtonTokens.DisabledSelectedIconColor
- .toColor()
+ .value
.copy(alpha = RadioButtonTokens.DisabledSelectedIconOpacity),
disabledUnselectedColor: Color = RadioButtonTokens.DisabledUnselectedIconColor
- .toColor()
+ .value
.copy(alpha = RadioButtonTokens.DisabledUnselectedIconOpacity)
): RadioButtonColors = RadioButtonColors(
selectedColor,
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt
index d5954c4..0e4f6cd 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt
@@ -16,9 +16,19 @@
package androidx.compose.material3
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.Crossfade
+import androidx.compose.animation.ExitTransition
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.AnimationVector1D
+import androidx.compose.animation.core.VectorConverter
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.scaleIn
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.FocusInteraction
import androidx.compose.foundation.interaction.Interaction
+import androidx.compose.foundation.interaction.InteractionSource
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Arrangement
@@ -28,9 +38,15 @@
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
+import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.shape.CornerBasedShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Check
+import androidx.compose.material3.tokens.MotionTokens
import androidx.compose.material3.tokens.OutlinedSegmentedButtonTokens
import androidx.compose.material3.tokens.OutlinedSegmentedButtonTokens.DisabledLabelTextColor
import androidx.compose.material3.tokens.OutlinedSegmentedButtonTokens.DisabledLabelTextOpacity
@@ -43,9 +59,13 @@
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.ReadOnlyComposable
+import androidx.compose.runtime.Stable
+import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -53,40 +73,52 @@
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.layout
+import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.util.fastMaxBy
+import kotlinx.coroutines.launch
/**
* <a href="https://m3.material.io/components/segmented-buttons/overview" class="external" target="_blank">Material Segmented Button</a>.
* Segmented buttons help people select options, switch views, or sort elements.
*
- * A default Segmented Button. Also known as Outlined Segmented Button.
+ * A default Toggleable Segmented Button. Also known as Outlined Segmented Button.
+ * See [Modifier.toggleable].
*
- * This should typically be used inside of a [SegmentedButtonRow], see the corresponding
- * documentation for example usage.
+ * Toggleable segmented buttons should be used for cases where the selection is not mutually
+ * exclusive.
*
+ * This should typically be used inside of a [MultiChoiceSegmentedButtonRow]
+ *
+ * For a sample showing Segmented button with only checked icons see:
+ * @sample androidx.compose.material3.samples.SegmentedButtonMultiSelectSample
+ *
+ * @param checked whether this button is checked or not
* @param onCheckedChange callback to be invoked when the button is clicked.
* therefore the change of checked state in requested.
* @param modifier the [Modifier] to be applied to this button
* @param enabled controls the enabled state of this button. When `false`, this component will not
* respond to user input, and it will appear visually disabled and disabled to accessibility
* services.
- * @param checked whether this button is checked or not
* @param shape the shape for this button
- * @param border the border for this button, see [SegmentedButtonColors]
* @param colors [SegmentedButtonColors] that will be used to resolve the colors used for this
+ * @param border the border for this button, see [SegmentedButtonColors]
* Button in different states
* @param interactionSource the [MutableInteractionSource] representing the stream of [Interaction]s
* for this button. You can create and pass in your own `remember`ed instance to observe
* [Interaction]s and customize the appearance / behavior of this button in different states.
+ * @param icon the icon slot for this button, you can pass null in unchecked, in which case
+ * the content will displace to show the checked icon, or pass different icon lambdas for
+ * unchecked and checked in which case the icons will crossfade.
* @param content content to be rendered inside this button
- *
- * @sample androidx.compose.material3.samples.SegmentedButtonSingleSelectSample
*/
@Composable
@ExperimentalMaterial3Api
-fun SegmentedButton(
+fun MultiChoiceSegmentedButtonRowScope.SegmentedButton(
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
@@ -95,39 +127,19 @@
colors: SegmentedButtonColors = SegmentedButtonDefaults.colors(),
border: SegmentedButtonBorder = SegmentedButtonDefaults.Border,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
- content: @Composable RowScope.() -> Unit,
+ icon: @Composable () -> Unit = { SegmentedButtonDefaults.SegmentedButtonIcon(checked) },
+ content: @Composable () -> Unit,
) {
- var interactionCount: Int by remember { mutableIntStateOf(0) }
- LaunchedEffect(interactionSource) {
- interactionSource.interactions.collect { interaction ->
- when (interaction) {
- is PressInteraction.Press,
- is FocusInteraction.Focus -> {
- interactionCount++
- }
-
- is PressInteraction.Release,
- is FocusInteraction.Unfocus,
- is PressInteraction.Cancel -> {
- interactionCount--
- }
- }
- }
- }
val containerColor = colors.containerColor(enabled, checked)
val contentColor = colors.contentColor(enabled, checked)
val checkedState by rememberUpdatedState(checked)
+ val interactionCount by interactionSource.interactionCountAsState()
Surface(
modifier = modifier
- .layout { measurable, constraints ->
- val placeable = measurable.measure(constraints)
- layout(placeable.width, placeable.height) {
- val zIndex = interactionCount + if (checkedState) CheckedZIndexFactor else 0f
- placeable.place(0, 0, zIndex)
- }
- }
+ .weight(1f)
+ .interactionZIndex(checkedState, interactionCount)
.defaultMinSize(
minWidth = ButtonDefaults.MinWidth,
minHeight = ButtonDefaults.MinHeight
@@ -141,128 +153,313 @@
border = border.borderStroke(enabled, checked, colors),
interactionSource = interactionSource
) {
- ProvideTextStyle(value = MaterialTheme.typography.labelLarge) {
- Row(
- Modifier.padding(ButtonDefaults.TextButtonContentPadding),
- horizontalArrangement = Arrangement.Center,
- verticalAlignment = Alignment.CenterVertically,
- content = content
- )
- }
+ SegmentedButtonContent(icon, content)
}
}
/**
+ * <a href="https://m3.material.io/components/segmented-buttons/overview" class="external" target="_blank">Material Segmented Button</a>.
+ * Segmented buttons help people select options, switch views, or sort elements.
*
+ * A default Toggleable Segmented Button. Also known as Outlined Segmented Button.
+ * See [Modifier.selectable].
+ *
+ * Selectable segmented buttons should be used for cases where the selection is mutually
+ * exclusive, when only one button can be selected at a time.
+ *
+ * This should typically be used inside of a [SingleChoiceSegmentedButtonRow]
+ *
+ * For a sample showing Segmented button with only checked icons see:
+ * @sample androidx.compose.material3.samples.SegmentedButtonSingleSelectSample
+ *
+ * @param selected whether this button is selected or not
+ * @param onClick callback to be invoked when the button is clicked.
+ * therefore the change of checked state in requested.
+ * @param modifier the [Modifier] to be applied to this button
+ * @param enabled controls the enabled state of this button. When `false`, this component will not
+ * respond to user input, and it will appear visually disabled and disabled to accessibility
+ * services.
+ * @param shape the shape for this button
+ * @param colors [SegmentedButtonColors] that will be used to resolve the colors used for this
+ * @param border the border for this button, see [SegmentedButtonColors]
+ * Button in different states
+ * @param interactionSource the [MutableInteractionSource] representing the stream of [Interaction]s
+ * for this button. You can create and pass in your own `remember`ed instance to observe
+ * [Interaction]s and customize the appearance / behavior of this button in different states.
+ * @param icon the icon slot for this button, you can pass null in unchecked, in which case
+ * the content will displace to show the checked icon, or pass different icon lambdas for
+ * unchecked and checked in which case the icons will crossfade.
+ * @param content content to be rendered inside this button
+ */
+@Composable
+@ExperimentalMaterial3Api
+fun SingleChoiceSegmentedButtonRowScope.SegmentedButton(
+ selected: Boolean,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ shape: Shape = RectangleShape,
+ colors: SegmentedButtonColors = SegmentedButtonDefaults.colors(),
+ border: SegmentedButtonBorder = SegmentedButtonDefaults.Border,
+ interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
+ icon: @Composable () -> Unit = { SegmentedButtonDefaults.SegmentedButtonIcon(selected) },
+ content: @Composable () -> Unit,
+) {
+ val containerColor = colors.containerColor(enabled, selected)
+ val contentColor = colors.contentColor(enabled, selected)
+ val checkedState by rememberUpdatedState(selected)
+ val interactionCount by interactionSource.interactionCountAsState()
+
+ Surface(
+ modifier = modifier
+ .weight(1f)
+ .interactionZIndex(checkedState, interactionCount)
+ .defaultMinSize(
+ minWidth = ButtonDefaults.MinWidth,
+ minHeight = ButtonDefaults.MinHeight
+ ),
+ selected = selected,
+ onClick = onClick,
+ enabled = enabled,
+ shape = shape,
+ color = containerColor,
+ contentColor = contentColor,
+ border = border.borderStroke(enabled, selected, colors),
+ interactionSource = interactionSource
+ ) {
+ SegmentedButtonContent(icon, content)
+ }
+}
+
+/**
* <a href="https://m3.material.io/components/segmented-buttons/overview" class="external" target="_blank">Material Segmented Button</a>.
*
* A Layout to correctly position and size [SegmentedButton]s in a Row.
* It handles overlapping items so that strokes of the item are correctly on top of each other.
+ * [SingleChoiceSegmentedButtonRow] is used when the selection only allows one value, for correct
+ * semantics.
+ *
+ * @sample androidx.compose.material3.samples.SegmentedButtonSingleSelectSample
*
* @param modifier the [Modifier] to be applied to this row
* @param space the dimension of the overlap between buttons. Should be equal to the stroke width
* used on the items.
* @param content the content of this Segmented Button Row, typically a sequence of
- * [SegmentedButtonRow]
- *
- * @sample androidx.compose.material3.samples.SegmentedButtonSingleSelectSample
+ * [SegmentedButton]s
*/
@Composable
@ExperimentalMaterial3Api
-fun SegmentedButtonRow(
+fun SingleChoiceSegmentedButtonRow(
modifier: Modifier = Modifier,
space: Dp = SegmentedButtonDefaults.Border.width,
- content: @Composable () -> Unit
+ content: @Composable SingleChoiceSegmentedButtonRowScope.() -> Unit
) {
- Layout(
+ Row(
+ modifier = modifier
+ .selectableGroup()
+ .height(OutlinedSegmentedButtonTokens.ContainerHeight)
+ .width(IntrinsicSize.Min),
+ horizontalArrangement = Arrangement.spacedBy(-space),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ val scope = remember { SingleChoiceSegmentedButtonScopeWrapper(this) }
+ scope.content()
+ }
+}
+
+/**
+ * <a href="https://m3.material.io/components/segmented-buttons/overview" class="external" target="_blank">Material Segmented Button</a>.
+ *
+ * A Layout to correctly position, size, and add semantics to [SegmentedButton]s in a Row.
+ * It handles overlapping items so that strokes of the item are correctly on top of each other.
+ *
+ * [MultiChoiceSegmentedButtonRow] is used when the selection allows multiple value, for correct
+ * semantics.
+ *
+ * @sample androidx.compose.material3.samples.SegmentedButtonMultiSelectSample
+ *
+ * @param modifier the [Modifier] to be applied to this row
+ * @param space the dimension of the overlap between buttons. Should be equal to the stroke width
+ * used on the items.
+ * @param content the content of this Segmented Button Row, typically a sequence of
+ * [SegmentedButton]s
+ *
+ */
+@Composable
+@ExperimentalMaterial3Api
+fun MultiChoiceSegmentedButtonRow(
+ modifier: Modifier = Modifier,
+ space: Dp = SegmentedButtonDefaults.Border.width,
+ content: @Composable MultiChoiceSegmentedButtonRowScope.() -> Unit
+) {
+ Row(
modifier = modifier
.height(OutlinedSegmentedButtonTokens.ContainerHeight)
- .width(IntrinsicSize.Min)
- .selectableGroup(),
- content = content
- ) { measurables, constraints ->
+ .width(IntrinsicSize.Min),
+ horizontalArrangement = Arrangement.spacedBy(-space),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ val scope = remember { MultiChoiceSegmentedButtonScopeWrapper(this) }
+ scope.content()
+ }
+}
- val width = measurables.fold(0) { curr, max ->
- maxOf(curr, max.maxIntrinsicWidth(constraints.maxHeight))
- }
+@ExperimentalMaterial3Api
+@Composable
+private fun SegmentedButtonContent(
+ icon: @Composable () -> Unit,
+ content: @Composable () -> Unit,
+) {
+ Row(
+ modifier = Modifier.padding(ButtonDefaults.TextButtonContentPadding),
+ horizontalArrangement = Arrangement.Center,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ ProvideTextStyle(value = MaterialTheme.typography.labelLarge) {
+ var animatable by remember {
+ mutableStateOf<Animatable<Int, AnimationVector1D>?>(null)
+ }
- val placeables = measurables.map {
- it.measure(constraints.copy(minWidth = width))
- }
+ val scope = rememberCoroutineScope()
- layout(placeables.size * width, constraints.maxHeight) {
- val itemCount = placeables.size
- val startOffset = (itemCount - 1) * space.roundToPx() / 2
- placeables.forEachIndexed { index, placeable ->
- placeable.placeRelative(startOffset + index * (width - space.roundToPx()), 0)
+ Layout(listOf(icon, content)) { (iconMeasurables, contentMeasurables), constraints ->
+ val iconPlaceables = iconMeasurables.map { it.measure(constraints) }
+ val iconDesiredWidth = iconMeasurables.fold(0) { acc, it ->
+ maxOf(acc, it.maxIntrinsicWidth(Constraints.Infinity))
+ }
+ val iconWidth = iconPlaceables.fastMaxBy { it.width }?.width ?: 0
+ val contentPlaceables = contentMeasurables.map { it.measure(constraints) }
+ val contentWidth = contentPlaceables.fastMaxBy { it.width }?.width
+ val width = maxOf(SegmentedButtonDefaults.IconSize.roundToPx(), iconDesiredWidth) +
+ IconSpacing.roundToPx() +
+ (contentWidth ?: 0)
+
+ val offsetX = if (iconWidth == 0) {
+ -(SegmentedButtonDefaults.IconSize.roundToPx() + IconSpacing.roundToPx()) / 2
+ } else {
+ iconDesiredWidth - SegmentedButtonDefaults.IconSize.roundToPx()
+ }
+
+ val anim = animatable ?: Animatable(offsetX, Int.VectorConverter)
+ .also { animatable = it }
+
+ if (anim.targetValue != offsetX) {
+ scope.launch {
+ anim.animateTo(offsetX, tween(MotionTokens.DurationMedium3.toInt()))
+ }
+ }
+
+ layout(width, constraints.maxHeight) {
+ iconPlaceables.forEach {
+ it.place(0, (constraints.maxHeight - it.height) / 2)
+ }
+
+ val contentOffsetX = SegmentedButtonDefaults.IconSize.roundToPx() +
+ IconSpacing.roundToPx() + anim.value
+
+ contentPlaceables.forEach {
+ it.place(contentOffsetX, (constraints.maxHeight - it.height) / 2)
+ }
+ }
}
}
}
}
+@Composable
+private fun InteractionSource.interactionCountAsState(): State<Int> {
+ val interactionCount = remember { mutableIntStateOf(0) }
+ LaunchedEffect(this) {
+ this@interactionCountAsState.interactions.collect { interaction ->
+ when (interaction) {
+ is PressInteraction.Press,
+ is FocusInteraction.Focus -> {
+ interactionCount.intValue++
+ }
+
+ is PressInteraction.Release,
+ is FocusInteraction.Unfocus,
+ is PressInteraction.Cancel -> {
+ interactionCount.intValue--
+ }
+ }
+ }
+ }
+
+ return interactionCount
+}
+
+/** Scope for the children of a [SingleChoiceSegmentedButtonRow] */
+@ExperimentalMaterial3Api
+interface SingleChoiceSegmentedButtonRowScope : RowScope
+
+/** Scope for the children of a [MultiChoiceSegmentedButtonRow] */
+@ExperimentalMaterial3Api
+interface MultiChoiceSegmentedButtonRowScope : RowScope
+
/* Contains defaults to be used with [SegmentedButtonRow] and [SegmentedButton] */
@ExperimentalMaterial3Api
+@Stable
object SegmentedButtonDefaults {
/**
* Creates a [SegmentedButtonColors] that represents the different colors
- * used in a [SegmentedButtonRow] in different states.
+ * used in a [SegmentedButton] in different states.
*
- * @param checkedContainerColor the color used for the container when enabled and checked
- * @param checkedContentColor the color used for the content when enabled and checked
- * @param checkedBorderColor the color used for the border when enabled and checked
- * @param uncheckedContainerColor the color used for the container when enabled and unchecked
- * @param uncheckedContentColor the color used for the content when enabled and unchecked
- * @param uncheckedBorderColor the color used for the border when enabled and checked
- * @param disabledCheckedContainerColor the color used for the container
- * when disabled and checked
- * @param disabledCheckedContentColor the color used for the content when disabled and checked
- * @param disabledCheckedBorderColor the color used for the border when disabled and checked
- * @param disabledUncheckedContainerColor the color used for the container
- * when disabled and unchecked
- * @param disabledUncheckedContentColor the color used for the content when disabled and
+ * @param activeContainerColor the color used for the container when enabled and active
+ * @param activeContentColor the color used for the content when enabled and active
+ * @param activeBorderColor the color used for the border when enabled and active
+ * @param inactiveContainerColor the color used for the container when enabled and inactive
+ * @param inactiveContentColor the color used for the content when enabled and inactive
+ * @param inactiveBorderColor the color used for the border when enabled and active
+ * @param disabledActiveContainerColor the color used for the container
+ * when disabled and active
+ * @param disabledActiveContentColor the color used for the content when disabled and active
+ * @param disabledActiveBorderColor the color used for the border when disabled and active
+ * @param disabledInactiveContainerColor the color used for the container
+ * when disabled and inactive
+ * @param disabledInactiveContentColor the color used for the content when disabled and
* unchecked
- * @param disabledUncheckedBorderColor the color used for the border when disabled and unchecked
+ * @param disabledInactiveBorderColor the color used for the border when disabled and inactive
*/
@Composable
fun colors(
- checkedContainerColor: Color = SelectedContainerColor.toColor(),
- checkedContentColor: Color = SelectedLabelTextColor.toColor(),
- checkedBorderColor: Color = OutlineColor.toColor(),
- uncheckedContainerColor: Color = MaterialTheme.colorScheme.surface,
- uncheckedContentColor: Color = UnselectedLabelTextColor.toColor(),
- uncheckedBorderColor: Color = checkedBorderColor,
- disabledCheckedContainerColor: Color = checkedContainerColor,
- disabledCheckedContentColor: Color = DisabledLabelTextColor.toColor()
+ activeContainerColor: Color = SelectedContainerColor.value,
+ activeContentColor: Color = SelectedLabelTextColor.value,
+ activeBorderColor: Color = OutlineColor.value,
+ inactiveContainerColor: Color = MaterialTheme.colorScheme.surface,
+ inactiveContentColor: Color = UnselectedLabelTextColor.value,
+ inactiveBorderColor: Color = activeBorderColor,
+ disabledActiveContainerColor: Color = activeContainerColor,
+ disabledActiveContentColor: Color = DisabledLabelTextColor.value
.copy(alpha = DisabledLabelTextOpacity),
- disabledCheckedBorderColor: Color = OutlineColor.toColor()
+ disabledActiveBorderColor: Color = OutlineColor.value
.copy(alpha = DisabledOutlineOpacity),
- disabledUncheckedContainerColor: Color = uncheckedContainerColor,
- disabledUncheckedContentColor: Color = disabledCheckedContentColor,
- disabledUncheckedBorderColor: Color = checkedBorderColor,
+ disabledInactiveContainerColor: Color = inactiveContainerColor,
+ disabledInactiveContentColor: Color = disabledActiveContentColor,
+ disabledInactiveBorderColor: Color = activeBorderColor,
): SegmentedButtonColors = SegmentedButtonColors(
- checkedContainerColor = checkedContainerColor,
- checkedContentColor = checkedContentColor,
- checkedBorderColor = checkedBorderColor,
- uncheckedContainerColor = uncheckedContainerColor,
- uncheckedContentColor = uncheckedContentColor,
- uncheckedBorderColor = uncheckedBorderColor,
- disabledCheckedContainerColor = disabledCheckedContainerColor,
- disabledCheckedContentColor = disabledCheckedContentColor,
- disabledCheckedBorderColor = disabledCheckedBorderColor,
- disabledUncheckedContainerColor = disabledUncheckedContainerColor,
- disabledUncheckedContentColor = disabledUncheckedContentColor,
- disabledUncheckedBorderColor = disabledUncheckedBorderColor,
-
- )
+ activeContainerColor = activeContainerColor,
+ activeContentColor = activeContentColor,
+ activeBorderColor = activeBorderColor,
+ inactiveContainerColor = inactiveContainerColor,
+ inactiveContentColor = inactiveContentColor,
+ inactiveBorderColor = inactiveBorderColor,
+ disabledActiveContainerColor = disabledActiveContainerColor,
+ disabledActiveContentColor = disabledActiveContentColor,
+ disabledActiveBorderColor = disabledActiveBorderColor,
+ disabledInactiveContainerColor = disabledInactiveContainerColor,
+ disabledInactiveContentColor = disabledInactiveContentColor,
+ disabledInactiveBorderColor = disabledInactiveBorderColor
+ )
/** The default [BorderStroke] factory used by [SegmentedButton]. */
val Border = SegmentedButtonBorder(width = OutlinedSegmentedButtonTokens.OutlineWidth)
- /** The default [Shape] for [SegmentedButton] insdie [SegmentedButtonRow]. */
+ /** The default [Shape] for [SegmentedButton]. */
val Shape: CornerBasedShape
@Composable
@ReadOnlyComposable
- get() = OutlinedSegmentedButtonTokens.Shape.toShape() as CornerBasedShape
+ get() = OutlinedSegmentedButtonTokens.Shape.value as CornerBasedShape
/**
* A shape constructor that the button in [position] should have when there are [count] buttons
@@ -283,9 +480,52 @@
}
/**
- * Icon size to use for icons inside [SegmentedButtonRow] item
+ * Icon size to use for icons used in [SegmentedButton]
*/
val IconSize = OutlinedSegmentedButtonTokens.IconSize
+
+ /** And icon to indicate the segmented button is checked or selected */
+ @Composable
+ fun ActiveIcon() {
+ Icon(
+ imageVector = Icons.Filled.Check,
+ contentDescription = null,
+ modifier = Modifier.size(IconSize)
+ )
+ }
+
+ /**
+ * The default implementation of icons for Segmented Buttons.
+ *
+ * @param active whether the button is activated or not.
+ * @param activeContent usually a checkmark icon of [IconSize] dimensions.
+ * @param inactiveContent typically an icon of [IconSize]. It shows only when the button is not
+ * checked.
+ */
+ @Composable
+ fun SegmentedButtonIcon(
+ active: Boolean,
+ activeContent: @Composable () -> Unit = { ActiveIcon() },
+ inactiveContent: (@Composable () -> Unit)? = null
+ ) {
+ if (inactiveContent == null) {
+ AnimatedVisibility(
+ visible = active,
+ exit = ExitTransition.None,
+ enter = fadeIn(tween(MotionTokens.DurationMedium3.toInt())) + scaleIn(
+ initialScale = 0f,
+ transformOrigin = TransformOrigin(0f, 1f),
+ animationSpec = tween(MotionTokens.DurationMedium3.toInt()),
+ ),
+ ) {
+ activeContent()
+ }
+ } else {
+ Crossfade(targetState = active) {
+ if (it) activeContent() else inactiveContent()
+ }
+ }
+ }
}
/**
@@ -313,84 +553,83 @@
* @constructor create an instance with arbitrary colors, see [SegmentedButtonDefaults] for a
* factory method using the default material3 spec
*
- * @param checkedContainerColor the color used for the container when enabled and checked
- * @param checkedContentColor the color used for the content when enabled and checked
- * @param checkedBorderColor the color used for the border when enabled and checked
- * @param uncheckedContainerColor the color used for the container when enabled and unchecked
- * @param uncheckedContentColor the color used for the content when enabled and unchecked
- * @param uncheckedBorderColor the color used for the border when enabled and checked
- * @param disabledCheckedContainerColor the color used for the container when disabled and checked
- * @param disabledCheckedContentColor the color used for the content when disabled and checked
- * @param disabledCheckedBorderColor the color used for the border when disabled and checked
- * @param disabledUncheckedContainerColor the color used for the container
- * when disabled and unchecked
- * @param disabledUncheckedContentColor the color used for the content when disabled and unchecked
- * @param disabledUncheckedBorderColor the color used for the border when disabled and unchecked
+ * @param activeContainerColor the color used for the container when enabled and active
+ * @param activeContentColor the color used for the content when enabled and active
+ * @param activeBorderColor the color used for the border when enabled and active
+ * @param inactiveContainerColor the color used for the container when enabled and inactive
+ * @param inactiveContentColor the color used for the content when enabled and inactive
+ * @param inactiveBorderColor the color used for the border when enabled and active
+ * @param disabledActiveContainerColor the color used for the container when disabled and active
+ * @param disabledActiveContentColor the color used for the content when disabled and active
+ * @param disabledActiveBorderColor the color used for the border when disabled and active
+ * @param disabledInactiveContainerColor the color used for the container
+ * when disabled and inactive
+ * @param disabledInactiveContentColor the color used for the content when disabled and inactive
+ * @param disabledInactiveBorderColor the color used for the border when disabled and inactive
*/
@Immutable
@ExperimentalMaterial3Api
class SegmentedButtonColors constructor(
- // enabled & checked
- val checkedContainerColor: Color,
- val checkedContentColor: Color,
- val checkedBorderColor: Color,
- // enabled & unchecked
- val uncheckedContainerColor: Color,
- val uncheckedContentColor: Color,
- val uncheckedBorderColor: Color,
- // disable & checked
- val disabledCheckedContainerColor: Color,
- val disabledCheckedContentColor: Color,
- val disabledCheckedBorderColor: Color,
- // disable & unchecked
- val disabledUncheckedContainerColor: Color,
- val disabledUncheckedContentColor: Color,
- val disabledUncheckedBorderColor: Color,
-
- ) {
+ // enabled & active
+ val activeContainerColor: Color,
+ val activeContentColor: Color,
+ val activeBorderColor: Color,
+ // enabled & inactive
+ val inactiveContainerColor: Color,
+ val inactiveContentColor: Color,
+ val inactiveBorderColor: Color,
+ // disable & active
+ val disabledActiveContainerColor: Color,
+ val disabledActiveContentColor: Color,
+ val disabledActiveBorderColor: Color,
+ // disable & inactive
+ val disabledInactiveContainerColor: Color,
+ val disabledInactiveContentColor: Color,
+ val disabledInactiveBorderColor: Color
+) {
/**
* Represents the color used for the SegmentedButton's border,
- * depending on [enabled] and [checked].
+ * depending on [enabled] and [active].
*
- * @param enabled whether the [SegmentedButtonRow] is enabled or not
- * @param checked whether the [SegmentedButtonRow] item is checked or not
+ * @param enabled whether the [SegmentedButton] is enabled or not
+ * @param active whether the [SegmentedButton] item is checked or not
*/
- internal fun borderColor(enabled: Boolean, checked: Boolean): Color {
+ internal fun borderColor(enabled: Boolean, active: Boolean): Color {
return when {
- enabled && checked -> checkedBorderColor
- enabled && !checked -> uncheckedBorderColor
- !enabled && checked -> disabledCheckedContentColor
- else -> disabledUncheckedContentColor
+ enabled && active -> activeBorderColor
+ enabled && !active -> inactiveBorderColor
+ !enabled && active -> disabledActiveContentColor
+ else -> disabledInactiveContentColor
}
}
/**
* Represents the content color passed to the items
*
- * @param enabled whether the [SegmentedButtonRow] is enabled or not
- * @param checked whether the [SegmentedButtonRow] item is checked or not
+ * @param enabled whether the [SegmentedButton] is enabled or not
+ * @param checked whether the [SegmentedButton] item is checked or not
*/
internal fun contentColor(enabled: Boolean, checked: Boolean): Color {
return when {
- enabled && checked -> checkedContentColor
- enabled && !checked -> uncheckedContentColor
- !enabled && checked -> disabledCheckedContentColor
- else -> disabledUncheckedContentColor
+ enabled && checked -> activeContentColor
+ enabled && !checked -> inactiveContentColor
+ !enabled && checked -> disabledActiveContentColor
+ else -> disabledInactiveContentColor
}
}
/**
* Represents the container color passed to the items
*
- * @param enabled whether the [SegmentedButtonRow] is enabled or not
- * @param checked whether the [SegmentedButtonRow] item is checked or not
+ * @param enabled whether the [SegmentedButton] is enabled or not
+ * @param active whether the [SegmentedButton] item is active or not
*/
- internal fun containerColor(enabled: Boolean, checked: Boolean): Color {
+ internal fun containerColor(enabled: Boolean, active: Boolean): Color {
return when {
- enabled && checked -> checkedContainerColor
- enabled && !checked -> uncheckedContainerColor
- !enabled && checked -> disabledCheckedContainerColor
- else -> disabledUncheckedContainerColor
+ enabled && active -> activeContainerColor
+ enabled && !active -> inactiveContainerColor
+ !enabled && active -> disabledActiveContainerColor
+ else -> disabledInactiveContainerColor
}
}
@@ -400,37 +639,55 @@
other as SegmentedButtonColors
- if (checkedBorderColor != other.checkedBorderColor) return false
- if (checkedContentColor != other.checkedContentColor) return false
- if (checkedContainerColor != other.checkedContainerColor) return false
- if (uncheckedBorderColor != other.uncheckedBorderColor) return false
- if (uncheckedContentColor != other.uncheckedContentColor) return false
- if (uncheckedContainerColor != other.uncheckedContainerColor) return false
- if (disabledCheckedBorderColor != other.disabledCheckedBorderColor) return false
- if (disabledCheckedContentColor != other.disabledCheckedContentColor) return false
- if (disabledCheckedContainerColor != other.disabledCheckedContainerColor) return false
- if (disabledUncheckedBorderColor != other.disabledUncheckedBorderColor) return false
- if (disabledUncheckedContentColor != other.disabledUncheckedContentColor) return false
- if (disabledUncheckedContainerColor != other.disabledUncheckedContainerColor) return false
+ if (activeBorderColor != other.activeBorderColor) return false
+ if (activeContentColor != other.activeContentColor) return false
+ if (activeContainerColor != other.activeContainerColor) return false
+ if (inactiveBorderColor != other.inactiveBorderColor) return false
+ if (inactiveContentColor != other.inactiveContentColor) return false
+ if (inactiveContainerColor != other.inactiveContainerColor) return false
+ if (disabledActiveBorderColor != other.disabledActiveBorderColor) return false
+ if (disabledActiveContentColor != other.disabledActiveContentColor) return false
+ if (disabledActiveContainerColor != other.disabledActiveContainerColor) return false
+ if (disabledInactiveBorderColor != other.disabledInactiveBorderColor) return false
+ if (disabledInactiveContentColor != other.disabledInactiveContentColor) return false
+ if (disabledInactiveContainerColor != other.disabledInactiveContainerColor) return false
return true
}
override fun hashCode(): Int {
- var result = checkedBorderColor.hashCode()
- result = 31 * result + checkedContentColor.hashCode()
- result = 31 * result + checkedContainerColor.hashCode()
- result = 31 * result + uncheckedBorderColor.hashCode()
- result = 31 * result + uncheckedContentColor.hashCode()
- result = 31 * result + uncheckedContainerColor.hashCode()
- result = 31 * result + disabledCheckedBorderColor.hashCode()
- result = 31 * result + disabledCheckedContentColor.hashCode()
- result = 31 * result + disabledCheckedContainerColor.hashCode()
- result = 31 * result + disabledUncheckedBorderColor.hashCode()
- result = 31 * result + disabledUncheckedContentColor.hashCode()
- result = 31 * result + disabledUncheckedContainerColor.hashCode()
+ var result = activeBorderColor.hashCode()
+ result = 31 * result + activeContentColor.hashCode()
+ result = 31 * result + activeContainerColor.hashCode()
+ result = 31 * result + inactiveBorderColor.hashCode()
+ result = 31 * result + inactiveContentColor.hashCode()
+ result = 31 * result + inactiveContainerColor.hashCode()
+ result = 31 * result + disabledActiveBorderColor.hashCode()
+ result = 31 * result + disabledActiveContentColor.hashCode()
+ result = 31 * result + disabledActiveContainerColor.hashCode()
+ result = 31 * result + disabledInactiveBorderColor.hashCode()
+ result = 31 * result + disabledInactiveContentColor.hashCode()
+ result = 31 * result + disabledInactiveContainerColor.hashCode()
return result
}
}
-private const val CheckedZIndexFactor = 5f
\ No newline at end of file
+private fun Modifier.interactionZIndex(checked: Boolean, interactionCount: Int) =
+ this.layout { measurable, constraints ->
+ val placeable = measurable.measure(constraints)
+ layout(placeable.width, placeable.height) {
+ val zIndex = interactionCount + if (checked) CheckedZIndexFactor else 0f
+ placeable.place(0, 0, zIndex)
+ }
+ }
+
+private const val CheckedZIndexFactor = 5f
+private val IconSpacing = 8.dp
+
+@OptIn(ExperimentalMaterial3Api::class)
+private class SingleChoiceSegmentedButtonScopeWrapper(scope: RowScope) :
+ SingleChoiceSegmentedButtonRowScope, RowScope by scope
+
+@OptIn(ExperimentalMaterial3Api::class)
+private class MultiChoiceSegmentedButtonScopeWrapper(scope: RowScope) :
+ MultiChoiceSegmentedButtonRowScope, RowScope by scope
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Shapes.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Shapes.kt
index 2fed380..4edc870 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Shapes.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Shapes.kt
@@ -183,12 +183,14 @@
}
}
-/** Converts a shape token key to the local shape provided by the theme */
-@Composable
-@ReadOnlyComposable
-internal fun ShapeKeyTokens.toShape(): Shape {
- return MaterialTheme.shapes.fromToken(this)
-}
+/**
+ * Converts a shape token key to the local shape provided by the theme
+ * The color is subscribed to [LocalShapes] changes
+ */
+internal val ShapeKeyTokens.value: Shape
+ @Composable
+ @ReadOnlyComposable
+ get() = MaterialTheme.shapes.fromToken(this)
/** CompositionLocal used to specify the default shapes for the surfaces. */
internal val LocalShapes = staticCompositionLocalOf { Shapes() }
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
index 141ffbf..5a6a3366 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
@@ -287,17 +287,17 @@
/** The default shape for bottom sheets in a [Hidden] state. */
val HiddenShape: Shape
@Composable get() =
- SheetBottomTokens.DockedMinimizedContainerShape.toShape()
+ SheetBottomTokens.DockedMinimizedContainerShape.value
/** The default shape for a bottom sheets in [PartiallyExpanded] and [Expanded] states. */
val ExpandedShape: Shape
@Composable get() =
- SheetBottomTokens.DockedContainerShape.toShape()
+ SheetBottomTokens.DockedContainerShape.value
/** The default container color for a bottom sheet. */
val ContainerColor: Color
@Composable get() =
- SheetBottomTokens.DockedContainerColor.toColor()
+ SheetBottomTokens.DockedContainerColor.value
/** The default elevation for a bottom sheet. */
val Elevation = SheetBottomTokens.DockedModalContainerElevation
@@ -305,7 +305,7 @@
/** The default color of the scrim overlay for background content. */
val ScrimColor: Color
@Composable get() =
- ScrimTokens.ContainerColor.toColor().copy(ScrimTokens.ContainerOpacity)
+ ScrimTokens.ContainerColor.value.copy(ScrimTokens.ContainerOpacity)
/**
* The default peek height used by [BottomSheetScaffold].
@@ -328,7 +328,7 @@
width: Dp = SheetBottomTokens.DockedDragHandleWidth,
height: Dp = SheetBottomTokens.DockedDragHandleHeight,
shape: Shape = MaterialTheme.shapes.extraLarge,
- color: Color = SheetBottomTokens.DockedDragHandleColor.toColor()
+ color: Color = SheetBottomTokens.DockedDragHandleColor.value
.copy(SheetBottomTokens.DockedDragHandleOpacity),
) {
val dragHandleDescription = getString(Strings.BottomSheetDragHandleDescription)
@@ -426,4 +426,4 @@
}
private val DragHandleVerticalPadding = 22.dp
-internal val BottomSheetMaxWidth = 640.dp
\ No newline at end of file
+internal val BottomSheetMaxWidth = 640.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
index 107d849..a00e616 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
@@ -920,31 +920,31 @@
*/
@Composable
fun colors(
- thumbColor: Color = SliderTokens.HandleColor.toColor(),
- activeTrackColor: Color = SliderTokens.ActiveTrackColor.toColor(),
+ thumbColor: Color = SliderTokens.HandleColor.value,
+ activeTrackColor: Color = SliderTokens.ActiveTrackColor.value,
activeTickColor: Color = SliderTokens.TickMarksActiveContainerColor
- .toColor()
+ .value
.copy(alpha = SliderTokens.TickMarksActiveContainerOpacity),
- inactiveTrackColor: Color = SliderTokens.InactiveTrackColor.toColor(),
- inactiveTickColor: Color = SliderTokens.TickMarksInactiveContainerColor.toColor()
+ inactiveTrackColor: Color = SliderTokens.InactiveTrackColor.value,
+ inactiveTickColor: Color = SliderTokens.TickMarksInactiveContainerColor.value
.copy(alpha = SliderTokens.TickMarksInactiveContainerOpacity),
disabledThumbColor: Color = SliderTokens.DisabledHandleColor
- .toColor()
+ .value
.copy(alpha = SliderTokens.DisabledHandleOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
disabledActiveTrackColor: Color =
SliderTokens.DisabledActiveTrackColor
- .toColor()
+ .value
.copy(alpha = SliderTokens.DisabledActiveTrackOpacity),
disabledActiveTickColor: Color = SliderTokens.TickMarksDisabledContainerColor
- .toColor()
+ .value
.copy(alpha = SliderTokens.TickMarksDisabledContainerOpacity),
disabledInactiveTrackColor: Color =
SliderTokens.DisabledInactiveTrackColor
- .toColor()
+ .value
.copy(alpha = SliderTokens.DisabledInactiveTrackOpacity),
- disabledInactiveTickColor: Color = SliderTokens.TickMarksDisabledContainerColor.toColor()
+ disabledInactiveTickColor: Color = SliderTokens.TickMarksDisabledContainerColor.value
.copy(alpha = SliderTokens.TickMarksDisabledContainerOpacity)
): SliderColors = SliderColors(
thumbColor = thumbColor,
@@ -999,7 +999,7 @@
} else {
ThumbDefaultElevation
}
- val shape = SliderTokens.HandleShape.toShape()
+ val shape = SliderTokens.HandleShape.value
Spacer(
modifier
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Snackbar.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Snackbar.kt
index 1fc0e7e..fa89582 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Snackbar.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Snackbar.kt
@@ -406,22 +406,22 @@
*/
object SnackbarDefaults {
/** Default shape of a snackbar. */
- val shape: Shape @Composable get() = SnackbarTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = SnackbarTokens.ContainerShape.value
/** Default color of a snackbar. */
- val color: Color @Composable get() = SnackbarTokens.ContainerColor.toColor()
+ val color: Color @Composable get() = SnackbarTokens.ContainerColor.value
/** Default content color of a snackbar. */
- val contentColor: Color @Composable get() = SnackbarTokens.SupportingTextColor.toColor()
+ val contentColor: Color @Composable get() = SnackbarTokens.SupportingTextColor.value
/** Default action color of a snackbar. */
- val actionColor: Color @Composable get() = SnackbarTokens.ActionLabelTextColor.toColor()
+ val actionColor: Color @Composable get() = SnackbarTokens.ActionLabelTextColor.value
/** Default action content color of a snackbar. */
- val actionContentColor: Color @Composable get() = SnackbarTokens.ActionLabelTextColor.toColor()
+ val actionContentColor: Color @Composable get() = SnackbarTokens.ActionLabelTextColor.value
/** Default dismiss action content color of a snackbar. */
- val dismissActionContentColor: Color @Composable get() = SnackbarTokens.IconColor.toColor()
+ val dismissActionContentColor: Color @Composable get() = SnackbarTokens.IconColor.value
}
private val ContainerMaxWidth = 600.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeToDismiss.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeToDismiss.kt
index dfd656f..bce5e38 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeToDismiss.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeToDismiss.kt
@@ -276,4 +276,4 @@
val FixedPositionalThreshold: Density.(totalDistance: Float) -> Float = { _ -> 56.dp.toPx() }
}
-private val DismissThreshold = 125.dp
\ No newline at end of file
+private val DismissThreshold = 125.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
index 3155cfd..e135720 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
@@ -211,7 +211,7 @@
private suspend fun snapInternalToOffset(target: Float) {
draggableState.drag {
- dragBy(target - absoluteOffset.value)
+ dragBy(target - absoluteOffset.floatValue)
}
}
@@ -244,8 +244,8 @@
get() {
// TODO(calintat): Track current velocity (b/149549482) and use that here.
val target = animationTarget.value ?: computeTarget(
- offset = offset.value,
- lastValue = anchors.getOffset(currentValue) ?: offset.value,
+ offset = offset.floatValue,
+ lastValue = anchors.getOffset(currentValue) ?: offset.floatValue,
anchors = anchors.keys,
thresholds = thresholds,
velocity = 0f,
@@ -362,7 +362,7 @@
latestNonEmptyAnchorsFlow.collect { anchors ->
val lastAnchor = anchors.getOffset(currentValue)!!
val targetValue = computeTarget(
- offset = offset.value,
+ offset = offset.floatValue,
lastValue = lastAnchor,
anchors = anchors.keys,
thresholds = thresholds,
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
index 98ac45c..a8de2ab 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
@@ -162,7 +162,7 @@
colors = colors,
thumbValue = offset.asState(),
interactionSource = interactionSource,
- thumbShape = SwitchTokens.HandleShape.toShape(),
+ thumbShape = SwitchTokens.HandleShape.value,
uncheckedThumbDiameter = uncheckedThumbDiameter,
minBound = thumbPaddingStart,
maxBound = ThumbPathLength,
@@ -208,7 +208,7 @@
thumbValue.value
}
- val trackShape = SwitchTokens.TrackShape.toShape()
+ val trackShape = SwitchTokens.TrackShape.value
val modifier = Modifier
.align(Alignment.Center)
.width(SwitchWidth)
@@ -282,35 +282,35 @@
*/
@Composable
fun colors(
- checkedThumbColor: Color = SwitchTokens.SelectedHandleColor.toColor(),
- checkedTrackColor: Color = SwitchTokens.SelectedTrackColor.toColor(),
+ checkedThumbColor: Color = SwitchTokens.SelectedHandleColor.value,
+ checkedTrackColor: Color = SwitchTokens.SelectedTrackColor.value,
checkedBorderColor: Color = Color.Transparent,
- checkedIconColor: Color = SwitchTokens.SelectedIconColor.toColor(),
- uncheckedThumbColor: Color = SwitchTokens.UnselectedHandleColor.toColor(),
- uncheckedTrackColor: Color = SwitchTokens.UnselectedTrackColor.toColor(),
- uncheckedBorderColor: Color = SwitchTokens.UnselectedFocusTrackOutlineColor.toColor(),
- uncheckedIconColor: Color = SwitchTokens.UnselectedIconColor.toColor(),
- disabledCheckedThumbColor: Color = SwitchTokens.DisabledSelectedHandleColor.toColor()
+ checkedIconColor: Color = SwitchTokens.SelectedIconColor.value,
+ uncheckedThumbColor: Color = SwitchTokens.UnselectedHandleColor.value,
+ uncheckedTrackColor: Color = SwitchTokens.UnselectedTrackColor.value,
+ uncheckedBorderColor: Color = SwitchTokens.UnselectedFocusTrackOutlineColor.value,
+ uncheckedIconColor: Color = SwitchTokens.UnselectedIconColor.value,
+ disabledCheckedThumbColor: Color = SwitchTokens.DisabledSelectedHandleColor.value
.copy(alpha = SwitchTokens.DisabledSelectedHandleOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
- disabledCheckedTrackColor: Color = SwitchTokens.DisabledSelectedTrackColor.toColor()
+ disabledCheckedTrackColor: Color = SwitchTokens.DisabledSelectedTrackColor.value
.copy(alpha = SwitchTokens.DisabledTrackOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
disabledCheckedBorderColor: Color = Color.Transparent,
- disabledCheckedIconColor: Color = SwitchTokens.DisabledSelectedIconColor.toColor()
+ disabledCheckedIconColor: Color = SwitchTokens.DisabledSelectedIconColor.value
.copy(alpha = SwitchTokens.DisabledSelectedIconOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
- disabledUncheckedThumbColor: Color = SwitchTokens.DisabledUnselectedHandleColor.toColor()
+ disabledUncheckedThumbColor: Color = SwitchTokens.DisabledUnselectedHandleColor.value
.copy(alpha = SwitchTokens.DisabledUnselectedHandleOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
- disabledUncheckedTrackColor: Color = SwitchTokens.DisabledUnselectedTrackColor.toColor()
+ disabledUncheckedTrackColor: Color = SwitchTokens.DisabledUnselectedTrackColor.value
.copy(alpha = SwitchTokens.DisabledTrackOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
disabledUncheckedBorderColor: Color =
- SwitchTokens.DisabledUnselectedTrackOutlineColor.toColor()
+ SwitchTokens.DisabledUnselectedTrackOutlineColor.value
.copy(alpha = SwitchTokens.DisabledTrackOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
- disabledUncheckedIconColor: Color = SwitchTokens.DisabledUnselectedIconColor.toColor()
+ disabledUncheckedIconColor: Color = SwitchTokens.DisabledUnselectedIconColor.value
.copy(alpha = SwitchTokens.DisabledUnselectedIconOpacity)
.compositeOver(MaterialTheme.colorScheme.surface),
): SwitchColors = SwitchColors(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.kt
index 0a3fcad..d51bb8e 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.kt
@@ -20,4 +20,4 @@
import androidx.compose.runtime.Composable
internal expect val WindowInsets.Companion.systemBarsForVisualComponents: WindowInsets
- @Composable get
\ No newline at end of file
+ @Composable get
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt
index 6dbce24..26dabf2 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt
@@ -411,12 +411,12 @@
/** Default container color of a tab row. */
val containerColor: Color
@Composable get() =
- PrimaryNavigationTabTokens.ContainerColor.toColor()
+ PrimaryNavigationTabTokens.ContainerColor.value
/** Default content color of a tab row. */
val contentColor: Color
@Composable get() =
- PrimaryNavigationTabTokens.ActiveLabelTextColor.toColor()
+ PrimaryNavigationTabTokens.ActiveLabelTextColor.value
/**
* Default indicator, which will be positioned at the bottom of the [TabRow], on top of the
@@ -462,7 +462,7 @@
modifier: Modifier = Modifier,
width: Dp = 24.dp,
height: Dp = PrimaryNavigationTabTokens.ActiveIndicatorHeight,
- color: Color = PrimaryNavigationTabTokens.ActiveIndicatorColor.toColor(),
+ color: Color = PrimaryNavigationTabTokens.ActiveIndicatorColor.value,
shape: Shape = PrimaryNavigationTabTokens.ActiveIndicatorShape
) {
Spacer(
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt
index e23732f..2af0c17d 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt
@@ -1144,4 +1144,4 @@
/** Padding from text field top to label top, and from input field bottom to text field bottom */
/*@VisibleForTesting*/
-internal val TextFieldWithLabelVerticalPadding = 8.dp
\ No newline at end of file
+internal val TextFieldWithLabelVerticalPadding = 8.dp
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldDefaults.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldDefaults.kt
index 7929f2e..c176e55 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldDefaults.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldDefaults.kt
@@ -55,7 +55,7 @@
@Immutable
object TextFieldDefaults {
/** Default shape for a [TextField]. */
- val shape: Shape @Composable get() = FilledTextFieldTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = FilledTextFieldTokens.ContainerShape.value
/**
* The default min width applied to a [TextField].
@@ -245,58 +245,58 @@
*/
@Composable
fun colors(
- focusedTextColor: Color = FilledTextFieldTokens.FocusInputColor.toColor(),
- unfocusedTextColor: Color = FilledTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ focusedTextColor: Color = FilledTextFieldTokens.FocusInputColor.value,
+ unfocusedTextColor: Color = FilledTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorTextColor: Color = FilledTextFieldTokens.ErrorInputColor.toColor(),
- focusedContainerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- unfocusedContainerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- disabledContainerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- errorContainerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- cursorColor: Color = FilledTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ errorTextColor: Color = FilledTextFieldTokens.ErrorInputColor.value,
+ focusedContainerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ unfocusedContainerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ disabledContainerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ errorContainerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ cursorColor: Color = FilledTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.toColor(),
- unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.toColor(),
- disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.toColor()
+ focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.value,
+ unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.value,
+ disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.value
.copy(alpha = FilledTextFieldTokens.DisabledActiveIndicatorOpacity),
- errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.toColor(),
- focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.value,
+ focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.toColor(),
- disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.toColor()
+ errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.value,
+ disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.toColor()
+ errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.toColor(),
- focusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- unfocusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.value,
+ focusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ unfocusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.toColor(),
- disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.toColor()
+ errorPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.value,
+ disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.value
.copy(alpha = FilledTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor()
+ errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
): TextFieldColors =
TextFieldColors(
focusedTextColor = focusedTextColor,
@@ -536,7 +536,7 @@
isError: Boolean,
interactionSource: InteractionSource,
colors: TextFieldColors,
- shape: Shape = OutlinedTextFieldTokens.ContainerShape.toShape(),
+ shape: Shape = OutlinedTextFieldTokens.ContainerShape.value,
focusedBorderThickness: Dp = OutlinedTextFieldDefaults.FocusedBorderThickness,
unfocusedBorderThickness: Dp = OutlinedTextFieldDefaults.UnfocusedBorderThickness
) = OutlinedTextFieldDefaults.ContainerBox(
@@ -669,56 +669,56 @@
@ExperimentalMaterial3Api
@Composable
fun textFieldColors(
- focusedTextColor: Color = FilledTextFieldTokens.FocusInputColor.toColor(),
- unfocusedTextColor: Color = FilledTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ focusedTextColor: Color = FilledTextFieldTokens.FocusInputColor.value,
+ unfocusedTextColor: Color = FilledTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorTextColor: Color = FilledTextFieldTokens.ErrorInputColor.toColor(),
- containerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- errorContainerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- cursorColor: Color = FilledTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ errorTextColor: Color = FilledTextFieldTokens.ErrorInputColor.value,
+ containerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ errorContainerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ cursorColor: Color = FilledTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.toColor(),
- unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.toColor(),
- disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.toColor()
+ focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.value,
+ unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.value,
+ disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.value
.copy(alpha = FilledTextFieldTokens.DisabledActiveIndicatorOpacity),
- errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.toColor(),
- focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.value,
+ focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.toColor(),
- disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.toColor()
+ errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.value,
+ disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.toColor()
+ errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.toColor(),
- focusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- unfocusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.value,
+ focusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ unfocusedPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.toColor(),
- disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.toColor()
+ errorPlaceholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.value,
+ disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.value
.copy(alpha = FilledTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor()
+ errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
): TextFieldColors = colors(
focusedTextColor = focusedTextColor,
unfocusedTextColor = unfocusedTextColor,
@@ -819,56 +819,56 @@
@ExperimentalMaterial3Api
@Composable
fun outlinedTextFieldColors(
- focusedTextColor: Color = OutlinedTextFieldTokens.FocusInputColor.toColor(),
- unfocusedTextColor: Color = OutlinedTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ focusedTextColor: Color = OutlinedTextFieldTokens.FocusInputColor.value,
+ unfocusedTextColor: Color = OutlinedTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorTextColor: Color = OutlinedTextFieldTokens.ErrorInputColor.toColor(),
+ errorTextColor: Color = OutlinedTextFieldTokens.ErrorInputColor.value,
containerColor: Color = Color.Transparent,
errorContainerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ cursorColor: Color = OutlinedTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.toColor(),
- disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.toColor()
+ focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.value,
+ disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.toColor(),
- focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.value,
+ focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.toColor(),
+ errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.value,
disabledTrailingIconColor: Color = OutlinedTextFieldTokens.DisabledTrailingIconColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
+ errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.toColor(),
- focusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- unfocusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.value,
+ focusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ unfocusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.toColor(),
+ errorPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.value,
disabledSupportingTextColor: Color = OutlinedTextFieldTokens.DisabledSupportingColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
+ errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
): TextFieldColors = OutlinedTextFieldDefaults.colors(
focusedTextColor = focusedTextColor,
unfocusedTextColor = unfocusedTextColor,
@@ -1058,51 +1058,51 @@
@ExperimentalMaterial3Api
@Composable
fun textFieldColors(
- textColor: Color = FilledTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ textColor: Color = FilledTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- containerColor: Color = FilledTextFieldTokens.ContainerColor.toColor(),
- cursorColor: Color = FilledTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ containerColor: Color = FilledTextFieldTokens.ContainerColor.value,
+ cursorColor: Color = FilledTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = FilledTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.toColor(),
- unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.toColor(),
- disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.toColor()
+ focusedIndicatorColor: Color = FilledTextFieldTokens.FocusActiveIndicatorColor.value,
+ unfocusedIndicatorColor: Color = FilledTextFieldTokens.ActiveIndicatorColor.value,
+ disabledIndicatorColor: Color = FilledTextFieldTokens.DisabledActiveIndicatorColor.value
.copy(alpha = FilledTextFieldTokens.DisabledActiveIndicatorOpacity),
- errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.toColor(),
- focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorIndicatorColor: Color = FilledTextFieldTokens.ErrorActiveIndicatorColor.value,
+ focusedLeadingIconColor: Color = FilledTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = FilledTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = FilledTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.toColor(),
- disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.toColor()
+ errorLeadingIconColor: Color = FilledTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = FilledTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = FilledTextFieldTokens.TrailingIconColor.value,
+ disabledTrailingIconColor: Color = FilledTextFieldTokens.DisabledTrailingIconColor.value
.copy(alpha = FilledTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.toColor()
+ errorTrailingIconColor: Color = FilledTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = FilledTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = FilledTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = FilledTextFieldTokens.DisabledLabelColor.value
.copy(alpha = FilledTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.toColor(),
- placeholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = FilledTextFieldTokens.ErrorLabelColor.value,
+ placeholderColor: Color = FilledTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = FilledTextFieldTokens.DisabledInputColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.toColor(),
- disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.toColor()
+ focusedSupportingTextColor: Color = FilledTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = FilledTextFieldTokens.SupportingColor.value,
+ disabledSupportingTextColor: Color = FilledTextFieldTokens.DisabledSupportingColor.value
.copy(alpha = FilledTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor()
+ errorSupportingTextColor: Color = FilledTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = FilledTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value
.copy(alpha = FilledTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = FilledTextFieldTokens.InputSuffixColor.value,
): TextFieldColors = colors(
focusedTextColor = textColor,
unfocusedTextColor = textColor,
@@ -1153,51 +1153,51 @@
@ExperimentalMaterial3Api
@Composable
fun outlinedTextFieldColors(
- textColor: Color = OutlinedTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ textColor: Color = OutlinedTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
containerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ cursorColor: Color = OutlinedTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.toColor(),
- disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.toColor()
+ focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.value,
+ disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.toColor(),
- focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.value,
+ focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.toColor(),
+ errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.value,
disabledTrailingIconColor: Color = OutlinedTextFieldTokens.DisabledTrailingIconColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
+ errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.toColor(),
- placeholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.value,
+ placeholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.toColor(),
+ focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.value,
disabledSupportingTextColor: Color = OutlinedTextFieldTokens.DisabledSupportingColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
+ errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
): TextFieldColors = OutlinedTextFieldDefaults.colors(
focusedTextColor = textColor,
unfocusedTextColor = textColor,
@@ -1345,7 +1345,7 @@
@Immutable
object OutlinedTextFieldDefaults {
/** Default shape for an [OutlinedTextField]. */
- val shape: Shape @Composable get() = OutlinedTextFieldTokens.ContainerShape.toShape()
+ val shape: Shape @Composable get() = OutlinedTextFieldTokens.ContainerShape.value
/**
* The default min width applied to an [OutlinedTextField].
@@ -1392,7 +1392,7 @@
isError: Boolean,
interactionSource: InteractionSource,
colors: TextFieldColors,
- shape: Shape = OutlinedTextFieldTokens.ContainerShape.toShape(),
+ shape: Shape = OutlinedTextFieldTokens.ContainerShape.value,
focusedBorderThickness: Dp = FocusedBorderThickness,
unfocusedBorderThickness: Dp = UnfocusedBorderThickness
) {
@@ -1477,58 +1477,58 @@
*/
@Composable
fun colors(
- focusedTextColor: Color = OutlinedTextFieldTokens.FocusInputColor.toColor(),
- unfocusedTextColor: Color = OutlinedTextFieldTokens.InputColor.toColor(),
- disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ focusedTextColor: Color = OutlinedTextFieldTokens.FocusInputColor.value,
+ unfocusedTextColor: Color = OutlinedTextFieldTokens.InputColor.value,
+ disabledTextColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorTextColor: Color = OutlinedTextFieldTokens.ErrorInputColor.toColor(),
+ errorTextColor: Color = OutlinedTextFieldTokens.ErrorInputColor.value,
focusedContainerColor: Color = Color.Transparent,
unfocusedContainerColor: Color = Color.Transparent,
disabledContainerColor: Color = Color.Transparent,
errorContainerColor: Color = Color.Transparent,
- cursorColor: Color = OutlinedTextFieldTokens.CaretColor.toColor(),
- errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.toColor(),
+ cursorColor: Color = OutlinedTextFieldTokens.CaretColor.value,
+ errorCursorColor: Color = OutlinedTextFieldTokens.ErrorFocusCaretColor.value,
selectionColors: TextSelectionColors = LocalTextSelectionColors.current,
- focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.toColor(),
- unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.toColor(),
- disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.toColor()
+ focusedBorderColor: Color = OutlinedTextFieldTokens.FocusOutlineColor.value,
+ unfocusedBorderColor: Color = OutlinedTextFieldTokens.OutlineColor.value,
+ disabledBorderColor: Color = OutlinedTextFieldTokens.DisabledOutlineColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledOutlineOpacity),
- errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.toColor(),
- focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.toColor(),
- unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.toColor(),
- disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.toColor()
+ errorBorderColor: Color = OutlinedTextFieldTokens.ErrorOutlineColor.value,
+ focusedLeadingIconColor: Color = OutlinedTextFieldTokens.FocusLeadingIconColor.value,
+ unfocusedLeadingIconColor: Color = OutlinedTextFieldTokens.LeadingIconColor.value,
+ disabledLeadingIconColor: Color = OutlinedTextFieldTokens.DisabledLeadingIconColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLeadingIconOpacity),
- errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.toColor(),
- focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.toColor(),
- unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.toColor(),
+ errorLeadingIconColor: Color = OutlinedTextFieldTokens.ErrorLeadingIconColor.value,
+ focusedTrailingIconColor: Color = OutlinedTextFieldTokens.FocusTrailingIconColor.value,
+ unfocusedTrailingIconColor: Color = OutlinedTextFieldTokens.TrailingIconColor.value,
disabledTrailingIconColor: Color = OutlinedTextFieldTokens.DisabledTrailingIconColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
- errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.toColor(),
- focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.toColor(),
- unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.toColor(),
- disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledTrailingIconOpacity),
+ errorTrailingIconColor: Color = OutlinedTextFieldTokens.ErrorTrailingIconColor.value,
+ focusedLabelColor: Color = OutlinedTextFieldTokens.FocusLabelColor.value,
+ unfocusedLabelColor: Color = OutlinedTextFieldTokens.LabelColor.value,
+ disabledLabelColor: Color = OutlinedTextFieldTokens.DisabledLabelColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledLabelOpacity),
- errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.toColor(),
- focusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- unfocusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.toColor()
+ errorLabelColor: Color = OutlinedTextFieldTokens.ErrorLabelColor.value,
+ focusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ unfocusedPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ disabledPlaceholderColor: Color = OutlinedTextFieldTokens.DisabledInputColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.toColor(),
- focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.toColor(),
- unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.toColor(),
+ errorPlaceholderColor: Color = OutlinedTextFieldTokens.InputPlaceholderColor.value,
+ focusedSupportingTextColor: Color = OutlinedTextFieldTokens.FocusSupportingColor.value,
+ unfocusedSupportingTextColor: Color = OutlinedTextFieldTokens.SupportingColor.value,
disabledSupportingTextColor: Color = OutlinedTextFieldTokens.DisabledSupportingColor
- .toColor().copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
- errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.toColor(),
- focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor()
+ .value.copy(alpha = OutlinedTextFieldTokens.DisabledSupportingOpacity),
+ errorSupportingTextColor: Color = OutlinedTextFieldTokens.ErrorSupportingColor.value,
+ focusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ unfocusedPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ disabledPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.toColor(),
- focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
- disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor()
+ errorPrefixColor: Color = OutlinedTextFieldTokens.InputPrefixColor.value,
+ focusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ unfocusedSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
+ disabledSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value
.copy(alpha = OutlinedTextFieldTokens.DisabledInputOpacity),
- errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.toColor(),
+ errorSuffixColor: Color = OutlinedTextFieldTokens.InputSuffixColor.value,
): TextFieldColors =
TextFieldColors(
focusedTextColor = focusedTextColor,
@@ -2172,4 +2172,4 @@
return rememberUpdatedState(
BorderStroke(animatedThickness.value, SolidColor(indicatorColor.value))
)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldImpl.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldImpl.kt
index 2ee2a6c..14b7065 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldImpl.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextFieldImpl.kt
@@ -426,4 +426,4 @@
internal val MinFocusedLabelLineHeight = 16.dp
internal val MinSupportingTextLineHeight = 16.dp
-internal val IconDefaultSizeModifier = Modifier.defaultMinSize(48.dp, 48.dp)
\ No newline at end of file
+internal val IconDefaultSizeModifier = Modifier.defaultMinSize(48.dp, 48.dp)
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimeFormat.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimeFormat.kt
index d1941c5..01f635a 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimeFormat.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimeFormat.kt
@@ -21,4 +21,4 @@
internal expect val is24HourFormat: Boolean
@Composable
- @ReadOnlyComposable get
\ No newline at end of file
+ @ReadOnlyComposable get
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
index dded021..2a47e55 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
@@ -273,27 +273,27 @@
*/
@Composable
fun colors(
- clockDialColor: Color = ClockDialColor.toColor(),
- clockDialSelectedContentColor: Color = ClockDialSelectedLabelTextColor.toColor(),
- clockDialUnselectedContentColor: Color = ClockDialUnselectedLabelTextColor.toColor(),
- selectorColor: Color = ClockDialSelectorHandleContainerColor.toColor(),
- containerColor: Color = ContainerColor.toColor(),
- periodSelectorBorderColor: Color = PeriodSelectorOutlineColor.toColor(),
+ clockDialColor: Color = ClockDialColor.value,
+ clockDialSelectedContentColor: Color = ClockDialSelectedLabelTextColor.value,
+ clockDialUnselectedContentColor: Color = ClockDialUnselectedLabelTextColor.value,
+ selectorColor: Color = ClockDialSelectorHandleContainerColor.value,
+ containerColor: Color = ContainerColor.value,
+ periodSelectorBorderColor: Color = PeriodSelectorOutlineColor.value,
periodSelectorSelectedContainerColor: Color =
- PeriodSelectorSelectedContainerColor.toColor(),
+ PeriodSelectorSelectedContainerColor.value,
periodSelectorUnselectedContainerColor: Color = Color.Transparent,
periodSelectorSelectedContentColor: Color =
- PeriodSelectorSelectedLabelTextColor.toColor(),
+ PeriodSelectorSelectedLabelTextColor.value,
periodSelectorUnselectedContentColor: Color =
- PeriodSelectorUnselectedLabelTextColor.toColor(),
+ PeriodSelectorUnselectedLabelTextColor.value,
timeSelectorSelectedContainerColor: Color =
- TimeSelectorSelectedContainerColor.toColor(),
+ TimeSelectorSelectedContainerColor.value,
timeSelectorUnselectedContainerColor: Color =
- TimeSelectorUnselectedContainerColor.toColor(),
+ TimeSelectorUnselectedContainerColor.value,
timeSelectorSelectedContentColor: Color =
- TimeSelectorSelectedLabelTextColor.toColor(),
+ TimeSelectorSelectedLabelTextColor.value,
timeSelectorUnselectedContentColor: Color =
- TimeSelectorUnselectedLabelTextColor.toColor(),
+ TimeSelectorUnselectedLabelTextColor.value,
) = TimePickerColors(
clockDialColor = clockDialColor,
clockDialSelectedContentColor = clockDialSelectedContentColor,
@@ -935,7 +935,7 @@
}
}
- val shape = PeriodSelectorContainerShape.toShape() as CornerBasedShape
+ val shape = PeriodSelectorContainerShape.value as CornerBasedShape
PeriodToggleImpl(
modifier = modifier,
@@ -978,7 +978,7 @@
}
}
- val shape = PeriodSelectorContainerShape.toShape() as CornerBasedShape
+ val shape = PeriodSelectorContainerShape.value as CornerBasedShape
PeriodToggleImpl(
modifier = modifier,
@@ -1004,7 +1004,7 @@
colors.periodSelectorBorderColor
)
- val shape = PeriodSelectorContainerShape.toShape() as CornerBasedShape
+ val shape = PeriodSelectorContainerShape.value as CornerBasedShape
val contentDescription = getString(Strings.TimePickerPeriodToggle)
Layout(
modifier = modifier
@@ -1031,7 +1031,7 @@
.layoutId("Spacer")
.zIndex(SeparatorZIndex)
.fillMaxSize()
- .background(color = PeriodSelectorOutlineColor.toColor())
+ .background(color = PeriodSelectorOutlineColor.value)
)
ToggleItem(
checked =
@@ -1090,7 +1090,7 @@
) {
Text(
text = ":",
- color = TimeFieldSeparatorColor.toColor(),
+ color = TimeFieldSeparatorColor.value,
style = style
)
}
@@ -1132,7 +1132,7 @@
}
},
selected = selected,
- shape = TimeSelectorContainerShape.toShape(),
+ shape = TimeSelectorContainerShape.value,
color = containerColor,
) {
val valueContentDescription =
@@ -1491,7 +1491,7 @@
enabled = true,
isError = false,
interactionSource = interactionSource,
- shape = TimeInputTokens.TimeFieldContainerShape.toShape(),
+ shape = TimeInputTokens.TimeFieldContainerShape.value,
colors = textFieldColors,
)
}
@@ -1510,7 +1510,7 @@
Strings.TimePickerMinute
}
),
- color = TimeInputTokens.TimeFieldSupportingTextColor.toColor(),
+ color = TimeInputTokens.TimeFieldSupportingTextColor.value,
style = MaterialTheme
.typography
.fromToken(TimeInputTokens.TimeFieldSupportingTextFont)
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tooltip.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tooltip.kt
index 7fe1110..4ae7400 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tooltip.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tooltip.kt
@@ -24,7 +24,6 @@
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.MutatePriority
import androidx.compose.foundation.MutatorMutex
-import androidx.compose.foundation.focusable
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.waitForUpOrCancellation
@@ -384,25 +383,25 @@
* The default [Shape] for a [PlainTooltipBox]'s container.
*/
val plainTooltipContainerShape: Shape
- @Composable get() = PlainTooltipTokens.ContainerShape.toShape()
+ @Composable get() = PlainTooltipTokens.ContainerShape.value
/**
* The default [Color] for a [PlainTooltipBox]'s container.
*/
val plainTooltipContainerColor: Color
- @Composable get() = PlainTooltipTokens.ContainerColor.toColor()
+ @Composable get() = PlainTooltipTokens.ContainerColor.value
/**
* The default [Color] for the content within the [PlainTooltipBox].
*/
val plainTooltipContentColor: Color
- @Composable get() = PlainTooltipTokens.SupportingTextColor.toColor()
+ @Composable get() = PlainTooltipTokens.SupportingTextColor.value
/**
* The default [Shape] for a [RichTooltipBox]'s container.
*/
val richTooltipContainerShape: Shape @Composable get() =
- RichTooltipTokens.ContainerShape.toShape()
+ RichTooltipTokens.ContainerShape.value
/**
* Method to create a [RichTooltipColors] for [RichTooltipBox]
@@ -410,10 +409,10 @@
*/
@Composable
fun richTooltipColors(
- containerColor: Color = RichTooltipTokens.ContainerColor.toColor(),
- contentColor: Color = RichTooltipTokens.SupportingTextColor.toColor(),
- titleContentColor: Color = RichTooltipTokens.SubheadColor.toColor(),
- actionContentColor: Color = RichTooltipTokens.ActionLabelTextColor.toColor(),
+ containerColor: Color = RichTooltipTokens.ContainerColor.value,
+ contentColor: Color = RichTooltipTokens.SupportingTextColor.value,
+ titleContentColor: Color = RichTooltipTokens.SubheadColor.value,
+ actionContentColor: Color = RichTooltipTokens.ActionLabelTextColor.value,
): RichTooltipColors =
RichTooltipColors(
containerColor = containerColor,
@@ -827,4 +826,4 @@
internal const val TooltipDuration = 1500L
// No specification for fade in and fade out duration, so aligning it with the behavior for snack bar
internal const val TooltipFadeInDuration = 150
-private const val TooltipFadeOutDuration = 75
\ No newline at end of file
+private const val TooltipFadeOutDuration = 75
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/AssistChipTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/AssistChipTokens.kt
index c7dc2ca..12c2566 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/AssistChipTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/AssistChipTokens.kt
@@ -55,4 +55,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 18.0.dp
val PressedIconColor = ColorSchemeKeyTokens.Primary
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/BottomAppBarTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/BottomAppBarTokens.kt
index 00655a8..16521e6 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/BottomAppBarTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/BottomAppBarTokens.kt
@@ -26,4 +26,4 @@
val ContainerHeight = 80.0.dp
val ContainerShape = ShapeKeyTokens.CornerNone
val ContainerSurfaceTintLayerColor = ColorSchemeKeyTokens.SurfaceTint
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/CircularProgressIndicatorTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/CircularProgressIndicatorTokens.kt
index 7e0ea7e..26701dc 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/CircularProgressIndicatorTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/CircularProgressIndicatorTokens.kt
@@ -29,4 +29,4 @@
val FourColorActiveIndicatorThreeColor = ColorSchemeKeyTokens.Tertiary
val FourColorActiveIndicatorTwoColor = ColorSchemeKeyTokens.PrimaryContainer
val Size = 48.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDarkTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDarkTokens.kt
index 5943954..230540c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDarkTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDarkTokens.kt
@@ -67,4 +67,4 @@
val TertiaryContainer = PaletteTokens.Tertiary30
val TertiaryFixed = PaletteTokens.Tertiary90
val TertiaryFixedDim = PaletteTokens.Tertiary80
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLightTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLightTokens.kt
index 1dbbb2f..cf18f07 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLightTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLightTokens.kt
@@ -67,4 +67,4 @@
val TertiaryContainer = PaletteTokens.Tertiary90
val TertiaryFixed = PaletteTokens.Tertiary90
val TertiaryFixedDim = PaletteTokens.Tertiary80
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKeyTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKeyTokens.kt
index 85acb6f..72914e4 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKeyTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKeyTokens.kt
@@ -67,4 +67,4 @@
TertiaryContainer,
TertiaryFixed,
TertiaryFixedDim,
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/DividerTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/DividerTokens.kt
index a9bfc87..df21b7d9 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/DividerTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/DividerTokens.kt
@@ -23,4 +23,4 @@
internal object DividerTokens {
val Color = ColorSchemeKeyTokens.OutlineVariant
val Thickness = 1.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedButtonTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedButtonTokens.kt
index fcef087..bf908da 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedButtonTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedButtonTokens.kt
@@ -46,4 +46,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 18.0.dp
val PressedIconColor = ColorSchemeKeyTokens.Primary
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedCardTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedCardTokens.kt
index ca4729a..8db812f 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedCardTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ElevatedCardTokens.kt
@@ -34,4 +34,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 24.0.dp
val PressedContainerElevation = ElevationTokens.Level1
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ExtendedFabPrimaryTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ExtendedFabPrimaryTokens.kt
index 1786948..70d298e 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ExtendedFabPrimaryTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ExtendedFabPrimaryTokens.kt
@@ -42,4 +42,4 @@
val PressedContainerElevation = ElevationTokens.Level3
val PressedIconColor = ColorSchemeKeyTokens.OnPrimaryContainer
val PressedLabelTextColor = ColorSchemeKeyTokens.OnPrimaryContainer
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryLargeTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryLargeTokens.kt
index 9d06a88..2330a5c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryLargeTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryLargeTokens.kt
@@ -38,4 +38,4 @@
val LoweredPressedContainerElevation = ElevationTokens.Level1
val PressedContainerElevation = ElevationTokens.Level3
val PressedIconColor = ColorSchemeKeyTokens.OnPrimaryContainer
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimarySmallTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimarySmallTokens.kt
index 3cbd45db..106084a 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimarySmallTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimarySmallTokens.kt
@@ -38,4 +38,4 @@
val LoweredPressedContainerElevation = ElevationTokens.Level1
val PressedContainerElevation = ElevationTokens.Level3
val PressedIconColor = ColorSchemeKeyTokens.OnPrimaryContainer
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryTokens.kt
index 2161f4c..6ee7c71 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabPrimaryTokens.kt
@@ -38,4 +38,4 @@
val LoweredPressedContainerElevation = ElevationTokens.Level1
val PressedContainerElevation = ElevationTokens.Level3
val PressedIconColor = ColorSchemeKeyTokens.OnPrimaryContainer
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabSecondaryTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabSecondaryTokens.kt
index 774995b..ce17e1b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabSecondaryTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FabSecondaryTokens.kt
@@ -38,4 +38,4 @@
val LoweredPressedContainerElevation = ElevationTokens.Level1
val PressedContainerElevation = ElevationTokens.Level3
val PressedIconColor = ColorSchemeKeyTokens.OnSecondaryContainer
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledAutocompleteTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledAutocompleteTokens.kt
index 88fe201..7ea8782 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledAutocompleteTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledAutocompleteTokens.kt
@@ -95,4 +95,4 @@
val FieldSupportingTextFont = TypographyKeyTokens.BodySmall
val TextFieldTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TextFieldTrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledButtonTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledButtonTokens.kt
index 64cb2b1..8d32f8e 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledButtonTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledButtonTokens.kt
@@ -45,4 +45,4 @@
val IconColor = ColorSchemeKeyTokens.OnPrimary
val IconSize = 18.0.dp
val PressedIconColor = ColorSchemeKeyTokens.OnPrimary
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledCardTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledCardTokens.kt
index 5dad463..fcada51 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledCardTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledCardTokens.kt
@@ -33,4 +33,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 24.0.dp
val PressedContainerElevation = ElevationTokens.Level0
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledTextFieldTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledTextFieldTokens.kt
index dc067dd..4d8c142 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledTextFieldTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilledTextFieldTokens.kt
@@ -88,4 +88,4 @@
val SupportingFont = TypographyKeyTokens.BodySmall
val TrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilterChipTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilterChipTokens.kt
index efe7825..1798b56 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilterChipTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/FilterChipTokens.kt
@@ -88,4 +88,4 @@
val UnselectedFocusTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val UnselectedHoverTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val UnselectedPressedTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/InputChipTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/InputChipTokens.kt
index d309ef6..26c5d18 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/InputChipTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/InputChipTokens.kt
@@ -76,4 +76,4 @@
val UnselectedHoverTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val UnselectedPressedTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val UnselectedTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ListTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ListTokens.kt
index b9be5b0..95d349d 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ListTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ListTokens.kt
@@ -71,4 +71,4 @@
val ListItemTrailingSupportingTextFont = TypographyKeyTokens.LabelSmall
val ListItemTwoLineContainerHeight = 72.0.dp
val ListItemUnselectedTrailingIconColor = ColorSchemeKeyTokens.OnSurface
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationBarTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationBarTokens.kt
index eecfc7e..8a95164 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationBarTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationBarTokens.kt
@@ -48,4 +48,4 @@
val InactivePressedIconColor = ColorSchemeKeyTokens.OnSurface
val InactivePressedLabelTextColor = ColorSchemeKeyTokens.OnSurface
val LabelTextFont = TypographyKeyTokens.LabelMedium
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationDrawerTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationDrawerTokens.kt
index 72c7a51..8aa688b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationDrawerTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationDrawerTokens.kt
@@ -55,4 +55,4 @@
val LargeBadgeLabelFont = TypographyKeyTokens.LabelLarge
val ModalContainerElevation = ElevationTokens.Level1
val StandardContainerElevation = ElevationTokens.Level0
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationRailTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationRailTokens.kt
index 0fb4723..1c6758d 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationRailTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/NavigationRailTokens.kt
@@ -54,4 +54,4 @@
val MenuPressedIconColor = ColorSchemeKeyTokens.OnSurface
val NoLabelActiveIndicatorHeight = 56.0.dp
val NoLabelActiveIndicatorShape = ShapeKeyTokens.CornerFull
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedAutocompleteTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedAutocompleteTokens.kt
index 779a0ff..3f3c6d3 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedAutocompleteTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedAutocompleteTokens.kt
@@ -93,4 +93,4 @@
val FieldSupportingTextFont = TypographyKeyTokens.BodySmall
val TextFieldTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TextFieldTrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedButtonTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedButtonTokens.kt
index 97c36a5..e6589c0 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedButtonTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedButtonTokens.kt
@@ -44,4 +44,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 18.0.dp
val PressedIconColor = ColorSchemeKeyTokens.Primary
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedSegmentedButtonTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedSegmentedButtonTokens.kt
index 681ebd3..2530ef6 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedSegmentedButtonTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/OutlinedSegmentedButtonTokens.kt
@@ -51,4 +51,4 @@
val UnselectedPressedLabelTextColor = ColorSchemeKeyTokens.OnSurface
val UnselectedIconColor = ColorSchemeKeyTokens.OnSurface
val IconSize = 18.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PaletteTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PaletteTokens.kt
index 3a8eb4c..b4e5e3b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PaletteTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PaletteTokens.kt
@@ -112,4 +112,4 @@
val Tertiary95 = Color(red = 255, green = 236, blue = 241)
val Tertiary99 = Color(red = 255, green = 251, blue = 250)
val White = Color(red = 255, green = 255, blue = 255)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PlainTooltipTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PlainTooltipTokens.kt
index 37b4364..0a3aa15 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PlainTooltipTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PlainTooltipTokens.kt
@@ -21,4 +21,4 @@
val ContainerShape = ShapeKeyTokens.CornerExtraSmall
val SupportingTextColor = ColorSchemeKeyTokens.InverseOnSurface
val SupportingTextFont = TypographyKeyTokens.BodySmall
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PrimaryNavigationTabTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PrimaryNavigationTabTokens.kt
index 4622e75..3a7cc1b6 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PrimaryNavigationTabTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/PrimaryNavigationTabTokens.kt
@@ -49,4 +49,4 @@
val InactiveLabelTextColor = ColorSchemeKeyTokens.OnSurfaceVariant
val InactivePressedLabelTextColor = ColorSchemeKeyTokens.OnSurface
val LabelTextFont = TypographyKeyTokens.TitleSmall
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/RichTooltipTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/RichTooltipTokens.kt
index e6d6f79..0363645 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/RichTooltipTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/RichTooltipTokens.kt
@@ -32,4 +32,4 @@
val SubheadFont = TypographyKeyTokens.TitleSmall
val SupportingTextColor = ColorSchemeKeyTokens.OnSurfaceVariant
val SupportingTextFont = TypographyKeyTokens.BodyMedium
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ScrimTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ScrimTokens.kt
index 9838003f..0526def 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ScrimTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ScrimTokens.kt
@@ -21,4 +21,4 @@
internal object ScrimTokens {
val ContainerColor = ColorSchemeKeyTokens.Scrim
const val ContainerOpacity = 0.32f
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchBarTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchBarTokens.kt
index 6cc751a..fc83e22 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchBarTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchBarTokens.kt
@@ -37,4 +37,4 @@
val SupportingTextColor = ColorSchemeKeyTokens.OnSurfaceVariant
val SupportingTextFont = TypographyKeyTokens.BodyLarge
val TrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchViewTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchViewTokens.kt
index ae626cf..8553159 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchViewTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SearchViewTokens.kt
@@ -36,4 +36,4 @@
val HeaderSupportingTextColor = ColorSchemeKeyTokens.OnSurfaceVariant
val HeaderSupportingTextFont = TypographyKeyTokens.BodyLarge
val HeaderTrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SecondaryNavigationTabTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SecondaryNavigationTabTokens.kt
index 6d34a48..a19ea9b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SecondaryNavigationTabTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SecondaryNavigationTabTokens.kt
@@ -40,4 +40,4 @@
val IconSize = 24.0.dp
val InactiveIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val PressedIconColor = ColorSchemeKeyTokens.OnSurface
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeKeyTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeKeyTokens.kt
index 956f53a..60b0097 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeKeyTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeKeyTokens.kt
@@ -30,4 +30,4 @@
CornerMedium,
CornerNone,
CornerSmall,
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeTokens.kt
index b4e3f61..92dedaa 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ShapeTokens.kt
@@ -58,4 +58,4 @@
val CornerMedium = RoundedCornerShape(12.0.dp)
val CornerNone = RectangleShape
val CornerSmall = RoundedCornerShape(8.0.dp)
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SheetBottomTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SheetBottomTokens.kt
index ecc53a4..4625132 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SheetBottomTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SheetBottomTokens.kt
@@ -31,4 +31,4 @@
val DockedMinimizedContainerShape = ShapeKeyTokens.CornerNone
val DockedModalContainerElevation = ElevationTokens.Level1
val DockedStandardContainerElevation = ElevationTokens.Level1
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SliderTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SliderTokens.kt
index 5506511..230111b 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SliderTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SliderTokens.kt
@@ -59,4 +59,4 @@
const val TickMarksDisabledContainerOpacity = 0.38f
val TickMarksInactiveContainerColor = ColorSchemeKeyTokens.OnSurfaceVariant
const val TickMarksInactiveContainerOpacity = 0.38f
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SnackbarTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SnackbarTokens.kt
index ad7994a..45acfed 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SnackbarTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SnackbarTokens.kt
@@ -38,4 +38,4 @@
val SupportingTextFont = TypographyKeyTokens.BodyMedium
val SingleLineContainerHeight = 48.0.dp
val TwoLinesContainerHeight = 68.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SwitchTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SwitchTokens.kt
index a359c70..a6c2e72 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SwitchTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/SwitchTokens.kt
@@ -78,4 +78,4 @@
val UnselectedTrackOutlineColor = ColorSchemeKeyTokens.Outline
val IconHandleHeight = 24.0.dp
val IconHandleWidth = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TextButtonTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TextButtonTokens.kt
index 90f2c21..bea23ec 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TextButtonTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TextButtonTokens.kt
@@ -37,4 +37,4 @@
val IconColor = ColorSchemeKeyTokens.Primary
val IconSize = 18.0.dp
val PressedIconColor = ColorSchemeKeyTokens.Primary
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimeInputTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimeInputTokens.kt
index 7fe4835..384f336 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimeInputTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimeInputTokens.kt
@@ -58,4 +58,4 @@
val TimeFieldSeparatorFont = TypographyKeyTokens.DisplayLarge
val TimeFieldSupportingTextColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TimeFieldSupportingTextFont = TypographyKeyTokens.BodySmall
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimePickerTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimePickerTokens.kt
index 335414e..0c4fe2c 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimePickerTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TimePickerTokens.kt
@@ -75,4 +75,4 @@
val TimeSelectorUnselectedHoverLabelTextColor = ColorSchemeKeyTokens.OnSurface
val TimeSelectorUnselectedLabelTextColor = ColorSchemeKeyTokens.OnSurface
val TimeSelectorUnselectedPressedLabelTextColor = ColorSchemeKeyTokens.OnSurface
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarLargeTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarLargeTokens.kt
index 3713c50..b45cf89 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarLargeTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarLargeTokens.kt
@@ -32,4 +32,4 @@
val LeadingIconSize = 24.0.dp
val TrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarMediumTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarMediumTokens.kt
index b2045a5..b342dc2 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarMediumTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarMediumTokens.kt
@@ -32,4 +32,4 @@
val LeadingIconSize = 24.0.dp
val TrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarSmallTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarSmallTokens.kt
index ebd8114..3fc3b56 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarSmallTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TopAppBarSmallTokens.kt
@@ -33,4 +33,4 @@
val OnScrollContainerElevation = ElevationTokens.Level2
val TrailingIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val TrailingIconSize = 24.0.dp
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TypographyKeyTokens.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TypographyKeyTokens.kt
index 848d7a2..0e58763 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TypographyKeyTokens.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/TypographyKeyTokens.kt
@@ -34,4 +34,4 @@
TitleLarge,
TitleMedium,
TitleSmall,
-}
\ No newline at end of file
+}
diff --git a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.desktop.kt b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.desktop.kt
index 3e06cac..27a88a5 100644
--- a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.desktop.kt
+++ b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/DefaultPlatformTextStyle.desktop.kt
@@ -18,4 +18,4 @@
import androidx.compose.ui.text.PlatformTextStyle
-internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = null
\ No newline at end of file
+internal actual fun defaultPlatformTextStyle(): PlatformTextStyle? = null
diff --git a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.desktop.kt b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.desktop.kt
index 31ecb1e..27e6c24 100644
--- a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.desktop.kt
+++ b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/IncludeFontPaddingHelper.desktop.kt
@@ -23,4 +23,4 @@
internal actual fun copyAndSetFontPadding(
style: TextStyle,
includeFontPadding: Boolean
-): TextStyle = style
\ No newline at end of file
+): TextStyle = style
diff --git a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.desktop.kt b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.desktop.kt
index c48c446..87b5e0d 100644
--- a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.desktop.kt
+++ b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/SystemBarsDefaultInsets.desktop.kt
@@ -22,4 +22,4 @@
internal actual val WindowInsets.Companion.systemBarsForVisualComponents: WindowInsets
@Composable
- get() = WindowInsets(0.dp, 0.dp, 0.dp, 0.dp)
\ No newline at end of file
+ get() = WindowInsets(0.dp, 0.dp, 0.dp, 0.dp)
diff --git a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/TooltipPopup.desktop.kt b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/TooltipPopup.desktop.kt
index 51ffed0..cd83c7c 100644
--- a/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/TooltipPopup.desktop.kt
+++ b/compose/material3/material3/src/desktopMain/kotlin/androidx/compose/material3/TooltipPopup.desktop.kt
@@ -31,4 +31,4 @@
popupPositionProvider = popupPositionProvider,
onDismissRequest = onDismissRequest,
content = content
-)
\ No newline at end of file
+)
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt
index 06d4a03..f225ede 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt
@@ -179,4 +179,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetector.kt
index ed2aafe2..f82045e 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetector.kt
@@ -49,6 +49,10 @@
return listOf("androidx.compose.runtime.snapshots.AutoboxingStateValueProperty")
}
+ override fun isApplicableAnnotationUsage(type: AnnotationUsageType): Boolean {
+ return type == AnnotationUsageType.FIELD_REFERENCE
+ }
+
override fun visitAnnotationUsage(
context: JavaContext,
usage: UElement,
@@ -61,10 +65,6 @@
allClassAnnotations: List<UAnnotation>,
allPackageAnnotations: List<UAnnotation>
) {
- if (type != AnnotationUsageType.FIELD_REFERENCE) {
- return
- }
-
val resolvedPropertyName = usage.identifier ?: "<unknown identifier>"
val preferredPropertyName = annotation.preferredPropertyName ?: "<unknown replacement>"
@@ -115,4 +115,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/ComposableFlowOperatorDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/ComposableFlowOperatorDetector.kt
index 024e954..bf2a594 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/ComposableFlowOperatorDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/ComposableFlowOperatorDetector.kt
@@ -118,4 +118,4 @@
private val FlowPackageName = Package("kotlinx.coroutines.flow")
private val FlowName = Name(FlowPackageName, "Flow")
-private val FlowClassifier = KmClassifier.Class(FlowName.kmClassName)
\ No newline at end of file
+private val FlowClassifier = KmClassifier.Class(FlowName.kmClassName)
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/MutableCollectionMutableStateDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/MutableCollectionMutableStateDetector.kt
index 4285eca..6d2d7f1 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/MutableCollectionMutableStateDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/MutableCollectionMutableStateDetector.kt
@@ -151,4 +151,4 @@
val descriptor = constructor.declarationDescriptor ?: return null
val packageName = descriptor.containingPackage()?.asString() ?: return null
return packageName + "." + descriptor.name.asString()
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetector.kt
index 70fd1cd..c950082 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetector.kt
@@ -250,4 +250,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt
index 35b6b07..1dffaac 100644
--- a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt
+++ b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt
@@ -502,4 +502,4 @@
override fun toString() = "type = $fqName"
}
}
-/* ktlint-enable max-line-length */
\ No newline at end of file
+/* ktlint-enable max-line-length */
diff --git a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetectorTest.kt b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetectorTest.kt
index 6f99bf7..5bac151 100644
--- a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetectorTest.kt
+++ b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateValuePropertyDetectorTest.kt
@@ -16,8 +16,9 @@
package androidx.compose.runtime.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.checks.infrastructure.TestFile
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Issue
import org.junit.Test
@@ -36,34 +37,31 @@
@Test
fun testReadAutoboxingPropertyAsVariableAssignment() {
lint().files(
- AutoboxingStateValuePropertyStub,
- StateWithAutoboxingPropertyStub,
- Stubs.SnapshotState,
kotlin(
"""
package androidx.compose.runtime.lint.test
- import androidx.compose.runtime.sandbox.MutableIntState
- import androidx.compose.runtime.getValue
- import androidx.compose.runtime.setValue
+ import androidx.compose.runtime.mutableIntStateOf
fun valueAssignment() {
- val state = MutableIntState()
+ val state = mutableIntStateOf(4)
val value = state.value
}
""".trimIndent()
- )
+ ),
+ AutoboxingStateValuePropertyStub,
+ MinimalSnapshotStateStub
).run().expect(
"""
-src/androidx/compose/runtime/lint/test/test.kt:9: Warning: Reading value will cause an autoboxing operation. Use intValue to avoid unnecessary allocations. [AutoboxingStateValueProperty]
+src/androidx/compose/runtime/lint/test/test.kt:7: Warning: Reading value will cause an autoboxing operation. Use intValue to avoid unnecessary allocations. [AutoboxingStateValueProperty]
val value = state.value
~~~~~
0 errors, 1 warnings
"""
).expectFixDiffs(
"""
-Fix for src/androidx/compose/runtime/lint/test/test.kt line 9: Replace with `intValue`:
-@@ -9 +9
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 7: Replace with `intValue`:
+@@ -7 +7
- val value = state.value
+ val value = state.intValue
"""
@@ -73,34 +71,31 @@
@Test
fun testTrivialAssignAutoboxingProperty() {
lint().files(
- AutoboxingStateValuePropertyStub,
- StateWithAutoboxingPropertyStub,
- Stubs.SnapshotState,
kotlin(
"""
package androidx.compose.runtime.lint.test
- import androidx.compose.runtime.sandbox.MutableIntState
- import androidx.compose.runtime.getValue
- import androidx.compose.runtime.setValue
+ import androidx.compose.runtime.mutableIntStateOf
fun valueAssignment() {
- val state = MutableIntState()
+ val state = mutableIntStateOf(0)
state.value = 42
}
""".trimIndent()
- )
+ ),
+ AutoboxingStateValuePropertyStub,
+ MinimalSnapshotStateStub
).run().expect(
"""
-src/androidx/compose/runtime/lint/test/test.kt:9: Warning: Assigning value will cause an autoboxing operation. Use intValue to avoid unnecessary allocations. [AutoboxingStateValueProperty]
+src/androidx/compose/runtime/lint/test/test.kt:7: Warning: Assigning value will cause an autoboxing operation. Use intValue to avoid unnecessary allocations. [AutoboxingStateValueProperty]
state.value = 42
~~~~~
0 errors, 1 warnings
"""
).expectFixDiffs(
"""
-Fix for src/androidx/compose/runtime/lint/test/test.kt line 9: Replace with `intValue`:
-@@ -9 +9
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 7: Replace with `intValue`:
+@@ -7 +7
- state.value = 42
+ state.intValue = 42
"""
@@ -108,54 +103,194 @@
}
companion object {
- private val StateWithAutoboxingPropertyStub = kotlin(
- """
- package androidx.compose.runtime.sandbox
-
- import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
-
- class MutableIntState {
-
- @AutoboxingStateValueProperty(
- preferredPropertyName = "intValue",
- delegatePackageDirective = "androidx.compose.runtime.sandbox"
- )
- var value: Int?
- get() = intValue
- set(value) = value?.let { intValue = it }
-
- var intValue: Int = 0
- }
-
- @Suppress("NOTHING_TO_INLINE")
- inline operator fun MutableIntState.getValue(
- thisObj: Any?,
- property: KProperty<*>
- ): Int = intValue
-
- @Suppress("NOTHING_TO_INLINE")
- inline operator fun MutableIntState.setValue(
- thisObj: Any?,
- property: KProperty<*>,
- value: Int
- ) {
- intValue = value
- }
- """
- )
-
- private val AutoboxingStateValuePropertyStub = kotlin(
- """
+ private val AutoboxingStateValuePropertyStub = bytecodeStub(
+ filename = "AutoboxingStateValueProperty.kt",
+ filepath = "androidx/compose/runtime/snapshots",
+ checksum = 0x2c564988,
+ source = """
package androidx.compose.runtime.snapshots
@Retention(AnnotationRetention.BINARY)
- @Target(AnnotationTarget.PROPERTY)
+ @Target(AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER)
annotation class AutoboxingStateValueProperty(
- val preferredPropertyName: String,
- val delegatePackageDirective: String
+ val preferredPropertyName: String
)
+ """,
"""
+ META-INF/main.kotlin_module:
+ H4sIAAAAAAAA/2NgYGBmYGBgBGIOBijg0uaSSMxLKcrPTKnQS87PLcgvTtUr
+ Ks0rycxNFeIPzkssKM7ILwkuSSxJ9S7h0uFSwqVYLyczr0SvJLW4RIgtBEh6
+ lygxaDEAAJG2tCtzAAAA
+ """,
+ """
+ androidx/compose/runtime/snapshots/AutoboxingStateValueProperty.class:
+ H4sIAAAAAAAA/6VSTXMSQRB9s3ytqGETEyXESBIjiRcXU960yiKKShUJ1O5W
+ qlIcrIEdccOyg7sDwo2b/8Of4cGicvRHWc4EAxyoePDS/ba7X/fr3vn1+8dP
+ AC9wSPCaBm7IPXdotni3xyNmhv1AeF1mRgHtRZ+5iMxSX/AmH3pB2xZUsDPq
+ 91k95D0WilEKhMC4oANq+jRom7XmBWuJFGIE+XmUBgGXVI8HZmkGU0gQbPRC
+ 9omFIXOvO57SLiNYP3xanfNtEcrpLwm2qx0ufC9Y7GgxwQKFZD4xUOIIDpbU
+ zScvMpLHldOSdU6QW0JxaNhmQlatUN/nX5k7DUQE+zcOmPEydatWL1vO+Ue7
+ 7DhlazHy/m9kp7r0UIsiC/8oqXPfa43U/m+qJdtWd1pKmOnaW54v+6wrOzqj
+ HlOnOSk7H2pvCVavlz1hgrpUUJnUuoOYfEREGV0ZEJCOjA899VWUyH1O8Goy
+ NtJaVktrxlZ6MpZuRTr98puWnYyPtCI51teShpbTijErM/WX35PJXFzXjLjq
+ cURQqv7nI5Vypbr8TSXPOoIgbfN+2GLvPF8+oU1rOuPMi7ymz+Y/NypIXYjL
+ jkm1tVSZgi6RhsKVfYID6b8ggVuyJs1wG3dwV8KVBjSGDAxlVrE2zd7DOjYU
+ bIAw3McDZCV1s4FYBbkKtip4iG0J8aiCPHZkVYRd7DWQiPA4wn6E1JXV/wB4
+ ImM31wMAAA==
+ """
+ )
+
+ private val MinimalSnapshotStateStub: TestFile = bytecodeStub(
+ filename = "SnapshotState.kt",
+ filepath = "androidx/compose/runtime",
+ checksum = 0x575bf828,
+ source = """
+ package androidx.compose.runtime
+
+ import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
+
+ fun mutableIntStateOf(initialValue: Int): MutableIntState =
+ throw UnsupportedOperationException("Stub!")
+
+ interface State<T> {
+ val value: T
+ }
+
+ interface MutableState<T> : State<T> {
+ override var value: T
+ }
+
+ interface IntState : State<Int> {
+ @get:AutoboxingStateValueProperty("intValue")
+ override val value: Int
+ get() = intValue
+
+ val intValue: Int
+ }
+
+ interface MutableIntState : IntState, MutableState<Int> {
+ @get:AutoboxingStateValueProperty("intValue")
+ @set:AutoboxingStateValueProperty("intValue")
+ override var value: Int
+ @Suppress("AutoBoxing") get() = intValue
+ set(value) { intValue = value }
+
+ override var intValue: Int
+ }
+ """,
+ """
+ META-INF/main.kotlin_module:
+ H4sIAAAAAAAA/2NgYGBmYGBgBGIOBijg0uaSSMxLKcrPTKnQS87PLcgvTtUr
+ Ks0rycxNFeIPzkssKM7ILwkuSSxJ9S7h0uFSwqVYLyczr0SvJLW4RIgtBEh6
+ lygxaDEAAJG2tCtzAAAA
+ """,
+ """
+ androidx/compose/runtime/IntState$DefaultImpls.class:
+ H4sIAAAAAAAA/4VTy27TQBQ9E7d1SAxpS1sIhUJpgKSgGiQWSF1FRUiWTFoR
+ lA2rSTJJJ7FnovE4Cn/FEljwAXwU4tpJKVBQFnMfZ+6c+7K///j6DcBLPGM4
+ 4qpvtOzP/J6OJzoRvkmVlbHwA2XblltRey0GPI1sEE+ixAVjWB/xKfcjrob+
+ aXcketaFw1AcCtvhUSoYXtXDpbTHjfCShkAxFOaYofn/l4nik+Rc28RvplZ3
+ 9UyqYU6VZz0zeiKM/Ugc2xMjBsIY0b8AWzymsopSXVR4EGoz9EfCdg2XKvG5
+ UpqopCa7pW0rjSIi2l/ahYsyQ5k6D35RO/VG4OE6bpThocKwcaVNFxsM7jQL
+ Px0w7NSDf83Cw01slbCJbYbVmj2XSVb28rlSxnCsbSSV/1ZY3ueWE1aIpw7t
+ nGWimAkwsHFm0OoKM5lZzxm835dNm24vZp5TH40tw8qJ7lOXlVAq0UrjrjDv
+ eTciZDPUPR51uJGZvwB3383LC9RUJpKg5uWgGWp/355xQ5uywvwR5gVKCXMS
+ 8SQR5JbaOjU98UZmCaoLis4VerxAASuYt3oNq1iDg1r+3VPrpEuHX7DO8Bk7
+ n8gr4BHJtfxmC49JevMo3MJt0k/oVCiK/gAUEyIsEVCn42ZsmeOgkcfTPOnt
+ Q1RxmPMe4CnpPcKrFHPnA5wAuwHuBriHvQD38SDA/k8Blj2alAMAAA==
+ """,
+ """
+ androidx/compose/runtime/IntState.class:
+ H4sIAAAAAAAA/4WS304TQRTGv9n+2xaEpYJCUQRBLTdsJV6YYEyIBrNJraRN
+ kISraTutW7YzzcxsU+94Ch/ACx/CC0O49KGMZ1tQomIvZuacM+f7zZmZ8/3H
+ 128AnqHMsMFlW6uwPfJbqj9QRvg6ljbsCz+QtmG5FTkwhjfVHh9yP+Ky679r
+ 9kTL7lVvVI5lL64pCCW6Qu+93GPw/gTlkGZY+z8shyyD2xX2iEexYFgqb/8D
+ z7B/c1FG8oH5oKzx92OrmmoUyu6YPUYeajUQ2n4kxtJAi47QWrSvgjXepzPd
+ UF4dv1lVuuv3hG1qHkrjcykVoUJFdk3ZWhxFBJqheoNfmlR5O2BYqJ4qG4XS
+ fyssb3PLKc/pD1P0HSyZ3GQCAzul+ChMvApZ7acMh+dnXsFZdibDcwuOm3U7
+ y+dnu24xXXQqToXVi16qRNbxxZf0xedstpR2016mvuhlk+jz98cXn67iOc9N
+ uLvJZaa2ABW5PuW7KYXKzgwnl92Zitx6LTo8jmzQH0QmhwcMs9cj1CeNyw8b
+ p++cWobV+gQSyGFowmYk9n+/O+kDKYV+FXFjBLn5RtiV3Maayik0VKxb4iCM
+ yFm5pBz9xaAec5Cha+To2R3qShd58jbJm6edAtkzBrO4haRl5yhIBrZoTrbW
+ KWUDK3iUiJHC4/H6EE9oPaB9j9ALJ0gFKAa4HWARS2TiToC7WD4BM6QtnSBv
+ sGpwz+A+HWUwZzBvsGbgGuR/AkgwZTK5AwAA
+ """,
+ """
+ androidx/compose/runtime/MutableIntState$DefaultImpls.class:
+ H4sIAAAAAAAA/5VT205TQRRd0wKF9igXBUUEVKq2VXu84BMmpsGYTFIKEdMX
+ n6btUAZOZ5o5cxr8K30TH/wAP8q457RcBE3wYe4ra+21956fv77/ALCOdYbX
+ QnesUZ2jsG16fRPL0CbaqZ4MtxInWpHk2u064WTxndwTSeR4rx/FOTCGmQMx
+ EGEkdDfcbh3ItsshyzDZla4pokQyvC3Vr8q+Ua6fsdGl7Eq7wVD7N0GsRT/e
+ Ny4Oa4kzLXOkdDelSsV3rOlL6z4Tx3zfyj1preycXDZEj6KbVPok0LW6sd3w
+ QLqWFUrHodDaEJUytG8Y10iiiIhKVzWTQ4GhQHngpwrZUpkHuIbrBQSYZpi9
+ 5DaHWYbcwMO39xgWSvxvKQlwAzfzmMM8w3jR7auYoXL1LJPr+LQ81f8oDy83
+ yVJ83tIYRdgMsIS73tMyxTMYPjBO/uqHxkVKh1vSiY5wgqQzvUGW2o75adJP
+ IOyh31DbZI6U3z1nCM43GnXZ7qjQaSDVQ0fKm6ZDOtN1pWUj6bWk/eiDZZir
+ m7aImsIqfx5dLn0YeuJ6oGJFV7Wz6jIUL77uCEvt4aT9AxZwraXdjEQcSzrm
+ d01i2/K98gKLI4rmJXq8QAZj3imtUxjHBLJ4mn49sk5rvnKMGYZvWPiSYp7R
+ PJG+LKNKczBE4RZu0xrSmCYU/T6qIxHmfcZo5DybP0xhEXdGGm8ImfGpriwd
+ YyWDrxcUVlKFhSFmpOB3q7hH716rQOuplteZyox0qGTkzUdGlaMoK6T7MuV/
+ glcpN8N9wjz4hCzHGkeR4yEecTxGiaP8GxKjsqaBBAAA
+ """,
+ """
+ androidx/compose/runtime/MutableIntState.class:
+ H4sIAAAAAAAA/41T3U4TQRg9sy3d7VJxKaAF/ONPWlS2NpqYYIxEY7JJqaZN
+ gISrKR3qwna27sw2eMdT+ABe+BBeGMKlD2X8trRAVISLmfl+zpzzzcw3P399
+ /wHgGVYZily2otBvHbq7YacbKuFGsdR+R7gbsebNQHhSNzTXwgRj+FTd5z3u
+ Bly23ffNfbGr16qXEgx3/gcy0OjDXl7gpq2iLaK1V2sMzp+SJtIMc1fKmsgw
+ LF1L2oTFYLWF3uRBLBimiqV/FMOwfvlJlORd9THUyl2PddgMD33Z7nP3KT9E
+ YVdE+jNxTHUjsSeiSLSGwRrvkKbly6H8QjWM2u6+0M2I+1K5XMqQqPyQ7Fqo
+ a3EQEJGlzupNF73SJsMoncA7Y0kVSx7F1MXYePUg1IEv3Q2heYtrTjxGp5ei
+ bmDJZCUTGNgBxQ/9xCuT1XrKII+PJm2jYJwPx7INK2vtFY6PKkaZVax8Om+U
+ U2WjXnDSM2Rtn3wbO/mayc2krREnM5+2TMeqLzrZJFfJnK4vtl5vbZ98GeJs
+ Z5RwOcdKVCsMK1f2zlmXJfd2dS8yLF+vHQlJFzHSO72459ctY/Gt2ONxoL1O
+ N1AmlhhyFyPUzo1Bp/ThqweaYbZ+yuXJnq98Ils/f3Da70kpojcBV0qQm234
+ bcl1HFFVdiOMo13xzg/ImR6wbP7FQf/AwAgNE1l60TR9HxujdLoSeTcpniP7
+ hsIYOcnfcjA+SCagYZISeUz0AZMEIAMrNNuUfkgcy5jGI/INpPC4vxbxhNY6
+ 5adI/dYOUh5ueyh4hJwhE7Me7uDuDpjCPdzfSVQeKMwpzCsskKJCXmFCYVJh
+ XGFRwVbUz3B+A5uahrjABAAA
+ """,
+ """
+ androidx/compose/runtime/MutableState.class:
+ H4sIAAAAAAAA/4VR0WoTURA9c3eT3aQxbmOradRaBTHxwa3FBzGlIKIYSBCa
+ EIQ83SZrvM1mt+TeDX3cb/HBj/BBlj76UeJsKkUM1Zc7c+aeOTOc+fHz23cA
+ L/CQ8FhGk0WsJuf+OJ6fxTrwF0lk1Dzwe4mRJ2HQN9IEDojQOxy86p7KpfRD
+ GU39Dyenwdi0j9ZL3Ws1V2KHg0H7qE3w/m50YBN2/93soEhwp4EZyjAJCFvN
+ 1voChEKzxVOYqa+Y2811YmtIKDaZmSeb3VlsQhX5vcDIiTSS+8V8abFVlD9u
+ /oBAM66fqxztczZ5TnibpdWyqItylq6CcAvup3qWPrXdLPXowK3ZNfGe9sVx
+ 3bMa4mWWfrz4Wr34Uqw0bNf2Co9st+g5udgB4cn1/v15E96OBoS9/7idm7G8
+ dMDrR/JMf47N6uPZzBBKfTWNpEkW/F3ux8liHLxTIYOd40uRodKKJ76Oopib
+ VBxp9l+gwD44bIDgi7koMdrNEcqMN1C5wjdg/c4sPFjF+9jj+IYZVVa5OYLV
+ gdfBZgc13OIUWx1s4/YIpHEH9RGfEDsaDY27Gvd0DksaGxqVX4ySaL/HAgAA
+ """,
+ """
+ androidx/compose/runtime/SnapshotStateKt.class:
+ H4sIAAAAAAAA/5WSXW/TMBSGX6efC2XLCoO142sbsA4Jsk1IXAwhIQRSRNZK
+ C1RCvXIbU9ymdpQ4VS/7r5BAgl7zoxB2WqmaEBfcvOf4PY+P7ZP8+v3tB4Dn
+ OCJoUREmkoczdyAnsUyZm2RC8QlzA0Hj9ItUgaKKvVcVEAJnRKfUjagYup3+
+ iA20WyDYnmSK9iPmiSXc+UzwtOUd+//sfXF1wznBoS+ToTtiqp9QLlKXCiF1
+ iUudt6VqZ1GkqaP1+R9FmsWxTBQLOzFLcvTtbMBik1RQJSgFKuvvV2ETlF9y
+ wdUrgp2Wv24RqISL4flxt4YartvYwCZBzZCcRl0aZYyAePp9/liqiAv3gika
+ UkX1TazJtKBnSIxUjUCzY5NYujjjJjvRWXhKcLCY1+zF3LZ2rTw41eams5g3
+ rRNyVnYsHQuGPCN48j8j0yc6Vz7Ss7EiKL6Rob73ls8Fa2eTPks+mH0EdV8O
+ zLMSbtYrc+9y2d4TU55ybb1ez53ADmSWDNg7btDGCu3+BeIUFopYDqGBEsp6
+ vZ//YQXtAPZ3bHyqX/uKrZ9mQDjQWs4rFRxqrS0pONjW8eGqWsnZR7k+wGMd
+ X2i3rvvf6KHg4aaHHQ+3cNvDLhoemtjrgaS4g7s9FFOUUtxL4aS4/wetLc8s
+ 8QIAAA==
+ """,
+ """
+ androidx/compose/runtime/State.class:
+ H4sIAAAAAAAA/31Qy0rDQBQ9k6RpjK/4bquIy+rCVHEhvsCNUKgItojQ1diO
+ dWw6KZ1pcZlvceFHuJDg0o8Sb1pXKm7uvefce+7r4/P1DcABNhg2uWoPYtl+
+ Cltxrx9rEQ6GysieCOuGG5EHYyifNI5qj3zEw4irTnh19yha5vjsN8UQ/OTy
+ cBi8jjA3PBoKhuXy9l+6XHm70SC/UOvGJpIqvBSGt7nhxFm9kU3rssx4mQED
+ 6xL/JDNUoai9x3CUJnO+VbD8NPGtIDOe7d0X0mTH8dIkYPtWxbpeDOySdZgm
+ t+8vzvuz65YczwlyWYd9hq3a/8+gXViDZeNzo8k1QV3xvn6IzTi/2zUMU3XZ
+ UdwMB5T26/Fw0BIXMiJQvJ70upFa3kXiXKmYRDJW2qX5yGF8GX3LBX0dRUIW
+ PNjfkY3S2BewTv6UKqZI4zdhVzFdxUwVs5ijEPNVBFhogmksYqkJV2NZY0Vj
+ VWNNZzD/Bf5sje8BAgAA
+ """
)
}
}
-/* ktlint-enable max-line-length */
\ No newline at end of file
+/* ktlint-enable max-line-length */
diff --git a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetectorTest.kt b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetectorTest.kt
index 597189a..74d6264 100644
--- a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetectorTest.kt
+++ b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/OpaqueUnitKeyDetectorTest.kt
@@ -1741,4 +1741,4 @@
// endregion key() test cases
}
-/* ktlint-enable max-line-length */
\ No newline at end of file
+/* ktlint-enable max-line-length */
diff --git a/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/CompletableAdapterTest.kt b/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/CompletableAdapterTest.kt
index 0f13eb7..116819d 100644
--- a/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/CompletableAdapterTest.kt
+++ b/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/CompletableAdapterTest.kt
@@ -94,4 +94,4 @@
completed = true
emitters.forEach { if (!it.isDisposed) it.onComplete() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/RxJava2AdapterTest.kt b/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/RxJava2AdapterTest.kt
index 103ff3b..0c19acb 100644
--- a/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/RxJava2AdapterTest.kt
+++ b/compose/runtime/runtime-rxjava2/src/androidTest/java/androidx/compose/runtime/rxjava2/RxJava2AdapterTest.kt
@@ -287,4 +287,4 @@
}
override fun toString() = "Maybe"
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/CompletableAdapterTest.kt b/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/CompletableAdapterTest.kt
index 0d5ce57..55f3a40 100644
--- a/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/CompletableAdapterTest.kt
+++ b/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/CompletableAdapterTest.kt
@@ -94,4 +94,4 @@
completed = true
emitters.forEach { if (!it.isDisposed) it.onComplete() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/RxJava3AdapterTest.kt b/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/RxJava3AdapterTest.kt
index dc8cf51..5ad2315 100644
--- a/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/RxJava3AdapterTest.kt
+++ b/compose/runtime/runtime-rxjava3/src/androidTest/java/androidx/compose/runtime/rxjava3/RxJava3AdapterTest.kt
@@ -287,4 +287,4 @@
}
override fun toString() = "Maybe"
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-rxjava3/src/main/java/androidx/compose/runtime/rxjava3/RxJava3Adapter.kt b/compose/runtime/runtime-rxjava3/src/main/java/androidx/compose/runtime/rxjava3/RxJava3Adapter.kt
index c4c31a5..0736da3 100644
--- a/compose/runtime/runtime-rxjava3/src/main/java/androidx/compose/runtime/rxjava3/RxJava3Adapter.kt
+++ b/compose/runtime/runtime-rxjava3/src/main/java/androidx/compose/runtime/rxjava3/RxJava3Adapter.kt
@@ -142,4 +142,4 @@
onDispose { disposable.dispose() }
}
return state
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/RememberSaveableSamples.kt b/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/RememberSaveableSamples.kt
index 5b4a546..0e741ce 100644
--- a/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/RememberSaveableSamples.kt
+++ b/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/RememberSaveableSamples.kt
@@ -55,4 +55,4 @@
private val HolderSaver = Saver<Holder, Int>(
save = { it.value },
restore = { Holder(it) }
-)
\ No newline at end of file
+)
diff --git a/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/SaveableStateHolderSamples.kt b/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/SaveableStateHolderSamples.kt
index d3bdb3b..cd7caaa 100644
--- a/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/SaveableStateHolderSamples.kt
+++ b/compose/runtime/runtime-saveable/samples/src/main/java/androidx/compose/runtime/saveable/samples/SaveableStateHolderSamples.kt
@@ -101,4 +101,4 @@
) {
content()
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt b/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
index ceffeeb..4babdd8 100644
--- a/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
+++ b/compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/RememberSaveableTest.kt
@@ -462,4 +462,4 @@
}
private open class DelegateRegistry(original: SaveableStateRegistry) :
- SaveableStateRegistry by original
\ No newline at end of file
+ SaveableStateRegistry by original
diff --git a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
index a2c50c1..b7818d3 100644
--- a/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
+++ b/compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
@@ -17,15 +17,15 @@
package androidx.compose.runtime.saveable
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.MutableState
+import androidx.compose.runtime.RememberObserver
+import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.SnapshotMutationPolicy
import androidx.compose.runtime.currentCompositeKeyHash
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.neverEqualPolicy
import androidx.compose.runtime.referentialEqualityPolicy
import androidx.compose.runtime.remember
-import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.snapshots.SnapshotMutableState
import androidx.compose.runtime.structuralEqualityPolicy
@@ -69,46 +69,32 @@
key: String? = null,
init: () -> T
): T {
+ val compositeKey = currentCompositeKeyHash
// key is the one provided by the user or the one generated by the compose runtime
val finalKey = if (!key.isNullOrEmpty()) {
key
} else {
- currentCompositeKeyHash.toString(MaxSupportedRadix)
+ compositeKey.toString(MaxSupportedRadix)
}
@Suppress("UNCHECKED_CAST")
(saver as Saver<T, Any>)
val registry = LocalSaveableStateRegistry.current
- // value is restored using the registry or created via [init] lambda
- val value = remember(*inputs) {
- // TODO not restore when the input values changed (use hashKeys?) b/152014032
+
+ val holder = remember {
+ // value is restored using the registry or created via [init] lambda
val restored = registry?.consumeRestored(finalKey)?.let {
saver.restore(it)
}
- restored ?: init()
+ val finalValue = restored ?: init()
+ SaveableHolder(saver, registry, finalKey, finalValue, inputs)
}
- // re-register if the registry or key has been changed
- if (registry != null) {
- // we want to use the latest instances of saver and value in the valueProvider lambda
- // without restarting DisposableEffect as it would cause re-registering the provider in
- // the different order. so we use rememberUpdatedState.
- val saverState = rememberUpdatedState(saver)
- val valueState = rememberUpdatedState(value)
-
- DisposableEffect(registry, finalKey) {
- val valueProvider = {
- with(saverState.value) {
- SaverScope { registry.canBeSaved(it) }.save(valueState.value)
- }
- }
- registry.requireCanBeSaved(valueProvider())
- val entry = registry.registerProvider(finalKey, valueProvider)
- onDispose {
- entry.unregister()
- }
- }
+ val value = holder.getValueIfInputsDidntChange(inputs) ?: init()
+ SideEffect {
+ holder.update(saver, registry, finalKey, value, inputs)
}
+
return value
}
@@ -146,6 +132,83 @@
init = init
)
+private class SaveableHolder<T>(
+ private var saver: Saver<T, Any>,
+ private var registry: SaveableStateRegistry?,
+ private var key: String,
+ private var value: T,
+ private var inputs: Array<out Any?>
+) : () -> Any?, SaverScope, RememberObserver {
+ private var entry: SaveableStateRegistry.Entry? = null
+
+ fun update(
+ saver: Saver<T, Any>,
+ registry: SaveableStateRegistry?,
+ key: String,
+ value: T,
+ inputs: Array<out Any?>
+ ) {
+ var entryIsOutdated = false
+ if (this.registry !== registry) {
+ this.registry = registry
+ entryIsOutdated = true
+ }
+ if (this.key != key) {
+ this.key = key
+ entryIsOutdated = true
+ }
+ this.saver = saver
+ this.value = value
+ this.inputs = inputs
+ if (entry != null && entryIsOutdated) {
+ entry?.unregister()
+ entry = null
+ register()
+ }
+ }
+
+ private fun register() {
+ val registry = registry
+ require(entry == null) { "entry($entry) is not null" }
+ if (registry != null) {
+ registry.requireCanBeSaved(invoke())
+ entry = registry.registerProvider(key, this)
+ }
+ }
+
+ /**
+ * Value provider called by the registry.
+ */
+ override fun invoke(): Any? = with(saver) {
+ save(requireNotNull(value) { "Value should be initialized" })
+ }
+
+ override fun canBeSaved(value: Any): Boolean {
+ val registry = registry
+ return registry == null || registry.canBeSaved(value)
+ }
+
+ override fun onRemembered() {
+ register()
+ }
+
+ override fun onForgotten() {
+ entry?.unregister()
+ }
+
+ override fun onAbandoned() {
+ entry?.unregister()
+ }
+
+ fun getValueIfInputsDidntChange(inputs: Array<out Any?>): T? {
+ return if (inputs.contentEquals(this.inputs)) {
+ value
+ } else {
+ null
+ }
+ }
+}
+
@Suppress("UNCHECKED_CAST")
private fun <T> mutableStateSaver(inner: Saver<T, out Any>) = with(inner as Saver<T, Any>) {
Saver<MutableState<T>, MutableState<Any?>>(
diff --git a/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/AutoSaverTest.kt b/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/AutoSaverTest.kt
index a14d78f..58f56ff 100644
--- a/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/AutoSaverTest.kt
+++ b/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/AutoSaverTest.kt
@@ -41,4 +41,4 @@
val disallowingScope = object : SaverScope {
override fun canBeSaved(value: Any) = false
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/MapSaverTest.kt b/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/MapSaverTest.kt
index 375b6b9..10621d5 100644
--- a/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/MapSaverTest.kt
+++ b/compose/runtime/runtime-saveable/src/test/java/androidx/compose/runtime/saveable/MapSaverTest.kt
@@ -98,4 +98,4 @@
save = { mapOf(nameKey to it?.name, ageKey to it?.age) },
restore = { NullableUser(it[nameKey] as String?, it[ageKey] as Int?) }
)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/api/current.txt b/compose/runtime/runtime/api/current.txt
index d5eb7cf..5fdddbb 100644
--- a/compose/runtime/runtime/api/current.txt
+++ b/compose/runtime/runtime/api/current.txt
@@ -217,7 +217,6 @@
method @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeApi @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent, kotlin.coroutines.CoroutineContext recomposeCoroutineContext);
method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeApi public static kotlin.coroutines.CoroutineContext getRecomposeCoroutineContext(androidx.compose.runtime.ControlledComposition);
- method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.CompositionObserverHandle observe(androidx.compose.runtime.Composition, androidx.compose.runtime.CompositionObserver observer);
}
@androidx.compose.runtime.Stable public abstract sealed class CompositionLocal<T> {
@@ -246,13 +245,11 @@
property public final androidx.compose.runtime.CompositionLocalMap Empty;
}
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserver {
- method public void onBeginComposition(androidx.compose.runtime.Composition composition, java.util.Map<androidx.compose.runtime.RecomposeScope,? extends java.util.Set<?>> invalidationMap);
- method public void onEndComposition(androidx.compose.runtime.Composition composition);
+ public interface CompositionServiceKey<T> {
}
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserverHandle {
- method public void dispose();
+ public interface CompositionServices {
+ method public <T> T? getCompositionService(androidx.compose.runtime.CompositionServiceKey<T> key);
}
@SuppressCompatibility @androidx.compose.runtime.InternalComposeTracingApi public interface CompositionTracer {
@@ -297,7 +294,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface DoubleState extends androidx.compose.runtime.State<java.lang.Double> {
method public double getDoubleValue();
- method public default Double getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double getValue();
property public abstract double doubleValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double value;
}
@@ -313,7 +310,7 @@
method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ExplicitGroupsComposable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
}
@@ -328,7 +325,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface FloatState extends androidx.compose.runtime.State<java.lang.Float> {
method public float getFloatValue();
- method public default Float getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float getValue();
property public abstract float floatValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float value;
}
@@ -338,7 +335,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface IntState extends androidx.compose.runtime.State<java.lang.Integer> {
method public int getIntValue();
- method public default Integer getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer getValue();
property public abstract int intValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer value;
}
@@ -351,7 +348,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LongState extends androidx.compose.runtime.State<java.lang.Long> {
method public long getLongValue();
- method public default Long getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long getValue();
property public abstract long longValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long value;
}
@@ -399,28 +396,28 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableDoubleState extends androidx.compose.runtime.DoubleState androidx.compose.runtime.MutableState<java.lang.Double> {
method public void setDoubleValue(double);
- method public default void setValue(double);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default void setValue(double);
property public abstract double doubleValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableFloatState extends androidx.compose.runtime.FloatState androidx.compose.runtime.MutableState<java.lang.Float> {
method public void setFloatValue(float);
- method public default void setValue(float);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default void setValue(float);
property public abstract float floatValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableIntState extends androidx.compose.runtime.IntState androidx.compose.runtime.MutableState<java.lang.Integer> {
method public void setIntValue(int);
- method public default void setValue(int);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default void setValue(int);
property public abstract int intValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableLongState extends androidx.compose.runtime.LongState androidx.compose.runtime.MutableState<java.lang.Long> {
method public void setLongValue(long);
- method public default void setValue(long);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default void setValue(long);
property public abstract long longValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long value;
}
@@ -472,16 +469,6 @@
method public void invalidate();
}
- public final class RecomposeScopeImplKt {
- method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.CompositionObserverHandle observe(androidx.compose.runtime.RecomposeScope, androidx.compose.runtime.RecomposeScopeObserver observer);
- }
-
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface RecomposeScopeObserver {
- method public void onBeginScopeComposition(androidx.compose.runtime.RecomposeScope scope);
- method public void onEndScopeComposition(androidx.compose.runtime.RecomposeScope scope);
- method public void onScopeDisposed(androidx.compose.runtime.RecomposeScope scope);
- }
-
public final class Recomposer extends androidx.compose.runtime.CompositionContext {
ctor public Recomposer(kotlin.coroutines.CoroutineContext effectCoroutineContext);
method public androidx.compose.runtime.RecomposerInfo asRecomposerInfo();
@@ -816,7 +803,7 @@
package androidx.compose.runtime.snapshots {
- @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.PROPERTY) public @interface AutoboxingStateValueProperty {
+ @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.PROPERTY_SETTER, kotlin.annotation.AnnotationTarget.PROPERTY_GETTER}) public @interface AutoboxingStateValueProperty {
method public abstract String preferredPropertyName();
property public abstract String preferredPropertyName;
}
@@ -1038,10 +1025,30 @@
property public abstract String? sourceInfo;
}
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserver {
+ method public void onBeginComposition(androidx.compose.runtime.Composition composition, java.util.Map<androidx.compose.runtime.RecomposeScope,? extends java.util.Set<?>> invalidationMap);
+ method public void onEndComposition(androidx.compose.runtime.Composition composition);
+ }
+
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserverHandle {
+ method public void dispose();
+ }
+
+ public final class CompositionObserverKt {
+ method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.tooling.CompositionObserverHandle? observe(androidx.compose.runtime.Composition, androidx.compose.runtime.tooling.CompositionObserver observer);
+ method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.tooling.CompositionObserverHandle observe(androidx.compose.runtime.RecomposeScope, androidx.compose.runtime.tooling.RecomposeScopeObserver observer);
+ }
+
public final class InspectionTablesKt {
method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> getLocalInspectionTables();
property public static final androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> LocalInspectionTables;
}
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface RecomposeScopeObserver {
+ method public void onBeginScopeComposition(androidx.compose.runtime.RecomposeScope scope);
+ method public void onEndScopeComposition(androidx.compose.runtime.RecomposeScope scope);
+ method public void onScopeDisposed(androidx.compose.runtime.RecomposeScope scope);
+ }
+
}
diff --git a/compose/runtime/runtime/api/restricted_current.txt b/compose/runtime/runtime/api/restricted_current.txt
index a019eae..4a0f6ac 100644
--- a/compose/runtime/runtime/api/restricted_current.txt
+++ b/compose/runtime/runtime/api/restricted_current.txt
@@ -235,7 +235,6 @@
method @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent);
method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeApi @org.jetbrains.annotations.TestOnly public static androidx.compose.runtime.ControlledComposition ControlledComposition(androidx.compose.runtime.Applier<?> applier, androidx.compose.runtime.CompositionContext parent, kotlin.coroutines.CoroutineContext recomposeCoroutineContext);
method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeApi public static kotlin.coroutines.CoroutineContext getRecomposeCoroutineContext(androidx.compose.runtime.ControlledComposition);
- method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.CompositionObserverHandle observe(androidx.compose.runtime.Composition, androidx.compose.runtime.CompositionObserver observer);
}
@androidx.compose.runtime.Stable public abstract sealed class CompositionLocal<T> {
@@ -264,15 +263,6 @@
property public final androidx.compose.runtime.CompositionLocalMap Empty;
}
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserver {
- method public void onBeginComposition(androidx.compose.runtime.Composition composition, java.util.Map<androidx.compose.runtime.RecomposeScope,? extends java.util.Set<?>> invalidationMap);
- method public void onEndComposition(androidx.compose.runtime.Composition composition);
- }
-
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserverHandle {
- method public void dispose();
- }
-
@kotlin.PublishedApi internal final class CompositionScopedCoroutineScopeCanceller implements androidx.compose.runtime.RememberObserver {
ctor public CompositionScopedCoroutineScopeCanceller(kotlinx.coroutines.CoroutineScope coroutineScope);
method public kotlinx.coroutines.CoroutineScope getCoroutineScope();
@@ -282,6 +272,13 @@
property public final kotlinx.coroutines.CoroutineScope coroutineScope;
}
+ public interface CompositionServiceKey<T> {
+ }
+
+ public interface CompositionServices {
+ method public <T> T? getCompositionService(androidx.compose.runtime.CompositionServiceKey<T> key);
+ }
+
@SuppressCompatibility @androidx.compose.runtime.InternalComposeTracingApi public interface CompositionTracer {
method public boolean isTraceInProgress();
method public void traceEventEnd();
@@ -324,7 +321,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface DoubleState extends androidx.compose.runtime.State<java.lang.Double> {
method public double getDoubleValue();
- method public default Double getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double getValue();
property public abstract double doubleValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double value;
}
@@ -340,7 +337,7 @@
method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object? key1, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void LaunchedEffect(Object![]? keys, kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
method @Deprecated @androidx.compose.runtime.Composable public static void LaunchedEffect(kotlin.jvm.functions.Function2<? super kotlinx.coroutines.CoroutineScope,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> block);
- method @androidx.compose.runtime.Composable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
+ method @androidx.compose.runtime.Composable @androidx.compose.runtime.ExplicitGroupsComposable @androidx.compose.runtime.NonRestartableComposable public static void SideEffect(kotlin.jvm.functions.Function0<kotlin.Unit> effect);
method @kotlin.PublishedApi internal static kotlinx.coroutines.CoroutineScope createCompositionCoroutineScope(kotlin.coroutines.CoroutineContext coroutineContext, androidx.compose.runtime.Composer composer);
method @androidx.compose.runtime.Composable public static inline kotlinx.coroutines.CoroutineScope rememberCoroutineScope(optional kotlin.jvm.functions.Function0<? extends kotlin.coroutines.CoroutineContext> getContext);
}
@@ -360,7 +357,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface FloatState extends androidx.compose.runtime.State<java.lang.Float> {
method public float getFloatValue();
- method public default Float getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float getValue();
property public abstract float floatValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float value;
}
@@ -370,7 +367,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface IntState extends androidx.compose.runtime.State<java.lang.Integer> {
method public int getIntValue();
- method public default Integer getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer getValue();
property public abstract int intValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer value;
}
@@ -383,7 +380,7 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface LongState extends androidx.compose.runtime.State<java.lang.Long> {
method public long getLongValue();
- method public default Long getValue();
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long getValue();
property public abstract long longValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long value;
}
@@ -431,28 +428,28 @@
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableDoubleState extends androidx.compose.runtime.DoubleState androidx.compose.runtime.MutableState<java.lang.Double> {
method public void setDoubleValue(double);
- method public default void setValue(double);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default void setValue(double);
property public abstract double doubleValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="doubleValue") public default Double value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableFloatState extends androidx.compose.runtime.FloatState androidx.compose.runtime.MutableState<java.lang.Float> {
method public void setFloatValue(float);
- method public default void setValue(float);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default void setValue(float);
property public abstract float floatValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="floatValue") public default Float value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableIntState extends androidx.compose.runtime.IntState androidx.compose.runtime.MutableState<java.lang.Integer> {
method public void setIntValue(int);
- method public default void setValue(int);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default void setValue(int);
property public abstract int intValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="intValue") public default Integer value;
}
@androidx.compose.runtime.Stable @kotlin.jvm.JvmDefaultWithCompatibility public interface MutableLongState extends androidx.compose.runtime.LongState androidx.compose.runtime.MutableState<java.lang.Long> {
method public void setLongValue(long);
- method public default void setValue(long);
+ method @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default void setValue(long);
property public abstract long longValue;
property @androidx.compose.runtime.snapshots.AutoboxingStateValueProperty(preferredPropertyName="longValue") public default Long value;
}
@@ -505,16 +502,9 @@
}
public final class RecomposeScopeImplKt {
- method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.CompositionObserverHandle observe(androidx.compose.runtime.RecomposeScope, androidx.compose.runtime.RecomposeScopeObserver observer);
method @kotlin.PublishedApi internal static int updateChangedFlags(int flags);
}
- @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface RecomposeScopeObserver {
- method public void onBeginScopeComposition(androidx.compose.runtime.RecomposeScope scope);
- method public void onEndScopeComposition(androidx.compose.runtime.RecomposeScope scope);
- method public void onScopeDisposed(androidx.compose.runtime.RecomposeScope scope);
- }
-
public final class Recomposer extends androidx.compose.runtime.CompositionContext {
ctor public Recomposer(kotlin.coroutines.CoroutineContext effectCoroutineContext);
method public androidx.compose.runtime.RecomposerInfo asRecomposerInfo();
@@ -851,7 +841,7 @@
package androidx.compose.runtime.snapshots {
- @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.PROPERTY) public @interface AutoboxingStateValueProperty {
+ @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.PROPERTY_SETTER, kotlin.annotation.AnnotationTarget.PROPERTY_GETTER}) public @interface AutoboxingStateValueProperty {
method public abstract String preferredPropertyName();
property public abstract String preferredPropertyName;
}
@@ -1085,10 +1075,30 @@
property public abstract String? sourceInfo;
}
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserver {
+ method public void onBeginComposition(androidx.compose.runtime.Composition composition, java.util.Map<androidx.compose.runtime.RecomposeScope,? extends java.util.Set<?>> invalidationMap);
+ method public void onEndComposition(androidx.compose.runtime.Composition composition);
+ }
+
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface CompositionObserverHandle {
+ method public void dispose();
+ }
+
+ public final class CompositionObserverKt {
+ method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.tooling.CompositionObserverHandle? observe(androidx.compose.runtime.Composition, androidx.compose.runtime.tooling.CompositionObserver observer);
+ method @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public static androidx.compose.runtime.tooling.CompositionObserverHandle observe(androidx.compose.runtime.RecomposeScope, androidx.compose.runtime.tooling.RecomposeScopeObserver observer);
+ }
+
public final class InspectionTablesKt {
method public static androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> getLocalInspectionTables();
property public static final androidx.compose.runtime.ProvidableCompositionLocal<java.util.Set<androidx.compose.runtime.tooling.CompositionData>> LocalInspectionTables;
}
+ @SuppressCompatibility @androidx.compose.runtime.ExperimentalComposeRuntimeApi public interface RecomposeScopeObserver {
+ method public void onBeginScopeComposition(androidx.compose.runtime.RecomposeScope scope);
+ method public void onEndScopeComposition(androidx.compose.runtime.RecomposeScope scope);
+ method public void onScopeDisposed(androidx.compose.runtime.RecomposeScope scope);
+ }
+
}
diff --git a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/ComposeActivity.kt b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/ComposeActivity.kt
index f698f2e..bfbf7cd 100644
--- a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/ComposeActivity.kt
+++ b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/ComposeActivity.kt
@@ -23,4 +23,4 @@
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/DeepTreeBenchmark.kt b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/DeepTreeBenchmark.kt
index 1814570..079ac56c 100644
--- a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/DeepTreeBenchmark.kt
+++ b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/DeepTreeBenchmark.kt
@@ -69,4 +69,4 @@
DeepTree(depth = 2, breadth = 10, wrap = 6)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/SnapshotStateAutoboxingBenchmark.kt b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/SnapshotStateAutoboxingBenchmark.kt
index 6ae06e8..1889856 100644
--- a/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/SnapshotStateAutoboxingBenchmark.kt
+++ b/compose/runtime/runtime/compose-runtime-benchmark/src/androidTest/java/androidx/compose/runtime/benchmark/SnapshotStateAutoboxingBenchmark.kt
@@ -96,4 +96,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidCompositionObserverTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidCompositionObserverTests.kt
new file mode 100644
index 0000000..6d654e4
--- /dev/null
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidCompositionObserverTests.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.runtime
+
+import androidx.compose.runtime.tooling.CompositionObserver
+import androidx.compose.runtime.tooling.CompositionObserverHandle
+import androidx.compose.runtime.tooling.observe
+import androidx.compose.ui.R
+import androidx.compose.ui.platform.LocalView
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import kotlin.test.assertNotNull
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+class AndroidCompositionObserverTests : BaseComposeTest() {
+ @get:Rule
+ override val activityRule = makeTestActivityRule()
+
+ @OptIn(ExperimentalComposeRuntimeApi::class)
+ @Test
+ fun testObservingUiComposition() {
+ var handle: CompositionObserverHandle? = null
+ compose {
+ val view = LocalView.current
+ val composition = view.getTag(R.id.wrapped_composition_tag) as Composition
+ handle = composition.observe(object : CompositionObserver {
+ override fun onBeginComposition(
+ composition: Composition,
+ invalidationMap: Map<RecomposeScope, Set<Any>?>
+ ) {
+ }
+
+ override fun onEndComposition(composition: Composition) {
+ }
+ })
+ }.then {
+ assertNotNull(handle)
+ handle?.dispose()
+ }
+ }
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidMovableContentTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidMovableContentTests.kt
index c17130f..7f9f42d 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidMovableContentTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidMovableContentTests.kt
@@ -94,4 +94,4 @@
interface Result {
fun toEqual(expected: Any?)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidSnapshotTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidSnapshotTests.kt
index 17842c2..ab2247a 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidSnapshotTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/AndroidSnapshotTests.kt
@@ -64,4 +64,4 @@
stop = true
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
index 79df8bd..373961f 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ComposeIntoTests.kt
@@ -136,4 +136,4 @@
}
}
-fun CountDownLatch.wait() = assertTrue(await(1, TimeUnit.SECONDS))
\ No newline at end of file
+fun CountDownLatch.wait() = assertTrue(await(1, TimeUnit.SECONDS))
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ContextReceiverTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ContextReceiverTests.kt
index 781503a..5fb7c53 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ContextReceiverTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ContextReceiverTests.kt
@@ -99,4 +99,4 @@
class CtxB {
fun getB() = "B"
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
index 6cb8982..c6edc91 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/DisposeTests.kt
@@ -85,4 +85,4 @@
activity.waitForAFrame()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt
index b0e4d91..b874c43 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt
@@ -575,4 +575,4 @@
if (shouldThrow()) {
error("Text error!")
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ProduceStateTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ProduceStateTests.kt
index ad0091f..6d7d71a 100644
--- a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ProduceStateTests.kt
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/ProduceStateTests.kt
@@ -56,4 +56,4 @@
assertEquals(1, observedResult, "observedResult after emitting new value")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/EffectSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/EffectSamples.kt
index 40d690d..b488925 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/EffectSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/EffectSamples.kt
@@ -146,4 +146,4 @@
// to recompose.
CountDisplay(sum)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/FlowAdapterSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/FlowAdapterSamples.kt
index 733a59a..56691ad 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/FlowAdapterSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/FlowAdapterSamples.kt
@@ -36,4 +36,4 @@
fun StateFlowSample(stateFlow: StateFlow<String>) {
val value: String by stateFlow.collectAsState()
Text("Value is $value")
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ImmutableSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ImmutableSamples.kt
index faf6eac..df458ba 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ImmutableSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ImmutableSamples.kt
@@ -50,4 +50,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ProduceStateSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ProduceStateSamples.kt
index 9adfc2d..015a6cf 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ProduceStateSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/ProduceStateSamples.kt
@@ -79,4 +79,4 @@
disposable.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SideEffectSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SideEffectSamples.kt
index 07cddd8..bab72f9 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SideEffectSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SideEffectSamples.kt
@@ -134,4 +134,4 @@
// ...
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotMutationPolicySamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotMutationPolicySamples.kt
index ade041c..0e58303 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotMutationPolicySamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotMutationPolicySamples.kt
@@ -55,4 +55,4 @@
}
// State is now equals 30 as the changes made in the snapshots are added together.
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
index 937674e..2310b38 100644
--- a/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
+++ b/compose/runtime/runtime/samples/src/main/java/androidx/compose/runtime/samples/SnapshotSamples.kt
@@ -89,4 +89,4 @@
snapshot.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/collection/SparseArrayImplTest.kt b/compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/collection/SparseArrayImplTest.kt
index 89f3bd6..0c2b299 100644
--- a/compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/collection/SparseArrayImplTest.kt
+++ b/compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/collection/SparseArrayImplTest.kt
@@ -92,4 +92,4 @@
}
return subject to added
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ActualAndroid.android.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ActualAndroid.android.kt
index 26a2698..e712b4a 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ActualAndroid.android.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ActualAndroid.android.kt
@@ -112,4 +112,4 @@
internal actual fun logError(message: String, e: Throwable) {
Log.e(LogTag, message, e)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableDoubleState.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableDoubleState.kt
index 6ef9807..e6e3418 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableDoubleState.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableDoubleState.kt
@@ -47,4 +47,4 @@
arrayOfNulls<ParcelableSnapshotMutableDoubleState>(size)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableFloatState.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableFloatState.kt
index 8eef327..202d1cb 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableFloatState.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableFloatState.kt
@@ -47,4 +47,4 @@
arrayOfNulls<ParcelableSnapshotMutableFloatState>(size)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableIntState.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableIntState.kt
index 28571af..8a59099 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableIntState.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableIntState.kt
@@ -47,4 +47,4 @@
arrayOfNulls<ParcelableSnapshotMutableIntState>(size)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableLongState.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableLongState.kt
index f5130b6..6343b37 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableLongState.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/ParcelableSnapshotMutableLongState.kt
@@ -47,4 +47,4 @@
arrayOfNulls<ParcelableSnapshotMutableLongState>(size)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.android.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.android.kt
index c8bd256..c8d1d7d 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.android.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.android.kt
@@ -63,4 +63,4 @@
}
// filename is not allowed if only a class is declared
-private val allowFilename = 0
\ No newline at end of file
+private val allowFilename = 0
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.android.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.android.kt
index 61845d3..211f48e 100644
--- a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.android.kt
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.android.kt
@@ -50,4 +50,4 @@
this == other
} else {
!this.isNan && !other.isNan && this == other
- }
\ No newline at end of file
+ }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Applier.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Applier.kt
index 8cff96a..762d8f1 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Applier.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Applier.kt
@@ -285,4 +285,4 @@
override fun clear() {
runtimeCheck(false) { "Clear is not valid on OffsetApplier" }
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/BitwiseOperators.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/BitwiseOperators.kt
index 9d4a71a..46615a3 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/BitwiseOperators.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/BitwiseOperators.kt
@@ -23,4 +23,4 @@
// NOTE: rotateLeft, marked @ExperimentalStdlibApi is also marked inline-only,
// which makes this usage stable.
-internal inline infix fun Int.rol(other: Int) = this.rotateLeft(other)
\ No newline at end of file
+internal inline infix fun Int.rol(other: Int) = this.rotateLeft(other)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeCompilerApi.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeCompilerApi.kt
index 6a38d9d..d8a75a1 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeCompilerApi.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ComposeCompilerApi.kt
@@ -22,4 +22,4 @@
AnnotationTarget.PROPERTY,
AnnotationTarget.TYPEALIAS
)
-annotation class ComposeCompilerApi
\ No newline at end of file
+annotation class ComposeCompilerApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
index bdf21bb..2f77c0b 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
@@ -25,6 +25,8 @@
import androidx.compose.runtime.snapshots.fastAll
import androidx.compose.runtime.snapshots.fastAny
import androidx.compose.runtime.snapshots.fastForEach
+import androidx.compose.runtime.tooling.CompositionObserver
+import androidx.compose.runtime.tooling.CompositionObserverHandle
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
@@ -77,25 +79,36 @@
}
/**
- * Observe the composition. Calling this twice on the same composition will implicitly dispose
- * the previous observer. the [CompositionObserver] will be called for this composition and
- * all sub-composition, transitively, for which this composition is a context. If, however,
- * [observe] is called on a sub-composition, it will override the parent composition and
- * notification for it and all sub-composition of it, will go to its observer instead of the
- * one registered for the parent.
- *
- * @param observer the observer that will be informed of composition events for this
- * composition and all sub-compositions for which this composition is the composition context.
- * Observing a composition will prevent the parent composition's observer from receiving
- * composition events about this composition.
- *
- * @return a handle that allows the observer to be disposed and detached from the composition.
- * Disposing an observer for a composition with a parent observer will begin sending the events
- * to the parent composition's observer.ø
+ * A key to locate a service using the [CompositionServices] interface optionally implemented
+ * by implementations of [Composition].
*/
-@ExperimentalComposeRuntimeApi
-fun Composition.observe(observer: CompositionObserver): CompositionObserverHandle =
- (this as CompositionImpl).observe(observer)
+interface CompositionServiceKey<T>
+
+/**
+ * Allows finding composition services from the runtime. The services requested through this
+ * interface are internal to the runtime and cannot be provided directly.
+ *
+ * The [CompositionServices] interface is used by the runtime to provide optional and/or
+ * experimental services through public extension functions.
+ *
+ * Implementation of [Composition] that delegate to another [Composition] instance should implement
+ * this interface and delegate calls to [getCompositionService] to the original [Composition].
+ */
+interface CompositionServices {
+ /**
+ * Find a service of class [T].
+ */
+ fun <T> getCompositionService(key: CompositionServiceKey<T>): T?
+}
+
+/**
+ * Find a Composition service.
+ *
+ * Find services that implement optional and/or experimental services provided through public or
+ * experimental extension functions.
+ */
+internal fun <T> Composition.getCompositionService(key: CompositionServiceKey<T>) =
+ (this as? CompositionServices)?.getCompositionService(key)
/**
* A controlled composition is a [Composition] that can be directly controlled by the caller.
@@ -350,6 +363,8 @@
private val PendingApplyNoModifications = Any()
+internal val CompositionImplServiceKey = object : CompositionServiceKey<CompositionImpl> { }
+
/**
* The implementation of the [Composition] interface.
*
@@ -372,7 +387,7 @@
private val applier: Applier<*>,
recomposeContext: CoroutineContext? = null
-) : ControlledComposition, RecomposeScopeOwner {
+) : ControlledComposition, RecomposeScopeOwner, CompositionServices {
/**
* `null` if a composition isn't pending to apply.
* `Set<Any>` or `Array<Set<Any>>` if there are modifications to record
@@ -397,6 +412,7 @@
/**
* The slot table is used to store the composition information required for recomposition.
*/
+ @Suppress("MemberVisibilityCanBePrivate") // published as internal
internal val slotTable = SlotTable()
/**
@@ -475,6 +491,7 @@
* [observations] set contains [RecomposeScope] that is no longer needed. [pendingInvalidScopes]
* is set to true whenever a [RecomposeScope] is removed from the [slotTable].
*/
+ @Suppress("MemberVisibilityCanBePrivate") // published as internal
internal var pendingInvalidScopes = false
private var invalidationDelegate: CompositionImpl? = null
@@ -1022,6 +1039,10 @@
pendingInvalidScopes = true
}
+ @Suppress("UNCHECKED_CAST")
+ override fun <T> getCompositionService(key: CompositionServiceKey<T>): T? =
+ if (key == CompositionImplServiceKey) this as T else null
+
private fun tryImminentInvalidation(scope: RecomposeScopeImpl, instance: Any?): Boolean =
isComposing && composer.tryImminentInvalidation(scope, instance)
@@ -1342,4 +1363,4 @@
internal class CompositionObserverHolder(
var observer: CompositionObserver? = null,
var root: Boolean = false,
-)
\ No newline at end of file
+)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
index b614f8a..4b64873 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
@@ -42,7 +42,7 @@
/**
* The [CoroutineContext] with which effects for the composition will be executed in.
- **/
+ */
abstract val effectCoroutineContext: CoroutineContext
internal abstract val recomposeCoroutineContext: CoroutineContext
internal abstract fun composeInitial(
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionObserver.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionObserver.kt
deleted file mode 100644
index ad32ecd..0000000
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionObserver.kt
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.compose.runtime
-
-@RequiresOptIn(
- level = RequiresOptIn.Level.ERROR,
- message = "This in experimental API that may change frequently and without warning."
-)
-@Target(
- AnnotationTarget.CLASS,
- AnnotationTarget.FUNCTION,
- AnnotationTarget.PROPERTY,
- AnnotationTarget.FIELD,
- AnnotationTarget.PROPERTY_GETTER,
-)
-@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalComposeRuntimeApi
-
-/**
- * Observe when the composition begins and ends.
- */
-@ExperimentalComposeRuntimeApi
-@Suppress("CallbackName")
-interface CompositionObserver {
- /**
- * Called when the composition begins on the [composition]. The [invalidationMap] a map of
- * invalid recompose scopes that are scheduled to be recomposed. The [CompositionObserver]
- * will be called for the [composition].
- *
- * The scopes in the [invalidationMap] are not guaranteed to be composed. Some cases where they
- * are not composed are 1) the scope is no longer part of the composition (e.g the parent scope
- * no longer executed the code branch the scope was a part of) 2) the scope is part of movable
- * content that was moved out of the composition.
- *
- * In the case of movable content, the scope will be recomposed as part of a different
- * composition when it is moved to that composition or it might be discarded if no other
- * composition claims it.
- *
- * @param composition the composition that is beginning to be recomposed
- * @param invalidationMap the recompose scopes that will be recomposed by this composition.
- * This list is empty for the initial composition.
- */
- fun onBeginComposition(
- composition: Composition,
- invalidationMap: Map<RecomposeScope, Set<Any>?>
- )
-
- /**
- * Called after composition has been completed for [composition].
- */
- fun onEndComposition(composition: Composition)
-}
-
-/**
- * Observer when a recompose scope is being recomposed or when the scope is disposed.
- */
-@ExperimentalComposeRuntimeApi
-@Suppress("CallbackName")
-interface RecomposeScopeObserver {
- /**
- * Called just before the recompose scope's recompose lambda is invoked.
- */
- fun onBeginScopeComposition(scope: RecomposeScope)
-
- /**
- * Called just after the recompose scopes' recompose lambda returns.
- */
- fun onEndScopeComposition(scope: RecomposeScope)
-
- /**
- * Called when the recompose scope is disposed.
- */
- fun onScopeDisposed(scope: RecomposeScope)
-}
-
-/**
- * The handle returned by [Composition.observe] and [RecomposeScope.observe]. Calling [dispose]
- * will prevent further composition observation events from being sent to the registered observer.
- */
-@ExperimentalComposeRuntimeApi
-interface CompositionObserverHandle {
- /**
- * Unregister the observer.
- */
- fun dispose()
-}
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
index cfb0359..080ee94 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Effects.kt
@@ -42,6 +42,7 @@
*/
@Composable
@NonRestartableComposable
+@ExplicitGroupsComposable
@OptIn(InternalComposeApi::class)
fun SideEffect(
effect: () -> Unit
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
index 19759e77..5c4170f 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Expect.kt
@@ -130,4 +130,4 @@
snapshot: Snapshot
) : SnapshotContextElement
-internal expect fun logError(message: String, e: Throwable)
\ No newline at end of file
+internal expect fun logError(message: String, e: Throwable)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeApi.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeApi.kt
index 1bfbd64..3b3242f 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeApi.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeApi.kt
@@ -28,4 +28,4 @@
AnnotationTarget.PROPERTY_GETTER
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalComposeApi
\ No newline at end of file
+annotation class ExperimentalComposeApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeRuntimeApi.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeRuntimeApi.kt
new file mode 100644
index 0000000..a7a2864
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExperimentalComposeRuntimeApi.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.runtime
+
+@RequiresOptIn(
+ level = RequiresOptIn.Level.ERROR,
+ message = "This in experimental API that may change frequently and without warning."
+)
+@Target(
+ AnnotationTarget.CLASS,
+ AnnotationTarget.FUNCTION,
+ AnnotationTarget.PROPERTY,
+ AnnotationTarget.FIELD,
+ AnnotationTarget.PROPERTY_GETTER,
+)
+@Retention(AnnotationRetention.BINARY)
+annotation class ExperimentalComposeRuntimeApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExplicitGroupsComposable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExplicitGroupsComposable.kt
index cf356a7..db2bddf 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExplicitGroupsComposable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ExplicitGroupsComposable.kt
@@ -32,4 +32,4 @@
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER
)
-annotation class ExplicitGroupsComposable
\ No newline at end of file
+annotation class ExplicitGroupsComposable
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Immutable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Immutable.kt
index f85bdd1..1938b4a 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Immutable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Immutable.kt
@@ -42,4 +42,4 @@
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
@StableMarker
-annotation class Immutable
\ No newline at end of file
+annotation class Immutable
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeApi.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeApi.kt
index c964187..928e1ee 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeApi.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeApi.kt
@@ -27,4 +27,4 @@
AnnotationTarget.PROPERTY
)
@Retention(AnnotationRetention.BINARY)
-annotation class InternalComposeApi
\ No newline at end of file
+annotation class InternalComposeApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeTracingApi.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeTracingApi.kt
index b2e5633..c80a2d3 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeTracingApi.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/InternalComposeTracingApi.kt
@@ -21,4 +21,4 @@
message = "This is internal API that may change frequently and without warning."
)
@Retention(AnnotationRetention.BINARY)
-annotation class InternalComposeTracingApi
\ No newline at end of file
+annotation class InternalComposeTracingApi
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Latch.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Latch.kt
index 8bb366f..85fe672 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Latch.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Latch.kt
@@ -87,4 +87,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MovableContent.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MovableContent.kt
index 2f83a84..11e33b8 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MovableContent.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/MovableContent.kt
@@ -260,4 +260,4 @@
}
// An arbitrary key created randomly. This key is used for the group containing the movable content
-internal const val movableContentKey = 0x078cc281
\ No newline at end of file
+internal const val movableContentKey = 0x078cc281
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NoLiveLiterals.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NoLiveLiterals.kt
index e5b1846..7bb2370 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NoLiveLiterals.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NoLiveLiterals.kt
@@ -28,4 +28,4 @@
AnnotationTarget.FILE
)
@Retention(AnnotationRetention.SOURCE)
-annotation class NoLiveLiterals
\ No newline at end of file
+annotation class NoLiveLiterals
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NonRestartableComposable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NonRestartableComposable.kt
index 6003162..9bfd087 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NonRestartableComposable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/NonRestartableComposable.kt
@@ -27,4 +27,4 @@
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER
)
-annotation class NonRestartableComposable
\ No newline at end of file
+annotation class NonRestartableComposable
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ReadOnlyComposable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ReadOnlyComposable.kt
index e0d3685..e8191a7 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ReadOnlyComposable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/ReadOnlyComposable.kt
@@ -34,4 +34,4 @@
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER
)
-annotation class ReadOnlyComposable
\ No newline at end of file
+annotation class ReadOnlyComposable
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
index dcc373f..07d44bf 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RecomposeScopeImpl.kt
@@ -21,6 +21,8 @@
import androidx.compose.runtime.collection.IdentityArraySet
import androidx.compose.runtime.snapshots.fastAny
import androidx.compose.runtime.snapshots.fastForEach
+import androidx.compose.runtime.tooling.CompositionObserverHandle
+import androidx.compose.runtime.tooling.RecomposeScopeObserver
/**
* Represents a recomposable scope or section of the composition hierarchy. Can be used to
@@ -35,13 +37,6 @@
fun invalidate()
}
-/**
- * Observer when this scope recomposes.
- */
-@ExperimentalComposeRuntimeApi
-fun RecomposeScope.observe(observer: RecomposeScopeObserver): CompositionObserverHandle =
- (this as RecomposeScopeImpl).observe(observer)
-
private const val changedLowBitMask = 0b001_001_001_001_001_001_001_001_001_001_0
private const val changedHighBitMask = changedLowBitMask shl 1
private const val changedMask = (changedLowBitMask or changedHighBitMask).inv()
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
index e16cdd8..a25479b 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
@@ -1527,4 +1527,4 @@
if (list.isEmpty())
remove(key)
}
- }
\ No newline at end of file
+ }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RememberObserver.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RememberObserver.kt
index f18ff31..3969761 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RememberObserver.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/RememberObserver.kt
@@ -65,4 +65,4 @@
* remembered by a composition.
*/
fun onAbandoned()
-}
\ No newline at end of file
+}
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 5f56791..32a9f5c 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
@@ -3477,4 +3477,4 @@
check(right >= size || list[index] >= list[right])
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
index 3868163..6ec8ca2 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
@@ -63,7 +63,7 @@
@Stable
@JvmDefaultWithCompatibility
interface DoubleState : State<Double> {
- @AutoboxingStateValueProperty("doubleValue")
+ @get:AutoboxingStateValueProperty("doubleValue")
override val value: Double
@Suppress("AutoBoxing") get() = doubleValue
@@ -92,7 +92,8 @@
@Stable
@JvmDefaultWithCompatibility
interface MutableDoubleState : DoubleState, MutableState<Double> {
- @AutoboxingStateValueProperty("doubleValue")
+ @get:AutoboxingStateValueProperty("doubleValue")
+ @set:AutoboxingStateValueProperty("doubleValue")
override var value: Double
@Suppress("AutoBoxing") get() = doubleValue
set(value) { doubleValue = value }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
index 7158d09..1490f39 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
@@ -62,7 +62,7 @@
@Stable
@JvmDefaultWithCompatibility
interface FloatState : State<Float> {
- @AutoboxingStateValueProperty("floatValue")
+ @get:AutoboxingStateValueProperty("floatValue")
override val value: Float
@Suppress("AutoBoxing") get() = floatValue
@@ -88,7 +88,8 @@
@Stable
@JvmDefaultWithCompatibility
interface MutableFloatState : FloatState, MutableState<Float> {
- @AutoboxingStateValueProperty("floatValue")
+ @get:AutoboxingStateValueProperty("floatValue")
+ @set:AutoboxingStateValueProperty("floatValue")
override var value: Float
@Suppress("AutoBoxing") get() = floatValue
set(value) { floatValue = value }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
index e43f884..137cbf7 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
@@ -61,7 +61,7 @@
@Stable
@JvmDefaultWithCompatibility
interface IntState : State<Int> {
- @AutoboxingStateValueProperty("intValue")
+ @get:AutoboxingStateValueProperty("intValue")
override val value: Int
@Suppress("AutoBoxing") get() = intValue
@@ -87,7 +87,8 @@
@Stable
@JvmDefaultWithCompatibility
interface MutableIntState : IntState, MutableState<Int> {
- @AutoboxingStateValueProperty("intValue")
+ @get:AutoboxingStateValueProperty("intValue")
+ @set:AutoboxingStateValueProperty("intValue")
override var value: Int
@Suppress("AutoBoxing") get() = intValue
set(value) { intValue = value }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
index a22c5c4..bde2f06 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
@@ -62,7 +62,7 @@
@Stable
@JvmDefaultWithCompatibility
interface LongState : State<Long> {
- @AutoboxingStateValueProperty("longValue")
+ @get:AutoboxingStateValueProperty("longValue")
override val value: Long
@Suppress("AutoBoxing") get() = longValue
@@ -88,7 +88,8 @@
@Stable
@JvmDefaultWithCompatibility
interface MutableLongState : LongState, MutableState<Long> {
- @AutoboxingStateValueProperty("longValue")
+ @get:AutoboxingStateValueProperty("longValue")
+ @set:AutoboxingStateValueProperty("longValue")
override var value: Long
@Suppress("AutoBoxing") get() = longValue
set(value) { longValue = value }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotStateExtensions.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotStateExtensions.kt
index da0aa7d..f9676e3 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotStateExtensions.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotStateExtensions.kt
@@ -118,4 +118,4 @@
get() = baseState.value
override fun toString(): String = "UnboxedDoubleState(baseState=$baseState)@${hashCode()}"
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/StableMarker.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/StableMarker.kt
index 54797d7..71e78f9 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/StableMarker.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/StableMarker.kt
@@ -46,4 +46,4 @@
@MustBeDocumented
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
-annotation class StableMarker
\ No newline at end of file
+annotation class StableMarker
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ChangeList.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ChangeList.kt
index e594c86..a539add 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ChangeList.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ChangeList.kt
@@ -297,4 +297,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ComposerChangeListWriter.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ComposerChangeListWriter.kt
index 60a5ec8..426d5d9 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ComposerChangeListWriter.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/ComposerChangeListWriter.kt
@@ -456,4 +456,4 @@
companion object {
private const val invalidGroupLocation = -2
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/FixupList.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/FixupList.kt
index 466734f..ef67a76 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/FixupList.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/FixupList.kt
@@ -87,4 +87,4 @@
if (isNotEmpty()) append(":\n${operations.toDebugString(linePrefix)}")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/IntRef.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/IntRef.kt
index dc0d4ae..2c3ba6f 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/IntRef.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/IntRef.kt
@@ -20,4 +20,4 @@
var element: Int = 0
) {
override fun toString() = "IntRef(element = $element)@${hashCode().toString(16)}"
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/OperationArgContainer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/OperationArgContainer.kt
index efe1864..ff4a320 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/OperationArgContainer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/OperationArgContainer.kt
@@ -29,4 +29,4 @@
* Returns the assigned value of [parameter] for the current operation.
*/
fun <T> getObject(parameter: Operation.ObjectParameter<T>): T
-}
\ No newline at end of file
+}
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 95823fb..50bef0d 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
@@ -469,4 +469,4 @@
internal sealed interface OperationsDebugStringFormattable {
fun toDebugString(linePrefix: String = " "): String
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMap.kt
index 69e32d6..f1f4022 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMap.kt
@@ -238,4 +238,4 @@
// We should insert at the end
return -(size + 1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayMap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayMap.kt
index 5328b4d..565eb30 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayMap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArrayMap.kt
@@ -294,4 +294,4 @@
override fun containsKey(key: Key): Boolean =
this@IdentityArrayMap[key] != null
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArraySet.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArraySet.kt
index c5347c7..415a611 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArraySet.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityArraySet.kt
@@ -398,4 +398,4 @@
} else {
forEach(block)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
index d683a23..3ee5190 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IdentityScopeMap.kt
@@ -328,4 +328,4 @@
// We should insert at the end
return -(size + 1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IntMap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IntMap.kt
index c53ec51..7097c8a 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IntMap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/IntMap.kt
@@ -56,4 +56,4 @@
* Current count of key value pairs.
*/
val size: Int
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/external/kotlinx/collections/immutable/implementations/immutableSet/TrieNode.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/external/kotlinx/collections/immutable/implementations/immutableSet/TrieNode.kt
index 9bc1540..2aa2ca9 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/external/kotlinx/collections/immutable/implementations/immutableSet/TrieNode.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/external/kotlinx/collections/immutable/implementations/immutableSet/TrieNode.kt
@@ -46,7 +46,7 @@
* on the fly using [predicate]. By default filters out [TrieNode.EMPTY] instances
*
* return number of elements written to [newArray]
- **/
+ */
private inline fun Array<Any?>.filterTo(
newArray: Array<Any?>,
newArrayOffset: Int = 0,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/Decoy.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/Decoy.kt
index d93794f..28add91 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/Decoy.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/Decoy.kt
@@ -68,4 +68,4 @@
@Suppress("unused")
@ExperimentalComposeApi
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
-internal annotation class DecoyImplementationDefaultsBitMask(val bitMask: Int)
\ No newline at end of file
+internal annotation class DecoyImplementationDefaultsBitMask(val bitMask: Int)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.kt
index 0404016..e1894f9 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.kt
@@ -42,4 +42,4 @@
*
* See [issue 281205384](b/281205384).
*/
-internal expect inline fun Double.equalsWithNanFix(other: Double): Boolean
\ No newline at end of file
+internal expect inline fun Double.equalsWithNanFix(other: Double): Boolean
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.kt
index d08cad5..d08cb28 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.runtime.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
index 0a334de..07285b5 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/internal/LiveLiteral.kt
@@ -96,4 +96,4 @@
if (needToUpdate) {
stateObj.value = value
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/AutoboxingStateValueProperty.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/AutoboxingStateValueProperty.kt
index 3f3a814..b81a5e5 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/AutoboxingStateValueProperty.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/AutoboxingStateValueProperty.kt
@@ -27,7 +27,7 @@
* instead.
*/
@Retention(AnnotationRetention.BINARY)
-@Target(AnnotationTarget.PROPERTY)
+@Target(AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER)
annotation class AutoboxingStateValueProperty(
/**
* An alternative, non-boxing property that can be used instead of the annotated property.
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeap.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeap.kt
index 12241e4..78d7def 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeap.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeap.kt
@@ -207,4 +207,4 @@
}
}
-private const val INITIAL_CAPACITY = 16
\ No newline at end of file
+private const val INITIAL_CAPACITY = 16
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 c3ffa55..56bbaee 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
@@ -239,4 +239,4 @@
return true
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt
index 7555423..3928568 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt
@@ -26,4 +26,4 @@
@MustBeDocumented
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
-annotation class StateFactoryMarker
\ No newline at end of file
+annotation class StateFactoryMarker
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionObserver.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionObserver.kt
new file mode 100644
index 0000000..6f379b2
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/tooling/CompositionObserver.kt
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.runtime.tooling
+
+import androidx.compose.runtime.Composition
+import androidx.compose.runtime.CompositionImplServiceKey
+import androidx.compose.runtime.ExperimentalComposeRuntimeApi
+import androidx.compose.runtime.RecomposeScope
+import androidx.compose.runtime.RecomposeScopeImpl
+import androidx.compose.runtime.getCompositionService
+
+/**
+ * Observe when the composition begins and ends.
+ */
+@ExperimentalComposeRuntimeApi
+@Suppress("CallbackName")
+interface CompositionObserver {
+ /**
+ * Called when the composition begins on the [composition]. The [invalidationMap] a map of
+ * invalid recompose scopes that are scheduled to be recomposed. The [CompositionObserver]
+ * will be called for the [composition].
+ *
+ * The scopes in the [invalidationMap] are not guaranteed to be composed. Some cases where they
+ * are not composed are 1) the scope is no longer part of the composition (e.g the parent scope
+ * no longer executed the code branch the scope was a part of) 2) the scope is part of movable
+ * content that was moved out of the composition.
+ *
+ * In the case of movable content, the scope will be recomposed as part of a different
+ * composition when it is moved to that composition or it might be discarded if no other
+ * composition claims it.
+ *
+ * @param composition the composition that is beginning to be recomposed
+ * @param invalidationMap the recompose scopes that will be recomposed by this composition.
+ * This list is empty for the initial composition.
+ */
+ fun onBeginComposition(
+ composition: Composition,
+ invalidationMap: Map<RecomposeScope, Set<Any>?>
+ )
+
+ /**
+ * Called after composition has been completed for [composition].
+ */
+ fun onEndComposition(composition: Composition)
+}
+
+/**
+ * Observer when a recompose scope is being recomposed or when the scope is disposed.
+ */
+@ExperimentalComposeRuntimeApi
+@Suppress("CallbackName")
+interface RecomposeScopeObserver {
+ /**
+ * Called just before the recompose scope's recompose lambda is invoked.
+ */
+ fun onBeginScopeComposition(scope: RecomposeScope)
+
+ /**
+ * Called just after the recompose scopes' recompose lambda returns.
+ */
+ fun onEndScopeComposition(scope: RecomposeScope)
+
+ /**
+ * Called when the recompose scope is disposed.
+ */
+ fun onScopeDisposed(scope: RecomposeScope)
+}
+
+/**
+ * The handle returned by [Composition.observe] and [RecomposeScope.observe]. Calling [dispose]
+ * will prevent further composition observation events from being sent to the registered observer.
+ */
+@ExperimentalComposeRuntimeApi
+interface CompositionObserverHandle {
+ /**
+ * Unregister the observer.
+ */
+ fun dispose()
+}
+
+/**
+ * Observe the composition. Calling this twice on the same composition will implicitly dispose
+ * the previous observer. the [CompositionObserver] will be called for this composition and
+ * all sub-composition, transitively, for which this composition is a context. If, however,
+ * [observe] is called on a sub-composition, it will override the parent composition and
+ * notification for it and all sub-composition of it, will go to its observer instead of the
+ * one registered for the parent.
+ *
+ * @param observer the observer that will be informed of composition events for this
+ * composition and all sub-compositions for which this composition is the composition context.
+ * Observing a composition will prevent the parent composition's observer from receiving
+ * composition events about this composition.
+ *
+ * @return a handle that allows the observer to be disposed and detached from the composition.
+ * Disposing an observer for a composition with a parent observer will begin sending the events
+ * to the parent composition's observer. A `null` indicates the composition does not support
+ * being observed.
+ */
+@ExperimentalComposeRuntimeApi
+fun Composition.observe(observer: CompositionObserver): CompositionObserverHandle? =
+ getCompositionService(CompositionImplServiceKey)?.observe(observer)
+
+/**
+ * Observer when this scope recomposes.
+
+ * @param observer the observer that will be informed of recompose events for this scope.
+ *
+ * @return a handle that allows the observer to be disposed and detached from the recompose scope.
+ */
+@ExperimentalComposeRuntimeApi
+fun RecomposeScope.observe(observer: RecomposeScopeObserver): CompositionObserverHandle =
+ (this as RecomposeScopeImpl).observe(observer)
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionTestExtensions.kt b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionTestExtensions.kt
index b21ab37..bf4fe5d 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionTestExtensions.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/CompositionTestExtensions.kt
@@ -24,4 +24,4 @@
@TestOnly
fun Composer.getInsertTableSlots(): Iterable<Any?> =
- (this as ComposerImpl).insertTable.slots.asIterable()
\ No newline at end of file
+ (this as ComposerImpl).insertTable.slots.asIterable()
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/OperationsTest.kt b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/OperationsTest.kt
index 12e524b..ff70c28 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/OperationsTest.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/OperationsTest.kt
@@ -672,4 +672,4 @@
property.isAccessible = true
return property.get(this)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/TestOperations.kt b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/TestOperations.kt
index 2d53533..ee4e33f 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/TestOperations.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/changelist/TestOperations.kt
@@ -30,4 +30,4 @@
val ThreeObjectsOperation = TestOperation(objects = 3)
val MixedOperation = TestOperation(ints = 2, objects = 2)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/internal/FloatingPointEqualityTest.kt b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/internal/FloatingPointEqualityTest.kt
index 978dd87..c943082 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/internal/FloatingPointEqualityTest.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/internal/FloatingPointEqualityTest.kt
@@ -175,4 +175,4 @@
private val Double.Companion.NegativeZero: Float
get() = Float.fromBits(0b1 shl 63)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/commonTest/kotlin/kotlinx/test/IgnoreJsTarget.kt b/compose/runtime/runtime/src/commonTest/kotlin/kotlinx/test/IgnoreJsTarget.kt
index 7745f77..31e55dd 100644
--- a/compose/runtime/runtime/src/commonTest/kotlin/kotlinx/test/IgnoreJsTarget.kt
+++ b/compose/runtime/runtime/src/commonTest/kotlin/kotlinx/test/IgnoreJsTarget.kt
@@ -15,4 +15,4 @@
*/
package kotlinx.test
-expect annotation class IgnoreJsTarget
\ No newline at end of file
+expect annotation class IgnoreJsTarget
diff --git a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.desktop.kt b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.desktop.kt
index a4c7120..6594283 100644
--- a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.desktop.kt
+++ b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/ActualDesktop.desktop.kt
@@ -101,4 +101,4 @@
internal actual fun logError(message: String, e: Throwable) {
System.err.println(message)
e.printStackTrace(System.err)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.desktop.kt b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.desktop.kt
index 5b2d961..36eb726e 100644
--- a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.desktop.kt
+++ b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/collection/ActualIntMap.desktop.kt
@@ -150,4 +150,4 @@
result[index] = value
System.arraycopy(this, index, result, index + 1, size - index)
return result
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.desktop.kt b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.desktop.kt
index be9c52f..aac6b0e 100644
--- a/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.desktop.kt
+++ b/compose/runtime/runtime/src/desktopMain/kotlin/androidx/compose/runtime/internal/FloatingPointEquality.desktop.kt
@@ -20,4 +20,4 @@
internal actual inline fun Float.equalsWithNanFix(other: Float): Boolean = (this == other)
@Suppress("NOTHING_TO_INLINE")
-internal actual inline fun Double.equalsWithNanFix(other: Double): Boolean = (this == other)
\ No newline at end of file
+internal actual inline fun Double.equalsWithNanFix(other: Double): Boolean = (this == other)
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.jvm.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.jvm.kt
index acafe13..e73fbb9 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.jvm.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/ActualJvm.jvm.kt
@@ -116,4 +116,4 @@
override fun restoreThreadContext(context: CoroutineContext, oldState: Snapshot?) {
snapshot.unsafeLeave(oldState)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.jvm.kt
index 7baefab..c474d37 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.runtime.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ThreadMap.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ThreadMap.kt
index d4645eb..3721928 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ThreadMap.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/internal/ThreadMap.kt
@@ -108,4 +108,4 @@
}
}
-internal val emptyThreadMap = ThreadMap(0, LongArray(0), emptyArray())
\ No newline at end of file
+internal val emptyThreadMap = ThreadMap(0, LongArray(0), emptyArray())
diff --git a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/reflect/ComposableMethod.kt b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/reflect/ComposableMethod.kt
index 51c93dc..dadbf04 100644
--- a/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/reflect/ComposableMethod.kt
+++ b/compose/runtime/runtime/src/jvmMain/kotlin/androidx/compose/runtime/reflect/ComposableMethod.kt
@@ -216,4 +216,4 @@
} ?: throw NoSuchMethodException("$name.$methodName")
return method.asComposableMethod()!!
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/changelist/OperationDefinitionValidationTest.kt b/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/changelist/OperationDefinitionValidationTest.kt
index 74af930..6a6025c 100644
--- a/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/changelist/OperationDefinitionValidationTest.kt
+++ b/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/changelist/OperationDefinitionValidationTest.kt
@@ -153,4 +153,4 @@
return errors
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/jvmTest/kotlin/kotlinx/test/IgnoreJsTarget.jvm.kt b/compose/runtime/runtime/src/jvmTest/kotlin/kotlinx/test/IgnoreJsTarget.jvm.kt
index a14cf3f..bebc8a3 100644
--- a/compose/runtime/runtime/src/jvmTest/kotlin/kotlinx/test/IgnoreJsTarget.jvm.kt
+++ b/compose/runtime/runtime/src/jvmTest/kotlin/kotlinx/test/IgnoreJsTarget.jvm.kt
@@ -18,4 +18,4 @@
annotation class DoNothing
-actual typealias IgnoreJsTarget = DoNothing
\ No newline at end of file
+actual typealias IgnoreJsTarget = DoNothing
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/BroadcastFrameClockTest.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/BroadcastFrameClockTest.kt
index a0f493d..4a3aafd 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/BroadcastFrameClockTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/BroadcastFrameClockTest.kt
@@ -75,4 +75,4 @@
val lateAwaiter = async { clock.withFrameNanos { it } }
assertAwaiterCancelled("lateAwaiter", lateAwaiter)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
index 2dc9e36..1289e49 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionLocalTests.kt
@@ -694,4 +694,4 @@
}
data class SomeData(val value: String = "default")
-@Stable class StableRef<T>(var value: T)
\ No newline at end of file
+@Stable class StableRef<T>(var value: T)
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionObserverTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionObserverTests.kt
index b864ece8..4a6aa60 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionObserverTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionObserverTests.kt
@@ -21,6 +21,9 @@
import androidx.compose.runtime.mock.expectChanges
import androidx.compose.runtime.mock.revalidate
import androidx.compose.runtime.mock.validate
+import androidx.compose.runtime.tooling.CompositionObserver
+import androidx.compose.runtime.tooling.RecomposeScopeObserver
+import androidx.compose.runtime.tooling.observe
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -215,7 +218,7 @@
assertEquals(2, beginCount)
assertEquals(2, endCount)
- handle.dispose()
+ handle?.dispose()
data++
expectChanges()
@@ -314,7 +317,7 @@
assertEquals(2, compositionsSeen.size)
val lastBeginCount = beginCount
val lastEndCount = endCount
- handle.dispose()
+ handle?.dispose()
data++
expectChanges()
@@ -446,7 +449,7 @@
val firstBeginCountTwo = beginCountTwo
val middleCountOne = beginCountOne
- handle.dispose()
+ handle?.dispose()
data++
expectChanges()
@@ -471,7 +474,7 @@
val lastCountTwo = beginCountTwo
// Dispose the subcompose observer
- subcomposeHandle.dispose()
+ subcomposeHandle?.dispose()
data++
expectChanges()
@@ -482,7 +485,7 @@
assertTrue(beginCountOne >= penultimateCountOne + 3)
val lastCountOne = beginCountOne
- handle2.dispose()
+ handle2?.dispose()
data++
expectChanges()
@@ -539,7 +542,7 @@
}
expectChanges()
assertTrue(validatedSomething)
- handle.dispose()
+ handle?.dispose()
}
changes(0)
@@ -558,4 +561,4 @@
changes(1, 2, 3)
changes(0, 1, 2, 3)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt
index 9912d15..74a4dd6 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionReusingTests.kt
@@ -816,4 +816,4 @@
if (found != null) return found
}
return null
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt
index 6e25f8d..f33bb2b 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/CompositionTests.kt
@@ -4189,4 +4189,4 @@
itemRenderer(viewItem)
}
-data class ListViewItem(val id: Int)
\ No newline at end of file
+data class ListViewItem(val id: Int)
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/EffectsTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/EffectsTests.kt
index 38b7cec..a92cdc3 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/EffectsTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/EffectsTests.kt
@@ -723,4 +723,4 @@
fun recompose() { count.value += 1 }
}
-fun use(@Suppress("UNUSED_PARAMETER") value: Any) { }
\ No newline at end of file
+fun use(@Suppress("UNUSED_PARAMETER") value: Any) { }
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/ModelViewTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/ModelViewTests.kt
index 42de67c..b121e62 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/ModelViewTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/ModelViewTests.kt
@@ -225,4 +225,4 @@
expectChanges()
validate()
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
index 012f6ee..119889b 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/NewCodeGenTests.kt
@@ -224,4 +224,4 @@
@Stable
class StableCounter(var count: Int = 0)
-data class Phone(val area: String, val prefix: String, val number: String)
\ No newline at end of file
+data class Phone(val area: String, val prefix: String, val number: String)
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/SlotTableTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/SlotTableTests.kt
index d6505b04..333289b 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/SlotTableTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/SlotTableTests.kt
@@ -4279,4 +4279,4 @@
exceptionThrown,
"Expected test to throw an exception containing \"$message\""
)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/UpdateChangedFlagsTest.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/UpdateChangedFlagsTest.kt
index f5b6b72..21e4f21 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/UpdateChangedFlagsTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/UpdateChangedFlagsTest.kt
@@ -62,4 +62,4 @@
val result = updateChangedFlags(flags)
assertEquals(flags, result)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMapTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMapTests.kt
index 992f6a2..95bbc05 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMapTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayIntMapTests.kt
@@ -124,4 +124,4 @@
assertEquals(keys.indexOf(key), value)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayMapTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayMapTests.kt
index 9e9cca7..705cc6b 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayMapTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArrayMapTests.kt
@@ -501,4 +501,4 @@
}
assertFalse(mapInterface.containsKey(keys[count]))
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArraySetTest.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArraySetTest.kt
index 617e518..f9e614a 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArraySetTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityArraySetTest.kt
@@ -241,4 +241,4 @@
}
data class Stuff(val item: Int)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityScopeMapTest.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityScopeMapTest.kt
index b930a35..01ef6a8 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityScopeMapTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/collection/IdentityScopeMapTest.kt
@@ -181,4 +181,4 @@
data class Scope(val item: Int)
data class Value(val s: String)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/CompositionTest.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
index 12de432..73712a0 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/CompositionTest.kt
@@ -18,14 +18,14 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composition
-import androidx.compose.runtime.CompositionObserver
-import androidx.compose.runtime.CompositionObserverHandle
import androidx.compose.runtime.ControlledComposition
import androidx.compose.runtime.ExperimentalComposeRuntimeApi
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.Recomposer
-import androidx.compose.runtime.observe
import androidx.compose.runtime.snapshots.Snapshot
+import androidx.compose.runtime.tooling.CompositionObserver
+import androidx.compose.runtime.tooling.CompositionObserverHandle
+import androidx.compose.runtime.tooling.observe
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import kotlinx.coroutines.CoroutineScope
@@ -66,7 +66,7 @@
override fun compose(
observer: CompositionObserver,
block: @Composable () -> Unit
- ): CompositionObserverHandle {
+ ): CompositionObserverHandle? {
check(!composed) { "Compose should only be called once" }
composed = true
root = View().apply { name = "root" }
@@ -130,7 +130,7 @@
fun compose(
observer: CompositionObserver,
block: @Composable () -> Unit
- ): CompositionObserverHandle
+ ): CompositionObserverHandle?
/**
* Advance the state which executes any pending compositions, if any. Returns true if
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/MockViewValidator.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/MockViewValidator.kt
index cfa0614..613954f 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/MockViewValidator.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/MockViewValidator.kt
@@ -104,4 +104,4 @@
val hasNext = next()
assertEquals(true, hasNext)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Report.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Report.kt
index 3d88290..a74e777 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Report.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Report.kt
@@ -16,4 +16,4 @@
package androidx.compose.runtime.mock
-data class Report(var from: String, var to: String)
\ No newline at end of file
+data class Report(var from: String, var to: String)
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/View.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/View.kt
index 2794899..886f7b3 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/View.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/View.kt
@@ -140,4 +140,4 @@
fun findFirst(predicate: (view: View) -> Boolean) =
findFirstOrNull(predicate) ?: error("View not found")
}
-fun View.flatten(): List<View> = listOf(this) + children.flatMap { it.flatten() }
\ No newline at end of file
+fun View.flatten(): List<View> = listOf(this) + children.flatMap { it.flatten() }
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Views.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Views.kt
index 8babf4b..9afeeef 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Views.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/mock/Views.kt
@@ -144,4 +144,4 @@
} else {
content()
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/DerivedSnapshotStateTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/DerivedSnapshotStateTests.kt
index 0100bb8..f8a59eb 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/DerivedSnapshotStateTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/DerivedSnapshotStateTests.kt
@@ -294,4 +294,4 @@
fun validateOpenSnapshots() {
assertEquals(count, openSnapshotCount())
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/PrimitiveSnapshotStateTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/PrimitiveSnapshotStateTests.kt
index 9fb0d40..2cf4e88 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/PrimitiveSnapshotStateTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/PrimitiveSnapshotStateTests.kt
@@ -141,4 +141,4 @@
override fun toString(): String = clazz.simpleName
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotContextElementTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotContextElementTests.kt
index 58cdedd..7281f11 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotContextElementTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotContextElementTests.kt
@@ -64,4 +64,4 @@
snapshotTwo.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeapTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeapTests.kt
index 03590c9..8ac3ebe 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeapTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotDoubleIndexHeapTests.kt
@@ -78,4 +78,4 @@
assertEquals(lowestAdded, heap.lowestOrDefault(400))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateExtensionsTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateExtensionsTests.kt
index d2b2cf3..636b7f5 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateExtensionsTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateExtensionsTests.kt
@@ -241,4 +241,4 @@
.runningFold(emptyList<T>()) { acc, value -> acc + value }
.stateIn(CoroutineScope(currentCoroutineContext() + coroutineContext))
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
index dab7a74..8cd5fb0 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
@@ -672,4 +672,4 @@
private fun defaultMap() = mutableStateMapOf(
1 to 1f, 2 to 2f, 3 to 3f, 4 to 4f, 5 to 1f, 6 to 2f, 7 to 3f, 8 to 4f
)
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSetTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSetTests.kt
index 4727b4a..97209ca 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSetTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSetTests.kt
@@ -84,4 +84,4 @@
}
private fun <T : Any> assertValidSet(set: SnapshotWeakSet<T>) = assertTrue(set.isValid())
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
index bd2a660..841b436 100644
--- a/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/tooling/CompositionDataTests.kt
@@ -250,4 +250,4 @@
val identity = slots.compositionGroups.first().compositionGroups.drop(5).first().identity
assertEquals(identity, slots.find(identity!!)?.identity)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/reflect/ComposableMethodTest.kt b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/reflect/ComposableMethodTest.kt
index 08334e85..2d903c6 100644
--- a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/reflect/ComposableMethodTest.kt
+++ b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/reflect/ComposableMethodTest.kt
@@ -668,4 +668,4 @@
assertEquals("abcde", resABCDE)
assertEquals("abada", resABADA)
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTestsJvm.kt b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTestsJvm.kt
index da4987d..f12ce1e 100644
--- a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTestsJvm.kt
+++ b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTestsJvm.kt
@@ -75,4 +75,4 @@
exception.get()?.let { throw it }
assertNull(exception.get())
}
-}
\ No newline at end of file
+}
diff --git a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotThreadMapTests.kt b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotThreadMapTests.kt
index a50c9a8..9cb0d14 100644
--- a/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotThreadMapTests.kt
+++ b/compose/runtime/runtime/src/nonEmulatorJvmTest/kotlin/androidx/compose/runtime/snapshots/SnapshotThreadMapTests.kt
@@ -159,4 +159,4 @@
local.set(100)
assertEquals(100, local.get())
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/build.gradle b/compose/test-utils/build.gradle
index 582e745..4331b6f 100644
--- a/compose/test-utils/build.gradle
+++ b/compose/test-utils/build.gradle
@@ -107,7 +107,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
index 8db9eec..4dbe7d39 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseRunner.android.kt
@@ -391,4 +391,4 @@
fun createBitmap(picture: Picture): Bitmap {
return Bitmap.createBitmap(picture)
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseSetup.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseSetup.android.kt
index 079f6260..02f398a 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseSetup.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/AndroidComposeTestCaseSetup.android.kt
@@ -43,4 +43,4 @@
latch.await()
error?.let { throw it }
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ImageAssertions.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ImageAssertions.android.kt
index daab5bab..8eeea13 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ImageAssertions.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ImageAssertions.android.kt
@@ -327,4 +327,4 @@
else -> offset.y
}
return Offset(x, y)
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ScreenshotTestsUtils.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ScreenshotTestsUtils.android.kt
index 79dc916..0b410bd 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ScreenshotTestsUtils.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/ScreenshotTestsUtils.android.kt
@@ -39,4 +39,4 @@
rule: ScreenshotTestRule,
goldenIdentifier: String,
matcher: BitmapMatcher = MSSIMMatcher()
-) = asAndroidBitmap().assertAgainstGolden(rule, goldenIdentifier, matcher)
\ No newline at end of file
+) = asAndroidBitmap().assertAgainstGolden(rule, goldenIdentifier, matcher)
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.android.kt b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.android.kt
index fd70854..4164cfa 100644
--- a/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.android.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/compose/testutils/TestRuleExtensions.android.kt
@@ -40,4 +40,4 @@
testCase,
getActivity()
)
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeBenchmarkScope.kt b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeBenchmarkScope.kt
index 1c765e5..ae93c386 100644
--- a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeBenchmarkScope.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeBenchmarkScope.kt
@@ -102,4 +102,4 @@
fun <T> ComposeBenchmarkScope<T>.setupContent() {
createTestCase()
emitContent()
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeExecutionControl.kt b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeExecutionControl.kt
index 2e04559..3d67155 100644
--- a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeExecutionControl.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeExecutionControl.kt
@@ -233,4 +233,4 @@
"Changes are still pending after '$maxAmountOfFrames' " +
"frames."
)
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeTestCase.kt b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeTestCase.kt
index 5d5e032..5278479 100644
--- a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeTestCase.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ComposeTestCase.kt
@@ -77,4 +77,4 @@
open fun ContentWrappers(content: @Composable () -> Unit) {
content()
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/DpAssertions.kt b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/DpAssertions.kt
index 035441c..4d0c93a 100644
--- a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/DpAssertions.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/DpAssertions.kt
@@ -67,4 +67,4 @@
"tolerance of $tolerance"
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ToggleableTestCase.kt b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ToggleableTestCase.kt
index 9e5dc7d..fa524f1 100644
--- a/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ToggleableTestCase.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/compose/testutils/ToggleableTestCase.kt
@@ -23,4 +23,4 @@
*/
interface ToggleableTestCase {
fun toggleState()
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/test/kotlin/androidx/compose/testutils/DpAssertionsTest.kt b/compose/test-utils/src/test/kotlin/androidx/compose/testutils/DpAssertionsTest.kt
index 6ec0019..dc6ab69 100644
--- a/compose/test-utils/src/test/kotlin/androidx/compose/testutils/DpAssertionsTest.kt
+++ b/compose/test-utils/src/test/kotlin/androidx/compose/testutils/DpAssertionsTest.kt
@@ -50,4 +50,4 @@
5.dp.assertIsNotEqualTo(5.4.dp)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/test-utils/src/test/kotlin/androidx/compose/testutils/ExpectTest.kt b/compose/test-utils/src/test/kotlin/androidx/compose/testutils/ExpectTest.kt
index 93d3316..01564423 100644
--- a/compose/test-utils/src/test/kotlin/androidx/compose/testutils/ExpectTest.kt
+++ b/compose/test-utils/src/test/kotlin/androidx/compose/testutils/ExpectTest.kt
@@ -127,4 +127,4 @@
}
throw AssertionError("Expected an AssertionError, but it wasn't thrown")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/CornerRadius.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/CornerRadius.kt
index 55581e9..808e8e61 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/CornerRadius.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/CornerRadius.kt
@@ -38,7 +38,7 @@
* Note consumers should create an instance of this class through the corresponding
* function constructor as it is represented as an inline class with 2 float
* parameters packed into a single long to reduce allocation overhead
- **/
+ */
@Immutable
@kotlin.jvm.JvmInline
value class CornerRadius internal constructor(@PublishedApi internal val packedValue: Long) {
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/MutableRect.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/MutableRect.kt
index 1e2d5b1..747c516f 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/MutableRect.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/MutableRect.kt
@@ -98,4 +98,4 @@
"${bottom.toStringAsFixed(1)})"
}
-fun MutableRect.toRect(): Rect = Rect(left, top, right, bottom)
\ No newline at end of file
+fun MutableRect.toRect(): Rect = Rect(left, top, right, bottom)
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Rect.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Rect.kt
index b7f3ebb..29af5fe 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Rect.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Rect.kt
@@ -340,4 +340,4 @@
lerp(start.right, stop.right, fraction),
lerp(start.bottom, stop.bottom, fraction)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
index 7f17248..3063bc1 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
@@ -222,4 +222,4 @@
* with this [Size].
*/
@Stable
-val Size.center: Offset get() = Offset(width / 2f, height / 2f)
\ No newline at end of file
+val Size.center: Offset get() = Offset(width / 2f, height / 2f)
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/CornerRadiusTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/CornerRadiusTest.kt
index 857370c..6726b83 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/CornerRadiusTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/CornerRadiusTest.kt
@@ -53,4 +53,4 @@
assertEquals(17f, x)
assertEquals(42f, y)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/GeometryUtilsTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/GeometryUtilsTest.kt
index 90f2ef39..4776374 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/GeometryUtilsTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/GeometryUtilsTest.kt
@@ -53,4 +53,4 @@
fun testRoundDownToNearestInt() {
assertEquals("0", 0.49f.toStringAsFixed(0))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/MutableRectTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/MutableRectTest.kt
index ce9a9c9..e4531a7 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/MutableRectTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/MutableRectTest.kt
@@ -91,4 +91,4 @@
assertEquals(20f, r.right, 0f)
assertEquals(6f, r.bottom, 0f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
index f63483a..75991f7 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
@@ -122,4 +122,4 @@
fun testUnspecifiedOffsetToString() {
assertEquals("Offset.Unspecified", Offset.Unspecified.toString())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/RectTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/RectTest.kt
index a911875..554987c 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/RectTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/RectTest.kt
@@ -264,4 +264,4 @@
assertEquals(Rect(25f, 25f, 150f, 150f), lerp(rect1, rect2, 0.5f))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
index d610346..01d8f1d 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
@@ -171,4 +171,4 @@
fun testSpecifiedSizeToString() {
Assert.assertEquals("Size(10.0, 20.0)", Size(10f, 20f).toString())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/benchmark/src/androidTest/java/androidx/compose/ui/graphics/benchmark/VectorBenchmark.kt b/compose/ui/ui-graphics/benchmark/src/androidTest/java/androidx/compose/ui/graphics/benchmark/VectorBenchmark.kt
index 0938440..3ad349a 100644
--- a/compose/ui/ui-graphics/benchmark/src/androidTest/java/androidx/compose/ui/graphics/benchmark/VectorBenchmark.kt
+++ b/compose/ui/ui-graphics/benchmark/src/androidTest/java/androidx/compose/ui/graphics/benchmark/VectorBenchmark.kt
@@ -76,4 +76,4 @@
fun programmatic_draw() {
benchmarkRule.benchmarkFirstDraw { ProgrammaticVectorTestCase() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/benchmark/test/src/androidTest/java/androidx/compose/ui/graphics/benchmark/test/ImageVectorTest.kt b/compose/ui/ui-graphics/benchmark/test/src/androidTest/java/androidx/compose/ui/graphics/benchmark/test/ImageVectorTest.kt
index 331886e..6292556 100644
--- a/compose/ui/ui-graphics/benchmark/test/src/androidTest/java/androidx/compose/ui/graphics/benchmark/test/ImageVectorTest.kt
+++ b/compose/ui/ui-graphics/benchmark/test/src/androidTest/java/androidx/compose/ui/graphics/benchmark/test/ImageVectorTest.kt
@@ -167,4 +167,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/BrushSamples.kt b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/BrushSamples.kt
index b825b33..c09b30a 100644
--- a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/BrushSamples.kt
+++ b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/BrushSamples.kt
@@ -163,4 +163,4 @@
listOf(Color.Red, Color.Green, Color.Blue),
center = Offset(10.0f, 20.0f)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/DrawScopeSample.kt b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/DrawScopeSample.kt
index 9e4f005..753f176 100644
--- a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/DrawScopeSample.kt
+++ b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/DrawScopeSample.kt
@@ -136,4 +136,4 @@
drawIntoCanvas { canvas -> canvas.nativeCanvas.drawPicture(picture) }
}
})
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/PathEffectSample.kt b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/PathEffectSample.kt
index b25f41e..4d96fc6 100644
--- a/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/PathEffectSample.kt
+++ b/compose/ui/ui-graphics/samples/src/main/java/androidx/compose/ui/graphics/samples/PathEffectSample.kt
@@ -103,4 +103,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidBlendModeTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidBlendModeTest.kt
index 25472a9..92b82f6 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidBlendModeTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidBlendModeTest.kt
@@ -447,4 +447,4 @@
Saturation,
Color,
Luminosity
- )
\ No newline at end of file
+ )
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidCanvasTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidCanvasTest.kt
index d849eb1..b123f45 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidCanvasTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidCanvasTest.kt
@@ -639,4 +639,4 @@
drawLatch.countDown()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidColorSpaceTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidColorSpaceTest.kt
index ca5301a..40802bc 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidColorSpaceTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidColorSpaceTest.kt
@@ -287,4 +287,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidRenderEffectTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidRenderEffectTest.kt
index a7d2422b..666c823 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidRenderEffectTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidRenderEffectTest.kt
@@ -52,4 +52,4 @@
fun testOffsetEffectNotSupported() {
assertFalse(OffsetEffect(1f, 2f).isSupported())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidTileModeTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidTileModeTest.kt
index a08d3dd..51414ee 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidTileModeTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/AndroidTileModeTest.kt
@@ -108,4 +108,4 @@
fun testFrameworkTileModeDecalConversion() {
assertEquals(TileMode.Decal, android.graphics.Shader.TileMode.DECAL.toComposeTileMode())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/GradientTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/GradientTest.kt
index 272424f..08dfe0f 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/GradientTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/GradientTest.kt
@@ -368,4 +368,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ImageBitmapTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ImageBitmapTest.kt
index 0d59a3f..13a71a7 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ImageBitmapTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ImageBitmapTest.kt
@@ -45,4 +45,4 @@
assertFalse(image.hasAlpha)
assertEquals(cs, image.colorSpace)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/OutlineTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/OutlineTest.kt
index d14fdaa..776c8d5 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/OutlineTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/OutlineTest.kt
@@ -55,4 +55,4 @@
)
assertEquals(Rect(0f, 15f, 100f, 200f), pathOutline.bounds)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PaintTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PaintTest.kt
index 0ed17ef..8c2bab9 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PaintTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PaintTest.kt
@@ -89,4 +89,4 @@
composePaint.shader = shader
assertSame(composePaint.shader, nativePaint.shader)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathMeasureTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathMeasureTest.kt
index 64a36aa..e657bea 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathMeasureTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathMeasureTest.kt
@@ -46,4 +46,4 @@
Assert.assertEquals(0.707106f, tangent.x, 0.0001f)
Assert.assertEquals(0.707106f, tangent.y, 0.0001f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathTest.kt
index a51bfb3..1952be6 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PathTest.kt
@@ -137,4 +137,4 @@
super.reset()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PixelMapTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PixelMapTest.kt
index f7cb47c..19f3fd1 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PixelMapTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/PixelMapTest.kt
@@ -92,4 +92,4 @@
Assert.assertEquals(Color.Green, pixelmap[1, 1])
Assert.assertEquals(Color.Yellow, pixelmap[2, 1])
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ShaderTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ShaderTest.kt
index 1386ef1..7e5437e 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ShaderTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/ShaderTest.kt
@@ -255,4 +255,4 @@
Size(width.toFloat(), height.toFloat()),
block
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/TestActivity.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/TestActivity.kt
index 144d4bd..8a439ac 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/TestActivity.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/TestActivity.kt
@@ -28,4 +28,4 @@
hasFocusLatch.countDown()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BitmapPainterTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BitmapPainterTest.kt
index ca0a142..4bf380b 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BitmapPainterTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BitmapPainterTest.kt
@@ -337,4 +337,4 @@
canvas.saveLayer(bounds, paint)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BrushPainterTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BrushPainterTest.kt
index aed63bc..55036a7 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BrushPainterTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/BrushPainterTest.kt
@@ -180,4 +180,4 @@
)
assertEquals(Size(0.0f, 100f), BrushPainter(brush).intrinsicSize)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTest.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTest.kt
index ebd4c8e..66ce5e1 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTest.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTest.kt
@@ -220,4 +220,4 @@
)
assertEquals(Color.Blue, image.toPixelMap()[50, 50])
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTestHelper.kt b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTestHelper.kt
index 687792c..b940919 100644
--- a/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTestHelper.kt
+++ b/compose/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/painter/PainterTestHelper.kt
@@ -40,4 +40,4 @@
draw(size, alpha = alpha, colorFilter = colorFilter)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidColorSpace.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidColorSpace.android.kt
index 37086be..6ce4ba6 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidColorSpace.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidColorSpace.android.kt
@@ -188,4 +188,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidImageBitmap.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidImageBitmap.android.kt
index 93d2f9c..d4d66bf 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidImageBitmap.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidImageBitmap.android.kt
@@ -209,4 +209,4 @@
@JvmStatic
internal fun Bitmap.composeColorSpace() =
colorSpace?.toComposeColorSpace() ?: ColorSpaces.Srgb
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPaint.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPaint.android.kt
index 2f76400..7d50ef1 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPaint.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPaint.android.kt
@@ -267,4 +267,4 @@
fun setBlendMode(paint: NativePaint, mode: BlendMode) {
paint.blendMode = mode.toAndroidBlendMode()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPathEffect.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPathEffect.android.kt
index 70ab861..d1c062e 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPathEffect.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidPathEffect.android.kt
@@ -63,4 +63,4 @@
StampedPathEffectStyle.Rotate -> PathDashPathEffect.Style.ROTATE
StampedPathEffectStyle.Translate -> PathDashPathEffect.Style.TRANSLATE
else -> PathDashPathEffect.Style.TRANSLATE
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidShader.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidShader.android.kt
index cac1f02..f90333b 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidShader.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidShader.android.kt
@@ -202,4 +202,4 @@
" equal length."
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidTileMode.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidTileMode.android.kt
index 256ac61..2ac1aa4 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidTileMode.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidTileMode.android.kt
@@ -67,4 +67,4 @@
@DoNotInline
fun getComposeTileModeDecal() = TileMode.Decal
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidVertexMode.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidVertexMode.android.kt
index d86c1b3..c8e779e 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidVertexMode.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/AndroidVertexMode.android.kt
@@ -21,4 +21,4 @@
VertexMode.TriangleStrip -> android.graphics.Canvas.VertexMode.TRIANGLE_STRIP
VertexMode.TriangleFan -> android.graphics.Canvas.VertexMode.TRIANGLE_FAN
else -> android.graphics.Canvas.VertexMode.TRIANGLES
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/CanvasUtils.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/CanvasUtils.android.kt
index 3f3d9ac..bcb4623 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/CanvasUtils.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/CanvasUtils.android.kt
@@ -98,4 +98,4 @@
canvas.disableZ()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/RectHelper.android.kt b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/RectHelper.android.kt
index 9537090..cc1160f 100644
--- a/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/RectHelper.android.kt
+++ b/compose/ui/ui-graphics/src/androidMain/kotlin/androidx/compose/ui/graphics/RectHelper.android.kt
@@ -76,4 +76,4 @@
* specified in the given [android.graphics.Rect]
*/
fun android.graphics.Rect.toComposeIntRect(): IntRect =
- IntRect(left, top, right, bottom)
\ No newline at end of file
+ IntRect(left, top, right, bottom)
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/BlendMode.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/BlendMode.kt
index 9bee6bc..f18f1d4 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/BlendMode.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/BlendMode.kt
@@ -501,4 +501,4 @@
* to be supported as it is the default drawing algorithm. If a [BlendMode] that is not supported
* is used, the default of SrcOver is consumed instead.
*/
-expect fun BlendMode.isSupported(): Boolean
\ No newline at end of file
+expect fun BlendMode.isSupported(): Boolean
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Brush.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Brush.kt
index 5f7a1d0..f236731 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Brush.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Brush.kt
@@ -666,4 +666,4 @@
if (p.shader != shader) p.shader = shader
if (p.alpha != alpha) p.alpha = alpha
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Canvas.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Canvas.kt
index 64d8783..d327689 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Canvas.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Canvas.kt
@@ -595,4 +595,4 @@
* @see enableZ
*/
fun disableZ()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
index bf442bc..0ce5481 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
@@ -669,4 +669,4 @@
* Return the color
*/
operator fun invoke(): Color
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorFilter.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorFilter.kt
index 6d45d4d..b615d1e 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorFilter.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorFilter.kt
@@ -72,4 +72,4 @@
internal expect fun actualColorMatrixColorFilter(colorMatrix: ColorMatrix): ColorFilter
-internal expect fun actualLightingColorFilter(multiply: Color, add: Color): ColorFilter
\ No newline at end of file
+internal expect fun actualLightingColorFilter(multiply: Color, add: Color): ColorFilter
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorMatrix.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorMatrix.kt
index ceed6c4..bb9218b 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorMatrix.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ColorMatrix.kt
@@ -325,4 +325,4 @@
this[2, 1] = 1.772f
this[2, 2] = 0f
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Degrees.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Degrees.kt
index bf2f08d..a03da8f 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Degrees.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Degrees.kt
@@ -24,4 +24,4 @@
* Converts [radians] to degrees.
*/
@PublishedApi
-internal fun degrees(radians: Float): Float = RadiansToDegrees * radians
\ No newline at end of file
+internal fun degrees(radians: Float): Float = RadiansToDegrees * radians
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ExperimentalGraphicsApi.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ExperimentalGraphicsApi.kt
index 909c69d..68f132e 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ExperimentalGraphicsApi.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ExperimentalGraphicsApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalGraphicsApi
\ No newline at end of file
+annotation class ExperimentalGraphicsApi
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/FilterQuality.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/FilterQuality.kt
index 3c121d0..0329619 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/FilterQuality.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/FilterQuality.kt
@@ -61,4 +61,4 @@
High -> "High"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Float16.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Float16.kt
index 7d57a93..03ae3d0 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Float16.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Float16.kt
@@ -735,4 +735,4 @@
return Float16.NaN
}
return if (x >= y) x else y
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ImageBitmap.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ImageBitmap.kt
index a18cb7a1..7ad7d5d 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ImageBitmap.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/ImageBitmap.kt
@@ -34,10 +34,10 @@
/** The number of image pixels along the ImageBitmap's vertical axis. */
val height: Int
- /** ColorSpace the Image renders in **/
+ /** ColorSpace the Image renders in */
val colorSpace: ColorSpace
- /** Determines whether or not the ImageBitmap contains an alpha channel **/
+ /** Determines whether or not the ImageBitmap contains an alpha channel */
val hasAlpha: Boolean
/**
@@ -258,4 +258,4 @@
config,
hasAlpha,
colorSpace
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt
index 23a0b022..b3079b7 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt
@@ -437,4 +437,4 @@
}
}
return true
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PaintingStyle.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PaintingStyle.kt
index 6a5e40d..20787937 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PaintingStyle.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PaintingStyle.kt
@@ -50,4 +50,4 @@
Stroke -> "Stroke"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathEffect.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathEffect.kt
index 3002f19..c70d534 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathEffect.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathEffect.kt
@@ -140,4 +140,4 @@
Morph -> "Morph"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathFillType.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathFillType.kt
index 8edcf83..495e199 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathFillType.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathFillType.kt
@@ -56,4 +56,4 @@
EvenOdd -> "EvenOdd"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathOperation.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathOperation.kt
index 0cef450..3dde746 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathOperation.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathOperation.kt
@@ -150,4 +150,4 @@
)
)
val PathOperation.Companion.xor: PathOperation
- get() = Xor
\ No newline at end of file
+ get() = Xor
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PixelMap.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PixelMap.kt
index 3f4d673..8212167 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PixelMap.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PixelMap.kt
@@ -51,4 +51,4 @@
/*@IntRange(from = 0)*/
y: Int
): Color = Color(buffer[bufferOffset + y * stride + x])
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PointMode.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PointMode.kt
index e7d5e4e..78d3d51 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PointMode.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PointMode.kt
@@ -67,4 +67,4 @@
Polygon -> "Polygon"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/RenderEffect.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/RenderEffect.kt
index 62b0c8f..30ebfe3 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/RenderEffect.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/RenderEffect.kt
@@ -77,4 +77,4 @@
expect class OffsetEffect(
renderEffect: RenderEffect?,
offset: Offset
-) : RenderEffect
\ No newline at end of file
+) : RenderEffect
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shader.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shader.kt
index 85217ee..59fc72c 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shader.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shader.kt
@@ -127,4 +127,4 @@
image: ImageBitmap,
tileModeX: TileMode,
tileModeY: TileMode
-): Shader
\ No newline at end of file
+): Shader
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shadow.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shadow.kt
index 296eb18..c628042 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shadow.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Shadow.kt
@@ -87,4 +87,4 @@
lerp(start.offset, stop.offset, fraction),
lerp(start.blurRadius, stop.blurRadius, fraction)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/StrokeJoin.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/StrokeJoin.kt
index 780239b..5eb6122 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/StrokeJoin.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/StrokeJoin.kt
@@ -52,4 +52,4 @@
Bevel -> "Bevel"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/TileMode.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/TileMode.kt
index ead07c5..b6cbeaa 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/TileMode.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/TileMode.kt
@@ -89,4 +89,4 @@
* and [TileMode.Mirror] are guaranteed to be supported. If a [TileMode] that is not supported is
* used, the default of [TileMode.Clamp] is consumed instead.
*/
-expect fun TileMode.isSupported(): Boolean
\ No newline at end of file
+expect fun TileMode.isSupported(): Boolean
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/VertexMode.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/VertexMode.kt
index f49997d..6a3c3a4 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/VertexMode.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/VertexMode.kt
@@ -50,4 +50,4 @@
TriangleFan -> "TriangleFan"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Vertices.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Vertices.kt
index d8f495cc..2938e56 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Vertices.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Vertices.kt
@@ -72,4 +72,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Adaptation.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Adaptation.kt
index fb26363..2c8bd5a 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Adaptation.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Adaptation.kt
@@ -85,4 +85,4 @@
override fun toString() = "Ciecat02"
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel.kt
index 497b1d4..8e71d85 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorModel.kt
@@ -86,4 +86,4 @@
Cmyk -> "Cmyk"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
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 1a70b69..a754e16 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
@@ -793,4 +793,4 @@
val LMS =
floatArrayOf(dstLMS[0] / srcLMS[0], dstLMS[1] / srcLMS[1], dstLMS[2] / srcLMS[2])
return mul3x3(inverse3x3(matrix), mul3x3Diag(LMS, matrix))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces.kt
index 6de2bd53..15c35b8 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpaces.kt
@@ -342,4 +342,4 @@
Unspecified,
Oklab
)
-}
\ No newline at end of file
+}
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 a0b1d63..dfe2401 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
@@ -336,4 +336,4 @@
internal val OklabToSrgbPerceptual =
Connector(ColorSpaces.Oklab, ColorSpaces.Srgb, RenderIntent.Perceptual)
}
-}
\ No newline at end of file
+}
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 ece22df..c644c9f 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
@@ -77,4 +77,4 @@
val E = WhitePoint(0.33333f, 0.33333f)
internal val D50Xyz = floatArrayOf(0.964212f, 1.0f, 0.825188f)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/RenderIntent.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/RenderIntent.kt
index eac73ba..4ebb599 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/RenderIntent.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/RenderIntent.kt
@@ -74,4 +74,4 @@
Absolute -> "Absolute"
else -> "Unknown"
}
-}
\ No newline at end of file
+}
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 4ded76b..fb50d9a 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
@@ -1393,4 +1393,4 @@
*/
internal fun interface DoubleFunction {
operator fun invoke(double: Double): Double
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters.kt
index bba82bb..c20f30a 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/TransferParameters.kt
@@ -96,4 +96,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Xyz.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Xyz.kt
index 44b7753..08a24df 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Xyz.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Xyz.kt
@@ -76,4 +76,4 @@
private fun clamp(x: Float): Float {
return x.coerceIn(-2f, 2f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/CanvasDrawScope.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/CanvasDrawScope.kt
index 5367870..c3a722e 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/CanvasDrawScope.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/CanvasDrawScope.kt
@@ -803,4 +803,4 @@
override fun transform(matrix: Matrix) {
this@asDrawTransform.canvas.concat(matrix)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawContext.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawContext.kt
index baea999..1bad45c 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawContext.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawContext.kt
@@ -72,4 +72,4 @@
var density: Density
get() = DefaultDensity
set(_) {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.kt
index 5649083..7ef2dc3 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.kt
@@ -1014,4 +1014,4 @@
override fun toString(): String {
return "Stroke(width=$width, miter=$miter, cap=$cap, join=$join, pathEffect=$pathEffect)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScopeMarker.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScopeMarker.kt
index 62c789f..6701060 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScopeMarker.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawScopeMarker.kt
@@ -20,4 +20,4 @@
* DSL marker used to distinguish between drawing operations and canvas transform operations
*/
@DslMarker
-annotation class DrawScopeMarker
\ No newline at end of file
+annotation class DrawScopeMarker
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawTransform.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawTransform.kt
index 0aedc6ff..18e2fdf 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawTransform.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/DrawTransform.kt
@@ -175,4 +175,4 @@
* @param matrix transformation matrix used to transform the drawing environment
*/
fun transform(matrix: Matrix)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/EmptyCanvas.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/EmptyCanvas.kt
index a22662d..cdebed0 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/EmptyCanvas.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/drawscope/EmptyCanvas.kt
@@ -160,4 +160,4 @@
override fun disableZ() {
throw UnsupportedOperationException()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.kt
index 1fdfcc3..e6691cb 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.graphics.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter.kt
index acbb7ca..68373e2 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter.kt
@@ -155,4 +155,4 @@
return "BitmapPainter(image=$image, srcOffset=$srcOffset, srcSize=$srcSize, " +
"filterQuality=$filterQuality)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BrushPainter.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BrushPainter.kt
index cfd8419..9aeb295 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BrushPainter.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/BrushPainter.kt
@@ -65,4 +65,4 @@
override fun toString(): String {
return "BrushPainter(brush=$brush)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/ColorPainter.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/ColorPainter.kt
index 9572548..63bc727 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/ColorPainter.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/ColorPainter.kt
@@ -64,4 +64,4 @@
* Drawing a color does not have an intrinsic size, return [Size.Unspecified] here
*/
override val intrinsicSize: Size = Size.Unspecified
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/Painter.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/Painter.kt
index cad2d23..e95e4b8 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/Painter.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/painter/Painter.kt
@@ -214,4 +214,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathBuilder.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathBuilder.kt
index 3848e3f..8754a23 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathBuilder.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathBuilder.kt
@@ -110,4 +110,4 @@
nodes.add(node)
return this
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathNode.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathNode.kt
index b9546e2..536eb5b 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathNode.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/PathNode.kt
@@ -396,4 +396,4 @@
private const val NUM_REFLECTIVE_CURVE_TO_ARGS = 4
private const val NUM_QUAD_TO_ARGS = 4
private const val NUM_REFLECTIVE_QUAD_TO_ARGS = 2
-private const val NUM_ARC_TO_ARGS = 7
\ No newline at end of file
+private const val NUM_ARC_TO_ARGS = 7
diff --git a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/ColorMatrixTest.kt b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/ColorMatrixTest.kt
index 1a2e8fa..3b5cfcd 100644
--- a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/ColorMatrixTest.kt
+++ b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/ColorMatrixTest.kt
@@ -338,4 +338,4 @@
assertEquals(i.toFloat(), ret[i], 0.0f)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/MatrixTest.kt b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/MatrixTest.kt
index 957d351..a146a65 100644
--- a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/MatrixTest.kt
+++ b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/MatrixTest.kt
@@ -274,4 +274,4 @@
return true
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/RenderEffectTest.kt b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/RenderEffectTest.kt
index dcec7d9..665f3b7 100644
--- a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/RenderEffectTest.kt
+++ b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/RenderEffectTest.kt
@@ -166,4 +166,4 @@
renderEffect.toString()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/colorspace/ColorModelTest.kt b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/colorspace/ColorModelTest.kt
index 914c15f..89e32b9 100644
--- a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/colorspace/ColorModelTest.kt
+++ b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/colorspace/ColorModelTest.kt
@@ -49,4 +49,4 @@
assertEquals("Cmyk", ColorModel.Cmyk.toString())
assertEquals(4, ColorModel.Cmyk.componentCount)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/vector/PathParserTest.kt b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/vector/PathParserTest.kt
index fc55c77..62efd24 100644
--- a/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/vector/PathParserTest.kt
+++ b/compose/ui/ui-graphics/src/commonTest/kotlin/androidx/compose/ui/graphics/vector/PathParserTest.kt
@@ -196,4 +196,4 @@
override fun op(path1: Path, path2: Path, operation: PathOperation): Boolean = false
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/desktopMain/kotlin/androidx/compose/ui/graphics/DesktopImageConverters.desktop.kt b/compose/ui/ui-graphics/src/desktopMain/kotlin/androidx/compose/ui/graphics/DesktopImageConverters.desktop.kt
index 8ead9ef..dad395a 100644
--- a/compose/ui/ui-graphics/src/desktopMain/kotlin/androidx/compose/ui/graphics/DesktopImageConverters.desktop.kt
+++ b/compose/ui/ui-graphics/src/desktopMain/kotlin/androidx/compose/ui/graphics/DesktopImageConverters.desktop.kt
@@ -257,4 +257,4 @@
bitmap.allocPixels(ImageInfo.makeS32(width, height, ColorAlphaType.UNPREMUL))
bitmap.installPixels(pixels)
return bitmap.asComposeImageBitmap()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/desktopTest/kotlin/androidx/compose/ui/graphics/DesktopGraphicsTest.kt b/compose/ui/ui-graphics/src/desktopTest/kotlin/androidx/compose/ui/graphics/DesktopGraphicsTest.kt
index 5c9a60a..5be1b32 100644
--- a/compose/ui/ui-graphics/src/desktopTest/kotlin/androidx/compose/ui/graphics/DesktopGraphicsTest.kt
+++ b/compose/ui/ui-graphics/src/desktopTest/kotlin/androidx/compose/ui/graphics/DesktopGraphicsTest.kt
@@ -48,4 +48,4 @@
fun teardown() {
_surface?.close()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/jvmMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/ui/ui-graphics/src/jvmMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.jvm.kt
index 6c78dbb..03d40a0 100644
--- a/compose/ui/ui-graphics/src/jvmMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/ui/ui-graphics/src/jvmMain/kotlin/androidx/compose/ui/graphics/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.graphics.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/BlendMode.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/BlendMode.skiko.kt
index 4bd3882..9a56c52 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/BlendMode.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/BlendMode.skiko.kt
@@ -48,4 +48,4 @@
BlendMode.Luminosity -> org.jetbrains.skia.BlendMode.LUMINOSITY
// Always fallback to default blendmode of src over
else -> org.jetbrains.skia.BlendMode.SRC_OVER
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Matrices.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Matrices.skiko.kt
index 9a7f904..14fedd7 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Matrices.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Matrices.skiko.kt
@@ -22,4 +22,4 @@
1f, 0f, 0f,
0f, 1f, 0f,
0f, 0f, 1f
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Rects.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Rects.skiko.kt
index 196e43c..02b79b0 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Rects.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/Rects.skiko.kt
@@ -46,4 +46,4 @@
radii[7] = bottomLeftCornerRadius.y
return org.jetbrains.skia.RRect.makeComplexLTRB(left, top, right, bottom, radii)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedCanvas.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedCanvas.skiko.kt
index 9ea4923..d79674b 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedCanvas.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedCanvas.skiko.kt
@@ -395,4 +395,4 @@
FilterQuality.High -> CubicResampler(1 / 3.0f, 1 / 3.0f)
else -> FilterMipmap(FilterMode.NEAREST, MipmapMode.NONE)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPaint.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPaint.skiko.kt
index 08811b8..4bfc05f 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPaint.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPaint.skiko.kt
@@ -146,4 +146,4 @@
}
}
-actual fun BlendMode.isSupported(): Boolean = true
\ No newline at end of file
+actual fun BlendMode.isSupported(): Boolean = true
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPath.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPath.skiko.kt
index 0285785..3aa30a0 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPath.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPath.skiko.kt
@@ -272,4 +272,4 @@
v[Matrix.Perspective1] = persp1 // 7
v[8] = v8 // 8
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathEffect.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathEffect.skiko.kt
index cd96db9..619f7c2 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathEffect.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathEffect.skiko.kt
@@ -63,4 +63,4 @@
StampedPathEffectStyle.Rotate -> SkPathEffect.Style.ROTATE
StampedPathEffectStyle.Translate -> SkPathEffect.Style.TRANSLATE
else -> SkPathEffect.Style.TRANSLATE
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathMeasure.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathMeasure.skiko.kt
index 810a409..d1efe79 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathMeasure.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedPathMeasure.skiko.kt
@@ -75,4 +75,4 @@
}
actual fun PathMeasure(): PathMeasure =
- SkiaBackedPathMeasure()
\ No newline at end of file
+ SkiaBackedPathMeasure()
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedRenderEffect.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedRenderEffect.skiko.kt
index 8d6e519..cea1bb0 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedRenderEffect.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaBackedRenderEffect.skiko.kt
@@ -150,4 +150,4 @@
override fun toString(): String {
return "OffsetEffect(renderEffect=$renderEffect, offset=$offset)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaColorFilter.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaColorFilter.skiko.kt
index 2e598a0..e68afc6 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaColorFilter.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaColorFilter.skiko.kt
@@ -41,4 +41,4 @@
)
internal actual fun actualLightingColorFilter(multiply: Color, add: Color): ColorFilter =
- ColorFilter(SkiaColorFilter.makeLighting(multiply.toArgb(), add.toArgb()))
\ No newline at end of file
+ ColorFilter(SkiaColorFilter.makeLighting(multiply.toArgb(), add.toArgb()))
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaImageAsset.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaImageAsset.skiko.kt
index 3c3b207..afef2c7 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaImageAsset.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaImageAsset.skiko.kt
@@ -156,4 +156,4 @@
ColorSpaces.DisplayP3 -> org.jetbrains.skia.ColorSpace.displayP3
else -> org.jetbrains.skia.ColorSpace.sRGB
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaShader.skiko.kt b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaShader.skiko.kt
index 856aab6..7ba6809 100644
--- a/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaShader.skiko.kt
+++ b/compose/ui/ui-graphics/src/skikoMain/kotlin/androidx/compose/ui/graphics/SkiaShader.skiko.kt
@@ -95,4 +95,4 @@
" equal length."
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/build.gradle b/compose/ui/ui-inspection/build.gradle
index 9ee96cd9..551b880 100644
--- a/compose/ui/ui-inspection/build.gradle
+++ b/compose/ui/ui-inspection/build.gradle
@@ -26,7 +26,9 @@
}
dependencies {
- implementation("androidx.annotation:annotation:1.1.0")
+ implementation("androidx.annotation:annotation:1.1.0", {
+ exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
+ })
// Following dependencies will be provided by inspected app itself
// because compose:ui-inspector can be run only in app with compose:ui:ui
// thus all its transitive dependencies will be present too.
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/LambdaLocationTest.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/LambdaLocationTest.kt
index b98fc6fdd..cd23a61 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/LambdaLocationTest.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/LambdaLocationTest.kt
@@ -45,4 +45,4 @@
assertThat(LambdaLocation.resolve(TestLambdas.unnamed))
.isEqualTo(LambdaLocation("TestLambdas.kt", 35, 35))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/RecompositionTest.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/RecompositionTest.kt
index 368db56..8c38ba9 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/RecompositionTest.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/RecompositionTest.kt
@@ -194,4 +194,4 @@
return node.childrenList.any { hasText(it, parameters, predicate) }
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/inspector/SynthesizedLambdaNameTest.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/inspector/SynthesizedLambdaNameTest.kt
index a6b8baf..c7acb19 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/inspector/SynthesizedLambdaNameTest.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/inspector/SynthesizedLambdaNameTest.kt
@@ -67,4 +67,4 @@
}
private fun name(lambda: Any) = lambda.javaClass.name
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/proto/ComposeExtensionsTest.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/proto/ComposeExtensionsTest.kt
index 0d47862..c7fb0d1 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/proto/ComposeExtensionsTest.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/proto/ComposeExtensionsTest.kt
@@ -27,4 +27,4 @@
assertThat(findLambdaSelector("com.example.Class\$f1\$3\$2"))
.isEqualTo("3$2")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
index 7e66fc6..83372bf 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/ComposeInspectionRule.kt
@@ -124,4 +124,4 @@
suspend fun InspectorTester.sendCommand(command: Command): Response {
return Response.parseFrom(sendCommand(command.toByteArray()))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/JvmtiRule.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/JvmtiRule.kt
index 21982eb..3cbe6bf 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/JvmtiRule.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/rules/JvmtiRule.kt
@@ -39,4 +39,4 @@
override fun before() {
ensureInitialised()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/ParametersTestActivity.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/ParametersTestActivity.kt
index 282d0a1..1600fb3 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/ParametersTestActivity.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/ParametersTestActivity.kt
@@ -87,4 +87,4 @@
@Composable
fun SomeContent(content: @Composable () -> Unit) = content()
-internal fun testClickHandler() {}
\ No newline at end of file
+internal fun testClickHandler() {}
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/RippleTestActivity.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/RippleTestActivity.kt
index 04f415b..7b0aa4a 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/RippleTestActivity.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/RippleTestActivity.kt
@@ -22,7 +22,9 @@
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.clickable
import androidx.compose.foundation.indication
+import androidx.compose.foundation.interaction.Interaction
import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
@@ -31,14 +33,25 @@
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.unit.dp
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.flowOf
class RippleTestActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Column {
- val interactionSource = remember { MutableInteractionSource() }
+ // Always pressed interaction source to trigger creating a ripple view immediately
+ val interactionSource = remember {
+ object : MutableInteractionSource {
+ override suspend fun emit(interaction: Interaction) {}
+ override fun tryEmit(interaction: Interaction) = true
+ override val interactions: Flow<Interaction>
+ get() = flowOf(PressInteraction.Press(Offset.Zero))
+ }
+ }
Text(
text = "Click me with indication",
modifier = Modifier
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/TestActivity.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/TestActivity.kt
index fa9f5b7..4a10d8e 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/TestActivity.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/testdata/TestActivity.kt
@@ -18,4 +18,4 @@
import androidx.activity.ComponentActivity
-class TestActivity : ComponentActivity()
\ No newline at end of file
+class TestActivity : ComponentActivity()
diff --git a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/util/AnchorMapTest.kt b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/util/AnchorMapTest.kt
index e896e92..ddc34af 100644
--- a/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/util/AnchorMapTest.kt
+++ b/compose/ui/ui-inspection/src/androidTest/java/androidx/compose/ui/inspection/util/AnchorMapTest.kt
@@ -56,4 +56,4 @@
override fun equals(other: Any?): Boolean = this === other
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/compose/ComposeExtensions.kt b/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/compose/ComposeExtensions.kt
index c6e0cae..283952a 100644
--- a/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/compose/ComposeExtensions.kt
+++ b/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/compose/ComposeExtensions.kt
@@ -92,4 +92,4 @@
}
next
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/inspector/ReflectionScope.kt b/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/inspector/ReflectionScope.kt
index f58cfe1..4dd88eb 100644
--- a/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/inspector/ReflectionScope.kt
+++ b/compose/ui/ui-inspection/src/main/java/androidx/compose/ui/inspection/inspector/ReflectionScope.kt
@@ -215,4 +215,4 @@
override fun setUpperBounds(typeParameter: KTypeParameter?, bounds: MutableList<KType>?) {
factory.setUpperBounds(typeParameter, bounds)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetector.kt b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetector.kt
index bfa381b..7e6a349 100644
--- a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetector.kt
+++ b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetector.kt
@@ -111,4 +111,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/SuspiciousCompositionLocalModifierReadDetector.kt b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/SuspiciousCompositionLocalModifierReadDetector.kt
index 2c13d25..5c7e102 100644
--- a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/SuspiciousCompositionLocalModifierReadDetector.kt
+++ b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/SuspiciousCompositionLocalModifierReadDetector.kt
@@ -135,4 +135,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetectorTest.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetectorTest.kt
index 191e087..d75769c 100644
--- a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetectorTest.kt
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ModifierNodeInspectablePropertiesDetectorTest.kt
@@ -243,4 +243,4 @@
)
}
}
-/* ktlint-enable max-line-length */
\ No newline at end of file
+/* ktlint-enable max-line-length */
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/MultipleAwaitPointerEventScopesDetectorTest.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/MultipleAwaitPointerEventScopesDetectorTest.kt
index 13bee92..76d37c1 100644
--- a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/MultipleAwaitPointerEventScopesDetectorTest.kt
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/MultipleAwaitPointerEventScopesDetectorTest.kt
@@ -675,4 +675,4 @@
private val WarningMessage
get() = "Warning: ${MultipleAwaitPointerEventScopesDetector.ErrorMessage} " +
"[${MultipleAwaitPointerEventScopesDetector.IssueId}]"
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ReturnFromAwaitPointerEventScopeDetectorTest.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ReturnFromAwaitPointerEventScopeDetectorTest.kt
index e1d4102..faac842 100644
--- a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ReturnFromAwaitPointerEventScopeDetectorTest.kt
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/ReturnFromAwaitPointerEventScopeDetectorTest.kt
@@ -343,4 +343,4 @@
private val WarningMessage: String =
"Warning: ${ReturnFromAwaitPointerEventScopeDetector.ErrorMessage} " +
"[${ReturnFromAwaitPointerEventScopeDetector.IssueId}]"
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/UiStubs.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/UiStubs.kt
index e32d2e1..eef686d 100644
--- a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/UiStubs.kt
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/UiStubs.kt
@@ -239,4 +239,4 @@
RcwkYbaKJ5jbB9Mo4ek+UhqOxjONjEbhL7J1D8vfAwAA
"""
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ApplySnapshotImmediatelyTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ApplySnapshotImmediatelyTest.kt
index af7875e..241f990 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ApplySnapshotImmediatelyTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ApplySnapshotImmediatelyTest.kt
@@ -100,4 +100,4 @@
assertStateIs(1, 1, 2)
assertDisplayIs(1, 1, 2)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResourceTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResourceTest.kt
index a72d7b8..4101860 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResourceTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeIdlingResourceTest.kt
@@ -172,4 +172,4 @@
private enum class AnimationStates {
From,
To
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeTestRuleWaitUntilTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeTestRuleWaitUntilTest.kt
index 3652cf4..3da62e9 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeTestRuleWaitUntilTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/ComposeTestRuleWaitUntilTest.kt
@@ -145,4 +145,4 @@
rule.waitUntilDoesNotExist(hasTestTag(TestTag), timeoutMillis = Timeout)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/FirstDrawTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/FirstDrawTest.kt
index b92a5fd..a683209 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/FirstDrawTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/FirstDrawTest.kt
@@ -97,4 +97,4 @@
// The compose view was off-screen, so it hasn't drawn yet
assertThat(drawn).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/LateSetContentTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/LateSetContentTest.kt
index cd9d26c..461e776 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/LateSetContentTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/LateSetContentTest.kt
@@ -49,4 +49,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/TimeOutTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/TimeOutTest.kt
index 6986851..46788f9 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/TimeOutTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/TimeOutTest.kt
@@ -198,4 +198,4 @@
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/WaitUntilNodeCountTest.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/WaitUntilNodeCountTest.kt
index 9fc70a6..0d78ba2 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/WaitUntilNodeCountTest.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/WaitUntilNodeCountTest.kt
@@ -145,4 +145,4 @@
waitUntilDoesNotExist(hasTestTag(TestTag), timeoutMillis = Timeout)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/util/BoundaryNodes.kt b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/util/BoundaryNodes.kt
index a7dd618..e5d04e7 100644
--- a/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/util/BoundaryNodes.kt
+++ b/compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/util/BoundaryNodes.kt
@@ -34,4 +34,4 @@
testTag: String
) {
Column(Modifier.testTag(testTag)) {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.android.kt b/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.android.kt
index 22d4156..e535136 100644
--- a/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.android.kt
+++ b/compose/ui/ui-test-junit4/src/androidMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.android.kt
@@ -32,4 +32,4 @@
::runOnUiThread
) {
internal val hasAwaiters = frameClock.hasAwaiters
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/desktopMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.desktop.kt b/compose/ui/ui-test-junit4/src/desktopMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.desktop.kt
index 75d023f..5b21f1b 100644
--- a/compose/ui/ui-test-junit4/src/desktopMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.desktop.kt
+++ b/compose/ui/ui-test-junit4/src/desktopMain/kotlin/androidx/compose/ui/test/junit4/MainTestClockImpl.desktop.kt
@@ -27,4 +27,4 @@
testScheduler,
frameDelayMillis,
::runOnUiThread
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-test-junit4/src/desktopTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt b/compose/ui/ui-test-junit4/src/desktopTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt
index aef2e84..0dd6f32 100644
--- a/compose/ui/ui-test-junit4/src/desktopTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt
+++ b/compose/ui/ui-test-junit4/src/desktopTest/kotlin/androidx/compose/ui/test/ComposeUiTestTest.kt
@@ -121,4 +121,4 @@
companion object Key : CoroutineContext.Key<TestCoroutineContextElement>
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/AbstractMainTestClock.kt b/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/AbstractMainTestClock.kt
index 3028a20..3557dfa 100644
--- a/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/AbstractMainTestClock.kt
+++ b/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/AbstractMainTestClock.kt
@@ -74,4 +74,4 @@
testScheduler.runCurrent()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/UncaughtExceptionHandler.jvm.kt b/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/UncaughtExceptionHandler.jvm.kt
index 9efd549..5518d55 100644
--- a/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/UncaughtExceptionHandler.jvm.kt
+++ b/compose/ui/ui-test-junit4/src/jvmMain/kotlin/androidx/compose/ui/test/junit4/UncaughtExceptionHandler.jvm.kt
@@ -75,4 +75,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/GradleDebugConfigurationDetector.kt b/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/GradleDebugConfigurationDetector.kt
index f5ed65b..2a56a77 100644
--- a/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/GradleDebugConfigurationDetector.kt
+++ b/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/GradleDebugConfigurationDetector.kt
@@ -115,4 +115,4 @@
}
return ""
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/TestManifestIssueRegistry.kt b/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/TestManifestIssueRegistry.kt
index a0b10da..4baeef0 100644
--- a/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/TestManifestIssueRegistry.kt
+++ b/compose/ui/ui-test-manifest-lint/src/main/java/androidx/compose/ui/test/manifest/lint/TestManifestIssueRegistry.kt
@@ -29,4 +29,4 @@
identifier = "androidx.compose.ui.test.manifest",
vendorName = "Android Open Source Project",
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/ApiLintVersionsTest.kt b/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/ApiLintVersionsTest.kt
index 18aaae3..f04f18b 100644
--- a/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/ApiLintVersionsTest.kt
+++ b/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/ApiLintVersionsTest.kt
@@ -42,4 +42,4 @@
// Since we don't publish this lint registry, minApi can match the api version.
Assert.assertEquals("registry.minApi matches registry.api", 10, registry.minApi)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/GradleDebugConfigurationDetectorTest.kt b/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/GradleDebugConfigurationDetectorTest.kt
index 172f6d9..1aa3977 100644
--- a/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/GradleDebugConfigurationDetectorTest.kt
+++ b/compose/ui/ui-test-manifest-lint/src/test/java/androix/compose/ui/test/manifest/lint/GradleDebugConfigurationDetectorTest.kt
@@ -235,4 +235,4 @@
""".trimIndent()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertExistsTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertExistsTest.kt
index 776d826..4b564b4 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertExistsTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertExistsTest.kt
@@ -104,4 +104,4 @@
.assertDoesNotExist()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertsTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertsTest.kt
index 7ac558d..8dc6de9 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertsTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/AssertsTest.kt
@@ -158,4 +158,4 @@
fun BoundaryNode(props: (SemanticsPropertyReceiver.() -> Unit)) {
Column(Modifier.semantics(properties = props)) {}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/CallSemanticsActionTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/CallSemanticsActionTest.kt
index a380a02..b977aee 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/CallSemanticsActionTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/CallSemanticsActionTest.kt
@@ -71,4 +71,4 @@
fun BoundaryNode(props: (SemanticsPropertyReceiver.() -> Unit)) {
Column(Modifier.semantics(properties = props)) {}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ErrorMessagesTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ErrorMessagesTest.kt
index 4596f86..53d6400 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ErrorMessagesTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ErrorMessagesTest.kt
@@ -419,4 +419,4 @@
content = composable
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FindersTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FindersTest.kt
index 0a19723..f27d346 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FindersTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FindersTest.kt
@@ -281,4 +281,4 @@
fun BoundaryNode(props: (SemanticsPropertyReceiver.() -> Unit)) {
Column(Modifier.semantics(properties = props)) {}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FocusActionsTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FocusActionsTest.kt
index 63b09bb..9a98258 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FocusActionsTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/FocusActionsTest.kt
@@ -62,4 +62,4 @@
rule.onNodeWithTag(tag(1)).assertIsFocused()
rule.onNodeWithTag(tag(0)).assertIsNotFocused()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/PrintToStringTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/PrintToStringTest.kt
index e8b9d96..431eb9c 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/PrintToStringTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/PrintToStringTest.kt
@@ -283,4 +283,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TestMonotonicFrameClockTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TestMonotonicFrameClockTest.kt
index f5f336f..24a0b3db 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TestMonotonicFrameClockTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TestMonotonicFrameClockTest.kt
@@ -599,4 +599,4 @@
private companion object {
const val FrameDelayNanos = 16_000_000L
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TextActionsTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TextActionsTest.kt
index 6be0f40..090d8b2 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TextActionsTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/TextActionsTest.kt
@@ -362,4 +362,4 @@
assertThat(actionPerformed).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/actions/ScrollToIndexTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/actions/ScrollToIndexTest.kt
index b92608e..a13191a 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/actions/ScrollToIndexTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/actions/ScrollToIndexTest.kt
@@ -118,4 +118,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/assertions/AssertAnyTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/assertions/AssertAnyTest.kt
index 50a9ca0..27feb9b 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/assertions/AssertAnyTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/assertions/AssertAnyTest.kt
@@ -92,4 +92,4 @@
.assertAny(hasTestTag("Child"))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveWithHistoryTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveWithHistoryTest.kt
index 719b1f7..5185442 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveWithHistoryTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveWithHistoryTest.kt
@@ -151,4 +151,4 @@
rule.waitForIdle()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyAncestorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyAncestorTest.kt
index df67328..585fbae 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyAncestorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyAncestorTest.kt
@@ -118,4 +118,4 @@
rule.onNode(hasAnyAncestor(hasTestTag("Child")))
.assertDoesNotExist()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyChildTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyChildTest.kt
index b6c1c80..5a415b8 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyChildTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyChildTest.kt
@@ -114,4 +114,4 @@
rule.onNode(hasAnyChild(hasAnyChild(hasTestTag("Child"))))
.assert(hasTestTag("Parent"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyDescendantTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyDescendantTest.kt
index c98ec7f..70f1988 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyDescendantTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnyDescendantTest.kt
@@ -91,4 +91,4 @@
rule.onAllNodes(hasAnyDescendant(hasTestTag("Child")))
.assertCountEquals(3) // Parent, Parent2 and root
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnySiblingTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnySiblingTest.kt
index 5178fee..1975f2c 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnySiblingTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasAnySiblingTest.kt
@@ -154,4 +154,4 @@
rule.onNode(hasParent(hasAnySibling(hasTestTag("ParentSibling"))))
.assert(hasTestTag("Me"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasParentTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasParentTest.kt
index 0ecda22..6855853 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasParentTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/predicates/HasParentTest.kt
@@ -110,4 +110,4 @@
rule.onNode(hasParent(hasParent(hasTestTag("Parent"))))
.assert(hasTestTag("Child"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AddIndexSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AddIndexSelectorTest.kt
index faef8f6..742ee99 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AddIndexSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AddIndexSelectorTest.kt
@@ -116,4 +116,4 @@
.assertExists()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AncestorsSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AncestorsSelectorTest.kt
index 8b35a6e..ab51b59 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AncestorsSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/AncestorsSelectorTest.kt
@@ -94,4 +94,4 @@
.onAncestors()
.assertCountEquals(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildSelectorTest.kt
index 22e9c6a..40979dd 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildSelectorTest.kt
@@ -92,4 +92,4 @@
.assertExists()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildrenSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildrenSelectorTest.kt
index 0403487..673125d 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildrenSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ChildrenSelectorTest.kt
@@ -64,4 +64,4 @@
.onChildren()
.assertCountEquals(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterSelectorTest.kt
index 4a78db7..4769eba 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterSelectorTest.kt
@@ -88,4 +88,4 @@
.filter(hasTestTag("Child"))
.assertCountEquals(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterToOneSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterToOneSelectorTest.kt
index 129c653..0349ed9 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterToOneSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/FilterToOneSelectorTest.kt
@@ -113,4 +113,4 @@
.assertExists()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/LastNodeSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/LastNodeSelectorTest.kt
index a78777d..7947e42 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/LastNodeSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/LastNodeSelectorTest.kt
@@ -82,4 +82,4 @@
.assertExists()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ParentSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ParentSelectorTest.kt
index 1733f78..e6cbd90 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ParentSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/ParentSelectorTest.kt
@@ -79,4 +79,4 @@
.assertExists()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingSelectorTest.kt
index aeefb12..0524551 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingSelectorTest.kt
@@ -99,4 +99,4 @@
.onSibling()
.assertExists()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingsSelectorTest.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingsSelectorTest.kt
index 7332ead..2bbd799 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingsSelectorTest.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/selectors/SiblingsSelectorTest.kt
@@ -81,4 +81,4 @@
get(1).assert(hasTestTag("Child3"))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/BoundaryNodes.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/BoundaryNodes.kt
index 1b7f84e..4cdc70f 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/BoundaryNodes.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/BoundaryNodes.kt
@@ -35,4 +35,4 @@
modifier: Modifier = Modifier
) {
Column(modifier.testTag(testTag)) {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/Output.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/Output.kt
index a67ef92..abfb166 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/Output.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/Output.kt
@@ -50,4 +50,4 @@
}
throw AssertionError("No AssertionError thrown!")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestCounter.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestCounter.kt
index 9fac117..65979dd 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestCounter.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestCounter.kt
@@ -31,4 +31,4 @@
}
count = expected
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestTextField.kt b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestTextField.kt
index f687d45..e3895eb 100644
--- a/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestTextField.kt
+++ b/compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/TestTextField.kt
@@ -58,4 +58,4 @@
)
Text("$textContent ${textState.value.text}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/InputEventRecorder.kt b/compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/InputEventRecorder.kt
index 5c6b49d..fbbfd11 100644
--- a/compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/InputEventRecorder.kt
+++ b/compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/InputEventRecorder.kt
@@ -40,4 +40,4 @@
" not ${event::class.simpleName}")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt b/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
index fd9bb58..1099245 100644
--- a/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
+++ b/compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidImageHelpers.android.kt
@@ -157,4 +157,4 @@
}
}
return getActivity().window
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Assertions.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Assertions.kt
index 6c9e153..0c8cbbf 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Assertions.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Assertions.kt
@@ -353,4 +353,4 @@
internal expect fun SemanticsNode.clippedNodeBoundsInWindow(): Rect
-internal expect fun SemanticsNode.isInScreenBounds(): Boolean
\ No newline at end of file
+internal expect fun SemanticsNode.isInScreenBounds(): Boolean
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Expect.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Expect.kt
index c0f1810..02a2ef6 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Expect.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Expect.kt
@@ -31,4 +31,4 @@
* if (identityHashCode(midVal) < identityHashCode(leftVal)) ...
* ```
*/
-internal expect fun identityHashCode(instance: Any?): Int
\ No newline at end of file
+internal expect fun identityHashCode(instance: Any?): Int
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MainTestClock.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MainTestClock.kt
index 3a9447e..8e8f17d 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MainTestClock.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MainTestClock.kt
@@ -171,4 +171,4 @@
/**
* Thrown in cases where Compose test can't satisfy a condition in a defined time limit.
*/
-class ComposeTimeoutException(message: String?) : Throwable(message)
\ No newline at end of file
+class ComposeTimeoutException(message: String?) : Throwable(message)
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Selectors.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Selectors.kt
index 79c3652..d6d6fd3 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Selectors.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Selectors.kt
@@ -188,4 +188,4 @@
useUnmergedTree,
selector.addSelectorViaMatcher("filterToOne", matcher)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsMatcher.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsMatcher.kt
index c89f100..6f02c1b 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsMatcher.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsMatcher.kt
@@ -89,4 +89,4 @@
!matcher(it)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider.kt
index 32a03fe..2b23130 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider.kt
@@ -59,4 +59,4 @@
matcher: SemanticsMatcher,
useUnmergedTree: Boolean = false
): SemanticsNodeInteractionCollection
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsSelector.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsSelector.kt
index d89cc1c3..95d44b4 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsSelector.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/SemanticsSelector.kt
@@ -150,4 +150,4 @@
) { nodes ->
SelectionResult(nodes.filter { matcher.matches(it) })
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/TextActions.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/TextActions.kt
index 53c81a7..4c0f408 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/TextActions.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/TextActions.kt
@@ -141,4 +141,4 @@
// Duplicate the stack trace to make troubleshooting easier.
stackTrace = cause.stackTrace
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Utils.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Utils.kt
index 48a1de6..90535cb 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Utils.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Utils.kt
@@ -39,4 +39,4 @@
}
return null
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/DelayPropagatingContinuationInterceptorWrapper.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/DelayPropagatingContinuationInterceptorWrapper.kt
index 9a502ff..20212ac 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/DelayPropagatingContinuationInterceptorWrapper.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/DelayPropagatingContinuationInterceptorWrapper.kt
@@ -39,4 +39,4 @@
ContinuationInterceptor,
// Coroutines will internally use the Default dispatcher as the delay if the
// ContinuationInterceptor does not implement Delay.
- Delay by ((wrappedInterceptor as? Delay) ?: (Dispatchers.Default as Delay))
\ No newline at end of file
+ Delay by ((wrappedInterceptor as? Delay) ?: (Dispatchers.Default as Delay))
diff --git a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.kt b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.kt
index ac2f018..76f5774 100644
--- a/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.test.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopAssertions.desktop.kt b/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopAssertions.desktop.kt
index f0ab8f2..375a472 100644
--- a/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopAssertions.desktop.kt
+++ b/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopAssertions.desktop.kt
@@ -29,4 +29,4 @@
internal actual fun SemanticsNode.isInScreenBounds(): Boolean {
TODO()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt b/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt
index 1d82eff..9514264 100644
--- a/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt
+++ b/compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt
@@ -144,4 +144,4 @@
override fun onDispose() {
batchedEvents.clear()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/Expect.jvm.kt b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/Expect.jvm.kt
index a436456..4fb8bc9 100644
--- a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/Expect.jvm.kt
+++ b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/Expect.jvm.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.test
-internal actual fun identityHashCode(instance: Any?): Int = System.identityHashCode(instance)
\ No newline at end of file
+internal actual fun identityHashCode(instance: Any?): Int = System.identityHashCode(instance)
diff --git a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/FrameDeferringContinuationInterceptor.kt b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/FrameDeferringContinuationInterceptor.kt
index 2ff66a0..7613ca4 100644
--- a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/FrameDeferringContinuationInterceptor.kt
+++ b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/FrameDeferringContinuationInterceptor.kt
@@ -195,4 +195,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.jvm.kt
index 699d0af..457d9d6 100644
--- a/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/ui/ui-test/src/jvmMain/kotlin/androidx/compose/ui/test/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.test.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/KeyEventsTest.kt b/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/KeyEventsTest.kt
index d39cd3f..0216a50 100644
--- a/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/KeyEventsTest.kt
+++ b/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/KeyEventsTest.kt
@@ -517,4 +517,4 @@
recorder.events[2].verifyKeyEvent(keyDown, key.nativeKeyCode)
recorder.events[3].verifyKeyEvent(keyUp, key.nativeKeyCode)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/multimodal/KeyAndMouseEventsTest.kt b/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/multimodal/KeyAndMouseEventsTest.kt
index 757d1c5..6d52228 100644
--- a/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/multimodal/KeyAndMouseEventsTest.kt
+++ b/compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/multimodal/KeyAndMouseEventsTest.kt
@@ -450,4 +450,4 @@
recorder.events[12].verifyMouseEvent(MotionEvent.ACTION_BUTTON_PRESS, 0L,
Offset.Zero, MotionEvent.BUTTON_PRIMARY)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text-google-fonts/src/androidTest/java/androidx/compose/ui/text/googlefonts/GoogleFontTest.kt b/compose/ui/ui-text-google-fonts/src/androidTest/java/androidx/compose/ui/text/googlefonts/GoogleFontTest.kt
index 54a390c..dff7ae0 100644
--- a/compose/ui/ui-text-google-fonts/src/androidTest/java/androidx/compose/ui/text/googlefonts/GoogleFontTest.kt
+++ b/compose/ui/ui-text-google-fonts/src/androidTest/java/androidx/compose/ui/text/googlefonts/GoogleFontTest.kt
@@ -388,4 +388,4 @@
return assetManager.open("ComGoogleAndroidGmsCertificate.dev").use {
it.readBytes()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text-google-fonts/src/main/java/androidx/compose/ui/text/googlefonts/GoogleFont.kt b/compose/ui/ui-text-google-fonts/src/main/java/androidx/compose/ui/text/googlefonts/GoogleFont.kt
index 5af4b91..97ee309 100644
--- a/compose/ui/ui-text-google-fonts/src/main/java/androidx/compose/ui/text/googlefonts/GoogleFont.kt
+++ b/compose/ui/ui-text-google-fonts/src/main/java/androidx/compose/ui/text/googlefonts/GoogleFont.kt
@@ -372,4 +372,4 @@
"usually means the font was attempted to load in a restricted context"
else -> "Unknown error code"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/FrameworkTextLayoutBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/FrameworkTextLayoutBenchmark.kt
index 2765fb0..2d3c075 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/FrameworkTextLayoutBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/FrameworkTextLayoutBenchmark.kt
@@ -128,4 +128,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/HyphensLineBreakBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/HyphensLineBreakBenchmark.kt
index 016ee62..72f0dbc 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/HyphensLineBreakBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/HyphensLineBreakBenchmark.kt
@@ -187,4 +187,4 @@
Hyphens.None -> "None"
Hyphens.Auto -> "Auto"
else -> throw IllegalArgumentException("Unrecognized Hyphens value for this test")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/NonLinearFontScalingBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/NonLinearFontScalingBenchmark.kt
new file mode 100644
index 0000000..915ade6
--- /dev/null
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/NonLinearFontScalingBenchmark.kt
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.ui.text.benchmark
+
+import android.content.Context
+import android.util.TypedValue
+import androidx.benchmark.junit4.BenchmarkRule
+import androidx.benchmark.junit4.measureRepeated
+import androidx.compose.ui.text.Paragraph
+import androidx.compose.ui.text.ParagraphIntrinsics
+import androidx.compose.ui.text.PlatformTextStyle
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.createFontFamilyResolver
+import androidx.compose.ui.text.style.LineHeightStyle
+import androidx.compose.ui.unit.Constraints
+import androidx.compose.ui.unit.Density
+import androidx.compose.ui.unit.em
+import androidx.compose.ui.unit.sp
+import androidx.test.filters.LargeTest
+import androidx.test.platform.app.InstrumentationRegistry
+import com.google.common.truth.Truth.assertThat
+import kotlin.math.ceil
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/**
+ * Tests font rendering performance when using the platform APIs to calculate pixel values for font
+ * sizes under non-linear font scaling.
+ */
+@LargeTest
+@RunWith(Parameterized::class)
+class NonLinearFontScalingBenchmark(
+ private val textLength: Int,
+ fontSizeSp: Int,
+ private val isLineHeightSp: Boolean,
+ private val lineHeightStyle: LineHeightStyle?
+) {
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(
+ name = "length={0} fontSize={1} isLineHeightSp={2} lineHeightStyle={3}"
+ )
+ fun initParameters(): List<Array<Any?>> = cartesian(
+ arrayOf(512),
+ // font size
+ arrayOf(8, 30),
+ // isLineHeightSp. This helps us verify that the calculation to keep line heights
+ // proportional doesn't affect performance too much. (see b/273326061)
+ arrayOf(false, true),
+ arrayOf(LineHeightStyle.Default)
+ )
+ }
+
+ @get:Rule
+ val benchmarkRule = BenchmarkRule()
+
+ @get:Rule
+ val textBenchmarkRule = TextBenchmarkTestRule(Alphabet.Latin)
+
+ private lateinit var instrumentationContext: Context
+
+ // Width initialized in setup().
+ private var width: Float = 0f
+ private val fontSize = fontSizeSp.sp
+
+ @Before
+ fun setup() {
+ instrumentationContext = InstrumentationRegistry.getInstrumentation().context
+ width = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ textBenchmarkRule.widthDp,
+ instrumentationContext.resources.displayMetrics
+ )
+ }
+
+ private fun text(textGenerator: RandomTextGenerator): String {
+ return textGenerator.nextParagraph(textLength) + "\n"
+ }
+
+ private fun paragraph(
+ text: String,
+ width: Float,
+ density: Density
+ ): Paragraph {
+ return Paragraph(
+ paragraphIntrinsics = paragraphIntrinsics(text, density),
+ constraints = Constraints(maxWidth = ceil(width).toInt())
+ )
+ }
+
+ private fun paragraphIntrinsics(text: String, density: Density): ParagraphIntrinsics {
+ assertThat(fontSize.isSp).isTrue()
+
+ @Suppress("DEPRECATION")
+ val style = if (isLineHeightSp) {
+ TextStyle(
+ fontSize = fontSize,
+ lineHeight = fontSize * 2,
+ lineHeightStyle = lineHeightStyle,
+ platformStyle = PlatformTextStyle(includeFontPadding = false)
+ )
+ } else {
+ TextStyle(
+ fontSize = fontSize,
+ lineHeight = 2.em,
+ lineHeightStyle = lineHeightStyle,
+ platformStyle = PlatformTextStyle(includeFontPadding = false)
+ )
+ }
+
+ return ParagraphIntrinsics(
+ text = text,
+ density = density,
+ style = style,
+ fontFamilyResolver = createFontFamilyResolver(instrumentationContext)
+ )
+ }
+
+ @Test
+ fun nonLinearfontScaling1x_construct() {
+ val density = Density(
+ instrumentationContext.resources.displayMetrics.density,
+ fontScale = 1f
+ )
+
+ textBenchmarkRule.generator { textGenerator ->
+ benchmarkRule.measureRepeated {
+ val text = runWithTimingDisabled {
+ // create a new paragraph and use a smaller width to get
+ // some line breaking in the result
+ text(textGenerator)
+ }
+
+ paragraph(text = text, width = width, density = density)
+ }
+ }
+ }
+
+ @Test
+ fun nonLinearfontScaling2x_construct() {
+ val density = Density(
+ instrumentationContext.resources.displayMetrics.density,
+ fontScale = 2f
+ )
+
+ textBenchmarkRule.generator { textGenerator ->
+ benchmarkRule.measureRepeated {
+ val text = runWithTimingDisabled {
+ // create a new paragraph and use a smaller width to get
+ // some line breaking in the result
+ text(textGenerator)
+ }
+
+ paragraph(text = text, width = width, density = density)
+ }
+ }
+ }
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphBenchmark.kt
index 02c2151..efd0149 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphBenchmark.kt
@@ -212,4 +212,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphMethodBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphMethodBenchmark.kt
index e5bbed1..1078156 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphMethodBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphMethodBenchmark.kt
@@ -177,4 +177,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphWithLineHeightBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphWithLineHeightBenchmark.kt
index 9ac6a7a..113a102 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphWithLineHeightBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/ParagraphWithLineHeightBenchmark.kt
@@ -136,4 +136,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/TextMeasurerBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/TextMeasurerBenchmark.kt
index 27e9cb6..07b7d03 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/TextMeasurerBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/TextMeasurerBenchmark.kt
@@ -193,4 +193,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/font/PlatformFontLookup.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/font/PlatformFontLookup.kt
index 6bfae1e..5de37b2 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/font/PlatformFontLookup.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/font/PlatformFontLookup.kt
@@ -80,4 +80,4 @@
fontFamilyResolver.resolve(fontFamily, fontWeight)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/EditProcessorBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/EditProcessorBenchmark.kt
index da8dcd1..14de92a 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/EditProcessorBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/EditProcessorBenchmark.kt
@@ -104,4 +104,4 @@
ep.apply(scenario.ops)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/GapBufferBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/GapBufferBenchmark.kt
index bc37b08..1c0e20d 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/GapBufferBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/input/GapBufferBenchmark.kt
@@ -107,4 +107,4 @@
buffer.toString()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/intl/LocaleListBenchmark.kt b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/intl/LocaleListBenchmark.kt
index 58c3c4c..04625f6 100644
--- a/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/intl/LocaleListBenchmark.kt
+++ b/compose/ui/ui-text/benchmark/src/androidTest/java/androidx/compose/ui/text/benchmark/intl/LocaleListBenchmark.kt
@@ -48,4 +48,4 @@
fun create() {
benchmarkRule.measureRepeated { LocaleList(languageTag) }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/benchmark/src/main/java/androidx/compose/ui/text/benchmark/TextBenchmarkTestRule.kt b/compose/ui/ui-text/benchmark/src/main/java/androidx/compose/ui/text/benchmark/TextBenchmarkTestRule.kt
index 6f7f876..d6d5f13 100644
--- a/compose/ui/ui-text/benchmark/src/main/java/androidx/compose/ui/text/benchmark/TextBenchmarkTestRule.kt
+++ b/compose/ui/ui-text/benchmark/src/main/java/androidx/compose/ui/text/benchmark/TextBenchmarkTestRule.kt
@@ -128,4 +128,4 @@
fun <T> generator(block: (generator: RandomTextGenerator) -> T): T {
return block(textGenerator)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/TextMotionSamples.kt b/compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/TextMotionSamples.kt
index 7fbf0de..4e67915 100644
--- a/compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/TextMotionSamples.kt
+++ b/compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/TextMotionSamples.kt
@@ -57,4 +57,4 @@
// Provide it via style argument but make sure that we are copying from current theme
style = LocalTextStyle.current.copy(textMotion = TextMotion.Animated)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/AndroidParagraphTextDirectionTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/AndroidParagraphTextDirectionTest.kt
index 1268ee3..fabf7eb 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/AndroidParagraphTextDirectionTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/AndroidParagraphTextDirectionTest.kt
@@ -148,4 +148,4 @@
resolveTextDirectionHeuristics(textDirection = TextDirection.ContentOrRtl)
).isEqualTo(LayoutCompat.TEXT_DIRECTION_FIRST_STRONG_RTL)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/CacheTextLayoutInputTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/CacheTextLayoutInputTest.kt
index 43d704c..8efe719 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/CacheTextLayoutInputTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/CacheTextLayoutInputTest.kt
@@ -225,4 +225,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTextDirectionTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTextDirectionTest.kt
index fd2538f..3eb3630 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTextDirectionTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/MultiParagraphIntegrationTextDirectionTest.kt
@@ -289,4 +289,4 @@
fontFamilyResolver = UncachedFontFamilyResolver(context)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphFillBoundingBoxesTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphFillBoundingBoxesTest.kt
index d802b37..0b3797d 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphFillBoundingBoxesTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphFillBoundingBoxesTest.kt
@@ -645,4 +645,4 @@
fontFamilyResolver = fontFamilyResolver
) as AndroidParagraph
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationBoundingBoxTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationBoundingBoxTest.kt
index c72f952..4bcf7d6 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationBoundingBoxTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationBoundingBoxTest.kt
@@ -433,4 +433,4 @@
LineBreakFrom.First to "\u05D0\u05D2\u05D2\n\u05D3\u05D4\u05D5 \u05D0\u05D2\u05D2",
LineBreakFrom.Second to "\u05D0\u05D2\u05D2 \u05D3\u05D4\u05D5\n\u05D0\u05D2\u05D2",
)
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationLineHeightStyleTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationLineHeightStyleTest.kt
index 61ce517..8a16caf 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationLineHeightStyleTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationLineHeightStyleTest.kt
@@ -971,4 +971,4 @@
val ascentRatio = ascent / fontMetrics.lineHeight()
return ceil(fontMetrics.lineHeight() * (1f - ascentRatio)).toInt()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationTextDirectionTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationTextDirectionTest.kt
index 6416362..f5bcc9c 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationTextDirectionTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationTextDirectionTest.kt
@@ -108,4 +108,4 @@
assertThat(paragraph.getParagraphDirection(0)).isEqualTo(ResolvedTextDirection.Rtl)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntrinsicIntegrationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntrinsicIntegrationTest.kt
index aa8e859..c01f046 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntrinsicIntegrationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntrinsicIntegrationTest.kt
@@ -214,4 +214,4 @@
fontFamilyResolver = UncachedFontFamilyResolver(context)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphPlaceholderIntegrationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphPlaceholderIntegrationTest.kt
index 8ff62fd..7164432 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphPlaceholderIntegrationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphPlaceholderIntegrationTest.kt
@@ -580,4 +580,4 @@
fontFamilyResolver = UncachedFontFamilyResolver(context)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformParagraphStyleTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformParagraphStyleTest.kt
index 09d8375..ed011c4 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformParagraphStyleTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformParagraphStyleTest.kt
@@ -161,4 +161,4 @@
EmojiSupportMatch.Default
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformSpanStyleTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformSpanStyleTest.kt
index ef9afe5..db6d77d 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformSpanStyleTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformSpanStyleTest.kt
@@ -98,4 +98,4 @@
assertThat(style).isEqualTo(otherStyle)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformTextStyleTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformTextStyleTest.kt
index 8aa22e0..a398665 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformTextStyleTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/PlatformTextStyleTest.kt
@@ -131,4 +131,4 @@
assertThat(mergedStyle.platformStyle?.paragraphStyle?.includeFontPadding).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextLayoutCacheTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextLayoutCacheTest.kt
index 14984f1..bbd9b52 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextLayoutCacheTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextLayoutCacheTest.kt
@@ -318,4 +318,4 @@
constraints = constraints
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerTest.kt
index dcbf9bb..404da84 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerTest.kt
@@ -425,4 +425,4 @@
skipCache = skipCache
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextPainterTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextPainterTest.kt
index b847c51..36f3cd5 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextPainterTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextPainterTest.kt
@@ -659,4 +659,4 @@
)
return bitmap
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextTestExtensions.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextTestExtensions.kt
index 2799025..4a8357a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextTestExtensions.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextTestExtensions.kt
@@ -253,4 +253,4 @@
}
}
}.toTypedArray()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TtsAnnotationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TtsAnnotationTest.kt
index f2d9d40..46f07b45 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TtsAnnotationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TtsAnnotationTest.kt
@@ -37,4 +37,4 @@
assertThat(ttsSpan.args.size()).isEqualTo(1)
assertThat(ttsSpan.args.getString(TtsSpan.ARG_VERBATIM)).isEqualTo(verbatim)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontTest.kt
index d5390c5..940c489 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontTest.kt
@@ -189,4 +189,4 @@
// don't care about result, but it's not supposed to throw
font.typefaceLoader.loadBlocking(context, font)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontUtilsTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontUtilsTest.kt
index 765f066..b4b4ca9 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontUtilsTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/AndroidFontUtilsTest.kt
@@ -51,4 +51,4 @@
.isEqualTo(Typeface.BOLD_ITALIC)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsageTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsageTest.kt
index d42258b..9c8b80e 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsageTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsageTest.kt
@@ -171,4 +171,4 @@
return Typeface.SERIF
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFontTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFontTest.kt
index 260ad83..61d402a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFontTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFontTest.kt
@@ -104,4 +104,4 @@
}
return fontName
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverFileTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverFileTest.kt
index daf1c07..cb1d84c 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverFileTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverFileTest.kt
@@ -125,4 +125,4 @@
assertThat(typeface.bitmap("~")).isNotEqualToBitmap(defaultTypeface.bitmap("~"))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplCancellationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplCancellationTest.kt
index cbf8603..157daa7 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplCancellationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplCancellationTest.kt
@@ -28,7 +28,7 @@
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.test.TestCoroutineDispatcher
+import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.runCurrent
import org.junit.After
@@ -54,10 +54,8 @@
fun setup() {
asyncTypefaceCache = AsyncTypefaceCache()
typefaceRequestCache = TypefaceRequestCache()
- val dispatcher = TestCoroutineDispatcher()
- scope = TestCoroutineScope(dispatcher).also {
- dispatcher.pauseDispatcher()
- }
+ val dispatcher = StandardTestDispatcher()
+ scope = TestCoroutineScope(dispatcher)
val injectedContext = scope.coroutineContext.minusKey(CoroutineExceptionHandler)
subject = FontFamilyResolverImpl(
fontLoader,
@@ -100,4 +98,4 @@
val afterCache = currentCacheItem()
assertThat(afterCache).isImmutableTypefaceOf(Typeface.DEFAULT)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplPreloadTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplPreloadTest.kt
index ad5dbea..92e6b14 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplPreloadTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplPreloadTest.kt
@@ -32,9 +32,9 @@
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
+import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
-import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runCurrent
import org.junit.Before
@@ -187,7 +187,7 @@
fun preload_errorsOnTimeout() {
val font = AsyncFauxFont(typefaceLoader, FontWeight.Normal, FontStyle.Normal)
val fallbackFont = AsyncFauxFont(typefaceLoader, FontWeight.Normal, FontStyle.Normal)
- val dispatcher = TestCoroutineDispatcher()
+ val dispatcher = StandardTestDispatcher()
val testScope = TestCoroutineScope(dispatcher)
val fontFamily = FontFamily(
@@ -195,7 +195,10 @@
fallbackFont
)
val deferred = testScope.async { subject.preload(fontFamily) }
- testScope.advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ testScope.testScheduler.apply {
+ advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ runCurrent()
+ }
assertThat(deferred.isCompleted).isTrue()
testScope.runBlockingTest {
deferred.await() // actually throw here
@@ -305,4 +308,4 @@
// other font chain semantics are tested directly, preload is just checking that we don't
// trigger async work when it's not necessary
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplTest.kt
index 2dcdb87..6a0b85b 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolverImplTest.kt
@@ -777,4 +777,4 @@
val typeface = resolveAsTypeface(fontFamily, FontWeight.W400)
assertThat(typeface).isSameInstanceAs(Typeface.SERIF)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolver_androidKtTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolver_androidKtTest.kt
index 880eebb..61c9d2b 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolver_androidKtTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontFamilyResolver_androidKtTest.kt
@@ -37,4 +37,4 @@
val result = subject.resolveAsTypeface(font.toFontFamily())
assertThat(result.value).isSameInstanceAs(SANS_SERIF)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterPreloadTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterPreloadTest.kt
index 44a252f..c3ddac1 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterPreloadTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterPreloadTest.kt
@@ -33,7 +33,6 @@
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
-import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runBlockingTest
import org.junit.After
import org.junit.Before
@@ -194,7 +193,10 @@
subject.preload(fontFamily, fontLoader)
}
assertThat(typefaceLoader.pendingRequests()).containsExactly(asyncFont)
- scope.advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ scope.testScheduler.apply {
+ advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ runCurrent()
+ }
scope.runBlockingTest {
preloadJob.await()
}
@@ -319,4 +321,4 @@
assertThat(preloadJob.isActive).isFalse()
assertThat(typefaceLoader.completedRequests()).containsExactly(optionalFont)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterTest.kt
index e5de0d1..7a5bd38 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapterTest.kt
@@ -40,9 +40,8 @@
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.runBlocking
-import kotlinx.coroutines.test.TestCoroutineDispatcher
+import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
-import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runCurrent
@@ -71,10 +70,8 @@
@Before
fun setup() {
cache = AsyncTypefaceCache()
- val dispatcher = TestCoroutineDispatcher()
- scope = TestCoroutineScope(dispatcher).also {
- dispatcher.pauseDispatcher()
- }
+ val dispatcher = StandardTestDispatcher()
+ scope = TestCoroutineScope(dispatcher)
val injectedContext = scope.coroutineContext.minusKey(CoroutineExceptionHandler)
subject = FontListFontFamilyTypefaceAdapter(cache, injectedContext)
typefaceLoader = AsyncTestTypefaceLoader()
@@ -290,7 +287,10 @@
assertThat(it).currentAsyncTypefaceValue(Typeface.DEFAULT)
},
doCompleteAsync = {
- scope.advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ scope.testScheduler.apply {
+ advanceTimeBy(Font.MaximumAsyncTimeoutMillis)
+ runCurrent()
+ }
scope.runCurrent()
typefaceLoader.completeOne(asyncFontFallback, expected)
}
@@ -492,9 +492,7 @@
// make another paused dispatcher
// it's important that this test uses paused dispatchers to allow us control of runtime
// ordering
- val newDispatcher = TestCoroutineDispatcher().also {
- it.pauseDispatcher()
- }
+ val newDispatcher = StandardTestDispatcher()
subject = FontListFontFamilyTypefaceAdapter(injectedContext = newDispatcher)
@@ -510,7 +508,7 @@
)
scope.runCurrent()
- newDispatcher.runCurrent()
+ newDispatcher.scheduler.runCurrent()
assertThat(typefaceLoader.pendingRequests()).containsExactly(asyncFont)
typefaceLoader.completeOne(asyncFont, Typeface.SERIF)
@@ -519,7 +517,7 @@
assertThat(result).currentAsyncTypefaceValue(Typeface.DEFAULT)
// correct scope run completes
- newDispatcher.runCurrent()
+ newDispatcher.scheduler.runCurrent()
assertThat(finalResult.isActive).isFalse()
assertThat(result).currentAsyncTypefaceValue(Typeface.SERIF)
scope.runBlockingTest {
@@ -774,4 +772,4 @@
}
assertThat(asyncResult).currentAsyncTypefaceValue(Typeface.DEFAULT)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontSynthesisTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontSynthesisTest.kt
index fcff7c3..2a2ab2a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontSynthesisTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/FontSynthesisTest.kt
@@ -169,4 +169,4 @@
Truth.assertThat(typeface500.isBold).isFalse()
Truth.assertThat(typeface600.isBold).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapterTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapterTest.kt
index e5296c7..25c0ce2 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapterTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapterTest.kt
@@ -267,4 +267,4 @@
assertThat(calledWith).isEmpty()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformTypefacesTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformTypefacesTest.kt
index 6e3e298..6fd8979 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformTypefacesTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/PlatformTypefacesTest.kt
@@ -207,4 +207,4 @@
assertThat(genericFontFamilyTypeface).isEqualTo(optionalOnDeviceFontFamilyTypeface)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/testutils/AsyncTestFonts.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/testutils/AsyncTestFonts.kt
index 9f24373..a462530 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/testutils/AsyncTestFonts.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/font/testutils/AsyncTestFonts.kt
@@ -165,4 +165,4 @@
override fun toString(): String {
return "$name[$weight, $style]"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/BackspaceCommandTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/BackspaceCommandTest.kt
index 9d05c2b..829ce54 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/BackspaceCommandTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/BackspaceCommandTest.kt
@@ -130,4 +130,4 @@
assertThat(eb.cursor).isEqualTo(0)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/MoveCursorCommandTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/MoveCursorCommandTest.kt
index 849d7f8..3713066 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/MoveCursorCommandTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/MoveCursorCommandTest.kt
@@ -169,4 +169,4 @@
assertThat(eb.cursor).isEqualTo(2 * FAMILY.length)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleListTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleListTest.kt
index d43cf4e..9dd17dd 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleListTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleListTest.kt
@@ -70,4 +70,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleTest.kt
index 44ecab1..5a95254 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/intl/LocaleTest.kt
@@ -59,4 +59,4 @@
assertThat(Locale("sr-Latn-SR")).isEqualTo(Locale("sr-Latn-SR"))
assertThat(Locale("sr-Latn-SR")).isNotEqualTo(Locale("sr-Cyrl-SR"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/BitmapSubject.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/BitmapSubject.kt
index aaa1171..7ccf78d 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/BitmapSubject.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/BitmapSubject.kt
@@ -62,4 +62,4 @@
super.actualCustomStringRepresentation()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/CharSequenceSubject.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/CharSequenceSubject.kt
index 92fb82d..77a996f 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/CharSequenceSubject.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/CharSequenceSubject.kt
@@ -194,4 +194,4 @@
}
}
-internal data class SpanInfo<T : Any>(val span: T, val start: Int, val end: Int, val flags: Int)
\ No newline at end of file
+internal data class SpanInfo<T : Any>(val span: T, val start: Int, val end: Int, val flags: Int)
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/ComposeMatchers.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/ComposeMatchers.kt
index 90b4e7c..bf4621a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/ComposeMatchers.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/ComposeMatchers.kt
@@ -49,4 +49,4 @@
internal fun IntegerSubject.isZero() {
this.isEqualTo(0)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/TypefaceResultSubject.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/TypefaceResultSubject.kt
index 4a95dbe..066baf9 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/TypefaceResultSubject.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/matchers/TypefaceResultSubject.kt
@@ -70,4 +70,4 @@
is Async ->
"TypefaceResult.Immutable(currentState=${subject.current.value})"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableStringTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableStringTest.kt
index 9c0efcb..8976a8b 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableStringTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableStringTest.kt
@@ -421,4 +421,4 @@
assertThat(spannable1).isNotSameInstanceAs(spannable2)
assertThat(urlSpan1).isSameInstanceAs(urlSpan2)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsicsTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsicsTest.kt
index 8e9a930..6cd30ec 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsicsTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsicsTest.kt
@@ -90,4 +90,4 @@
fontState.value = true
assertThat(subject.hasStaleResolvedFonts).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceCacheTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceCacheTest.kt
index 162b8b0..daa999be 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceCacheTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceCacheTest.kt
@@ -48,4 +48,4 @@
AndroidTypefaceCache.getOrCreate(context, FontTestData.FONT_200_REGULAR)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceSubsetTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceSubsetTest.kt
index 0410d86..0f8c137 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceSubsetTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceSubsetTest.kt
@@ -130,4 +130,4 @@
// The italic font is not loaded, so querying Italic will return Normal font.
assertThat(typefaceFromSubset).isTypefaceOf(FontWeight.Normal, FontStyle.Normal)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceTest.kt
index 9df4326..8ea1d54 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceTest.kt
@@ -587,4 +587,4 @@
return Mockito.argThat { arg: Any ->
arg is Int || arg is FontStyle
} as FontStyle? ?: FontStyle.Normal
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/EmojiCompatStatusTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/EmojiCompatStatusTest.kt
index 3d15326..db0c29a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/EmojiCompatStatusTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/EmojiCompatStatusTest.kt
@@ -151,4 +151,4 @@
config.setMetadataLoadStrategy(LOAD_STRATEGY_MANUAL)
return config to deferred
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/GenericFontFamilyCacheTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/GenericFontFamilyCacheTest.kt
index 121461be..0daffb0 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/GenericFontFamilyCacheTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/GenericFontFamilyCacheTest.kt
@@ -52,4 +52,4 @@
typeface.getNativeTypeface(FontWeight.Bold, FontStyle.Italic, FontSynthesis.None)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt
index 2ec8bcb..653562a 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt
@@ -600,4 +600,4 @@
it.foregroundColor == Color.Red.toArgb()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextPaintExtensionsTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextPaintExtensionsTest.kt
index b7cdc5e3..1a0eceb78 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextPaintExtensionsTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextPaintExtensionsTest.kt
@@ -425,4 +425,4 @@
assertThat(tp.flags and TextPaint.SUBPIXEL_TEXT_FLAG).isEqualTo(0)
assertThat(tp.hinting).isEqualTo(TextPaint.HINTING_OFF)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextTestExtensions.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextTestExtensions.kt
index 3717a8e..20f5522 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextTestExtensions.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/TextTestExtensions.kt
@@ -56,4 +56,4 @@
width = text.length * fontSize * 1.5f
)
return layout.bitmap()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/HyphensTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/HyphensTest.kt
index aa850f8..c3469bf 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/HyphensTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/HyphensTest.kt
@@ -55,4 +55,4 @@
)
assertThat(brokenLines).isEqualTo(expected)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
index d86dfa9..040414c 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/LineBreakTest.kt
@@ -248,4 +248,4 @@
assertThat(brokenLines).isEqualTo(expectedBrokenLines)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
index a0f3c2a..9077ca0 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/style/TextLineBreaker.kt
@@ -72,4 +72,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidParagraph.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidParagraph.android.kt
index 1eb166c..d4bc7c2 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidParagraph.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidParagraph.android.kt
@@ -617,4 +617,4 @@
val spannable = if (this is Spannable) this else SpannableString(this)
spannable.setSpan(IndentationFixSpan(), spannable.length - 1, spannable.length - 1)
return spannable
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidTextStyle.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidTextStyle.android.kt
index 5aef6b2..67f0518 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidTextStyle.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidTextStyle.android.kt
@@ -293,4 +293,4 @@
fraction: Float
): PlatformSpanStyle {
return start
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/EmojiSupportMatch.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/EmojiSupportMatch.kt
index 51660ef..9e2d651 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/EmojiSupportMatch.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/EmojiSupportMatch.kt
@@ -44,4 +44,4 @@
*/
val None = EmojiSupportMatch(1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.android.kt
index 30c1fc6..4314e40 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.android.kt
@@ -28,4 +28,4 @@
val it = BreakIterator.getCharacterInstance()
it.setText(this)
return it.following(index)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Paragraph.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Paragraph.android.kt
index 2a0538e..251124e 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Paragraph.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Paragraph.android.kt
@@ -76,4 +76,4 @@
drawStyle: DrawStyle?,
blendMode: BlendMode
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFont.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFont.kt
index 98fa359..36e60db 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFont.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFont.kt
@@ -231,4 +231,4 @@
}
// keep generating AndroidFontKt to avoid API change
-private fun generateAndroidFontKtForApiCompatibility() {}
\ No newline at end of file
+private fun generateAndroidFontKtForApiCompatibility() {}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontLoader.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontLoader.android.kt
index 62c270d..57d55a7 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontLoader.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontLoader.android.kt
@@ -82,4 +82,4 @@
}
}, null)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontResolveInterceptor.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontResolveInterceptor.android.kt
index 0c91c61..b56bf6c 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontResolveInterceptor.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontResolveInterceptor.android.kt
@@ -58,4 +58,4 @@
0
}
return AndroidFontResolveInterceptor(fontWeightAdjustment)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontUtils.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontUtils.android.kt
index 2c5633f..12a2f2f 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontUtils.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidFontUtils.android.kt
@@ -70,4 +70,4 @@
@DoNotInline
fun create(typeface: Typeface, finalFontWeight: Int, finalFontStyle: Boolean) =
Typeface.create(typeface, finalFontWeight, finalFontStyle)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidTypeface.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidTypeface.android.kt
index 411ef8a..c06da8f 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidTypeface.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/AndroidTypeface.android.kt
@@ -75,4 +75,4 @@
*/
fun FontFamily(typeface: Typeface): FontFamily {
return FontFamily(Typeface(typeface))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.android.kt
index 24ceb0a..56914a1 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.android.kt
@@ -109,4 +109,4 @@
else -> loader.load(font)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFont.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFont.kt
index c9ae2fc..c6e128c 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFont.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/DeviceFontFamilyNameFont.kt
@@ -130,4 +130,4 @@
override suspend fun awaitLoad(context: Context, font: AndroidFont): Typeface? {
throw UnsupportedOperationException("All preloaded fonts are optional local.")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.android.kt
index 0bcc0a5..e1a83a1 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.android.kt
@@ -66,4 +66,4 @@
}
TypefaceHelperMethodsApi28.create(typeface, finalFontWeight, finalFontStyle)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/PlatformTypefaces.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/PlatformTypefaces.kt
index 4e39b41..b86a1f0 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/PlatformTypefaces.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/font/PlatformTypefaces.kt
@@ -307,4 +307,4 @@
in 8..10 -> "$name-black" // 900 black, fallback 800, no match 1000
else -> name // can't reach
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.android.kt
index d8bb227..1e8f4f3 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.android.kt
@@ -51,4 +51,4 @@
* cancelled.
*/
fun createInputConnection(outAttrs: EditorInfo): InputConnection
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/intl/AndroidLocaleDelegate.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/intl/AndroidLocaleDelegate.android.kt
index 8c3d370..602c01f 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/intl/AndroidLocaleDelegate.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/intl/AndroidLocaleDelegate.android.kt
@@ -81,4 +81,4 @@
override fun parseLanguageTag(languageTag: String): PlatformLocale =
AndroidLocale(JavaLocale.forLanguageTag(languageTag))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt
index f9f160e..0e0bb15 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt
@@ -178,4 +178,4 @@
private object Api28Impl {
@DoNotInline
fun createTypefaceSpan(typeface: Typeface): TypefaceSpan = TypefaceSpan(typeface)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidDefaultTypeface.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidDefaultTypeface.android.kt
index a9ff30a..70f8f41 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidDefaultTypeface.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidDefaultTypeface.android.kt
@@ -51,4 +51,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidGenericFontFamilyTypeface.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidGenericFontFamilyTypeface.android.kt
index 9b0108d..859a17a 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidGenericFontFamilyTypeface.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidGenericFontFamilyTypeface.android.kt
@@ -58,4 +58,4 @@
fontStyle == FontStyle.Italic
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidMultiParagraphDraw.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidMultiParagraphDraw.kt
index 0b86686..8f8c48e 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidMultiParagraphDraw.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidMultiParagraphDraw.kt
@@ -91,4 +91,4 @@
it.paragraph.paint(canvas, brush, alpha, shadow, decoration, drawStyle, blendMode)
canvas.translate(0f, it.paragraph.height)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
index 2fd7809..b3c0f75 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
@@ -123,4 +123,4 @@
private val NoopSpan = object : CharacterStyle() {
override fun updateDrawState(p0: TextPaint?) {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt
index 8dfa683..9a20cf8 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt
@@ -203,4 +203,4 @@
}
private val TextStyle.hasEmojiCompat: Boolean
- get() = platformStyle?.paragraphStyle?.emojiSupportMatch != EmojiSupportMatch.None
\ No newline at end of file
+ get() = platformStyle?.paragraphStyle?.emojiSupportMatch != EmojiSupportMatch.None
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidStringDelegate.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidStringDelegate.android.kt
index 33e1e35..bbaab79 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidStringDelegate.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidStringDelegate.android.kt
@@ -42,4 +42,4 @@
}
internal actual fun ActualStringDelegate(): PlatformStringDelegate =
- AndroidStringDelegate()
\ No newline at end of file
+ AndroidStringDelegate()
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTextPaint.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTextPaint.android.kt
index cc7c683..bfc47eb 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTextPaint.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTextPaint.android.kt
@@ -140,4 +140,4 @@
val alphaInt = alpha.coerceIn(0f, 1f).times(255).roundToInt()
setAlpha(alphaInt)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceWrapper.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceWrapper.android.kt
index 673e6ff..63ff7c7 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceWrapper.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidTypefaceWrapper.android.kt
@@ -36,4 +36,4 @@
): Typeface {
return typeface
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/URLSpanCache.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/URLSpanCache.kt
index a8444ba..f50503b 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/URLSpanCache.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/URLSpanCache.kt
@@ -43,4 +43,4 @@
@Suppress("AcronymName")
fun toURLSpan(urlAnnotation: UrlAnnotation): URLSpan =
spansByAnnotation.getOrPut(urlAnnotation) { URLSpan(urlAnnotation.url) }
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/LocaleExtensions.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/LocaleExtensions.android.kt
index 1148632..16ebd74 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/LocaleExtensions.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/LocaleExtensions.android.kt
@@ -47,4 +47,4 @@
*localeList.map { it.toJavaLocale() }.toTypedArray()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TextPaintExtensions.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TextPaintExtensions.android.kt
index ee6daab..bc686ff 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TextPaintExtensions.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TextPaintExtensions.android.kt
@@ -193,4 +193,4 @@
Float.MIN_VALUE
} else {
blurRadius
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TtsAnnotationExtensions.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TtsAnnotationExtensions.android.kt
index 8066ab1..aa3844a 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TtsAnnotationExtensions.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TtsAnnotationExtensions.android.kt
@@ -29,4 +29,4 @@
fun VerbatimTtsAnnotation.toSpan(): TtsSpan {
val builder = TtsSpan.VerbatimBuilder(verbatim)
return builder.build()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/LineBreak.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/LineBreak.android.kt
index cdd2a88..6bd954f 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/LineBreak.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/LineBreak.android.kt
@@ -336,4 +336,4 @@
private fun unpackByte2(mask: Int) = 0x000000FF and (mask shr 8)
-private fun unpackByte3(mask: Int) = 0x000000FF and (mask shr 16)
\ No newline at end of file
+private fun unpackByte3(mask: Int) = 0x000000FF and (mask shr 16)
diff --git a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/TextMotion.android.kt b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/TextMotion.android.kt
index c508974..eca6c08 100644
--- a/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/TextMotion.android.kt
+++ b/compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/style/TextMotion.android.kt
@@ -94,4 +94,4 @@
else -> "Invalid"
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
index d447d62..3398b6a 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
@@ -1123,4 +1123,4 @@
/**
* Returns an AnnotatedString with empty text and no annotations.
*/
-internal fun emptyAnnotatedString() = EmptyAnnotatedString
\ No newline at end of file
+internal fun emptyAnnotatedString() = EmptyAnnotatedString
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt
index 334935a..a5d2e10 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt
@@ -23,4 +23,4 @@
fun set(value: V)
fun getAndSet(value: V): V
fun compareAndSet(expect: V, newValue: V): Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/CharHelpers.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/CharHelpers.kt
index 11dd57b..661d04e 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/CharHelpers.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/CharHelpers.kt
@@ -26,4 +26,4 @@
* Helper function that returns the following character boundary index. It will return -1 if it
* can't go forward.
*/
-internal expect fun String.findFollowingBreak(index: Int): Int
\ No newline at end of file
+internal expect fun String.findFollowingBreak(index: Int): Int
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ExperimentalTextApi.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ExperimentalTextApi.kt
index b67456b..70f8ef4 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ExperimentalTextApi.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ExperimentalTextApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalTextApi
\ No newline at end of file
+annotation class ExperimentalTextApi
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/InternalTextApi.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/InternalTextApi.kt
index 710ac39..0eea1c1 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/InternalTextApi.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/InternalTextApi.kt
@@ -26,4 +26,4 @@
AnnotationTarget.PROPERTY
)
@Retention(AnnotationRetention.BINARY)
-annotation class InternalTextApi
\ No newline at end of file
+annotation class InternalTextApi
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraphIntrinsics.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraphIntrinsics.kt
index c1839cb..cd86a8f 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraphIntrinsics.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/MultiParagraphIntrinsics.kt
@@ -149,4 +149,4 @@
val intrinsics: ParagraphIntrinsics,
val startIndex: Int,
val endIndex: Int
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Paragraph.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Paragraph.kt
index 8cbe75b..f9d7e81 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Paragraph.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Paragraph.kt
@@ -559,4 +559,4 @@
constraints
)
-internal fun Float.ceilToInt(): Int = ceil(this).toInt()
\ No newline at end of file
+internal fun Float.ceilToInt(): Int = ceil(this).toInt()
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ParagraphIntrinsics.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ParagraphIntrinsics.kt
index b63d2cf..4aa26740 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ParagraphIntrinsics.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/ParagraphIntrinsics.kt
@@ -102,4 +102,4 @@
placeholders = placeholders,
density = density,
fontFamilyResolver = fontFamilyResolver
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Placeholder.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Placeholder.kt
index 7e7f2eb..5e85d27 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Placeholder.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Placeholder.kt
@@ -133,4 +133,4 @@
*/
val TextCenter = PlaceholderVerticalAlign(7)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/PlatformTextStyle.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/PlatformTextStyle.kt
index 549354e..0c8ea32 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/PlatformTextStyle.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/PlatformTextStyle.kt
@@ -94,4 +94,4 @@
start: PlatformSpanStyle,
stop: PlatformSpanStyle,
fraction: Float
-): PlatformSpanStyle
\ No newline at end of file
+): PlatformSpanStyle
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Savers.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Savers.kt
index c5ad4ce..4ebba20 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Savers.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Savers.kt
@@ -418,4 +418,4 @@
private val LocaleSaver = Saver<Locale, Any>(
save = { it.toLanguageTag() },
restore = { Locale(languageTag = it as String) }
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
index 9a92316..c24f8d2 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
@@ -948,4 +948,4 @@
if (platformStyle == null) return other
if (other == null) return platformStyle
return platformStyle.merge(other)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/String.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/String.kt
index 8261b49..4b9b08b 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/String.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/String.kt
@@ -135,4 +135,4 @@
fun String.decapitalize(localeList: LocaleList): String =
if (localeList.isEmpty()) decapitalize(Locale.current) else decapitalize(localeList[0])
-private val stringDelegate = ActualStringDelegate()
\ No newline at end of file
+private val stringDelegate = ActualStringDelegate()
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutResult.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutResult.kt
index cc822d5..584b461 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutResult.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutResult.kt
@@ -600,4 +600,4 @@
"placeholderRects=$placeholderRects" +
")"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurer.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurer.kt
index eb8cef9..533d7eb 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurer.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurer.kt
@@ -409,4 +409,4 @@
return true
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextPainter.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextPainter.kt
index 23f39f9..d215853 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextPainter.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextPainter.kt
@@ -395,4 +395,4 @@
}
return Constraints(minWidth, maxWidth, minHeight, maxHeight)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextRange.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextRange.kt
index 2fbf0a7..6d7115a 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextRange.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextRange.kt
@@ -125,4 +125,4 @@
"end cannot be negative. [start: $start, end: $end]"
}
return packInts(start, end)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TtsAnnotation.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TtsAnnotation.kt
index 95373e8..a66ad82 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TtsAnnotation.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TtsAnnotation.kt
@@ -45,4 +45,4 @@
override fun toString(): String {
return "VerbatimTtsAnnotation(verbatim=$verbatim)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/UrlAnnotation.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/UrlAnnotation.kt
index e47f951..7573ee7 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/UrlAnnotation.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/UrlAnnotation.kt
@@ -37,4 +37,4 @@
override fun toString(): String {
return "UrlAnnotation(url=$url)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/caches/ContainerHelpers.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/caches/ContainerHelpers.kt
index 92676d0..c9a697c 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/caches/ContainerHelpers.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/caches/ContainerHelpers.kt
@@ -46,4 +46,4 @@
}
}
return lo.inv() // value not present
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.kt
index 59636a8..dcf7c54 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/DelegatingFontLoaderForDeprecatedUsage.kt
@@ -23,4 +23,4 @@
)
internal expect fun createFontFamilyResolver(
fontResourceLoader: Font.ResourceLoader
-): FontFamily.Resolver
\ No newline at end of file
+): FontFamily.Resolver
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.kt
index 81bc069..a348a3d 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.kt
@@ -245,4 +245,4 @@
get() = synchronized(lock) {
resultCache.size
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapter.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapter.kt
index 783254f..9d0e94c 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapter.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontListFontFamilyTypefaceAdapter.kt
@@ -424,4 +424,4 @@
put(font, platformFontLoader, it)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontMatcher.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontMatcher.kt
index bca26c5..b227277 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontMatcher.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontMatcher.kt
@@ -162,4 +162,4 @@
): List<Font> {
return matchFont(fontFamily.fonts, fontWeight, fontStyle)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.kt
index 4f6a3d9..70cd4f7f 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.kt
@@ -32,7 +32,7 @@
* [CSS font-synthesis](https://www.w3.org/TR/css-fonts-4/#font-synthesis) property.
*
* @sample androidx.compose.ui.text.samples.FontFamilySynthesisSample
- **/
+ */
@kotlin.jvm.JvmInline
value class FontSynthesis internal constructor(internal val value: Int) {
@@ -98,4 +98,4 @@
font: Font,
requestedWeight: FontWeight,
requestedStyle: FontStyle
-): Any
\ No newline at end of file
+): Any
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontVariation.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontVariation.kt
index 2332e60..bc4f389 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontVariation.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/font/FontVariation.kt
@@ -369,4 +369,4 @@
): Settings {
return Settings(weight(weight.weight), italic(style.value.toFloat()), *settings)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditCommand.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditCommand.kt
index 1b03ee1..f78b444 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditCommand.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditCommand.kt
@@ -560,4 +560,4 @@
* is a Unicode low-surrogate code unit.
*/
private fun isSurrogatePair(high: Char, low: Char): Boolean =
- high.isHighSurrogate() && low.isLowSurrogate()
\ No newline at end of file
+ high.isHighSurrogate() && low.isLowSurrogate()
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditProcessor.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditProcessor.kt
index 09c150e..b8ef202 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditProcessor.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/EditProcessor.kt
@@ -175,4 +175,4 @@
// Do not return toString() by default, since that might contain sensitive text.
else -> "Unknown EditCommand: " + (this::class.simpleName ?: "{anonymous EditCommand}")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeAction.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeAction.kt
index 1ef3163..7b816a1 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeAction.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeAction.kt
@@ -97,4 +97,4 @@
@Stable
val Done: ImeAction = ImeAction(7)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt
index 86152fd..abc8377 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/ImeOptions.kt
@@ -96,4 +96,4 @@
return "ImeOptions(singleLine=$singleLine, capitalization=$capitalization, " +
"autoCorrect=$autoCorrect, keyboardType=$keyboardType, imeAction=$imeAction)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/InputEventCallback.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/InputEventCallback.kt
index 27433de..d6d18d9 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/InputEventCallback.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/InputEventCallback.kt
@@ -38,4 +38,4 @@
*/
@Suppress("CallbackMethodName")
fun onImeAction(imeAction: ImeAction)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization.kt
index 8981899..f9819aa 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/KeyboardCapitalization.kt
@@ -60,4 +60,4 @@
@Stable
val Sentences = KeyboardCapitalization(3)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.kt
index d0851f9..4dcc7fa 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.kt
@@ -20,4 +20,4 @@
* Represents a request to open a platform-specific text input session via
* `PlatformTextInputModifierNode.textInputSession`.
*/
-expect interface PlatformTextInputMethodRequest
\ No newline at end of file
+expect interface PlatformTextInputMethodRequest
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextFieldValue.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextFieldValue.kt
index ed074ba..77f74d1 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextFieldValue.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextFieldValue.kt
@@ -198,4 +198,4 @@
/**
* Returns the currently selected text.
*/
-fun TextFieldValue.getSelectedText(): AnnotatedString = annotatedString.subSequence(selection)
\ No newline at end of file
+fun TextFieldValue.getSelectedText(): AnnotatedString = annotatedString.subSequence(selection)
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.kt
index b49c2e4..f788d98 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.text.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformMultiParagraphDraw.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformMultiParagraphDraw.kt
index 79208ff..a398968 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformMultiParagraphDraw.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformMultiParagraphDraw.kt
@@ -41,4 +41,4 @@
decoration: TextDecoration? = null,
drawStyle: DrawStyle? = null,
blendMode: BlendMode = BlendMode.SrcOver
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformParagraph.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformParagraph.kt
index 3f754003..78815c0 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformParagraph.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformParagraph.kt
@@ -73,4 +73,4 @@
placeholders: List<AnnotatedString.Range<Placeholder>>,
density: Density,
fontFamilyResolver: FontFamily.Resolver
-): ParagraphIntrinsics
\ No newline at end of file
+): ParagraphIntrinsics
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformString.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformString.kt
index 95f3d64..7f5ba3e 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformString.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/platform/PlatformString.kt
@@ -18,4 +18,4 @@
import androidx.compose.ui.text.PlatformStringDelegate
-internal expect fun ActualStringDelegate(): PlatformStringDelegate
\ No newline at end of file
+internal expect fun ActualStringDelegate(): PlatformStringDelegate
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/BaselineShift.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/BaselineShift.kt
index f650511..df1d450 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/BaselineShift.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/BaselineShift.kt
@@ -64,4 +64,4 @@
fraction
)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/LineBreak.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/LineBreak.kt
index 44d49c1..0dea51a3 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/LineBreak.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/LineBreak.kt
@@ -67,4 +67,4 @@
@Stable
val Paragraph: LineBreak
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/ResolvedTextDirection.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/ResolvedTextDirection.kt
index 19f57ab..8e379e8 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/ResolvedTextDirection.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/ResolvedTextDirection.kt
@@ -32,4 +32,4 @@
* Represents the text that is right-to-left.
*/
Rtl
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextForegroundStyle.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextForegroundStyle.kt
index 517236f..f21c244 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextForegroundStyle.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextForegroundStyle.kt
@@ -145,4 +145,4 @@
private fun Float.takeOrElse(block: () -> Float): Float {
return if (this.isNaN()) block() else this
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextMotion.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextMotion.kt
index 145ae70..50d95a5 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextMotion.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextMotion.kt
@@ -40,4 +40,4 @@
*/
val Animated: TextMotion
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
index da392d0..8fc4117 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
@@ -68,4 +68,4 @@
@Stable
val Visible = TextOverflow(3)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.desktop.kt b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.desktop.kt
index ccb4e3f..e9e9e9f 100644
--- a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.desktop.kt
+++ b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/JvmCharHelpers.desktop.kt
@@ -28,4 +28,4 @@
val it = BreakIterator.makeCharacterInstance()
it.setText(this)
return it.following(index)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.desktop.kt b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.desktop.kt
index f2ac5ec..44b8f04 100644
--- a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.desktop.kt
+++ b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/font/FontSynthesis.desktop.kt
@@ -24,4 +24,4 @@
font: Font,
requestedWeight: FontWeight,
requestedStyle: FontStyle
-): Any = typeface
\ No newline at end of file
+): Any = typeface
diff --git a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.desktop.kt b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.desktop.kt
index f1b408d5..503015a 100644
--- a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.desktop.kt
+++ b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputMethodRequest.desktop.kt
@@ -36,4 +36,4 @@
* [Component.getInputMethodRequests] while the session is active.
*/
val inputMethodRequests: InputMethodRequests
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/platform/DesktopStringDelegate.desktop.kt b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/platform/DesktopStringDelegate.desktop.kt
index 87dbb789..8a42784 100644
--- a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/platform/DesktopStringDelegate.desktop.kt
+++ b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/platform/DesktopStringDelegate.desktop.kt
@@ -43,4 +43,4 @@
}
internal actual fun ActualStringDelegate(): PlatformStringDelegate =
- DesktopStringDelegate()
\ No newline at end of file
+ DesktopStringDelegate()
diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/CacheTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/CacheTest.kt
index 0bc44ec..9d1d6b6 100644
--- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/CacheTest.kt
+++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/CacheTest.kt
@@ -126,4 +126,4 @@
Truth.assertThat(cache.map.size)
.isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopFontTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopFontTest.kt
index 155edc2..7c60589 100644
--- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopFontTest.kt
+++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopFontTest.kt
@@ -74,4 +74,4 @@
Truth.assertThat(fontLoader.loadPlatformTypes(loadedFontFamily).aliases)
.isEqualTo(listOf("Sample Font"))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt
index f9c9607..5c1e63a 100644
--- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt
+++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt
@@ -334,4 +334,4 @@
constraints = Constraints(maxWidth = width.ceilToInt()),
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/TestUtils.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/TestUtils.kt
index e283426..79eac26 100644
--- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/TestUtils.kt
+++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/TestUtils.kt
@@ -19,4 +19,4 @@
private val os = System.getProperty("os.name").lowercase()
internal val isLinux = os.startsWith("linux")
internal val isWindows = os.startsWith("win")
-internal val isMacOs = os.startsWith("mac")
\ No newline at end of file
+internal val isMacOs = os.startsWith("mac")
diff --git a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/input/GapBuffer.jvm.kt b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/input/GapBuffer.jvm.kt
index 522fe42..9238ccc 100644
--- a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/input/GapBuffer.jvm.kt
+++ b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/input/GapBuffer.jvm.kt
@@ -24,4 +24,4 @@
) {
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
(this as java.lang.String).getChars(startIndex, endIndex, destination, destinationOffset)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.jvm.kt
index 450447e..88c3269 100644
--- a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.text.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/platform/Synchronization.jvm.kt b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/platform/Synchronization.jvm.kt
index a688db2..9421baf 100644
--- a/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/platform/Synchronization.jvm.kt
+++ b/compose/ui/ui-text/src/jvmMain/kotlin/androidx/compose/ui/text/platform/Synchronization.jvm.kt
@@ -22,4 +22,4 @@
internal actual inline fun <R> synchronized(lock: SynchronizedObject, block: () -> R): R {
return kotlin.synchronized(lock, block)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/DesktopTextStyle.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/DesktopTextStyle.skiko.kt
index bcd4619..c78eb71 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/DesktopTextStyle.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/DesktopTextStyle.skiko.kt
@@ -140,4 +140,4 @@
fraction: Float
): PlatformSpanStyle {
return start
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/Paragraph.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/Paragraph.skiko.kt
index 2a0538e..251124e 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/Paragraph.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/Paragraph.skiko.kt
@@ -76,4 +76,4 @@
drawStyle: DrawStyle?,
blendMode: BlendMode
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.sikio.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.sikio.kt
index 73d9583..4827ba2 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.sikio.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/FontFamilyResolver.sikio.kt
@@ -73,4 +73,4 @@
@OptIn(ExperimentalTextApi::class)
internal fun createFontFamilyResolver(fontCache: FontCache): FontFamily.Resolver {
return FontFamilyResolverImpl(SkiaFontLoader(fontCache))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapter.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapter.skiko.kt
index 22f1e52..10c76dc 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapter.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/PlatformFontFamilyTypefaceAdapter.skiko.kt
@@ -34,4 +34,4 @@
)
return TypefaceResult.Immutable(result)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/SkiaFontLoader.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/SkiaFontLoader.skiko.kt
index ca2e9f6..7ed707a 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/SkiaFontLoader.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/font/SkiaFontLoader.skiko.kt
@@ -66,4 +66,4 @@
}
override val cacheKey: Any = fontCache // results are valid for all shared caches
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/ParagraphLayouter.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/ParagraphLayouter.skiko.kt
index 61b2f14..a020695 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/ParagraphLayouter.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/ParagraphLayouter.skiko.kt
@@ -104,4 +104,4 @@
}
return para
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/PlatformFont.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/PlatformFont.skiko.kt
index 9eb93ef..9cc0c21 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/PlatformFont.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/PlatformFont.skiko.kt
@@ -215,4 +215,4 @@
}
internal expect val typefacesCache: Cache<String, SkTypeface>
-internal expect fun loadFromTypefacesCache(font: Font): SkTypeface
\ No newline at end of file
+internal expect fun loadFromTypefacesCache(font: Font): SkTypeface
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaMultiParagraphDraw.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaMultiParagraphDraw.skiko.kt
index 923d798..967a500 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaMultiParagraphDraw.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaMultiParagraphDraw.skiko.kt
@@ -42,4 +42,4 @@
canvas.translate(0f, it.paragraph.height)
}
canvas.restore()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaParagraphIntrinsics.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaParagraphIntrinsics.skiko.kt
index b4739b4..0a94be1 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaParagraphIntrinsics.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/platform/SkiaParagraphIntrinsics.skiko.kt
@@ -90,4 +90,4 @@
private fun contentBasedTextDirection() = text.contentBasedTextDirection()
}
-internal expect fun String.contentBasedTextDirection(): ResolvedTextDirection?
\ No newline at end of file
+internal expect fun String.contentBasedTextDirection(): ResolvedTextDirection?
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/LineBreak.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/LineBreak.skiko.kt
index 300119a..dad3ca8 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/LineBreak.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/LineBreak.skiko.kt
@@ -30,4 +30,4 @@
actual val Paragraph: LineBreak = LineBreak(3)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/TextMotion.skiko.kt b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/TextMotion.skiko.kt
index 63c3537..eb79c74 100644
--- a/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/TextMotion.skiko.kt
+++ b/compose/ui/ui-text/src/skikoMain/kotlin/androidx/compose/ui/text/style/TextMotion.skiko.kt
@@ -25,4 +25,4 @@
actual val Animated: TextMotion = TextMotion()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
index 16c64c8..7e8e019 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
@@ -1163,4 +1163,4 @@
start = indexOf(start),
end = indexOf(end) + 1
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTest.kt
index 05297b1..63ad3da 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTest.kt
@@ -559,4 +559,4 @@
addStyle(ParagraphStyle(), 0, 2)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTransformTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTransformTest.kt
index 2f4bc88..20a0dc2 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTransformTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringTransformTest.kt
@@ -326,4 +326,4 @@
assertThat(uppercase.spanStyles).isEqualTo(input.spanStyles)
assertThat(uppercase.paragraphStyles).isEqualTo(input.paragraphStyles)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/MultiParagraphTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/MultiParagraphTest.kt
index 469aa3f..469b97e6 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/MultiParagraphTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/MultiParagraphTest.kt
@@ -75,4 +75,4 @@
.isEqualTo(i / paragraphHeight)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/PlaceholderTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/PlaceholderTest.kt
index a17d7f1..86bec68c 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/PlaceholderTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/PlaceholderTest.kt
@@ -41,4 +41,4 @@
placeholderVerticalAlign = PlaceholderVerticalAlign.AboveBaseline
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/SaversTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/SaversTest.kt
index 8cb738b..8365149 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/SaversTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/SaversTest.kt
@@ -398,4 +398,4 @@
assertThat(LocaleList.Saver.restore(saved!!)).isEqualTo(original)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextRangeTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextRangeTest.kt
index 9c47e02..dbcdce2 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextRangeTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextRangeTest.kt
@@ -163,4 +163,4 @@
assertThat(TextRange(0, 1).toString()).isEqualTo("TextRange(0, 1)")
assertThat(TextRange(1, 1).toString()).isEqualTo("TextRange(1, 1)")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextStyleLayoutAttributesTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextStyleLayoutAttributesTest.kt
index 7b894df..3c7d779 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextStyleLayoutAttributesTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextStyleLayoutAttributesTest.kt
@@ -393,4 +393,4 @@
) {
constructor(parameter: KProperty1<*, *>) : this(parameter.name, parameter.returnType)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AndroidFontResolverInterceptorTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AndroidFontResolverInterceptorTest.kt
index 3de00a3a..4f352de 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AndroidFontResolverInterceptorTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AndroidFontResolverInterceptorTest.kt
@@ -95,4 +95,4 @@
assertThat(subject.interceptFontSynthesis(FontSynthesis.Weight))
.isEqualTo(FontSynthesis.Weight)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AsyncFontListLoaderTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AsyncFontListLoaderTest.kt
index 89883bd..89b1749 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AsyncFontListLoaderTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/AsyncFontListLoaderTest.kt
@@ -146,4 +146,4 @@
override val cacheKey: String = "androidx.compose.ui.text.font.makeResourceLoader"
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontFamilyTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontFamilyTest.kt
index e2298bf..2ba7e82 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontFamilyTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontFamilyTest.kt
@@ -87,4 +87,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontMatcherTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontMatcherTest.kt
index 0315bcd..ab361ef 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontMatcherTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontMatcherTest.kt
@@ -928,4 +928,4 @@
@ExperimentalTextApi
override val loadingStrategy: FontLoadingStrategy = FontLoadingStrategy.Blocking
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTest.kt
index 1673ded..b2db0b0 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTest.kt
@@ -82,4 +82,4 @@
assertThat(fontFamily).isNotEmpty()
assertThat(fontFamily[0]).isSameInstanceAs(font)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTestData.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTestData.kt
index 2393d7a..a3514ed 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTestData.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontTestData.kt
@@ -194,4 +194,4 @@
style = FontStyle.Italic
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontVariationTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontVariationTest.kt
index cac46e1..08ae46f 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontVariationTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontVariationTest.kt
@@ -160,4 +160,4 @@
assertThat(variation.axisName).isEqualTo("fzzt")
assertThat(variation.toVariationValue(null)).isEqualTo(7f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontWeightTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontWeightTest.kt
index f22a6400..0d0a4db 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontWeightTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/FontWeightTest.kt
@@ -137,4 +137,4 @@
assertThat(FontWeight.W400.compareTo(FontWeight.W300)).isEqualTo(1)
assertThat(FontWeight.W400.compareTo(FontWeight.W500)).isEqualTo(-1)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/LoadedFontFamilyTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/LoadedFontFamilyTest.kt
index 86147f6..8c56a73 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/LoadedFontFamilyTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/LoadedFontFamilyTest.kt
@@ -33,4 +33,4 @@
assertThat(loadedFontFamily.typeface).isEqualTo(typeface)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/ResourceFontVariationSettingsTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/ResourceFontVariationSettingsTest.kt
index 189eb795f..d38bcac 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/ResourceFontVariationSettingsTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/font/ResourceFontVariationSettingsTest.kt
@@ -75,4 +75,4 @@
assertThat(resourceFont.hashCode()).isNotEqualTo(resourceFont2.hashCode())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/CommitTextCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/CommitTextCommandTest.kt
index 81d5e19..2c7a253 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/CommitTextCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/CommitTextCommandTest.kt
@@ -182,4 +182,4 @@
assertThat(eb.cursor).isEqualTo(6)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextCommandTest.kt
index fe3eea8..bd134c2 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextCommandTest.kt
@@ -297,4 +297,4 @@
assertThat(eb.toString()).isEqualTo("bcde")
assertThat(eb.cursor).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommandTest.kt
index 72d1ccf4..73492cc 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommandTest.kt
@@ -308,4 +308,4 @@
assertThat(eb.toString()).isEqualTo("bcde")
assertThat(eb.cursor).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditProcessorTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditProcessorTest.kt
index 64bd8a4..12db189 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditProcessorTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditProcessorTest.kt
@@ -332,4 +332,4 @@
)
assertThat(error).hasCauseThat().hasMessageThat().isEqualTo("Better luck next time")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditingBufferTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditingBufferTest.kt
index a8b520e..56c8497 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditingBufferTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/EditingBufferTest.kt
@@ -433,4 +433,4 @@
assertThat(eb.cursor).isEqualTo(0)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/FinishComposingTextCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/FinishComposingTextCommandTest.kt
index 5858de9..e6449d9 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/FinishComposingTextCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/FinishComposingTextCommandTest.kt
@@ -49,4 +49,4 @@
assertThat(eb.selectionEnd).isEqualTo(4)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/GapBufferTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/GapBufferTest.kt
index ad381bc..e3ac749 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/GapBufferTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/GapBufferTest.kt
@@ -682,4 +682,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/PasswordVisualTransformationTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/PasswordVisualTransformationTest.kt
index 561ae15..a3129b6 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/PasswordVisualTransformationTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/PasswordVisualTransformationTest.kt
@@ -53,4 +53,4 @@
assertThat(offsetMapping.transformedToOriginal(i)).isEqualTo(i)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingRegionCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingRegionCommandTest.kt
index 81c5159..f6b7e46 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingRegionCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingRegionCommandTest.kt
@@ -127,4 +127,4 @@
assertThat(eb.compositionStart).isEqualTo(0)
assertThat(eb.compositionEnd).isEqualTo(5)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingTextCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingTextCommandTest.kt
index f0d5992..4ee8fae 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingTextCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetComposingTextCommandTest.kt
@@ -202,4 +202,4 @@
assertThat(eb.compositionStart).isEqualTo(5)
assertThat(eb.compositionEnd).isEqualTo(6)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetSelectionCommandTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetSelectionCommandTest.kt
index 995f7dc..baec7aa 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetSelectionCommandTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/SetSelectionCommandTest.kt
@@ -122,4 +122,4 @@
assertThat(eb.selectionEnd).isEqualTo(5)
assertThat(eb.hasComposition()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/TextFieldValueTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/TextFieldValueTest.kt
index d14b201..48da0c4 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/TextFieldValueTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/input/TextFieldValueTest.kt
@@ -235,4 +235,4 @@
assertThat(restored).isEqualTo(original)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/matchers/EditBufferSubject.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/matchers/EditBufferSubject.kt
index fcb894e..6cce6e9 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/matchers/EditBufferSubject.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/matchers/EditBufferSubject.kt
@@ -69,4 +69,4 @@
assertThat(subject[i]).isEqualTo(expected[i])
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/BaselineShiftTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/BaselineShiftTest.kt
index f29101d..d57c0cd 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/BaselineShiftTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/BaselineShiftTest.kt
@@ -32,4 +32,4 @@
val lerpBaselineShift = lerp(a, b, t)
assertThat(lerpBaselineShift.multiplier).isEqualTo(1.3f)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/HyphensTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/HyphensTest.kt
index bb75b61..e776927 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/HyphensTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/HyphensTest.kt
@@ -54,4 +54,4 @@
val otherHyphens = Hyphens.Auto
assertThat(hyphens.hashCode()).isEqualTo(otherHyphens.hashCode())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/LineHeightStyleTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/LineHeightStyleTest.kt
index 1aeef097..8d9fc96 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/LineHeightStyleTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/LineHeightStyleTest.kt
@@ -105,4 +105,4 @@
)
assertThat(lineHeightStyle.hashCode()).isEqualTo(otherLineHeightStyle.hashCode())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextDecorationTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextDecorationTest.kt
index 6fcbdb0..28df454 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextDecorationTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextDecorationTest.kt
@@ -78,4 +78,4 @@
(TextDecoration.Underline + TextDecoration.LineThrough).toString()
).isEqualTo("TextDecoration[Underline, LineThrough]")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextForegroundStyleTest.kt b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextForegroundStyleTest.kt
index f9be743..9b2d38e 100644
--- a/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextForegroundStyleTest.kt
+++ b/compose/ui/ui-text/src/test/java/androidx/compose/ui/text/style/TextForegroundStyleTest.kt
@@ -191,4 +191,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling-data/build.gradle b/compose/ui/ui-tooling-data/build.gradle
index a2ba3a7..0faefb4 100644
--- a/compose/ui/ui-tooling-data/build.gradle
+++ b/compose/ui/ui-tooling-data/build.gradle
@@ -116,7 +116,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
diff --git a/compose/ui/ui-tooling-data/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/data/OffsetData.kt b/compose/ui/ui-tooling-data/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/data/OffsetData.kt
index 06a5051..61727c4 100644
--- a/compose/ui/ui-tooling-data/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/data/OffsetData.kt
+++ b/compose/ui/ui-tooling-data/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/data/OffsetData.kt
@@ -85,4 +85,4 @@
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling-data/src/jvmMain/kotlin/androidx/compose/ui/tooling/data/UiToolingDataApi.kt b/compose/ui/ui-tooling-data/src/jvmMain/kotlin/androidx/compose/ui/tooling/data/UiToolingDataApi.kt
index 15b71a6..8049a4c 100644
--- a/compose/ui/ui-tooling-data/src/jvmMain/kotlin/androidx/compose/ui/tooling/data/UiToolingDataApi.kt
+++ b/compose/ui/ui-tooling-data/src/jvmMain/kotlin/androidx/compose/ui/tooling/data/UiToolingDataApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is for tooling only and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class UiToolingDataApi
\ No newline at end of file
+annotation class UiToolingDataApi
diff --git a/compose/ui/ui-tooling-preview/build.gradle b/compose/ui/ui-tooling-preview/build.gradle
index 022bc02c..c32950f 100644
--- a/compose/ui/ui-tooling-preview/build.gradle
+++ b/compose/ui/ui-tooling-preview/build.gradle
@@ -101,7 +101,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
diff --git a/compose/ui/ui-tooling-preview/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/Preview.kt b/compose/ui/ui-tooling-preview/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/Preview.kt
index 520f4a6..d57ddc4 100644
--- a/compose/ui/ui-tooling-preview/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/Preview.kt
+++ b/compose/ui/ui-tooling-preview/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/Preview.kt
@@ -20,4 +20,4 @@
@Target(
AnnotationTarget.FUNCTION
)
-annotation class Preview
\ No newline at end of file
+annotation class Preview
diff --git a/compose/ui/ui-tooling/build.gradle b/compose/ui/ui-tooling/build.gradle
index 4e12802..ac62e0d 100644
--- a/compose/ui/ui-tooling/build.gradle
+++ b/compose/ui/ui-tooling/build.gradle
@@ -126,7 +126,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/ComposeInvokerTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/ComposeInvokerTest.kt
index 68328d1..efe77d9 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/ComposeInvokerTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/ComposeInvokerTest.kt
@@ -184,4 +184,4 @@
override val values: Sequence<CornerRadius>
get() = sequenceOf(CornerRadius(42f), CornerRadius.Zero, CornerRadius(0f, 34f))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/DesignInfoProviderComposable.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/DesignInfoProviderComposable.kt
index 806dd6c..b916f34 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/DesignInfoProviderComposable.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/DesignInfoProviderComposable.kt
@@ -52,4 +52,4 @@
}
}
}
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/HotReloaderTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/HotReloaderTest.kt
index baa0d04..3c117e8 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/HotReloaderTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/HotReloaderTest.kt
@@ -47,4 +47,4 @@
assertNotNull(saveStateAndDisposeMethod)
assertNotNull(loadStateAndDisposeMethod)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/LazyColumnPreview.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/LazyColumnPreview.kt
index 03e6561..2d81a2e 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/LazyColumnPreview.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/LazyColumnPreview.kt
@@ -70,4 +70,4 @@
Text("Hello world")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestAnimationPreview.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestAnimationPreview.kt
index 1ec7539..623f4ee 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestAnimationPreview.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestAnimationPreview.kt
@@ -476,4 +476,4 @@
fun MaterialPreview() {
val state = remember { mutableStateOf(ToggleableState.On) }.value
TriStateCheckbox(state, {})
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestViewModel.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestViewModel.kt
index fa3f31c..429a983 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestViewModel.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/TestViewModel.kt
@@ -31,4 +31,4 @@
fun increaseCounter() {
counter.value = ++count
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimationTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimationTest.kt
index 459a6aa..6d19a7d 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimationTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimationTest.kt
@@ -286,4 +286,4 @@
assertNotNull(composeAnimation.toolingState)
return composeAnimation
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimationTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimationTest.kt
index 2fcda35..e7ececc 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimationTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimationTest.kt
@@ -87,4 +87,4 @@
assertEquals(1, search.animations.size)
assertNull(search.animations.first().parseAnimatedContent())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimationTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimationTest.kt
index 6c06aaf..1711089 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimationTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimationTest.kt
@@ -41,4 +41,4 @@
Assert.assertNull(composeAnimation.childTransition)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimationSearchTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimationSearchTest.kt
index 5b00bba..8996987 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimationSearchTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/AnimationSearchTest.kt
@@ -393,4 +393,4 @@
rule.searchAndTrackAllAnimations(search) { AnimatedContentExtensionPreview() }
assertTrue(search.hasAnimations)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimationTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimationTest.kt
index 90d7752..cca3022 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimationTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimationTest.kt
@@ -68,4 +68,4 @@
}
InfiniteTransitionComposeAnimation.testOverrideAvailability(true)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/PreviewAnimationClockTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/PreviewAnimationClockTest.kt
index 2b6de36..c765d46 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/PreviewAnimationClockTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/PreviewAnimationClockTest.kt
@@ -682,4 +682,4 @@
private enum class RotationColor { RC1, RC2, RC3 }
-private const val eps = 0.00001f
\ No newline at end of file
+private const val eps = 0.00001f
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimationTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimationTest.kt
index b0d110e..8de8eb7 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimationTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimationTest.kt
@@ -103,4 +103,4 @@
Assert.assertEquals(setOf(TransitionClockTest.CustomState(0)), composeAnimation.states)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/Utils.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/Utils.kt
index 9cb987b..c91edb6 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/Utils.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/Utils.kt
@@ -128,4 +128,4 @@
fun assertEquals(expected: Long, actual: Long, delta: Long) {
Assert.assertEquals(null, expected.toFloat(), actual.toFloat(), delta.toFloat())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClockTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClockTest.kt
index f58d39d..b55547c 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClockTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClockTest.kt
@@ -677,4 +677,4 @@
assertEquals(listOf(ComposeAnimatedProperty(label, newTargetValue)), properties)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClockTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClockTest.kt
index d19c2f8..6bad9d0 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClockTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClockTest.kt
@@ -184,4 +184,4 @@
rule.waitForIdle()
return clock
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClockTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClockTest.kt
index d1a0b86..4d920ca 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClockTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClockTest.kt
@@ -299,4 +299,4 @@
assertEquals(1300, clock.getMaxDuration())
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClockTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClockTest.kt
index 39af8c6..48b3e9c 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClockTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClockTest.kt
@@ -683,4 +683,4 @@
fun assertEquals(expected: Long, actual: Long, delta: Long) {
assertEquals(null, expected.toFloat(), actual.toFloat(), delta.toFloat())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/UtilsTest.kt b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/UtilsTest.kt
index a5cf31a..e3e263d 100644
--- a/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/UtilsTest.kt
+++ b/compose/ui/ui-tooling/src/androidAndroidTest/kotlin/androidx/compose/ui/tooling/animation/clock/UtilsTest.kt
@@ -291,4 +291,4 @@
), value
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/LayoutlibFontResourceLoader.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/LayoutlibFontResourceLoader.kt
index fef35b7..0f33184 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/LayoutlibFontResourceLoader.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/LayoutlibFontResourceLoader.kt
@@ -48,4 +48,4 @@
fun load(context: Context, font: ResourceFont): Typeface {
return context.resources.getFont(font.resId)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.android.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.android.kt
index 981a832..77b605b 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.android.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.android.kt
@@ -31,4 +31,4 @@
Log.e(Tag, message, throwable)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ShadowViewInfo.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ShadowViewInfo.kt
index 40e5b35..9d7614d 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ShadowViewInfo.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ShadowViewInfo.kt
@@ -117,4 +117,4 @@
}
return newTree
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ViewInfoUtil.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ViewInfoUtil.kt
index 3a0a662..0240056 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ViewInfoUtil.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/ViewInfoUtil.kt
@@ -75,4 +75,4 @@
}
return builder.toString()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimation.kt
index a1e339b..b97565b 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimateXAsStateComposeAnimation.kt
@@ -73,4 +73,4 @@
apiAvailable = override
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimation.kt
index f825633..d2a2ea8 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedContentComposeAnimation.kt
@@ -60,4 +60,4 @@
apiAvailable = override
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimation.kt
index 2c123fb..cc946833 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimatedVisibilityComposeAnimation.kt
@@ -44,4 +44,4 @@
@Suppress("UNCHECKED_CAST")
val childTransition: Transition<Any>?
get() = animationObject.transitions.getOrNull(0) as? Transition<Any>
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimationSearch.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimationSearch.kt
index 268394b..7e61b68 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimationSearch.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/AnimationSearch.kt
@@ -352,4 +352,4 @@
}.findRememberedData())
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimation.kt
index 092f5a1..751b170 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/InfiniteTransitionComposeAnimation.kt
@@ -65,4 +65,4 @@
apiAvailable = override
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/ToolingState.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/ToolingState.kt
index c785e65..0cf6e60 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/ToolingState.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/ToolingState.kt
@@ -36,4 +36,4 @@
*/
class ToolingState<T>(default: T) : State<T> {
override var value by mutableStateOf(default)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimation.kt
index 7f313f6..53f9e03 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/TransitionComposeAnimation.kt
@@ -41,4 +41,4 @@
override val label: String?
) : ComposeAnimation, TransitionBasedAnimation<T> {
override val type = ComposeAnimationType.TRANSITION_ANIMATION
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/UnsupportedComposeAnimation.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/UnsupportedComposeAnimation.kt
index 33bd152..765d62e 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/UnsupportedComposeAnimation.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/UnsupportedComposeAnimation.kt
@@ -49,4 +49,4 @@
apiAvailable = override
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClock.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClock.kt
index 7367903..b6328bd 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClock.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimateXAsStateClock.kt
@@ -94,4 +94,4 @@
initialVelocity = animation.animationObject.velocity
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClock.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClock.kt
index aeb3e35..f1eeb55 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClock.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/AnimatedVisibilityClock.kt
@@ -83,4 +83,4 @@
private fun AnimatedVisibilityState.toCurrentTargetPair() =
if (this == AnimatedVisibilityState.Enter) false to true else true to false
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/ComposeAnimationClock.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/ComposeAnimationClock.kt
index 239805a..8de5646 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/ComposeAnimationClock.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/ComposeAnimationClock.kt
@@ -59,4 +59,4 @@
* [setStateParameters] allows to update [state] in that case.
*/
fun setStateParameters(par1: Any, par2: Any? = null)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClock.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClock.kt
index 2cc56af..50572b8 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClock.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/InfiniteTransitionClock.kt
@@ -82,4 +82,4 @@
val animation = repeatableSpec.animation.vectorize(typeConverter)
return millisToNanos(animation.delayMillis.toLong() + animation.durationMillis * repeats)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClock.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClock.kt
index da45461..75efa36 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClock.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/TransitionClock.kt
@@ -84,4 +84,4 @@
state.initial, state.target, animationTimeNanos
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/Utils.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/Utils.kt
index 0ecdc83..d2a700f 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/Utils.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/clock/Utils.kt
@@ -277,4 +277,4 @@
}
}
return null
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/AnimatedVisibilityState.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/AnimatedVisibilityState.kt
index 1e928d2..20bcff6 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/AnimatedVisibilityState.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/AnimatedVisibilityState.kt
@@ -28,4 +28,4 @@
val Enter = AnimatedVisibilityState("Enter")
val Exit = AnimatedVisibilityState("Exit")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/ComposeAnimationState.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/ComposeAnimationState.kt
index 4673b8f..6ec28c6 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/ComposeAnimationState.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/ComposeAnimationState.kt
@@ -19,4 +19,4 @@
import androidx.compose.ui.tooling.animation.clock.ComposeAnimationClock
/** State of [ComposeAnimationClock]. */
-internal interface ComposeAnimationState
\ No newline at end of file
+internal interface ComposeAnimationState
diff --git a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/TargetState.kt b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/TargetState.kt
index fcffb740..6f3d736 100644
--- a/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/TargetState.kt
+++ b/compose/ui/ui-tooling/src/androidMain/kotlin/androidx/compose/ui/tooling/animation/states/TargetState.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.tooling.animation.states
/** [ComposeAnimationState] for animations with [initial] and [target] states. */
-internal data class TargetState<T>(val initial: T, val target: T) : ComposeAnimationState
\ No newline at end of file
+internal data class TargetState<T>(val initial: T, val target: T) : ComposeAnimationState
diff --git a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/PreviewLogger.desktop.kt b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/PreviewLogger.desktop.kt
index 7b9ca9f..fd8b2bd 100644
--- a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/PreviewLogger.desktop.kt
+++ b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/PreviewLogger.desktop.kt
@@ -29,4 +29,4 @@
System.err.println("$Tag: $message.\n$throwable")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/NonInteractivePreviewFacade.kt b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/NonInteractivePreviewFacade.kt
index 5cec2cc..43b3ce5 100644
--- a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/NonInteractivePreviewFacade.kt
+++ b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/NonInteractivePreviewFacade.kt
@@ -65,4 +65,4 @@
return window.surface.makeImageSnapshot().encodeToData()!!.bytes
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/PreviewRunner.kt b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/PreviewRunner.kt
index a64124c..037308b 100644
--- a/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/PreviewRunner.kt
+++ b/compose/ui/ui-tooling/src/desktopMain/kotlin/androidx/compose/desktop/ui/tooling/preview/runtime/PreviewRunner.kt
@@ -55,4 +55,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-tooling/src/jvmMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.jvm.kt b/compose/ui/ui-tooling/src/jvmMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.jvm.kt
index c26ea17..967ba0c 100644
--- a/compose/ui/ui-tooling/src/jvmMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.jvm.kt
+++ b/compose/ui/ui-tooling/src/jvmMain/kotlin/androidx/compose/ui/tooling/PreviewLogger.jvm.kt
@@ -23,4 +23,4 @@
internal fun logError(message: String, throwable: Throwable? = null)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/samples/src/main/java/androidx/compose/ui/unit/samples/DpSample.kt b/compose/ui/ui-unit/samples/src/main/java/androidx/compose/ui/unit/samples/DpSample.kt
index 7a3e049..9937c09 100644
--- a/compose/ui/ui-unit/samples/src/main/java/androidx/compose/ui/unit/samples/DpSample.kt
+++ b/compose/ui/ui-unit/samples/src/main/java/androidx/compose/ui/unit/samples/DpSample.kt
@@ -50,4 +50,4 @@
drawRect(Color.Red, style = Stroke(lineThicknessPx))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/DpDeviceTest.kt b/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/DpDeviceTest.kt
index dc7c3ea..e38840e 100644
--- a/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/DpDeviceTest.kt
+++ b/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/DpDeviceTest.kt
@@ -54,4 +54,4 @@
companion object {
class TestActivity : Activity()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/SpDeviceTest.kt b/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/SpDeviceTest.kt
index 8c08f71..090c7fb 100644
--- a/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/SpDeviceTest.kt
+++ b/compose/ui/ui-unit/src/androidAndroidTest/kotlin/androidx/compose/ui/unit/SpDeviceTest.kt
@@ -65,4 +65,4 @@
companion object {
class TestActivity : Activity()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/ExperimentalUnitApi.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/ExperimentalUnitApi.kt
index 3db6a8c..a037e98 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/ExperimentalUnitApi.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/ExperimentalUnitApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalUnitApi
\ No newline at end of file
+annotation class ExperimentalUnitApi
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntOffset.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntOffset.kt
index ab0feed..4c7bd77 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntOffset.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntOffset.kt
@@ -176,4 +176,4 @@
* Round a [Offset] down to the nearest [Int] coordinates.
*/
@Stable
-inline fun Offset.round(): IntOffset = IntOffset(x.roundToInt(), y.roundToInt())
\ No newline at end of file
+inline fun Offset.round(): IntOffset = IntOffset(x.roundToInt(), y.roundToInt())
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntSize.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntSize.kt
index c56c857..7a7ae72 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntSize.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/IntSize.kt
@@ -108,4 +108,4 @@
// temporary while PxSize is transitioned to Size
@Stable
-fun IntSize.toSize() = Size(width.toFloat(), height.toFloat())
\ No newline at end of file
+fun IntSize.toSize() = Size(width.toFloat(), height.toFloat())
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/LayoutDirection.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/LayoutDirection.kt
index 80c5765..efbfb17 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/LayoutDirection.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/LayoutDirection.kt
@@ -31,4 +31,4 @@
* Horizontal layout direction is from Right to Left.
*/
Rtl
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Velocity.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Velocity.kt
index 6de7ed1..3af3650 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Velocity.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Velocity.kt
@@ -141,4 +141,4 @@
operator fun rem(operand: Float) = Velocity(x % operand, y % operand)
override fun toString() = "($x, $y) px/sec"
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.kt
index aa09639..f08c3ae 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.unit.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/ui/ui-unit/src/jvmMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/ui/ui-unit/src/jvmMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.jvm.kt
index ff766cb..bef0212 100644
--- a/compose/ui/ui-unit/src/jvmMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/ui/ui-unit/src/jvmMain/kotlin/androidx/compose/ui/unit/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.unit.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DensityTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DensityTest.kt
index bcb2400..9060a47 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DensityTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DensityTest.kt
@@ -125,4 +125,4 @@
fun testSizeUnspecifiedToDpSize() = with(density) {
assertEquals(DpSize.Unspecified, Size.Unspecified.toDpSize())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpOffsetTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpOffsetTest.kt
index 6e2b181..02d10c8 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpOffsetTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpOffsetTest.kt
@@ -107,4 +107,4 @@
fun testUnspecifiedToString() {
assertEquals("DpOffset.Unspecified", DpOffset.Unspecified.toString())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpSizeTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpSizeTest.kt
index 14cbd2e..b3d3eaa 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpSizeTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpSizeTest.kt
@@ -108,4 +108,4 @@
fun testUnspecifiedToString() {
assertEquals("DpSize.Unspecified", DpSize.Unspecified.toString())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
index 9061916..5518904 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
@@ -202,4 +202,4 @@
fun testTakeOrElseFalse() {
assertTrue(Dp.Unspecified.takeOrElse { Dp(1f) }.isSpecified)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntOffsetTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntOffsetTest.kt
index 8aa0f12..2a864d5 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntOffsetTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntOffsetTest.kt
@@ -53,4 +53,4 @@
fun toOffset() {
assertEquals(Offset(3f, 10f), IntOffset(3, 10).toOffset())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntRectTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntRectTest.kt
index d1f93a7..2dd9332 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntRectTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntRectTest.kt
@@ -252,4 +252,4 @@
Rect(2.4f, 2.5f, 3.9f, 5.3f).roundToIntRect(),
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntSizeTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntSizeTest.kt
index e98769a..4e84fda 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntSizeTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/IntSizeTest.kt
@@ -58,4 +58,4 @@
assertEquals(10, w)
assertEquals(20, h)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
index 7144295..5346f73 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
@@ -513,4 +513,4 @@
fun testTakeOrElseFalse() {
Assert.assertTrue(TextUnit.Unspecified.takeOrElse { 1.sp }.isSpecified)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/VelocityTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/VelocityTest.kt
index 9720402..b3c4ebf 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/VelocityTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/VelocityTest.kt
@@ -104,4 +104,4 @@
Assert.assertEquals(100f, copy.x)
Assert.assertEquals(300f, copy.y)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-util/src/androidMain/kotlin/androidx/compose/ui/util/AndroidTrace.android.kt b/compose/ui/ui-util/src/androidMain/kotlin/androidx/compose/ui/util/AndroidTrace.android.kt
index ab3abb3..266bbf5 100644
--- a/compose/ui/ui-util/src/androidMain/kotlin/androidx/compose/ui/util/AndroidTrace.android.kt
+++ b/compose/ui/ui-util/src/androidMain/kotlin/androidx/compose/ui/util/AndroidTrace.android.kt
@@ -29,4 +29,4 @@
} finally {
Trace.endSection()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/InlineClassHelper.kt b/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/InlineClassHelper.kt
index b2f3402..c1548f2 100644
--- a/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/InlineClassHelper.kt
+++ b/compose/ui/ui-util/src/commonMain/kotlin/androidx/compose/ui/util/InlineClassHelper.kt
@@ -60,4 +60,4 @@
*/
inline fun unpackInt2(value: Long): Int {
return value.and(0xFFFFFFFF).toInt()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/InlineClassHelperTest.kt b/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/InlineClassHelperTest.kt
index 7f52124..a254057 100644
--- a/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/InlineClassHelperTest.kt
+++ b/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/InlineClassHelperTest.kt
@@ -95,4 +95,4 @@
assertEquals(first, unpackInt1(packed))
assertEquals(second, unpackInt2(packed))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/MathHelpersTest.kt b/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/MathHelpersTest.kt
index d391158..93d8958 100644
--- a/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/MathHelpersTest.kt
+++ b/compose/ui/ui-util/src/test/kotlin/androidx/compose/ui/util/MathHelpersTest.kt
@@ -97,4 +97,4 @@
assertThat(lerp(from, to, 1.00f)).isEqualTo((4 * multiplier).toLong())
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-viewbinding/samples/src/androidTest/java/androidx/compose/ui/samples/ReusableAndroidViewBindingTest.kt b/compose/ui/ui-viewbinding/samples/src/androidTest/java/androidx/compose/ui/samples/ReusableAndroidViewBindingTest.kt
index 2561853..cbf7ecd 100644
--- a/compose/ui/ui-viewbinding/samples/src/androidTest/java/androidx/compose/ui/samples/ReusableAndroidViewBindingTest.kt
+++ b/compose/ui/ui-viewbinding/samples/src/androidTest/java/androidx/compose/ui/samples/ReusableAndroidViewBindingTest.kt
@@ -340,4 +340,4 @@
companion object {
private val ButtonFqClassName = Button::class.qualifiedName!!
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui-viewbinding/samples/src/main/java/androidx/compose/ui/samples/AndroidViewBindingSample.kt b/compose/ui/ui-viewbinding/samples/src/main/java/androidx/compose/ui/samples/AndroidViewBindingSample.kt
index 67baa43..694e5e6 100644
--- a/compose/ui/ui-viewbinding/samples/src/main/java/androidx/compose/ui/samples/AndroidViewBindingSample.kt
+++ b/compose/ui/ui-viewbinding/samples/src/main/java/androidx/compose/ui/samples/AndroidViewBindingSample.kt
@@ -56,4 +56,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/BenchmarkModifierExtensions.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/BenchmarkModifierExtensions.kt
index 893ed85..aa45c87 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/BenchmarkModifierExtensions.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/BenchmarkModifierExtensions.kt
@@ -146,4 +146,4 @@
} else {
runWithTimingDisabled { block() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LayoutNodeModifierBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LayoutNodeModifierBenchmark.kt
index f462daa..b95cb7d 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LayoutNodeModifierBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LayoutNodeModifierBenchmark.kt
@@ -169,4 +169,4 @@
.apply(base, description)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LifecycleAwareWindowRecomposerBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LifecycleAwareWindowRecomposerBenchmark.kt
index 082292b..f1d69a0 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LifecycleAwareWindowRecomposerBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/LifecycleAwareWindowRecomposerBenchmark.kt
@@ -76,4 +76,4 @@
.apply(base, description)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
index 226b652..f879471 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
@@ -306,4 +306,4 @@
fun Modifier.emptyElement(): Modifier = this then object : Modifier.Element {}
@Suppress("UNUSED_PARAMETER")
-fun capture(value: Any?) {}
\ No newline at end of file
+fun capture(value: Any?) {}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/autofill/AndroidAutofillBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/autofill/AndroidAutofillBenchmark.kt
index 87cfc77..66b8f02 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/autofill/AndroidAutofillBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/autofill/AndroidAutofillBenchmark.kt
@@ -82,4 +82,4 @@
composeView.autofill(autofillValues)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/AndroidTapIntegrationBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/AndroidTapIntegrationBenchmark.kt
index 87a6eab..26d85af 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/AndroidTapIntegrationBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/AndroidTapIntegrationBenchmark.kt
@@ -202,4 +202,4 @@
return true
}
-}
\ No newline at end of file
+}
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 796abbc..8ef603f 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
@@ -18,4 +18,4 @@
val ItemHeightPx = 1f
-val NumItems = 100
\ No newline at end of file
+val NumItems = 100
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/VelocityTrackerBenchmark.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/VelocityTrackerBenchmark.kt
index 058b533..552adeb 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/VelocityTrackerBenchmark.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/VelocityTrackerBenchmark.kt
@@ -104,4 +104,4 @@
companion object {
private const val TestNumDataPoints = 100
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/utils.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/utils.kt
index c28a69f..f3e935c 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/utils.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/utils.kt
@@ -80,4 +80,4 @@
MotionEvent.PointerCoords().apply {
this.x = x
this.y = y
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui/build.gradle b/compose/ui/ui/build.gradle
index 7622917..751a851 100644
--- a/compose/ui/ui/build.gradle
+++ b/compose/ui/ui/build.gradle
@@ -172,7 +172,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
implementation(libs.truth)
implementation(libs.junit)
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/DeclarativeGraphicsDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/DeclarativeGraphicsDemo.kt
index 52f5641..91cff21 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/DeclarativeGraphicsDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/DeclarativeGraphicsDemo.kt
@@ -127,4 +127,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PainterResourcesDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PainterResourcesDemo.kt
index 306808e..da40196 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PainterResourcesDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PainterResourcesDemo.kt
@@ -55,4 +55,4 @@
Image(painter, contentDescription = null)
Image(vector, contentDescription = null)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/AdjacentScrollablesFocusDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/AdjacentScrollablesFocusDemo.kt
index 31040db..52b8957 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/AdjacentScrollablesFocusDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/AdjacentScrollablesFocusDemo.kt
@@ -99,4 +99,4 @@
.border(2.dp, Color.Black)
.background(Color.White)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/CaptureFocusDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/CaptureFocusDemo.kt
index fc4646b..368151e 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/CaptureFocusDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/CaptureFocusDemo.kt
@@ -80,4 +80,4 @@
.onFocusChanged { longStringBorder = if (it.isCaptured) Red else Transparent }
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ClickableInLazyColumnDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ClickableInLazyColumnDemo.kt
index ccf7d99..6c591c6 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ClickableInLazyColumnDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ClickableInLazyColumnDemo.kt
@@ -36,4 +36,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ConditionalFocusabilityDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ConditionalFocusabilityDemo.kt
index 7c416f6..289e230 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ConditionalFocusabilityDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/ConditionalFocusabilityDemo.kt
@@ -127,4 +127,4 @@
.size(150.dp, 50.dp)
.background(color)
.onFocusChanged { color = if (it.isFocused) Red else Gray }
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialogDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialogDemo.kt
index 0997274..e8d5c94 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialogDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInDialogDemo.kt
@@ -72,4 +72,4 @@
private fun FocusStatus() {
val windowInfo = LocalWindowInfo.current
Text("Status: Window ${if (windowInfo.isWindowFocused) "is" else "is not"} focused.")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopupDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopupDemo.kt
index a5c21ca..39f1676 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopupDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/focus/FocusInPopupDemo.kt
@@ -78,4 +78,4 @@
private fun FocusStatus() {
val windowInfo = LocalWindowInfo.current
Text("Status: Window ${if (windowInfo.isWindowFocused) "is" else "is not"} focused.")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DoubleTapInTapDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DoubleTapInTapDemo.kt
index d0cf3d4..e06d701 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DoubleTapInTapDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/DoubleTapInTapDemo.kt
@@ -78,4 +78,4 @@
.background(color = innerColor.value, shape = RectangleShape)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/EventTypesDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/EventTypesDemo.kt
index 7d94bd5..6a760c1 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/EventTypesDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/EventTypesDemo.kt
@@ -132,4 +132,4 @@
while (events.size > 100) {
events.removeAt(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
index f6aa708..b686261 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
@@ -255,4 +255,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/LongPressDragGestureDetectorDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/LongPressDragGestureDetectorDemo.kt
index 4ed3a64..8426140 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/LongPressDragGestureDetectorDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/LongPressDragGestureDetectorDemo.kt
@@ -67,4 +67,4 @@
.background(color.value)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedPressDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedPressDemo.kt
index f9887e5..e526e1b 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedPressDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedPressDemo.kt
@@ -122,4 +122,4 @@
.border(BorderStroke(2.dp, BorderColor))
.padding(2.dp)
) { content() }
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
index 213634a..0b6abd6 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
@@ -218,4 +218,4 @@
Text("I'm text $it", modifier = Modifier.padding(16.dp))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
index f755807..b75515e 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
@@ -295,4 +295,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/input/TouchModeDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/input/TouchModeDemo.kt
index 962dd5e..0077972 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/input/TouchModeDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/input/TouchModeDemo.kt
@@ -57,4 +57,4 @@
Text("Exit touch mode")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/keyinput/InterceptEnterToSendMessageDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/keyinput/InterceptEnterToSendMessageDemo.kt
index 3c839a9..6535363 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/keyinput/InterceptEnterToSendMessageDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/keyinput/InterceptEnterToSendMessageDemo.kt
@@ -101,4 +101,4 @@
annotatedString.replaceRange(selection.start, selection.end, value).toString(),
TextRange(cursorLocation, cursorLocation)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewDemos.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewDemos.kt
index 0c3ce8c..9a172fd 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewDemos.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewDemos.kt
@@ -25,4 +25,4 @@
FragmentDemo("Basic interop (enabled)", RecyclerViewInteropDemoFragment::class),
FragmentDemo("Basic interop (disabled)", RecyclerViewInteropOffDemoFragment::class),
)
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ComplexInteractions.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ComplexInteractions.kt
index a750b67..e233f66 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ComplexInteractions.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ComplexInteractions.kt
@@ -122,4 +122,4 @@
) {
Text("Click me")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropAndroidInCompose.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropAndroidInCompose.kt
index 595b15f..4f883bc 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropAndroidInCompose.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropAndroidInCompose.kt
@@ -316,4 +316,4 @@
Text(motionEventString.value)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropComposeInAndroid.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropComposeInAndroid.kt
index e071074..7dfe44c 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropComposeInAndroid.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/PointerInputInteropComposeInAndroid.kt
@@ -440,4 +440,4 @@
return MyDialogFragment()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ResizeComposeViewDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ResizeComposeViewDemo.kt
index 28ae4b0..411c70c 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ResizeComposeViewDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ResizeComposeViewDemo.kt
@@ -64,4 +64,4 @@
Text("Touch the screen to change the size of the child ComposeView")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
index 6cfb3ae..debf0ea 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
@@ -125,4 +125,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
index 20cfb51..2ea6de9 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
@@ -77,10 +77,10 @@
val colorIndex = remember { mutableIntStateOf(0) }
Button(
onClick = {
- colorIndex.value = (colorIndex.value + 1) % 4
+ colorIndex.intValue = (colorIndex.intValue + 1) % 4
squareRef.value!!.color = arrayOf(
Color.Blue, Color.LightGray, Color.Yellow, Color.Cyan
- )[colorIndex.value]
+ )[colorIndex.intValue]
}
) {
Text("Change color of Android view")
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DialogSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DialogSample.kt
index d66efbd..9cf049f 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DialogSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DialogSample.kt
@@ -41,4 +41,4 @@
Box(Modifier.size(dialogWidth, dialogHeight).background(Color.White))
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DrawModifierSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DrawModifierSample.kt
index 4335d1e..85db583 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DrawModifierSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/DrawModifierSample.kt
@@ -153,4 +153,4 @@
}
fun Modifier.circle(color: Color) = this then CircleElement(color)
Box(Modifier.fillMaxSize().circle(Color.Blue))
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/FocusSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/FocusSamples.kt
index e254b12d..69035e5 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/FocusSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/FocusSamples.kt
@@ -318,4 +318,4 @@
Box(Modifier.focusRequester(nextItem).focusable())
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierCompositionLocalSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierCompositionLocalSample.kt
index 108ffc5..aad6edd 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierCompositionLocalSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierCompositionLocalSample.kt
@@ -79,4 +79,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierLocalSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierLocalSamples.kt
index d1869e6..189abfb 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierLocalSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierLocalSamples.kt
@@ -137,4 +137,4 @@
.clickable { sender?.sendMessage("Hello World") }
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierSamples.kt
index 020c4b9..1fdb55e 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ModifierSamples.kt
@@ -534,4 +534,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/NestedScrollSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/NestedScrollSamples.kt
index 84c940f..1d3cc92 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/NestedScrollSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/NestedScrollSamples.kt
@@ -174,4 +174,4 @@
modifier = Modifier.align(Alignment.Center)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/OnPlacedSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/OnPlacedSamples.kt
index 3fa3518..339a098 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/OnPlacedSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/OnPlacedSamples.kt
@@ -87,4 +87,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PainterSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PainterSample.kt
index f39a660..9b4e1b5 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PainterSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PainterSample.kt
@@ -55,7 +55,7 @@
.padding(30.dp)
.background(color = Color.Yellow)
.paint(CustomPainter())
- ) { /** intentionally empty **/ }
+ ) { /** intentionally empty */ }
}
@Sampled
@@ -69,4 +69,4 @@
contentDescription = null,
modifier = Modifier.requiredSize(50.dp)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlacementScopeCoordinatesSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlacementScopeCoordinatesSample.kt
index fc5a7d4..cd84c1d 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlacementScopeCoordinatesSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlacementScopeCoordinatesSample.kt
@@ -92,4 +92,4 @@
}
})
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlatformTextInputModifierNodeSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlatformTextInputModifierNodeSample.kt
index f9d8358..84e67f9 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlatformTextInputModifierNodeSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PlatformTextInputModifierNodeSample.kt
@@ -67,4 +67,4 @@
TODO("Create platform-specific request")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerIconSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerIconSample.kt
index afb8484..432ebf02 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerIconSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerIconSample.kt
@@ -40,4 +40,4 @@
}
Text("Just text with global pointerIcon")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerInputModifierSamples.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerInputModifierSamples.kt
index efc55bd..a328c59 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerInputModifierSamples.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/PointerInputModifierSamples.kt
@@ -70,4 +70,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/RotateSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/RotateSample.kt
index cf3d922..3a4ec18 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/RotateSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/RotateSample.kt
@@ -31,4 +31,4 @@
Modifier.rotate(45f)
.size(100.dp, 100.dp)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ScaleSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ScaleSample.kt
index e7798dbf..f05fabe 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ScaleSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ScaleSample.kt
@@ -40,4 +40,4 @@
Modifier.scale(scaleX = 2f, scaleY = 3f)
.size(100.dp, 100.dp)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
index c8e75ff..5da88e4 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SoftwareKeyboardControllerSample.kt
@@ -72,4 +72,4 @@
Text("Show software keyboard.")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SubcomposeLayoutSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SubcomposeLayoutSample.kt
index b116741..17abe1a 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SubcomposeLayoutSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/SubcomposeLayoutSample.kt
@@ -49,4 +49,4 @@
}
}
-enum class SlotsEnum { Main, Dependent }
\ No newline at end of file
+enum class SlotsEnum { Main, Dependent }
diff --git a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ZIndexModifierSample.kt b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ZIndexModifierSample.kt
index 77494b1..dc81b73 100644
--- a/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ZIndexModifierSample.kt
+++ b/compose/ui/ui/samples/src/main/java/androidx/compose/ui/samples/ZIndexModifierSample.kt
@@ -30,4 +30,4 @@
Text("Drawn second", Modifier.zIndex(1f))
Text("Drawn first")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/GoldenCommon.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/GoldenCommon.kt
index e342c5f..06d928c 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/GoldenCommon.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/GoldenCommon.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui
-internal const val GOLDEN_UI = "compose/ui/ui"
\ No newline at end of file
+internal const val GOLDEN_UI = "compose/ui/ui"
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/OpenComposeView.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/OpenComposeView.kt
index ece2f94..ef0b4a6 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/OpenComposeView.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/OpenComposeView.kt
@@ -40,4 +40,4 @@
fun setContent(content: @Composable () -> Unit) {
this.content.value = content
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/SnapshotFlowTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/SnapshotFlowTest.kt
index b1d5933..e9275f2 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/SnapshotFlowTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/SnapshotFlowTest.kt
@@ -59,4 +59,4 @@
assertEquals(1, lastComposedValue)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt
index 20a459c2..181ef0b 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt
@@ -378,4 +378,4 @@
accessibilityDelegate.populateAccessibilityNodeInfoProperties(node.id, info, node)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
index 7f914ad..0ed8118 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
@@ -128,4 +128,4 @@
// Assert.
assertThat(autofilledValue).isEqualTo(expectedValue)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/BlurTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/BlurTest.kt
index f4f5968..3b871fb 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/BlurTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/BlurTest.kt
@@ -187,4 +187,4 @@
fun testUnboundedBlurredEdgeTreatmentDoesNotHaveShape() {
assertNull(BlurredEdgeTreatment.Unbounded.shape)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/InvalidatingNotPlacedChildTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/InvalidatingNotPlacedChildTest.kt
index c5ec5ae..4133459 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/InvalidatingNotPlacedChildTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/InvalidatingNotPlacedChildTest.kt
@@ -433,4 +433,4 @@
useDuringLayout?.value
placeable.place(0, 0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
index e49c957..1098436 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt
@@ -967,4 +967,4 @@
placeable.place(0, 0)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusSearchNonPlacedItemsTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusSearchNonPlacedItemsTest.kt
index b78a3c0..1c65e9d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusSearchNonPlacedItemsTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusSearchNonPlacedItemsTest.kt
@@ -548,4 +548,4 @@
}
rule.runOnIdle { initialFocus.requestFocus() }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt
index 47e1944..b2c2ef2 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt
@@ -107,4 +107,4 @@
}
IntRect(left, top, right, bottom)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/gesture/Utils.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/gesture/Utils.kt
index fb57437..5c81cab 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/gesture/Utils.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/gesture/Utils.kt
@@ -95,4 +95,4 @@
this.y = y
setAxisValue(AXIS_HSCROLL, scrollX)
setAxisValue(AXIS_VSCROLL, scrollY)
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/VectorInvalidationTestCase.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/VectorInvalidationTestCase.kt
index 6696cb1..d286ad3 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/VectorInvalidationTestCase.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/VectorInvalidationTestCase.kt
@@ -74,4 +74,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParserTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParserTest.kt
index 4a724a3..c02449d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParserTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParserTest.kt
@@ -287,4 +287,4 @@
)
return this as T
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt
index 3e2c63b..caf9dbb 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/EditorInfoTest.kt
@@ -540,4 +540,4 @@
private fun EditorInfo.update(imeOptions: ImeOptions) {
this.update(imeOptions, TextFieldValue())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/RecordingInputConnectionTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/RecordingInputConnectionTest.kt
index 545bd5d..ebe91c8 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/RecordingInputConnectionTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/RecordingInputConnectionTest.kt
@@ -632,4 +632,4 @@
ic.endBatchEdit()
verify(mCallback, never()).onEditCommands(any())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidEmojiTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidEmojiTest.kt
index 2bec941..0050d0b 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidEmojiTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidEmojiTest.kt
@@ -64,4 +64,4 @@
textInputService.createInputConnection(info)
verify(e2).updateEditorInfo(eq(info))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidOnStateUpdateTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidOnStateUpdateTest.kt
index 9d383b7..27063fa 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidOnStateUpdateTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidOnStateUpdateTest.kt
@@ -210,4 +210,4 @@
assertThat(inputConnection.mTextFieldValue).isEqualTo(value)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifierTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifierTest.kt
index 650d52c..c523c91 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifierTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifierTest.kt
@@ -57,7 +57,6 @@
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
-import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -988,7 +987,6 @@
}
}
- @Ignore // This is failing in some APIs, but it's fixed for impulse.
@Test
fun nestedScroll_movingTarget_velocityShouldRespectSign() {
var lastVelocity = Velocity.Zero
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MotionEventSpyTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MotionEventSpyTest.kt
index 53d2990..2bba86f 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MotionEventSpyTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MotionEventSpyTest.kt
@@ -106,4 +106,4 @@
ACTION_DOWN, ACTION_MOVE, ACTION_UP
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MouseEventTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MouseEventTest.kt
index 9f9ade5..b24fba5 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MouseEventTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/MouseEventTest.kt
@@ -261,4 +261,4 @@
rule.waitForIdle()
return events
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
index 922f012..26e13a8 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
@@ -4098,4 +4098,4 @@
exit()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
index 03a8fd5..2fac881 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessorTest.kt
@@ -3462,4 +3462,4 @@
) {
val logEntry = this[index]
assertThat(logEntry).isInstanceOf(OnCancelFilterEntry::class.java)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewHookupTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewHookupTest.kt
index a76783f..038d0d5 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewHookupTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewHookupTest.kt
@@ -571,4 +571,4 @@
this.disallowIntercept = disallowIntercept
super.requestDisallowInterceptTouchEvent(disallowIntercept)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewOffsetsTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewOffsetsTest.kt
index 877e911..e18277c 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewOffsetsTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterAndroidViewOffsetsTest.kt
@@ -172,4 +172,4 @@
hitListener()
return true
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterComposeHookupTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterComposeHookupTest.kt
index 139d5e5..5b0ba1e 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterComposeHookupTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterComposeHookupTest.kt
@@ -449,4 +449,4 @@
assertThat(eventStringLog[2]).isEqualTo(PointerEventPass.Final.toString())
assertThat(eventStringLog[3]).isEqualTo("motionEvent")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt
index 6a82429..c2b3768 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt
@@ -47,7 +47,6 @@
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withTimeout
-import kotlinx.coroutines.yield
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -385,14 +384,9 @@
rule.runOnIdle {
runTest {
- withTimeout(400) {
- while (!results.isClosedForSend) {
- yield()
- }
+ val received = withTimeout(400) {
+ results.receiveAsFlow().toList()
}
-
- val received = results.receiveAsFlow().toList()
-
assertThat(received).hasSize(twoExpectedEvents.size)
twoExpectedEvents.forEachIndexed { index, expectedEvent ->
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/AlignmentLineTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/AlignmentLineTest.kt
index 5714cc7..5617f9f 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/AlignmentLineTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/AlignmentLineTest.kt
@@ -1329,4 +1329,4 @@
placeable.place(0, 0)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutCooperationTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutCooperationTest.kt
index e91f316..01365b8 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutCooperationTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LayoutCooperationTest.kt
@@ -115,4 +115,4 @@
.assertLeftPositionInRootIsEqualTo(expectedLeft)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
index 1b3d5d6..7f3e41e 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/LookaheadScopeTest.kt
@@ -2499,4 +2499,4 @@
postPlacement()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureOnlyTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureOnlyTest.kt
index 41e78f7..35eae9e 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureOnlyTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureOnlyTest.kt
@@ -279,4 +279,4 @@
assertThat(view.height).isEqualTo(10)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsRealClockTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsRealClockTest.kt
index 36a3ef8..9a60433 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsRealClockTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsRealClockTest.kt
@@ -554,4 +554,4 @@
): Int = height
})
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsTest.kt
index 5cd91ca..3b7b505 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RemeasureWithIntrinsicsTest.kt
@@ -583,4 +583,4 @@
): Int = height.roundToPx()
})
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RootNodeLayoutTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RootNodeLayoutTest.kt
index d850fd8..316e180 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RootNodeLayoutTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/RootNodeLayoutTest.kt
@@ -163,4 +163,4 @@
assertEquals(parent.measuredWidth, composeView.measuredWidth)
assertEquals(parent.measuredHeight, composeView.measuredHeight)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
index 925bd71..132b1dd 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
@@ -2444,4 +2444,4 @@
private enum class Screens {
Screen1,
Screen2,
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/TestRuleExecutesLayoutPassesWhenWaitingForIdleTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/TestRuleExecutesLayoutPassesWhenWaitingForIdleTest.kt
index ec23d95..b1bbfb6 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/TestRuleExecutesLayoutPassesWhenWaitingForIdleTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/TestRuleExecutesLayoutPassesWhenWaitingForIdleTest.kt
@@ -390,4 +390,4 @@
assertThat(placements).isEqualTo(numUpdates + 1)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/CompositionLocalMapInjectionTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/CompositionLocalMapInjectionTest.kt
index d64b638..c04b52d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/CompositionLocalMapInjectionTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/CompositionLocalMapInjectionTest.kt
@@ -363,4 +363,4 @@
@Composable fun OldBox(modifier: Modifier = Modifier) {
OldLayout(modifier, EmptyBoxMeasurePolicy)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalMultiLayoutNodeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalMultiLayoutNodeTest.kt
index 070ab8e..cd34e19 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalMultiLayoutNodeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalMultiLayoutNodeTest.kt
@@ -411,4 +411,4 @@
// Assert.
rule.runOnIdle { assertThat(readString).isEqualTo(providedValue) }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalSameLayoutNodeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalSameLayoutNodeTest.kt
index 2120f41c..7144730 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalSameLayoutNodeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/modifier/ModifierLocalSameLayoutNodeTest.kt
@@ -529,4 +529,4 @@
assertThat(calls).isEqualTo(1)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/InvalidateSubtreeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/InvalidateSubtreeTest.kt
index e416db9..bffa21e 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/InvalidateSubtreeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/InvalidateSubtreeTest.kt
@@ -159,4 +159,4 @@
override fun hashCode() = 0
override fun equals(other: Any?) = (other === this)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeCoroutineScopeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeCoroutineScopeTest.kt
index 2c3e809..aa3938b 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeCoroutineScopeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeCoroutineScopeTest.kt
@@ -77,4 +77,4 @@
assertThat(exception!!.stackTrace).isEmpty()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitChildrenTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitChildrenTest.kt
index 1efc8c7..9ba4db0 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitChildrenTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitChildrenTest.kt
@@ -205,4 +205,4 @@
}
private fun Modifier.otherModifier(): Modifier = this.then(Modifier)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitSelfAndChildrenTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitSelfAndChildrenTest.kt
index 60325f5..7c0aa04 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitSelfAndChildrenTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/ModifierNodeVisitSelfAndChildrenTest.kt
@@ -289,4 +289,4 @@
}
private fun Modifier.otherModifier(): Modifier = this.then(Modifier)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/MyersDiffTests.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/MyersDiffTests.kt
index edf4fce..8fb31f5 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/MyersDiffTests.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/MyersDiffTests.kt
@@ -175,4 +175,4 @@
}
})
return DiffResult(result, log)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NestedVectorStackTests.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NestedVectorStackTests.kt
index 67f3d39..74a3c0e 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NestedVectorStackTests.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NestedVectorStackTests.kt
@@ -56,4 +56,4 @@
}
Assert.assertEquals("987654321", result)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt
index bd20a93..520b601 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTester.kt
@@ -317,4 +317,4 @@
val afterEntity = chain.tail
assert(beforeEntity === afterEntity)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTests.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTests.kt
index ecac318..6d74a3a 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTests.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/node/NodeChainTests.kt
@@ -213,4 +213,4 @@
// - number of inserts/deletes/etc for different types of updates
// - ensure which same-size updates go through diff vs not
// - ensure that entities in chain are attached, out of chain are detached
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidClipboardManagerTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidClipboardManagerTest.kt
index f35c3e2..62da8e8 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidClipboardManagerTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidClipboardManagerTest.kt
@@ -261,4 +261,4 @@
assertThat(annotatedString).isEqualTo(recoveredAnnotatedString)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidComposeViewsInRecyclerViewTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidComposeViewsInRecyclerViewTest.kt
index dbeebe7..ffafb50 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidComposeViewsInRecyclerViewTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidComposeViewsInRecyclerViewTest.kt
@@ -586,4 +586,4 @@
items += this.getRecycledViewCount(type)
}
return items
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidCompositionLocalTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidCompositionLocalTest.kt
index e8a1fd1..fc5fdde 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidCompositionLocalTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidCompositionLocalTest.kt
@@ -130,4 +130,4 @@
assertThat(compositionCount).isEqualTo(3)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoaderTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoaderTest.kt
index c2cc74f..be76106 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoaderTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoaderTest.kt
@@ -45,4 +45,4 @@
)
assertThat(typeface).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewOverlayTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewOverlayTest.kt
index c671c55..b1c2668 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewOverlayTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewOverlayTest.kt
@@ -139,4 +139,4 @@
private fun Recomposer.waitForIdle() = runBlocking {
currentState.filter { it == Recomposer.State.Idle }.first()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewTest.kt
index 1b702f2..ee097a3 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewTest.kt
@@ -48,4 +48,4 @@
) as ViewGroup
assertFalse("XML overrides ComposeView.isTransitionGroup", view.isTransitionGroup)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/DepthSortedSetTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/DepthSortedSetTest.kt
index 7de34c5..1a6bb2d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/DepthSortedSetTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/DepthSortedSetTest.kt
@@ -164,4 +164,4 @@
}
}
-private fun DepthSortedSet() = DepthSortedSet(extraAssertions = true)
\ No newline at end of file
+private fun DepthSortedSet() = DepthSortedSet(extraAssertions = true)
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LayoutIdTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LayoutIdTest.kt
index 6cc5157..e452968 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LayoutIdTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LayoutIdTest.kt
@@ -94,4 +94,4 @@
assertThat(modifier.valueOverride).isEqualTo("box")
assertThat(modifier.inspectableElements.asIterable()).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
index 1ef304ba..84ac6dc 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/LocalSoftwareKeyboardControllerTest.kt
@@ -103,4 +103,4 @@
keyboardController!!.show()
keyboardController!!.hide()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowRecomposerTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowRecomposerTest.kt
index 44ebf7c..ebea1a2 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowRecomposerTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/WindowRecomposerTest.kt
@@ -282,4 +282,4 @@
get() = SampleCoroutineContextElement
companion object : CoroutineContext.Key<SampleCoroutineContextElement>
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
index cca5c26..c36fcd7 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/ColorResourcesTest.kt
@@ -47,4 +47,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
index a503656..649b9a4 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/PrimitiveResourcesTest.kt
@@ -80,4 +80,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
index 89b9648..272ad1a 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/res/StringResourcesTest.kt
@@ -205,4 +205,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerHelperTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerHelperTest.kt
index ff12cf1..0b655a3 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerHelperTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextMeasurerHelperTest.kt
@@ -125,4 +125,4 @@
assertThat(measurers.size).isEqualTo(2)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/AndroidPlatformTextInputSessionTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/AndroidPlatformTextInputSessionTest.kt
index 33b1003..240c782 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/AndroidPlatformTextInputSessionTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/AndroidPlatformTextInputSessionTest.kt
@@ -188,4 +188,4 @@
coroutineContext.job.cancelChildren()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt
index 54e4c2b..952e014 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt
@@ -116,4 +116,4 @@
verify(delegate, never()).setSelection(any(), any())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/PlatformTextInputViewIntegrationTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/PlatformTextInputViewIntegrationTest.kt
index ed2bbe7..4a4d1f5 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/PlatformTextInputViewIntegrationTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/PlatformTextInputViewIntegrationTest.kt
@@ -658,4 +658,4 @@
onNode(this)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/TestInputMethodRequest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/TestInputMethodRequest.kt
index 8bdddc8..f33098c 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/TestInputMethodRequest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/text/input/TestInputMethodRequest.kt
@@ -27,4 +27,4 @@
override fun createInputConnection(outAttrs: EditorInfo): InputConnection {
return this
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/EditTextInteropTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/EditTextInteropTest.kt
index d849a82..afda8a0 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/EditTextInteropTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/EditTextInteropTest.kt
@@ -58,4 +58,4 @@
// propagate hardware keys correctly, assert that the EditText receives the entered value.
assertThat(keyConsumed).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropTestHelper.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropTestHelper.kt
index 5392884..6122079 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropTestHelper.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropTestHelper.kt
@@ -411,4 +411,4 @@
internal fun abs(velocity: Velocity) = Velocity(
kotlin.math.abs(velocity.x),
kotlin.math.abs(velocity.y)
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropThreeFoldTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropThreeFoldTest.kt
index 67a83e3f..9f23cb0 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropThreeFoldTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropThreeFoldTest.kt
@@ -285,4 +285,4 @@
modifier = outerModifier
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropViewHolderTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropViewHolderTest.kt
index 78c6077..9f35c31 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropViewHolderTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/NestedScrollInteropViewHolderTest.kt
@@ -211,4 +211,4 @@
.isEqualTo(recyclerViewConsumptionTracker.velocityConsumed)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/PoolingContainerComposeTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/PoolingContainerComposeTest.kt
index a9b7904..5385d1d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/PoolingContainerComposeTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/PoolingContainerComposeTest.kt
@@ -181,4 +181,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/VelocityTrackingParityTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/VelocityTrackingParityTest.kt
index 1736506..175e984 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/VelocityTrackingParityTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/viewinterop/VelocityTrackingParityTest.kt
@@ -41,7 +41,11 @@
import androidx.lifecycle.Lifecycle
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso
-import androidx.test.espresso.action.ViewActions.swipeUp
+import androidx.test.espresso.action.CoordinatesProvider
+import androidx.test.espresso.action.GeneralLocation
+import androidx.test.espresso.action.GeneralSwipeAction
+import androidx.test.espresso.action.Press
+import androidx.test.espresso.action.Swipe
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
@@ -83,26 +87,31 @@
fun equalDraggable_withEqualSwipes_shouldProduceSimilarVelocity() {
// Arrange
createActivity()
- checkVisibility(composeView, View.VISIBLE)
- checkVisibility(draggableView, View.GONE)
-
- // Act
- swipeView(R.id.compose_view)
-
- val currentTopInCompose = latestComposeVelocity
-
- // switch visibility
- rule.runOnUiThread {
- composeView.visibility = View.GONE
- draggableView.visibility = View.VISIBLE
- }
-
checkVisibility(composeView, View.GONE)
checkVisibility(draggableView, View.VISIBLE)
+ // Act: Use system to send motion events and collect them.
swipeView(R.id.draggable_view)
+
val childAtTheTopOfView = draggableView.latestVelocity.y
+ // switch visibility
+ rule.runOnUiThread {
+ composeView.visibility = View.VISIBLE
+ draggableView.visibility = View.GONE
+ }
+
+ checkVisibility(composeView, View.VISIBLE)
+ checkVisibility(draggableView, View.GONE)
+
+ assertTrue { isValidGesture(draggableView.motionEvents.filterNotNull()) }
+
+ // Inject the same events in compose view
+ for (event in draggableView.motionEvents) {
+ composeView.dispatchTouchEvent(event)
+ }
+ val currentTopInCompose = latestComposeVelocity
+
// assert
assertThat(childAtTheTopOfView).isWithin(VelocityDifferenceTolerance)
.of(currentTopInCompose)
@@ -126,9 +135,39 @@
}
private fun swipeView(id: Int) {
- Espresso.onView(withId(id)).perform(swipeUp())
+ controlledSwipeUp(id)
rule.waitForIdle()
}
+
+ /**
+ * Checks the contents of [events] represents a swipe gesture.
+ */
+ private fun isValidGesture(events: List<MotionEvent>): Boolean {
+ val down = events.filter { it.action == MotionEvent.ACTION_DOWN }
+ val move = events.filter { it.action == MotionEvent.ACTION_MOVE }
+ val up = events.filter { it.action == MotionEvent.ACTION_UP }
+ return down.size == 1 && move.isNotEmpty() && up.size == 1
+ }
+}
+
+internal fun controlledSwipeUp(id: Int) {
+ Espresso.onView(withId(id))
+ .perform(
+ espressoSwipe(
+ GeneralLocation.CENTER,
+ GeneralLocation.TOP_CENTER
+ )
+ )
+}
+
+private fun espressoSwipe(
+ start: CoordinatesProvider,
+ end: CoordinatesProvider
+): GeneralSwipeAction {
+ return GeneralSwipeAction(
+ Swipe.FAST, start, end,
+ Press.FINGER
+ )
}
@Composable
@@ -154,10 +193,11 @@
activity.setContentView(layout)
with(activity.findViewById<ComposeView>(R.id.compose_view)) {
setContent(content)
+ visibility = View.GONE
}
activity.findViewById<VelocityTrackingView>(R.id.draggable_view)?.visibility =
- View.GONE
+ View.VISIBLE
}
moveToState(Lifecycle.State.RESUMED)
}
@@ -169,7 +209,9 @@
View(context, attributeSet) {
private val tracker = VelocityTracker.obtain()
var latestVelocity: Velocity = Velocity.Zero
+ val motionEvents = mutableListOf<MotionEvent?>()
override fun onTouchEvent(event: MotionEvent?): Boolean {
+ motionEvents.add(MotionEvent.obtain(event))
when (event?.action) {
MotionEvent.ACTION_UP -> {
tracker.computeCurrentVelocity(1000)
@@ -194,4 +236,4 @@
}
}
-private const val VelocityDifferenceTolerance = 10f
\ No newline at end of file
+private const val VelocityDifferenceTolerance = 10f
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/ActivityWithInsets.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/ActivityWithInsets.kt
index be8f248..04359b5 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/ActivityWithInsets.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/ActivityWithInsets.kt
@@ -24,4 +24,4 @@
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogSecureFlagTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogSecureFlagTest.kt
index 7b1a7b6..01dd14d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogSecureFlagTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogSecureFlagTest.kt
@@ -127,4 +127,4 @@
return (owner.rootView.layoutParams as WindowManager.LayoutParams).flags and
WindowManager.LayoutParams.FLAG_SECURE != 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
index d98d807..f53a959 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/DialogTest.kt
@@ -375,4 +375,4 @@
Truth.assertThat(actualWidth).isEqualTo((40 * rule.density.density).roundToInt())
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
index b9949ca..c6ce011 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupAlignmentTest.kt
@@ -397,4 +397,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupSecureFlagTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupSecureFlagTest.kt
index 2889dc2..f4aec1d 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupSecureFlagTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PopupSecureFlagTest.kt
@@ -138,4 +138,4 @@
return popupMatcher.lastSeenWindowParams!!.flags and
WindowManager.LayoutParams.FLAG_SECURE != 0
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.android.kt
index 3ef53ac..1b530eb 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.android.kt
@@ -227,4 +227,4 @@
width: Int,
height: Int
) = structure.setDimens(left, top, scrollX, scrollY, width, height)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/AndroidVectorResources.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/AndroidVectorResources.android.kt
index 1c1e21c..0cb7728 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/AndroidVectorResources.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/AndroidVectorResources.android.kt
@@ -95,4 +95,4 @@
intArrayOf(android.R.attr.name, android.R.attr.pathData)
val STYLEABLE_VECTOR_DRAWABLE_CLIP_PATH_NAME = 0
val STYLEABLE_VECTOR_DRAWABLE_CLIP_PATH_PATH_DATA = 1
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParser.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParser.android.kt
index b307f18..53c5b79 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParser.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/graphics/vector/compat/XmlVectorParser.android.kt
@@ -723,4 +723,4 @@
return result
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.android.kt
index c0ce531..05cd2ca 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.android.kt
@@ -33,4 +33,4 @@
}?.issuesEnterExit ?: false
actual var suppressMovementConsumption: Boolean = false
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.android.kt
index c2c1350..d0ab04a 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.android.kt
@@ -78,4 +78,4 @@
internal actual val pointerIconDefault: PointerIcon = AndroidPointerIconType(TYPE_DEFAULT)
internal actual val pointerIconCrosshair: PointerIcon = AndroidPointerIconType(TYPE_CROSSHAIR)
internal actual val pointerIconText: PointerIcon = AndroidPointerIconType(TYPE_TEXT)
-internal actual val pointerIconHand: PointerIcon = AndroidPointerIconType(TYPE_HAND)
\ No newline at end of file
+internal actual val pointerIconHand: PointerIcon = AndroidPointerIconType(TYPE_HAND)
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropUtils.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropUtils.android.kt
index 05ca9c9..f9cc561 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropUtils.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropUtils.android.kt
@@ -84,4 +84,4 @@
action = oldAction
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/UiApplier.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/UiApplier.android.kt
index c3ec8d3..c516421 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/UiApplier.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/UiApplier.android.kt
@@ -47,4 +47,4 @@
super.onEndChanges()
root.owner?.onEndApplyChanges()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/ViewInterop.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/ViewInterop.android.kt
index 3126227..bfeff03 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/ViewInterop.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/node/ViewInterop.android.kt
@@ -94,4 +94,4 @@
setTag(viewAdaptersKey, adapter)
}
return adapter
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidClipboardManager.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidClipboardManager.android.kt
index 445b00b..cdc9714 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidClipboardManager.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidClipboardManager.android.kt
@@ -547,4 +547,4 @@
private const val BASELINE_SHIFT_SIZE = FLOAT_SIZE
private const val TEXT_GEOMETRIC_TRANSFORM_SIZE = FLOAT_SIZE * 2
private const val TEXT_DECORATION_SIZE = INT_SIZE
-private const val SHADOW_SIZE = COLOR_SIZE + FLOAT_SIZE * 3
\ No newline at end of file
+private const val SHADOW_SIZE = COLOR_SIZE + FLOAT_SIZE * 3
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoader.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoader.android.kt
index f707d67..eb48e82 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoader.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidFontResourceLoader.android.kt
@@ -67,4 +67,4 @@
fun create(context: Context, resourceId: Int): Typeface {
return context.resources.getFont(resourceId)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidTextToolbar.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidTextToolbar.android.kt
index 54d9e4c..6849410 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidTextToolbar.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidTextToolbar.android.kt
@@ -101,4 +101,4 @@
fun invalidateContentRect(actionMode: ActionMode) {
actionMode.invalidateContentRect()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock.android.kt
index 1f96ec4..cbb4b7f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock.android.kt
@@ -57,4 +57,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUriHandler.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUriHandler.android.kt
index c95ab4f..714ba62 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUriHandler.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidUriHandler.android.kt
@@ -25,4 +25,4 @@
override fun openUri(uri: String) {
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(uri)))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/NestedScrollInteropConnection.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/NestedScrollInteropConnection.kt
index 06ca492..b43e3fc 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/NestedScrollInteropConnection.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/NestedScrollInteropConnection.kt
@@ -233,4 +233,4 @@
hostView: View = LocalView.current
): NestedScrollConnection = remember(hostView) {
NestedScrollInteropConnection(hostView)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.android.kt
index 7cc8793..ea9cf2f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.android.kt
@@ -28,4 +28,4 @@
val view: View
actual suspend fun startInputMethod(request: PlatformTextInputMethodRequest): Nothing
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WeakCache.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WeakCache.kt
index 1d196f3..d3bfe77 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WeakCache.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WeakCache.kt
@@ -73,4 +73,4 @@
}
} while (item != null)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt
index 820d05d..a9d8c5f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.android.kt
@@ -26,6 +26,8 @@
import androidx.compose.runtime.Composition
import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.CompositionServiceKey
+import androidx.compose.runtime.CompositionServices
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Recomposer
import androidx.compose.runtime.currentComposer
@@ -123,7 +125,7 @@
private class WrappedComposition(
val owner: AndroidComposeView,
val original: Composition
-) : Composition, LifecycleEventObserver {
+) : Composition, LifecycleEventObserver, CompositionServices {
private var disposed = false
private var addedToLifecycle: Lifecycle? = null
@@ -184,6 +186,9 @@
}
}
}
+
+ override fun <T> getCompositionService(key: CompositionServiceKey<T>): T? =
+ (original as? CompositionServices)?.getCompositionService(key)
}
private val DefaultLayoutParams = ViewGroup.LayoutParams(
@@ -216,4 +221,4 @@
@DoNotInline
fun attributeSourceResourceMap(view: View): Map<Int, Int> =
view.attributeSourceResourceMap
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt
index 7a4e421..212864c 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt
@@ -150,4 +150,4 @@
columnSpan,
false,
itemNode.config.getOrElse(SemanticsProperties.Selected) { false }
- )
\ No newline at end of file
+ )
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/PrimaryTextActionModeCallback.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/PrimaryTextActionModeCallback.android.kt
index b2441f4..9d711b6 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/PrimaryTextActionModeCallback.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/PrimaryTextActionModeCallback.android.kt
@@ -38,4 +38,4 @@
override fun onDestroyActionMode(mode: ActionMode?) {
callback.onDestroyActionMode()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/TextActionModeCallback.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/TextActionModeCallback.android.kt
index 97fbb47..a1d60a6 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/TextActionModeCallback.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/actionmodecallback/TextActionModeCallback.android.kt
@@ -116,4 +116,4 @@
* This item will be shown before all items that have order greater than this value.
*/
val order = id
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/PainterResources.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/PainterResources.android.kt
index b075bfc..32dcbe67 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/PainterResources.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/PainterResources.android.kt
@@ -121,4 +121,4 @@
) : RuntimeException(message, cause)
private const val errorMessage =
- "Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG, WEBP"
\ No newline at end of file
+ "Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG, WEBP"
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/Resources.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/Resources.android.kt
index d034198..5834528 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/Resources.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/Resources.android.kt
@@ -31,4 +31,4 @@
internal fun resources(): Resources {
LocalConfiguration.current
return LocalContext.current.resources
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/VectorResources.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/VectorResources.android.kt
index 136a23c..eeb02ee 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/VectorResources.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/VectorResources.android.kt
@@ -150,4 +150,4 @@
fun clear() {
map.clear()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.android.kt
index 515bef0..f30e414 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.android.kt
@@ -52,4 +52,4 @@
@set:ExperimentalComposeUiApi
@ExperimentalComposeUiApi
var SemanticsPropertyReceiver.testTagsAsResourceId by
- SemanticsPropertiesAndroid.TestTagsAsResourceId
\ No newline at end of file
+ SemanticsPropertiesAndroid.TestTagsAsResourceId
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputEventCallback2.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputEventCallback2.android.kt
index 84b9702..11c09cf 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputEventCallback2.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputEventCallback2.android.kt
@@ -61,4 +61,4 @@
* @param ic a closed input connection
*/
fun onConnectionClosed(ic: RecordingInputConnection)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.kt
index 345de38..df90db0 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.kt
@@ -200,4 +200,4 @@
final override fun commitContent(p0: InputContentInfo, p1: Int, p2: Bundle?): Boolean =
delegate?.commitContent(p0, p1, p2) ?: false
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/RecordingInputConnection.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/RecordingInputConnection.android.kt
index dfa347d..1e26015 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/RecordingInputConnection.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/RecordingInputConnection.android.kt
@@ -449,4 +449,4 @@
private fun logDebug(message: String) {
if (DEBUG) { Log.d(TAG, "$DEBUG_CLASS.$message, $isActive") }
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
index a721c15..be9b6c5 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
@@ -572,4 +572,4 @@
postFrameCallback { runnable.run() }
}
-private fun hasFlag(bits: Int, flag: Int): Boolean = (bits and flag) == flag
\ No newline at end of file
+private fun hasFlag(bits: Int, flag: Int): Boolean = (bits and flag) == flag
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidView.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidView.android.kt
index efabfe9..2aba2bf 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidView.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidView.android.kt
@@ -395,4 +395,4 @@
private fun unregisterSaveStateProvider() {
savableRegistryEntry = null
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropView.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropView.android.kt
index 7c03e9a..3d00470 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropView.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropView.android.kt
@@ -18,4 +18,4 @@
import android.view.View
-actual typealias InteropView = View
\ No newline at end of file
+actual typealias InteropView = View
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.android.kt
index 278fdeb..485d153 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.android.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.viewinterop
-internal actual typealias InteropViewFactoryHolder = AndroidViewHolder
\ No newline at end of file
+internal actual typealias InteropViewFactoryHolder = AndroidViewHolder
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/SecureFlagPolicy.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/SecureFlagPolicy.android.kt
index 4a4e04d..4046a63 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/SecureFlagPolicy.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/window/SecureFlagPolicy.android.kt
@@ -46,4 +46,4 @@
SecureFlagPolicy.SecureOn -> true
SecureFlagPolicy.Inherit -> isSecureFlagSetOnParent
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt
index e7eddf6..72a4419 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt
@@ -24,4 +24,4 @@
fun set(value: V)
fun getAndSet(value: V): V
fun compareAndSet(expect: V, newValue: V): Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/Expect.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/Expect.kt
index 0e9bad8..ec40633 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/Expect.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/Expect.kt
@@ -36,4 +36,4 @@
@OptIn(ExperimentalComposeUiApi::class)
internal expect fun InspectorInfo.tryPopulateReflectively(
element: ModifierNodeElement<*>
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/ExperimentalComposeUiApi.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/ExperimentalComposeUiApi.kt
index 00116b9..fac714b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/ExperimentalComposeUiApi.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/ExperimentalComposeUiApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalComposeUiApi
\ No newline at end of file
+annotation class ExperimentalComposeUiApi
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/Autofill.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/Autofill.kt
index 84e8ca6..d1db594 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/Autofill.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/Autofill.kt
@@ -101,4 +101,4 @@
result = 31 * result + (onFill?.hashCode() ?: 0)
return result
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/AutofillTree.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/AutofillTree.kt
index 5a8eb84..e200bc6 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/AutofillTree.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/autofill/AutofillTree.kt
@@ -48,4 +48,4 @@
* [id] with the specified [value].
*/
fun performAutofill(id: Int, value: String) = children[id]?.onFill?.invoke(value)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Blur.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Blur.kt
index a34e0b4..7eda4d8 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Blur.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Blur.kt
@@ -150,4 +150,4 @@
fun Modifier.blur(
radius: Dp,
edgeTreatment: BlurredEdgeTreatment = BlurredEdgeTreatment.Rectangle
-) = blur(radius, radius, edgeTreatment)
\ No newline at end of file
+) = blur(radius, radius, edgeTreatment)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Clip.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Clip.kt
index 0694e48..45e4290 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Clip.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Clip.kt
@@ -33,4 +33,4 @@
* @param shape the content will be clipped to this [Shape].
*/
@Stable
-fun Modifier.clip(shape: Shape) = graphicsLayer(shape = shape, clip = true)
\ No newline at end of file
+fun Modifier.clip(shape: Shape) = graphicsLayer(shape = shape, clip = true)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Rotate.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Rotate.kt
index 5579bc1..4e98780 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Rotate.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/draw/Rotate.kt
@@ -33,4 +33,4 @@
*/
@Stable
fun Modifier.rotate(degrees: Float) =
- if (degrees != 0f) graphicsLayer(rotationZ = degrees) else this
\ No newline at end of file
+ if (degrees != 0f) graphicsLayer(rotationZ = degrees) else this
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusPropertiesModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusPropertiesModifierNode.kt
index 20b61f1..0359bb4 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusPropertiesModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusPropertiesModifierNode.kt
@@ -35,4 +35,4 @@
fun FocusPropertiesModifierNode.invalidateFocusProperties() {
requireOwner().focusOwner.scheduleInvalidation(this)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/DrawCache.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/DrawCache.kt
index c11e511..1c4a8e1 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/DrawCache.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/DrawCache.kt
@@ -103,4 +103,4 @@
private fun DrawScope.clear() {
drawRect(color = Color.Black, blendMode = BlendMode.Clear)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedback.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedback.kt
index e6b6fec..234ac09 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedback.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedback.kt
@@ -24,4 +24,4 @@
* Provide haptic feedback to the user.
*/
fun performHapticFeedback(hapticFeedbackType: HapticFeedbackType)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackType.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackType.kt
index 96607ef..65e8fac 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackType.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackType.kt
@@ -53,4 +53,4 @@
internal expect object PlatformHapticFeedbackType {
val LongPress: HapticFeedbackType
val TextHandleMove: HapticFeedbackType
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/InputModeManager.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/InputModeManager.kt
index f6a6fe2..d070126 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/InputModeManager.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/InputModeManager.kt
@@ -73,4 +73,4 @@
@ExperimentalComposeUiApi
override fun requestInputMode(inputMode: InputMode) = onRequestInputModeChange.invoke(inputMode)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifier.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifier.kt
index 94c56a7..651727c 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifier.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifier.kt
@@ -371,4 +371,4 @@
properties["connection"] = connection
properties["dispatcher"] = dispatcher
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.kt
index 2484837..a1ac20b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.kt
@@ -239,4 +239,4 @@
* The unique identifier used as the key for the custom [ModifierLocalProvider] created to tell us
* the current [PointerIcon].
*/
-private val ModifierLocalPointerIcon = modifierLocalOf<PointerIconModifierLocal?> { null }
\ No newline at end of file
+private val ModifierLocalPointerIcon = modifierLocalOf<PointerIconModifierLocal?> { null }
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker.kt
index d73b265..9db434e 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker.kt
@@ -316,6 +316,7 @@
}
}
+@OptIn(ExperimentalComposeUiApi::class)
private fun VelocityTracker.addPointerInputChangeLegacy(event: PointerInputChange) {
// Register down event as the starting point for the accumulator
@@ -373,7 +374,7 @@
if (!event.changedToUpIgnoreConsumed() && !event.changedToDownIgnoreConsumed()) {
lastMoveEventTimeStamp = event.uptimeMillis
if (event.historical.isEmpty()) {
- val delta = event.position - currentPointerPositionAccumulator
+ val delta = event.position - event.previousPosition
currentPointerPositionAccumulator += delta
addPosition(event.uptimeMillis, currentPointerPositionAccumulator)
} else {
@@ -685,4 +686,4 @@
@get:ExperimentalComposeUiApi
@set:ExperimentalComposeUiApi
@ExperimentalComposeUiApi
-var VelocityTrackerAddPointsFix: Boolean by mutableStateOf(false)
\ No newline at end of file
+var VelocityTrackerAddPointsFix: Boolean by mutableStateOf(false)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.kt
index 2c32968..209ced5 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui.internal
-internal expect annotation class JvmDefaultWithCompatibility()
\ No newline at end of file
+internal expect annotation class JvmDefaultWithCompatibility()
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntermediateLayoutModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntermediateLayoutModifierNode.kt
index 19fcadb..a371e65 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntermediateLayoutModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntermediateLayoutModifierNode.kt
@@ -314,4 +314,4 @@
override val coroutineContext: CoroutineContext
get() = coroutineScope.coroutineContext
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope.kt
index 68891fa..a039b3b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/IntrinsicMeasureScope.kt
@@ -38,4 +38,4 @@
*/
val isLookingAhead: Boolean
get() = false
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutId.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutId.kt
index 9fa709a..693195a 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutId.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutId.kt
@@ -82,4 +82,4 @@
* @sample androidx.compose.ui.samples.LayoutTagChildrenUsage
*/
val Measurable.layoutId: Any?
- get() = (parentData as? LayoutIdParentData)?.layoutId
\ No newline at end of file
+ get() = (parentData as? LayoutIdParentData)?.layoutId
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
index 8c3c500..4e8bdbe 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LayoutModifier.kt
@@ -293,4 +293,4 @@
override fun toString(): String {
return "LayoutModifierImpl(measureBlock=$measureBlock)"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
index 949cb76..ba4ee3b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/LookaheadScope.kt
@@ -187,4 +187,4 @@
override val Placeable.PlacementScope.lookaheadScopeCoordinates: LayoutCoordinates
get() = scopeCoordinates!!()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Measurable.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Measurable.kt
index d32be83..a5efa15 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Measurable.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Measurable.kt
@@ -28,4 +28,4 @@
* size. A [Measurable] can only be measured once inside a layout pass.
*/
fun measure(constraints: Constraints): Placeable
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/MeasureResult.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/MeasureResult.kt
index 3181d94..ab309fb 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/MeasureResult.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/MeasureResult.kt
@@ -14,4 +14,4 @@
val height: Int
val alignmentLines: Map<AlignmentLine, Int>
fun placeChildren()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnPlacedModifier.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnPlacedModifier.kt
index c4acf63..fcfda60 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnPlacedModifier.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/OnPlacedModifier.kt
@@ -76,4 +76,4 @@
* parent [LayoutModifier] and parent layout can be calculated using the [LayoutCoordinates].
*/
fun onPlaced(coordinates: LayoutCoordinates)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
index b20aa16..5ad4f9c 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/Placeable.kt
@@ -423,4 +423,4 @@
*/
private val DefaultLayerBlock: GraphicsLayerScope.() -> Unit = {}
-private val DefaultConstraints = Constraints()
\ No newline at end of file
+private val DefaultConstraints = Constraints()
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/RootMeasurePolicy.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/RootMeasurePolicy.kt
index 91aec0b..7c76766 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/RootMeasurePolicy.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/RootMeasurePolicy.kt
@@ -64,4 +64,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
index 7ea18cd..35e79ac 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
@@ -194,4 +194,4 @@
androidx.compose.ui.util.lerp(start.scaleX, stop.scaleX, fraction),
androidx.compose.ui.util.lerp(start.scaleY, stop.scaleY, fraction)
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocal.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocal.kt
index b98ef0a..34662c8 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocal.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocal.kt
@@ -106,4 +106,4 @@
* or above this modifier in the layout tree.
*/
val <T> ModifierLocal<T>.current: T
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalConsumer.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalConsumer.kt
index cb2ad69..6d291ff 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalConsumer.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalConsumer.kt
@@ -71,4 +71,4 @@
}
override fun hashCode() = consumer.hashCode()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalManager.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalManager.kt
index 620349c..68e7866 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalManager.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalManager.kt
@@ -118,4 +118,4 @@
removedLocal += key
invalidate()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalProvider.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalProvider.kt
index b689b69..39894e1 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalProvider.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/modifier/ModifierLocalProvider.kt
@@ -66,4 +66,4 @@
override val value by derivedStateOf(value)
}
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/BackwardsCompatNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/BackwardsCompatNode.kt
index 179c56f..89ab17a 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/BackwardsCompatNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/BackwardsCompatNode.kt
@@ -456,4 +456,4 @@
private fun BackwardsCompatNode.isChainUpdate(): Boolean {
val tailNode = requireLayoutNode().nodes.tail as TailModifierNode
return tailNode.attachHasBeenRun
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/CompositionLocalConsumerModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/CompositionLocalConsumerModifierNode.kt
index 2d6f733..5b541ad 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/CompositionLocalConsumerModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/CompositionLocalConsumerModifierNode.kt
@@ -73,4 +73,4 @@
"Cannot read CompositionLocal because the Modifier node is not currently attached."
}
return requireLayoutNode().compositionLocalMap[local]
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatableNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatableNode.kt
index ece4784..d5ad56e 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatableNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatableNode.kt
@@ -423,4 +423,4 @@
private fun MutableVector<Modifier.Node>?.pop(): Modifier.Node? {
return if (this == null || isEmpty()) null
else removeAt(size - 1)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/GlobalPositionAwareModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/GlobalPositionAwareModifierNode.kt
index cc280a3..3265083 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/GlobalPositionAwareModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/GlobalPositionAwareModifierNode.kt
@@ -41,4 +41,4 @@
* the [LayoutCoordinates] argument or when the [onGloballyPositioned] is called.
*/
fun onGloballyPositioned(coordinates: LayoutCoordinates)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/InteroperableComposeUiNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/InteroperableComposeUiNode.kt
index 1c9615a..612d684 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/InteroperableComposeUiNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/InteroperableComposeUiNode.kt
@@ -27,4 +27,4 @@
@InternalComposeUiApi
sealed interface InteroperableComposeUiNode {
fun getInteropView(): InteropView?
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutAwareModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutAwareModifierNode.kt
index 9f6af91..6637cb9 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutAwareModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutAwareModifierNode.kt
@@ -47,4 +47,4 @@
* most common usage is [onSizeChanged].
*/
fun onRemeasured(size: IntSize) {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutModifierNode.kt
index 9bac97d..fa1fb316 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutModifierNode.kt
@@ -299,4 +299,4 @@
private enum class IntrinsicMinMax { Min, Max }
private enum class IntrinsicWidthHeight { Width, Height }
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
index 2fa7171..c55e1d35 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
@@ -1458,4 +1458,4 @@
*/
internal fun LayoutNode.add(child: LayoutNode) {
insertAt(children.size, child)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeAlignmentLines.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeAlignmentLines.kt
index b682397..98abd1b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeAlignmentLines.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeAlignmentLines.kt
@@ -243,4 +243,4 @@
override fun NodeCoordinator.calculatePositionInParent(position: Offset): Offset =
this.lookaheadDelegate!!.position.toOffset() + position
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeDrawScope.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeDrawScope.kt
index 23c5790..784e739 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeDrawScope.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNodeDrawScope.kt
@@ -124,4 +124,4 @@
next = next.child
}
return null
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MeasureBlocks.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MeasureBlocks.kt
index f813b01..351ac71 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MeasureBlocks.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MeasureBlocks.kt
@@ -70,4 +70,4 @@
measurables: List<IntrinsicMeasurable>,
w: Int
): Int
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ModifierNodeElement.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ModifierNodeElement.kt
index 7cf6f2d..009aaf0 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ModifierNodeElement.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ModifierNodeElement.kt
@@ -101,4 +101,4 @@
* inputs may implement this function by checking the type of the other object.
*/
abstract override fun equals(other: Any?): Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MutableVectorWithMutationTracking.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MutableVectorWithMutationTracking.kt
index 5a7b0aa..5312521 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MutableVectorWithMutationTracking.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MutableVectorWithMutationTracking.kt
@@ -50,4 +50,4 @@
fun asList(): List<T> = vector.asMutableList()
operator fun get(index: Int): T = vector[index]
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NestedVectorStack.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NestedVectorStack.kt
index ba3a4c7..915bc00 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NestedVectorStack.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NestedVectorStack.kt
@@ -54,4 +54,4 @@
current++
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeChain.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeChain.kt
index f6a0aea..20e43e3 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeChain.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeChain.kt
@@ -832,4 +832,4 @@
}
}
return result
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt
index 31c7c4c..afe3564 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt
@@ -333,4 +333,4 @@
} else {
calculateNodeKindSetFrom(node)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/OwnerScope.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/OwnerScope.kt
index 938d179..9a94292 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/OwnerScope.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/OwnerScope.kt
@@ -28,4 +28,4 @@
* observations are no longer necessary.
*/
val isValidOwnerScope: Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ParentDataModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ParentDataModifierNode.kt
index 950f087..03dd713 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ParentDataModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/ParentDataModifierNode.kt
@@ -41,4 +41,4 @@
* This invalidates the current node's parent data, and ensures that layouts that utilize it will be
* scheduled to relayout for the next frame.
*/
-fun ParentDataModifierNode.invalidateParentData() = requireLayoutNode().invalidateParentData()
\ No newline at end of file
+fun ParentDataModifierNode.invalidateParentData() = requireLayoutNode().invalidateParentData()
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/RootForTest.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/RootForTest.kt
index e009d51..aea1975 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/RootForTest.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/RootForTest.kt
@@ -61,4 +61,4 @@
*/
@ExperimentalComposeUiApi
fun measureAndLayoutForTest() {}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/SemanticsModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/SemanticsModifierNode.kt
index 1cc3317..3b50fbd 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/SemanticsModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/SemanticsModifierNode.kt
@@ -103,4 +103,4 @@
}
return requireCoordinator(Nodes.Semantics).touchBoundsInRoot()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AccessibilityManager.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AccessibilityManager.kt
index 70beef4..fa8a959 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AccessibilityManager.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AccessibilityManager.kt
@@ -48,4 +48,4 @@
containsText: Boolean = false,
containsControls: Boolean = false
): Long
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt
index b5a0be1..f36eaed 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt
@@ -22,4 +22,4 @@
expect class AtomicInt(value_: Int) {
fun addAndGet(delta: Int): Int
fun compareAndSet(expected: Int, new: Int): Boolean
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ClassHelpers.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ClassHelpers.kt
index 92b94de..a52773b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ClassHelpers.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ClassHelpers.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.platform
// For performance optimizations of type.
-internal expect fun Any.nativeClass(): Any
\ No newline at end of file
+internal expect fun Any.nativeClass(): Any
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/DebugUtils.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/DebugUtils.kt
index b31b781..b352175 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/DebugUtils.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/DebugUtils.kt
@@ -20,4 +20,4 @@
block()
}
-internal expect fun simpleIdentityToString(obj: Any, name: String?): String
\ No newline at end of file
+internal expect fun simpleIdentityToString(obj: Any, name: String?): String
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InfiniteAnimationPolicy.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InfiniteAnimationPolicy.kt
index 25b5cd5..e497bd2 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InfiniteAnimationPolicy.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InfiniteAnimationPolicy.kt
@@ -63,4 +63,4 @@
when (val policy = coroutineContext[InfiniteAnimationPolicy]) {
null -> withFrameNanos(onFrame)
else -> policy.onInfiniteOperation { withFrameNanos(onFrame) }
- }
\ No newline at end of file
+ }
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InvertMatrix.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InvertMatrix.kt
index d2e6c52..8f0153c 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InvertMatrix.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/InvertMatrix.kt
@@ -74,4 +74,4 @@
other[3, 2] = ((-a30 * b03 + a31 * b01 - a32 * b00) * invDet)
other[3, 3] = ((a20 * b03 - a21 * b01 + a22 * b00) * invDet)
return true
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputModifierNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputModifierNode.kt
index b577306..2706ca9 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputModifierNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputModifierNode.kt
@@ -88,4 +88,4 @@
*/
suspend fun PlatformTextInputModifierNode.textInputSession(
session: suspend PlatformTextInputSessionScope.() -> Nothing
-): Nothing = requireOwner().textInputSession(session)
\ No newline at end of file
+): Nothing = requireOwner().textInputSession(session)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ShapeContainingUtil.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ShapeContainingUtil.kt
index d52279c..eebf652 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ShapeContainingUtil.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ShapeContainingUtil.kt
@@ -158,4 +158,4 @@
opPath.reset()
touchPointPath.reset()
return !isClipped
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
index 12a4c1a..e25a7cc 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/SoftwareKeyboardController.kt
@@ -72,4 +72,4 @@
@Suppress("DEPRECATION")
textInputService.hideSoftwareKeyboard()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
index 0942d88..d1dd4cc 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Subcomposition.kt
@@ -23,4 +23,4 @@
internal expect fun createSubcomposition(
container: LayoutNode,
parent: CompositionContext
-): Composition
\ No newline at end of file
+): Composition
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt
index c146d16..557f57d 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt
@@ -32,4 +32,4 @@
properties = {
testTag = tag
}
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbar.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbar.kt
index 4ac8387..44591ac 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbar.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbar.kt
@@ -52,4 +52,4 @@
* @return [TextToolbarStatus] of [TextToolbar].
*/
val status: TextToolbarStatus
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbarStatus.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbarStatus.kt
index e4afc87..d814abc 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbarStatus.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TextToolbarStatus.kt
@@ -28,4 +28,4 @@
* The [TextToolbar] is hidden.
*/
Hidden
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/UriHandler.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/UriHandler.kt
index 3a0b7c1..104fc59 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/UriHandler.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/UriHandler.kt
@@ -24,4 +24,4 @@
* Open given URL in browser
*/
fun openUri(uri: String)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ViewConfiguration.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ViewConfiguration.kt
index d74db18..79fd45b 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ViewConfiguration.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/ViewConfiguration.kt
@@ -54,4 +54,4 @@
*/
val minimumTouchTargetSize: DpSize
get() = DpSize(48.dp, 48.dp)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsModifier.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsModifier.kt
index 688113e..dd4decb 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsModifier.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsModifier.kt
@@ -205,4 +205,4 @@
properties["properties"] = semanticsConfiguration.associate { (key, value) ->
key.name to value
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt
index 1c5a975..e72cfd8 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt
@@ -466,4 +466,4 @@
private val SemanticsNode.role get() = this.unmergedConfig.getOrNull(SemanticsProperties.Role)
private fun SemanticsNode.contentDescriptionFakeNodeId() = this.id + 2_000_000_000
-private fun SemanticsNode.roleFakeNodeId() = this.id + 1_000_000_000
\ No newline at end of file
+private fun SemanticsNode.roleFakeNodeId() = this.id + 1_000_000_000
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
index 96d0e6b..39e6cb6 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
@@ -1386,4 +1386,4 @@
action: (() -> Boolean)?
) {
this[SemanticsActions.PageRight] = AccessibilityAction(label, action)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/state/ToggleableState.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/state/ToggleableState.kt
index 0258ebf..7a03d3a 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/state/ToggleableState.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/state/ToggleableState.kt
@@ -42,4 +42,4 @@
*
* @param value whether the ToggleableState is on or off
*/
-fun ToggleableState(value: Boolean) = if (value) On else Off
\ No newline at end of file
+fun ToggleableState(value: Boolean) = if (value) On else Off
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurerHelper.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurerHelper.kt
index 5b6565a..9c0a0a8 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurerHelper.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/text/TextMeasurerHelper.kt
@@ -51,4 +51,4 @@
return remember(fontFamilyResolver, density, layoutDirection, cacheSize) {
TextMeasurer(fontFamilyResolver, density, layoutDirection, cacheSize)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt
index 4fd9db3..9bc1832 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt
@@ -24,4 +24,4 @@
* in which case the typealias will resolve to [Any].
*/
@InternalComposeUiApi
-expect class InteropView
\ No newline at end of file
+expect class InteropView
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt
index 56ba24a..f72fa1e 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt
@@ -22,4 +22,4 @@
@InternalComposeUiApi
internal expect class InteropViewFactoryHolder : ComposeNodeLifecycleCallback {
fun getInteropView(): InteropView?
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeLayer.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeLayer.desktop.kt
index b849495..2c00a20 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeLayer.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeLayer.desktop.kt
@@ -398,4 +398,4 @@
DesktopPlatform.Current == DesktopPlatform.MacOS &&
((modifiersEx and InputEvent.BUTTON1_DOWN_MASK) != 0) &&
((modifiersEx and InputEvent.CTRL_DOWN_MASK) != 0)
- )
\ No newline at end of file
+ )
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/LocalLayerContainer.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/LocalLayerContainer.desktop.kt
index 7999d4f..c0f9c25 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/LocalLayerContainer.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/LocalLayerContainer.desktop.kt
@@ -21,4 +21,4 @@
internal val LocalLayerContainer = compositionLocalOf<Container> {
error("CompositionLocal LayerContainer not provided")
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/hapticfeedback/PlatformHapticFeedbackType.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/hapticfeedback/PlatformHapticFeedbackType.desktop.kt
index 808d843..d689afa 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/hapticfeedback/PlatformHapticFeedbackType.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/hapticfeedback/PlatformHapticFeedbackType.desktop.kt
@@ -22,4 +22,4 @@
internal actual object PlatformHapticFeedbackType {
actual val LongPress: HapticFeedbackType = HapticFeedbackType(0)
actual val TextHandleMove: HapticFeedbackType = HapticFeedbackType(9)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/KeyShortcut.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/KeyShortcut.desktop.kt
index 2c4f3ce..ad253e1 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/KeyShortcut.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/KeyShortcut.desktop.kt
@@ -93,4 +93,4 @@
if (shift) value = value or InputEvent.SHIFT_DOWN_MASK
value
}
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.desktop.kt
index 0bd66bd..bb0a910 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/InternalPointerEvent.desktop.kt
@@ -41,4 +41,4 @@
// Assume that all changes are from mouse events for now
actual fun issuesEnterExitEvent(pointerId: PointerId): Boolean = true
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.desktop.kt
index 06534e7..e6e52fd 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/pointer/PointerIcon.desktop.kt
@@ -47,4 +47,4 @@
internal actual val pointerIconDefault: PointerIcon = AwtCursor(Cursor(Cursor.DEFAULT_CURSOR))
internal actual val pointerIconCrosshair: PointerIcon = AwtCursor(Cursor(Cursor.CROSSHAIR_CURSOR))
internal actual val pointerIconText: PointerIcon = AwtCursor(Cursor(Cursor.TEXT_CURSOR))
-internal actual val pointerIconHand: PointerIcon = AwtCursor(Cursor(Cursor.HAND_CURSOR))
\ No newline at end of file
+internal actual val pointerIconHand: PointerIcon = AwtCursor(Cursor(Cursor.HAND_CURSOR))
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.desktop.kt
index 437c083..37f028c 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopOwner.desktop.kt
@@ -50,4 +50,4 @@
containerCursor?.componentCursor = defaultCursor
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopPlatform.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopPlatform.desktop.kt
index 69b44f4..03ad58a 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopPlatform.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopPlatform.desktop.kt
@@ -52,4 +52,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopTextInputSession.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopTextInputSession.kt
index de9af896..35f8ff9 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopTextInputSession.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/DesktopTextInputSession.kt
@@ -47,4 +47,4 @@
}
})
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformLocalization.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformLocalization.desktop.kt
index b0c95a3..0e985da 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformLocalization.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformLocalization.desktop.kt
@@ -34,4 +34,4 @@
val LocalLocalization = staticCompositionLocalOf {
defaultPlatformLocalization
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.desktop.kt
index a531248..f35320b 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/PlatformTextInputSession.desktop.kt
@@ -20,4 +20,4 @@
actual interface PlatformTextInputSession {
actual suspend fun startInputMethod(request: PlatformTextInputMethodRequest): Nothing
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.desktop.kt
index bc88383..88dd5ae 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/TestComposeWindow.desktop.kt
@@ -202,4 +202,4 @@
companion object {
private val EventComponent = object : Component() {}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/DesktopSvgResources.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/DesktopSvgResources.desktop.kt
index 5413fa0..677bb91 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/DesktopSvgResources.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/DesktopSvgResources.desktop.kt
@@ -125,4 +125,4 @@
dom.render(canvas.nativeCanvas)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/ImageResources.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/ImageResources.desktop.kt
index e862143..9a8330a 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/ImageResources.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/ImageResources.desktop.kt
@@ -30,4 +30,4 @@
* @return the decoded SVG image associated with the resource
*/
fun loadImageBitmap(inputStream: InputStream): ImageBitmap =
- Image.makeFromEncoded(inputStream.readAllBytes()).toComposeImageBitmap()
\ No newline at end of file
+ Image.makeFromEncoded(inputStream.readAllBytes()).toComposeImageBitmap()
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/PainterResources.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/PainterResources.desktop.kt
index 410f0d6..a2e730d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/PainterResources.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/PainterResources.desktop.kt
@@ -80,4 +80,4 @@
useResource(resourcePath, ::loadImageBitmap)
}
return BitmapPainter(image)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/Resources.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/Resources.desktop.kt
index 6ad2853..60ff71a 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/Resources.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/Resources.desktop.kt
@@ -46,4 +46,4 @@
return requireNotNull(classLoader.getResourceAsStream(resourcePath)) {
"Resource $resourcePath not found"
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopValueParsers.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopValueParsers.desktop.kt
index da7da20..583e20d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopValueParsers.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopValueParsers.desktop.kt
@@ -101,4 +101,4 @@
endsWith("px") -> removeSuffix("px").toFloat().toDp()
else -> throw UnsupportedOperationException("value should ends with dp or px")
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopXmlVectorParser.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopXmlVectorParser.desktop.kt
index c326802..cb92895 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopXmlVectorParser.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/res/vector/DesktopXmlVectorParser.desktop.kt
@@ -274,4 +274,4 @@
for (i in 0 until childNodes.length) {
yield(childNodes.item(i))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/ComponentUpdater.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/ComponentUpdater.kt
index 309e8a9..87b7306 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/ComponentUpdater.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/ComponentUpdater.kt
@@ -49,4 +49,4 @@
index++
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/UpdateEffect.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/UpdateEffect.desktop.kt
index 62a183c..83391a9 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/UpdateEffect.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/UpdateEffect.desktop.kt
@@ -66,4 +66,4 @@
snapshotObserver.clear()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/Windows.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/Windows.desktop.kt
index a50f886..eda022d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/Windows.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/util/Windows.desktop.kt
@@ -165,4 +165,4 @@
} finally {
preferredSize = oldPreferredSize
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Application.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Application.desktop.kt
index 80d3f69..5e556d8 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Application.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Application.desktop.kt
@@ -229,4 +229,4 @@
override fun move(from: Int, to: Int, count: Int) = Unit
override fun clear() = Unit
override fun onEndChanges() = Unit
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/AwtWindow.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/AwtWindow.desktop.kt
index 2b96713..545576e 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/AwtWindow.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/AwtWindow.desktop.kt
@@ -128,4 +128,4 @@
window().isVisible = false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Dialog.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Dialog.desktop.kt
index f92ee1c..d224e73 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Dialog.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Dialog.desktop.kt
@@ -259,4 +259,4 @@
* [ComposeDialog] that was created inside [androidx.compose.ui.window.Dialog].
*/
override val window: ComposeDialog
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/DialogState.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/DialogState.desktop.kt
index 621309a..9e73e2d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/DialogState.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/DialogState.desktop.kt
@@ -189,4 +189,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LayoutConfiguration.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LayoutConfiguration.desktop.kt
index b05f1b9..fee47de 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LayoutConfiguration.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LayoutConfiguration.desktop.kt
@@ -46,4 +46,4 @@
internal val GlobalLayoutDirection get() = LayoutDirection.Ltr
@Suppress("unused")
-internal val Component.layoutDirection: LayoutDirection get() = LayoutDirection.Ltr
\ No newline at end of file
+internal val Component.layoutDirection: LayoutDirection get() = LayoutDirection.Ltr
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LocalWindow.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LocalWindow.kt
index 4208152..9d202ea 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LocalWindow.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/LocalWindow.kt
@@ -26,4 +26,4 @@
* Window-owner of the current composition (for example, [ComposeWindow] or [ComposeDialog]).
* If the composition is not inside Window (for example, [ComposePanel]), then return null
*/
-internal val LocalWindow = compositionLocalOf<Window?> { null }
\ No newline at end of file
+internal val LocalWindow = compositionLocalOf<Window?> { null }
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Menu.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Menu.desktop.kt
index 05c535b..52f1603 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Menu.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Menu.desktop.kt
@@ -833,4 +833,4 @@
set(receiver, ref.value!!) // prevent internal state change
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Notification.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Notification.desktop.kt
index ee37df8..bf0f254 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Notification.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Notification.desktop.kt
@@ -115,4 +115,4 @@
*/
Error,
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/UndecoratedWindowResizer.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/UndecoratedWindowResizer.desktop.kt
index 8547501..79c3b9d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/UndecoratedWindowResizer.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/UndecoratedWindowResizer.desktop.kt
@@ -175,4 +175,4 @@
val Right = 0x0100
val Bottom = 0x1000
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Window.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Window.desktop.kt
index dfcaafe..0826e9a 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Window.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/Window.desktop.kt
@@ -381,4 +381,4 @@
composition.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPlacement.desktop.kt.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPlacement.desktop.kt.kt
index f825474..c97ea0b 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPlacement.desktop.kt.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPlacement.desktop.kt.kt
@@ -38,4 +38,4 @@
* application menu on macOs).
*/
Fullscreen
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPosition.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPosition.desktop.kt
index c86638b..9815703 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPosition.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowPosition.desktop.kt
@@ -148,4 +148,4 @@
return result
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowScope.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowScope.kt
index a340356..6f24730 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowScope.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowScope.kt
@@ -30,4 +30,4 @@
* or [androidx.compose.ui.window.Dialog]
*/
val window: Window
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowSize.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowSize.desktop.kt
index 591053d..9e17edc 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowSize.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowSize.desktop.kt
@@ -95,4 +95,4 @@
@Stable
override fun toString() = "$width x $height"
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowState.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowState.desktop.kt
index 24e59c1..2ef1d2d 100644
--- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowState.desktop.kt
+++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/window/WindowState.desktop.kt
@@ -245,4 +245,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/desktop/TestThread.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/desktop/TestThread.kt
index f98d967..4c62c78 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/desktop/TestThread.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/desktop/TestThread.kt
@@ -35,4 +35,4 @@
throw exception!!
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/TestUtils.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/TestUtils.kt
index 2d891af..c7b3abd 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/TestUtils.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/TestUtils.kt
@@ -119,4 +119,4 @@
)
component.dispatchEvent(event)
return event.isConsumed
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposePanelTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposePanelTest.kt
index 66ac55a..041db79 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposePanelTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposePanelTest.kt
@@ -123,4 +123,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt
index 226bc0a..41a3f6b 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/awt/ComposeWindowTest.kt
@@ -168,4 +168,4 @@
window.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/mouse/MouseScrollFilterTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/mouse/MouseScrollFilterTest.kt
index 5177ec6..0bb7091 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/mouse/MouseScrollFilterTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/mouse/MouseScrollFilterTest.kt
@@ -310,4 +310,4 @@
assertThat(actualEvent?.orientation).isEqualTo(MouseScrollOrientation.Horizontal)
assertThat(actualBounds).isEqualTo(IntSize(20, 40))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
index a4c7cbb..cff629c 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
@@ -184,4 +184,4 @@
)
assertThat(iconService.getIcon()).isEqualTo(PointerIcon.Hand)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/AccessibilityTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/AccessibilityTest.kt
index 4ae3e53..c8ea15d 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/AccessibilityTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/AccessibilityTest.kt
@@ -1,59 +1,59 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.compose.ui.platform
-
-import androidx.compose.material.Text
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.test.junit4.createComposeRule
-import androidx.compose.ui.test.onNodeWithTag
-import javax.accessibility.AccessibleText
-import org.junit.Assert.assertEquals
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-
-@RunWith(JUnit4::class)
-class AccessibilityTest {
-
- @get:Rule
- val rule = createComposeRule()
-
- @Test
- fun accessibleText() {
- rule.setContent {
- Text("Hello world. Hi world.", modifier = Modifier.testTag("text"))
- }
-
- val node = rule.onNodeWithTag("text").fetchSemanticsNode()
- val accessibleNode = ComposeAccessible(node)
- val accessibleText = accessibleNode.accessibleContext.accessibleText!!
- assertEquals(22, accessibleText.charCount)
-
- assertEquals("H", accessibleText.getAtIndex(AccessibleText.CHARACTER, 0))
- assertEquals("Hello", accessibleText.getAtIndex(AccessibleText.WORD, 0))
- assertEquals("Hello world. ", accessibleText.getAtIndex(AccessibleText.SENTENCE, 0))
-
- assertEquals("e", accessibleText.getAfterIndex(AccessibleText.CHARACTER, 0))
- assertEquals("world", accessibleText.getAfterIndex(AccessibleText.WORD, 0))
- assertEquals("Hi world.", accessibleText.getAfterIndex(AccessibleText.SENTENCE, 0))
-
- assertEquals("d", accessibleText.getBeforeIndex(AccessibleText.CHARACTER, 21))
- assertEquals("world", accessibleText.getBeforeIndex(AccessibleText.WORD, 21))
- assertEquals("Hi world", accessibleText.getBeforeIndex(AccessibleText.SENTENCE, 21))
- }
-}
\ No newline at end of file
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.ui.platform
+
+import androidx.compose.material.Text
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import javax.accessibility.AccessibleText
+import org.junit.Assert.assertEquals
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class AccessibilityTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun accessibleText() {
+ rule.setContent {
+ Text("Hello world. Hi world.", modifier = Modifier.testTag("text"))
+ }
+
+ val node = rule.onNodeWithTag("text").fetchSemanticsNode()
+ val accessibleNode = ComposeAccessible(node)
+ val accessibleText = accessibleNode.accessibleContext.accessibleText!!
+ assertEquals(22, accessibleText.charCount)
+
+ assertEquals("H", accessibleText.getAtIndex(AccessibleText.CHARACTER, 0))
+ assertEquals("Hello", accessibleText.getAtIndex(AccessibleText.WORD, 0))
+ assertEquals("Hello world. ", accessibleText.getAtIndex(AccessibleText.SENTENCE, 0))
+
+ assertEquals("e", accessibleText.getAfterIndex(AccessibleText.CHARACTER, 0))
+ assertEquals("world", accessibleText.getAfterIndex(AccessibleText.WORD, 0))
+ assertEquals("Hi world.", accessibleText.getAfterIndex(AccessibleText.SENTENCE, 0))
+
+ assertEquals("d", accessibleText.getBeforeIndex(AccessibleText.CHARACTER, 21))
+ assertEquals("world", accessibleText.getBeforeIndex(AccessibleText.WORD, 21))
+ assertEquals("Hi world", accessibleText.getBeforeIndex(AccessibleText.SENTENCE, 21))
+ }
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopInputComponentTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopInputComponentTest.kt
index 2ffaeea..4cdd2ae 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopInputComponentTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopInputComponentTest.kt
@@ -109,4 +109,4 @@
Assert.assertEquals("ä", buffer.text)
Assert.assertEquals(TextRange(1), buffer.selection)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopTextInputSessionTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopTextInputSessionTest.kt
index c2fd0d6..24e4bc4 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopTextInputSessionTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/DesktopTextInputSessionTest.kt
@@ -140,4 +140,4 @@
throw AssertionError("not supported")
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcherTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcherTest.kt
index b784f0d..f4d29ff 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcherTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcherTest.kt
@@ -106,4 +106,4 @@
assertEquals((0 until 10000).toList(), actualNumbers)
assertFalse(dispatcher.hasTasks())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/GraphicsLayerTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/GraphicsLayerTest.kt
index 57376b1..6c0688e 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/GraphicsLayerTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/GraphicsLayerTest.kt
@@ -325,4 +325,4 @@
}
screenshotRule.snap(window.surface)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
index 81cc28a..4de7ff75 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/RenderingTestScope.kt
@@ -106,4 +106,4 @@
}
return onRender.isCompleted
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/TestComposeWindowTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/TestComposeWindowTest.kt
index 7fd119a..735f3a7 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/TestComposeWindowTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/TestComposeWindowTest.kt
@@ -52,4 +52,4 @@
window.dispose()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/res/DesktopSvgResourcesTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/res/DesktopSvgResourcesTest.kt
index 30389c3..6351f8c 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/res/DesktopSvgResourcesTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/res/DesktopSvgResourcesTest.kt
@@ -124,4 +124,4 @@
}
screenshotRule.snap(window.surface)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/AddRemoveMutableListTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/AddRemoveMutableListTest.kt
index 5a55cc6..95a0d9e 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/AddRemoveMutableListTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/AddRemoveMutableListTest.kt
@@ -76,4 +76,4 @@
override fun performRemove(index: Int) {
list.removeAt(index)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/UpdateEffectTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/UpdateEffectTest.kt
index 493117b..93bb454 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/UpdateEffectTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/util/UpdateEffectTest.kt
@@ -83,4 +83,4 @@
rule.waitForIdle()
assertThat(updatedState).isNotEqualTo(state)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/ApplicationTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/ApplicationTest.kt
index 95cb554..a842511 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/ApplicationTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/ApplicationTest.kt
@@ -151,4 +151,4 @@
exitApplication()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/MenuBarTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/MenuBarTest.kt
index 40d329b..1ec49f3 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/MenuBarTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/MenuBarTest.kt
@@ -474,4 +474,4 @@
exitApplication()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/TestUtils.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/TestUtils.kt
index 427bda9..c6b4f02 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/TestUtils.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/TestUtils.kt
@@ -138,4 +138,4 @@
recomposerInfo.state.takeWhile { it > Recomposer.State.Idle }.collect()
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/dialog/DialogTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/dialog/DialogTest.kt
index 5009c3e..1d526c76 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/dialog/DialogTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/dialog/DialogTest.kt
@@ -552,4 +552,4 @@
exitApplication()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowInputEventTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowInputEventTest.kt
index b90df87..3eba371 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowInputEventTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowInputEventTest.kt
@@ -596,4 +596,4 @@
private val PointerEvent.pressed get() = changes.first().pressed
private val PointerEvent.position get() = changes.first().position
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowParameterTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowParameterTest.kt
index 5e4cf77..09a7700 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowParameterTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowParameterTest.kt
@@ -201,4 +201,4 @@
window?.dispatchEvent(WindowEvent(window, WindowEvent.WINDOW_CLOSING))
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowStateTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowStateTest.kt
index e8279f5..e50d1a8 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowStateTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowStateTest.kt
@@ -801,4 +801,4 @@
size.width - insets.left - insets.right,
size.height - insets.top - insets.bottom,
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowTest.kt
index 9ae3fc6..1bc68ce 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/window/window/WindowTest.kt
@@ -461,4 +461,4 @@
exitApplication()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/Actual.kt b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/Actual.kt
index 18da868..84f9030 100644
--- a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/Actual.kt
+++ b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/Actual.kt
@@ -46,4 +46,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/AtomicReference.jvm.kt b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/AtomicReference.jvm.kt
index 1e2527d..c1a54db 100644
--- a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/AtomicReference.jvm.kt
+++ b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/AtomicReference.jvm.kt
@@ -16,4 +16,4 @@
package androidx.compose.ui
-internal actual typealias AtomicReference<V> = java.util.concurrent.atomic.AtomicReference<V>
\ No newline at end of file
+internal actual typealias AtomicReference<V> = java.util.concurrent.atomic.AtomicReference<V>
diff --git a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.jvm.kt b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.jvm.kt
index bc27390..792bbe5 100644
--- a/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.jvm.kt
+++ b/compose/ui/ui/src/jvmMain/kotlin/androidx/compose/ui/internal/JvmDefaultWithCompatibility.jvm.kt
@@ -17,4 +17,4 @@
package androidx.compose.ui.internal
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
-internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
\ No newline at end of file
+internal actual typealias JvmDefaultWithCompatibility = kotlin.jvm.JvmDefaultWithCompatibility
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/AccessibilityController.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/AccessibilityController.skiko.kt
index bf3da08..14792b0 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/AccessibilityController.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/AccessibilityController.skiko.kt
@@ -39,4 +39,4 @@
* platform-specific counterparts.
*/
suspend fun syncLoop()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultHapticFeedback.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultHapticFeedback.skiko.kt
index eafdf15..83652f7 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultHapticFeedback.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultHapticFeedback.skiko.kt
@@ -23,4 +23,4 @@
internal class DefaultHapticFeedback : HapticFeedback {
override fun performHapticFeedback(hapticFeedbackType: HapticFeedbackType) {
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultTextToolbar.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultTextToolbar.skiko.kt
index def1d41..05b98f3 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultTextToolbar.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultTextToolbar.skiko.kt
@@ -34,4 +34,4 @@
onSelectAllRequested: (() -> Unit)?
) {
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultUiApplier.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultUiApplier.skiko.kt
index 56a4cb8..579f42e 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultUiApplier.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/DefaultUiApplier.skiko.kt
@@ -46,4 +46,4 @@
super.onEndChanges()
root.owner?.onEndApplyChanges()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcher.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcher.skiko.kt
index 134f900..e058161 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcher.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/FlushCoroutineDispatcher.skiko.kt
@@ -84,4 +84,4 @@
isPerformingRun = false
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OutlineCache.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OutlineCache.skiko.kt
index 1c339d4..580fd2b 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OutlineCache.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OutlineCache.skiko.kt
@@ -71,4 +71,4 @@
private fun createOutline() =
shape.createOutline(size.toSize(), layoutDirection, density)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaRootForTest.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaRootForTest.skiko.kt
index e21e539..dc6f7f03 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaRootForTest.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/SkiaRootForTest.skiko.kt
@@ -33,4 +33,4 @@
* [pointers] state of all pointers
*/
fun processPointerInput(timeMillis: Long, pointers: List<TestPointerInputEventData>)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropView.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropView.skiko.kt
index d9a2743..fd7cb75 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropView.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropView.skiko.kt
@@ -18,4 +18,4 @@
// Interop Views aren't supported in Skiko. Use Any instead of Nothing because we can't have a type
// aliased to Nothing appear as a function return type or property type.
-actual typealias InteropView = Any
\ No newline at end of file
+actual typealias InteropView = Any
diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.skiko.kt
index 357df45..f8b7219 100644
--- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.skiko.kt
+++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.skiko.kt
@@ -45,4 +45,4 @@
"InteropViewFactoryHolder cannot be used because " +
"interoperability views are not supported on this platform."
)
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/SessionMutexTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/SessionMutexTest.kt
index 7da32ad9..d0bf7d9 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/SessionMutexTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/SessionMutexTest.kt
@@ -379,4 +379,4 @@
)
private class TestException : RuntimeException()
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/TransformOriginTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/TransformOriginTest.kt
index 51651a7..25db313 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/TransformOriginTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/TransformOriginTest.kt
@@ -54,4 +54,4 @@
assertEquals(0.1f, pivotX)
assertEquals(0.2f, pivotY)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/TestUtils.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/TestUtils.kt
index 3e8482a..fe67b4b 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/TestUtils.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/TestUtils.kt
@@ -19,4 +19,4 @@
import androidx.compose.ui.input.pointer.PointerEvent
import androidx.compose.ui.input.pointer.PointerInputChange
-internal fun pointerEventOf(vararg changes: PointerInputChange) = PointerEvent(changes.toList())
\ No newline at end of file
+internal fun pointerEventOf(vararg changes: PointerInputChange) = PointerEvent(changes.toList())
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/scrollorientationlocking/PolyFitLeastSquaresTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/scrollorientationlocking/PolyFitLeastSquaresTest.kt
index 5dd6560..5675abc 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/scrollorientationlocking/PolyFitLeastSquaresTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/gesture/scrollorientationlocking/PolyFitLeastSquaresTest.kt
@@ -282,4 +282,4 @@
assertThat(actual[index]).isWithin(.00001f).of(value)
}
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/graphics/vector/ImageVectorBuilderTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/graphics/vector/ImageVectorBuilderTest.kt
index 5bbab8f..af80fc4 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/graphics/vector/ImageVectorBuilderTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/graphics/vector/ImageVectorBuilderTest.kt
@@ -119,4 +119,4 @@
defaultHeight = 10.dp,
viewportWidth = 10f,
viewportHeight = 10f
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackTest.kt
index 9669e89..260344e 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/hapticfeedback/HapticFeedbackTest.kt
@@ -53,4 +53,4 @@
times(1)
).performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionInactiveTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionInactiveTest.kt
index 05a700a..84dc9d0 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionInactiveTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionInactiveTest.kt
@@ -170,4 +170,4 @@
// fun getHandler() {
// assertThat(ic.handler).isFalse()
// }
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt
index 4774c9f..def7b15 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt
@@ -101,4 +101,4 @@
assertThat(captor.firstValue.selectionStart).isEqualTo(0)
assertThat(captor.firstValue.selectionEnd).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker1DTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker1DTest.kt
index 8283e89..be20d3e 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker1DTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTracker1DTest.kt
@@ -719,4 +719,4 @@
val differentialDataPoints: Boolean,
val dataPoints: List<DataPointAtTime>,
val expectedVelocities: List<ExpectedVelocity>
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTrackerTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTrackerTest.kt
index 284add9..2016513 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTrackerTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/pointer/util/VelocityTrackerTest.kt
@@ -1727,4 +1727,4 @@
down = false,
position = createPxPosition(241.14285278320312f, 451.4285583496094f)
)
-)
\ No newline at end of file
+)
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/AlignmentTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/AlignmentTest.kt
index af13cf5..1d03d24 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/AlignmentTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/AlignmentTest.kt
@@ -350,4 +350,4 @@
BiasAbsoluteAlignment.Horizontal(0.5f).align(0, space1D, LayoutDirection.Rtl)
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ContentScaleTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ContentScaleTest.kt
index 7134996..6743d68 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ContentScaleTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ContentScaleTest.kt
@@ -135,4 +135,4 @@
assertEquals(3.0f, scale.scaleX)
assertEquals(7.0f, scale.scaleY)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
index 81103bf..7e690aa 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
@@ -138,4 +138,4 @@
fun testScaleFactorToString() {
assertEquals("ScaleFactor(1.2, 1.3)", ScaleFactor(1.234f, 1.25f).toString())
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/DelegatingNodeTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/DelegatingNodeTest.kt
index 9b88092..157de10 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/DelegatingNodeTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/DelegatingNodeTest.kt
@@ -889,4 +889,4 @@
val queue = this ?: ArrayDeque(8)
queue.addLast(node)
return queue
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
index 4e8ee25..35642ad 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/LayoutNodeTest.kt
@@ -2804,4 +2804,4 @@
return node.element
}
-private fun LayoutNode.onNodePlaced() = measurePassDelegate.onNodePlaced()
\ No newline at end of file
+private fun LayoutNode.onNodePlaced() = measurePassDelegate.onNodePlaced()
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/ModifierNodeElementTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/ModifierNodeElementTest.kt
index 862f89b..d0f0cf0 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/ModifierNodeElementTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/node/ModifierNodeElementTest.kt
@@ -93,4 +93,4 @@
actual.inspectableElements.toList()
)
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/ClipboardManagerTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/ClipboardManagerTest.kt
index a9048bc..7896fe2 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/ClipboardManagerTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/ClipboardManagerTest.kt
@@ -48,4 +48,4 @@
}
assertThat(clipboardManager.hasText()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/WindowInfoTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/WindowInfoTest.kt
index 0d88eb7..07ce625 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/WindowInfoTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/platform/WindowInfoTest.kt
@@ -84,4 +84,4 @@
testScheduler.runCurrent()
assertThat(last).isEqualTo(PointerKeyboardModifiers(22))
}
-}
\ No newline at end of file
+}
diff --git a/concurrent/concurrent-futures-ktx/src/main/java/androidx/concurrent/futures/SuspendToFutureAdapter.kt b/concurrent/concurrent-futures-ktx/src/main/java/androidx/concurrent/futures/SuspendToFutureAdapter.kt
index 3e70e3a..870eef8 100644
--- a/concurrent/concurrent-futures-ktx/src/main/java/androidx/concurrent/futures/SuspendToFutureAdapter.kt
+++ b/concurrent/concurrent-futures-ktx/src/main/java/androidx/concurrent/futures/SuspendToFutureAdapter.kt
@@ -145,4 +145,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/concurrent/concurrent-futures-ktx/src/test/java/androidx/concurrent/futures/SuspendToFutureAdapterTest.kt b/concurrent/concurrent-futures-ktx/src/test/java/androidx/concurrent/futures/SuspendToFutureAdapterTest.kt
index f0026cf..446818a3 100644
--- a/concurrent/concurrent-futures-ktx/src/test/java/androidx/concurrent/futures/SuspendToFutureAdapterTest.kt
+++ b/concurrent/concurrent-futures-ktx/src/test/java/androidx/concurrent/futures/SuspendToFutureAdapterTest.kt
@@ -224,4 +224,4 @@
block.run()
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutComposeIssueRegistry.kt b/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutComposeIssueRegistry.kt
index 1edc7e6..09a1496 100644
--- a/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutComposeIssueRegistry.kt
+++ b/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutComposeIssueRegistry.kt
@@ -40,4 +40,4 @@
identifier = "androidx.constraintlayout.compose",
vendorName = "Android Open Source Project",
)
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetector.kt b/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetector.kt
index 81058d4..c6292e8 100644
--- a/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetector.kt
+++ b/constraintlayout/constraintlayout-compose-lint/src/main/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetector.kt
@@ -760,4 +760,4 @@
val typeName = this.getExpressionType()?.canonicalText ?: return false
return typeName == CONSTRAINED_LAYOUT_REFERENCE_CLASS_FQ ||
typeName == LAYOUT_REFERENCE_CLASS_FQ
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ApiLintVersionsTest.kt b/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ApiLintVersionsTest.kt
index 2d34377..92c95d2 100644
--- a/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ApiLintVersionsTest.kt
+++ b/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ApiLintVersionsTest.kt
@@ -34,4 +34,4 @@
assertThat(registry.api).isEqualTo(CURRENT_API)
assertThat(registry.minApi).isEqualTo(CURRENT_API)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetectorTest.kt b/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetectorTest.kt
index 359189a..1687dad 100644
--- a/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetectorTest.kt
+++ b/constraintlayout/constraintlayout-compose-lint/src/test/java/androidx/constraintlayout/compose/lint/ConstraintLayoutDslDetectorTest.kt
@@ -376,4 +376,4 @@
4 errors, 0 warnings"""
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/build.gradle b/constraintlayout/constraintlayout-compose/integration-tests/demos/build.gradle
index 7078017..17f8024 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/build.gradle
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/build.gradle
@@ -29,7 +29,6 @@
implementation(project(":compose:ui:ui"))
implementation(project(":compose:animation:animation"))
implementation(project(":compose:material:material"))
- implementation(project(":compose:material:material-icons-extended"))
implementation(project(":compose:ui:ui-tooling-preview"))
debugImplementation(project(":compose:ui:ui-tooling"))
}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
index 53be7dc..4ab8cf2 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
@@ -171,4 +171,4 @@
fontSize = 16.sp
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ChainsDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ChainsDemo.kt
index 06cff7e..c1dfe25 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ChainsDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ChainsDemo.kt
@@ -107,4 +107,4 @@
Text(text = "Toggle Orientation")
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
index a1aa8cc..2b52ffc 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
@@ -304,4 +304,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt
index 21070d0..846b2f2 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt
@@ -116,4 +116,4 @@
text = "Color: ${background.toArgb().toUInt().toString(16)}"
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/LazyListItemsDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/LazyListItemsDemo.kt
index b6af84a..d35ff34 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/LazyListItemsDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/LazyListItemsDemo.kt
@@ -253,4 +253,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/OnSwipeDemos.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/OnSwipeDemos.kt
index 586a4b5..4dbb5ca 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/OnSwipeDemos.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/OnSwipeDemos.kt
@@ -301,4 +301,4 @@
.layoutId("box")
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/PuzzleDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/PuzzleDemo.kt
index f5d5cc4..804d328 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/PuzzleDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/PuzzleDemo.kt
@@ -183,4 +183,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
index ecd1404..3bce2e5 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
@@ -139,4 +139,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/StaggeredDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/StaggeredDemo.kt
index a3b52d1..24bb6b9 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/StaggeredDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/StaggeredDemo.kt
@@ -137,4 +137,4 @@
Normal,
Inverted,
Custom
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/MotionLayoutActivity.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/MotionLayoutActivity.kt
index d104977..91a28e8 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/MotionLayoutActivity.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/MotionLayoutActivity.kt
@@ -89,4 +89,4 @@
}
Choreographer.getInstance().postFrameCallback(callback)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/CardSample.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/CardSample.kt
index a1c4b31..95c5eb0 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/CardSample.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/CardSample.kt
@@ -133,4 +133,4 @@
overflow = TextOverflow.Ellipsis
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/SearchBar.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/SearchBar.kt
index 8cc4339..5caaad8 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/SearchBar.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/SearchBar.kt
@@ -114,4 +114,4 @@
backgroundColor = Color.Transparent,
)
)
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/TestableButton.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/TestableButton.kt
index 9beb710..c2d9833 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/TestableButton.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/components/TestableButton.kt
@@ -39,4 +39,4 @@
) {
Text(text = text)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Images.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Images.kt
index 08f4781..5e0b504 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Images.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Images.kt
@@ -53,4 +53,4 @@
.appendPath(getResourceTypeName(resourceId))
.appendPath(getResourceEntryName(resourceId))
.build()
- }
\ No newline at end of file
+ }
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Strings.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Strings.kt
index c062956..3af119c 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Strings.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Strings.kt
@@ -132,4 +132,4 @@
LOREM_IPSUM.filter { it != '\n' }.split(' ')
.take(wordCount.coerceIn(1, LOREM_IPSUM_WORDS.size))
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Time.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Time.kt
index 53944f9..7baafd3 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Time.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/common/sampledata/Time.kt
@@ -23,4 +23,4 @@
internal fun newHourMinuteTimeStamp(): String {
return SimpleDateFormat("hh:mma", Locale.US).format(Date.from(Instant.now()))
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/graphs/DynamicGraphs.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/graphs/DynamicGraphs.kt
index 1ba89a0..15c3bd1 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/graphs/DynamicGraphs.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/graphs/DynamicGraphs.kt
@@ -144,4 +144,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessage.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessage.kt
index 95b79af..0c12a36 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessage.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessage.kt
@@ -755,4 +755,4 @@
)
}
-private fun Color.toHexString() = toArgb().toUInt().toString(16)
\ No newline at end of file
+private fun Color.toHexString() = toArgb().toUInt().toString(16)
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessageState.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessageState.kt
index 0fb0062..47c30ef 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessageState.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/newmessage/NewMessageState.kt
@@ -51,4 +51,4 @@
Full,
Mini,
Fab
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/toolbar/CollapsibleToolbar.kt b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/toolbar/CollapsibleToolbar.kt
index 846fd83..08681e0 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/toolbar/CollapsibleToolbar.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark-target/src/main/java/androidx/constraintlayout/compose/integration/macrobenchmark/target/toolbar/CollapsibleToolbar.kt
@@ -240,4 +240,4 @@
)
OutlinedSearchBar(modifier = Modifier.layoutId("toolbar"))
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ChainsTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ChainsTest.kt
index 5fb7268..9beb827 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ChainsTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ChainsTest.kt
@@ -460,4 +460,4 @@
rule.onNodeWithTag("box1").assertPositionInRootIsEqualTo(0.dp, rootSize * 0.667f)
rule.onNodeWithTag("box1").assertHeightIsEqualTo(rootSize * 0.334f)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt
index b418a5d..ac64762 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt
@@ -2725,4 +2725,4 @@
assertEquals(151f, position[3])
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetParserKtTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetParserKtTest.kt
index 91615d5..688ad92 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetParserKtTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetParserKtTest.kt
@@ -39,4 +39,4 @@
""".trimIndent()
ConstraintSetParser.parseJSON(content, coreTransition, 0) // Should finish successfully
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/DesignInfoProviderTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/DesignInfoProviderTest.kt
index 955b6d2..337393c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/DesignInfoProviderTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/DesignInfoProviderTest.kt
@@ -232,4 +232,4 @@
Box {
content()
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridDslTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridDslTest.kt
index 1ae2257..c14819c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridDslTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridDslTest.kt
@@ -663,4 +663,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridTest.kt
index e9191c8..be5563a 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/GridTest.kt
@@ -689,4 +689,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionFlowTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionFlowTest.kt
index 38f992f..500c66c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionFlowTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionFlowTest.kt
@@ -143,4 +143,4 @@
expectedPosition += gapSize + 10.dp
rule.onNodeWithTag("4").assertPositionInRootIsEqualTo(94.9.dp, expectedPosition)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionGridTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionGridTest.kt
index 40eae1d..d9f575c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionGridTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionGridTest.kt
@@ -304,4 +304,4 @@
val density = LocalDensity.current
return with(density) { dpVal.toPx() }
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionLayoutTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionLayoutTest.kt
index 028ce9f..ad4c332 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionLayoutTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionLayoutTest.kt
@@ -728,4 +728,4 @@
),
content = content
)
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionParserTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionParserTest.kt
index b674c98..63db86a 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionParserTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MotionParserTest.kt
@@ -118,4 +118,4 @@
// Test should finish without exceptions
rule.waitForIdle()
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt
index 5f80af3..2fc71cf 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt
@@ -258,4 +258,4 @@
Caller,
Content
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/OnSwipeTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/OnSwipeTest.kt
index 913cba0..056cee8 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/OnSwipeTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/OnSwipeTest.kt
@@ -212,4 +212,4 @@
.testTag("box")
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnDslTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnDslTest.kt
index 9a75d12..4f3521f 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnDslTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnDslTest.kt
@@ -340,4 +340,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnTest.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnTest.kt
index 85979d4..e166bb6 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/RowColumnTest.kt
@@ -337,4 +337,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/Utils.kt b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/Utils.kt
index c31f08a..3ba47d7 100644
--- a/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/Utils.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/Utils.kt
@@ -25,4 +25,4 @@
*
* This allows using syntax such as: `rule.onNodeWithTag(id)...`
*/
-internal fun Modifier.layoutTestId(id: Any): Modifier = testTag(id.toString()).layoutId(id)
\ No newline at end of file
+internal fun Modifier.layoutTestId(id: Any): Modifier = testTag(id.toString()).layoutId(id)
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ChainConstrainScope.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ChainConstrainScope.kt
index 1a85685..0e3471a 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ChainConstrainScope.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ChainConstrainScope.kt
@@ -84,4 +84,4 @@
private class ChainHorizontalAnchorable constructor(
containerObject: CLObject,
index: Int
-) : BaseHorizontalAnchorable(containerObject, index)
\ No newline at end of file
+) : BaseHorizontalAnchorable(containerObject, index)
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt
index 10dd2ab..198785a 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt
@@ -539,4 +539,4 @@
}
containerObject.put("baseline", constraintArray)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
index 2186658..6d9fd43 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
@@ -2186,4 +2186,4 @@
enum class LayoutInfoFlags {
NONE,
BOUNDS
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutBaseScope.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutBaseScope.kt
index 4a182c6..392cf7e 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutBaseScope.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutBaseScope.kt
@@ -1978,4 +1978,4 @@
value class Span(val description: String) {
constructor(position: Int, rows: Int, columns: Int) : this("$position:${rows}x$columns")
constructor(position: Int, size: Int) : this("$position:$size")
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTag.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTag.kt
index 13ec011..a995722 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTag.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTag.kt
@@ -83,4 +83,4 @@
get() = (parentData as? ConstraintLayoutTagParentData)?.constraintLayoutTag
val Measurable.constraintLayoutId: Any?
- get() = (parentData as? ConstraintLayoutTagParentData)?.constraintLayoutId
\ No newline at end of file
+ get() = (parentData as? ConstraintLayoutTagParentData)?.constraintLayoutId
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintScopeCommon.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintScopeCommon.kt
index 11c8a8e..21fb99c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintScopeCommon.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintScopeCommon.kt
@@ -172,4 +172,4 @@
"start"
}
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintSet.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintSet.kt
index 9ee3ef6..77d4deb 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintSet.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintSet.kt
@@ -297,4 +297,4 @@
* Inheritors should implement this function so that derived constraints are applied properly.
*/
fun applyToState(state: State)
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/DslConstraintSet.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/DslConstraintSet.kt
index 0d1c30b..9ac6466 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/DslConstraintSet.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/DslConstraintSet.kt
@@ -52,4 +52,4 @@
override fun hashCode(): Int {
return scope.hashCode()
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/JSONConstraintSet.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/JSONConstraintSet.kt
index 245c8d1..6ae09a9 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/JSONConstraintSet.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/JSONConstraintSet.kt
@@ -121,4 +121,4 @@
override fun onNewProgress(progress: Float) {
// Nothing for ConstraintSet
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt
index 40561ea..6d198ae 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt
@@ -18,6 +18,7 @@
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.MutableFloatState
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
@@ -39,12 +40,13 @@
*/
internal fun Modifier.motionPointerInput(
key: Any,
- motionProgress: MotionProgress,
+ motionProgress: MutableFloatState,
measurer: MotionMeasurer
): Modifier = composed(
inspectorInfo = debugInspectorInfo {
name = "motionPointerInput"
properties["key"] = key
+ properties["motionProgress"] = motionProgress
properties["measurer"] = measurer
}
) {
@@ -136,4 +138,4 @@
velocity = velocity
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
index d1aff18..eaa32df 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
@@ -25,7 +25,7 @@
import androidx.compose.foundation.layout.LayoutScopeMarker
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.MutableState
+import androidx.compose.runtime.MutableFloatState
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
@@ -579,7 +579,7 @@
end = end,
layoutDirection = layoutDirection,
transition = transitionImpl,
- progress = motionProgress.currentProgress
+ progress = motionProgress.floatValue
)
true // Remember is required to return a non-Unit value
}
@@ -640,7 +640,7 @@
@LayoutScopeMarker
class MotionLayoutScope @Suppress("ShowingMemberInHiddenClass") internal constructor(
private val measurer: MotionMeasurer,
- private val motionProgress: MotionProgress
+ private val motionProgress: MutableFloatState
) {
/**
* Invokes [onBoundsChanged] whenever the Start or End bounds may have changed for the
@@ -738,7 +738,7 @@
* Returns [Color.Unspecified] if the property does not exist.
*/
fun color(name: String): Color {
- return measurer.getCustomColor(id, name, motionProgress.currentProgress)
+ return measurer.getCustomColor(id, name, motionProgress.floatValue)
}
/**
@@ -747,7 +747,7 @@
* Returns [Color.Unspecified] if the property does not exist.
*/
fun float(name: String): Float {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress)
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue)
}
/**
@@ -756,7 +756,7 @@
* Returns `0` if the property does not exist.
*/
fun int(name: String): Int {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).toInt()
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).toInt()
}
/**
@@ -765,7 +765,7 @@
* Returns [Dp.Unspecified] if the property does not exist.
*/
fun distance(name: String): Dp {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).dp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).dp
}
/**
@@ -774,7 +774,7 @@
* Returns [TextUnit.Unspecified] if the property does not exist.
*/
fun fontSize(name: String): TextUnit {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).sp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).sp
}
}
@@ -795,23 +795,23 @@
}
fun color(name: String): Color {
- return measurer.getCustomColor(myId, name, motionProgress.currentProgress)
+ return measurer.getCustomColor(myId, name, motionProgress.floatValue)
}
fun float(name: String): Float {
- return measurer.getCustomFloat(myId, name, motionProgress.currentProgress)
+ return measurer.getCustomFloat(myId, name, motionProgress.floatValue)
}
fun int(name: String): Int {
- return measurer.getCustomFloat(myId, name, motionProgress.currentProgress).toInt()
+ return measurer.getCustomFloat(myId, name, motionProgress.floatValue).toInt()
}
fun distance(name: String): Dp {
- return measurer.getCustomFloat(myId, name, motionProgress.currentProgress).dp
+ return measurer.getCustomFloat(myId, name, motionProgress.floatValue).dp
}
fun fontSize(name: String): TextUnit {
- return measurer.getCustomFloat(myId, name, motionProgress.currentProgress).sp
+ return measurer.getCustomFloat(myId, name, motionProgress.floatValue).sp
}
}
@@ -834,27 +834,27 @@
@Deprecated("Deprecated for naming consistency", ReplaceWith("customColor(id, name)"))
fun motionColor(id: String, name: String): Color {
- return measurer.getCustomColor(id, name, motionProgress.currentProgress)
+ return measurer.getCustomColor(id, name, motionProgress.floatValue)
}
@Deprecated("Deprecated for naming consistency", ReplaceWith("customFloat(id, name)"))
fun motionFloat(id: String, name: String): Float {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress)
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue)
}
@Deprecated("Deprecated for naming consistency", ReplaceWith("customInt(id, name)"))
fun motionInt(id: String, name: String): Int {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).toInt()
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).toInt()
}
@Deprecated("Deprecated for naming consistency", ReplaceWith("customDistance(id, name)"))
fun motionDistance(id: String, name: String): Dp {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).dp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).dp
}
@Deprecated("Deprecated for naming consistency", ReplaceWith("customFontSize(id, name)"))
fun motionFontSize(id: String, name: String): TextUnit {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).sp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).sp
}
/**
@@ -878,7 +878,7 @@
* This is a short version of: `customProperties(id).color(name)`.
*/
fun customColor(id: String, name: String): Color {
- return measurer.getCustomColor(id, name, motionProgress.currentProgress)
+ return measurer.getCustomColor(id, name, motionProgress.floatValue)
}
/**
@@ -891,7 +891,7 @@
* This is a short version of: `customProperties(id).float(name)`.
*/
fun customFloat(id: String, name: String): Float {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress)
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue)
}
/**
@@ -904,7 +904,7 @@
* This is a short version of: `customProperties(id).int(name)`.
*/
fun customInt(id: String, name: String): Int {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).toInt()
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).toInt()
}
/**
@@ -917,7 +917,7 @@
* This is a short version of: `customProperties(id).distance(name)`.
*/
fun customDistance(id: String, name: String): Dp {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).dp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).dp
}
/**
@@ -930,7 +930,7 @@
* This is a short version of: `customProperties(id).fontSize(name)`.
*/
fun customFontSize(id: String, name: String): TextUnit {
- return measurer.getCustomFloat(id, name, motionProgress.currentProgress).sp
+ return measurer.getCustomFloat(id, name, motionProgress.floatValue).sp
}
}
@@ -940,7 +940,7 @@
constraintSetStart: ConstraintSet,
constraintSetEnd: ConstraintSet,
@SuppressWarnings("HiddenTypeParameter") transition: TransitionImpl,
- motionProgress: MotionProgress,
+ motionProgress: MutableFloatState,
measurer: MotionMeasurer,
optimizationLevel: Int,
): MeasurePolicy =
@@ -957,7 +957,7 @@
transition,
measurables,
optimizationLevel,
- motionProgress.currentProgress,
+ motionProgress.floatValue,
compositionSource.value ?: CompositionSource.Unknown
)
compositionSource.value = CompositionSource.Unknown // Reset after measuring
@@ -972,17 +972,17 @@
/**
* Updates [motionProgress] from changes in [LayoutInformationReceiver.getForcedProgress].
*
- * User changes, (reflected in [MotionProgress.currentProgress]) take priority.
+ * User changes, (reflected in [MutableFloatState.floatValue]) take priority.
*/
@Composable
internal fun UpdateWithForcedIfNoUserChange(
- motionProgress: MotionProgress,
+ motionProgress: MutableFloatState,
informationReceiver: LayoutInformationReceiver?
) {
if (informationReceiver == null) {
return
}
- val currentUserProgress = motionProgress.currentProgress
+ val currentUserProgress = motionProgress.floatValue
val forcedProgress = informationReceiver.getForcedProgress()
// Save the initial progress
@@ -990,7 +990,7 @@
if (!forcedProgress.isNaN() && lastUserProgress.value == currentUserProgress) {
// Use the forced progress if the user progress hasn't changed
- motionProgress.updateProgress(forcedProgress)
+ motionProgress.floatValue = forcedProgress
} else {
informationReceiver.resetForcedProgress()
}
@@ -998,22 +998,22 @@
}
/**
- * Creates a [MotionProgress] that may be manipulated internally, but can also be updated by user
+ * Creates a [MutableFloatState] that may be manipulated internally, but can also be updated by user
* calls with different [progress] values.
*
- * @param progress User progress, if changed, updates the underlying [MotionProgress]
- * @return A [MotionProgress] instance that may change from internal or external calls
+ * @param progress User progress, if changed, updates the underlying [MutableFloatState]
+ * @return A [MutableFloatState] instance that may change from internal or external calls
*/
@Composable
-internal fun createAndUpdateMotionProgress(progress: Float): MotionProgress {
+internal fun createAndUpdateMotionProgress(progress: Float): MutableFloatState {
val motionProgress = remember {
- MotionProgress.fromMutableState(mutableFloatStateOf(progress))
+ mutableFloatStateOf(progress)
}
val last = remember { Ref<Float>().apply { value = progress } }
if (last.value != progress) {
// Update on progress change
last.value = progress
- motionProgress.updateProgress(progress)
+ motionProgress.floatValue = progress
}
return motionProgress
}
@@ -1053,7 +1053,8 @@
*/
@PublishedApi
internal enum class CompositionSource {
- // TODO: Add an explicit option for Composition initiated internally
+ // TODO: Consider adding an explicit option for Composition initiated internally, in case we
+ // need to differentiate them
Unknown,
@@ -1065,36 +1066,6 @@
}
/**
- * Internal representation to read and set values for the progress.
- */
-internal interface MotionProgress {
- // TODO: Since this class has no other uses anymore, consider to substitute it with a simple
- // MutableState<Float>
-
- val currentProgress: Float
-
- fun updateProgress(newProgress: Float)
-
- companion object {
- fun fromMutableState(mutableProgress: MutableState<Float>): MotionProgress =
- fromState(mutableProgress) { mutableProgress.value = it }
-
- fun fromState(
- progressState: State<Float>,
- onUpdate: (newProgress: Float) -> Unit
- ): MotionProgress =
- object : MotionProgress {
- override val currentProgress: Float
- get() = progressState.value
-
- override fun updateProgress(newProgress: Float) {
- onUpdate(newProgress)
- }
- }
- }
-}
-
-/**
* Flags to use with MotionLayout to enable visual debugging.
*
* @property showBounds
@@ -1177,4 +1148,4 @@
fun isShowingLayoutBounds(view: View): Boolean {
return view.isShowingLayoutBounds
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt
index c2915a5..a8a1f1c 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt
@@ -541,4 +541,4 @@
this.transition.interpolate(0, 0, progress)
transition.applyAllTo(this.transition)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt
index 1477c32..07bb926 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt
@@ -457,4 +457,4 @@
const val MAX_KEY_FRAMES = 50
private const val DEBUG_PATH_TICKS_PER_MS = 16
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionScene.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionScene.kt
index fc93309..08a80f2 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionScene.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionScene.kt
@@ -127,4 +127,4 @@
signalUpdate()
}
// endregion
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionSceneScope.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionSceneScope.kt
index 6d404b8..9a02187 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionSceneScope.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionSceneScope.kt
@@ -432,4 +432,4 @@
data class ConstraintSetRef internal constructor(
internal val name: String
-)
\ No newline at end of file
+)
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ToolingUtils.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ToolingUtils.kt
index 58d7e93..0cd828b 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ToolingUtils.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ToolingUtils.kt
@@ -193,4 +193,4 @@
viewWithBoundsAndConstraints.put("constraints", constraintsInfoArray)
}
put(viewId, viewWithBoundsAndConstraints)
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt
index 4730d2a..9845121 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt
@@ -108,4 +108,4 @@
internal companion object {
internal val EMPTY = TransitionImpl(CLObject(charArrayOf()))
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/TransitionHandler.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/TransitionHandler.kt
index 32a2cab..35e7131 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/TransitionHandler.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/TransitionHandler.kt
@@ -16,6 +16,7 @@
package androidx.constraintlayout.compose
+import androidx.compose.runtime.MutableFloatState
import androidx.compose.runtime.withFrameNanos
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.unit.Velocity
@@ -26,7 +27,7 @@
*/
internal class TransitionHandler(
private val motionMeasurer: MotionMeasurer,
- private val motionProgress: MotionProgress
+ private val motionProgress: MutableFloatState
) {
private val transition: androidx.constraintlayout.core.state.Transition
get() = motionMeasurer.transition
@@ -36,15 +37,15 @@
*/
fun updateProgressOnDrag(dragAmount: Offset) {
val progressDelta = transition.dragToProgress(
- motionProgress.currentProgress,
+ motionProgress.floatValue,
motionMeasurer.layoutCurrentWidth,
motionMeasurer.layoutCurrentHeight,
dragAmount.x,
dragAmount.y
)
- var newProgress = motionProgress.currentProgress + progressDelta
+ var newProgress = motionProgress.floatValue + progressDelta
newProgress = newProgress.coerceIn(0f, 1f)
- motionProgress.updateProgress(newProgress)
+ motionProgress.floatValue = newProgress
}
/**
@@ -53,7 +54,7 @@
*/
suspend fun onTouchUp(velocity: Velocity) {
withFrameNanos { timeNanos ->
- transition.setTouchUp(motionProgress.currentProgress, timeNanos, velocity.x, velocity.y)
+ transition.setTouchUp(motionProgress.floatValue, timeNanos, velocity.x, velocity.y)
}
}
@@ -65,13 +66,13 @@
val newProgress = withFrameNanos { timeNanos ->
transition.getTouchUpProgress(timeNanos)
}
- motionProgress.updateProgress(newProgress)
+ motionProgress.floatValue = newProgress
}
/**
* Returns true if the progress is still expected to be updated by [updateProgressWhileTouchUp].
*/
fun pendingProgressWhileTouchUp(): Boolean {
- return transition.isTouchNotDone(motionProgress.currentProgress)
+ return transition.isTouchNotDone(motionProgress.floatValue)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetStabilityTest.kt b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetStabilityTest.kt
index f843699..cc8aae3 100644
--- a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetStabilityTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/ConstraintSetStabilityTest.kt
@@ -208,4 +208,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/DebugFlagsTest.kt b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/DebugFlagsTest.kt
index 76d06f2..d119546 100644
--- a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/DebugFlagsTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/DebugFlagsTest.kt
@@ -117,4 +117,4 @@
DebugFlags(showBounds = false, showPaths = false, showKeyPositions = true).toString()
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/MotionSceneStabilityTest.kt b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/MotionSceneStabilityTest.kt
index b6795e7..09d9b83 100644
--- a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/MotionSceneStabilityTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/MotionSceneStabilityTest.kt
@@ -158,4 +158,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/TransitionStabilityTest.kt b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/TransitionStabilityTest.kt
index be92e41..f7858f1 100644
--- a/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/TransitionStabilityTest.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidTest/kotlin/androidx/constraintlayout/compose/TransitionStabilityTest.kt
@@ -110,4 +110,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/constraintlayout/constraintlayout/api/current.txt b/constraintlayout/constraintlayout/api/current.txt
index 70b97b6..10abe87 100644
--- a/constraintlayout/constraintlayout/api/current.txt
+++ b/constraintlayout/constraintlayout/api/current.txt
@@ -7,9 +7,11 @@
ctor public Carousel(android.content.Context!, android.util.AttributeSet!, int);
method public int getCount();
method public int getCurrentIndex();
+ method public boolean isInfinite();
method public void jumpToIndex(int);
method public void refresh();
method public void setAdapter(androidx.constraintlayout.helper.widget.Carousel.Adapter!);
+ method public void setInfinite(boolean);
method public void transitionToIndex(int, int);
field public static final int TOUCH_UP_CARRY_ON = 2; // 0x2
field public static final int TOUCH_UP_IMMEDIATE_STOP = 1; // 0x1
diff --git a/constraintlayout/constraintlayout/api/restricted_current.txt b/constraintlayout/constraintlayout/api/restricted_current.txt
index 70b97b6..10abe87 100644
--- a/constraintlayout/constraintlayout/api/restricted_current.txt
+++ b/constraintlayout/constraintlayout/api/restricted_current.txt
@@ -7,9 +7,11 @@
ctor public Carousel(android.content.Context!, android.util.AttributeSet!, int);
method public int getCount();
method public int getCurrentIndex();
+ method public boolean isInfinite();
method public void jumpToIndex(int);
method public void refresh();
method public void setAdapter(androidx.constraintlayout.helper.widget.Carousel.Adapter!);
+ method public void setInfinite(boolean);
method public void transitionToIndex(int, int);
field public static final int TOUCH_UP_CARRY_ON = 2; // 0x2
field public static final int TOUCH_UP_IMMEDIATE_STOP = 1; // 0x1
diff --git a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/Carousel.java b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/Carousel.java
index a83e3b1..1a6a26d 100644
--- a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/Carousel.java
+++ b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/Carousel.java
@@ -138,6 +138,25 @@
}
/**
+ * A setter method for whether it should be a infinite Carousel.
+ * Remember to call {@link #refresh} after calling this method.
+ *
+ * @param infiniteCarousel true if it should be a infinite Carousel, otherwise, false
+ */
+ public void setInfinite(boolean infiniteCarousel) {
+ this.mInfiniteCarousel = infiniteCarousel;
+ }
+
+ /**
+ * Returns whether it's a infinite Carousel
+ *
+ * @return true if it's a infinite Carousel, otherwise, false.
+ */
+ public boolean isInfinite() {
+ return this.mInfiniteCarousel;
+ }
+
+ /**
* Returns the number of elements in the Carousel
*
* @return number of elements
diff --git a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
index b90540e..00cba1a 100644
--- a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
+++ b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
@@ -64,7 +64,7 @@
*
* Recommendation - always set radius and angle for all views in <i>constraint_referenced_ids</i>
*
- **/
+ */
public class CircularFlow extends VirtualLayout {
private static final String TAG = "CircularFlow";
diff --git a/core/core-graphics-integration-tests/testapp/src/main/java/androidx/core/graphics/sample/GraphicsSampleActivity.kt b/core/core-graphics-integration-tests/testapp/src/main/java/androidx/core/graphics/sample/GraphicsSampleActivity.kt
index 26547b8..0c191e8 100644
--- a/core/core-graphics-integration-tests/testapp/src/main/java/androidx/core/graphics/sample/GraphicsSampleActivity.kt
+++ b/core/core-graphics-integration-tests/testapp/src/main/java/androidx/core/graphics/sample/GraphicsSampleActivity.kt
@@ -44,4 +44,4 @@
drawable2.setFilterBitmap(false)
bottomview.setImageDrawable(drawable2)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckDeviceSettingsTest.kt b/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckDeviceSettingsTest.kt
index a65431d..4a94a15 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckDeviceSettingsTest.kt
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckDeviceSettingsTest.kt
@@ -72,4 +72,4 @@
private fun stripVersionTrailing(str: String): String {
return str.replace(Regex("[0-9.]+$"), "")
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckTheJavaApisTest.java b/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckTheJavaApisTest.java
index f64ccb0..27349ee 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckTheJavaApisTest.java
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/CheckTheJavaApisTest.java
@@ -32,7 +32,6 @@
import androidx.core.i18n.DateTimeFormatterSkeletonOptions.Timezone;
import androidx.core.i18n.DateTimeFormatterSkeletonOptions.WeekDay;
import androidx.core.i18n.DateTimeFormatterSkeletonOptions.Year;
-import androidx.core.os.BuildCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -102,7 +101,7 @@
DateTimeFormatterSkeletonOptions dateTimeFormatterOptions = builder.build();
String expected;
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
expected = "Mo., 23. August 2021 n. Chr. um 19:53:47,123 MEZ";
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
expected = "Mo., 23. August 2021 n. Chr., 19:53:47,123 MEZ";
@@ -142,7 +141,7 @@
// Verify DateTimeFormatterSkeletonOptions.fromString
dateTimeFormatterOptions = DateTimeFormatterSkeletonOptions.fromString("yMMMMdjmsEEEE");
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
expected = "Montag, 23. August 2021 um 19:53:47";
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
expected = "Montag, 23. August 2021, 19:53:47";
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatJdkStylesTest.kt b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatJdkStylesTest.kt
index dae2fa6..cdf185f 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatJdkStylesTest.kt
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatJdkStylesTest.kt
@@ -114,4 +114,4 @@
val formatter = DateTimeFormatter(appContext, options, Locale.US)
assertEquals("Sun, Sep 19", formatter.format(testCalendar))
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterCommonOptionsTest.kt b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterCommonOptionsTest.kt
index 6860ebe..c1c745d 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterCommonOptionsTest.kt
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterCommonOptionsTest.kt
@@ -18,7 +18,6 @@
import android.icu.text.DateFormat
import android.os.Build
-import androidx.core.os.BuildCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -60,7 +59,7 @@
DateTimeFormatterCommonOptions.YEAR_NUM_MONTH_WEEKDAY_DAY to "Sun, 9/19/2021"
)
val commonFormatsVersionDependent = when {
- BuildCompat.isAtLeastU() -> mapOf(
+ Build.VERSION.SDK_INT >= 34 -> mapOf(
DateTimeFormatterCommonOptions.HOUR_MINUTE to "9:42\u202FPM",
DateTimeFormatterCommonOptions.HOUR_MINUTE_SECOND to "9:42:12\u202FPM"
)
@@ -158,4 +157,4 @@
assertEquals(entry.value, entry.key.toString())
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterTest.kt b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterTest.kt
index 94ff57d..bc48661 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterTest.kt
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/DateTimeFormatterTest.kt
@@ -20,7 +20,6 @@
import android.os.Build
import android.util.Log
import androidx.core.i18n.DateTimeFormatterSkeletonOptions as SkeletonOptions
-import androidx.core.os.BuildCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
@@ -100,7 +99,7 @@
val locale = Locale.US
val options = SkeletonOptions.fromString("yMMMdjms")
val expected = when {
- BuildCompat.isAtLeastU() -> "Sep 19, 2021, 9:42:12\u202FPM"
+ Build.VERSION.SDK_INT >= 34 -> "Sep 19, 2021, 9:42:12\u202FPM"
else -> "Sep 19, 2021, 9:42:12 PM"
}
@@ -126,19 +125,19 @@
val localeUs = Locale.US
val expectedUs12 = when {
- BuildCompat.isAtLeastU() -> "Sep 19, 2021, 9:42:12\u202FPM"
+ Build.VERSION.SDK_INT >= 34 -> "Sep 19, 2021, 9:42:12\u202FPM"
else -> "Sep 19, 2021, 9:42:12 PM"
}
val expectedUs24 = "Sep 19, 2021, 21:42:12"
val expectedUs12Milli = when {
- BuildCompat.isAtLeastU() -> "Sep 19, 2021, 9:42:12.345\u202FPM"
+ Build.VERSION.SDK_INT >= 34 -> "Sep 19, 2021, 9:42:12.345\u202FPM"
else -> "Sep 19, 2021, 9:42:12.345 PM"
}
val expectedFr12: String
val expectedFr24: String
when {
- BuildCompat.isAtLeastU() -> { // >= 31
+ Build.VERSION.SDK_INT >= 34 -> { // >= 31
expectedFr12 = "19 sept. 2021, 9:42:12\u202FPM"
expectedFr24 = "19 sept. 2021, 21:42:12"
}
@@ -234,7 +233,7 @@
@SdkSuppress(minSdkVersion = AVAILABLE_LANGUAGE_TAG)
fun testHourCycleOverrides() {
val expectedUs12 = when {
- BuildCompat.isAtLeastU() -> "Sep 19, 2021, 9:42:12\u202FPM"
+ Build.VERSION.SDK_INT >= 34 -> "Sep 19, 2021, 9:42:12\u202FPM"
else -> "Sep 19, 2021, 9:42:12 PM"
}
val expectedUs24 = "Sep 19, 2021, 21:42:12"
@@ -410,7 +409,7 @@
var options = builder.build()
assertEquals(
when {
- BuildCompat.isAtLeastU() -> "9:42\u202FPM Mountain Daylight Time"
+ Build.VERSION.SDK_INT >= 34 -> "9:42\u202FPM Mountain Daylight Time"
isIcuAvailable -> "9:42 PM Mountain Daylight Time"
else -> "8:42 PM Pacific Daylight Time"
},
@@ -420,7 +419,7 @@
options = builder.setTimezone(SkeletonOptions.Timezone.SHORT).build()
assertEquals(
when {
- BuildCompat.isAtLeastU() -> "9:42\u202FPM MDT"
+ Build.VERSION.SDK_INT >= 34 -> "9:42\u202FPM MDT"
isIcuAvailable -> "9:42 PM MDT"
else -> "8:42 PM PDT"
},
@@ -430,7 +429,7 @@
options = builder.setTimezone(SkeletonOptions.Timezone.SHORT_GENERIC).build()
assertEquals(
when {
- BuildCompat.isAtLeastU() -> "9:42\u202FPM MT"
+ Build.VERSION.SDK_INT >= 34 -> "9:42\u202FPM MT"
isIcuAvailable -> "9:42 PM MT"
else -> "8:42 PM PDT"
},
@@ -440,7 +439,7 @@
options = builder.setTimezone(SkeletonOptions.Timezone.SHORT_OFFSET).build()
assertEquals(
when {
- BuildCompat.isAtLeastU() -> "9:42\u202FPM GMT-6"
+ Build.VERSION.SDK_INT >= 34 -> "9:42\u202FPM GMT-6"
isIcuAvailable -> "9:42 PM GMT-6"
else -> "8:42 PM PDT"
},
@@ -460,7 +459,7 @@
// Honor the current default timezone
val expPDT = when {
- BuildCompat.isAtLeastU() -> "9:42\u202FPM Pacific Daylight Time"
+ Build.VERSION.SDK_INT >= 34 -> "9:42\u202FPM Pacific Daylight Time"
else -> "9:42 PM Pacific Daylight Time"
}
// Test Calendar, Date, and milliseconds
@@ -471,7 +470,7 @@
// Change the default timezone.
TimeZone.setDefault(TimeZone.getTimeZone("America/Denver"))
val expMDT = when {
- BuildCompat.isAtLeastU() -> "10:42\u202FPM Mountain Daylight Time"
+ Build.VERSION.SDK_INT >= 34 -> "10:42\u202FPM Mountain Daylight Time"
else -> "10:42 PM Mountain Daylight Time"
}
// The calendar object already has a time zone of its own, captured at creation time.
@@ -501,4 +500,4 @@
SkeletonOptions.fromString("fiInNopPRtT")
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/androidTest/java/androidx/core/i18n/Helper.kt b/core/core-i18n/src/androidTest/java/androidx/core/i18n/Helper.kt
index cea0afd..e3e4bad 100644
--- a/core/core-i18n/src/androidTest/java/androidx/core/i18n/Helper.kt
+++ b/core/core-i18n/src/androidTest/java/androidx/core/i18n/Helper.kt
@@ -34,4 +34,4 @@
fun normalizeNnbsp(text: String): String {
return text.replace("\u202F", " ")
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/main/java/androidx/core/i18n/DateTimeFormatter.kt b/core/core-i18n/src/main/java/androidx/core/i18n/DateTimeFormatter.kt
index de90629..03c10b9 100644
--- a/core/core-i18n/src/main/java/androidx/core/i18n/DateTimeFormatter.kt
+++ b/core/core-i18n/src/main/java/androidx/core/i18n/DateTimeFormatter.kt
@@ -175,4 +175,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/main/java/androidx/core/i18n/LocaleCompatUtils.kt b/core/core-i18n/src/main/java/androidx/core/i18n/LocaleCompatUtils.kt
index a576d18..31685be 100644
--- a/core/core-i18n/src/main/java/androidx/core/i18n/LocaleCompatUtils.kt
+++ b/core/core-i18n/src/main/java/androidx/core/i18n/LocaleCompatUtils.kt
@@ -25,4 +25,4 @@
*/
internal object LocaleCompatUtils {
fun getDefaultFormattingLocale(): Locale = Locale.getDefault()
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/main/java/androidx/core/i18n/MessageFormat.kt b/core/core-i18n/src/main/java/androidx/core/i18n/MessageFormat.kt
index 28b1569..74e5071 100644
--- a/core/core-i18n/src/main/java/androidx/core/i18n/MessageFormat.kt
+++ b/core/core-i18n/src/main/java/androidx/core/i18n/MessageFormat.kt
@@ -62,4 +62,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-i18n/src/main/java/androidx/core/i18n/messageformat_icu/simple/DateTimeFormatterAsFormat.kt b/core/core-i18n/src/main/java/androidx/core/i18n/messageformat_icu/simple/DateTimeFormatterAsFormat.kt
index 55e7d9a..312b9e8 100644
--- a/core/core-i18n/src/main/java/androidx/core/i18n/messageformat_icu/simple/DateTimeFormatterAsFormat.kt
+++ b/core/core-i18n/src/main/java/androidx/core/i18n/messageformat_icu/simple/DateTimeFormatterAsFormat.kt
@@ -48,4 +48,4 @@
java.text.SimpleDateFormat.getDateInstance(DateFormat.LONG).parseObject("")
throw ParseException("Parsing not implemented", 0)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-ktx/src/main/java/androidx/core/animation/Animator.kt b/core/core-ktx/src/main/java/androidx/core/animation/Animator.kt
index b40dda8..fe3450c 100644
--- a/core/core-ktx/src/main/java/androidx/core/animation/Animator.kt
+++ b/core/core-ktx/src/main/java/androidx/core/animation/Animator.kt
@@ -133,4 +133,4 @@
fun addPauseListener(animator: Animator, listener: Animator.AnimatorPauseListener) {
animator.addPauseListener(listener)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-ktx/src/main/java/androidx/core/graphics/Paint.kt b/core/core-ktx/src/main/java/androidx/core/graphics/Paint.kt
index 441cb8b..1aee940 100644
--- a/core/core-ktx/src/main/java/androidx/core/graphics/Paint.kt
+++ b/core/core-ktx/src/main/java/androidx/core/graphics/Paint.kt
@@ -27,4 +27,4 @@
*/
public inline fun Paint.setBlendMode(blendModeCompat: BlendModeCompat?): Boolean {
return PaintCompat.setBlendMode(this, blendModeCompat)
-}
\ No newline at end of file
+}
diff --git a/core/core-ktx/src/main/java/androidx/core/view/View.kt b/core/core-ktx/src/main/java/androidx/core/view/View.kt
index 74d4c8f..0b0febc 100644
--- a/core/core-ktx/src/main/java/androidx/core/view/View.kt
+++ b/core/core-ktx/src/main/java/androidx/core/view/View.kt
@@ -310,7 +310,7 @@
*
* @see View.getLayoutParams
* @see View.setLayoutParams
- **/
+ */
public inline fun View.updateLayoutParams(block: ViewGroup.LayoutParams.() -> Unit) {
updateLayoutParams<ViewGroup.LayoutParams>(block)
}
@@ -321,7 +321,7 @@
*
* @see View.getLayoutParams
* @see View.setLayoutParams
- **/
+ */
@JvmName("updateLayoutParamsTyped")
public inline fun <reified T : ViewGroup.LayoutParams> View.updateLayoutParams(
block: T.() -> Unit
diff --git a/core/core-performance-play-services/src/main/java/androidx/core/performance/play/services/PlayServicesDevicePerformanceSupplier.kt b/core/core-performance-play-services/src/main/java/androidx/core/performance/play/services/PlayServicesDevicePerformanceSupplier.kt
index 921caf5..a7a2792 100644
--- a/core/core-performance-play-services/src/main/java/androidx/core/performance/play/services/PlayServicesDevicePerformanceSupplier.kt
+++ b/core/core-performance-play-services/src/main/java/androidx/core/performance/play/services/PlayServicesDevicePerformanceSupplier.kt
@@ -43,4 +43,4 @@
emit(0)
// TODO(281079628): implement
}
-}
\ No newline at end of file
+}
diff --git a/core/core-performance-testing/src/main/java/androidx/core/performance/testing/FakeDevicePerformanceSupplier.kt b/core/core-performance-testing/src/main/java/androidx/core/performance/testing/FakeDevicePerformanceSupplier.kt
index 80ac20b..3a02368 100644
--- a/core/core-performance-testing/src/main/java/androidx/core/performance/testing/FakeDevicePerformanceSupplier.kt
+++ b/core/core-performance-testing/src/main/java/androidx/core/performance/testing/FakeDevicePerformanceSupplier.kt
@@ -31,4 +31,4 @@
override val mediaPerformanceClassFlow: Flow<Int> = flow {
emit(mediaPerformanceClass)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/AppWidgetManagerDeviceTest.kt b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/AppWidgetManagerDeviceTest.kt
index 053b013..082ea8b 100644
--- a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/AppWidgetManagerDeviceTest.kt
+++ b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/AppWidgetManagerDeviceTest.kt
@@ -191,4 +191,4 @@
}
private infix fun Number.x(other: Number) = SizeFCompat(this.toFloat(), other.toFloat())
-}
\ No newline at end of file
+}
diff --git a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/RemoteViewsCompatTest.kt b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/RemoteViewsCompatTest.kt
index c5f9f09..84a9146 100644
--- a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/RemoteViewsCompatTest.kt
+++ b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/RemoteViewsCompatTest.kt
@@ -439,4 +439,4 @@
return mIntent ?: fail("Expected intent to be received within five seconds")
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/TestAppWidgetProvider.kt b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/TestAppWidgetProvider.kt
index 551595e..2d59c68c 100644
--- a/core/core-remoteviews/src/androidTest/java/androidx/core/widget/TestAppWidgetProvider.kt
+++ b/core/core-remoteviews/src/androidTest/java/androidx/core/widget/TestAppWidgetProvider.kt
@@ -18,4 +18,4 @@
import android.appwidget.AppWidgetProvider
-public class TestAppWidgetProvider : AppWidgetProvider()
\ No newline at end of file
+public class TestAppWidgetProvider : AppWidgetProvider()
diff --git a/core/core-remoteviews/src/test/java/androidx/core/widget/AppWidgetManagerCompatTest.kt b/core/core-remoteviews/src/test/java/androidx/core/widget/AppWidgetManagerCompatTest.kt
index dd00746..c190fbb 100644
--- a/core/core-remoteviews/src/test/java/androidx/core/widget/AppWidgetManagerCompatTest.kt
+++ b/core/core-remoteviews/src/test/java/androidx/core/widget/AppWidgetManagerCompatTest.kt
@@ -280,4 +280,4 @@
configuration.apply(modifier)
return context.createConfigurationContext(configuration)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-splashscreen/samples/src/main/java/androidx/core/splashscreen/sample/SplashScreenSampleActivity.kt b/core/core-splashscreen/samples/src/main/java/androidx/core/splashscreen/sample/SplashScreenSampleActivity.kt
index 5abcc47..2ad3db5 100644
--- a/core/core-splashscreen/samples/src/main/java/androidx/core/splashscreen/sample/SplashScreenSampleActivity.kt
+++ b/core/core-splashscreen/samples/src/main/java/androidx/core/splashscreen/sample/SplashScreenSampleActivity.kt
@@ -170,4 +170,4 @@
const val SPLASHSCREEN_TY_ANIMATION_DURATION = 500
const val WAIT_FOR_AVD_TO_FINISH = false
}
-}
\ No newline at end of file
+}
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt
index fb9f042..d3518db9 100644
--- a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt
@@ -53,4 +53,4 @@
}
Truth.assertThat(splashScreen.splashScreenIconViewBackground).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/TestView.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/TestView.kt
index 9170829..5e915f7 100644
--- a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/TestView.kt
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/TestView.kt
@@ -32,4 +32,4 @@
super.onDraw(canvas)
doOnDraw()
}
-}
\ No newline at end of file
+}
diff --git a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
index 3fc305c..7820518 100644
--- a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
+++ b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
@@ -139,4 +139,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/ThemeUtils.kt b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/ThemeUtils.kt
index 66d08c6..653e9a6 100644
--- a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/ThemeUtils.kt
+++ b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/ThemeUtils.kt
@@ -63,4 +63,4 @@
decor.windowInsetsController!!.setSystemBarsAppearance(appearance, mask)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/CallListAdapter.kt b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/CallListAdapter.kt
index 7c33fc8..a7598c2 100644
--- a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/CallListAdapter.kt
+++ b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/CallListAdapter.kt
@@ -162,4 +162,4 @@
holder?.currentEndpoint?.text = "currentEndpoint=[$endpoint]"
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/Utilities.kt b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/Utilities.kt
index 13c0b67..b1fd714 100644
--- a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/Utilities.kt
+++ b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/Utilities.kt
@@ -51,4 +51,4 @@
CALL_TYPE_VIDEO_CALL,
ALL_CALL_CAPABILITIES)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/VoipCall.kt b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/VoipCall.kt
index d2decbb..c984ad9 100644
--- a/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/VoipCall.kt
+++ b/core/core-telecom/integration-tests/testapp/src/main/java/androidx/core/telecom/test/VoipCall.kt
@@ -92,4 +92,4 @@
}
return null
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/AndroidManifest.xml b/core/core-telecom/src/androidTest/AndroidManifest.xml
index ec9a3d9..6e24bd3 100644
--- a/core/core-telecom/src/androidTest/AndroidManifest.xml
+++ b/core/core-telecom/src/androidTest/AndroidManifest.xml
@@ -27,7 +27,17 @@
</intent-filter>
</service>
- <service android:name="androidx.core.telecom.utils.MockInCallService"
+ <!-- This CS is needed to simulate managed/sim calls for testing -->
+ <service
+ android:name="androidx.core.telecom.test.utils.ManagedConnectionService"
+ android:exported="true"
+ android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
+ <intent-filter>
+ <action android:name="android.telecom.ConnectionService"/>
+ </intent-filter>
+ </service>
+
+ <service android:name="androidx.core.telecom.test.utils.MockInCallService"
android:permission="android.permission.BIND_INCALL_SERVICE"
android:exported="true">
<intent-filter>
@@ -43,7 +53,7 @@
android:value="true" />
</service>
- <activity android:name="androidx.core.telecom.utils.MockDialerActivity"
+ <activity android:name="androidx.core.telecom.test.utils.MockDialerActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.DIAL" />
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlCallbacksTest.kt
similarity index 99%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlCallbacksTest.kt
index 808b668..f1fff4d 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlCallbacksTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlCallbacksTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.os.Build.VERSION_CODES
import android.telecom.Call
@@ -22,8 +22,8 @@
import android.telecom.DisconnectCause
import androidx.annotation.RequiresApi
import androidx.core.telecom.internal.utils.Utils
-import androidx.core.telecom.utils.BaseTelecomTest
-import androidx.core.telecom.utils.TestUtils
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.TestUtils
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
@@ -506,4 +506,4 @@
// Assert that the correct callback was invoked
assertTrue(TestUtils.mOnDisconnectCallbackCalled)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlsTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlsTest.kt
similarity index 97%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlsTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlsTest.kt
index af294a3..5992045 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/BasicCallControlsTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/BasicCallControlsTest.kt
@@ -14,15 +14,18 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.os.Build.VERSION_CODES
import android.telecom.DisconnectCause
import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallAttributesCompat
+import androidx.core.telecom.CallEndpointCompat
+import androidx.core.telecom.CallException
import androidx.core.telecom.internal.utils.Utils
-import androidx.core.telecom.utils.BaseTelecomTest
-import androidx.core.telecom.utils.MockInCallService
-import androidx.core.telecom.utils.TestUtils
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.MockInCallService
+import androidx.core.telecom.test.utils.TestUtils
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
@@ -437,4 +440,4 @@
}
return null
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/CallEndpointCompatTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallEndpointCompatTest.kt
similarity index 97%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/CallEndpointCompatTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallEndpointCompatTest.kt
index 1711968..edc806f 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/CallEndpointCompatTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallEndpointCompatTest.kt
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.os.Build.VERSION_CODES
import android.os.ParcelUuid
import android.telecom.CallAudioState
import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallEndpointCompat
import androidx.core.telecom.internal.utils.EndpointUtils
import androidx.test.filters.SdkSuppress
import java.util.UUID
@@ -113,4 +114,4 @@
EndpointUtils.mapTypeToRoute(-1)
)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/CallsManagerTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallsManagerTest.kt
similarity index 94%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/CallsManagerTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallsManagerTest.kt
index 453d374..a575a9b 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/CallsManagerTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/CallsManagerTest.kt
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.os.Build.VERSION_CODES
import android.telecom.PhoneAccount.CAPABILITY_SELF_MANAGED
import android.telecom.PhoneAccount.CAPABILITY_SUPPORTS_TRANSACTIONAL_OPERATIONS
import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallsManager
import androidx.core.telecom.internal.utils.Utils
-import androidx.core.telecom.utils.BaseTelecomTest
-import androidx.core.telecom.utils.TestUtils
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.TestUtils
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -104,4 +105,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/InCallAudioTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/InCallAudioTest.kt
similarity index 97%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/InCallAudioTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/InCallAudioTest.kt
index d892bc4..453ec4d 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/InCallAudioTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/InCallAudioTest.kt
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.media.AudioManager.MODE_IN_COMMUNICATION
import android.os.Build
import android.telecom.DisconnectCause
import androidx.annotation.RequiresApi
import androidx.core.telecom.internal.utils.Utils
-import androidx.core.telecom.utils.BaseTelecomTest
-import androidx.core.telecom.utils.TestUtils
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.TestUtils
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
@@ -128,4 +128,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/JetpackConnectionServiceTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/JetpackConnectionServiceTest.kt
similarity index 93%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/JetpackConnectionServiceTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/JetpackConnectionServiceTest.kt
index a85adca..ab14abf 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/JetpackConnectionServiceTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/JetpackConnectionServiceTest.kt
@@ -14,19 +14,20 @@
* limitations under the License.
*/
-package androidx.core.telecom
+package androidx.core.telecom.test
import android.os.Build.VERSION_CODES
import android.telecom.Connection
import android.telecom.ConnectionRequest
import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallAttributesCompat
import androidx.core.telecom.internal.CallChannels
import androidx.core.telecom.internal.JetpackConnectionService
import androidx.core.telecom.internal.utils.Utils
-import androidx.core.telecom.utils.BaseTelecomTest
-import androidx.core.telecom.utils.TestUtils
-import androidx.core.telecom.utils.TestUtils.TEST_CALL_ATTRIB_NAME
-import androidx.core.telecom.utils.TestUtils.TEST_PHONE_NUMBER_9001
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.TestUtils
+import androidx.core.telecom.test.utils.TestUtils.TEST_CALL_ATTRIB_NAME
+import androidx.core.telecom.test.utils.TestUtils.TEST_PHONE_NUMBER_9001
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -129,4 +130,4 @@
// create a ConnectionRequest
return ConnectionRequest(mPackagePhoneAccountHandle, TEST_PHONE_NUMBER_9001, null)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/ManagedCallsTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/ManagedCallsTest.kt
new file mode 100644
index 0000000..90e8504
--- /dev/null
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/ManagedCallsTest.kt
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.telecom.test
+
+import android.content.ComponentName
+import android.net.Uri
+import android.os.Build
+import android.telecom.DisconnectCause
+import android.telecom.PhoneAccount
+import android.telecom.PhoneAccountHandle
+import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallAttributesCompat
+import androidx.core.telecom.internal.utils.Utils
+import androidx.core.telecom.test.utils.BaseTelecomTest
+import androidx.core.telecom.test.utils.ManagedConnection
+import androidx.core.telecom.test.utils.ManagedConnectionService
+import androidx.core.telecom.test.utils.TestUtils
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/**
+ * NOTE: This class requires a minSdkVersion = Build.VERSION_CODES.Q
+ *
+ * [ManagedCallsTest] should be used to test core-telecom with traditional sim calling.
+ */
+@SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+@RequiresApi(Build.VERSION_CODES.Q)
+@RunWith(AndroidJUnit4::class)
+@OptIn(ExperimentalCoroutinesApi::class)
+class ManagedCallsTest : BaseTelecomTest() {
+ private val address = Uri.parse("tel:555-TEST")
+ private val mManagedConnectionService = ManagedConnectionService()
+ private val mPhoneAccountHandle = PhoneAccountHandle(
+ ComponentName(
+ "androidx.core.telecom.test",
+ "androidx.core.telecom.test.utils.ManagedConnectionService"
+ ), "2"
+ )
+ private val mPhoneAccount = PhoneAccount.builder(mPhoneAccountHandle, "ManagedJetpackAcct")
+ .setAddress(address)
+ .setSubscriptionAddress(address)
+ .setCapabilities(
+ PhoneAccount.CAPABILITY_CALL_PROVIDER or
+ PhoneAccount.CAPABILITY_VIDEO_CALLING or
+ PhoneAccount.CAPABILITY_RTT or
+ PhoneAccount.CAPABILITY_CONNECTION_MANAGER or
+ PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS or
+ PhoneAccount.CAPABILITY_ADHOC_CONFERENCE_CALLING
+ )
+ .addSupportedUriScheme(PhoneAccount.SCHEME_TEL)
+ .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL)
+ .build()
+
+ @Before
+ fun setUp() {
+ Utils.resetUtils()
+ mTelecomManager.registerPhoneAccount(mPhoneAccount)
+ TestUtils.enablePhoneAccountHandle(mContext, mPhoneAccountHandle)
+ }
+
+ @After
+ fun onDestroy() {
+ Utils.resetUtils()
+ mTelecomManager.unregisterPhoneAccount(mPhoneAccountHandle)
+ }
+
+ /**
+ * verify simulated managed calling is working in the jetpack layer.
+ */
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+ @LargeTest
+ @Test
+ fun testAddManagedCall() {
+ val deferredConnection = CompletableDeferred<ManagedConnection>()
+ runBlocking {
+ val connection = addManagedCall(TestUtils.OUTGOING_CALL_ATTRIBUTES, deferredConnection)
+ disconnectAndDestroyConnection(connection)
+ }
+ }
+
+ /***********************************************************************************************
+ * Helpers
+ *********************************************************************************************/
+
+ private suspend fun addManagedCall(
+ callAttributes: CallAttributesCompat,
+ deferredConnection: CompletableDeferred<ManagedConnection>
+ ): ManagedConnection {
+ val request = ManagedConnectionService.PendingConnectionRequest(
+ callAttributes, deferredConnection
+ )
+ mManagedConnectionService.createConnectionRequest(
+ mTelecomManager,
+ mPhoneAccountHandle,
+ request
+ )
+ deferredConnection.await()
+ val connection = deferredConnection.getCompleted()
+ delay(10)
+ connection.setActive()
+ delay(10)
+ return connection
+ }
+
+ private fun disconnectAndDestroyConnection(connection: ManagedConnection) {
+ connection.setDisconnected(DisconnectCause(DisconnectCause.LOCAL))
+ connection.destroy()
+ }
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/BaseTelecomTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/BaseTelecomTest.kt
similarity index 97%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/BaseTelecomTest.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/BaseTelecomTest.kt
index eb9a8a1..d7451f3 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/BaseTelecomTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/BaseTelecomTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.core.telecom.utils
+package androidx.core.telecom.test.utils
import android.content.Context
import android.content.pm.PackageManager
@@ -113,6 +113,9 @@
private fun maybeCleanupStuckCalls() {
JetpackConnectionService.mPendingConnectionRequests.clear()
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ ManagedConnectionService.mPendingConnectionRequests.clear()
+ }
MockInCallService.destroyAllCalls()
}
@@ -161,4 +164,4 @@
Assert.fail(TestUtils.VERIFICATION_TIMEOUT_MSG)
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnection.kt
similarity index 68%
copy from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
copy to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnection.kt
index 1c5fafb..3855142 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnection.kt
@@ -14,17 +14,13 @@
* limitations under the License.
*/
-package androidx.kruth
+package androidx.core.telecom.test.utils
+
+import android.os.Build
+import androidx.annotation.RequiresApi
/**
- * Always fails with the provided error message.
+ * [ManagedConnection] is an extension of the [android.telecom.Connection] class.
*/
-internal class FailingOrdered(
- private val asserter: KruthAsserter,
- private val message: () -> String,
-) : Ordered {
-
- override fun inOrder() {
- asserter.fail(message())
- }
-}
\ No newline at end of file
+@RequiresApi(Build.VERSION_CODES.O)
+class ManagedConnection : android.telecom.Connection()
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnectionService.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnectionService.kt
new file mode 100644
index 0000000..1d7e7d0
--- /dev/null
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/ManagedConnectionService.kt
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.telecom.test.utils
+
+import android.os.Build
+import android.telecom.Connection
+import android.telecom.ConnectionRequest
+import android.telecom.ConnectionService
+import android.telecom.PhoneAccountHandle
+import android.telecom.TelecomManager
+import android.telecom.VideoProfile
+import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallAttributesCompat
+import androidx.core.telecom.internal.utils.Utils
+import androidx.test.platform.app.InstrumentationRegistry
+import kotlinx.coroutines.CompletableDeferred
+
+/**
+ * NOTE: This class requires a DUT that has Build.VERSION_CODES.Q or higher in oder to create
+ * connections. This is due to the user of [androidx.test.platform.app.InstrumentationRegistry]
+ * dependency.
+ *
+ * [ManagedConnectionService] is a ConnectionService that simulates managed/sim calls. Managed calls
+ * have to be simulated because the devices being used for testing are not guaranteed to have sims.
+ */
+@RequiresApi(Build.VERSION_CODES.Q)
+class ManagedConnectionService : ConnectionService() {
+ data class PendingConnectionRequest(
+ val callAttributes: CallAttributesCompat,
+ val completableDeferred: CompletableDeferred<ManagedConnection>?
+ )
+
+ companion object {
+ var mPendingConnectionRequests: ArrayList<PendingConnectionRequest> = ArrayList()
+ }
+
+ fun createConnectionRequest(
+ telecomManager: TelecomManager,
+ phoneAccountHandle: PhoneAccountHandle,
+ pendingConnectionRequest: PendingConnectionRequest,
+ ) {
+ pendingConnectionRequest.callAttributes.mHandle = phoneAccountHandle
+
+ // add request to list
+ mPendingConnectionRequests.add(pendingConnectionRequest)
+
+ val extras = Utils.getBundleWithPhoneAccountHandle(
+ pendingConnectionRequest.callAttributes,
+ pendingConnectionRequest.callAttributes.mHandle!!
+ )
+
+ val uiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation
+ uiAutomation.adoptShellPermissionIdentity("android.permission.CALL_PHONE")
+
+ // Call into the platform to start call
+ if (pendingConnectionRequest.callAttributes.isOutgoingCall()) {
+ telecomManager.placeCall(
+ pendingConnectionRequest.callAttributes.address, extras
+ )
+ } else {
+ telecomManager.addNewIncomingCall(
+ pendingConnectionRequest.callAttributes.mHandle, extras
+ )
+ }
+ uiAutomation.dropShellPermissionIdentity()
+ }
+
+ /**
+ * Outgoing Connections
+ */
+ override fun onCreateOutgoingConnection(
+ connectionManagerAccount: PhoneAccountHandle,
+ request: ConnectionRequest
+ ): Connection? {
+ return createSelfManagedConnection(
+ request, CallAttributesCompat.DIRECTION_OUTGOING
+ )
+ }
+
+ override fun onCreateOutgoingConnectionFailed(
+ connectionManagerPhoneAccount: PhoneAccountHandle,
+ request: ConnectionRequest
+ ) {
+ val pendingRequest: PendingConnectionRequest? = findTargetPendingConnectionRequest(
+ request, CallAttributesCompat.DIRECTION_OUTGOING
+ )
+ pendingRequest?.completableDeferred?.cancel()
+
+ mPendingConnectionRequests.remove(pendingRequest)
+ }
+
+ /**
+ * Incoming Connections
+ */
+ override fun onCreateIncomingConnection(
+ connectionManagerPhoneAccount: PhoneAccountHandle,
+ request: ConnectionRequest
+ ): Connection? {
+ return createSelfManagedConnection(
+ request, CallAttributesCompat.DIRECTION_INCOMING
+ )
+ }
+
+ override fun onCreateIncomingConnectionFailed(
+ connectionManagerPhoneAccount: PhoneAccountHandle,
+ request: ConnectionRequest
+ ) {
+ val pendingRequest: PendingConnectionRequest? = findTargetPendingConnectionRequest(
+ request, CallAttributesCompat.DIRECTION_INCOMING
+ )
+ pendingRequest?.completableDeferred?.cancel()
+ mPendingConnectionRequests.remove(pendingRequest)
+ }
+
+ internal fun createSelfManagedConnection(
+ request: ConnectionRequest,
+ direction: Int
+ ): Connection? {
+ val targetRequest: PendingConnectionRequest =
+ findTargetPendingConnectionRequest(request, direction) ?: return null
+
+ val jetpackConnection = ManagedConnection()
+
+ // set display name
+ jetpackConnection.setCallerDisplayName(
+ targetRequest.callAttributes.displayName.toString(), TelecomManager.PRESENTATION_ALLOWED
+ )
+
+ // set address
+ jetpackConnection.setAddress(
+ targetRequest.callAttributes.address, TelecomManager.PRESENTATION_ALLOWED
+ )
+
+ // set the call state for the given direction
+ if (direction == CallAttributesCompat.DIRECTION_OUTGOING) {
+ jetpackConnection.setDialing()
+ } else {
+ jetpackConnection.setRinging()
+ }
+
+ // set the callType
+ if (targetRequest.callAttributes.callType == CallAttributesCompat.CALL_TYPE_VIDEO_CALL) {
+ jetpackConnection.videoState = VideoProfile.STATE_BIDIRECTIONAL
+ } else {
+ jetpackConnection.videoState = VideoProfile.STATE_AUDIO_ONLY
+ }
+
+ // set the call capabilities
+ if (targetRequest.callAttributes.hasSupportsSetInactiveCapability()) {
+ jetpackConnection.connectionCapabilities =
+ Connection.CAPABILITY_HOLD or Connection.CAPABILITY_SUPPORT_HOLD
+ }
+
+ targetRequest.completableDeferred?.complete(jetpackConnection)
+ mPendingConnectionRequests.remove(targetRequest)
+
+ return jetpackConnection
+ }
+
+ /**
+ * Helper methods
+ */
+ private fun findTargetPendingConnectionRequest(
+ request: ConnectionRequest,
+ direction: Int
+ ): PendingConnectionRequest? {
+ for (pendingConnectionRequest in mPendingConnectionRequests) {
+ if (isSameAddress(pendingConnectionRequest.callAttributes, request) && isSameDirection(
+ pendingConnectionRequest.callAttributes, direction
+ ) && isSameHandle(pendingConnectionRequest.callAttributes.mHandle, request)
+ ) {
+ return pendingConnectionRequest
+ }
+ }
+ return null
+ }
+
+ private fun isSameDirection(callAttributes: CallAttributesCompat, direction: Int): Boolean {
+ return (callAttributes.direction == direction)
+ }
+
+ private fun isSameAddress(
+ callAttributes: CallAttributesCompat,
+ request: ConnectionRequest
+ ): Boolean {
+ return request.address?.equals(callAttributes.address) ?: false
+ }
+
+ private fun isSameHandle(handle: PhoneAccountHandle?, request: ConnectionRequest): Boolean {
+ return request.accountHandle?.equals(handle) ?: false
+ }
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockDialerActivity.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockDialerActivity.kt
similarity index 95%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockDialerActivity.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockDialerActivity.kt
index 93fb341..14a9e5e 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockDialerActivity.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockDialerActivity.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.core.telecom.utils
+package androidx.core.telecom.test.utils
import android.app.Activity
import android.os.Bundle
@@ -28,4 +28,4 @@
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockInCallService.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockInCallService.kt
similarity index 98%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockInCallService.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockInCallService.kt
index d620ca7..95fcd26 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/MockInCallService.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/MockInCallService.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.core.telecom.utils
+package androidx.core.telecom.test.utils
import android.content.Intent
import android.os.Build
@@ -96,4 +96,4 @@
super.onCallRemoved(call)
mCalls.remove(call)
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/TestUtils.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/TestUtils.kt
similarity index 90%
rename from core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/TestUtils.kt
rename to core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/TestUtils.kt
index c33d8ee..d38fd18 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/utils/TestUtils.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/utils/TestUtils.kt
@@ -14,10 +14,13 @@
* limitations under the License.
*/
-package androidx.core.telecom.utils
+package androidx.core.telecom.test.utils
+import android.content.Context
import android.net.Uri
import android.os.Build.VERSION_CODES
+import android.os.UserHandle
+import android.os.UserManager
import android.telecom.Call
import android.telecom.DisconnectCause
import android.telecom.PhoneAccountHandle
@@ -44,6 +47,7 @@
const val COMMAND_SET_DEFAULT_DIALER = "telecom set-default-dialer " // DO NOT REMOVE SPACE
const val COMMAND_GET_DEFAULT_DIALER = "telecom get-default-dialer"
const val COMMAND_CLEANUP_STUCK_CALLS = "cleanup-stuck-calls"
+ const val COMMAND_ENABLE_PHONE_ACCOUNT = "telecom set-phone-account-enabled "
const val COMMAND_DUMP_TELECOM = "dumpsys telecom"
const val TEST_CALL_ATTRIB_NAME = "Elon Musk"
const val OUTGOING_NAME = "Larry Page"
@@ -221,6 +225,24 @@
)
}
+ fun enablePhoneAccountHandle(context: Context, phoneAccountHandle: PhoneAccountHandle) {
+ val pn = phoneAccountHandle.componentName.packageName
+ val cn = phoneAccountHandle.componentName.className
+ val userHandleId = getCurrentUserSerialNumber(context, phoneAccountHandle.userHandle)
+ Log.i(
+ LOG_TAG,
+ "enable phoneAccountHandle=[$phoneAccountHandle], success=[${
+ runShellCommand(
+ (COMMAND_ENABLE_PHONE_ACCOUNT +
+ pn + "/" + cn + " " + phoneAccountHandle.id + " " + userHandleId)
+ )
+ }]"
+ )
+ }
+ private fun getCurrentUserSerialNumber(context: Context, userHandle: UserHandle): Long {
+ val userManager = context.getSystemService(UserManager::class.java)
+ return userManager.getSerialNumberForUser(userHandle)
+ }
fun getDefaultDialer(): String {
val s = runShellCommand(COMMAND_GET_DEFAULT_DIALER)
return s.replace("\n", "")
@@ -282,4 +304,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallAttributesCompat.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallAttributesCompat.kt
index e3d3610..3d6abdc 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallAttributesCompat.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallAttributesCompat.kt
@@ -189,4 +189,4 @@
internal fun isOutgoingCall(): Boolean {
return direction == DIRECTION_OUTGOING
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallControlCallback.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallControlCallback.kt
index 8651577..b39bb5c 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallControlCallback.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallControlCallback.kt
@@ -82,4 +82,4 @@
* disconnect and untrack the call.
*/
suspend fun onDisconnect(disconnectCause: android.telecom.DisconnectCause): Boolean
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallControlScope.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallControlScope.kt
index 5977ca0..3ab71f1 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallControlScope.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallControlScope.kt
@@ -139,4 +139,4 @@
* changes.
*/
val isMuted: Flow<Boolean>
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallEndpointCompat.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallEndpointCompat.kt
index 13ee6cd..b70eb93 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallEndpointCompat.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallEndpointCompat.kt
@@ -99,4 +99,4 @@
) {
mMackAddress = address
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallException.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallException.kt
index 8677df2..c5964d1 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallException.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallException.kt
@@ -65,4 +65,4 @@
return "An Unknown Error has occurred while using the Core-Telecom APIs"
}
}
-}
\ No newline at end of file
+}
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 cae5305..fa5b8609 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
@@ -303,4 +303,4 @@
internal fun getBuiltPhoneAccount(): PhoneAccount? {
return mPhoneAccount
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallChannels.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallChannels.kt
index 8989ca4..0426191 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallChannels.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallChannels.kt
@@ -29,4 +29,4 @@
availableEndpointChannel.close()
isMutedChannel.close()
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/BuildVersionAdapter.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/BuildVersionAdapter.kt
index 9c40d14..563032d 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/BuildVersionAdapter.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/BuildVersionAdapter.kt
@@ -19,4 +19,4 @@
internal interface BuildVersionAdapter {
fun hasPlatformV2Apis(): Boolean
fun hasInvalidBuildVersion(): Boolean
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/CallAttributesUtils.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/CallAttributesUtils.kt
index 5148edd..5a1f8be 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/CallAttributesUtils.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/CallAttributesUtils.kt
@@ -80,4 +80,4 @@
return Utils.hasCapability(CallAttributesCompat.SUPPORTS_TRANSFER, callCapabilities)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/EndpointUtils.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/EndpointUtils.kt
index 7075dc5..d7c5be7 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/EndpointUtils.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/EndpointUtils.kt
@@ -214,4 +214,4 @@
return getCallEndpointFromBluetoothDevice(state.activeBluetoothDevice)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/Utils.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/Utils.kt
index 4ab0ec2..fa4b4ba 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/Utils.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/utils/Utils.kt
@@ -141,4 +141,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-testing/src/main/java/androidx/core/testing/util/TestConsumer.kt b/core/core-testing/src/main/java/androidx/core/testing/util/TestConsumer.kt
index 14623df..47eaeb3 100644
--- a/core/core-testing/src/main/java/androidx/core/testing/util/TestConsumer.kt
+++ b/core/core-testing/src/main/java/androidx/core/testing/util/TestConsumer.kt
@@ -56,4 +56,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/core-testing/src/test/java/androidx/core/testing/util/TestConsumerTest.kt b/core/core-testing/src/test/java/androidx/core/testing/util/TestConsumerTest.kt
index 48e0f9d..9aab53f 100644
--- a/core/core-testing/src/test/java/androidx/core/testing/util/TestConsumerTest.kt
+++ b/core/core-testing/src/test/java/androidx/core/testing/util/TestConsumerTest.kt
@@ -48,4 +48,4 @@
testConsumer.assertValues(values.reversed())
}
-}
\ No newline at end of file
+}
diff --git a/core/core/api/current.ignore b/core/core/api/current.ignore
new file mode 100644
index 0000000..d11fec9
--- /dev/null
+++ b/core/core/api/current.ignore
@@ -0,0 +1,7 @@
+// Baseline format: 1.0
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getActivity(android.content.Context,int,android.content.Intent,int,android.os.Bundle,boolean)
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getActivity(android.content.Context, int, android.content.Intent, int, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getActivity(android.content.Context,int,android.content.Intent,int,boolean)
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getService(android.content.Context, int, android.content.Intent, int, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getService(android.content.Context,int,android.content.Intent,int,boolean)
diff --git a/core/core/api/current.txt b/core/core/api/current.txt
index f3b03cb..0d4c8ef 100644
--- a/core/core/api/current.txt
+++ b/core/core/api/current.txt
@@ -875,11 +875,11 @@
public final class PendingIntentCompat {
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent![], int, android.os.Bundle?, boolean);
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent![], int, boolean);
- method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle?, boolean);
- method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, boolean);
+ method public static android.app.PendingIntent? getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle?, boolean);
+ method public static android.app.PendingIntent? getActivity(android.content.Context, int, android.content.Intent, int, boolean);
method public static android.app.PendingIntent? getBroadcast(android.content.Context, int, android.content.Intent, int, boolean);
method @RequiresApi(26) public static android.app.PendingIntent getForegroundService(android.content.Context, int, android.content.Intent, int, boolean);
- method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int, boolean);
+ method public static android.app.PendingIntent? getService(android.content.Context, int, android.content.Intent, int, boolean);
method public static void send(android.app.PendingIntent, android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished?, android.os.Handler?) throws android.app.PendingIntent.CanceledException;
method public static void send(android.app.PendingIntent, android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished?, android.os.Handler?, String?, android.os.Bundle?) throws android.app.PendingIntent.CanceledException;
method public static void send(android.app.PendingIntent, int, android.app.PendingIntent.OnFinished?, android.os.Handler?) throws android.app.PendingIntent.CanceledException;
@@ -1849,7 +1849,7 @@
package androidx.core.os {
- public class BuildCompat {
+ public final class BuildCompat {
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.N) public static boolean isAtLeastN();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.N_MR1) public static boolean isAtLeastNMR1();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.O) public static boolean isAtLeastO();
@@ -1858,17 +1858,18 @@
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.Q) public static boolean isAtLeastQ();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.R) public static boolean isAtLeastR();
method @Deprecated @ChecksSdkIntAtLeast(api=31, codename="S") public static boolean isAtLeastS();
- method @Deprecated @SuppressCompatibility @ChecksSdkIntAtLeast(api=32, codename="Sv2") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastSv2();
- method @Deprecated @SuppressCompatibility @ChecksSdkIntAtLeast(api=33, codename="Tiramisu") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastT();
- method @SuppressCompatibility @ChecksSdkIntAtLeast(api=34, codename="UpsideDownCake") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastU();
+ method @Deprecated @ChecksSdkIntAtLeast(api=32, codename="Sv2") public static boolean isAtLeastSv2();
+ method @Deprecated @ChecksSdkIntAtLeast(api=33, codename="Tiramisu") public static boolean isAtLeastT();
+ method @Deprecated @ChecksSdkIntAtLeast(api=34, codename="UpsideDownCake") public static boolean isAtLeastU();
method @SuppressCompatibility @ChecksSdkIntAtLeast(codename="VanillaIceCream") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastV();
field @ChecksSdkIntAtLeast(extension=android.os.ext.SdkExtensions.AD_SERVICES) public static final int AD_SERVICES_EXTENSION_INT;
+ field public static final androidx.core.os.BuildCompat INSTANCE;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.R) public static final int R_EXTENSION_INT;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.S) public static final int S_EXTENSION_INT;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.TIRAMISU) public static final int T_EXTENSION_INT;
}
- @SuppressCompatibility @RequiresOptIn @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) public static @interface BuildCompat.PrereleaseSdkCheck {
+ @SuppressCompatibility @kotlin.RequiresOptIn @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public static @interface BuildCompat.PrereleaseSdkCheck {
}
public final class BundleCompat {
@@ -3863,10 +3864,12 @@
method public int getDisplayId();
method public int getId();
method public int getLayer();
+ method public androidx.core.os.LocaleListCompat getLocales();
method public androidx.core.view.accessibility.AccessibilityWindowInfoCompat? getParent();
method public void getRegionInScreen(android.graphics.Region);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getRoot();
method public CharSequence? getTitle();
+ method public long getTransitionTimeMillis();
method public int getType();
method public boolean isAccessibilityFocused();
method public boolean isActive();
diff --git a/core/core/api/restricted_current.ignore b/core/core/api/restricted_current.ignore
new file mode 100644
index 0000000..d11fec9
--- /dev/null
+++ b/core/core/api/restricted_current.ignore
@@ -0,0 +1,7 @@
+// Baseline format: 1.0
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getActivity(android.content.Context,int,android.content.Intent,int,android.os.Bundle,boolean)
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getActivity(android.content.Context, int, android.content.Intent, int, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getActivity(android.content.Context,int,android.content.Intent,int,boolean)
+InvalidNullConversion: androidx.core.app.PendingIntentCompat#getService(android.content.Context, int, android.content.Intent, int, boolean):
+ Attempted to change method return from @NonNull to @Nullable: incompatible change for method androidx.core.app.PendingIntentCompat.getService(android.content.Context,int,android.content.Intent,int,boolean)
diff --git a/core/core/api/restricted_current.txt b/core/core/api/restricted_current.txt
index 2a13cca..6ccfe47 100644
--- a/core/core/api/restricted_current.txt
+++ b/core/core/api/restricted_current.txt
@@ -976,11 +976,11 @@
public final class PendingIntentCompat {
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent![], int, android.os.Bundle?, boolean);
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent![], int, boolean);
- method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle?, boolean);
- method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, boolean);
+ method public static android.app.PendingIntent? getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle?, boolean);
+ method public static android.app.PendingIntent? getActivity(android.content.Context, int, android.content.Intent, int, boolean);
method public static android.app.PendingIntent? getBroadcast(android.content.Context, int, android.content.Intent, int, boolean);
method @RequiresApi(26) public static android.app.PendingIntent getForegroundService(android.content.Context, int, android.content.Intent, int, boolean);
- method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int, boolean);
+ method public static android.app.PendingIntent? getService(android.content.Context, int, android.content.Intent, int, boolean);
method public static void send(android.app.PendingIntent, android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished?, android.os.Handler?) throws android.app.PendingIntent.CanceledException;
method public static void send(android.app.PendingIntent, android.content.Context, int, android.content.Intent, android.app.PendingIntent.OnFinished?, android.os.Handler?, String?, android.os.Bundle?) throws android.app.PendingIntent.CanceledException;
method public static void send(android.app.PendingIntent, int, android.app.PendingIntent.OnFinished?, android.os.Handler?) throws android.app.PendingIntent.CanceledException;
@@ -2202,7 +2202,7 @@
package androidx.core.os {
- public class BuildCompat {
+ public final class BuildCompat {
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.N) public static boolean isAtLeastN();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.N_MR1) public static boolean isAtLeastNMR1();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.O) public static boolean isAtLeastO();
@@ -2211,17 +2211,18 @@
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.Q) public static boolean isAtLeastQ();
method @Deprecated @ChecksSdkIntAtLeast(api=android.os.Build.VERSION_CODES.R) public static boolean isAtLeastR();
method @Deprecated @ChecksSdkIntAtLeast(api=31, codename="S") public static boolean isAtLeastS();
- method @Deprecated @SuppressCompatibility @ChecksSdkIntAtLeast(api=32, codename="Sv2") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastSv2();
- method @Deprecated @SuppressCompatibility @ChecksSdkIntAtLeast(api=33, codename="Tiramisu") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastT();
- method @SuppressCompatibility @ChecksSdkIntAtLeast(api=34, codename="UpsideDownCake") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastU();
+ method @Deprecated @ChecksSdkIntAtLeast(api=32, codename="Sv2") public static boolean isAtLeastSv2();
+ method @Deprecated @ChecksSdkIntAtLeast(api=33, codename="Tiramisu") public static boolean isAtLeastT();
+ method @Deprecated @ChecksSdkIntAtLeast(api=34, codename="UpsideDownCake") public static boolean isAtLeastU();
method @SuppressCompatibility @ChecksSdkIntAtLeast(codename="VanillaIceCream") @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static boolean isAtLeastV();
field @ChecksSdkIntAtLeast(extension=android.os.ext.SdkExtensions.AD_SERVICES) public static final int AD_SERVICES_EXTENSION_INT;
+ field public static final androidx.core.os.BuildCompat INSTANCE;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.R) public static final int R_EXTENSION_INT;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.S) public static final int S_EXTENSION_INT;
field @ChecksSdkIntAtLeast(extension=android.os.Build.VERSION_CODES.TIRAMISU) public static final int T_EXTENSION_INT;
}
- @SuppressCompatibility @RequiresOptIn @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) public static @interface BuildCompat.PrereleaseSdkCheck {
+ @SuppressCompatibility @kotlin.RequiresOptIn @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public static @interface BuildCompat.PrereleaseSdkCheck {
}
public final class BundleCompat {
@@ -4352,10 +4353,12 @@
method public int getDisplayId();
method public int getId();
method public int getLayer();
+ method public androidx.core.os.LocaleListCompat getLocales();
method public androidx.core.view.accessibility.AccessibilityWindowInfoCompat? getParent();
method public void getRegionInScreen(android.graphics.Region);
method public androidx.core.view.accessibility.AccessibilityNodeInfoCompat? getRoot();
method public CharSequence? getTitle();
+ method public long getTransitionTimeMillis();
method public int getType();
method public boolean isAccessibilityFocused();
method public boolean isActive();
diff --git a/core/core/src/androidTest/java/androidx/core/app/ActivityCompatTest.java b/core/core/src/androidTest/java/androidx/core/app/ActivityCompatTest.java
index bded6af..5a9c846 100644
--- a/core/core/src/androidTest/java/androidx/core/app/ActivityCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/app/ActivityCompatTest.java
@@ -34,9 +34,7 @@
import android.support.v4.BaseInstrumentationTestCase;
import android.view.View;
-import androidx.annotation.OptIn;
import androidx.core.app.ActivityCompat.PermissionCompatDelegate;
-import androidx.core.os.BuildCompat;
import androidx.core.test.R;
import androidx.test.core.app.ActivityScenario;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -152,7 +150,6 @@
}
@Test
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void testShouldShowRequestPermissionRationaleForPostNotifications() throws Throwable {
if (Build.VERSION.SDK_INT < 33) {
// permission doesn't exist yet, so should return false
diff --git a/core/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java b/core/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
index 1716ef1..7fbc420 100644
--- a/core/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/app/NotificationCompatTest.java
@@ -572,6 +572,42 @@
@SdkSuppress(minSdkVersion = 19)
@Test
+ public void testBuilderFromNotification_withSmallResIdAndLargeBitmap() {
+ int smallIcon = R.drawable.ic_call_answer;
+ Bitmap largeIcon = BitmapFactory.decodeResource(mContext.getResources(),
+ R.drawable.notification_bg);
+ Notification original = new NotificationCompat.Builder(mContext, "channelId")
+ .setSmallIcon(smallIcon)
+ .setLargeIcon(largeIcon)
+ .build();
+
+ Notification recovered = new NotificationCompat.Builder(mContext, original).build();
+
+ assertThat(recovered.icon).isEqualTo(smallIcon);
+ assertThat(recovered.largeIcon).isEqualTo(largeIcon);
+ }
+
+ @SdkSuppress(minSdkVersion = 23)
+ @Test
+ public void testBuilderFromNotification_withSmallAndLargeIcons() {
+ IconCompat smallIcon = IconCompat.createWithResource(mContext, R.drawable.ic_call_answer);
+ Icon largeIcon = Icon.createWithResource(mContext, R.drawable.notification_bg);
+ Notification original = new NotificationCompat.Builder(mContext, "channelId")
+ .setSmallIcon(smallIcon)
+ .setLargeIcon(largeIcon)
+ .build();
+
+ Notification recovered = new NotificationCompat.Builder(mContext, original).build();
+
+ // Icon doesn't implement equals(), and instances are not identical due to conversion
+ // between Icon & IconCompat, so compare string representation instead.
+ assertThat(recovered.getSmallIcon().toString()).isEqualTo(
+ smallIcon.toIcon(mContext).toString());
+ assertThat(recovered.getLargeIcon().toString()).isEqualTo(largeIcon.toString());
+ }
+
+ @SdkSuppress(minSdkVersion = 19)
+ @Test
public void testBuilderFromNotification_fromMessagingStyledCompat() {
Person person1 = new Person.Builder()
.setName("personName1")
@@ -2454,7 +2490,7 @@
}
@Test
- @SdkSuppress(minSdkVersion = 24) // TODO: Should be 20. Adjust when b/288084025 is fixed.
+ @SdkSuppress(minSdkVersion = 20)
public void testCallStyle_preservesCustomActions() {
PendingIntent hangupIntent = createIntent("hangup");
Person person = new Person.Builder().setName("test name").build();
diff --git a/core/core/src/androidTest/java/androidx/core/content/ContextCompatTest.java b/core/core/src/androidTest/java/androidx/core/content/ContextCompatTest.java
index a0ce095..077e531 100644
--- a/core/core/src/androidTest/java/androidx/core/content/ContextCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/content/ContextCompatTest.java
@@ -147,11 +147,9 @@
import android.view.inputmethod.InputMethodManager;
import android.view.textservice.TextServicesManager;
-import androidx.annotation.OptIn;
import androidx.core.app.AppLocalesStorageHelper;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.hardware.display.DisplayManagerCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.os.ConfigurationCompat;
import androidx.core.os.LocaleListCompat;
import androidx.core.test.R;
@@ -604,9 +602,8 @@
}
@Test
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void testCheckSelfPermissionNotificationPermission() {
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
assertEquals(
mContext.checkCallingPermission(Manifest.permission.POST_NOTIFICATIONS),
ContextCompat.checkSelfPermission(
diff --git a/core/core/src/androidTest/java/androidx/core/content/IntentCompatTest.java b/core/core/src/androidTest/java/androidx/core/content/IntentCompatTest.java
index ec062a6..4a053a7 100644
--- a/core/core/src/androidTest/java/androidx/core/content/IntentCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/content/IntentCompatTest.java
@@ -43,10 +43,10 @@
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.net.Uri;
+import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
-import androidx.core.os.BuildCompat;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
@@ -224,7 +224,7 @@
@Test
public void getParcelableArrayExtra_postU() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Intent intent = new Intent();
Signature[] signature = new Signature[] { new Signature("") };
intent.putExtra("extra", signature);
@@ -237,7 +237,7 @@
@Test
public void getParcelableArrayExtra_returnsNullOnClassMismatch_postU() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Intent intent = new Intent();
Signature[] signature = new Signature[] { new Signature("") };
intent.putExtra("extra", signature);
@@ -248,7 +248,7 @@
@Test
public void getParcelableArrayExtra_preU() {
- if (BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT >= 34) return;
Intent intent = new Intent();
Signature[] signature = new Signature[] { new Signature("") };
intent.putExtra("extra", signature);
@@ -282,7 +282,7 @@
@Test
public void getParcelableArrayListExtra_returnsNullOnClassMismatch_postU() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Intent intent = new Intent();
ArrayList<Signature> signature = Lists.newArrayList(new Signature(""));
intent.putParcelableArrayListExtra("extra", signature);
@@ -293,7 +293,7 @@
@Test
public void getParcelableArrayListExtra_noTypeCheck_preU() {
- if (BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT >= 34) return;
Intent intent = new Intent();
ArrayList<Signature> signature = Lists.newArrayList(new Signature(""));
intent.putParcelableArrayListExtra("extra", signature);
diff --git a/core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java b/core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
index 3ce039d..16c5ef7 100644
--- a/core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
@@ -37,9 +37,7 @@
import android.util.DisplayMetrics;
import androidx.annotation.NonNull;
-import androidx.annotation.OptIn;
import androidx.core.graphics.TypefaceCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.provider.FontsContractCompat;
import androidx.core.provider.MockFontProvider;
import androidx.core.test.R;
@@ -526,8 +524,6 @@
assertTrue(drawable instanceof TransitionDrawable);
assertTrue(mutated instanceof TransitionDrawable);
}
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@Test
public void testClearCachesForTheme() {
Resources.Theme theme = mResources.newTheme();
diff --git a/core/core/src/androidTest/java/androidx/core/os/BundleCompatTest.java b/core/core/src/androidTest/java/androidx/core/os/BundleCompatTest.java
index 533fe9c..e772f8d 100644
--- a/core/core/src/androidTest/java/androidx/core/os/BundleCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/os/BundleCompatTest.java
@@ -23,6 +23,7 @@
import android.content.Intent;
import android.content.pm.Signature;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
@@ -66,7 +67,7 @@
@Test
@SdkSuppress(minSdkVersion = 33)
public void getParcelableArray_post33() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Bundle bundle = new Bundle();
bundle.putParcelableArray("array", new Intent[] { new Intent() });
parcelAndUnparcel(bundle);
@@ -78,7 +79,7 @@
@Test
@SdkSuppress(minSdkVersion = 33)
public void getParcelableArray_returnsNullOnClassMismatch_post33() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Bundle bundle = new Bundle();
bundle.putParcelableArray("array", new Intent[] { new Intent() });
parcelAndUnparcel(bundle);
@@ -89,7 +90,7 @@
@Test
@SdkSuppress(maxSdkVersion = 32)
public void getParcelableArray_pre33() {
- if (BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT >= 34) return;
Bundle bundle = new Bundle();
bundle.putParcelableArray("array", new Intent[] { new Intent() });
parcelAndUnparcel(bundle);
@@ -117,9 +118,9 @@
}
@Test
- @SdkSuppress(minSdkVersion = 33)
- public void getParcelableArrayList_returnsNullOnClassMismatch_post33() {
- if (!BuildCompat.isAtLeastU()) return;
+ @SdkSuppress(minSdkVersion = 34)
+ public void getParcelableArrayList_returnsNullOnClassMismatch_post34() {
+ if (Build.VERSION.SDK_INT < 34) return;
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("array", Lists.newArrayList(new Intent()));
parcelAndUnparcel(bundle);
@@ -128,9 +129,9 @@
}
@Test
- @SdkSuppress(maxSdkVersion = 32)
- public void getParcelableArrayList_noTypeCheck_pre33() {
- if (BuildCompat.isAtLeastU()) return;
+ @SdkSuppress(maxSdkVersion = 33)
+ public void getParcelableArrayList_noTypeCheck_pre34() {
+ if (Build.VERSION.SDK_INT >= 34) return;
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("array", Lists.newArrayList(new Intent()));
parcelAndUnparcel(bundle);
@@ -155,9 +156,9 @@
}
@Test
- @SdkSuppress(minSdkVersion = 33)
- public void getSparseParcelableArray_returnsNullOnClassMismatch_post33() {
- if (!BuildCompat.isAtLeastU()) return;
+ @SdkSuppress(minSdkVersion = 34)
+ public void getSparseParcelableArray_returnsNullOnClassMismatch_post34() {
+ if (Build.VERSION.SDK_INT < 34) return;
Bundle bundle = new Bundle();
SparseArray<Intent> array = new SparseArray<>();
array.put(0, new Intent());
@@ -168,9 +169,9 @@
}
@Test
- @SdkSuppress(maxSdkVersion = 32)
- public void getSparseParcelableArray_noTypeCheck_pre33() {
- if (BuildCompat.isAtLeastU()) return;
+ @SdkSuppress(maxSdkVersion = 33)
+ public void getSparseParcelableArray_noTypeCheck_pre34() {
+ if (Build.VERSION.SDK_INT >= 34) return;
Bundle bundle = new Bundle();
SparseArray<Intent> array = new SparseArray<>();
array.put(0, new Intent());
diff --git a/core/core/src/androidTest/java/androidx/core/os/ParcelCompatTest.java b/core/core/src/androidTest/java/androidx/core/os/ParcelCompatTest.java
index e3464ac..9329489 100644
--- a/core/core/src/androidTest/java/androidx/core/os/ParcelCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/os/ParcelCompatTest.java
@@ -236,7 +236,7 @@
@Test
public void readParcelableArrayTyped_postU() {
- if (!BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT < 34) return;
Parcel p = Parcel.obtain();
Signature[] s = {new Signature("1234"),
null,
@@ -258,7 +258,7 @@
@Test
public void readParcelableArrayTyped_preU() {
- if (BuildCompat.isAtLeastU()) return;
+ if (Build.VERSION.SDK_INT >= 34) return;
Parcel p = Parcel.obtain();
Signature[] s = {new Signature("1234"),
null,
diff --git a/core/core/src/androidTest/java/androidx/core/service/quicksettings/TileServiceCompatTest.java b/core/core/src/androidTest/java/androidx/core/service/quicksettings/TileServiceCompatTest.java
index a78f703..836591a 100644
--- a/core/core/src/androidTest/java/androidx/core/service/quicksettings/TileServiceCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/service/quicksettings/TileServiceCompatTest.java
@@ -59,7 +59,7 @@
Bundle options = new Bundle();
PendingIntentActivityWrapper wrapper = new PendingIntentActivityWrapper(mContext,
requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT, options, /* isMutable = */
- true);
+ false);
TileServiceCompat.setTileServiceWrapper(tileServiceWrapper);
TileServiceCompat.startActivityAndCollapse(tileService, wrapper);
diff --git a/core/core/src/androidTest/java/androidx/core/view/DisplayCutoutCompatTest.java b/core/core/src/androidTest/java/androidx/core/view/DisplayCutoutCompatTest.java
index 3bc2fe3..4d92901 100644
--- a/core/core/src/androidTest/java/androidx/core/view/DisplayCutoutCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/view/DisplayCutoutCompatTest.java
@@ -25,9 +25,9 @@
import static org.junit.Assert.assertNotEquals;
import android.graphics.Rect;
+import android.os.Build;
import androidx.core.graphics.Insets;
-import androidx.core.os.BuildCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -90,7 +90,7 @@
@Test
public void testWaterfallInsets() {
- if (BuildCompat.isAtLeastR()) {
+ if (Build.VERSION.SDK_INT >= 30) {
assertEquals(Insets.of(0, 20, 0, 20), mCutoutWaterfall.getWaterfallInsets());
} else {
assertEquals(Insets.NONE, mCutoutWaterfall.getWaterfallInsets());
diff --git a/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java b/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
index 3b7b2d8..e0cc255 100644
--- a/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompatTest.java
@@ -324,7 +324,7 @@
equalTo(accessibilityNodeInfoCompat.unwrap().getExtraRenderingInfo()));
}
- @SdkSuppress(minSdkVersion = 33)
+ @SdkSuppress(minSdkVersion = 19)
@SmallTest
@Test
public void testSetGetTextSelectable() {
@@ -335,7 +335,6 @@
assertThat(accessibilityNodeInfoCompat.isTextSelectable(), equalTo(true));
}
- @SdkSuppress(minSdkVersion = 34)
@SmallTest
@Test
public void testActionScrollInDirection() {
diff --git a/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompatTest.java b/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompatTest.java
index 1788e22..e67191b 100644
--- a/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompatTest.java
+++ b/core/core/src/androidTest/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompatTest.java
@@ -16,15 +16,18 @@
package androidx.core.view.accessibility;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.IsNot.not;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import android.annotation.TargetApi;
import android.graphics.Region;
+import android.os.Build;
+import android.os.LocaleList;
import android.view.accessibility.AccessibilityWindowInfo;
+import androidx.core.os.LocaleListCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -32,6 +35,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.Locale;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class AccessibilityWindowInfoCompatTest {
@@ -49,8 +54,8 @@
AccessibilityWindowInfoCompat infoCompat = new AccessibilityWindowInfoCompat();
AccessibilityWindowInfo info = new AccessibilityWindowInfo();
- assertThat(infoCompat.unwrap(), is(not(equalTo(null))));
- assertThat(infoCompat.unwrap(), equalTo(info));
+ assertThat(infoCompat.unwrap()).isNotNull();
+ assertThat(infoCompat.unwrap()).isEqualTo(info);
}
@SdkSuppress(minSdkVersion = 33)
@@ -60,7 +65,7 @@
AccessibilityWindowInfo accessibilityWindowInfo = AccessibilityWindowInfo.obtain();
AccessibilityWindowInfoCompat accessibilityWindowInfoCompat =
AccessibilityWindowInfoCompat.wrapNonNullInstance(accessibilityWindowInfo);
- assertThat(accessibilityWindowInfoCompat.unwrap(), equalTo(accessibilityWindowInfo));
+ assertThat(accessibilityWindowInfoCompat.unwrap()).isEqualTo(accessibilityWindowInfo);
}
@SdkSuppress(minSdkVersion = 33)
@@ -68,8 +73,8 @@
@Test
public void testIsPictureInPictureMode() {
AccessibilityWindowInfoCompat windowInfoCompat = obtainedWrappedWindowCompat();
- assertThat(windowInfoCompat.isInPictureInPictureMode(), equalTo(
- windowInfoCompat.unwrap().isInPictureInPictureMode()));
+ assertThat(windowInfoCompat.isInPictureInPictureMode()).isEqualTo(
+ windowInfoCompat.unwrap().isInPictureInPictureMode());
}
@SdkSuppress(minSdkVersion = 33)
@@ -77,8 +82,8 @@
@Test
public void testGetDisplayId() {
AccessibilityWindowInfoCompat windowInfoCompat = obtainedWrappedWindowCompat();
- assertThat(windowInfoCompat.getDisplayId(), equalTo(
- windowInfoCompat.unwrap().getDisplayId()));
+ assertThat(windowInfoCompat.getDisplayId()).isEqualTo(
+ windowInfoCompat.unwrap().getDisplayId());
}
@SdkSuppress(minSdkVersion = 33)
@@ -90,6 +95,42 @@
Region compatRegion = new Region();
windowInfoCompat.unwrap().getRegionInScreen(region);
windowInfoCompat.getRegionInScreen(region);
- assertThat(region, equalTo(compatRegion));
+ assertThat(region).isEqualTo(compatRegion);
+ }
+ @SmallTest
+ @Test
+ public void testGetTransitionTimeMillis() {
+ boolean supportsPlatformTransitionMillis = Build.VERSION.SDK_INT >= 34;
+ AccessibilityWindowInfoCompat windowInfoCompat;
+ if (supportsPlatformTransitionMillis) {
+ AccessibilityWindowInfo mockInfo = mock(AccessibilityWindowInfo.class);
+ when(mockInfo.getTransitionTimeMillis()).thenReturn(100L);
+ windowInfoCompat =
+ AccessibilityWindowInfoCompat.wrapNonNullInstance(mockInfo);
+ } else {
+ windowInfoCompat = obtainedWrappedWindowCompat();
+ }
+
+ long transitionMillis = supportsPlatformTransitionMillis ? 100L : 0;
+ assertThat(windowInfoCompat.getTransitionTimeMillis()).isEqualTo(transitionMillis);
+ }
+
+ @SmallTest
+ @Test
+ public void testGetLocales() {
+ boolean supportsPlatformLocales = Build.VERSION.SDK_INT >= 34;
+ AccessibilityWindowInfoCompat windowInfoCompat;
+ if (supportsPlatformLocales) {
+ AccessibilityWindowInfo mockInfo = mock(AccessibilityWindowInfo.class);
+ when(mockInfo.getLocales()).thenReturn(new LocaleList(Locale.ENGLISH));
+ windowInfoCompat = AccessibilityWindowInfoCompat.wrapNonNullInstance(mockInfo);
+ } else {
+ windowInfoCompat = obtainedWrappedWindowCompat();
+ }
+
+ LocaleListCompat localeListCompat = supportsPlatformLocales
+ ? LocaleListCompat.wrap(new LocaleList(Locale.ENGLISH))
+ : LocaleListCompat.getEmptyLocaleList();
+ assertThat(windowInfoCompat.getLocales()).isEqualTo(localeListCompat);
}
}
diff --git a/core/core/src/main/java/androidx/core/app/ActivityCompat.java b/core/core/src/main/java/androidx/core/app/ActivityCompat.java
index bc39a35..dea976c 100644
--- a/core/core/src/main/java/androidx/core/app/ActivityCompat.java
+++ b/core/core/src/main/java/androidx/core/app/ActivityCompat.java
@@ -42,12 +42,10 @@
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.content.ContextCompat;
import androidx.core.content.LocusIdCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.view.DragAndDropPermissionsCompat;
import java.lang.reflect.InvocationTargetException;
@@ -513,7 +511,6 @@
* @see #checkSelfPermission(android.content.Context, String)
* @see #shouldShowRequestPermissionRationale(android.app.Activity, String)
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static void requestPermissions(final @NonNull Activity activity,
final @NonNull String[] permissions, final @IntRange(from = 0) int requestCode) {
if (sDelegate != null
@@ -589,7 +586,6 @@
* @see #checkSelfPermission(Context, String)
* @see #requestPermissions(Activity, String[], int)
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static boolean shouldShowRequestPermissionRationale(@NonNull Activity activity,
@NonNull String permission) {
if (Build.VERSION.SDK_INT < 33
diff --git a/core/core/src/main/java/androidx/core/app/ComponentActivity.java b/core/core/src/main/java/androidx/core/app/ComponentActivity.java
index 384c454..1ada2ea 100644
--- a/core/core/src/main/java/androidx/core/app/ComponentActivity.java
+++ b/core/core/src/main/java/androidx/core/app/ComponentActivity.java
@@ -28,10 +28,8 @@
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RestrictTo;
import androidx.collection.SimpleArrayMap;
-import androidx.core.os.BuildCompat;
import androidx.core.view.KeyEventDispatcher;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
@@ -164,8 +162,6 @@
protected final boolean shouldDumpInternalState(@Nullable String[] args) {
return !shouldSkipDump(args);
}
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
private static boolean shouldSkipDump(@Nullable String[] args) {
if (args != null && args.length > 0) {
// NOTE: values below are hardcoded on framework's Activity (like dumpInner())
@@ -178,7 +174,7 @@
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S;
case "--list-dumpables":
case "--dump-dumpable":
- return BuildCompat.isAtLeastT();
+ return Build.VERSION.SDK_INT >= 33;
}
}
return false;
diff --git a/core/core/src/main/java/androidx/core/app/GrammaticalInflectionManagerCompat.java b/core/core/src/main/java/androidx/core/app/GrammaticalInflectionManagerCompat.java
index d1f442b..07e24f0 100644
--- a/core/core/src/main/java/androidx/core/app/GrammaticalInflectionManagerCompat.java
+++ b/core/core/src/main/java/androidx/core/app/GrammaticalInflectionManagerCompat.java
@@ -18,6 +18,7 @@
import android.app.GrammaticalInflectionManager;
import android.content.Context;
+import android.os.Build;
import androidx.annotation.AnyThread;
import androidx.annotation.DoNotInline;
@@ -26,7 +27,6 @@
import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
-import androidx.core.os.BuildCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -90,7 +90,7 @@
@OptIn(markerClass = androidx.core.os.BuildCompat.PrereleaseSdkCheck.class)
@AnyThread
public static int getApplicationGrammaticalGender(@NonNull Context context) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api34Impl.getApplicationGrammaticalGender(context);
} else {
return 0;
@@ -108,7 +108,7 @@
@AnyThread
public static void setRequestedApplicationGrammaticalGender(
@NonNull Context context, @GrammaticalGender int grammaticalGender) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api34Impl.setRequestedApplicationGrammaticalGender(context, grammaticalGender);
}
}
diff --git a/core/core/src/main/java/androidx/core/app/NotificationCompat.java b/core/core/src/main/java/androidx/core/app/NotificationCompat.java
index e8bab6f..848e66e 100644
--- a/core/core/src/main/java/androidx/core/app/NotificationCompat.java
+++ b/core/core/src/main/java/androidx/core/app/NotificationCompat.java
@@ -1134,6 +1134,10 @@
// Avoid the setter which requires wrapping/unwrapping IconCompat and extra null checks
if (Build.VERSION.SDK_INT >= 23) {
this.mSmallIcon = Api23Impl.getSmallIcon(notification);
+ Icon largeIcon = Api23Impl.getLargeIcon(notification);
+ if (largeIcon != null) {
+ this.mLargeIcon = IconCompat.createFromIcon(largeIcon);
+ }
}
// Add actions from the notification.
@@ -2652,6 +2656,11 @@
static Icon getSmallIcon(Notification notification) {
return notification.getSmallIcon();
}
+
+ @DoNotInline
+ static Icon getLargeIcon(Notification notification) {
+ return notification.getLargeIcon();
+ }
}
/**
@@ -5004,18 +5013,6 @@
}
}
if (style != null) {
- // Before applying the style, we clear any previous style-provided actions.
- ArrayList<Action> customActions = new ArrayList<>();
- for (Action action : mBuilder.mActions) {
- if (!isActionAddedByCallStyle(action)) {
- customActions.add(action);
- }
- }
- Api24Impl.clearActions(builderAccessor.getBuilder());
- for (Action action : customActions) {
- Api20Impl.addAction(builderAccessor.getBuilder(),
- getActionFromActionCompat(action));
- }
Api16Impl.setBuilder(style, builderAccessor.getBuilder());
if (mAnswerButtonColor != null) {
Api31Impl.setAnswerButtonColorHint(style, mAnswerButtonColor);
@@ -5067,20 +5064,6 @@
}
}
- // Adds actions to the notification.
- if (Build.VERSION.SDK_INT >= 20) {
- // Retrieves call style actions, including contextual and system actions.
- List<Action> actionsList = getActionsListWithSystemActions();
- // Clear any existing actions.
- if (Build.VERSION.SDK_INT >= 24) {
- Api24Impl.clearActions(builder);
- }
- // Adds the actions to the builder in the proper order.
- for (Action action : actionsList) {
- Api20Impl.addAction(builder, getActionFromActionCompat(action));
- }
- }
-
// Sets the category of the notification to CATEGORY_CALL; if the notification
// has this set and is also from the default phone app, it will be ranked in the
// shade similarly to how CallStyle notifications are ranked in API 31+.
@@ -5227,51 +5210,6 @@
return resultActions;
}
- @RequiresApi(20)
- private static Notification.Action getActionFromActionCompat(Action actionCompat) {
- Notification.Action.Builder actionBuilder;
- if (Build.VERSION.SDK_INT >= 23) {
- IconCompat iconCompat = actionCompat.getIconCompat();
- actionBuilder = Api23Impl.createActionBuilder(
- iconCompat == null ? null : iconCompat.toIcon(), actionCompat.getTitle(),
- actionCompat.getActionIntent());
- } else {
- IconCompat icon = actionCompat.getIconCompat();
- int iconResId = 0;
- if (icon != null && icon.getType() == IconCompat.TYPE_RESOURCE) {
- iconResId = icon.getResId();
- }
- actionBuilder =
- Api20Impl.createActionBuilder(iconResId, actionCompat.getTitle(),
- actionCompat.getActionIntent());
- }
- Bundle actionExtras;
- if (actionCompat.getExtras() != null) {
- actionExtras = new Bundle(actionCompat.getExtras());
- } else {
- actionExtras = new Bundle();
- }
- actionExtras.putBoolean(NotificationCompatJellybean.EXTRA_ALLOW_GENERATED_REPLIES,
- actionCompat.getAllowGeneratedReplies());
- if (Build.VERSION.SDK_INT >= 24) {
- Api24Impl.setAllowGeneratedReplies(actionBuilder,
- actionCompat.getAllowGeneratedReplies());
- }
- if (Build.VERSION.SDK_INT >= 31) {
- Api31Impl.setAuthenticationRequired(actionBuilder,
- actionCompat.isAuthenticationRequired());
- }
- Api20Impl.addExtras(actionBuilder, actionExtras);
- RemoteInput[] remoteInputCompats = actionCompat.getRemoteInputs();
- if (remoteInputCompats != null) {
- android.app.RemoteInput[] remoteInputs = RemoteInput.fromCompat(remoteInputCompats);
- for (android.app.RemoteInput remoteInput : remoteInputs) {
- Api20Impl.addRemoteInput(actionBuilder, remoteInput);
- }
- }
- return Api20Impl.build(actionBuilder);
- }
-
/**
* A class for wrapping calls to {@link Notification.CallStyle} methods which
* were added in API 16; these calls must be wrapped to avoid performance issues.
@@ -5298,12 +5236,6 @@
}
@DoNotInline
- static Notification.Builder addAction(Notification.Builder builder,
- Notification.Action action) {
- return builder.addAction(action);
- }
-
- @DoNotInline
static Notification.Action build(Notification.Action.Builder builder) {
return builder.build();
}
@@ -5390,14 +5322,6 @@
private Api24Impl() {
}
- /**
- * Clears actions by calling setActions() with an empty list of arguments.
- */
- @DoNotInline
- static Notification.Builder clearActions(Notification.Builder builder) {
- return builder.setActions();
- }
-
@DoNotInline
static Notification.Action.Builder setAllowGeneratedReplies(
Notification.Action.Builder builder, boolean allowGeneratedReplies) {
diff --git a/core/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java b/core/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
index 54cc20f..f3c71f2 100644
--- a/core/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
+++ b/core/core/src/main/java/androidx/core/app/NotificationCompatBuilder.java
@@ -112,8 +112,25 @@
Api16Impl.setPriority(
Api16Impl.setUsesChronometer(Api16Impl.setSubText(mBuilder, b.mSubText),
b.mUseChronometer), b.mPriority);
- for (NotificationCompat.Action action : b.mActions) {
- addAction(action);
+
+ // CallStyle notifications add special actions in pre-specified positions, in addition
+ // to any provided custom actions. Because there's no way to remove Actions once they're
+ // added to Notification.Builder in Versions < 24, we add them here where we have
+ // access to NotificationCompatBuilder, rather than in CallStyle.apply where we have
+ // to add to the Notification.Builder directly.
+ if (Build.VERSION.SDK_INT >= 20
+ && (b.mStyle instanceof NotificationCompat.CallStyle)) {
+ // Retrieves call style actions, including contextual and system actions.
+ List<NotificationCompat.Action> actionsList =
+ ((NotificationCompat.CallStyle) b.mStyle).getActionsListWithSystemActions();
+ // Adds the actions to the builder in the proper order.
+ for (NotificationCompat.Action action : actionsList) {
+ addAction(action);
+ }
+ } else {
+ for (NotificationCompat.Action action : b.mActions) {
+ addAction(action);
+ }
}
if (b.mExtras != null) {
@@ -712,7 +729,7 @@
@DoNotInline
static Notification.Builder setSound(Notification.Builder builder, Uri sound,
- Object audioAttributes /** AudioAttributes **/) {
+ Object audioAttributes /** AudioAttributes */) {
return builder.setSound(sound, (AudioAttributes) audioAttributes);
}
}
@@ -734,7 +751,7 @@
@DoNotInline
static Notification.Builder setSmallIcon(Notification.Builder builder,
- Object icon /** Icon **/) {
+ Object icon /** Icon */) {
return builder.setSmallIcon((Icon) icon);
}
@@ -871,7 +888,7 @@
@DoNotInline
static Notification.Builder setLocusId(Notification.Builder builder,
- Object locusId /** LocusId **/) {
+ Object locusId /** LocusId */) {
return builder.setLocusId((LocusId) locusId);
}
diff --git a/core/core/src/main/java/androidx/core/app/PendingIntentCompat.java b/core/core/src/main/java/androidx/core/app/PendingIntentCompat.java
index e88aa99..92edc72 100644
--- a/core/core/src/main/java/androidx/core/app/PendingIntentCompat.java
+++ b/core/core/src/main/java/androidx/core/app/PendingIntentCompat.java
@@ -103,10 +103,13 @@
/**
* Retrieves a {@link PendingIntent} with mandatory mutability flag set on supported platform
* versions. The caller provides the flag as combination of all the other values except
- * mutability flag. This method combines mutability flag when necessary. See {@link
- * PendingIntent#getActivity(Context, int, Intent, int)}.
+ * mutability flag. This method combines mutability flag when necessary.
+ *
+ * @return Returns an existing or new PendingIntent matching the given parameters. May return
+ * {@code null} only if {@link PendingIntent#FLAG_NO_CREATE} has been supplied.
+ * @see PendingIntent#getActivity(Context, int, Intent, int)
*/
- public static @NonNull PendingIntent getActivity(
+ public static @Nullable PendingIntent getActivity(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
@@ -119,10 +122,13 @@
/**
* Retrieves a {@link PendingIntent} with mandatory mutability flag set on supported platform
* versions. The caller provides the flag as combination of all the other values except
- * mutability flag. This method combines mutability flag when necessary. See {@link
- * PendingIntent#getActivity(Context, int, Intent, int, Bundle)}.
+ * mutability flag. This method combines mutability flag when necessary.
+ *
+ * @return Returns an existing or new PendingIntent matching the given parameters. May return
+ * {@code null} only if {@link PendingIntent#FLAG_NO_CREATE} has been supplied.
+ * @see PendingIntent#getActivity(Context, int, Intent, int, Bundle)
*/
- public static @NonNull PendingIntent getActivity(
+ public static @Nullable PendingIntent getActivity(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
@@ -176,10 +182,13 @@
/**
* Retrieves a {@link PendingIntent} with mandatory mutability flag set on supported platform
* versions. The caller provides the flag as combination of all the other values except
- * mutability flag. This method combines mutability flag when necessary. See {@link
- * PendingIntent#getService(Context, int, Intent, int)}.
+ * mutability flag. This method combines mutability flag when necessary.
+ *
+ * @return Returns an existing or new PendingIntent matching the given parameters. May return
+ * {@code null} only if {@link PendingIntent#FLAG_NO_CREATE} has been supplied.
+ * @see PendingIntent#getService(Context, int, Intent, int)
*/
- public static @NonNull PendingIntent getService(
+ public static @Nullable PendingIntent getService(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
diff --git a/core/core/src/main/java/androidx/core/app/ServiceCompat.java b/core/core/src/main/java/androidx/core/app/ServiceCompat.java
index 09d7b64..ae56964 100644
--- a/core/core/src/main/java/androidx/core/app/ServiceCompat.java
+++ b/core/core/src/main/java/androidx/core/app/ServiceCompat.java
@@ -29,10 +29,8 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
-import androidx.core.os.BuildCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -168,10 +166,9 @@
* @see Service#startForeground(int, Notification)
* @see Service#startForeground(int, Notification, int)
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static void startForeground(@NonNull Service service, int id,
@NonNull Notification notification, int foregroundServiceType) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api34Impl.startForeground(service, id, notification, foregroundServiceType);
} else if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.startForeground(service, id, notification, foregroundServiceType);
diff --git a/core/core/src/main/java/androidx/core/content/ContextCompat.java b/core/core/src/main/java/androidx/core/content/ContextCompat.java
index d5d5f5a..bb53f32 100644
--- a/core/core/src/main/java/androidx/core/content/ContextCompat.java
+++ b/core/core/src/main/java/androidx/core/content/ContextCompat.java
@@ -149,14 +149,12 @@
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.app.LocaleManagerCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.res.ResourcesCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.os.ConfigurationCompat;
import androidx.core.os.EnvironmentCompat;
import androidx.core.os.ExecutorCompat;
@@ -595,7 +593,6 @@
* permission, or {@link PackageManager#PERMISSION_DENIED} if not.
* @see PackageManager#checkPermission(String, String)
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static int checkSelfPermission(@NonNull Context context, @NonNull String permission) {
ObjectsCompat.requireNonNull(permission, "permission must be non-null");
if (Build.VERSION.SDK_INT < 33
@@ -845,7 +842,6 @@
* @see Context#registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)
*/
@Nullable
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static Intent registerReceiver(@NonNull Context context,
@Nullable BroadcastReceiver receiver, @NonNull IntentFilter filter,
@Nullable String broadcastPermission,
@@ -870,7 +866,7 @@
+ "RECEIVER_NOT_EXPORTED");
}
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.registerReceiver(context, receiver, filter, broadcastPermission,
scheduler, flags);
}
diff --git a/core/core/src/main/java/androidx/core/content/IntentCompat.java b/core/core/src/main/java/androidx/core/content/IntentCompat.java
index 8647f13..db25773 100644
--- a/core/core/src/main/java/androidx/core/content/IntentCompat.java
+++ b/core/core/src/main/java/androidx/core/content/IntentCompat.java
@@ -34,9 +34,7 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
-import androidx.core.os.BuildCompat;
import java.util.ArrayList;
@@ -213,8 +211,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, the object type is checked after deserialization.
* </ul>
*
@@ -228,11 +225,10 @@
* @see Intent#putExtra(String, Parcelable)
*/
@Nullable
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
public static <T> T getParcelableExtra(@NonNull Intent in, @Nullable String name,
@NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableExtra(in, name, clazz);
} else {
T extra = in.getParcelableExtra(name);
@@ -245,8 +241,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -260,12 +255,11 @@
* @see Intent#putExtra(String, Parcelable[])
*/
@Nullable
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation"})
@SuppressLint({"ArrayReturn", "NullableCollection"})
public static Parcelable[] getParcelableArrayExtra(@NonNull Intent in, @Nullable String name,
@NonNull Class<? extends Parcelable> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableArrayExtra(in, name, clazz);
} else {
return in.getParcelableArrayExtra(name);
@@ -277,8 +271,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -294,12 +287,11 @@
* @see Intent#putParcelableArrayListExtra(String, ArrayList)
*/
@Nullable
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
@SuppressLint({"ConcreteCollection", "NullableCollection"})
public static <T> ArrayList<T> getParcelableArrayListExtra(
@NonNull Intent in, @Nullable String name, @NonNull Class<? extends T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableArrayListExtra(in, name, clazz);
} else {
return (ArrayList<T>) in.getParcelableArrayListExtra(name);
diff --git a/core/core/src/main/java/androidx/core/os/BuildCompat.java b/core/core/src/main/java/androidx/core/os/BuildCompat.java
deleted file mode 100644
index 896db47..0000000
--- a/core/core/src/main/java/androidx/core/os/BuildCompat.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.core.os;
-
-import static android.os.ext.SdkExtensions.getExtensionVersion;
-
-import android.annotation.SuppressLint;
-import android.os.Build;
-import android.os.Build.VERSION;
-import android.os.ext.SdkExtensions;
-
-import androidx.annotation.ChecksSdkIntAtLeast;
-import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
-import androidx.annotation.RequiresOptIn;
-import androidx.annotation.VisibleForTesting;
-
-import java.util.Locale;
-
-/**
- * This class contains additional platform version checking methods for targeting pre-release
- * versions of Android.
- */
-public class BuildCompat {
-
- private BuildCompat() {
- // This class is non-instantiable.
- }
-
- /**
- * Checks if the codename is a matching or higher version than the given build value.
- * @param codename the requested build codename, e.g. {@code "O"} or {@code "OMR1"}
- * @param buildCodename the value of {@link Build.VERSION#CODENAME}
- *
- * @return {@code true} if APIs from the requested codename are available in the build.
- */
- @VisibleForTesting
- static boolean isAtLeastPreReleaseCodename(@NonNull String codename,
- @NonNull String buildCodename) {
-
- // Special case "REL", which means the build is not a pre-release build.
- if ("REL".equals(buildCodename)) {
- return false;
- }
-
- // Otherwise lexically compare them. Return true if the build codename is equal to or
- // greater than the requested codename.
- final String buildCodenameUpper = buildCodename.toUpperCase(Locale.ROOT);
- final String codenameUpper = codename.toUpperCase(Locale.ROOT);
- return buildCodenameUpper.compareTo(codenameUpper) >= 0;
- }
-
- /**
- * Checks if the device is running on the Android N release or newer.
- *
- * @return {@code true} if N APIs are available for use
- * @deprecated Android N is a finalized release and this method is no longer necessary. It will
- * be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.N}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N)
- @Deprecated
- public static boolean isAtLeastN() {
- return VERSION.SDK_INT >= 24;
- }
-
- /**
- * Checks if the device is running on the Android N MR1 release or newer.
- *
- * @return {@code true} if N MR1 APIs are available for use
- * @deprecated Android N MR1 is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N_MR1)
- @Deprecated
- public static boolean isAtLeastNMR1() {
- return VERSION.SDK_INT >= 25;
- }
-
- /**
- * Checks if the device is running on a release version of Android O or newer.
- * <p>
- * @return {@code true} if O APIs are available for use, {@code false} otherwise
- * @deprecated Android O is a finalized release and this method is no longer necessary. It will
- * be removed in a future release of the Support Library. Instead use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.O}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
- @Deprecated
- public static boolean isAtLeastO() {
- return VERSION.SDK_INT >= 26;
- }
-
- /**
- * Checks if the device is running on a release version of Android O MR1 or newer.
- * <p>
- * @return {@code true} if O MR1 APIs are available for use, {@code false} otherwise
- * @deprecated Android O MR1 is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O_MR1)
- @Deprecated
- public static boolean isAtLeastOMR1() {
- return VERSION.SDK_INT >= 27;
- }
-
- /**
- * Checks if the device is running on a release version of Android P or newer.
- * <p>
- * @return {@code true} if P APIs are available for use, {@code false} otherwise
- * @deprecated Android P is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.P}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P)
- @Deprecated
- public static boolean isAtLeastP() {
- return VERSION.SDK_INT >= 28;
- }
-
- /**
- * Checks if the device is running on release version of Android Q or newer.
- * <p>
- * @return {@code true} if Q APIs are available for use, {@code false} otherwise
- * @deprecated Android Q is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.Q)
- @Deprecated
- public static boolean isAtLeastQ() {
- return VERSION.SDK_INT >= 29;
- }
-
- /**
- * Checks if the device is running on release version of Android R or newer.
- * <p>
- * @return {@code true} if R APIs are available for use, {@code false} otherwise
- * @deprecated Android R is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of the Support Library. Instead, use
- * {@code Build.VERSION.SDK_INT >= Build.VERSION_CODES.R}.
- */
- @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
- @Deprecated
- public static boolean isAtLeastR() {
- return VERSION.SDK_INT >= 30;
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android S or a release version of
- * Android S or newer.
- *
- * @return {@code true} if S APIs are available for use, {@code false} otherwise
- * @deprecated Android S is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of this library. Instead, use
- * {@code Build.VERSION.SDK_INT >= 31}.
- */
- @SuppressLint("RestrictedApi")
- @ChecksSdkIntAtLeast(api = 31, codename = "S")
- @Deprecated
- public static boolean isAtLeastS() {
- return VERSION.SDK_INT >= 31
- || (VERSION.SDK_INT >= 30 && isAtLeastPreReleaseCodename("S", VERSION.CODENAME));
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android Sv2 or a release
- * version of Android Sv2 or newer.
- *
- * @return {@code true} if Sv2 APIs are available for use, {@code false} otherwise
- * @deprecated Android Sv2 is a finalized release and this method is no longer necessary. It
- * will be removed in a future release of this library. Instead, use
- * {@code Build.VERSION.SDK_INT >= 32}.
- */
- @PrereleaseSdkCheck
- @ChecksSdkIntAtLeast(api = 32, codename = "Sv2")
- @Deprecated
- public static boolean isAtLeastSv2() {
- return VERSION.SDK_INT >= 32
- || (VERSION.SDK_INT >= 31
- && isAtLeastPreReleaseCodename("Sv2", VERSION.CODENAME));
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android Tiramisu or a release
- * version of Android Tiramisu or newer.
- * <p>
- * <strong>Note:</strong> When Android Tiramisu is finalized for release, this method will be
- * removed and all calls must be replaced with {@code Build.VERSION.SDK_INT >= 33}.
- *
- * @return {@code true} if Tiramisu APIs are available for use, {@code false} otherwise
- * @deprecated Android Tiramisu is a finalized release and this method is no longer necessary.
- * It will be removed in a future release of this library. Instead, use
- * {@code Build.VERSION.SDK_INT >= 33}.
- */
- @PrereleaseSdkCheck
- @ChecksSdkIntAtLeast(api = 33, codename = "Tiramisu")
- @Deprecated
- public static boolean isAtLeastT() {
- return VERSION.SDK_INT >= 33
- || (VERSION.SDK_INT >= 32
- && isAtLeastPreReleaseCodename("Tiramisu", VERSION.CODENAME));
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android UpsideDownCake or a
- * release version of Android UpsideDownCake or newer.
- * <p>
- * <strong>Note:</strong> When Android UpsideDownCake is finalized for release, this method
- * will be removed and all calls must be replaced with {@code Build.VERSION.SDK_INT >= 34}.
- *
- * @return {@code true} if UpsideDownCake APIs are available for use, {@code false} otherwise
- */
- @PrereleaseSdkCheck
- @ChecksSdkIntAtLeast(api = 34, codename = "UpsideDownCake")
- public static boolean isAtLeastU() {
- return VERSION.SDK_INT >= 34
- || (VERSION.SDK_INT >= 33
- && isAtLeastPreReleaseCodename("UpsideDownCake", VERSION.CODENAME));
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android VanillaIceCream.
- * <p>
- * <strong>Note:</strong> When Android anillaIceCream is finalized for release, this method will
- * be removed and all calls must be replaced with {@code Build.VERSION.SDK_INT >=
- * Build.VERSION_CODES.VANILLA_ICE_CREAM}.
- *
- * @return {@code true} if VanillaIceCream APIs are available for use, {@code false} otherwise
- */
- @PrereleaseSdkCheck
- @ChecksSdkIntAtLeast(codename = "VanillaIceCream")
- public static boolean isAtLeastV() {
- return VERSION.SDK_INT >= 34
- && isAtLeastPreReleaseCodename("VanillaIceCream", VERSION.CODENAME);
- }
-
- /**
- * Experimental feature set for pre-release SDK checks.
- * <p>
- * APIs annotated as part of this feature set should only be used when building against
- * pre-release platform SDKs. They are safe to ship in production apps and alpha libraries,
- * but they must not be shipped in beta or later libraries as they <strong>will be
- * removed</strong> after their respective SDKs are finalized for release.
- */
- @RequiresOptIn
- public @interface PrereleaseSdkCheck { }
-
- /**
- * The value of {@code SdkExtensions.getExtensionVersion(R)}. This is a convenience constant
- * which provides the extension version in a similar style to {@code Build.VERSION.SDK_INT}.
- * <p>
- * Compared to calling {@code getExtensionVersion} directly, using this constant has the
- * benefit of not having to verify the {@code getExtensionVersion} method is available.
- *
- * @return the version of the R extension, if it exists. 0 otherwise.
- */
- @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.R)
- @SuppressLint("CompileTimeConstant")
- public static final int R_EXTENSION_INT = VERSION.SDK_INT >= 30 ? Extensions30Impl.R : 0;
-
- /**
- * The value of {@code SdkExtensions.getExtensionVersion(S)}. This is a convenience constant
- * which provides the extension version in a similar style to {@code Build.VERSION.SDK_INT}.
- * <p>
- * Compared to calling {@code getExtensionVersion} directly, using this constant has the
- * benefit of not having to verify the {@code getExtensionVersion} method is available.
- *
- * @return the version of the S extension, if it exists. 0 otherwise.
- */
- @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.S)
- @SuppressLint("CompileTimeConstant")
- public static final int S_EXTENSION_INT = VERSION.SDK_INT >= 30 ? Extensions30Impl.S : 0;
-
- /**
- * The value of {@code SdkExtensions.getExtensionVersion(TIRAMISU)}. This is a convenience
- * constant which provides the extension version in a similar style to
- * {@code Build.VERSION.SDK_INT}.
- * <p>
- * Compared to calling {@code getExtensionVersion} directly, using this constant has the
- * benefit of not having to verify the {@code getExtensionVersion} method is available.
- *
- * @return the version of the T extension, if it exists. 0 otherwise.
- */
- @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.TIRAMISU)
- @SuppressLint("CompileTimeConstant")
- public static final int T_EXTENSION_INT = VERSION.SDK_INT >= 30 ? Extensions30Impl.TIRAMISU : 0;
-
- /**
- * The value of {@code SdkExtensions.getExtensionVersion(AD_SERVICES)}. This is a convenience
- * constant which provides the extension version in a similar style to
- * {@code Build.VERSION.SDK_INT}.
- * <p>
- * Compared to calling {@code getExtensionVersion} directly, using this constant has the
- * benefit of not having to verify the {@code getExtensionVersion} method is available.
- *
- * @return the version of the AdServices extension, if it exists. 0 otherwise.
- */
- @ChecksSdkIntAtLeast(extension = SdkExtensions.AD_SERVICES)
- @SuppressLint("CompileTimeConstant")
- public static final int AD_SERVICES_EXTENSION_INT =
- VERSION.SDK_INT >= 30 ? Extensions30Impl.AD_SERVICES : 0;
-
- @RequiresApi(30)
- private static final class Extensions30Impl {
- static final int R = getExtensionVersion(Build.VERSION_CODES.R);
- static final int S = getExtensionVersion(Build.VERSION_CODES.S);
- static final int TIRAMISU = getExtensionVersion(Build.VERSION_CODES.TIRAMISU);
- static final int AD_SERVICES = getExtensionVersion(SdkExtensions.AD_SERVICES);
- }
-
-}
diff --git a/core/core/src/main/java/androidx/core/os/BuildCompat.kt b/core/core/src/main/java/androidx/core/os/BuildCompat.kt
new file mode 100644
index 0000000..a704a26
--- /dev/null
+++ b/core/core/src/main/java/androidx/core/os/BuildCompat.kt
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.os
+
+import android.os.Build
+import android.os.ext.SdkExtensions
+import androidx.annotation.ChecksSdkIntAtLeast
+import androidx.annotation.DoNotInline
+import androidx.annotation.RequiresApi
+import androidx.annotation.RestrictTo
+import androidx.annotation.VisibleForTesting
+
+/**
+ * This class contains additional platform version checking methods for targeting pre-release
+ * versions of Android.
+ */
+object BuildCompat {
+
+ /**
+ * Checks if the codename is a matching or higher version than the given build value.
+ *
+ * @param codename the requested build codename, e.g. `"O"` or `"OMR1"`
+ * @param buildCodename the value of [Build.VERSION.CODENAME]
+ * @return `true` if APIs from the requested codename are available in the build.
+ */
+ @JvmStatic
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ @VisibleForTesting
+ fun isAtLeastPreReleaseCodename(
+ codename: String,
+ buildCodename: String
+ ): Boolean {
+ // Special case "REL", which means the build is not a pre-release build.
+ if ("REL" == buildCodename) {
+ return false
+ }
+ // Otherwise lexically compare them. Return true if the build codename is equal to or
+ // greater than the requested codename.
+ return buildCodename.uppercase() >= codename.uppercase()
+ }
+
+ /**
+ * Checks if the device is running on the Android N release or newer.
+ *
+ * @return `true` if N APIs are available for use
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N)
+ @Deprecated(
+ message = "Android N is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 24`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 24")
+ )
+ fun isAtLeastN(): Boolean = Build.VERSION.SDK_INT >= 24
+
+ /**
+ * Checks if the device is running on the Android N MR1 release or newer.
+ *
+ * @return `true` if N MR1 APIs are available for use
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N_MR1)
+ @Deprecated(
+ message = "Android N MR1 is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 25`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 25")
+ )
+ fun isAtLeastNMR1(): Boolean = Build.VERSION.SDK_INT >= 25
+
+ /**
+ * Checks if the device is running on a release version of Android O or newer.
+ *
+ * @return `true` if O APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
+ @Deprecated(
+ message = "Android O is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead use " +
+ "`Build.VERSION.SDK_INT >= 26`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 26")
+ )
+ fun isAtLeastO(): Boolean = Build.VERSION.SDK_INT >= 26
+
+ /**
+ * Checks if the device is running on a release version of Android O MR1 or newer.
+ *
+ * @return `true` if O MR1 APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O_MR1)
+ @Deprecated(
+ message = "Android O MR1 is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 27`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 27")
+ )
+ fun isAtLeastOMR1(): Boolean = Build.VERSION.SDK_INT >= 27
+
+ /**
+ * Checks if the device is running on a release version of Android P or newer.
+ *
+ * @return `true` if P APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P)
+ @Deprecated(
+ message = "Android P is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 28`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 28")
+ )
+ fun isAtLeastP(): Boolean = Build.VERSION.SDK_INT >= 28
+
+ /**
+ * Checks if the device is running on release version of Android Q or newer.
+ *
+ * @return `true` if Q APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.Q)
+ @Deprecated(
+ message = "Android Q is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 29`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 29")
+ )
+ fun isAtLeastQ(): Boolean = Build.VERSION.SDK_INT >= 29
+
+ /**
+ * Checks if the device is running on release version of Android R or newer.
+ *
+ * @return `true` if R APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
+ @Deprecated(
+ message = "Android R is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 30`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 30")
+ )
+ fun isAtLeastR(): Boolean = Build.VERSION.SDK_INT >= 30
+
+ /**
+ * Checks if the device is running on a pre-release version of Android S or a release version of
+ * Android S or newer.
+ *
+ * @return `true` if S APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = 31, codename = "S")
+ @Deprecated(
+ message = "Android S is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 31`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 31")
+ )
+ fun isAtLeastS(): Boolean =
+ Build.VERSION.SDK_INT >= 31 || (Build.VERSION.SDK_INT >= 30 && isAtLeastPreReleaseCodename(
+ "S",
+ Build.VERSION.CODENAME
+ ))
+
+ /**
+ * Checks if the device is running on a pre-release version of Android Sv2 or a release
+ * version of Android Sv2 or newer.
+ *
+ * @return `true` if Sv2 APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = 32, codename = "Sv2")
+ @Deprecated(
+ message = "Android Sv2 is a finalized release and this method is no longer necessary. " +
+ "It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 32`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 32")
+ )
+ fun isAtLeastSv2(): Boolean =
+ Build.VERSION.SDK_INT >= 32 || (Build.VERSION.SDK_INT >= 31 && isAtLeastPreReleaseCodename(
+ "Sv2",
+ Build.VERSION.CODENAME
+ ))
+
+ /**
+ * Checks if the device is running on a pre-release version of Android Tiramisu or a release
+ * version of Android Tiramisu or newer.
+ *
+ * **Note:** When Android Tiramisu is finalized for release, this method will be
+ * removed and all calls must be replaced with `Build.VERSION.SDK_INT >= 33`.
+ *
+ * @return `true` if Tiramisu APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = 33, codename = "Tiramisu")
+ @Deprecated(
+ message = "Android Tiramisu is a finalized release and this method is no longer " +
+ "necessary. It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 33`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 33")
+ )
+ fun isAtLeastT(): Boolean =
+ Build.VERSION.SDK_INT >= 33 || (Build.VERSION.SDK_INT >= 32 && isAtLeastPreReleaseCodename(
+ "Tiramisu",
+ Build.VERSION.CODENAME
+ ))
+
+ /**
+ * Checks if the device is running on a pre-release version of Android UpsideDownCake or a
+ * release version of Android UpsideDownCake or newer.
+ *
+ * **Note:** When Android UpsideDownCake is finalized for release, this method
+ * will be removed and all calls must be replaced with `Build.VERSION.SDK_INT >= 34`.
+ *
+ * @return `true` if UpsideDownCake APIs are available for use, `false` otherwise
+ */
+ @JvmStatic
+ @ChecksSdkIntAtLeast(api = 34, codename = "UpsideDownCake")
+ @Deprecated(
+ message = "Android UpsideDownCase is a finalized release and this method is no longer " +
+ "necessary. It will be removed in a future release of this library. Instead, use " +
+ "`Build.VERSION.SDK_INT >= 34`.",
+ ReplaceWith("android.os.Build.VERSION.SDK_INT >= 34")
+ )
+ fun isAtLeastU(): Boolean =
+ Build.VERSION.SDK_INT >= 34 || (Build.VERSION.SDK_INT >= 33 && isAtLeastPreReleaseCodename(
+ "UpsideDownCake",
+ Build.VERSION.CODENAME
+ ))
+
+ /**
+ * Checks if the device is running on a pre-release version of Android VanillaIceCream.
+ *
+ * **Note:** When Android VanillaIceCream is finalized for release, this method will
+ * be removed and all calls must be replaced with `Build.VERSION.SDK_INT >=
+ * Build.VERSION_CODES.VANILLA_ICE_CREAM`.
+ *
+ * @return `true` if VanillaIceCream APIs are available for use, `false` otherwise
+ */
+ @PrereleaseSdkCheck
+ @JvmStatic
+ @ChecksSdkIntAtLeast(codename = "VanillaIceCream")
+ fun isAtLeastV(): Boolean = Build.VERSION.SDK_INT >= 34 && isAtLeastPreReleaseCodename(
+ "VanillaIceCream",
+ Build.VERSION.CODENAME
+ )
+
+ /**
+ * Experimental feature set for pre-release SDK checks.
+ *
+ * Pre-release SDK checks **do not** guarantee correctness, as APIs may have been added or
+ * removed during the course of a pre-release SDK development cycle.
+ *
+ * Additionally, pre-release checks **may not** return `true` when run on a finalized version of
+ * the SDK associated with the codename.
+ */
+ @RequiresOptIn
+ @Retention(AnnotationRetention.BINARY)
+ annotation class PrereleaseSdkCheck
+
+ /**
+ * The value of `SdkExtensions.getExtensionVersion(R)`. This is a convenience constant
+ * which provides the extension version in a similar style to `Build.VERSION.SDK_INT`.
+ *
+ * Compared to calling `getExtensionVersion` directly, using this constant has the
+ * benefit of not having to verify the `getExtensionVersion` method is available.
+ *
+ * @return the version of the R extension, if it exists. 0 otherwise.
+ */
+ @JvmField
+ @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.R)
+ val R_EXTENSION_INT = if (Build.VERSION.SDK_INT >= 30) {
+ Api30Impl.getExtensionVersion(Build.VERSION_CODES.R)
+ } else 0
+
+ /**
+ * The value of `SdkExtensions.getExtensionVersion(S)`. This is a convenience constant
+ * which provides the extension version in a similar style to `Build.VERSION.SDK_INT`.
+ *
+ * Compared to calling `getExtensionVersion` directly, using this constant has the
+ * benefit of not having to verify the `getExtensionVersion` method is available.
+ *
+ * @return the version of the S extension, if it exists. 0 otherwise.
+ */
+ @JvmField
+ @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.S)
+ val S_EXTENSION_INT = if (Build.VERSION.SDK_INT >= 30) {
+ Api30Impl.getExtensionVersion(Build.VERSION_CODES.S)
+ } else 0
+
+ /**
+ * The value of `SdkExtensions.getExtensionVersion(TIRAMISU)`. This is a convenience
+ * constant which provides the extension version in a similar style to
+ * `Build.VERSION.SDK_INT`.
+ *
+ * Compared to calling `getExtensionVersion` directly, using this constant has the
+ * benefit of not having to verify the `getExtensionVersion` method is available.
+ *
+ * @return the version of the T extension, if it exists. 0 otherwise.
+ */
+ @JvmField
+ @ChecksSdkIntAtLeast(extension = Build.VERSION_CODES.TIRAMISU)
+ val T_EXTENSION_INT = if (Build.VERSION.SDK_INT >= 30) {
+ Api30Impl.getExtensionVersion(Build.VERSION_CODES.TIRAMISU)
+ } else 0
+
+ /**
+ * The value of `SdkExtensions.getExtensionVersion(AD_SERVICES)`. This is a convenience
+ * constant which provides the extension version in a similar style to
+ * `Build.VERSION.SDK_INT`.
+ *
+ * Compared to calling `getExtensionVersion` directly, using this constant has the
+ * benefit of not having to verify the `getExtensionVersion` method is available.
+ *
+ * @return the version of the AdServices extension, if it exists. 0 otherwise.
+ */
+ @JvmField
+ @ChecksSdkIntAtLeast(extension = SdkExtensions.AD_SERVICES)
+ val AD_SERVICES_EXTENSION_INT = if (Build.VERSION.SDK_INT >= 30) {
+ Api30Impl.getExtensionVersion(SdkExtensions.AD_SERVICES)
+ } else 0
+
+ @RequiresApi(30)
+ private object Api30Impl {
+
+ @DoNotInline
+ fun getExtensionVersion(extension: Int): Int {
+ return SdkExtensions.getExtensionVersion(extension)
+ }
+ }
+}
diff --git a/core/core/src/main/java/androidx/core/os/BundleCompat.java b/core/core/src/main/java/androidx/core/os/BundleCompat.java
index 1c1d0f2..94555cf 100644
--- a/core/core/src/main/java/androidx/core/os/BundleCompat.java
+++ b/core/core/src/main/java/androidx/core/os/BundleCompat.java
@@ -55,8 +55,7 @@
* <p>
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and above, this method matches platform behavior.
* <li>SDK 33 and below, the object type is checked after deserialization.
* </ul>
*
@@ -70,7 +69,8 @@
@SuppressWarnings({"deprecation", "unchecked"})
public static <T> T getParcelable(@NonNull Bundle in, @Nullable String key,
@NonNull Class<T> clazz) {
- if (Build.VERSION.SDK_INT >= 33) {
+ // Even though API was introduced in 33, we use 34 as 33 is bugged in some scenarios.
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelable(in, key, clazz);
} else {
T parcelable = in.getParcelable(key);
@@ -92,8 +92,7 @@
* <p>
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and above, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -107,7 +106,8 @@
@SuppressLint({"ArrayReturn", "NullableCollection"})
public static Parcelable[] getParcelableArray(@NonNull Bundle in, @Nullable String key,
@NonNull Class<? extends Parcelable> clazz) {
- if (Build.VERSION.SDK_INT >= 33) {
+ // Even though API was introduced in 33, we use 34 as 33 is bugged in some scenarios.
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableArray(in, key, clazz);
} else {
return in.getParcelableArray(key);
@@ -128,8 +128,7 @@
* <p>
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and above, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the list elements' types.
* </ul>
*
@@ -144,7 +143,8 @@
@SuppressLint({"ConcreteCollection", "NullableCollection"})
public static <T> ArrayList<T> getParcelableArrayList(@NonNull Bundle in, @Nullable String key,
@NonNull Class<? extends T> clazz) {
- if (Build.VERSION.SDK_INT >= 33) {
+ // Even though API was introduced in 33, we use 34 as 33 is bugged in some scenarios.
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableArrayList(in, key, clazz);
} else {
return (ArrayList<T>) in.getParcelableArrayList(key);
@@ -161,8 +161,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and above, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -176,7 +175,7 @@
@Nullable
public static <T> SparseArray<T> getSparseParcelableArray(@NonNull Bundle in,
@Nullable String key, @NonNull Class<? extends T> clazz) {
- if (Build.VERSION.SDK_INT >= 33) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getSparseParcelableArray(in, key, clazz);
} else {
return (SparseArray<T>) in.getSparseParcelableArray(key);
diff --git a/core/core/src/main/java/androidx/core/os/LocaleListCompat.java b/core/core/src/main/java/androidx/core/os/LocaleListCompat.java
index 7409305..f742a7e9 100644
--- a/core/core/src/main/java/androidx/core/os/LocaleListCompat.java
+++ b/core/core/src/main/java/androidx/core/os/LocaleListCompat.java
@@ -23,7 +23,6 @@
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.Size;
import androidx.core.text.ICUCompat;
@@ -246,10 +245,9 @@
* @return True if they match, false otherwise.
*/
@RequiresApi(21)
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public static boolean matchesLanguageAndScript(@NonNull Locale supported,
@NonNull Locale desired) {
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return LocaleList.matchesLanguageAndScript(supported, desired);
} else if (Build.VERSION.SDK_INT >= 21) {
return Api21Impl.matchesLanguageAndScript(supported, desired);
diff --git a/core/core/src/main/java/androidx/core/os/ParcelCompat.java b/core/core/src/main/java/androidx/core/os/ParcelCompat.java
index 4eb07c4..cc52e51 100644
--- a/core/core/src/main/java/androidx/core/os/ParcelCompat.java
+++ b/core/core/src/main/java/androidx/core/os/ParcelCompat.java
@@ -26,7 +26,6 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import java.io.Serializable;
@@ -65,8 +64,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the list elements' types.
* </ul>
*
@@ -74,11 +72,10 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings("deprecation")
public static <T> void readList(@NonNull Parcel in, @NonNull List<? super T> outVal,
@Nullable ClassLoader loader, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api33Impl.readList(in, outVal, loader, clazz);
} else {
in.readList(outVal, loader);
@@ -91,8 +88,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the list elements' types.
* </ul>
*
@@ -100,13 +96,12 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressLint({"ConcreteCollection", "NullableCollection"})
@SuppressWarnings({"deprecation", "unchecked"})
@Nullable
public static <T> ArrayList<T> readArrayList(@NonNull Parcel in, @Nullable ClassLoader loader,
@NonNull Class<? extends T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readArrayList(in, loader, clazz);
} else {
return in.readArrayList(loader);
@@ -119,8 +114,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -128,13 +122,12 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
@SuppressLint({"ArrayReturn", "NullableCollection"})
@Nullable
public static <T> Object[] readArray(@NonNull Parcel in, @Nullable ClassLoader loader,
@NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readArray(in, loader, clazz);
} else {
return in.readArray(loader);
@@ -147,8 +140,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -156,12 +148,11 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings("deprecation")
@Nullable
public static <T> SparseArray<T> readSparseArray(@NonNull Parcel in,
@Nullable ClassLoader loader, @NonNull Class<? extends T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readSparseArray(in, loader, clazz);
} else {
return in.readSparseArray(loader);
@@ -174,20 +165,18 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the map entries' types.
* </ul>
*
* @throws android.os.BadParcelableException If the item to be deserialized is not an
* instance of that class or any of its children class.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings("deprecation")
public static <K, V> void readMap(@NonNull Parcel in, @NonNull Map<? super K, ? super V> outVal,
@Nullable ClassLoader loader, @NonNull Class<K> clazzKey,
@NonNull Class<V> clazzValue) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api33Impl.readMap(in, outVal, loader, clazzKey, clazzValue);
} else {
in.readMap(outVal, loader);
@@ -200,21 +189,19 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the map entries' types.
* </ul>
*
* @throws android.os.BadParcelableException if the item to be deserialized is not an
* instance of that class or any of its children class.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressLint({"ConcreteCollection", "NullableCollection"})
@SuppressWarnings({"deprecation", "unchecked"})
@Nullable
public static <K, V> HashMap<K, V> readHashMap(@NonNull Parcel in, @Nullable ClassLoader loader,
@NonNull Class<? extends K> clazzKey, @NonNull Class<? extends V> clazzValue) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readHashMap(in, loader, clazzKey, clazzValue);
} else {
return in.readHashMap(loader);
@@ -227,8 +214,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, the object type is checked after deserialization.
* </ul>
*
@@ -236,12 +222,11 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings("deprecation")
@Nullable
public static <T extends Parcelable> T readParcelable(@NonNull Parcel in,
@Nullable ClassLoader loader, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readParcelable(in, loader, clazz);
} else {
T parcelable = in.readParcelable(loader);
@@ -260,8 +245,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the creator's type.
* </ul>
*
@@ -269,13 +253,12 @@
* deserialized is not an instance of that class or any of its children classes or there
* there was an error trying to read the {@link Parcelable.Creator}.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
@Nullable
@RequiresApi(30)
public static <T> Parcelable.Creator<T> readParcelableCreator(@NonNull Parcel in,
@Nullable ClassLoader loader, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readParcelableCreator(in, loader, clazz);
} else {
return (Parcelable.Creator<T>) Api30Impl.readParcelableCreator(in, loader);
@@ -288,8 +271,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -300,14 +282,13 @@
* @deprecated This method incurs a performance penalty on SDK 33 and below. Use
* {@link #readParcelableArrayTyped} instead.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
@SuppressLint({"ArrayReturn", "NullableCollection"})
@Nullable
@Deprecated
public static <T> T[] readParcelableArray(@NonNull Parcel in, @Nullable ClassLoader loader,
@NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readParcelableArray(in, loader, clazz);
} else {
// The array type is always Parcelable[]. Cast to clazz[] for compatibility if needed.
@@ -337,8 +318,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the array elements' types.
* </ul>
*
@@ -346,13 +326,12 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation"})
@SuppressLint({"ArrayReturn", "NullableCollection"})
@Nullable
public static <T> Parcelable[] readParcelableArrayTyped(@NonNull Parcel in,
@Nullable ClassLoader loader, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return (Parcelable[]) Api33Impl.readParcelableArray(in, loader, clazz);
} else {
return in.readParcelableArray(loader);
@@ -365,8 +344,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>{@link BuildCompat#isAtLeastU() Android U and later}, this method matches platform
- * behavior.
+ * <li>SDK 34 and later, this method matches platform behavior.
* <li>SDK 33 and below, this method will not check the list elements' types.
* </ul>
*
@@ -374,13 +352,12 @@
* deserialized is not an instance of that class or any of its children classes or there was
* an error trying to instantiate an element.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@NonNull
@SuppressWarnings({"deprecation", "unchecked"})
@RequiresApi(api = Build.VERSION_CODES.Q)
public static <T> List<T> readParcelableList(@NonNull Parcel in, @NonNull List<T> list,
@Nullable ClassLoader cl, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.readParcelableList(in, list, cl, clazz);
} else {
return Api29Impl.readParcelableList(in, (List) list, cl);
@@ -394,8 +371,7 @@
*
* Compatibility behavior:
* <ul>
- * <li>SDK 33 and later, this method matches platform
- * behavior.
+ * <li>SDK 33 and later, this method matches platform behavior.
* <li>SDK 32 and below, this method will not check the item's type.
* </ul>
*
@@ -403,12 +379,11 @@
* deserialized is not an instance of that class or any of its children class or there there
* was an error deserializing the object.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"deprecation", "unchecked"})
@Nullable
public static <T extends Serializable> T readSerializable(@NonNull Parcel in,
@Nullable ClassLoader loader, @NonNull Class<T> clazz) {
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.readSerializable(in, loader, clazz);
} else {
return (T) in.readSerializable();
diff --git a/core/core/src/main/java/androidx/core/provider/FontsContractCompat.java b/core/core/src/main/java/androidx/core/provider/FontsContractCompat.java
index 7d60696..4b40136 100644
--- a/core/core/src/main/java/androidx/core/provider/FontsContractCompat.java
+++ b/core/core/src/main/java/androidx/core/provider/FontsContractCompat.java
@@ -377,7 +377,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
// TODO after removing from public API make package private.
@Deprecated
@RestrictTo(LIBRARY_GROUP_PREFIX)
@@ -508,7 +508,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
@Deprecated // unused
@RestrictTo(LIBRARY_GROUP_PREFIX)
static final int RESULT_CODE_PROVIDER_NOT_FOUND = -1;
@@ -516,7 +516,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
@Deprecated // unused
@RestrictTo(LIBRARY_GROUP_PREFIX)
static final int RESULT_CODE_WRONG_CERTIFICATES = -2;
@@ -525,7 +525,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
@Deprecated // unused
@RestrictTo(LIBRARY_GROUP_PREFIX)
public static Typeface getFontSync(
@@ -547,7 +547,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
@Deprecated // unused
@RestrictTo(LIBRARY_GROUP_PREFIX)
public static void resetCache() {
@@ -582,7 +582,7 @@
/**
* @deprecated Not being used by any cross library, and should not be used, internal
* implementation detail.
- **/
+ */
@Deprecated // unused
@VisibleForTesting
@RestrictTo(LIBRARY_GROUP_PREFIX)
diff --git a/core/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java b/core/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
index af9dd42..a2c07c3 100644
--- a/core/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
+++ b/core/core/src/main/java/androidx/core/text/PrecomputedTextCompat.java
@@ -56,7 +56,7 @@
* A text object that contains the character metrics data and can be used to improve the performance
* of text layout operations. When a PrecomputedTextCompat is created with a given
* {@link CharSequence}, it will measure the text metrics during the creation. This PrecomputedText
- * instance can be set on {@linkandroid.widget.TextView} or {@link StaticLayout}. Since the text
+ * instance can be set on {@link android.widget.TextView} or {@link StaticLayout}. Since the text
* layout information will be included in this instance, {@link android.widget.TextView} or
* {@link StaticLayout} will not have to recalculate this information.
*
diff --git a/core/core/src/main/java/androidx/core/text/util/LocalePreferences.java b/core/core/src/main/java/androidx/core/text/util/LocalePreferences.java
index 81f847e..a30c03a 100644
--- a/core/core/src/main/java/androidx/core/text/util/LocalePreferences.java
+++ b/core/core/src/main/java/androidx/core/text/util/LocalePreferences.java
@@ -26,11 +26,9 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.StringDef;
-import androidx.core.os.BuildCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -84,7 +82,6 @@
* {@see HourCycle}, e.g. {@code HourCycle#H11}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@HourCycle.HourCycleTypes
public static String getHourCycle() {
return getHourCycle(true);
@@ -96,7 +93,6 @@
* {@see HourCycle}, e.g. {@code HourCycle#H11}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@HourCycle.HourCycleTypes
public static String getHourCycle(@NonNull Locale locale) {
return getHourCycle(locale, true);
@@ -119,7 +115,6 @@
* {@code HourCycle#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@HourCycle.HourCycleTypes
public static String getHourCycle(
boolean resolved) {
@@ -144,7 +139,6 @@
* {@code HourCycle#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@HourCycle.HourCycleTypes
public static String getHourCycle(@NonNull Locale locale, boolean resolved) {
String result = getUnicodeLocaleType(HourCycle.U_EXTENSION_TAG,
@@ -152,7 +146,7 @@
if (result != null) {
return result;
}
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.getHourCycle(locale);
} else {
return getBaseHourCycle(locale);
@@ -217,7 +211,6 @@
* {@see CalendarType}, e.g. {@code CalendarType#CHINESE}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@CalendarType.CalendarTypes
public static String getCalendarType() {
return getCalendarType(true);
@@ -229,7 +222,6 @@
* {@see CalendarType}, e.g. {@code CalendarType#CHINESE}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@CalendarType.CalendarTypes
public static String getCalendarType(@NonNull Locale locale) {
return getCalendarType(locale, true);
@@ -253,7 +245,6 @@
* empty string, i.e. {@code CalendarType#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@CalendarType.CalendarTypes
public static String getCalendarType(boolean resolved) {
Locale defaultLocale = (Build.VERSION.SDK_INT >= VERSION_CODES.N)
@@ -277,7 +268,6 @@
* empty string, i.e. {@code CalendarType#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@CalendarType.CalendarTypes
public static String getCalendarType(@NonNull Locale locale, boolean resolved) {
String result = getUnicodeLocaleType(CalendarType.U_EXTENSION_TAG,
@@ -326,7 +316,6 @@
* {@see TemperatureUnit}, e.g. {@code TemperatureUnit#FAHRENHEIT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@TemperatureUnit.TemperatureUnits
public static String getTemperatureUnit() {
return getTemperatureUnit(true);
@@ -337,7 +326,6 @@
* defined in {@see TemperatureUnit}, e.g. {@code TemperatureUnit#FAHRENHEIT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@TemperatureUnit.TemperatureUnits
public static String getTemperatureUnit(
@NonNull Locale locale) {
@@ -362,7 +350,6 @@
* empty string, i.e. {@code TemperatureUnit#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@TemperatureUnit.TemperatureUnits
public static String getTemperatureUnit(boolean resolved) {
Locale defaultLocale = (Build.VERSION.SDK_INT >= VERSION_CODES.N)
@@ -387,7 +374,6 @@
* empty string, i.e. {@code TemperatureUnit#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@TemperatureUnit.TemperatureUnits
public static String getTemperatureUnit(@NonNull Locale locale, boolean resolved) {
String result = getUnicodeLocaleType(TemperatureUnit.U_EXTENSION_TAG,
@@ -395,7 +381,7 @@
if (result != null) {
return result;
}
- if (BuildCompat.isAtLeastT()) {
+ if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.getResolvedTemperatureUnit(locale);
} else {
return getTemperatureHardCoded(locale);
@@ -448,7 +434,6 @@
* {@see FirstDayOfWeek}, e.g. {@code FirstDayOfWeek#SUNDAY}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@FirstDayOfWeek.Days
public static String getFirstDayOfWeek() {
return getFirstDayOfWeek(true);
@@ -460,7 +445,6 @@
* {@see FirstDayOfWeek}, e.g. {@code FirstDayOfWeek#SUNDAY}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@FirstDayOfWeek.Days
public static String getFirstDayOfWeek(@NonNull Locale locale) {
return getFirstDayOfWeek(locale, true);
@@ -484,7 +468,6 @@
* i.e. {@code FirstDayOfWeek#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@FirstDayOfWeek.Days
public static String getFirstDayOfWeek(boolean resolved) {
Locale defaultLocale = (Build.VERSION.SDK_INT >= VERSION_CODES.N)
@@ -510,7 +493,6 @@
* empty string, i.e. {@code FirstDayOfWeek#DEFAULT}.
*/
@NonNull
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@FirstDayOfWeek.Days
public static String getFirstDayOfWeek(
@NonNull Locale locale, boolean resolved) {
diff --git a/core/core/src/main/java/androidx/core/view/ViewCompat.java b/core/core/src/main/java/androidx/core/view/ViewCompat.java
index 9ca0a09..5fa5a59 100644
--- a/core/core/src/main/java/androidx/core/view/ViewCompat.java
+++ b/core/core/src/main/java/androidx/core/view/ViewCompat.java
@@ -56,6 +56,7 @@
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityRecord;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeProvider;
import android.view.autofill.AutofillId;
@@ -635,9 +636,12 @@
/**
* Called from {@link View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)}
* giving a chance to this View to populate the accessibility event with its
- * text content. While this method is free to modify event
- * attributes other than text content, doing so should normally be performed in
- * {@link View#onInitializeAccessibilityEvent(AccessibilityEvent)}.
+ * text content.
+ * <p>
+ * <b>Note:</b> This method should only be used with {@link AccessibilityRecord#getText()}.
+ * Avoid mutating other event state in this method. Instead, follow the practices described in
+ * {@link #dispatchPopulateAccessibilityEvent(AccessibilityEvent)}. In general, put UI
+ * metadata in the node for services to easily query, than in events.
* <p>
* Example: Adding formatted date string to an accessibility event in addition
* to the text added by the super implementation:
@@ -1472,6 +1476,11 @@
* {@link AccessibilityDelegateCompat#performAccessibilityAction(View, int, Bundle)}
* is responsible for handling this call.
* </p>
+ * <p>
+ * <b>Note:</b> Avoid setting accessibility focus with
+ * {@link AccessibilityNodeInfoCompat.AccessibilityActionCompat#ACTION_ACCESSIBILITY_FOCUS}.
+ * This is intended to be controlled by screen readers. Apps changing focus can confuse
+ * screen readers, and the resulting behavior can vary by device and screen reader version.
*
* @param action The action to perform.
* @param arguments Optional action arguments.
@@ -1703,10 +1712,22 @@
* {@link android.accessibilityservice.AccessibilityService}.
* This class is made immutable before being delivered to an AccessibilityService.
* </p>
+ * <p>
+ * State refers to a frequently changing property of the View, such as an enabled/disabled
+ * state of a button or the audio level of a volume slider.
+ *
+ * <p>
+ * This should omit role or content. Role refers to the kind of user-interface element the
+ * View is, such as a Button or Checkbox. Content is the meaningful text and graphics that
+ * should be described by {@link View#setContentDescription(CharSequence)} or
+ * {@code android:contentDescription}. It is expected that a content description mostly
+ * remains constant, while a state description updates from time to time.
*
* @param stateDescription the state description of this node.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ * @see View#setStateDescription(CharSequence)
+ * @see View#setContentDescription(CharSequence)
*/
@UiThread
public static void setStateDescription(@NonNull View view,
@@ -1737,6 +1758,20 @@
/**
* Allow accessibility services to find and activate clickable spans in the application.
*
+ * <p>
+ * {@link android.text.style.ClickableSpan} is automatically supported from
+ * API 26. For compatibility back to API 19, this should be enabled.
+ * <p>
+ * {@link android.text.style.URLSpan}, a subclass of ClickableSpans, is
+ * automatically supported and does not need this enabled.
+ * <p>
+ * Do not put ClickableSpans in {@link View#setContentDescription(CharSequence)} or
+ * {@link View#setStateDescription(CharSequence)}.
+ * These links are only visible to accessibility services in
+ * {@link AccessibilityNodeInfoCompat#getText()}, which should be
+ * modifiable using helper methods on UI elements. For example, use
+ * {@link android.widget.TextView#setText(CharSequence)} to modify the text of TextViews.
+ *
* @param view The view
* <p>
* Compatibility:
@@ -2129,24 +2164,36 @@
}
/**
- * Sets the live region mode for the specified view. This indicates to
- * accessibility services whether they should automatically notify the user
- * about changes to the view's content description or text, or to the
- * content descriptions or text of the view's children (where applicable).
+ * Sets the live region mode for this view. This indicates to accessibility
+ * services whether they should automatically notify the user about changes
+ * to the view's content description or text, or to the content descriptions
+ * or text of the view's children (where applicable).
* <p>
- * For example, in a login screen with a TextView that displays an "incorrect
- * password" notification, that view should be marked as a live region with
- * mode {@link #ACCESSIBILITY_LIVE_REGION_POLITE}.
+ * To indicate that the user should be notified of changes, use
+ * {@link #ACCESSIBILITY_LIVE_REGION_POLITE}. Announcements from this region are queued and
+ * do not disrupt ongoing speech.
+ * <p>
+ * For example, selecting an option in a dropdown menu may update a panel below with the updated
+ * content. This panel may be marked as a live region with
+ * {@link #ACCESSIBILITY_LIVE_REGION_POLITE} to notify users of the change.
+ * <p>
+ * For notifying users about errors, such as in a login screen with text that displays an
+ * "incorrect password" notification, that view should send an AccessibilityEvent of type
+ * {@link AccessibilityEvent#CONTENT_CHANGE_TYPE_ERROR} and set
+ * {@link AccessibilityNodeInfo#setError(CharSequence)} instead. Custom widgets should expose
+ * error-setting methods that support accessibility automatically. For example, instead of
+ * explicitly sending this event when using a TextView, use
+ * {@link android.widget.TextView#setError(CharSequence)}.
* <p>
* To disable change notifications for this view, use
* {@link #ACCESSIBILITY_LIVE_REGION_NONE}. This is the default live region
* mode for most views.
* <p>
- * To indicate that the user should be notified of changes, use
- * {@link #ACCESSIBILITY_LIVE_REGION_POLITE}.
- * <p>
* If the view's changes should interrupt ongoing speech and notify the user
- * immediately, use {@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE}.
+ * immediately, use {@link #ACCESSIBILITY_LIVE_REGION_ASSERTIVE}. This may result in disruptive
+ * announcements from an accessibility service, so it should generally be used only to convey
+ * information that is time-sensitive or critical for use of the application. Examples may
+ * include an incoming call or an emergency alert.
*
* @param view The view on which to set the live region mode
* @param mode The live region mode for this view, one of:
@@ -4519,6 +4566,10 @@
* <p>
* Note: this is similar to using <a href="#attr_android:focusable">{@code android:focusable},
* but does not impact input focus behavior.
+ * <p>This can be used to
+ * <a href="{@docRoot}guide/topics/ui/accessibility/principles#content-groups">group related
+ * content.</a>
+ * </p>
*
* @param view The view whose title should be set
* @param screenReaderFocusable Whether the view should be treated as a unit by screen reader
@@ -4579,11 +4630,20 @@
/**
* Visually distinct portion of a window with window-like semantics are considered panes for
- * accessibility purposes. One example is the content view of a fragment that is replaced.
+ * accessibility purposes. One example is the content view of a large fragment that is replaced.
* In order for accessibility services to understand a pane's window-like behavior, panes
- * should have descriptive titles. Views with pane titles produce {@link AccessibilityEvent}s
- * when they appear, disappear, or change title.
+ * should have descriptive titles. Views with pane titles produce
+ * {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED}s when they appear, disappear, or change
+ * title.
*
+ * <p>
+ * When transitioning from one Activity to another, instead of using
+ * setAccessibilityPaneTitle(), set a descriptive title for your activity's window by using
+ * {@code android:label} for the matching <activity> entry in your application’s manifest or
+ * updating the title at runtime with {@link android.app.Activity#setTitle(CharSequence)}.
+ *
+ * <p>
+ * To set the pane title in xml, use {@code android:accessibilityPaneTitle}.
* @param view The view whose pane title should be set.
* @param accessibilityPaneTitle The pane's title. Setting to {@code null} indicates that this
* View is not a pane.
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityEventCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityEventCompat.java
index 957d459..449a592 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityEventCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityEventCompat.java
@@ -120,11 +120,13 @@
/**
* Represents the event of gaining accessibility focus.
+ * @see AccessibilityNodeInfoCompat.AccessibilityActionCompat#ACTION_ACCESSIBILITY_FOCUS
*/
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 0x00008000;
/**
* Represents the event of clearing accessibility focus.
+ * @see AccessibilityNodeInfoCompat.AccessibilityActionCompat#ACTION_CLEAR_ACCESSIBILITY_FOCUS
*/
public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 0x00010000;
@@ -200,6 +202,7 @@
/**
* Change type for {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} event:
* The node's pane title changed.
+ * @see androidx.core.view.ViewCompat#setAccessibilityPaneTitle(View, CharSequence)
*/
public static final int CONTENT_CHANGE_TYPE_PANE_TITLE = 0x00000008;
@@ -207,6 +210,7 @@
* Change type for {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} event:
* The node has a pane title, and either just appeared or just was assigned a title when it
* had none before.
+ * @see androidx.core.view.ViewCompat#setAccessibilityPaneTitle(View, CharSequence)
*/
public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED = 0x00000010;
@@ -218,6 +222,7 @@
* No source will be returned if the node is no longer on the screen. To make the change more
* clear for the user, the first entry in {@link AccessibilityRecord#getText()} can return the
* value that would have been returned by {@code getSource().getPaneTitle()}.
+ * @see androidx.core.view.ViewCompat#setAccessibilityPaneTitle(View, CharSequence)
*/
public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED = 0x00000020;
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
index 6e63749..50bd76d5 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
@@ -37,6 +37,7 @@
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo;
@@ -49,7 +50,6 @@
import androidx.annotation.RestrictTo;
import androidx.core.R;
import androidx.core.accessibilityservice.AccessibilityServiceInfoCompat;
-import androidx.core.os.BuildCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityViewCommand.CommandArguments;
import androidx.core.view.accessibility.AccessibilityViewCommand.MoveAtGranularityArguments;
@@ -96,8 +96,8 @@
* </p>
* <p class="note">
* <strong>Note:</strong> Views which support these actions should invoke
- * {@link View#setImportantForAccessibility(int)} with
- * {@link View#IMPORTANT_FOR_ACCESSIBILITY_YES} to ensure an
+ * {@link ViewCompat#setImportantForAccessibility(View, int)} with
+ * {@link ViewCompat#IMPORTANT_FOR_ACCESSIBILITY_YES} to ensure an
* {@link android.accessibilityservice.AccessibilityService} can discover the set of supported
* actions.
* </p>
@@ -108,12 +108,22 @@
/**
* Action that gives input focus to the node.
+ * <p>The focus request sends an event of {@link AccessibilityEvent#TYPE_VIEW_FOCUSED}
+ * if successful. In the View system, this is handled by {@link View#requestFocus}.
+ *
+ * <p>The node that is focused should return {@code true} for
+ * {@link AccessibilityNodeInfoCompat#isFocused()}.
+ *
+ * @see #ACTION_ACCESSIBILITY_FOCUS for the difference between system focus and
+ * accessibility focus.
*/
public static final AccessibilityActionCompat ACTION_FOCUS =
new AccessibilityActionCompat(AccessibilityNodeInfoCompat.ACTION_FOCUS, null);
/**
* Action that clears input focus of the node.
+ * <p>The node that is cleared should return {@code false} for
+ * {@link AccessibilityNodeInfoCompat#isFocused()}.
*/
public static final AccessibilityActionCompat ACTION_CLEAR_FOCUS =
new AccessibilityActionCompat(
@@ -135,12 +145,29 @@
/**
* Action that clicks on the node info.
+ *
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_CLICKED} event. In the View system,
+ * the default handling of this action when performed by a service is to call
+ * {@link View#performClick()}, and setting a
+ * {@link View#setOnClickListener(View.OnClickListener)} automatically adds this action.
+ *
+ * <p>{@link #isClickable()} should return true if this action is available.
*/
public static final AccessibilityActionCompat ACTION_CLICK =
new AccessibilityActionCompat(AccessibilityNodeInfoCompat.ACTION_CLICK, null);
/**
* Action that long clicks on the node.
+ *
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_LONG_CLICKED} event. In the View system,
+ * the default handling of this action when performed by a service is to call
+ * {@link View#performLongClick()}, and setting a
+ * {@link View#setOnLongClickListener(View.OnLongClickListener)} automatically adds this
+ * action.
+ *
+ * <p>{@link #isLongClickable()} should return true if this action is available.
*/
public static final AccessibilityActionCompat ACTION_LONG_CLICK =
new AccessibilityActionCompat(
@@ -148,6 +175,16 @@
/**
* Action that gives accessibility focus to the node.
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_ACCESSIBILITY_FOCUSED} event
+ * if successful. The node that is focused should return {@code true} for
+ * {@link AccessibilityNodeInfoCompat#isAccessibilityFocused()}.
+ *
+ * <p>This is intended to be used by screen readers to assist with user navigation. Apps
+ * changing focus can confuse screen readers, so the resulting behavior can vary by device
+ * and screen reader version.
+ * <p>This is distinct from {@link #ACTION_FOCUS}, which refers to system focus. System
+ * focus is typically used to convey targets for keyboard navigation.
*/
public static final AccessibilityActionCompat ACTION_ACCESSIBILITY_FOCUS =
new AccessibilityActionCompat(
@@ -155,6 +192,10 @@
/**
* Action that clears accessibility focus of the node.
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED} event if successful. The
+ * node that is cleared should return {@code false} for
+ * {@link AccessibilityNodeInfoCompat#isAccessibilityFocused()}.
*/
public static final AccessibilityActionCompat ACTION_CLEAR_ACCESSIBILITY_FOCUS =
new AccessibilityActionCompat(
@@ -352,6 +393,11 @@
* </code></pre></p>
* </p>
*
+ * <p> If this is a text selection, the UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED} event if its selection is
+ * updated. This element should also return {@code true} for
+ * {@link AccessibilityNodeInfoCompat#isTextSelectable()}.
+ *
* @see AccessibilityNodeInfoCompat#ACTION_ARGUMENT_SELECTION_START_INT
* AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SELECTION_START_INT
* @see AccessibilityNodeInfoCompat#ACTION_ARGUMENT_SELECTION_END_INT
@@ -398,6 +444,10 @@
* "android");
* info.performAction(AccessibilityActionCompat.ACTION_SET_TEXT.getId(), arguments);
* </code></pre></p>
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} event if its text is updated.
+ * This element should also return {@code true} for
+ * {@link AccessibilityNodeInfoCompat#isEditable()}.
*/
public static final AccessibilityActionCompat ACTION_SET_TEXT =
new AccessibilityActionCompat(AccessibilityNodeInfoCompat.ACTION_SET_TEXT, null,
@@ -501,6 +551,18 @@
/**
* Action that context clicks the node.
+ *
+ * <p>The UI element that implements this should send a
+ * {@link AccessibilityEvent#TYPE_VIEW_CONTEXT_CLICKED} event. In the View system,
+ * the default handling of this action when performed by a service is to call
+ * {@link View#performContextClick()}, and setting a
+ * {@link View#setOnContextClickListener(View.OnContextClickListener)} automatically adds
+ * this action.
+ *
+ * <p>A context click usually occurs from a mouse pointer right-click or a stylus button
+ * press.
+ *
+ * <p>{@link #isContextClickable()} should return true if this action is available.
*/
public static final AccessibilityActionCompat ACTION_CONTEXT_CLICK =
new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 23
@@ -680,13 +742,10 @@
@NonNull
@OptIn(markerClass = androidx.core.os.BuildCompat.PrereleaseSdkCheck.class)
public static final AccessibilityActionCompat ACTION_SCROLL_IN_DIRECTION =
- new AccessibilityActionCompat(BuildCompat.isAtLeastU()
+ new AccessibilityActionCompat(Build.VERSION.SDK_INT >= 34
? AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_IN_DIRECTION
- : null,
- // TODO (267511848): update ID value once U resources are finalized.
- BuildCompat.isAtLeastU()
- ? android.R.id.accessibilityActionScrollInDirection : -1,
- null, null, null);
+ : null, android.R.id.accessibilityActionScrollInDirection, null, null,
+ null);
final Object mAction;
private final int mId;
@@ -1397,6 +1456,7 @@
private static final int BOOLEAN_PROPERTY_IS_SHOWING_HINT = 0x00000004;
private static final int BOOLEAN_PROPERTY_IS_TEXT_ENTRY_KEY = 0x00000008;
private static final int BOOLEAN_PROPERTY_HAS_REQUEST_INITIAL_ACCESSIBILITY_FOCUS = 1 << 5;
+ private static final int BOOLEAN_PROPERTY_TEXT_SELECTABLE = 1 << 23;
private static final int BOOLEAN_PROPERTY_SUPPORTS_GRANULAR_SCROLLING = 1 << 26;
private final AccessibilityNodeInfo mInfo;
@@ -1413,31 +1473,37 @@
/**
* Action that focuses the node.
+ * @see AccessibilityActionCompat#ACTION_FOCUS
*/
public static final int ACTION_FOCUS = 0x00000001;
/**
* Action that unfocuses the node.
+ * @see AccessibilityActionCompat#ACTION_CLEAR_FOCUS
*/
public static final int ACTION_CLEAR_FOCUS = 0x00000002;
/**
* Action that selects the node.
+ * @see AccessibilityActionCompat#ACTION_SELECT
*/
public static final int ACTION_SELECT = 0x00000004;
/**
* Action that unselects the node.
+ * @see AccessibilityActionCompat#ACTION_CLEAR_SELECTION
*/
public static final int ACTION_CLEAR_SELECTION = 0x00000008;
/**
* Action that clicks on the node info.
+ * @see AccessibilityActionCompat#ACTION_CLICK
*/
public static final int ACTION_CLICK = 0x00000010;
/**
* Action that long clicks on the node.
+ * @see AccessibilityActionCompat#ACTION_LONG_CLICK
*/
public static final int ACTION_LONG_CLICK = 0x00000020;
@@ -1445,6 +1511,7 @@
/**
* Action that gives accessibility focus to the node.
+ * @see AccessibilityActionCompat#ACTION_ACCESSIBILITY_FOCUS
*/
public static final int ACTION_ACCESSIBILITY_FOCUS = 0x00000040;
@@ -1482,6 +1549,7 @@
* @see #MOVEMENT_GRANULARITY_LINE
* @see #MOVEMENT_GRANULARITY_PARAGRAPH
* @see #MOVEMENT_GRANULARITY_PAGE
+ * @see AccessibilityActionCompat#ACTION_NEXT_AT_MOVEMENT_GRANULARITY
*/
public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 0x00000100;
@@ -1515,6 +1583,7 @@
* @see #MOVEMENT_GRANULARITY_LINE
* @see #MOVEMENT_GRANULARITY_PARAGRAPH
* @see #MOVEMENT_GRANULARITY_PAGE
+ * @see AccessibilityActionCompat#ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
*/
public static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 0x00000200;
@@ -1530,6 +1599,7 @@
* info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);
* </code></pre></p>
* </p>
+ * @see AccessibilityActionCompat#ACTION_NEXT_HTML_ELEMENT
*/
public static final int ACTION_NEXT_HTML_ELEMENT = 0x00000400;
@@ -1545,16 +1615,20 @@
* info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);
* </code></pre></p>
* </p>
+ *
+ * @see AccessibilityActionCompat#ACTION_PREVIOUS_HTML_ELEMENT
*/
public static final int ACTION_PREVIOUS_HTML_ELEMENT = 0x00000800;
/**
* Action to scroll the node content forward.
+ * @see AccessibilityActionCompat#ACTION_SCROLL_FORWARD
*/
public static final int ACTION_SCROLL_FORWARD = 0x00001000;
/**
* Action to scroll the node content backward.
+ * @see AccessibilityActionCompat#ACTION_SCROLL_BACKWARD
*/
public static final int ACTION_SCROLL_BACKWARD = 0x00002000;
@@ -1562,16 +1636,19 @@
/**
* Action to copy the current selection to the clipboard.
+ * @see AccessibilityActionCompat#ACTION_COPY
*/
public static final int ACTION_COPY = 0x00004000;
/**
* Action to paste the current clipboard content.
+ * @see AccessibilityActionCompat#ACTION_PASTE
*/
public static final int ACTION_PASTE = 0x00008000;
/**
* Action to cut the current selection and place it to the clipboard.
+ * @see AccessibilityActionCompat#ACTION_CUT
*/
public static final int ACTION_CUT = 0x00010000;
@@ -1592,21 +1669,25 @@
*
* @see #ACTION_ARGUMENT_SELECTION_START_INT
* @see #ACTION_ARGUMENT_SELECTION_END_INT
+ * @see AccessibilityActionCompat#ACTION_SET_SELECTION
*/
public static final int ACTION_SET_SELECTION = 0x00020000;
/**
* Action to expand an expandable node.
+ * @see AccessibilityActionCompat#ACTION_EXPAND
*/
public static final int ACTION_EXPAND = 0x00040000;
/**
* Action to collapse an expandable node.
+ * @see AccessibilityActionCompat#ACTION_COLLAPSE
*/
public static final int ACTION_COLLAPSE = 0x00080000;
/**
- * Action to dismiss a dismissable node.
+ * Action to dismiss a dismissible node.
+ * @see AccessibilityActionCompat#ACTION_DISMISS
*/
public static final int ACTION_DISMISS = 0x00100000;
@@ -1623,6 +1704,7 @@
* "android");
* info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
* </code></pre></p>
+ * @see AccessibilityActionCompat#ACTION_SET_TEXT
*/
public static final int ACTION_SET_TEXT = 0x00200000;
@@ -1643,8 +1725,8 @@
* Argument for which HTML element to get moving to the next/previous HTML element.
* <p>
* <strong>Type:</strong> String<br>
- * <strong>Actions:</strong> {@link #ACTION_NEXT_HTML_ELEMENT},
- * {@link #ACTION_PREVIOUS_HTML_ELEMENT}
+ * <strong>Actions:</strong> {@link AccessibilityActionCompat#ACTION_NEXT_HTML_ELEMENT},
+ * {@link AccessibilityActionCompat#ACTION_PREVIOUS_HTML_ELEMENT}
* </p>
*/
public static final String ACTION_ARGUMENT_HTML_ELEMENT_STRING =
@@ -1659,8 +1741,8 @@
* {@link #ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY}
* </p>
*
- * @see #ACTION_NEXT_AT_MOVEMENT_GRANULARITY
- * @see #ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
+ * @see AccessibilityActionCompat#ACTION_NEXT_AT_MOVEMENT_GRANULARITY
+ * @see AccessibilityActionCompat#ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
*/
public static final String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN =
"ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
@@ -1672,7 +1754,7 @@
* <strong>Actions:</strong> {@link #ACTION_SET_SELECTION}
* </p>
*
- * @see #ACTION_SET_SELECTION
+ * @see AccessibilityActionCompat#ACTION_SET_SELECTION
*/
public static final String ACTION_ARGUMENT_SELECTION_START_INT =
"ACTION_ARGUMENT_SELECTION_START_INT";
@@ -1684,7 +1766,7 @@
* <strong>Actions:</strong> {@link #ACTION_SET_SELECTION}
* </p>
*
- * @see #ACTION_SET_SELECTION
+ * @see AccessibilityActionCompat#ACTION_SET_SELECTION
*/
public static final String ACTION_ARGUMENT_SELECTION_END_INT =
"ACTION_ARGUMENT_SELECTION_END_INT";
@@ -1696,7 +1778,7 @@
* <strong>Actions:</strong> {@link #ACTION_SET_TEXT}
* </p>
*
- * @see #ACTION_SET_TEXT
+ * @see AccessibilityActionCompat#ACTION_SET_TEXT
*/
public static final String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE =
"ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE";
@@ -2833,7 +2915,11 @@
/**
* Gets if the node supports granular scrolling.
- *
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 19: Returns false.</li>
+ * </ul>
* @return True if all scroll actions that could support
* {@link #ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT} have done so, false otherwise.
*/
@@ -2849,7 +2935,11 @@
* {@link android.accessibilityservice.AccessibilityService}.
* This class is made immutable before being delivered to an AccessibilityService.
* </p>
- *
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 19: No-op.</li>
+ * </ul>
* @param granularScrollingSupported True if the node supports granular scrolling, false
* otherwise.
*
@@ -2867,11 +2957,12 @@
* Services should use {@link #ACTION_SET_SELECTION} for selection. Editable text nodes must
* also be selectable. But not all UIs will populate this field, so services should consider
* 'isTextSelectable | isEditable' to ensure they don't miss nodes with selectable text.
- * Compatibility:
- * <ul>
- * <li>Api < 33: Returns false.</li>
- * </ul>
* </p>
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 19: Returns false.</li>
+ * </ul>
*
* @see #isEditable
* @return True if the node has selectable text.
@@ -2880,7 +2971,7 @@
if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.isTextSelectable(mInfo);
} else {
- return false;
+ return getBooleanProperty(BOOLEAN_PROPERTY_TEXT_SELECTABLE);
}
}
@@ -2890,10 +2981,12 @@
* <strong>Note:</strong> Cannot be called from an
* {@link android.accessibilityservice.AccessibilityService}.
* This class is made immutable before being delivered to an AccessibilityService.
- * Compatibility:
- * <ul>
- * <li>Api < 33: Does not operate.</li>
- * </ul>
+ * </p>
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 19: Does not operate.</li>
+ * </ul>
* </p>
*
* @param selectableText True if the node has selectable text, false otherwise.
@@ -2903,6 +2996,8 @@
public void setTextSelectable(boolean selectableText) {
if (Build.VERSION.SDK_INT >= 33) {
Api33Impl.setTextSelectable(mInfo, selectableText);
+ } else {
+ setBooleanProperty(BOOLEAN_PROPERTY_TEXT_SELECTABLE, selectableText);
}
}
@@ -3167,8 +3262,8 @@
* than 19.
*/
public @Nullable CharSequence getStateDescription() {
- if (BuildCompat.isAtLeastR()) {
- return mInfo.getStateDescription();
+ if (Build.VERSION.SDK_INT >= 30) {
+ return Api30Impl.getStateDescription(mInfo);
} else if (Build.VERSION.SDK_INT >= 19) {
return Api19Impl.getExtras(mInfo).getCharSequence(STATE_DESCRIPTION_KEY);
}
@@ -3202,8 +3297,8 @@
* @throws IllegalStateException If called from an AccessibilityService.
*/
public void setStateDescription(@Nullable CharSequence stateDescription) {
- if (BuildCompat.isAtLeastR()) {
- mInfo.setStateDescription(stateDescription);
+ if (Build.VERSION.SDK_INT >= 30) {
+ Api30Impl.setStateDescription(mInfo, stateDescription);
} else if (Build.VERSION.SDK_INT >= 19) {
Api19Impl.getExtras(mInfo).putCharSequence(STATE_DESCRIPTION_KEY, stateDescription);
}
@@ -3215,10 +3310,9 @@
* @return the unique id or null if android version smaller
* than 19.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public @Nullable String getUniqueId() {
- if (BuildCompat.isAtLeastT()) {
- return mInfo.getUniqueId();
+ if (Build.VERSION.SDK_INT >= 33) {
+ return Api33Impl.getUniqueId(mInfo);
} else if (Build.VERSION.SDK_INT >= 19) {
return Api19Impl.getExtras(mInfo).getString(UNIQUE_ID_KEY);
}
@@ -3236,10 +3330,9 @@
* @param uniqueId the unique id of this node.
* @throws IllegalStateException If called from an AccessibilityService.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void setUniqueId(@Nullable String uniqueId) {
- if (BuildCompat.isAtLeastT()) {
- mInfo.setUniqueId(uniqueId);
+ if (Build.VERSION.SDK_INT >= 33) {
+ Api33Impl.setUniqueId(mInfo, uniqueId);
} else if (Build.VERSION.SDK_INT >= 19) {
Api19Impl.getExtras(mInfo).putString(UNIQUE_ID_KEY, uniqueId);
}
@@ -4338,7 +4431,7 @@
* Returns whether node represents a heading.
* <p><strong>Note:</strong> Returns {@code true} if either {@link #setHeading(boolean)}
* marks this node as a heading or if the node has a {@link CollectionItemInfoCompat} that marks
- * it as such, to accomodate apps that use the now-deprecated API.</p>
+ * it as such, to accommodate apps that use the now-deprecated API.</p>
*
* @return {@code true} if the node is a heading, {@code false} otherwise.
*/
@@ -4594,8 +4687,12 @@
builder.append("; packageName: ").append(getPackageName());
builder.append("; className: ").append(getClassName());
builder.append("; text: ").append(getText());
+ builder.append("; error: ").append(getError());
+ builder.append("; maxTextLength: ").append(getMaxTextLength());
+ builder.append("; stateDescription: ").append(getStateDescription());
builder.append("; contentDescription: ").append(getContentDescription());
- builder.append("; viewId: ").append(getViewIdResourceName());
+ builder.append("; tooltipText: ").append(getTooltipText());
+ builder.append("; viewIdResName: ").append(getViewIdResourceName());
builder.append("; uniqueId: ").append(getUniqueId());
builder.append("; checkable: ").append(isCheckable());
@@ -4605,9 +4702,14 @@
builder.append("; selected: ").append(isSelected());
builder.append("; clickable: ").append(isClickable());
builder.append("; longClickable: ").append(isLongClickable());
+ builder.append("; contextClickable: ").append(isContextClickable());
builder.append("; enabled: ").append(isEnabled());
builder.append("; password: ").append(isPassword());
builder.append("; scrollable: " + isScrollable());
+ builder.append("; granularScrollingSupported: ").append(isGranularScrollingSupported());
+ builder.append("; importantForAccessibility: ").append(isImportantForAccessibility());
+ builder.append("; visible: ").append(isVisibleToUser());
+ builder.append("; isTextSelectable: ").append(isTextSelectable());
builder.append("; [");
if (Build.VERSION.SDK_INT >= 21) {
@@ -4738,16 +4840,31 @@
return "ACTION_DRAG_DROP";
case android.R.id.accessibilityActionDragCancel:
return "ACTION_DRAG_CANCEL";
+ case android.R.id.accessibilityActionScrollInDirection:
+ return "ACTION_SCROLL_IN_DIRECTION";
default:
- // TODO (b/267511848): fix after Android U constants are finalized.
- if (Build.VERSION.SDK_INT >= 34
- && action == android.R.id.accessibilityActionScrollInDirection) {
- return "ACTION_SCROLL_IN_DIRECTION";
- }
return "ACTION_UNKNOWN";
}
}
+ @RequiresApi(30)
+ private static class Api30Impl {
+ private Api30Impl() {
+ // This class is non instantiable.
+ }
+
+ @DoNotInline
+ public static void setStateDescription(AccessibilityNodeInfo info,
+ CharSequence stateDescription) {
+ info.setStateDescription(stateDescription);
+ }
+
+ @DoNotInline
+ public static CharSequence getStateDescription(AccessibilityNodeInfo info) {
+ return info.getStateDescription();
+ }
+ }
+
@RequiresApi(33)
private static class Api33Impl {
private Api33Impl() {
@@ -4769,6 +4886,16 @@
public static void setTextSelectable(AccessibilityNodeInfo info, boolean selectable) {
info.setTextSelectable(selectable);
}
+
+ @DoNotInline
+ public static String getUniqueId(AccessibilityNodeInfo info) {
+ return info.getUniqueId();
+ }
+
+ @DoNotInline
+ public static void setUniqueId(AccessibilityNodeInfo info, String uniqueId) {
+ info.setUniqueId(uniqueId);
+ }
}
@RequiresApi(19)
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeProviderCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeProviderCompat.java
index 513e38f..6b12814 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeProviderCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeProviderCompat.java
@@ -30,6 +30,11 @@
/**
* Helper for accessing {@link android.view.accessibility.AccessibilityNodeProvider}.
+ * <p>
+ * <aside class="note">
+ * <b>Note:</b> Consider using a {@link androidx.customview.widget.ExploreByTouchHelper}, a utility
+ * extension of AccessibilityNodeProvider, to simplify many aspects of providing information to
+ * accessibility services and managing accessibility focus. </aside>
*/
public class AccessibilityNodeProviderCompat {
@RequiresApi(16)
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
index 91586a5..9ffba16 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
@@ -21,6 +21,8 @@
import android.graphics.Rect;
import android.graphics.Region;
+import android.os.LocaleList;
+import android.os.SystemClock;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityWindowInfo;
@@ -28,6 +30,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
+import androidx.core.os.LocaleListCompat;
/**
* Helper for accessing {@link android.view.accessibility.AccessibilityWindowInfo}.
@@ -322,6 +325,40 @@
}
/**
+ * Returns the {@link SystemClock#uptimeMillis()} at which the last transition happens.
+ * A transition happens when {@link #getBoundsInScreen(Rect)} is changed.
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 34: Will return 0.</li>
+ * </ul>
+ * @return The transition timestamp.
+ */
+ public long getTransitionTimeMillis() {
+ if (SDK_INT >= 34) {
+ return Api34Impl.getTransitionTimeMillis((AccessibilityWindowInfo) mInfo);
+ }
+ return 0;
+ }
+
+ /**
+ * Returns the {@link android.os.LocaleList} of the window.
+ * <p>
+ * Compatibility:
+ * <ul>
+ * <li>Api < 34: Will return {@link LocaleListCompat#getEmptyLocaleList()}.</li>
+ * </ul>
+ * @return the locales of the window.
+ */
+ public @NonNull LocaleListCompat getLocales() {
+ if (SDK_INT >= 34) {
+ return LocaleListCompat.wrap(Api34Impl.getLocales((AccessibilityWindowInfo) mInfo));
+ } else {
+ return LocaleListCompat.getEmptyLocaleList();
+ }
+ }
+
+ /**
* Gets the title of the window.
*
* @return The title of the window, or the application label for the window if no title was
@@ -448,6 +485,8 @@
builder.append(", active=").append(isActive());
builder.append(", hasParent=").append(getParent() != null);
builder.append(", hasChildren=").append(getChildCount() > 0);
+ builder.append(", transitionTime=").append(getTransitionTimeMillis());
+ builder.append(", locales=").append(getLocales());
builder.append(']');
return builder.toString();
}
@@ -593,4 +632,21 @@
return info.isInPictureInPictureMode();
}
}
+
+ @RequiresApi(34)
+ private static class Api34Impl {
+ private Api34Impl() {
+ // This class is non instantiable.
+ }
+
+ @DoNotInline
+ public static long getTransitionTimeMillis(AccessibilityWindowInfo info) {
+ return info.getTransitionTimeMillis();
+ }
+
+ @DoNotInline
+ static LocaleList getLocales(AccessibilityWindowInfo info) {
+ return info.getLocales();
+ }
+ }
}
\ No newline at end of file
diff --git a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClient.kt b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClient.kt
index 522e730..7844a1d 100644
--- a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClient.kt
+++ b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClient.kt
@@ -101,4 +101,4 @@
fun disconnectPeer(device: UwbDevice) {
callback.onRangingSuspended(device, 0)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClientSessionScope.kt b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClientSessionScope.kt
index 76eeebb..c93aa63 100644
--- a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClientSessionScope.kt
+++ b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbClientSessionScope.kt
@@ -115,4 +115,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControleeSessionScope.kt b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControleeSessionScope.kt
index 1e23410..785a677 100644
--- a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControleeSessionScope.kt
+++ b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControleeSessionScope.kt
@@ -33,4 +33,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControllerSessionScope.kt b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControllerSessionScope.kt
index 0991c67..66b78f9 100644
--- a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControllerSessionScope.kt
+++ b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbControllerSessionScope.kt
@@ -45,4 +45,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbManager.kt b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbManager.kt
index 112a643..10b4942 100644
--- a/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbManager.kt
+++ b/core/uwb/uwb-rxjava3/src/androidTest/java/androidx/core/uwb/rxjava3/mock/TestUwbManager.kt
@@ -83,4 +83,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbClientSessionScopeRx.kt b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbClientSessionScopeRx.kt
index 85c2cae..75f7049 100644
--- a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbClientSessionScopeRx.kt
+++ b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbClientSessionScopeRx.kt
@@ -43,4 +43,4 @@
public fun UwbClientSessionScope.rangingResultsFlowable(parameters: RangingParameters):
Flowable<RangingResult> {
return prepareSession(parameters).conflate().asFlowable()
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbControllerSessionScopeRx.kt b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbControllerSessionScopeRx.kt
index 81d24e6..0b9885d 100644
--- a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbControllerSessionScopeRx.kt
+++ b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbControllerSessionScopeRx.kt
@@ -37,4 +37,4 @@
*/
fun UwbControllerSessionScope.removeControleeSingle(address: UwbAddress): Single<Unit> {
return rxSingle { removeControlee(address) }
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbManagerRx.kt b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbManagerRx.kt
index 1a15496..6e74489 100644
--- a/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbManagerRx.kt
+++ b/core/uwb/uwb-rxjava3/src/main/java/androidx/core/uwb/rxjava3/UwbManagerRx.kt
@@ -49,4 +49,4 @@
*/
fun UwbManager.controllerSessionScopeSingle(): Single<UwbControllerSessionScope> {
return rxSingle { controllerSessionScope() }
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/common/TestCommons.kt b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/common/TestCommons.kt
index 7175825..b0e67db 100644
--- a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/common/TestCommons.kt
+++ b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/common/TestCommons.kt
@@ -45,4 +45,4 @@
RangingParameters.RANGING_UPDATE_RATE_AUTOMATIC
)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbClientSessionScopeImplTest.kt b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbClientSessionScopeImplTest.kt
index 91093c4..e4a24e2 100644
--- a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbClientSessionScopeImplTest.kt
+++ b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbClientSessionScopeImplTest.kt
@@ -287,4 +287,4 @@
}
job2.cancel()
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbControllerSessionScopeImplTest.kt b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbControllerSessionScopeImplTest.kt
index b68d546..5ccc536 100644
--- a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbControllerSessionScopeImplTest.kt
+++ b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/impl/UwbControllerSessionScopeImplTest.kt
@@ -165,4 +165,4 @@
job.join()
}
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/mock/TestUwbClient.kt b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/mock/TestUwbClient.kt
index db0ff5b..9ac95b5 100644
--- a/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/mock/TestUwbClient.kt
+++ b/core/uwb/uwb/src/androidTest/java/androidx/core/uwb/mock/TestUwbClient.kt
@@ -122,4 +122,4 @@
fun disconnectPeer(device: UwbDevice) {
callback.onRangingSuspended(device, 0)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingCapabilities.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingCapabilities.kt
index b7e35fd..3d22c5b 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingCapabilities.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingCapabilities.kt
@@ -24,7 +24,7 @@
* @property minRangingInterval - Minimum ranging interval
* @property supportedChannels - Set of supported channels
* @property supportedConfigIds - Set of supported config ids
- **/
+ */
class RangingCapabilities(
val isDistanceSupported: Boolean,
val isAzimuthalAngleSupported: Boolean,
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingResult.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingResult.kt
index 7cdc6a0..ddac64c 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingResult.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/RangingResult.kt
@@ -34,4 +34,4 @@
/** A ranging result with peer disconnected status update. */
class RangingResultPeerDisconnected(override val device: UwbDevice) : RangingResult()
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbClientSessionScope.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbClientSessionScope.kt
index 1bbac28..56d22a0 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbClientSessionScope.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbClientSessionScope.kt
@@ -56,4 +56,4 @@
* before starting again.
*/
val localAddress: UwbAddress
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbComplexChannel.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbComplexChannel.kt
index 4167e093..f072814 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbComplexChannel.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbComplexChannel.kt
@@ -28,4 +28,4 @@
override fun toString(): String {
return "UwbComplexChannel(channel=$channel, preambleIndex=$preambleIndex)"
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControleeSessionScope.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControleeSessionScope.kt
index 5e02a8e..c94b83e 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControleeSessionScope.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControleeSessionScope.kt
@@ -17,4 +17,4 @@
package androidx.core.uwb
/** Interface for controlee client session that is established between nearby UWB devices. */
-interface UwbControleeSessionScope : UwbClientSessionScope
\ No newline at end of file
+interface UwbControleeSessionScope : UwbClientSessionScope
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControllerSessionScope.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControllerSessionScope.kt
index cb5d7fb..3048757 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControllerSessionScope.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbControllerSessionScope.kt
@@ -56,4 +56,4 @@
* [RangingResult.RangingResultPeerDisconnected] to listen for disconnects.
*/
suspend fun removeControlee(address: UwbAddress)
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbManager.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbManager.kt
index 8a0305e..6657216 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbManager.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/UwbManager.kt
@@ -58,4 +58,4 @@
* @throws [androidx.core.uwb.exceptions.UwbHardwareNotAvailableException] if the hardware is not available on the device.
*/
suspend fun controllerSessionScope(): UwbControllerSessionScope
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException.kt
index 72ad22d..9e710bea 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException.kt
@@ -17,4 +17,4 @@
package androidx.core.uwb.exceptions
/** The uwb hardware is not available on the device. */
-class UwbHardwareNotAvailableException(message: String) : UwbApiException(message)
\ No newline at end of file
+class UwbHardwareNotAvailableException(message: String) : UwbApiException(message)
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbServiceNotAvailableException.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbServiceNotAvailableException.kt
index ad1db5b..3c5452c 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbServiceNotAvailableException.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbServiceNotAvailableException.kt
@@ -17,4 +17,4 @@
package androidx.core.uwb.exceptions
/** The service was not available on the device. */
-class UwbServiceNotAvailableException(message: String) : UwbApiException(message)
\ No newline at end of file
+class UwbServiceNotAvailableException(message: String) : UwbApiException(message)
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbSystemCallbackException.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbSystemCallbackException.kt
index 32546ff..ea5c7c1 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbSystemCallbackException.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/exceptions/UwbSystemCallbackException.kt
@@ -20,4 +20,4 @@
* Unusual failures happened in UWB system callback, such as stopping
* ranging or removing a known controlee failed.
*/
-class UwbSystemCallbackException(message: String) : UwbApiException(message)
\ No newline at end of file
+class UwbSystemCallbackException(message: String) : UwbApiException(message)
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeAospImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeAospImpl.kt
index 201b5d8..2f05484 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeAospImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeAospImpl.kt
@@ -157,4 +157,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeImpl.kt
index 2423cec..5b11a8e 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbClientSessionScopeImpl.kt
@@ -155,4 +155,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeAospImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeAospImpl.kt
index e39bed3..a4d9a7a 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeAospImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeAospImpl.kt
@@ -35,4 +35,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeImpl.kt
index 5fbabd0..5cb9eeb 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControleeSessionScopeImpl.kt
@@ -35,4 +35,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeAospImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeAospImpl.kt
index 0630d41..bb03130 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeAospImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeAospImpl.kt
@@ -56,4 +56,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeImpl.kt
index 65c3fc5..e51b361b2 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbControllerSessionScopeImpl.kt
@@ -69,4 +69,4 @@
override fun prepareSession(parameters: RangingParameters): Flow<RangingResult> {
return uwbClientSessionScope.prepareSession(parameters)
}
-}
\ No newline at end of file
+}
diff --git a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbManagerImpl.kt b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbManagerImpl.kt
index 7af9774..5aaae18 100644
--- a/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbManagerImpl.kt
+++ b/core/uwb/uwb/src/main/java/androidx/core/uwb/impl/UwbManagerImpl.kt
@@ -159,4 +159,4 @@
throw e
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/AndroidManifest.xml b/credentials/credentials-play-services-auth/src/androidTest/AndroidManifest.xml
index d7b0e91..73badf7 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/AndroidManifest.xml
+++ b/credentials/credentials-play-services-auth/src/androidTest/AndroidManifest.xml
@@ -21,5 +21,9 @@
android:name="androidx.credentials.playservices.TestCredentialsActivity"
android:exported="false"
/>
+ <activity
+ android:name="androidx.credentials.playservices.TestCredentialsFragmentActivity"
+ android:exported="false"
+ />
</application>
</manifest>
\ No newline at end of file
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplJavaTest.java b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplJavaTest.java
index 36bdbc8..abcacde 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplJavaTest.java
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplJavaTest.java
@@ -21,7 +21,8 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import androidx.core.os.BuildCompat;
+import android.os.Build;
+
import androidx.test.core.app.ActivityScenario;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
@@ -40,7 +41,7 @@
@Test
@SdkSuppress(maxSdkVersion = 33)
public void isAvailableOnDevice_apiSuccess_returnsTrue() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return; // Wait until Mockito fixes 'mock' for API 34
}
ActivityScenario<TestCredentialsActivity> activityScenario =
@@ -63,7 +64,7 @@
@Test
@SdkSuppress(maxSdkVersion = 33)
public void isAvailableOnDevice_apiNotSuccess_returnsFalse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return; // Wait until Mockito fixes 'mock' for API 34
}
ActivityScenario<TestCredentialsActivity> activityScenario =
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplTest.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplTest.kt
index 63226ec..ad59aa9 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplTest.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/CredentialProviderPlayServicesImplTest.kt
@@ -16,7 +16,7 @@
package androidx.credentials.playservices
-import androidx.core.os.BuildCompat
+import android.os.Build
import androidx.credentials.playservices.TestUtils.Companion.ConnectionResultFailureCases
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -36,7 +36,7 @@
@Test
@SdkSuppress(maxSdkVersion = 33)
fun isAvailableOnDevice_apiSuccess_returnsTrue() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return // TODO(b/285651071) : Fix once Mockito fixes mock issue, around these test cases
}
val activityScenario = ActivityScenario.launch(
@@ -61,7 +61,7 @@
@Test
@SdkSuppress(maxSdkVersion = 33)
fun isAvailableOnDevice_apiNotSuccess_returnsFalse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return // Wait until Mockito fixes 'mock' for API 34
}
val activityScenario = ActivityScenario.launch(
@@ -83,4 +83,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsActivity.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsActivity.kt
index d57a9b6..37dd2c4 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsActivity.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsActivity.kt
@@ -22,4 +22,4 @@
* This is a test activity used by the Robolectric Activity Scenario tests. It acts
* as a calling activity in our test cases.
*/
-class TestCredentialsActivity : ComponentActivity()
\ No newline at end of file
+class TestCredentialsActivity : ComponentActivity()
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsFragmentActivity.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsFragmentActivity.kt
new file mode 100644
index 0000000..f7ad106
--- /dev/null
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestCredentialsFragmentActivity.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.credentials.playservices
+
+import android.os.Build
+import androidx.annotation.RequiresApi
+import androidx.fragment.app.FragmentActivity
+
+/**
+ * This is a test activity used by the Robolectric Activity Scenario tests. It acts as a calling
+ * activity in our test cases. This activity uses fragments.
+ */
+@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
+class TestCredentialsFragmentActivity : FragmentActivity()
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestUtils.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestUtils.kt
index 63dd65a..1bf209d 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestUtils.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/TestUtils.kt
@@ -152,4 +152,4 @@
ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, ConnectionResult.SIGN_IN_FAILED,
ConnectionResult.SIGN_IN_REQUIRED, ConnectionResult.TIMEOUT)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerJavaTest.java b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerJavaTest.java
index e4cddda..acbfe57 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerJavaTest.java
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerJavaTest.java
@@ -20,12 +20,14 @@
import static org.junit.Assert.assertThrows;
+import android.app.Activity;
+import android.os.Build;
+
import androidx.credentials.GetCredentialRequest;
import androidx.credentials.GetPasswordOption;
import androidx.credentials.playservices.TestCredentialsActivity;
import androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController;
import androidx.test.core.app.ActivityScenario;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import com.google.android.gms.auth.api.identity.BeginSignInRequest;
@@ -33,19 +35,56 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
import java.util.HashSet;
import java.util.List;
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@SmallTest
@SuppressWarnings("deprecation")
public class CredentialProviderBeginSignInControllerJavaTest {
+
+ private final boolean mUseFragmentActivity;
+
+ @Parameterized.Parameters
+ public static Object[] data() {
+ return new Object[] {true, false};
+ }
+
+ public CredentialProviderBeginSignInControllerJavaTest(final boolean useFragmentActivity)
+ throws Throwable {
+ mUseFragmentActivity = useFragmentActivity;
+ }
+
+ interface TestActivityListener {
+ void onActivity(Activity a);
+ }
+
+ private void launchTestActivity(TestActivityListener listener) {
+ if (mUseFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ ActivityScenario<androidx.credentials.playservices.TestCredentialsFragmentActivity>
+ activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ } else {
+ ActivityScenario<TestCredentialsActivity> activityScenario =
+ ActivityScenario.launch(TestCredentialsActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ }
+ }
+
@Test
public void convertRequestToPlayServices_setPasswordOptionRequestAndFalseAutoSelect_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
BeginSignInRequest actualResponse =
CredentialProviderBeginSignInController.getInstance(activity)
@@ -60,9 +99,7 @@
@Test
public void convertRequestToPlayServices_setPasswordOptionRequestAndTrueAutoSelect_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
BeginSignInRequest actualResponse =
CredentialProviderBeginSignInController.getInstance(activity)
@@ -79,9 +116,7 @@
@Test
public void convertRequestToPlayServices_nullRequest_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
assertThrows(
"null get credential request must throw exception",
@@ -94,9 +129,7 @@
@Test
public void convertResponseToCredentialManager_nullRequest_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
assertThrows(
"null sign in credential response must throw exception",
@@ -109,9 +142,6 @@
@Test
public void convertRequestToPlayServices_setGoogleIdOptionRequestAndTrueAutoSelect_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
-
GetGoogleIdOption option =
new GetGoogleIdOption.Builder()
.setServerClientId("server_client_id")
@@ -122,7 +152,7 @@
.setAutoSelectEnabled(true)
.build();
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
BeginSignInRequest actualRequest =
CredentialProviderBeginSignInController.getInstance(activity)
@@ -151,9 +181,7 @@
@Test
public void duplicateGetInstance_shouldBeEqual() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
CredentialProviderBeginSignInController firstInstance =
CredentialProviderBeginSignInController.getInstance(activity);
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerTest.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerTest.kt
index 98ba9e3..5e05605 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerTest.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/beginsignin/CredentialProviderBeginSignInControllerTest.kt
@@ -16,32 +16,55 @@
package androidx.credentials.playservices.beginsignin
+import android.app.Activity
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.credentials.GetCredentialRequest
import androidx.credentials.GetPasswordOption
import androidx.credentials.playservices.TestCredentialsActivity
+import androidx.credentials.playservices.TestCredentialsFragmentActivity
import androidx.credentials.playservices.controllers.BeginSignIn.CredentialProviderBeginSignInController.Companion.getInstance
import androidx.test.core.app.ActivityScenario
-import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.android.libraries.identity.googleid.GetGoogleIdOption
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
-@RunWith(AndroidJUnit4::class)
+@RunWith(Parameterized::class)
@SmallTest
@Suppress("deprecation")
@RequiresApi(api = Build.VERSION_CODES.O)
-class CredentialProviderBeginSignInControllerTest {
+class CredentialProviderBeginSignInControllerTest(val useFragmentActivity: Boolean) {
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters() = listOf(true, false)
+ }
+
+ private fun launchTestActivity(callback: (activity: Activity) -> Unit) {
+ if (useFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ var activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ } else {
+ var activityScenario = ActivityScenario.launch(TestCredentialsActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ }
+ }
+
@Test
fun convertRequestToPlayServices_setPasswordOptionRequestAndFalseAutoSelect_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
- val actualResponse = getInstance(activity!!)
+ launchTestActivity { activity: Activity ->
+ val actualResponse = getInstance(activity)
.convertRequestToPlayServices(
GetCredentialRequest(
listOf(
@@ -58,11 +81,8 @@
@Test
fun convertRequestToPlayServices_setPasswordOptionRequestAndTrueAutoSelect_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
- val actualResponse = getInstance(activity!!)
+ launchTestActivity { activity: Activity ->
+ val actualResponse = getInstance(activity)
.convertRequestToPlayServices(
GetCredentialRequest(
listOf(
@@ -79,10 +99,6 @@
@Test
fun convertRequestToPlayServices_setGoogleIdOptionRequest_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
-
val option = GetGoogleIdOption.Builder()
.setServerClientId("server_client_id")
.setNonce("nonce")
@@ -92,8 +108,8 @@
.setAutoSelectEnabled(true)
.build()
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
- val actualRequest = getInstance(activity!!)
+ launchTestActivity { activity: Activity ->
+ val actualRequest = getInstance(activity)
.convertRequestToPlayServices(
GetCredentialRequest(
listOf(
@@ -120,14 +136,11 @@
@Test
fun duplicateGetInstance_shouldBeEqual() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
- val firstInstance = getInstance(activity!!)
+ val firstInstance = getInstance(activity)
val secondInstance = getInstance(activity)
assertThat(firstInstance).isEqualTo(secondInstance)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerJavaTest.java b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerJavaTest.java
index 00b86ba..f0d5a85 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerJavaTest.java
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerJavaTest.java
@@ -20,6 +20,8 @@
import static org.junit.Assert.assertThrows;
+import android.app.Activity;
+import android.os.Build;
import android.os.Bundle;
import androidx.credentials.CreateCredentialResponse;
@@ -29,7 +31,6 @@
import androidx.credentials.playservices.TestUtils;
import androidx.credentials.playservices.controllers.CreatePassword.CredentialProviderCreatePasswordController;
import androidx.test.core.app.ActivityScenario;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import com.google.android.gms.auth.api.identity.SignInPassword;
@@ -38,17 +39,53 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@SmallTest
public class CredentialProviderCreatePasswordControllerJavaTest {
+ private final boolean mUseFragmentActivity;
+
+ @Parameterized.Parameters
+ public static Object[] data() {
+ return new Object[] {true, false};
+ }
+
+ public CredentialProviderCreatePasswordControllerJavaTest(final boolean useFragmentActivity)
+ throws Throwable {
+ mUseFragmentActivity = useFragmentActivity;
+ }
+
+ interface TestActivityListener {
+ void onActivity(Activity a);
+ }
+
+ private void launchTestActivity(TestActivityListener listener) {
+ if (mUseFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ ActivityScenario<androidx.credentials.playservices.TestCredentialsFragmentActivity>
+ activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ } else {
+ ActivityScenario<TestCredentialsActivity> activityScenario =
+ ActivityScenario.launch(TestCredentialsActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ }
+ }
+
@Test
public void convertResponseToCredentialManager_unitInput_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
String expectedResponseType = new CreatePasswordResponse().getType();
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
CreateCredentialResponse actualResponse =
CredentialProviderCreatePasswordController.getInstance(activity)
@@ -62,11 +99,9 @@
@Test
public void convertRequestToPlayServices_createPasswordRequest_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
String expectedId = "LM";
String expectedPassword = "SodaButton";
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
SignInPassword actualRequest =
CredentialProviderCreatePasswordController.getInstance(activity)
@@ -83,7 +118,7 @@
public void convertRequestToPlayServices_nullRequest_throws() {
ActivityScenario<TestCredentialsActivity> activityScenario =
ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
assertThrows(
"null create password request must throw exception",
@@ -97,9 +132,7 @@
@Test
public void convertResponseToCredentialManager_nullRequest_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
assertThrows(
"null unit response must throw exception",
@@ -112,9 +145,7 @@
@Test
public void duplicateGetInstance_shouldBeEqual() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(
+ launchTestActivity(
activity -> {
CredentialProviderCreatePasswordController firstInstance =
CredentialProviderCreatePasswordController.getInstance(activity);
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerTest.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerTest.kt
index 128c970..cc2e365 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerTest.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpassword/CredentialProviderCreatePasswordControllerTest.kt
@@ -16,31 +16,56 @@
package androidx.credentials.playservices.createpassword
+import android.app.Activity
+import android.os.Build
import android.os.Bundle
+import androidx.annotation.DoNotInline
import androidx.credentials.CreatePasswordRequest
import androidx.credentials.CreatePasswordResponse
import androidx.credentials.playservices.TestCredentialsActivity
import androidx.credentials.playservices.TestUtils.Companion.equals
import androidx.credentials.playservices.controllers.CreatePassword.CredentialProviderCreatePasswordController.Companion.getInstance
import androidx.test.core.app.ActivityScenario
-import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
-@RunWith(AndroidJUnit4::class)
+@RunWith(Parameterized::class)
@SmallTest
-class CredentialProviderCreatePasswordControllerTest {
+class CredentialProviderCreatePasswordControllerTest(val useFragmentActivity: Boolean) {
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters() = listOf(true, false)
+ }
+
+ @DoNotInline
+ private fun launchTestActivity(callback: (activity: Activity) -> Unit) {
+ if (useFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ var activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ } else {
+ var activityScenario = ActivityScenario.launch(TestCredentialsActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ }
+ }
+
@Test
fun convertResponseToCredentialManager_unitInput_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
val expectedResponseType = CreatePasswordResponse().type
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
- val actualResponse = getInstance(activity!!)
+ val actualResponse = getInstance(activity)
.convertResponseToCredentialManager(Unit)
assertThat(actualResponse.type)
@@ -51,14 +76,11 @@
@Test
fun convertRequestToPlayServices_createPasswordRequest_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
val expectedId = "LM"
val expectedPassword = "SodaButton"
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
- val actualRequest = getInstance(activity!!)
+ val actualRequest = getInstance(activity)
.convertRequestToPlayServices(CreatePasswordRequest(
expectedId, expectedPassword)).signInPassword
@@ -70,14 +92,11 @@
@Test
fun duplicateGetInstance_shouldBeEqual() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
- val firstInstance = getInstance(activity!!)
+ val firstInstance = getInstance(activity)
val secondInstance = getInstance(activity)
assertThat(firstInstance).isEqualTo(secondInstance)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CreatePublicKeyCredentialControllerTestUtils.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CreatePublicKeyCredentialControllerTestUtils.kt
index 027a3ad..b4286c2 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CreatePublicKeyCredentialControllerTestUtils.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CreatePublicKeyCredentialControllerTestUtils.kt
@@ -327,4 +327,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerJavaTest.java b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerJavaTest.java
index 8fba8ff..5e92ef8 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerJavaTest.java
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerJavaTest.java
@@ -33,12 +33,14 @@
import static org.junit.Assert.assertThrows;
+import android.app.Activity;
+import android.os.Build;
+
import androidx.credentials.CreatePublicKeyCredentialRequest;
import androidx.credentials.playservices.TestCredentialsActivity;
import androidx.credentials.playservices.TestUtils;
import androidx.credentials.playservices.controllers.CreatePublicKeyCredential.CredentialProviderCreatePublicKeyCredentialController;
import androidx.test.core.app.ActivityScenario;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions;
@@ -47,157 +49,209 @@
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
-@RunWith(AndroidJUnit4.class)
+@RunWith(Parameterized.class)
@SmallTest
public class CredentialProviderCreatePublicKeyCredentialControllerJavaTest {
+
+ private final boolean mUseFragmentActivity;
+
+ @Parameterized.Parameters
+ public static Object[] data() {
+ return new Object[] {true, false};
+ }
+
+ public CredentialProviderCreatePublicKeyCredentialControllerJavaTest(
+ final boolean useFragmentActivity) throws Throwable {
+ mUseFragmentActivity = useFragmentActivity;
+ }
+
+ interface TestActivityListener {
+ void onActivity(Activity a);
+ }
+
+ private void launchTestActivity(TestActivityListener listener) {
+ if (mUseFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ ActivityScenario<androidx.credentials.playservices.TestCredentialsFragmentActivity>
+ activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ } else {
+ ActivityScenario<TestCredentialsActivity> activityScenario =
+ ActivityScenario.launch(TestCredentialsActivity.class);
+ activityScenario.onActivity(
+ activity -> {
+ listener.onActivity((Activity) activity);
+ });
+ }
+ }
+
+ private PublicKeyCredentialCreationOptions convertRequestToPlayServices(
+ Activity activity, String type) {
+ CreatePublicKeyCredentialRequest pubKeyRequest = new CreatePublicKeyCredentialRequest(type);
+ return CredentialProviderCreatePublicKeyCredentialController.getInstance(activity)
+ .convertRequestToPlayServices(pubKeyRequest);
+ }
+
@Test
- public void
- convertRequestToPlayServices_correctRequiredOnlyRequest_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
- try {
- JSONObject expectedJson = new JSONObject(
- MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT);
+ public void convertRequestToPlayServices_correctRequiredOnlyRequest_success() {
+ launchTestActivity(
+ activity -> {
+ try {
+ JSONObject expectedJson =
+ new JSONObject(MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT);
- PublicKeyCredentialCreationOptions actualResponse =
- CredentialProviderCreatePublicKeyCredentialController.getInstance(activity)
- .convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT));
- JSONObject actualJson = createJsonObjectFromPublicKeyCredentialCreationOptions(
+ PublicKeyCredentialCreationOptions actualResponse =
+ convertRequestToPlayServices(
+ activity,
+ MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT);
+ JSONObject actualJson =
+ createJsonObjectFromPublicKeyCredentialCreationOptions(
actualResponse);
- JSONObject requiredKeys = new JSONObject(ALL_REQUIRED_FIELDS_SIGNATURE);
+ JSONObject requiredKeys = new JSONObject(ALL_REQUIRED_FIELDS_SIGNATURE);
- assertThat(TestUtils.Companion.isSubsetJson(expectedJson, actualJson,
- requiredKeys)).isTrue();
- // TODO("Add remaining tests in detail after discussing ideal form")
- } catch (JSONException e) {
- throw new RuntimeException(e);
- }
- });
+ assertThat(
+ TestUtils.Companion.isSubsetJson(
+ expectedJson, actualJson, requiredKeys))
+ .isTrue();
+ // TODO("Add remaining tests in detail after discussing ideal form")
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+ });
}
@Test
public void convertRequestToPlayServices_correctRequiredAndOptionalRequest_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
- try {
- JSONObject expectedJson = new JSONObject(
- MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT);
+ launchTestActivity(
+ activity -> {
+ try {
+ JSONObject expectedJson =
+ new JSONObject(
+ MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT);
- PublicKeyCredentialCreationOptions actualResponse =
- CredentialProviderCreatePublicKeyCredentialController.getInstance(activity)
- .convertRequestToPlayServices(new CreatePublicKeyCredentialRequest(
- MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT));
- JSONObject actualJson =
- createJsonObjectFromPublicKeyCredentialCreationOptions(
+ PublicKeyCredentialCreationOptions actualResponse =
+ convertRequestToPlayServices(
+ activity,
+ MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT);
+ JSONObject actualJson =
+ createJsonObjectFromPublicKeyCredentialCreationOptions(
actualResponse);
- JSONObject requiredKeys = new JSONObject(ALL_REQUIRED_AND_OPTIONAL_SIGNATURE);
+ JSONObject requiredKeys =
+ new JSONObject(ALL_REQUIRED_AND_OPTIONAL_SIGNATURE);
- assertThat(TestUtils.Companion.isSubsetJson(expectedJson, actualJson,
- requiredKeys)).isTrue();
- // TODO("Add remaining tests in detail after discussing ideal form")
- } catch (JSONException e) {
- throw new RuntimeException(e);
- }
- });
+ assertThat(
+ TestUtils.Companion.isSubsetJson(
+ expectedJson, actualJson, requiredKeys))
+ .isTrue();
+ // TODO("Add remaining tests in detail after discussing ideal form")
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+ });
}
+
@Test
public void convertRequestToPlayServices_missingRequired_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
- try {
- CredentialProviderCreatePublicKeyCredentialController
- .getInstance(activity)
- .convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- MAIN_CREATE_JSON_MISSING_REQUIRED_FIELD));
+ launchTestActivity(
+ activity -> {
+ try {
+ PublicKeyCredentialCreationOptions actualResponse =
+ convertRequestToPlayServices(
+ activity,
+ MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT);
- // Should not reach here.
- assertWithMessage("Exception should be thrown").that(true).isFalse();
- } catch (Exception e) {
- assertThat(e.getMessage().contains("No value for id")).isTrue();
- assertThat(e.getClass().getName().contains("JSONException")).isTrue();
- }
- });
+ CreatePublicKeyCredentialRequest pubKeyRequest =
+ new CreatePublicKeyCredentialRequest(
+ MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT);
+ CredentialProviderCreatePublicKeyCredentialController.getInstance(activity)
+ .convertRequestToPlayServices(
+ new CreatePublicKeyCredentialRequest(
+ MAIN_CREATE_JSON_MISSING_REQUIRED_FIELD));
+
+ // Should not reach here.
+ assertWithMessage("Exception should be thrown").that(true).isFalse();
+ } catch (Exception e) {
+ assertThat(e.getMessage().contains("No value for id")).isTrue();
+ assertThat(e.getClass().getName().contains("JSONException")).isTrue();
+ }
+ });
}
@Test
public void convertRequestToPlayServices_emptyRequired_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
-
- assertThrows("Expected bad required json to throw",
- JSONException.class,
- () -> CredentialProviderCreatePublicKeyCredentialController
- .getInstance(activity).convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- MAIN_CREATE_JSON_REQUIRED_FIELD_EMPTY)));
- });
+ launchTestActivity(
+ activity -> {
+ assertThrows(
+ "Expected bad required json to throw",
+ JSONException.class,
+ () ->
+ convertRequestToPlayServices(
+ activity,
+ MAIN_CREATE_JSON_REQUIRED_FIELD_EMPTY));
+ });
}
@Test
public void convertRequestToPlayServices_missingOptionalRequired_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
-
- assertThrows("Expected bad required json to throw",
- JSONException.class,
- () -> CredentialProviderCreatePublicKeyCredentialController
- .getInstance(activity)
- .convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- OPTIONAL_FIELD_MISSING_REQUIRED_SUBFIELD)));
- });
+ launchTestActivity(
+ activity -> {
+ assertThrows(
+ "Expected bad required json to throw",
+ JSONException.class,
+ () ->
+ convertRequestToPlayServices(
+ activity,
+ OPTIONAL_FIELD_MISSING_REQUIRED_SUBFIELD));
+ });
}
@Test
public void convertRequestToPlayServices_emptyOptionalRequired_throws() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
-
- assertThrows("Expected bad required json to throw",
- JSONException.class,
- () -> CredentialProviderCreatePublicKeyCredentialController
- .getInstance(activity)
- .convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- OPTIONAL_FIELD_WITH_EMPTY_REQUIRED_SUBFIELD)));
- });
+ launchTestActivity(
+ activity -> {
+ assertThrows(
+ "Expected bad required json to throw",
+ JSONException.class,
+ () ->
+ convertRequestToPlayServices(
+ activity,
+ OPTIONAL_FIELD_WITH_EMPTY_REQUIRED_SUBFIELD));
+ });
}
@Test
public void convertRequestToPlayServices_missingOptionalNotRequired_success() {
- ActivityScenario<TestCredentialsActivity> activityScenario =
- ActivityScenario.launch(TestCredentialsActivity.class);
- activityScenario.onActivity(activity -> {
- try {
- JSONObject expectedJson = new JSONObject(
- OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD);
+ launchTestActivity(
+ activity -> {
+ try {
+ JSONObject expectedJson =
+ new JSONObject(OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD);
- PublicKeyCredentialCreationOptions actualResponse =
- CredentialProviderCreatePublicKeyCredentialController.getInstance(activity)
- .convertRequestToPlayServices(
- new CreatePublicKeyCredentialRequest(
- OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD));
- JSONObject actualJson = createJsonObjectFromPublicKeyCredentialCreationOptions(
+ PublicKeyCredentialCreationOptions actualResponse =
+ convertRequestToPlayServices(
+ activity,
+ OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD);
+ JSONObject actualJson =
+ createJsonObjectFromPublicKeyCredentialCreationOptions(
actualResponse);
- JSONObject requiredKeys = new
- JSONObject(OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD_SIGNATURE);
+ JSONObject requiredKeys =
+ new JSONObject(OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD_SIGNATURE);
- assertThat(TestUtils.Companion.isSubsetJson(expectedJson, actualJson,
- requiredKeys)).isTrue();
- // TODO("Add remaining tests in detail after discussing ideal form")
- } catch (JSONException e) {
- throw new RuntimeException(e);
- }
- });
+ assertThat(
+ TestUtils.Companion.isSubsetJson(
+ expectedJson, actualJson, requiredKeys))
+ .isTrue();
+ // TODO("Add remaining tests in detail after discussing ideal form")
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+ });
}
}
diff --git a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerTest.kt b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerTest.kt
index c33a968..34ca8a8 100644
--- a/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerTest.kt
+++ b/credentials/credentials-play-services-auth/src/androidTest/java/androidx/credentials/playservices/createpublickeycredential/CredentialProviderCreatePublicKeyCredentialControllerTest.kt
@@ -16,6 +16,9 @@
package androidx.credentials.playservices.createpublickeycredential
+import android.app.Activity
+import android.os.Build
+import androidx.annotation.DoNotInline
import androidx.credentials.CreatePublicKeyCredentialRequest
import androidx.credentials.playservices.TestCredentialsActivity
import androidx.credentials.playservices.TestUtils.Companion.isSubsetJson
@@ -32,7 +35,6 @@
import androidx.credentials.playservices.createkeycredential.CreatePublicKeyCredentialControllerTestUtils.Companion.OPTIONAL_FIELD_WITH_EMPTY_REQUIRED_SUBFIELD
import androidx.credentials.playservices.createkeycredential.CreatePublicKeyCredentialControllerTestUtils.Companion.createJsonObjectFromPublicKeyCredentialCreationOptions
import androidx.test.core.app.ActivityScenario
-import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
import org.json.JSONException
@@ -41,20 +43,43 @@
import org.junit.Test
import org.junit.function.ThrowingRunnable
import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
-@RunWith(AndroidJUnit4::class)
+@RunWith(Parameterized::class)
@SmallTest
-class CredentialProviderCreatePublicKeyCredentialControllerTest {
+class CredentialProviderCreatePublicKeyCredentialControllerTest(val useFragmentActivity: Boolean) {
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters() = listOf(true, false)
+ }
+
+ @DoNotInline
+ private fun launchTestActivity(callback: (activity: Activity) -> Unit) {
+ if (useFragmentActivity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
+ var activityScenario =
+ ActivityScenario.launch(
+ androidx.credentials.playservices
+ .TestCredentialsFragmentActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ } else {
+ var activityScenario = ActivityScenario.launch(TestCredentialsActivity::class.java)
+ activityScenario.onActivity { activity: Activity ->
+ callback.invoke(activity)
+ }
+ }
+ }
+
@Test
fun convertRequestToPlayServices_correctRequiredOnlyRequest_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
try {
val expectedJson = JSONObject(MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT)
- val actualResponse = getInstance(activity!!).convertRequestToPlayServices(
+ val actualResponse = getInstance(activity).convertRequestToPlayServices(
CreatePublicKeyCredentialRequest(
MAIN_CREATE_JSON_ALL_REQUIRED_FIELDS_PRESENT))
val actualJson =
@@ -72,15 +97,12 @@
@Test
fun convertRequestToPlayServices_correctRequiredAndOptionalRequest_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
try {
val expectedJson = JSONObject(
MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT)
- val actualResponse = getInstance(activity!!)
+ val actualResponse = getInstance(activity)
.convertRequestToPlayServices(CreatePublicKeyCredentialRequest(
MAIN_CREATE_JSON_ALL_REQUIRED_AND_OPTIONAL_FIELDS_PRESENT))
val actualJson =
@@ -98,16 +120,13 @@
@Test
fun convertRequestToPlayServices_missingRequired_throws() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
Assert.assertThrows("Expected bad required json to throw",
JSONException::class.java,
ThrowingRunnable {
getInstance(
- activity!!
+ activity
).convertRequestToPlayServices(
CreatePublicKeyCredentialRequest(
MAIN_CREATE_JSON_MISSING_REQUIRED_FIELD
@@ -117,30 +136,24 @@
@Test
fun convertRequestToPlayServices_emptyRequired_throws() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
Assert.assertThrows("Expected bad required json to throw",
JSONException::class.java,
- ThrowingRunnable { getInstance(activity!!
+ ThrowingRunnable { getInstance(activity
).convertRequestToPlayServices(CreatePublicKeyCredentialRequest(
MAIN_CREATE_JSON_REQUIRED_FIELD_EMPTY)) })
}
}
@Test
fun convertRequestToPlayServices_missingOptionalRequired_throws() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
Assert.assertThrows("Expected bad required json to throw",
JSONException::class.java,
ThrowingRunnable {
getInstance(
- activity!!
+ activity
).convertRequestToPlayServices(
CreatePublicKeyCredentialRequest(
OPTIONAL_FIELD_MISSING_REQUIRED_SUBFIELD)) })
@@ -149,14 +162,11 @@
@Test
fun convertRequestToPlayServices_emptyOptionalRequired_throws() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
Assert.assertThrows("Expected bad required json to throw",
JSONException::class.java,
- ThrowingRunnable { getInstance(activity!!).convertRequestToPlayServices(
+ ThrowingRunnable { getInstance(activity).convertRequestToPlayServices(
CreatePublicKeyCredentialRequest(
OPTIONAL_FIELD_WITH_EMPTY_REQUIRED_SUBFIELD)) })
}
@@ -164,15 +174,12 @@
@Test
fun convertRequestToPlayServices_missingOptionalNotRequired_success() {
- val activityScenario = ActivityScenario.launch(
- TestCredentialsActivity::class.java
- )
- activityScenario.onActivity { activity: TestCredentialsActivity? ->
+ launchTestActivity { activity: Activity ->
try {
val expectedJson = JSONObject(OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD)
val actualResponse =
- getInstance(activity!!)
+ getInstance(activity)
.convertRequestToPlayServices(
CreatePublicKeyCredentialRequest(
OPTIONAL_FIELD_MISSING_OPTIONAL_SUBFIELD))
@@ -188,4 +195,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderFragment.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderFragment.kt
new file mode 100644
index 0000000..2d7f1e9
--- /dev/null
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderFragment.kt
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.credentials.playservices
+
+import android.content.Intent
+import android.os.Bundle
+import android.os.ResultReceiver
+import androidx.annotation.RestrictTo
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController
+import androidx.fragment.app.Fragment
+
+/** A fragment used if we are passed a fragment activity. */
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+@Suppress("Deprecation")
+open class CredentialProviderFragment : Fragment() {
+
+ private var resultReceiver: ResultReceiver? = null
+ private var mWaitingForActivityResult = false
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ resultReceiver = getResultReceiver()
+ if (resultReceiver == null) {
+ return
+ }
+
+ restoreState(savedInstanceState)
+ if (mWaitingForActivityResult) {
+ return // Past call still active
+ }
+ }
+
+ private fun getResultReceiver(): ResultReceiver? {
+ if (getArguments() == null) {
+ return null
+ }
+
+ return getArguments()!!.getParcelable(CredentialProviderBaseController.RESULT_RECEIVER_TAG)
+ as? ResultReceiver
+ }
+
+ private fun restoreState(savedInstanceState: Bundle?) {
+ if (savedInstanceState != null) {
+ mWaitingForActivityResult = savedInstanceState.getBoolean(KEY_AWAITING_RESULT, false)
+ }
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ outState.putBoolean(KEY_AWAITING_RESULT, mWaitingForActivityResult)
+ super.onSaveInstanceState(outState)
+ }
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ val bundle = Bundle()
+ bundle.putBoolean(CredentialProviderBaseController.FAILURE_RESPONSE_TAG, false)
+ bundle.putInt(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, requestCode)
+ bundle.putParcelable(CredentialProviderBaseController.RESULT_DATA_TAG, data)
+ resultReceiver?.send(resultCode, bundle)
+ mWaitingForActivityResult = false
+ }
+
+ companion object {
+ private const val TAG = "CredentialProviderFragment"
+ private const val KEY_AWAITING_RESULT = "androidx.credentials.playservices.AWAITING_RESULT"
+
+ fun createFrom(resultReceiver: ResultReceiver): CredentialProviderFragment {
+ val f = CredentialProviderFragment()
+
+ // Supply index input as an argument.
+ val args = Bundle()
+ args.putParcelable(CredentialProviderBaseController.RESULT_RECEIVER_TAG, resultReceiver)
+ f.setArguments(args)
+
+ return f
+ }
+ }
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderMetadataHolder.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderMetadataHolder.kt
index 4847ac0..6069c27 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderMetadataHolder.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderMetadataHolder.kt
@@ -30,4 +30,4 @@
override fun onBind(p0: Intent?): IBinder? {
TODO("Not yet implemented")
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderPlayServicesImpl.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderPlayServicesImpl.kt
index 8e5e883..f65e129 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderPlayServicesImpl.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/CredentialProviderPlayServicesImpl.kt
@@ -163,4 +163,4 @@
return false
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/GmsCoreUtils.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/GmsCoreUtils.kt
new file mode 100644
index 0000000..112599d
--- /dev/null
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/GmsCoreUtils.kt
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.credentials.playservices
+
+import android.app.Activity
+import android.app.PendingIntent
+import android.content.IntentSender
+import android.os.Bundle
+import android.os.ResultReceiver
+import android.util.Log
+import androidx.annotation.RestrictTo
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.CREATE_INTERRUPTED
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.CREATE_UNKNOWN
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_INTERRUPTED
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_NO_CREDENTIALS
+import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_UNKNOWN
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentActivity
+import com.google.android.gms.auth.api.identity.BeginSignInRequest
+import com.google.android.gms.auth.api.identity.CredentialSavingClient
+import com.google.android.gms.auth.api.identity.SavePasswordRequest
+import com.google.android.gms.auth.api.identity.SignInClient
+import com.google.android.gms.common.api.ApiException
+import com.google.android.gms.fido.fido2.Fido2ApiClient
+import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions
+
+/** A util class for interacting with GmsCore. */
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+@Suppress("Deprecation", "ForbiddenSuperClass")
+open class GmsCoreUtils {
+
+ class GmsCoreUtilsResult(var waitingForActivityResult: Boolean, var hasFinished: Boolean)
+
+ internal companion object {
+ private const val TAG = "GmsCoreUtils"
+
+ const val DEFAULT_REQUEST_CODE = 1
+
+ class FragmentCreationException() : Exception("Failed to create exception")
+
+ fun handleCreatePublicKeyCredential(
+ apiClient: Fido2ApiClient,
+ resultReceiver: ResultReceiver,
+ fidoRegistrationRequest: PublicKeyCredentialCreationOptions?,
+ requestCode: Int,
+ activity: Activity
+ ): GmsCoreUtilsResult {
+ var waitingForActivityResult = false
+ var hasActivityFinished = false
+ var fragment = setupFragmentActivity(activity, resultReceiver)
+
+ fidoRegistrationRequest?.let {
+ apiClient
+ .getRegisterPendingIntent(fidoRegistrationRequest)
+ .addOnSuccessListener { result: PendingIntent ->
+ try {
+ startIntentSender(
+ activity,
+ result.intentSender,
+ requestCode,
+ fragment,
+ )
+ } catch (e: IntentSender.SendIntentException) {
+ setupFailure(
+ resultReceiver,
+ CREATE_UNKNOWN,
+ "During public key credential, found IntentSender " +
+ "failure on public key creation: ${e.message}"
+ )
+ }
+ }
+ .addOnFailureListener { e: Exception ->
+ var errName: String = CREATE_UNKNOWN
+ if (e is ApiException && e.statusCode in CredentialProviderBaseController.retryables) {
+ errName = CREATE_INTERRUPTED
+ }
+ setupFailure(
+ resultReceiver,
+ errName,
+ "During create public key credential, fido registration " + "failure: ${e.message}"
+ )
+ }
+ }
+ ?: run {
+ Log.w(
+ TAG,
+ "During create public key credential, request is null, so nothing to " +
+ "launch for public key credentials"
+ )
+ hasActivityFinished = true
+ }
+ return GmsCoreUtilsResult(waitingForActivityResult, hasActivityFinished)
+ }
+
+ fun handleBeginSignIn(
+ apiClient: SignInClient,
+ resultReceiver: ResultReceiver,
+ params: BeginSignInRequest?,
+ requestCode: Int,
+ activity: Activity
+ ): GmsCoreUtilsResult {
+ var waitingForActivityResult = false
+ var hasFinished = false
+ var fragment = setupFragmentActivity(activity, resultReceiver)
+
+ params?.let {
+ apiClient
+ .beginSignIn(params)
+ .addOnSuccessListener {
+ try {
+ waitingForActivityResult = true
+ startIntentSender(
+ activity,
+ it.pendingIntent.intentSender,
+ requestCode,
+ fragment,
+ )
+ } catch (e: IntentSender.SendIntentException) {
+ setupFailure(
+ resultReceiver,
+ GET_UNKNOWN,
+ "During begin sign in, one tap ui intent sender " + "failure: ${e.message}"
+ )
+ }
+ }
+ .addOnFailureListener { e: Exception ->
+ var errName: String = GET_NO_CREDENTIALS
+ if (e is ApiException && e.statusCode in CredentialProviderBaseController.retryables) {
+ errName = GET_INTERRUPTED
+ }
+ setupFailure(
+ resultReceiver,
+ errName,
+ "During begin sign in, failure response from one tap: ${e.message}"
+ )
+ }
+ }
+ ?: run {
+ Log.i(
+ TAG,
+ "During begin sign in, params is null, nothing to launch for " + "begin sign in"
+ )
+ hasFinished = true
+ }
+ return GmsCoreUtilsResult(waitingForActivityResult, hasFinished)
+ }
+
+ fun handleCreatePassword(
+ apiClient: CredentialSavingClient,
+ resultReceiver: ResultReceiver,
+ params: SavePasswordRequest?,
+ requestCode: Int,
+ activity: Activity
+ ): GmsCoreUtilsResult {
+ var waitingForActivityResult = false
+ var hasFinished = false
+ var fragment = setupFragmentActivity(activity, resultReceiver)
+
+ params?.let {
+ apiClient
+ .savePassword(params)
+ .addOnSuccessListener {
+ try {
+ waitingForActivityResult = true
+ startIntentSender(
+ activity,
+ it.pendingIntent.intentSender,
+ requestCode,
+ fragment,
+ )
+ } catch (e: IntentSender.SendIntentException) {
+ setupFailure(
+ resultReceiver,
+ CREATE_UNKNOWN,
+ "During save password, found UI intent sender " + "failure: ${e.message}"
+ )
+ }
+ }
+ .addOnFailureListener { e: Exception ->
+ var errName: String = CREATE_UNKNOWN
+ if (e is ApiException && e.statusCode in CredentialProviderBaseController.retryables) {
+ errName = CREATE_INTERRUPTED
+ }
+ setupFailure(
+ resultReceiver,
+ errName,
+ "During save password, found " + "password failure response from one tap ${e.message}"
+ )
+ }
+ }
+ ?: run {
+ Log.i(
+ TAG,
+ "During save password, params is null, nothing to launch for create" + " password"
+ )
+ hasFinished = true
+ }
+ return GmsCoreUtilsResult(waitingForActivityResult, hasFinished)
+ }
+
+ private fun setupFragmentActivity(
+ activity: Activity,
+ resultReceiver: ResultReceiver
+ ): Fragment? {
+ if (activity is FragmentActivity) {
+ val fragment = CredentialProviderFragment.createFrom(resultReceiver)
+ val manager = activity.getSupportFragmentManager()
+ manager.beginTransaction().add(fragment, "credman").commit()
+
+ if (!fragment.isAdded()) {
+ throw FragmentCreationException()
+ }
+
+ return fragment
+ }
+
+ return null
+ }
+
+ private fun startIntentSender(
+ activity: Activity,
+ intentSender: IntentSender,
+ requestCode: Int,
+ fragment: Fragment?,
+ ) {
+ if (fragment != null && fragment.isAdded() && activity is FragmentActivity) {
+ activity.startIntentSenderFromFragment(
+ fragment,
+ intentSender,
+ requestCode,
+ null,
+ 0,
+ 0,
+ 0,
+ null,
+ )
+ return
+ }
+
+ activity.startIntentSenderForResult(intentSender, requestCode, null, 0, 0, 0, null)
+ }
+
+ private fun setupFailure(resultReceiver: ResultReceiver, errName: String, errMsg: String) {
+ val bundle = Bundle()
+ bundle.putBoolean(CredentialProviderBaseController.FAILURE_RESPONSE_TAG, true)
+ bundle.putString(CredentialProviderBaseController.EXCEPTION_TYPE_TAG, errName)
+ bundle.putString(CredentialProviderBaseController.EXCEPTION_MESSAGE_TAG, errMsg)
+ resultReceiver.send(Integer.MAX_VALUE, bundle)
+ }
+ }
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/HiddenActivity.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/HiddenActivity.kt
index faf3b6f..8586305 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/HiddenActivity.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/HiddenActivity.kt
@@ -17,230 +17,150 @@
package androidx.credentials.playservices
import android.app.Activity
-import android.app.PendingIntent
import android.content.Intent
-import android.content.IntentSender
import android.os.Bundle
import android.os.ResultReceiver
import android.util.Log
import androidx.annotation.RestrictTo
import androidx.credentials.playservices.controllers.CredentialProviderBaseController
-import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.CREATE_INTERRUPTED
-import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.CREATE_UNKNOWN
-import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_INTERRUPTED
-import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_NO_CREDENTIALS
-import androidx.credentials.playservices.controllers.CredentialProviderBaseController.Companion.GET_UNKNOWN
import com.google.android.gms.auth.api.identity.BeginSignInRequest
import com.google.android.gms.auth.api.identity.Identity
import com.google.android.gms.auth.api.identity.SavePasswordRequest
-import com.google.android.gms.common.api.ApiException
import com.google.android.gms.fido.Fido
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions
-/**
- * An activity used to ensure all required API versions work as intended.
- */
+/** An activity used to ensure all required API versions work as intended. */
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Suppress("Deprecation", "ForbiddenSuperClass")
open class HiddenActivity : Activity() {
- private var resultReceiver: ResultReceiver? = null
- private var mWaitingForActivityResult = false
+ private var resultReceiver: ResultReceiver? = null
+ private var mWaitingForActivityResult = false
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- overridePendingTransition(0, 0)
- val type: String? = intent.getStringExtra(CredentialProviderBaseController.TYPE_TAG)
- resultReceiver = intent.getParcelableExtra(
- CredentialProviderBaseController.RESULT_RECEIVER_TAG)
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ overridePendingTransition(0, 0)
+ val type: String? = intent.getStringExtra(CredentialProviderBaseController.TYPE_TAG)
+ resultReceiver = intent.getParcelableExtra(CredentialProviderBaseController.RESULT_RECEIVER_TAG)
- if (resultReceiver == null) {
- finish()
- }
-
- restoreState(savedInstanceState)
- if (mWaitingForActivityResult) {
- return; // Past call still active
- }
-
- when (type) {
- CredentialProviderBaseController.BEGIN_SIGN_IN_TAG -> {
- handleBeginSignIn()
- }
- CredentialProviderBaseController.CREATE_PASSWORD_TAG -> {
- handleCreatePassword()
- }
- CredentialProviderBaseController.CREATE_PUBLIC_KEY_CREDENTIAL_TAG -> {
- handleCreatePublicKeyCredential()
- } else -> {
- Log.w(TAG, "Activity handed an unsupported type")
- finish()
- }
- }
+ if (resultReceiver == null) {
+ finish()
}
- private fun restoreState(savedInstanceState: Bundle?) {
- if (savedInstanceState != null) {
- mWaitingForActivityResult = savedInstanceState.getBoolean(KEY_AWAITING_RESULT, false)
- }
+ restoreState(savedInstanceState)
+ if (mWaitingForActivityResult) {
+ return
+ // Past call still active
}
- private fun handleCreatePublicKeyCredential() {
- val fidoRegistrationRequest: PublicKeyCredentialCreationOptions? = intent
- .getParcelableExtra(CredentialProviderBaseController.REQUEST_TAG)
- val requestCode: Int = intent.getIntExtra(
- CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG,
- DEFAULT_VALUE)
- fidoRegistrationRequest?.let {
- Fido.getFido2ApiClient(this)
- .getRegisterPendingIntent(fidoRegistrationRequest)
- .addOnSuccessListener { result: PendingIntent ->
- try {
- mWaitingForActivityResult = true
- startIntentSenderForResult(
- result.intentSender,
- requestCode,
- null, /* fillInIntent= */
- 0, /* flagsMask= */
- 0, /* flagsValue= */
- 0, /* extraFlags= */
- null /* options= */
- )
- } catch (e: IntentSender.SendIntentException) {
- setupFailure(resultReceiver!!,
- CREATE_UNKNOWN,
- "During public key credential, found IntentSender " +
- "failure on public key creation: ${e.message}")
- }
- }
- .addOnFailureListener { e: Exception ->
- var errName: String = CREATE_UNKNOWN
- if (e is ApiException && e.statusCode in
- CredentialProviderBaseController.retryables) {
- errName = CREATE_INTERRUPTED
- }
- setupFailure(resultReceiver!!, errName,
- "During create public key credential, fido registration " +
- "failure: ${e.message}")
- }
- } ?: run {
- Log.w(TAG, "During create public key credential, request is null, so nothing to " +
- "launch for public key credentials")
- finish()
- }
- }
-
- private fun setupFailure(resultReceiver: ResultReceiver, errName: String, errMsg: String) {
- val bundle = Bundle()
- bundle.putBoolean(CredentialProviderBaseController.FAILURE_RESPONSE_TAG, true)
- bundle.putString(CredentialProviderBaseController.EXCEPTION_TYPE_TAG, errName)
- bundle.putString(CredentialProviderBaseController.EXCEPTION_MESSAGE_TAG, errMsg)
- resultReceiver.send(Integer.MAX_VALUE, bundle)
+ when (type) {
+ CredentialProviderBaseController.BEGIN_SIGN_IN_TAG -> {
+ handleBeginSignIn(intent, resultReceiver)
+ }
+ CredentialProviderBaseController.CREATE_PASSWORD_TAG -> {
+ handleCreatePassword(intent, resultReceiver)
+ }
+ CredentialProviderBaseController.CREATE_PUBLIC_KEY_CREDENTIAL_TAG -> {
+ handleCreatePublicKeyCredential(intent, resultReceiver)
+ }
+ else -> {
+ Log.w(TAG, "Activity handed an unsupported type")
finish()
+ }
}
+ }
- override fun onSaveInstanceState(outState: Bundle) {
- outState.putBoolean(KEY_AWAITING_RESULT, mWaitingForActivityResult)
- super.onSaveInstanceState(outState)
+ private fun restoreState(savedInstanceState: Bundle?) {
+ if (savedInstanceState != null) {
+ mWaitingForActivityResult = savedInstanceState.getBoolean(KEY_AWAITING_RESULT, false)
}
+ }
- private fun handleBeginSignIn() {
- val params: BeginSignInRequest? = intent.getParcelableExtra(
- CredentialProviderBaseController.REQUEST_TAG)
- val requestCode: Int = intent.getIntExtra(
- CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG,
- DEFAULT_VALUE)
- params?.let {
- Identity.getSignInClient(this).beginSignIn(params).addOnSuccessListener {
- try {
- mWaitingForActivityResult = true
- startIntentSenderForResult(
- it.pendingIntent.intentSender,
- requestCode,
- null,
- 0,
- 0,
- 0,
- null
- )
- } catch (e: IntentSender.SendIntentException) {
- setupFailure(resultReceiver!!,
- GET_UNKNOWN,
- "During begin sign in, one tap ui intent sender " +
- "failure: ${e.message}")
- }
- }.addOnFailureListener { e: Exception ->
- var errName: String = GET_NO_CREDENTIALS
- if (e is ApiException && e.statusCode in
- CredentialProviderBaseController.retryables) {
- errName = GET_INTERRUPTED
- }
- setupFailure(resultReceiver!!, errName,
- "During begin sign in, failure response from one tap: ${e.message}")
- }
- } ?: run {
- Log.i(TAG, "During begin sign in, params is null, nothing to launch for " +
- "begin sign in")
- finish()
- }
- }
+ private fun handleBeginSignIn(intent: Intent, resultReceiver: ResultReceiver?) {
+ val params: BeginSignInRequest? =
+ intent.getParcelableExtra(CredentialProviderBaseController.REQUEST_TAG)
+ val requestCode: Int =
+ intent.getIntExtra(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, DEFAULT_VALUE)
- private fun handleCreatePassword() {
- val params: SavePasswordRequest? = intent.getParcelableExtra(
- CredentialProviderBaseController.REQUEST_TAG)
- val requestCode: Int = intent.getIntExtra(
- CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG,
- DEFAULT_VALUE)
- params?.let {
- Identity.getCredentialSavingClient(this).savePassword(params)
- .addOnSuccessListener {
- try {
- mWaitingForActivityResult = true
- startIntentSenderForResult(
- it.pendingIntent.intentSender,
- requestCode,
- null,
- 0,
- 0,
- 0,
- null
- )
- } catch (e: IntentSender.SendIntentException) {
- setupFailure(resultReceiver!!,
- CREATE_UNKNOWN,
- "During save password, found UI intent sender " +
- "failure: ${e.message}")
- }
- }.addOnFailureListener { e: Exception ->
- var errName: String = CREATE_UNKNOWN
- if (e is ApiException && e.statusCode in
- CredentialProviderBaseController.retryables) {
- errName = CREATE_INTERRUPTED
- }
- setupFailure(resultReceiver!!, errName, "During save password, found " +
- "password failure response from one tap ${e.message}")
- }
- } ?: run {
- Log.i(TAG, "During save password, params is null, nothing to launch for create" +
- " password")
- finish()
- }
- }
-
- override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
- super.onActivityResult(requestCode, resultCode, data)
- val bundle = Bundle()
- bundle.putBoolean(CredentialProviderBaseController.FAILURE_RESPONSE_TAG, false)
- bundle.putInt(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, requestCode)
- bundle.putParcelable(CredentialProviderBaseController.RESULT_DATA_TAG, data)
- resultReceiver?.send(resultCode, bundle)
- mWaitingForActivityResult = false
+ if (intent.hasExtra(CredentialProviderBaseController.REQUEST_TAG) && resultReceiver != null) {
+ val result =
+ GmsCoreUtils.handleBeginSignIn(
+ Identity.getSignInClient(this),
+ resultReceiver,
+ params!!,
+ requestCode,
+ this
+ )
+ mWaitingForActivityResult = result.waitingForActivityResult
+ if (result.hasFinished) {
finish()
+ }
}
+ }
- companion object {
- private const val DEFAULT_VALUE: Int = 1
- private const val TAG = "HiddenActivity"
- private const val KEY_AWAITING_RESULT = "androidx.credentials.playservices.AWAITING_RESULT"
+ private fun handleCreatePassword(intent: Intent, resultReceiver: ResultReceiver?) {
+ val params: SavePasswordRequest? =
+ intent.getParcelableExtra(CredentialProviderBaseController.REQUEST_TAG)
+ val requestCode: Int =
+ intent.getIntExtra(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, DEFAULT_VALUE)
+
+ if (intent.hasExtra(CredentialProviderBaseController.REQUEST_TAG) && resultReceiver != null) {
+ val result =
+ GmsCoreUtils.handleCreatePassword(
+ Identity.getCredentialSavingClient(this),
+ resultReceiver,
+ params!!,
+ requestCode,
+ this
+ )
+ mWaitingForActivityResult = result.waitingForActivityResult
+ if (result.hasFinished) {
+ finish()
+ }
}
-}
\ No newline at end of file
+ }
+
+ private fun handleCreatePublicKeyCredential(intent: Intent, resultReceiver: ResultReceiver?) {
+ val fidoRegistrationRequest: PublicKeyCredentialCreationOptions? =
+ intent.getParcelableExtra(CredentialProviderBaseController.REQUEST_TAG)
+ val requestCode: Int =
+ intent.getIntExtra(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, DEFAULT_VALUE)
+
+ if (intent.hasExtra(CredentialProviderBaseController.REQUEST_TAG) && resultReceiver != null) {
+ val result =
+ GmsCoreUtils.handleCreatePublicKeyCredential(
+ Fido.getFido2ApiClient(this),
+ resultReceiver,
+ fidoRegistrationRequest!!,
+ requestCode,
+ this
+ )
+ mWaitingForActivityResult = result.waitingForActivityResult
+ if (result.hasFinished) {
+ finish()
+ }
+ }
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ outState.putBoolean(KEY_AWAITING_RESULT, mWaitingForActivityResult)
+ super.onSaveInstanceState(outState)
+ }
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ val bundle = Bundle()
+ bundle.putBoolean(CredentialProviderBaseController.FAILURE_RESPONSE_TAG, false)
+ bundle.putInt(CredentialProviderBaseController.ACTIVITY_REQUEST_CODE_TAG, requestCode)
+ bundle.putParcelable(CredentialProviderBaseController.RESULT_DATA_TAG, data)
+ resultReceiver?.send(resultCode, bundle)
+ mWaitingForActivityResult = false
+ finish()
+ }
+
+ companion object {
+ private const val DEFAULT_VALUE: Int = 1
+ private const val TAG = "HiddenActivity"
+ private const val KEY_AWAITING_RESULT = "androidx.credentials.playservices.AWAITING_RESULT"
+ }
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/BeginSignIn/CredentialProviderBeginSignInController.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/BeginSignIn/CredentialProviderBeginSignInController.kt
index b0d9453..18f8a16 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/BeginSignIn/CredentialProviderBeginSignInController.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/BeginSignIn/CredentialProviderBeginSignInController.kt
@@ -36,11 +36,13 @@
import androidx.credentials.exceptions.GetCredentialInterruptedException
import androidx.credentials.exceptions.GetCredentialUnknownException
import androidx.credentials.playservices.CredentialProviderPlayServicesImpl
+import androidx.credentials.playservices.GmsCoreUtils
import androidx.credentials.playservices.HiddenActivity
import androidx.credentials.playservices.controllers.BeginSignIn.BeginSignInControllerUtility.Companion.constructBeginSignInRequest
import androidx.credentials.playservices.controllers.CreatePublicKeyCredential.PublicKeyCredentialControllerUtility
import androidx.credentials.playservices.controllers.CredentialProviderBaseController
import androidx.credentials.playservices.controllers.CredentialProviderController
+import androidx.fragment.app.FragmentActivity
import com.google.android.gms.auth.api.identity.BeginSignInRequest
import com.google.android.gms.auth.api.identity.Identity
import com.google.android.gms.auth.api.identity.SignInCredential
@@ -117,6 +119,20 @@
}
val convertedRequest: BeginSignInRequest = this.convertRequestToPlayServices(request)
+
+ // If we were passed a fragment activity use that instead of a hidden one.
+ if (context is FragmentActivity) {
+ try {
+ GmsCoreUtils.handleBeginSignIn(
+ Identity.getSignInClient(context),
+ resultReceiver, convertedRequest, GmsCoreUtils.DEFAULT_REQUEST_CODE,
+ context)
+ return
+ } catch (e: Exception) {
+ Log.e(TAG, "Failed to use fragment flow", e)
+ }
+ }
+
val hiddenIntent = Intent(context, HiddenActivity::class.java)
hiddenIntent.putExtra(REQUEST_TAG, convertedRequest)
generateHiddenActivityIntent(resultReceiver, hiddenIntent, BEGIN_SIGN_IN_TAG)
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePassword/CredentialProviderCreatePasswordController.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePassword/CredentialProviderCreatePasswordController.kt
index 360b0c6..ee4c3bb 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePassword/CredentialProviderCreatePasswordController.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePassword/CredentialProviderCreatePasswordController.kt
@@ -32,9 +32,12 @@
import androidx.credentials.exceptions.CreateCredentialException
import androidx.credentials.exceptions.CreateCredentialUnknownException
import androidx.credentials.playservices.CredentialProviderPlayServicesImpl
+import androidx.credentials.playservices.GmsCoreUtils
import androidx.credentials.playservices.HiddenActivity
import androidx.credentials.playservices.controllers.CredentialProviderBaseController
import androidx.credentials.playservices.controllers.CredentialProviderController
+import androidx.fragment.app.FragmentActivity
+import com.google.android.gms.auth.api.identity.Identity
import com.google.android.gms.auth.api.identity.SavePasswordRequest
import com.google.android.gms.auth.api.identity.SignInPassword
import java.util.concurrent.Executor
@@ -100,6 +103,20 @@
}
val convertedRequest: SavePasswordRequest = this.convertRequestToPlayServices(request)
+
+ // If we were passed a fragment activity use that instead of a hidden one.
+ if (context is FragmentActivity) {
+ try {
+ GmsCoreUtils.handleCreatePassword(
+ Identity.getCredentialSavingClient(context),
+ resultReceiver, convertedRequest, GmsCoreUtils.DEFAULT_REQUEST_CODE,
+ context)
+ return
+ } catch (e: Exception) {
+ Log.e(TAG, "Failed to use fragment flow", e)
+ }
+ }
+
val hiddenIntent = Intent(context, HiddenActivity::class.java)
hiddenIntent.putExtra(REQUEST_TAG, convertedRequest)
generateHiddenActivityIntent(resultReceiver, hiddenIntent, CREATE_PASSWORD_TAG)
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/CredentialProviderCreatePublicKeyCredentialController.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/CredentialProviderCreatePublicKeyCredentialController.kt
index 7f3a269..a3d614a 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/CredentialProviderCreatePublicKeyCredentialController.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/CredentialProviderCreatePublicKeyCredentialController.kt
@@ -35,9 +35,11 @@
import androidx.credentials.exceptions.domerrors.UnknownError
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException
import androidx.credentials.playservices.CredentialProviderPlayServicesImpl
+import androidx.credentials.playservices.GmsCoreUtils
import androidx.credentials.playservices.HiddenActivity
import androidx.credentials.playservices.controllers.CredentialProviderBaseController
import androidx.credentials.playservices.controllers.CredentialProviderController
+import androidx.fragment.app.FragmentActivity
import com.google.android.gms.fido.Fido
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredential
import com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialCreationOptions
@@ -106,10 +108,9 @@
try {
fidoRegistrationRequest = this.convertRequestToPlayServices(request)
} catch (e: JSONException) {
- // TODO(b/262924507) : Perfect error code parsing and pass-back
cancelOrCallbackExceptionOrResult(cancellationSignal) { this.executor.execute {
- this.callback
- .onError(CreatePublicKeyCredentialDomException(EncodingError(), e.message)) } }
+ this.callback.onError(JSONExceptionToPKCError(e))
+ } }
return
} catch (t: Throwable) {
cancelOrCallbackExceptionOrResult(cancellationSignal) { this.executor.execute {
@@ -120,6 +121,19 @@
if (CredentialProviderPlayServicesImpl.cancellationReviewer(cancellationSignal)) {
return
}
+
+ // If we were passed a fragment activity use that instead of a hidden one.
+ if (context is FragmentActivity) {
+ try {
+ GmsCoreUtils.handleCreatePublicKeyCredential(Fido.getFido2ApiClient(context),
+ resultReceiver, fidoRegistrationRequest, GmsCoreUtils.DEFAULT_REQUEST_CODE,
+ context)
+ return
+ } catch (e: Exception) {
+ Log.e(TAG, "Failed to use fragment flow", e)
+ }
+ }
+
val hiddenIntent = Intent(context, HiddenActivity::class.java)
hiddenIntent.putExtra(REQUEST_TAG, fidoRegistrationRequest)
generateHiddenActivityIntent(resultReceiver, hiddenIntent,
@@ -191,6 +205,15 @@
.toCreatePasskeyResponseJson(response))
}
+ private fun JSONExceptionToPKCError(exception: JSONException):
+ CreatePublicKeyCredentialDomException {
+ val myCopy: String? = exception.message
+ if (myCopy != null && myCopy.length > 0) {
+ return CreatePublicKeyCredentialDomException(EncodingError(), myCopy)
+ }
+ return CreatePublicKeyCredentialDomException(EncodingError(), "Unknown error")
+ }
+
companion object {
private const val TAG = "CreatePublicKey"
private var controller: CredentialProviderCreatePublicKeyCredentialController? = null
@@ -213,4 +236,4 @@
return controller!!
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/PublicKeyCredentialControllerUtility.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/PublicKeyCredentialControllerUtility.kt
index 07d63b1..c7701c6 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/PublicKeyCredentialControllerUtility.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CreatePublicKeyCredential/PublicKeyCredentialControllerUtility.kt
@@ -294,7 +294,8 @@
val json = JSONObject(option.requestJson)
val rpId = json.optString(JSON_KEY_RPID, "")
if (rpId.isEmpty()) {
- throw JSONException("GetPublicKeyCredentialOption - rpId not specified in the " +
+ throw JSONException(
+ "GetPublicKeyCredentialOption - rpId not specified in the " +
"request or is unexpectedly empty")
}
val challenge = getChallenge(json)
@@ -308,7 +309,8 @@
private fun getChallenge(json: JSONObject): ByteArray {
val challengeB64 = json.optString(JSON_KEY_CHALLENGE, "")
if (challengeB64.isEmpty()) {
- throw JSONException("Challenge not found in request or is unexpectedly empty")
+ throw JSONException(
+ "Challenge not found in request or is unexpectedly empty")
}
return b64Decode(challengeB64)
}
@@ -464,8 +466,14 @@
val descriptorJSON = pubKeyDescriptorJSONs.getJSONObject(i)
val descriptorId = b64Decode(descriptorJSON.getString(JSON_KEY_ID))
val descriptorType = descriptorJSON.getString(JSON_KEY_TYPE)
- if (descriptorId.isEmpty() || descriptorType.isEmpty()) {
- throw JSONException("PublicKeyCredentialDescriptor id or type value not " +
+ if (descriptorType.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialDescriptor type value is not " +
+ "found or unexpectedly empty")
+ }
+ if (descriptorId.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialDescriptor id value is not " +
"found or unexpectedly empty")
}
var transports: MutableList<Transport>? = null
@@ -516,8 +524,14 @@
if (rpIcon!!.isEmpty()) {
rpIcon = null
}
- if (rpName.isEmpty() || rpId.isEmpty()) {
- throw JSONException("PublicKeyCredentialCreationOptions rp ID or rp name are " +
+ if (rpName.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions rp name is " +
+ "missing or unexpectedly empty")
+ }
+ if (rpId.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions rp ID is " +
"missing or unexpectedly empty")
}
builder.setRp(
@@ -535,7 +549,8 @@
val paramAlg = param.getLong(JSON_KEY_ALG).toInt()
val typeParam = param.optString(JSON_KEY_TYPE, "")
if (typeParam.isEmpty()) {
- throw JSONException("PublicKeyCredentialCreationOptions " +
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions " +
"PublicKeyCredentialParameter type missing or unexpectedly empty")
}
if (checkAlgSupported(paramAlg)) {
@@ -558,9 +573,20 @@
val userName = user.getString(JSON_KEY_NAME)
val displayName = user.getString(JSON_KEY_DISPLAY_NAME)
val userIcon = user.optString(JSON_KEY_ICON, "")
- if (displayName.isEmpty() || userId.isEmpty() || userName.isEmpty()) {
- throw JSONException("PublicKeyCredentialCreationOptions UserEntity missing one " +
- "or more of displayName, userId or userName, or they are unexpectedly empty")
+ if (displayName.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions UserEntity missing " +
+ "displayName or they are unexpectedly empty")
+ }
+ if (userId.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions UserEntity missing " +
+ "user id or they are unexpectedly empty")
+ }
+ if (userName.isEmpty()) {
+ throw JSONException(
+ "PublicKeyCredentialCreationOptions UserEntity missing " +
+ "user name or they are unexpectedly empty")
}
builder.setUser(
PublicKeyCredentialUserEntity(
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderBaseController.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderBaseController.kt
index fad0c4c..3040f9d 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderBaseController.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderBaseController.kt
@@ -59,7 +59,7 @@
const val CREATE_INTERRUPTED = "CREATE_INTERRUPTED"
const val CREATE_UNKNOWN = "CREATE_UNKNOWN"
- /** ---- Data Constants to pass between the controllers and the hidden activity---- **/
+ /** ---- Data Constants to pass between the controllers and the hidden activity---- */
// Key to indicate type sent from controller to hidden activity
const val TYPE_TAG = "TYPE"
@@ -154,4 +154,4 @@
toIpcFriendlyResultReceiver(resultReceiver))
hiddenIntent.flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderController.kt b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderController.kt
index 30a857d..be39533 100644
--- a/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderController.kt
+++ b/credentials/credentials-play-services-auth/src/main/java/androidx/credentials/playservices/controllers/CredentialProviderController.kt
@@ -194,4 +194,4 @@
* @return a credential provider response
*/
protected abstract fun convertResponseToCredentialManager(response: R2): R1
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/api/1.2.0-beta01.txt b/credentials/credentials/api/1.2.0-beta01.txt
index 3a1d7df..7271bca 100644
--- a/credentials/credentials/api/1.2.0-beta01.txt
+++ b/credentials/credentials/api/1.2.0-beta01.txt
@@ -243,9 +243,9 @@
@VisibleForTesting public static final class PrepareGetCredentialResponse.TestBuilder {
ctor public PrepareGetCredentialResponse.TestBuilder();
method public androidx.credentials.PrepareGetCredentialResponse build();
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
}
public final class PublicKeyCredential extends androidx.credentials.Credential {
@@ -263,6 +263,13 @@
package androidx.credentials.exceptions {
+ public final class ClearCredentialCustomException extends androidx.credentials.exceptions.ClearCredentialException {
+ ctor public ClearCredentialCustomException(String type);
+ ctor public ClearCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class ClearCredentialException extends java.lang.Exception {
}
@@ -286,18 +293,18 @@
ctor public ClearCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class ClearCustomCredentialException extends androidx.credentials.exceptions.ClearCredentialException {
- ctor public ClearCustomCredentialException(String type);
- ctor public ClearCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class CreateCredentialCancellationException extends androidx.credentials.exceptions.CreateCredentialException {
ctor public CreateCredentialCancellationException();
ctor public CreateCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class CreateCredentialCustomException extends androidx.credentials.exceptions.CreateCredentialException {
+ ctor public CreateCredentialCustomException(String type);
+ ctor public CreateCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class CreateCredentialException extends java.lang.Exception {
}
@@ -326,18 +333,18 @@
ctor public CreateCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class CreateCustomCredentialException extends androidx.credentials.exceptions.CreateCredentialException {
- ctor public CreateCustomCredentialException(String type);
- ctor public CreateCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class GetCredentialCancellationException extends androidx.credentials.exceptions.GetCredentialException {
ctor public GetCredentialCancellationException();
ctor public GetCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class GetCredentialCustomException extends androidx.credentials.exceptions.GetCredentialException {
+ ctor public GetCredentialCustomException(String type);
+ ctor public GetCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class GetCredentialException extends java.lang.Exception {
}
@@ -361,13 +368,6 @@
ctor public GetCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class GetCustomCredentialException extends androidx.credentials.exceptions.GetCredentialException {
- ctor public GetCustomCredentialException(String type);
- ctor public GetCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class NoCredentialException extends androidx.credentials.exceptions.GetCredentialException {
ctor public NoCredentialException();
ctor public NoCredentialException(optional CharSequence? errorMessage);
@@ -607,6 +607,7 @@
public final class BeginCreatePublicKeyCredentialRequest extends androidx.credentials.provider.BeginCreateCredentialRequest {
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData);
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData, optional byte[]? clientDataHash);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginCreatePublicKeyCredentialRequest createForTest(android.os.Bundle data, androidx.credentials.provider.CallingAppInfo? callingAppInfo);
method public byte[]? getClientDataHash();
method public String getRequestJson();
property public final byte[]? clientDataHash;
@@ -677,6 +678,7 @@
public final class BeginGetPasswordOption extends androidx.credentials.provider.BeginGetCredentialOption {
ctor public BeginGetPasswordOption(java.util.Set<java.lang.String> allowedUserIds, android.os.Bundle candidateQueryData, String id);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginGetPasswordOption createForTest(android.os.Bundle data, String id);
method public java.util.Set<java.lang.String> getAllowedUserIds();
property public final java.util.Set<java.lang.String> allowedUserIds;
}
@@ -693,10 +695,9 @@
public final class CallingAppInfo {
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo);
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo, optional String? origin);
- method public String? getOrigin();
+ method public String? getOrigin(String privilegedAllowlist);
method public String getPackageName();
method public android.content.pm.SigningInfo getSigningInfo();
- property public final String? origin;
property public final String packageName;
property public final android.content.pm.SigningInfo signingInfo;
}
diff --git a/credentials/credentials/api/current.ignore b/credentials/credentials/api/current.ignore
new file mode 100644
index 0000000..14f41da
--- /dev/null
+++ b/credentials/credentials/api/current.ignore
@@ -0,0 +1,15 @@
+// Baseline format: 1.0
+AddedClass: androidx.credentials.exceptions.ClearCredentialCustomException:
+ Added class androidx.credentials.exceptions.ClearCredentialCustomException
+AddedClass: androidx.credentials.exceptions.CreateCredentialCustomException:
+ Added class androidx.credentials.exceptions.CreateCredentialCustomException
+AddedClass: androidx.credentials.exceptions.GetCredentialCustomException:
+ Added class androidx.credentials.exceptions.GetCredentialCustomException
+
+
+RemovedClass: androidx.credentials.exceptions.ClearCustomCredentialException:
+ Removed class androidx.credentials.exceptions.ClearCustomCredentialException
+RemovedClass: androidx.credentials.exceptions.CreateCustomCredentialException:
+ Removed class androidx.credentials.exceptions.CreateCustomCredentialException
+RemovedClass: androidx.credentials.exceptions.GetCustomCredentialException:
+ Removed class androidx.credentials.exceptions.GetCustomCredentialException
diff --git a/credentials/credentials/api/current.txt b/credentials/credentials/api/current.txt
index 3a1d7df..7271bca 100644
--- a/credentials/credentials/api/current.txt
+++ b/credentials/credentials/api/current.txt
@@ -243,9 +243,9 @@
@VisibleForTesting public static final class PrepareGetCredentialResponse.TestBuilder {
ctor public PrepareGetCredentialResponse.TestBuilder();
method public androidx.credentials.PrepareGetCredentialResponse build();
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
}
public final class PublicKeyCredential extends androidx.credentials.Credential {
@@ -263,6 +263,13 @@
package androidx.credentials.exceptions {
+ public final class ClearCredentialCustomException extends androidx.credentials.exceptions.ClearCredentialException {
+ ctor public ClearCredentialCustomException(String type);
+ ctor public ClearCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class ClearCredentialException extends java.lang.Exception {
}
@@ -286,18 +293,18 @@
ctor public ClearCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class ClearCustomCredentialException extends androidx.credentials.exceptions.ClearCredentialException {
- ctor public ClearCustomCredentialException(String type);
- ctor public ClearCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class CreateCredentialCancellationException extends androidx.credentials.exceptions.CreateCredentialException {
ctor public CreateCredentialCancellationException();
ctor public CreateCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class CreateCredentialCustomException extends androidx.credentials.exceptions.CreateCredentialException {
+ ctor public CreateCredentialCustomException(String type);
+ ctor public CreateCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class CreateCredentialException extends java.lang.Exception {
}
@@ -326,18 +333,18 @@
ctor public CreateCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class CreateCustomCredentialException extends androidx.credentials.exceptions.CreateCredentialException {
- ctor public CreateCustomCredentialException(String type);
- ctor public CreateCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class GetCredentialCancellationException extends androidx.credentials.exceptions.GetCredentialException {
ctor public GetCredentialCancellationException();
ctor public GetCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class GetCredentialCustomException extends androidx.credentials.exceptions.GetCredentialException {
+ ctor public GetCredentialCustomException(String type);
+ ctor public GetCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class GetCredentialException extends java.lang.Exception {
}
@@ -361,13 +368,6 @@
ctor public GetCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class GetCustomCredentialException extends androidx.credentials.exceptions.GetCredentialException {
- ctor public GetCustomCredentialException(String type);
- ctor public GetCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class NoCredentialException extends androidx.credentials.exceptions.GetCredentialException {
ctor public NoCredentialException();
ctor public NoCredentialException(optional CharSequence? errorMessage);
@@ -607,6 +607,7 @@
public final class BeginCreatePublicKeyCredentialRequest extends androidx.credentials.provider.BeginCreateCredentialRequest {
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData);
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData, optional byte[]? clientDataHash);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginCreatePublicKeyCredentialRequest createForTest(android.os.Bundle data, androidx.credentials.provider.CallingAppInfo? callingAppInfo);
method public byte[]? getClientDataHash();
method public String getRequestJson();
property public final byte[]? clientDataHash;
@@ -677,6 +678,7 @@
public final class BeginGetPasswordOption extends androidx.credentials.provider.BeginGetCredentialOption {
ctor public BeginGetPasswordOption(java.util.Set<java.lang.String> allowedUserIds, android.os.Bundle candidateQueryData, String id);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginGetPasswordOption createForTest(android.os.Bundle data, String id);
method public java.util.Set<java.lang.String> getAllowedUserIds();
property public final java.util.Set<java.lang.String> allowedUserIds;
}
@@ -693,10 +695,9 @@
public final class CallingAppInfo {
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo);
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo, optional String? origin);
- method public String? getOrigin();
+ method public String? getOrigin(String privilegedAllowlist);
method public String getPackageName();
method public android.content.pm.SigningInfo getSigningInfo();
- property public final String? origin;
property public final String packageName;
property public final android.content.pm.SigningInfo signingInfo;
}
diff --git a/credentials/credentials/api/restricted_1.2.0-beta01.txt b/credentials/credentials/api/restricted_1.2.0-beta01.txt
index 3a1d7df..7271bca 100644
--- a/credentials/credentials/api/restricted_1.2.0-beta01.txt
+++ b/credentials/credentials/api/restricted_1.2.0-beta01.txt
@@ -243,9 +243,9 @@
@VisibleForTesting public static final class PrepareGetCredentialResponse.TestBuilder {
ctor public PrepareGetCredentialResponse.TestBuilder();
method public androidx.credentials.PrepareGetCredentialResponse build();
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
}
public final class PublicKeyCredential extends androidx.credentials.Credential {
@@ -263,6 +263,13 @@
package androidx.credentials.exceptions {
+ public final class ClearCredentialCustomException extends androidx.credentials.exceptions.ClearCredentialException {
+ ctor public ClearCredentialCustomException(String type);
+ ctor public ClearCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class ClearCredentialException extends java.lang.Exception {
}
@@ -286,18 +293,18 @@
ctor public ClearCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class ClearCustomCredentialException extends androidx.credentials.exceptions.ClearCredentialException {
- ctor public ClearCustomCredentialException(String type);
- ctor public ClearCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class CreateCredentialCancellationException extends androidx.credentials.exceptions.CreateCredentialException {
ctor public CreateCredentialCancellationException();
ctor public CreateCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class CreateCredentialCustomException extends androidx.credentials.exceptions.CreateCredentialException {
+ ctor public CreateCredentialCustomException(String type);
+ ctor public CreateCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class CreateCredentialException extends java.lang.Exception {
}
@@ -326,18 +333,18 @@
ctor public CreateCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class CreateCustomCredentialException extends androidx.credentials.exceptions.CreateCredentialException {
- ctor public CreateCustomCredentialException(String type);
- ctor public CreateCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class GetCredentialCancellationException extends androidx.credentials.exceptions.GetCredentialException {
ctor public GetCredentialCancellationException();
ctor public GetCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class GetCredentialCustomException extends androidx.credentials.exceptions.GetCredentialException {
+ ctor public GetCredentialCustomException(String type);
+ ctor public GetCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class GetCredentialException extends java.lang.Exception {
}
@@ -361,13 +368,6 @@
ctor public GetCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class GetCustomCredentialException extends androidx.credentials.exceptions.GetCredentialException {
- ctor public GetCustomCredentialException(String type);
- ctor public GetCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class NoCredentialException extends androidx.credentials.exceptions.GetCredentialException {
ctor public NoCredentialException();
ctor public NoCredentialException(optional CharSequence? errorMessage);
@@ -607,6 +607,7 @@
public final class BeginCreatePublicKeyCredentialRequest extends androidx.credentials.provider.BeginCreateCredentialRequest {
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData);
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData, optional byte[]? clientDataHash);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginCreatePublicKeyCredentialRequest createForTest(android.os.Bundle data, androidx.credentials.provider.CallingAppInfo? callingAppInfo);
method public byte[]? getClientDataHash();
method public String getRequestJson();
property public final byte[]? clientDataHash;
@@ -677,6 +678,7 @@
public final class BeginGetPasswordOption extends androidx.credentials.provider.BeginGetCredentialOption {
ctor public BeginGetPasswordOption(java.util.Set<java.lang.String> allowedUserIds, android.os.Bundle candidateQueryData, String id);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginGetPasswordOption createForTest(android.os.Bundle data, String id);
method public java.util.Set<java.lang.String> getAllowedUserIds();
property public final java.util.Set<java.lang.String> allowedUserIds;
}
@@ -693,10 +695,9 @@
public final class CallingAppInfo {
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo);
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo, optional String? origin);
- method public String? getOrigin();
+ method public String? getOrigin(String privilegedAllowlist);
method public String getPackageName();
method public android.content.pm.SigningInfo getSigningInfo();
- property public final String? origin;
property public final String packageName;
property public final android.content.pm.SigningInfo signingInfo;
}
diff --git a/credentials/credentials/api/restricted_current.ignore b/credentials/credentials/api/restricted_current.ignore
new file mode 100644
index 0000000..14f41da
--- /dev/null
+++ b/credentials/credentials/api/restricted_current.ignore
@@ -0,0 +1,15 @@
+// Baseline format: 1.0
+AddedClass: androidx.credentials.exceptions.ClearCredentialCustomException:
+ Added class androidx.credentials.exceptions.ClearCredentialCustomException
+AddedClass: androidx.credentials.exceptions.CreateCredentialCustomException:
+ Added class androidx.credentials.exceptions.CreateCredentialCustomException
+AddedClass: androidx.credentials.exceptions.GetCredentialCustomException:
+ Added class androidx.credentials.exceptions.GetCredentialCustomException
+
+
+RemovedClass: androidx.credentials.exceptions.ClearCustomCredentialException:
+ Removed class androidx.credentials.exceptions.ClearCustomCredentialException
+RemovedClass: androidx.credentials.exceptions.CreateCustomCredentialException:
+ Removed class androidx.credentials.exceptions.CreateCustomCredentialException
+RemovedClass: androidx.credentials.exceptions.GetCustomCredentialException:
+ Removed class androidx.credentials.exceptions.GetCustomCredentialException
diff --git a/credentials/credentials/api/restricted_current.txt b/credentials/credentials/api/restricted_current.txt
index 3a1d7df..7271bca 100644
--- a/credentials/credentials/api/restricted_current.txt
+++ b/credentials/credentials/api/restricted_current.txt
@@ -243,9 +243,9 @@
@VisibleForTesting public static final class PrepareGetCredentialResponse.TestBuilder {
ctor public PrepareGetCredentialResponse.TestBuilder();
method public androidx.credentials.PrepareGetCredentialResponse build();
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
- method public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setCredentialTypeDelegate(kotlin.jvm.functions.Function1<? super java.lang.String,java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasAuthResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
+ method @VisibleForTesting public androidx.credentials.PrepareGetCredentialResponse.TestBuilder setHasRemoteResultsDelegate(kotlin.jvm.functions.Function0<java.lang.Boolean> handler);
}
public final class PublicKeyCredential extends androidx.credentials.Credential {
@@ -263,6 +263,13 @@
package androidx.credentials.exceptions {
+ public final class ClearCredentialCustomException extends androidx.credentials.exceptions.ClearCredentialException {
+ ctor public ClearCredentialCustomException(String type);
+ ctor public ClearCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class ClearCredentialException extends java.lang.Exception {
}
@@ -286,18 +293,18 @@
ctor public ClearCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class ClearCustomCredentialException extends androidx.credentials.exceptions.ClearCredentialException {
- ctor public ClearCustomCredentialException(String type);
- ctor public ClearCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class CreateCredentialCancellationException extends androidx.credentials.exceptions.CreateCredentialException {
ctor public CreateCredentialCancellationException();
ctor public CreateCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class CreateCredentialCustomException extends androidx.credentials.exceptions.CreateCredentialException {
+ ctor public CreateCredentialCustomException(String type);
+ ctor public CreateCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class CreateCredentialException extends java.lang.Exception {
}
@@ -326,18 +333,18 @@
ctor public CreateCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class CreateCustomCredentialException extends androidx.credentials.exceptions.CreateCredentialException {
- ctor public CreateCustomCredentialException(String type);
- ctor public CreateCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class GetCredentialCancellationException extends androidx.credentials.exceptions.GetCredentialException {
ctor public GetCredentialCancellationException();
ctor public GetCredentialCancellationException(optional CharSequence? errorMessage);
}
+ public final class GetCredentialCustomException extends androidx.credentials.exceptions.GetCredentialException {
+ ctor public GetCredentialCustomException(String type);
+ ctor public GetCredentialCustomException(String type, optional CharSequence? errorMessage);
+ method public String getType();
+ property public String type;
+ }
+
public abstract class GetCredentialException extends java.lang.Exception {
}
@@ -361,13 +368,6 @@
ctor public GetCredentialUnsupportedException(optional CharSequence? errorMessage);
}
- public final class GetCustomCredentialException extends androidx.credentials.exceptions.GetCredentialException {
- ctor public GetCustomCredentialException(String type);
- ctor public GetCustomCredentialException(String type, optional CharSequence? errorMessage);
- method public String getType();
- property public String type;
- }
-
public final class NoCredentialException extends androidx.credentials.exceptions.GetCredentialException {
ctor public NoCredentialException();
ctor public NoCredentialException(optional CharSequence? errorMessage);
@@ -607,6 +607,7 @@
public final class BeginCreatePublicKeyCredentialRequest extends androidx.credentials.provider.BeginCreateCredentialRequest {
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData);
ctor public BeginCreatePublicKeyCredentialRequest(String requestJson, androidx.credentials.provider.CallingAppInfo? callingAppInfo, android.os.Bundle candidateQueryData, optional byte[]? clientDataHash);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginCreatePublicKeyCredentialRequest createForTest(android.os.Bundle data, androidx.credentials.provider.CallingAppInfo? callingAppInfo);
method public byte[]? getClientDataHash();
method public String getRequestJson();
property public final byte[]? clientDataHash;
@@ -677,6 +678,7 @@
public final class BeginGetPasswordOption extends androidx.credentials.provider.BeginGetCredentialOption {
ctor public BeginGetPasswordOption(java.util.Set<java.lang.String> allowedUserIds, android.os.Bundle candidateQueryData, String id);
+ method @VisibleForTesting public static androidx.credentials.provider.BeginGetPasswordOption createForTest(android.os.Bundle data, String id);
method public java.util.Set<java.lang.String> getAllowedUserIds();
property public final java.util.Set<java.lang.String> allowedUserIds;
}
@@ -693,10 +695,9 @@
public final class CallingAppInfo {
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo);
ctor public CallingAppInfo(String packageName, android.content.pm.SigningInfo signingInfo, optional String? origin);
- method public String? getOrigin();
+ method public String? getOrigin(String privilegedAllowlist);
method public String getPackageName();
method public android.content.pm.SigningInfo getSigningInfo();
- property public final String? origin;
property public final String packageName;
property public final android.content.pm.SigningInfo signingInfo;
}
diff --git a/credentials/credentials/samples/src/main/java/androidx/credentials/samples/CredentialManagerSample.kt b/credentials/credentials/samples/src/main/java/androidx/credentials/samples/CredentialManagerSample.kt
index 57232c9..24eb7ee 100644
--- a/credentials/credentials/samples/src/main/java/androidx/credentials/samples/CredentialManagerSample.kt
+++ b/credentials/credentials/samples/src/main/java/androidx/credentials/samples/CredentialManagerSample.kt
@@ -82,7 +82,9 @@
val yourCoroutineScope = MainScope()
fun generateGetPasskeyRequestJsonFromServer(): String {
- TODO("Server call to generate the passkey request option json")
+ throw NotImplementedError("Apps using this sample code should " +
+ "add a call here to generate the passkey request json from " +
+ "their own server")
}
const val TAG: String = "TAG"
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCredentialRequestDisplayInfoTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCredentialRequestDisplayInfoTest.kt
index a495264..252bea5 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCredentialRequestDisplayInfoTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCredentialRequestDisplayInfoTest.kt
@@ -126,4 +126,4 @@
)
assertThat(displayInfo.preferDefaultProvider).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialRequestTest.kt
index ccc00f3..413adf6 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialRequestTest.kt
@@ -156,4 +156,4 @@
expectedPreferImmediatelyAvailableCredentials
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialResponseTest.kt
index 27e7abd..1f8da27 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreateCustomCredentialResponseTest.kt
@@ -53,4 +53,4 @@
assertThat(option.type).isEqualTo(expectedType)
assertThat(equals(option.data, expectedBundle)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordRequestTest.kt
index bb39755..f7405e2 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordRequestTest.kt
@@ -240,4 +240,4 @@
assertThat(convertedRequest.candidateQueryData.getBoolean(customCandidateQueryDataKey))
.isEqualTo(customCandidateQueryDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordResponseTest.kt
index 4af918c..6d1fadc 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePasswordResponseTest.kt
@@ -52,4 +52,4 @@
assertThat(convertedResponse.data.getCharSequence(customDataKey))
.isEqualTo(customDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialRequestTest.kt
index e785fc3..cd3f948 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialRequestTest.kt
@@ -257,4 +257,4 @@
assertThat(convertedRequest.candidateQueryData.getBoolean(customCandidateQueryDataKey))
.isEqualTo(customCandidateQueryDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialResponseTest.kt
index 9be5324..34a84b7 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CreatePublicKeyCredentialResponseTest.kt
@@ -100,4 +100,4 @@
assertThat(convertedResponse.data.getCharSequence(customDataKey))
.isEqualTo(customDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerPreUTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerPreUTest.kt
index 3dc1124a..8b89fd5 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerPreUTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerPreUTest.kt
@@ -168,4 +168,4 @@
.TYPE_CLEAR_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerTest.kt
index a09fb95..ec852ca 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CredentialManagerTest.kt
@@ -166,4 +166,4 @@
.TYPE_CLEAR_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/CustomCredentialTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/CustomCredentialTest.kt
index 5f61267..8dc2b7d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/CustomCredentialTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/CustomCredentialTest.kt
@@ -52,4 +52,4 @@
assertThat(option.type).isEqualTo(expectedType)
assertThat(equals(option.data, expectedBundle)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/FederatedCredentialTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/FederatedCredentialTest.kt
index 080e629..f22d409 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/FederatedCredentialTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/FederatedCredentialTest.kt
@@ -30,4 +30,4 @@
assertThat(FederatedCredential.TYPE_FEDERATED_CREDENTIAL)
.isEqualTo("type.federated_credential")
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/GetCredentialRequestTest.kt
index ca3baf6..f0333e9 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/GetCredentialRequestTest.kt
@@ -251,4 +251,4 @@
expectedPreferImmediatelyAvailableCredentials
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetCustomCredentialOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/GetCustomCredentialOptionTest.kt
index 8a3c0828..706b9c0 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetCustomCredentialOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/GetCustomCredentialOptionTest.kt
@@ -130,4 +130,4 @@
assertThat(actualOption.allowedProviders)
.containsAtLeastElementsIn(expectedAllowedProviders)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPasswordOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPasswordOptionTest.kt
index 0f2d4f3..105406d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPasswordOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPasswordOptionTest.kt
@@ -131,4 +131,4 @@
assertThat(convertedOption.candidateQueryData.getBoolean(customCandidateQueryDataKey))
.isEqualTo(customCandidateQueryDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionTest.kt
index 8775bd9..5c5e4e7 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/GetPublicKeyCredentialOptionTest.kt
@@ -132,4 +132,4 @@
assertThat(convertedOption.candidateQueryData.getBoolean(customCandidateQueryDataKey))
.isEqualTo(customCandidateQueryDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/PasswordCredentialTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/PasswordCredentialTest.kt
index e361e8f..faf9130 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/PasswordCredentialTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/PasswordCredentialTest.kt
@@ -95,4 +95,4 @@
assertThat(convertedCredential.data.getCharSequence(customDataKey))
.isEqualTo(customDataValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseJavaTest.java
index 7bfc8b9..c9379ed 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseJavaTest.java
@@ -18,24 +18,21 @@
import static com.google.common.truth.Truth.assertThat;
-import androidx.core.os.BuildCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+@SdkSuppress(minSdkVersion = 34)
@RunWith(AndroidJUnit4.class)
@SmallTest
public class PrepareGetCredentialResponseJavaTest {
@Test
public void constructor_throwsNPEWhenMissingInput() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
Assert.assertThrows(
"Expected null pointer when missing input",
NullPointerException.class,
@@ -48,10 +45,6 @@
@Test
public void test_hasCredentialResults() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
// Construct the test class.
PrepareGetCredentialResponse response = new PrepareGetCredentialResponse.TestBuilder()
.setCredentialTypeDelegate((val) ->
@@ -68,10 +61,6 @@
@Test
public void test_hasAuthenticationResults() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
// Construct the test class.
PrepareGetCredentialResponse response = new PrepareGetCredentialResponse.TestBuilder()
.setHasAuthResultsDelegate(() -> true)
@@ -87,10 +76,6 @@
@Test
public void test_hasRemoteResults() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
// Construct the test class.
PrepareGetCredentialResponse response = new PrepareGetCredentialResponse.TestBuilder()
.setHasRemoteResultsDelegate(() -> true)
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseTest.kt
index b15e06d..23826e1 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/PrepareGetCredentialResponseTest.kt
@@ -16,7 +16,6 @@
package androidx.credentials
-import androidx.core.os.BuildCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -25,17 +24,13 @@
import org.junit.Test
import org.junit.runner.RunWith
-@SdkSuppress(minSdkVersion = 34, codeName = "UpsideDownCake")
+@SdkSuppress(minSdkVersion = 34)
@RunWith(AndroidJUnit4::class)
@SmallTest
class PrepareGetCredentialResponseTest {
@Test
fun constructor_throwsNPEWhenMissingInput() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
Assert.assertThrows(
"Expected null pointer when missing input",
NullPointerException::class.java
@@ -48,10 +43,6 @@
@Test
fun test_hasCredentialResults() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
// Construct the test class.
val response = PrepareGetCredentialResponse.TestBuilder()
.setCredentialTypeDelegate { option ->
@@ -70,10 +61,6 @@
@Test
fun test_hasAuthenticationResults() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
// Construct the test class.
val response = PrepareGetCredentialResponse.TestBuilder()
.setHasAuthResultsDelegate {
@@ -91,10 +78,6 @@
@Test
fun test_hasRemoteResults() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
// Construct the test class.
val response = PrepareGetCredentialResponse.TestBuilder()
.setHasRemoteResultsDelegate {
@@ -109,4 +92,4 @@
assertThat(response.hasAuthenticationResults()).isFalse()
assertThat(response.hasRemoteResults()).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/PublicKeyCredentialTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/PublicKeyCredentialTest.kt
index 08fb335..d972d82 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/PublicKeyCredentialTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/PublicKeyCredentialTest.kt
@@ -117,4 +117,4 @@
val typeActual = PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL
assertThat(typeActual).isEqualTo(typeExpected)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/TestActivity.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/TestActivity.kt
index 07b5b9a..5cfd10b 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/TestActivity.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/TestActivity.kt
@@ -22,4 +22,4 @@
* This is a test activity used by the Robolectric Activity Scenario tests. It acts
* as a calling activity in our test cases.
*/
-class TestActivity : ComponentActivity()
\ No newline at end of file
+class TestActivity : ComponentActivity()
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/TestUtils.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/TestUtils.kt
index 200a073..a04f4a8 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/TestUtils.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/TestUtils.kt
@@ -19,7 +19,6 @@
import android.graphics.drawable.Icon
import android.os.Build
import android.os.Bundle
-import androidx.core.os.BuildCompat
import androidx.credentials.provider.CallingAppInfo
/** True if the two Bundles contain the same elements, and false otherwise. */
@@ -71,7 +70,7 @@
/** True if the device running the test is post framework api level,
* false if pre framework api level. */
fun isPostFrameworkApiLevel(): Boolean {
- return BuildCompat.isAtLeastU()
+ return Build.VERSION.SDK_INT >= 34
}
fun equals(a: Icon, b: Icon): Boolean {
@@ -83,4 +82,4 @@
fun equals(a: CallingAppInfo, b: CallingAppInfo): Boolean {
return a.packageName == b.packageName && a.origin == b.origin
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionJavaTest.java
similarity index 68%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionJavaTest.java
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionJavaTest.java
index fd49190..bc6ac0a 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionJavaTest.java
@@ -26,34 +26,34 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
-public class ClearCustomCredentialExceptionJavaTest {
+public class ClearCredentialCustomExceptionJavaTest {
@Test(expected = ClearCredentialException.class)
- public void construct_inputsNonEmpty_success() throws ClearCustomCredentialException {
- throw new ClearCustomCredentialException("type", "msg");
+ public void construct_inputsNonEmpty_success() throws ClearCredentialCustomException {
+ throw new ClearCredentialCustomException("type", "msg");
}
- @Test(expected = ClearCustomCredentialException.class)
- public void construct_errorMessageNull_success() throws ClearCustomCredentialException {
- throw new ClearCustomCredentialException("type", null);
+ @Test(expected = ClearCredentialCustomException.class)
+ public void construct_errorMessageNull_success() throws ClearCredentialCustomException {
+ throw new ClearCredentialCustomException("type", null);
}
@Test(expected = IllegalArgumentException.class)
- public void construct_typeEmpty_throws() throws ClearCustomCredentialException {
- throw new ClearCustomCredentialException("", "msg");
+ public void construct_typeEmpty_throws() throws ClearCredentialCustomException {
+ throw new ClearCredentialCustomException("", "msg");
}
@Test(expected = NullPointerException.class)
- public void construct_typeNull_throws() throws ClearCustomCredentialException {
- throw new ClearCustomCredentialException(null, "msg");
+ public void construct_typeNull_throws() throws ClearCredentialCustomException {
+ throw new ClearCredentialCustomException(null, "msg");
}
@Test
public void getter_success() {
String expectedType = "type";
String expectedMessage = "message";
- ClearCustomCredentialException exception = new
- ClearCustomCredentialException(expectedType , expectedMessage);
+ ClearCredentialCustomException exception = new
+ ClearCredentialCustomException(expectedType , expectedMessage);
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionTest.kt
similarity index 77%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionTest.kt
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionTest.kt
index 9c1ce33..a8043f6 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCustomCredentialExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialCustomExceptionTest.kt
@@ -24,28 +24,28 @@
@RunWith(AndroidJUnit4::class)
@SmallTest
-class ClearCustomCredentialExceptionTest {
- @Test(expected = ClearCustomCredentialException::class)
+class ClearCredentialCustomExceptionTest {
+ @Test(expected = ClearCredentialCustomException::class)
fun construct_inputsNonEmpty_success() {
- throw ClearCustomCredentialException("type", "msg")
+ throw ClearCredentialCustomException("type", "msg")
}
- @Test(expected = ClearCustomCredentialException::class)
+ @Test(expected = ClearCredentialCustomException::class)
fun construct_errorMessageNull_success() {
- throw ClearCustomCredentialException("type", null)
+ throw ClearCredentialCustomException("type", null)
}
@Test(expected = IllegalArgumentException::class)
fun construct_typeEmpty_throws() {
- throw ClearCustomCredentialException("", "msg")
+ throw ClearCredentialCustomException("", "msg")
}
@Test
fun getter_success() {
val expectedType = "type"
val expectedMessage = "message"
- val exception = ClearCustomCredentialException(expectedType, expectedMessage)
+ val exception = ClearCredentialCustomException(expectedType, expectedMessage)
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialInterruptedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialInterruptedExceptionTest.kt
index b55f482..efbcbe5 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialInterruptedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialInterruptedExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationExceptionTest.kt
index c2cf9bd..1885f4c 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnknownExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnknownExceptionTest.kt
index 7b8ca2b..5254b7d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnknownExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnknownExceptionTest.kt
@@ -43,4 +43,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnsupportedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnsupportedExceptionTest.kt
index ca5684d..969552f 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnsupportedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/ClearCredentialUnsupportedExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCancellationExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCancellationExceptionTest.kt
index 904340b..81fab82c 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCancellationExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCancellationExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionJavaTest.java
similarity index 65%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionJavaTest.java
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionJavaTest.java
index a5d4ddd..5ff1b36 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionJavaTest.java
@@ -26,33 +26,33 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
-public class CreateCustomCredentialExceptionJavaTest {
- @Test(expected = CreateCustomCredentialException.class)
- public void construct_inputsNonEmpty_success() throws CreateCustomCredentialException {
- throw new CreateCustomCredentialException("type", "msg");
+public class CreateCredentialCustomExceptionJavaTest {
+ @Test(expected = CreateCredentialCustomException.class)
+ public void construct_inputsNonEmpty_success() throws CreateCredentialCustomException {
+ throw new CreateCredentialCustomException("type", "msg");
}
- @Test(expected = CreateCustomCredentialException.class)
- public void construct_errorMessageNull_success() throws CreateCustomCredentialException {
- throw new CreateCustomCredentialException("type", null);
+ @Test(expected = CreateCredentialCustomException.class)
+ public void construct_errorMessageNull_success() throws CreateCredentialCustomException {
+ throw new CreateCredentialCustomException("type", null);
}
@Test(expected = IllegalArgumentException.class)
- public void construct_typeEmpty_throws() throws CreateCustomCredentialException {
- throw new CreateCustomCredentialException("", "msg");
+ public void construct_typeEmpty_throws() throws CreateCredentialCustomException {
+ throw new CreateCredentialCustomException("", "msg");
}
@Test(expected = NullPointerException.class)
- public void construct_typeNull_throws() throws CreateCustomCredentialException {
- throw new CreateCustomCredentialException(null, "msg");
+ public void construct_typeNull_throws() throws CreateCredentialCustomException {
+ throw new CreateCredentialCustomException(null, "msg");
}
@Test
public void getter_success() {
String expectedType = "type";
String expectedMessage = "message";
- CreateCustomCredentialException exception = new
- CreateCustomCredentialException(expectedType , expectedMessage);
+ CreateCredentialCustomException exception = new
+ CreateCredentialCustomException(expectedType , expectedMessage);
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionTest.kt
similarity index 76%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionTest.kt
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionTest.kt
index d79665c..bd86cab 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCustomCredentialExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialCustomExceptionTest.kt
@@ -24,28 +24,28 @@
@RunWith(AndroidJUnit4::class)
@SmallTest
-class CreateCustomCredentialExceptionTest {
- @Test(expected = CreateCustomCredentialException::class)
+class CreateCredentialCustomExceptionTest {
+ @Test(expected = CreateCredentialCustomException::class)
fun construct_inputsNonEmpty_success() {
- throw CreateCustomCredentialException("type", "msg")
+ throw CreateCredentialCustomException("type", "msg")
}
- @Test(expected = CreateCustomCredentialException::class)
+ @Test(expected = CreateCredentialCustomException::class)
fun construct_errorMessageNull_success() {
- throw CreateCustomCredentialException("type", null)
+ throw CreateCredentialCustomException("type", null)
}
@Test(expected = IllegalArgumentException::class)
fun construct_typeEmpty_throws() {
- throw CreateCustomCredentialException("", "msg")
+ throw CreateCredentialCustomException("", "msg")
}
@Test
fun getter_success() {
val expectedType = "type"
val expectedMessage = "message"
- val exception = CreateCustomCredentialException(expectedType, expectedMessage)
+ val exception = CreateCredentialCustomException(expectedType, expectedMessage)
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialInterruptedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialInterruptedExceptionTest.kt
index 6013df0..d6aa111 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialInterruptedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialInterruptedExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationExceptionTest.kt
index e8e2c8c..acb08d91 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnknownExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnknownExceptionTest.kt
index 6fcb19c..232cb82 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnknownExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnknownExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnsupportedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnsupportedExceptionTest.kt
index e9e2417..d2b6b16 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnsupportedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/CreateCredentialUnsupportedExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCancellationExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCancellationExceptionTest.kt
index 10deff4..da1642d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCancellationExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCancellationExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionJavaTest.java
similarity index 63%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionJavaTest.java
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionJavaTest.java
index a7a1ae4..4be700e 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionJavaTest.java
@@ -26,33 +26,33 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
-public class GetCustomCredentialExceptionJavaTest {
- @Test(expected = GetCustomCredentialException.class)
- public void construct_inputsNonEmpty_success() throws GetCustomCredentialException {
- throw new GetCustomCredentialException("type", "msg");
+public class GetCredentialCustomExceptionJavaTest {
+ @Test(expected = GetCredentialCustomException.class)
+ public void construct_inputsNonEmpty_success() throws GetCredentialCustomException {
+ throw new GetCredentialCustomException("type", "msg");
}
- @Test(expected = GetCustomCredentialException.class)
- public void construct_errorMessageNull_success() throws GetCustomCredentialException {
- throw new GetCustomCredentialException("type", null);
+ @Test(expected = GetCredentialCustomException.class)
+ public void construct_errorMessageNull_success() throws GetCredentialCustomException {
+ throw new GetCredentialCustomException("type", null);
}
@Test(expected = IllegalArgumentException.class)
- public void construct_typeEmpty_throws() throws GetCustomCredentialException {
- throw new GetCustomCredentialException("", "msg");
+ public void construct_typeEmpty_throws() throws GetCredentialCustomException {
+ throw new GetCredentialCustomException("", "msg");
}
@Test(expected = NullPointerException.class)
- public void construct_typeNull_throws() throws GetCustomCredentialException {
- throw new GetCustomCredentialException(null, "msg");
+ public void construct_typeNull_throws() throws GetCredentialCustomException {
+ throw new GetCredentialCustomException(null, "msg");
}
@Test
public void getter_success() {
String expectedType = "type";
String expectedMessage = "message";
- GetCustomCredentialException exception = new
- GetCustomCredentialException(expectedType , expectedMessage);
+ GetCredentialCustomException exception = new
+ GetCredentialCustomException(expectedType , expectedMessage);
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionTest.kt
similarity index 77%
rename from credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionTest.kt
rename to credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionTest.kt
index 308ddb4..db7bf97 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCustomCredentialExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialCustomExceptionTest.kt
@@ -24,28 +24,28 @@
@RunWith(AndroidJUnit4::class)
@SmallTest
-class GetCustomCredentialExceptionTest {
- @Test(expected = GetCustomCredentialException::class)
+class GetCredentialCustomExceptionTest {
+ @Test(expected = GetCredentialCustomException::class)
fun construct_inputsNonEmpty_success() {
- throw GetCustomCredentialException("type", "msg")
+ throw GetCredentialCustomException("type", "msg")
}
- @Test(expected = GetCustomCredentialException::class)
+ @Test(expected = GetCredentialCustomException::class)
fun construct_errorMessageNull_success() {
- throw GetCustomCredentialException("type", null)
+ throw GetCredentialCustomException("type", null)
}
@Test(expected = IllegalArgumentException::class)
fun construct_typeEmpty_throws() {
- throw GetCustomCredentialException("", "msg")
+ throw GetCredentialCustomException("", "msg")
}
@Test
fun getter_success() {
val expectedType = "type"
val expectedMessage = "message"
- val exception = GetCustomCredentialException(expectedType, expectedMessage)
+ val exception = GetCredentialCustomException(expectedType, expectedMessage)
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialInterruptedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialInterruptedExceptionTest.kt
index b7cee03..cd78cae 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialInterruptedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialInterruptedExceptionTest.kt
@@ -44,4 +44,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationExceptionTest.kt
index 50490ea..bfe5b51 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnknownExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnknownExceptionTest.kt
index bafbd19..6e3a145 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnknownExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnknownExceptionTest.kt
@@ -43,4 +43,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnsupportedExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnsupportedExceptionTest.kt
index f6c68d7..d72267c 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnsupportedExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/GetCredentialUnsupportedExceptionTest.kt
@@ -45,4 +45,4 @@
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/AbortDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/AbortDomErrorTest.kt
index 68c0c89..a503a67 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/AbortDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/AbortDomErrorTest.kt
@@ -39,4 +39,4 @@
AbortError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ABORT_ERROR
assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ConstraintDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ConstraintDomErrorTest.kt
index c16902b..3deb197 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ConstraintDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ConstraintDomErrorTest.kt
@@ -39,4 +39,4 @@
.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_CONSTRAINT_ERROR
assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/DataDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/DataDomErrorTest.kt
index 7dc2e76..47f49b1 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/DataDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/DataDomErrorTest.kt
@@ -38,4 +38,4 @@
DataError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_ERROR
assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InUseAttributeDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InUseAttributeDomErrorTest.kt
index 8a4c0b0..747f35a 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InUseAttributeDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InUseAttributeDomErrorTest.kt
@@ -38,4 +38,4 @@
InUseAttributeError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_IN_USE_ATTRIBUTE_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidCharacterDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidCharacterDomErrorTest.kt
index 39498fe..0031ea8 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidCharacterDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidCharacterDomErrorTest.kt
@@ -38,4 +38,4 @@
InvalidCharacterError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_CHARACTER_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidModificationDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidModificationDomErrorTest.kt
index a6a20b5..9089bcb 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidModificationDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidModificationDomErrorTest.kt
@@ -38,4 +38,4 @@
InvalidModificationError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_MODIFICATION_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidNodeTypeDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidNodeTypeDomErrorTest.kt
index b2ebd89..475ef02 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidNodeTypeDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/InvalidNodeTypeDomErrorTest.kt
@@ -38,4 +38,4 @@
InvalidNodeTypeError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_NODE_TYPE_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NoModificationAllowedDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NoModificationAllowedDomErrorTest.kt
index f24bb41..7fe4802 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NoModificationAllowedDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NoModificationAllowedDomErrorTest.kt
@@ -38,4 +38,4 @@
.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NO_MODIFICATION_ALLOWED_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotFoundDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotFoundDomErrorTest.kt
index c829063..43d867f 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotFoundDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotFoundDomErrorTest.kt
@@ -37,4 +37,4 @@
val expectedType = NotFoundError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_FOUND_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotReadableDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotReadableDomErrorTest.kt
index 2a10418..c4ec0b1 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotReadableDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/NotReadableDomErrorTest.kt
@@ -39,4 +39,4 @@
.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_READABLE_ERROR
assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OperationDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OperationDomErrorTest.kt
index 0060e92..3f9bece 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OperationDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OperationDomErrorTest.kt
@@ -37,4 +37,4 @@
val expectedType = OperationError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPERATION_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OptOutDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OptOutDomErrorTest.kt
index 476c58e..d5c2fc4 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OptOutDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/OptOutDomErrorTest.kt
@@ -37,4 +37,4 @@
val expectedType = OptOutError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPT_OUT_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/QuotaExceededDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/QuotaExceededDomErrorTest.kt
index 22a37c6..4d3d650 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/QuotaExceededDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/QuotaExceededDomErrorTest.kt
@@ -38,4 +38,4 @@
.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_QUOTA_EXCEEDED_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ReadOnlyDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ReadOnlyDomErrorTest.kt
index 4c5f483..92432ec 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ReadOnlyDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/ReadOnlyDomErrorTest.kt
@@ -37,4 +37,4 @@
val expectedType = ReadOnlyError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_READ_ONLY_ERROR
Truth.assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/UnknownDomErrorTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/UnknownDomErrorTest.kt
index 7da1a04..5387751 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/UnknownDomErrorTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/domerror/UnknownDomErrorTest.kt
@@ -39,4 +39,4 @@
.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_UNKNOWN_ERROR
assertThat(error.type).isEqualTo(expectedType)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionJavaTest.java
index e782efc..9ec0c643 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionJavaTest.java
@@ -16,8 +16,12 @@
package androidx.credentials.exceptions.publickeycredential;
+import static androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.SEPARATOR;
+
import static com.google.common.truth.Truth.assertThat;
+import androidx.credentials.exceptions.CreateCredentialCustomException;
+import androidx.credentials.exceptions.CreateCredentialException;
import androidx.credentials.exceptions.domerrors.AbortError;
import androidx.credentials.exceptions.domerrors.DomError;
import androidx.credentials.exceptions.domerrors.EncodingError;
@@ -51,7 +55,7 @@
DomError expectedDomError = new EncodingError();
String expectedType =
CreatePublicKeyCredentialDomException
- .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ expectedDomError.getType();
CreatePublicKeyCredentialDomException exception = new
@@ -60,4 +64,38 @@
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
+
+
+ @Test
+ public void frameworkToJetpackConversion_success() {
+ String expectedMessage = "msg";
+ DomError expectedDomError = new EncodingError();
+ String expectedType = CreatePublicKeyCredentialDomException
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ + expectedDomError.getType();
+
+ CreateCredentialException exception = CreatePublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(CreatePublicKeyCredentialDomException.class);
+ assertThat(((CreatePublicKeyCredentialDomException) exception).getDomError())
+ .isInstanceOf(EncodingError.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
+
+ @Test
+ public void frameworkToJetpackConversion_failure_createsCustomException() {
+ String expectedMessage = "CustomMessage";
+ String expectedType =
+ CreatePublicKeyCredentialDomException
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + "/CustomType";
+
+ CreateCredentialException exception = CreatePublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(CreateCredentialCustomException.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionTest.kt
index b8ae2bc..3f637a2 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomExceptionTest.kt
@@ -16,9 +16,12 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.credentials.exceptions.CreateCredentialCustomException
import androidx.credentials.exceptions.domerrors.AbortError
import androidx.credentials.exceptions.domerrors.EncodingError
-import com.google.common.truth.Truth
+import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException.Companion.createFrom
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
+import com.google.common.truth.Truth.assertThat
import org.junit.Test
class CreatePublicKeyCredentialDomExceptionTest {
@@ -35,11 +38,46 @@
val expectedDomError = EncodingError()
val expectedType =
CreatePublicKeyCredentialDomException.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
- expectedDomError.type
+ SEPARATOR + expectedDomError.type
val exception = CreatePublicKeyCredentialDomException(expectedDomError, expectedMessage)
- Truth.assertThat(exception.type).isEqualTo(expectedType)
- Truth.assertThat(exception.errorMessage).isEqualTo(expectedMessage)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+
+ @Test
+ fun frameworkToJetpackConversion_success() {
+ val expectedMessage = "msg"
+ val expectedDomError = EncodingError()
+ val expectedType = CreatePublicKeyCredentialDomException
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR + expectedDomError.type
+
+ val exception = CreatePublicKeyCredentialException.createFrom(expectedType,
+ expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ CreatePublicKeyCredentialDomException::class.java
+ )
+ assertThat((exception as CreatePublicKeyCredentialDomException).domError)
+ .isInstanceOf(EncodingError::class.java)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.errorMessage).isEqualTo(expectedMessage)
+ }
+
+ @Test
+ fun frameworkToJetpackConversion_failure_createsCustomException() {
+ val expectedMessage = "CustomMessage"
+ val expectedType =
+ CreatePublicKeyCredentialDomException.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
+ "/CustomType"
+
+ val exception = createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ CreateCredentialCustomException::class.java
+ )
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionJavaTest.java
index b40128e..ceb1b57 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionJavaTest.java
@@ -16,8 +16,14 @@
package androidx.credentials.exceptions.publickeycredential;
+import static androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.SEPARATOR;
+
import static com.google.common.truth.Truth.assertThat;
+import androidx.credentials.exceptions.CreateCredentialCustomException;
+import androidx.credentials.exceptions.CreateCredentialException;
+import androidx.credentials.exceptions.domerrors.DataCloneError;
+import androidx.credentials.exceptions.domerrors.DomError;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -57,4 +63,35 @@
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
+
+ @Test
+ public void frameworkToJetpackConversion_success() {
+ String expectedMessage = "msg";
+ DomError expectedDomError = new DataCloneError();
+ String expectedType = CreatePublicKeyCredentialDomException
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ + expectedDomError.getType();
+
+ CreateCredentialException exception = CreatePublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(CreatePublicKeyCredentialDomException.class);
+ assertThat(((CreatePublicKeyCredentialDomException) exception).getDomError())
+ .isInstanceOf(DataCloneError.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
+
+ @Test
+ public void frameworkToJetpackConversion_failure_createsCustomException() {
+ String expectedMessage = "CustomMessage";
+ String expectedType = "CustomType";
+
+ CreateCredentialException exception = CreatePublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception.getClass()).isEqualTo(CreateCredentialCustomException.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionTest.kt
index 5a2f1fe..8d5b1a5 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialExceptionTest.kt
@@ -16,6 +16,11 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.credentials.exceptions.CreateCredentialCustomException
+import androidx.credentials.exceptions.domerrors.DataCloneError
+import androidx.credentials.exceptions.domerrors.DomError
+import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException.Companion.createFrom
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
@@ -45,8 +50,43 @@
fun getter_success() {
val expectedType = "type"
val expectedMessage = "message"
+
val exception = CreatePublicKeyCredentialException(expectedType, expectedMessage)
+
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+
+ @Test
+ fun frameworkToJetpackConversion_success() {
+ val expectedMessage = "msg"
+ val expectedDomError: DomError = DataCloneError()
+ val expectedType =
+ CreatePublicKeyCredentialDomException.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
+ SEPARATOR + expectedDomError.type
+
+ val exception = createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ CreatePublicKeyCredentialDomException::class.java
+ )
+ assertThat((exception as CreatePublicKeyCredentialDomException).domError)
+ .isInstanceOf(DataCloneError::class.java)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+
+ @Test
+ fun frameworkToJetpackConversion_failure_createsCustomException() {
+ val expectedMessage = "CustomMessage"
+ val expectedType = "CustomType"
+
+ val exception = createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ CreateCredentialCustomException::class.java
+ )
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionJavaTest.java
index 561065f..2c0ad70 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionJavaTest.java
@@ -16,8 +16,12 @@
package androidx.credentials.exceptions.publickeycredential;
+import static androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.SEPARATOR;
+
import static com.google.common.truth.Truth.assertThat;
+import androidx.credentials.exceptions.GetCredentialCustomException;
+import androidx.credentials.exceptions.GetCredentialException;
import androidx.credentials.exceptions.domerrors.AbortError;
import androidx.credentials.exceptions.domerrors.DomError;
import androidx.credentials.exceptions.domerrors.EncodingError;
@@ -51,7 +55,7 @@
DomError expectedDomError = new EncodingError();
String expectedType =
GetPublicKeyCredentialDomException
- .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION
+ .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ expectedDomError.getType();
GetPublicKeyCredentialDomException exception = new
@@ -60,4 +64,37 @@
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
+
+ @Test
+ public void frameworkToJetpackConversion_success() {
+ String expectedMessage = "msg";
+ DomError expectedDomError = new EncodingError();
+ String expectedType = GetPublicKeyCredentialDomException
+ .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ + expectedDomError.getType();
+
+ GetCredentialException exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(GetPublicKeyCredentialDomException.class);
+ assertThat(((GetPublicKeyCredentialDomException) exception).getDomError())
+ .isInstanceOf(EncodingError.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
+
+ @Test
+ public void frameworkToJetpackConversion_failure_createsCustomException() {
+ String expectedMessage = "CustomMessage";
+ String expectedType =
+ GetPublicKeyCredentialDomException
+ .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + "/CustomType";
+
+ GetCredentialException exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(GetCredentialCustomException.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionTest.kt
index 580e73e..9ace0a1 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomExceptionTest.kt
@@ -16,9 +16,14 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.credentials.exceptions.GetCredentialCustomException
import androidx.credentials.exceptions.domerrors.AbortError
+import androidx.credentials.exceptions.domerrors.DomError
import androidx.credentials.exceptions.domerrors.EncodingError
-import com.google.common.truth.Truth
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
+import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialDomException.Companion.createFrom
+import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialException.Companion.createFrom
+import com.google.common.truth.Truth.assertThat
import org.junit.Test
class GetPublicKeyCredentialDomExceptionTest {
@@ -35,11 +40,48 @@
val expectedDomError = EncodingError()
val expectedType =
GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
- expectedDomError.type
+ SEPARATOR + expectedDomError.type
val exception = GetPublicKeyCredentialDomException(expectedDomError, expectedMessage)
- Truth.assertThat(exception.type).isEqualTo(expectedType)
- Truth.assertThat(exception.errorMessage).isEqualTo(expectedMessage)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+
+ @Test
+ fun frameworkToJetpackConversion_success() {
+ val expectedMessage = "msg"
+ val expectedDomError: DomError = EncodingError()
+ val expectedType =
+ GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
+ SEPARATOR + expectedDomError.type
+
+ val exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ GetPublicKeyCredentialDomException::class.java
+ )
+ assertThat((exception as GetPublicKeyCredentialDomException).domError)
+ .isInstanceOf(EncodingError::class.java)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+
+ @Test
+ fun frameworkToJetpackConversion_failure_createsCustomException() {
+ val expectedMessage = "CustomMessage"
+ val expectedType =
+ GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
+ "/CustomType"
+
+ val exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ GetCredentialCustomException::class.java
+ )
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionJavaTest.java
index 919c35f..15e18a8 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionJavaTest.java
@@ -16,8 +16,14 @@
package androidx.credentials.exceptions.publickeycredential;
+import static androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.SEPARATOR;
+
import static com.google.common.truth.Truth.assertThat;
+import androidx.credentials.exceptions.GetCredentialCustomException;
+import androidx.credentials.exceptions.GetCredentialException;
+import androidx.credentials.exceptions.domerrors.DomError;
+import androidx.credentials.exceptions.domerrors.EncodingError;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
@@ -57,4 +63,35 @@
assertThat(exception.getType()).isEqualTo(expectedType);
assertThat(exception.getErrorMessage()).isEqualTo(expectedMessage);
}
+
+ @Test
+ public void frameworkToJetpackConversion_success() {
+ String expectedMessage = "msg";
+ DomError expectedDomError = new EncodingError();
+ String expectedType = GetPublicKeyCredentialDomException
+ .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR
+ + expectedDomError.getType();
+
+ GetCredentialException exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(GetPublicKeyCredentialDomException.class);
+ assertThat(((GetPublicKeyCredentialDomException) exception).getDomError())
+ .isInstanceOf(EncodingError.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
+
+ @Test
+ public void frameworkToJetpackConversion_failure_createsCustomException() {
+ String expectedMessage = "CustomMessage";
+ String expectedType = "CustomType";
+
+ GetCredentialException exception = GetPublicKeyCredentialException
+ .createFrom(expectedType, expectedMessage);
+
+ assertThat(exception).isInstanceOf(GetCredentialCustomException.class);
+ assertThat(exception.getType()).isEqualTo(expectedType);
+ assertThat(exception.getMessage()).isEqualTo(expectedMessage);
+ }
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionTest.kt
index 89c3756..ad63b38 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialExceptionTest.kt
@@ -16,6 +16,11 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.credentials.exceptions.GetCredentialCustomException
+import androidx.credentials.exceptions.domerrors.DomError
+import androidx.credentials.exceptions.domerrors.EncodingError
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
+import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialException.Companion.createFrom
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.google.common.truth.Truth.assertThat
@@ -45,8 +50,43 @@
fun getter_success() {
val expectedType = "type"
val expectedMessage = "message"
+
val exception = GetPublicKeyCredentialException(expectedType, expectedMessage)
+
assertThat(exception.type).isEqualTo(expectedType)
assertThat(exception.errorMessage).isEqualTo(expectedMessage)
}
-}
\ No newline at end of file
+
+ @Test
+ fun frameworkToJetpackConversion_success() {
+ val expectedMessage = "msg"
+ val expectedDomError: DomError = EncodingError()
+ val expectedType =
+ GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION +
+ SEPARATOR + expectedDomError.type
+
+ val exception = createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ GetPublicKeyCredentialDomException::class.java
+ )
+ assertThat((exception as GetPublicKeyCredentialDomException).domError)
+ .isInstanceOf(EncodingError::class.java)
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+
+ @Test
+ fun frameworkToJetpackConversion_failure_createsCustomException() {
+ val expectedMessage = "CustomMessage"
+ val expectedType = "CustomType"
+
+ val exception = createFrom(expectedType, expectedMessage)
+
+ assertThat(exception).isInstanceOf(
+ GetCredentialCustomException::class.java
+ )
+ assertThat(exception.type).isEqualTo(expectedType)
+ assertThat(exception.message).isEqualTo(expectedMessage)
+ }
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/internal/FrameworkClassParsingExceptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/internal/FrameworkClassParsingExceptionTest.kt
index 8485d8c..226ce77 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/internal/FrameworkClassParsingExceptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/internal/FrameworkClassParsingExceptionTest.kt
@@ -31,4 +31,4 @@
fun constructor_success() {
FrameworkClassParsingException()
}
- }
\ No newline at end of file
+ }
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCredentialResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCredentialResponseTest.kt
index f15cd57..55d82de 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCredentialResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCredentialResponseTest.kt
@@ -118,4 +118,4 @@
assertThat(actualRemoteEntry).isEqualTo(expectedRemoteEntry)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestJavaTest.java
index ff3c9ec..08e98f2 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestJavaTest.java
@@ -41,11 +41,16 @@
}
@Test
- public void constructor_nullTypeBundle_throws() {
- // TODO(b/275416815) - parameterize to account for all individually
- assertThrows("Expected null list to throw NPE",
+ public void constructor_callingappinfo_success() {
+ new BeginCreateCustomCredentialRequest("type", Bundle.EMPTY, new CallingAppInfo(
+ "package", new SigningInfo()));
+ }
+
+ @Test
+ public void constructor_nullBundleInfo_throws() {
+ assertThrows("Expected null candidateQueryData to throw NPE",
NullPointerException.class,
- () -> new BeginCreateCustomCredentialRequest(null, null,
+ () -> new BeginCreateCustomCredentialRequest("", null,
new CallingAppInfo(
"package", new SigningInfo()))
);
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestTest.kt
index c4caf97..05ec9a1 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreateCustomCredentialRequestTest.kt
@@ -71,4 +71,4 @@
val actualBundle = beginCreateCustomCredentialRequest.candidateQueryData
assertThat(actualBundle.getString(expectedKey)).isEqualTo(expectedValue)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePasswordRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePasswordRequestTest.kt
index dacb3d6..e8a2418 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePasswordRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePasswordRequestTest.kt
@@ -77,4 +77,4 @@
null,
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestJavaTest.java
index f2029ac..661ec9a 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestJavaTest.java
@@ -23,6 +23,7 @@
import android.content.pm.SigningInfo;
import android.os.Bundle;
+import androidx.credentials.internal.FrameworkClassParsingException;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -34,80 +35,74 @@
@SdkSuppress(minSdkVersion = 28)
@SmallTest
public class BeginCreatePublicKeyCredentialRequestJavaTest {
+
+ private static final String BUNDLE_KEY_CLIENT_DATA_HASH =
+ "androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH";
+ private static final String BUNDLE_KEY_REQUEST_JSON =
+ "androidx.credentials.BUNDLE_KEY_REQUEST_JSON";
+
@Test
public void constructor_emptyJson_throwsIllegalArgumentException() {
- assertThrows("Expected empty Json to throw error",
+ assertThrows(
+ "Expected empty Json to throw error",
IllegalArgumentException.class,
- () -> new BeginCreatePublicKeyCredentialRequest(
- "",
- new CallingAppInfo(
- "sample_package_name", new SigningInfo()),
- new Bundle()
- )
- );
-
+ () ->
+ new BeginCreatePublicKeyCredentialRequest(
+ "",
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle()));
}
@Test
public void constructor_invalidJson_throwsIllegalArgumentException() {
- assertThrows("Expected invalid Json to throw error",
+ assertThrows(
+ "Expected invalid Json to throw error",
IllegalArgumentException.class,
- () -> new BeginCreatePublicKeyCredentialRequest(
- "invalid",
- new CallingAppInfo(
- "sample_package_name", new SigningInfo()),
- new Bundle()
- )
- );
+ () ->
+ new BeginCreatePublicKeyCredentialRequest(
+ "invalid",
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle()));
}
@Test
public void constructor_nullJson_throwsNullPointerException() {
- assertThrows("Expected null Json to throw NPE",
+ assertThrows(
+ "Expected null Json to throw NPE",
NullPointerException.class,
- () -> new BeginCreatePublicKeyCredentialRequest(
- null,
- new CallingAppInfo("sample_package_name",
- new SigningInfo()),
- new Bundle()
- )
- );
+ () ->
+ new BeginCreatePublicKeyCredentialRequest(
+ null,
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle()));
}
@Test
public void constructor_success() {
new BeginCreatePublicKeyCredentialRequest(
"{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
- new CallingAppInfo(
- "sample_package_name", new SigningInfo()
- ),
- new Bundle()
- );
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle());
}
@Test
public void constructorWithClientDataHash_success() {
new BeginCreatePublicKeyCredentialRequest(
"{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
- new CallingAppInfo(
- "sample_package_name", new SigningInfo()
- ),
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
new Bundle(),
- "client_data_hash".getBytes()
- );
+ "client_data_hash".getBytes());
}
@Test
public void getter_requestJson_success() {
String testJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}";
- BeginCreatePublicKeyCredentialRequest
- createPublicKeyCredentialReq = new BeginCreatePublicKeyCredentialRequest(
- testJsonExpected,
- new CallingAppInfo(
- "sample_package_name", new SigningInfo()),
- new Bundle()
- );
+ BeginCreatePublicKeyCredentialRequest createPublicKeyCredentialReq =
+ new BeginCreatePublicKeyCredentialRequest(
+ testJsonExpected,
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle());
String testJsonActual = createPublicKeyCredentialReq.getRequestJson();
assertThat(testJsonActual).isEqualTo(testJsonExpected);
@@ -120,13 +115,50 @@
BeginCreatePublicKeyCredentialRequest createPublicKeyCredentialReq =
new BeginCreatePublicKeyCredentialRequest(
"{\"hi\":{\"there\":{\"lol\":\"Value\"}}}",
- new CallingAppInfo("sample_package_name",
- new SigningInfo()),
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
new Bundle(),
testClientDataHashExpected.getBytes());
assertThat(createPublicKeyCredentialReq.getClientDataHash())
.isEqualTo(testClientDataHashExpected.getBytes());
}
- // TODO ("Add framework conversion, createFrom & preferImmediatelyAvailable tests")
+
+ @Test
+ public void constructor_success_createFrom() {
+ Bundle bundle = new Bundle();
+ bundle.putString(BUNDLE_KEY_REQUEST_JSON, "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}");
+ bundle.putByteArray(BUNDLE_KEY_CLIENT_DATA_HASH, new byte[0]);
+
+ BeginCreatePublicKeyCredentialRequest.createForTest(
+ bundle, new CallingAppInfo("sample_package_name", new SigningInfo()));
+ }
+
+ @Test
+ public void constructor_error_createFrom() {
+ assertThrows(
+ "Expected create from to throw error",
+ FrameworkClassParsingException.class,
+ () ->
+ BeginCreatePublicKeyCredentialRequest.createForTest(
+ new Bundle(),
+ new CallingAppInfo("sample_package_name", new SigningInfo())));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = 34)
+ public void conversion() {
+ String testJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}";
+
+ BeginCreatePublicKeyCredentialRequest req =
+ new BeginCreatePublicKeyCredentialRequest(
+ testJsonExpected,
+ new CallingAppInfo("sample_package_name", new SigningInfo()),
+ new Bundle());
+
+ Bundle bundle = BeginCreateCredentialRequest.asBundle(req);
+ assertThat(bundle).isNotNull();
+
+ BeginCreateCredentialRequest converted = BeginCreateCredentialRequest.fromBundle(bundle);
+ assertThat(req.getType()).isEqualTo(converted.getType());
+ }
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestTest.kt
index 8783adf..1ade737 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequestTest.kt
@@ -17,6 +17,7 @@
import android.content.pm.SigningInfo
import android.os.Bundle
+import androidx.credentials.internal.FrameworkClassParsingException
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -87,6 +88,35 @@
}
@Test
+ fun constructor_success_createFrom() {
+ val bundle = Bundle()
+ bundle.putString(BUNDLE_KEY_REQUEST_JSON, "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}")
+ bundle.putByteArray(BUNDLE_KEY_CLIENT_DATA_HASH, byteArrayOf())
+
+ BeginCreatePublicKeyCredentialRequest.createForTest(
+ bundle,
+ CallingAppInfo(
+ "sample_package_name", SigningInfo()
+ )
+ )
+ }
+
+ @Test
+ fun constructor_error_createFrom() {
+ Assert.assertThrows(
+ "Expected create from to throw error",
+ FrameworkClassParsingException::class.java
+ ) {
+ BeginCreatePublicKeyCredentialRequest.createForTest(
+ Bundle(),
+ CallingAppInfo(
+ "sample_package_name", SigningInfo()
+ )
+ )
+ }
+ }
+
+ @Test
fun getter_requestJson_success() {
val testJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}"
@@ -118,5 +148,30 @@
val testClientDataHashActual = createPublicKeyCredentialReq.clientDataHash
assertThat(testClientDataHashActual).isEqualTo(testClientDataHashExpected)
}
- // TODO ("Add framework conversion, createFrom & preferImmediatelyAvailable tests")
-}
\ No newline at end of file
+
+ @Test
+ @SdkSuppress(minSdkVersion = 34)
+ fun conversion() {
+ val testJsonExpected = "{\"hi\":{\"there\":{\"lol\":\"Value\"}}}"
+
+ val req = BeginCreatePublicKeyCredentialRequest(
+ testJsonExpected,
+ CallingAppInfo(
+ "sample_package_name", SigningInfo()
+ ),
+ Bundle()
+ )
+
+ val bundle = BeginCreateCredentialRequest.asBundle(req)
+ assertThat(bundle).isNotNull()
+
+ var converted = BeginCreateCredentialRequest.fromBundle(bundle)
+ assertThat(req.type).isEqualTo(converted!!.type)
+ }
+
+ internal companion object {
+ internal const val BUNDLE_KEY_CLIENT_DATA_HASH =
+ "androidx.credentials.BUNDLE_KEY_CLIENT_DATA_HASH"
+ internal const val BUNDLE_KEY_REQUEST_JSON = "androidx.credentials.BUNDLE_KEY_REQUEST_JSON"
+ }
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialRequestTest.kt
index 4a495e3..85a6e54 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialRequestTest.kt
@@ -94,4 +94,4 @@
assertThat(actualPackageName).isEqualTo(expectedPackageName)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseJavaTest.java
index 5f3e93c..93180c8 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseJavaTest.java
@@ -33,6 +33,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.ArrayList;
import java.util.Collections;
@SdkSuppress(minSdkVersion = 28)
@@ -45,9 +46,8 @@
new BeginGetCredentialResponse();
}
- // TODO(b/275416815) - parameterize to account for all individually
@Test
- public void constructor_nullList_throws() {
+ public void constructor_nullList_throws_allListsNull() {
assertThrows("Expected null list to throw NPE",
NullPointerException.class,
() -> new BeginGetCredentialResponse(
@@ -56,6 +56,33 @@
}
@Test
+ public void constructor_nullList_throws_credEntriesNull() {
+ assertThrows("Expected null list to throw NPE",
+ NullPointerException.class,
+ () -> new BeginGetCredentialResponse(
+ null, new ArrayList<>(), new ArrayList<>(), constructRemoteEntryDefault())
+ );
+ }
+
+ @Test
+ public void constructor_nullList_throws_actionsNull() {
+ assertThrows("Expected null list to throw NPE",
+ NullPointerException.class,
+ () -> new BeginGetCredentialResponse(
+ new ArrayList<>(), null, new ArrayList<>(), constructRemoteEntryDefault())
+ );
+ }
+
+ @Test
+ public void constructor_nullList_throws_authActionsNull() {
+ assertThrows("Expected null list to throw NPE",
+ NullPointerException.class,
+ () -> new BeginGetCredentialResponse(
+ new ArrayList<>(), new ArrayList<>(), null, constructRemoteEntryDefault())
+ );
+ }
+
+ @Test
public void buildConstruct_success() {
new BeginGetCredentialResponse.Builder().build();
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseTest.kt
index 9246bbc..3d70566 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCredentialResponseTest.kt
@@ -125,4 +125,4 @@
assertThat(actualRemoteEntry).isEqualTo(expectedRemoteEntry)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCustomCredentialOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCustomCredentialOptionTest.kt
index ec8367b..ebec728 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCustomCredentialOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetCustomCredentialOptionTest.kt
@@ -70,4 +70,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionJavaTest.java
index cf3af28..6d570779 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionJavaTest.java
@@ -27,12 +27,11 @@
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
-import com.google.common.collect.ImmutableSet;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Set;
@RunWith(AndroidJUnit4.class)
@@ -42,21 +41,40 @@
private static final String BUNDLE_ID_KEY =
"android.service.credentials.BeginGetCredentialOption.BUNDLE_ID_KEY";
private static final String BUNDLE_ID = "id";
+ private static final Set<String> EXPECTED_ALLOWED_USER_IDS = generateExpectedAllowedUserIds();
@Test
public void constructor_success() {
- Set<String> expectedAllowedUserIds = ImmutableSet.of("id1", "id2", "id3");
Bundle bundle = new Bundle();
- bundle.putStringArrayList(GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS,
- new ArrayList<>(expectedAllowedUserIds));
+ bundle.putStringArrayList(
+ GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS,
+ new ArrayList<>(EXPECTED_ALLOWED_USER_IDS));
- BeginGetPasswordOption option = new BeginGetPasswordOption(expectedAllowedUserIds,
- bundle, BUNDLE_ID);
+ BeginGetPasswordOption option =
+ new BeginGetPasswordOption(EXPECTED_ALLOWED_USER_IDS, bundle, BUNDLE_ID);
bundle.putString(BUNDLE_ID_KEY, BUNDLE_ID);
assertThat(option.getType()).isEqualTo(PasswordCredential.TYPE_PASSWORD_CREDENTIAL);
assertThat(TestUtilsKt.equals(option.getCandidateQueryData(), bundle)).isTrue();
- assertThat(option.getAllowedUserIds())
- .containsExactlyElementsIn(expectedAllowedUserIds);
+ assertThat(option.getAllowedUserIds()).containsExactlyElementsIn(EXPECTED_ALLOWED_USER_IDS);
+ }
+
+ @Test
+ public void createFrom_success() {
+ Bundle bundle = new Bundle();
+ bundle.putStringArrayList(
+ GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS,
+ new ArrayList<>(EXPECTED_ALLOWED_USER_IDS));
+
+ BeginGetPasswordOption option = BeginGetPasswordOption.createForTest(bundle, "id");
+ assertThat(option.getId()).isEqualTo("id");
+ }
+
+ private static Set<String> generateExpectedAllowedUserIds() {
+ Set<String> ids = new HashSet<>();
+ ids.add("id1");
+ ids.add("id2");
+ ids.add("id3");
+ return ids;
}
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionTest.kt
index f1b1206..676af2d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPasswordOptionTest.kt
@@ -60,20 +60,7 @@
ArrayList(expectedAllowedUserIds)
)
- var option = BeginGetPasswordOption.createFrom(bundle, "id")
+ var option = BeginGetPasswordOption.createForTest(bundle, "id")
assertThat(option.id).isEqualTo("id")
}
-
- @Test
- fun createFromEntrySlice_success() {
- val expectedAllowedUserIds: Set<String> = setOf("id1", "id2", "id3")
- val bundle = Bundle()
- bundle.putStringArrayList(
- GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS,
- ArrayList(expectedAllowedUserIds)
- )
-
- var option = BeginGetPasswordOption.createFromEntrySlice(bundle, "id")
- assertThat(option.id).isEqualTo("id")
- }
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPublicKeyCredentialOptionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPublicKeyCredentialOptionTest.kt
index 7a410f4..1fc0de9 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPublicKeyCredentialOptionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/BeginGetPublicKeyCredentialOptionTest.kt
@@ -146,4 +146,4 @@
val option = BeginGetPublicKeyCredentialOption.createFromEntrySlice(bundle, "id")
assertThat(option.id).isEqualTo("id")
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CallingAppInfoTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CallingAppInfoTest.kt
index 2e04b47..a15e88d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CallingAppInfoTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CallingAppInfoTest.kt
@@ -20,6 +20,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
+import com.google.common.truth.Truth.assertThat
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@@ -36,7 +37,11 @@
@Test
fun constructor_success_withOrigin() {
- CallingAppInfo("name", SigningInfo(), "origin")
+ val origin = "origin"
+ val callingAppInfo = CallingAppInfo("name", SigningInfo(), origin)
+
+ assertThat(callingAppInfo.getOrigin("{\"key\":\"value\"}")).isNull()
+ assertThat(callingAppInfo.origin).isEqualTo(origin)
}
@Test
@@ -48,4 +53,32 @@
CallingAppInfo("", SigningInfo(), "origin")
}
}
- }
\ No newline at end of file
+
+ @Test
+ fun getOrigin_emptyPrivilegedAllowlist_throwsException() {
+ val origin = "origin"
+ val callingAppInfo = CallingAppInfo("name", SigningInfo(), origin)
+
+ assertThat(callingAppInfo.origin).isEqualTo(origin)
+ Assert.assertThrows(
+ "Expected exception from emptyPrivilegedAllowList",
+ IllegalArgumentException::class.java
+ ) {
+ callingAppInfo.getOrigin("")
+ }
+ }
+
+ @Test
+ fun getOrigin_invalidJSON_throwsException() {
+ val origin = "origin"
+ val callingAppInfo = CallingAppInfo("name", SigningInfo(), origin)
+
+ assertThat(callingAppInfo.origin).isEqualTo(origin)
+ Assert.assertThrows(
+ "Expected exception from emptyPrivilegedAllowList",
+ IllegalArgumentException::class.java
+ ) {
+ callingAppInfo.getOrigin("invalid_json")
+ }
+ }
+ }
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialEntryTest.kt
index 66fc41e..c871a6c 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialEntryTest.kt
@@ -104,4 +104,4 @@
assertThat(result).isNotNull()
assertThat(result!!.type).isEqualTo("custom")
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceJavaTest.java
index 6f0606f..175992e 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceJavaTest.java
@@ -23,7 +23,6 @@
import android.os.CancellationSignal;
import android.os.OutcomeReceiver;
-import androidx.core.os.BuildCompat;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -35,15 +34,11 @@
@RunWith(AndroidJUnit4.class)
@SmallTest
-@SdkSuppress(minSdkVersion = 34, codeName = "UpsideDownCake")
+@SdkSuppress(minSdkVersion = 34)
public class CredentialProviderServiceJavaTest {
@Test
public void test_createRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
CredentialProviderServiceTestImpl service = new CredentialProviderServiceTestImpl();
service.setTestMode(true);
@@ -72,10 +67,6 @@
@Test
public void test_getRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
CredentialProviderServiceTestImpl service = new CredentialProviderServiceTestImpl();
service.setTestMode(true);
@@ -104,10 +95,6 @@
@Test
public void test_clearRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return;
- }
-
CredentialProviderServiceTestImpl service = new CredentialProviderServiceTestImpl();
service.setTestMode(true);
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTest.kt
index a863383..f040162 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTest.kt
@@ -21,7 +21,6 @@
import android.os.CancellationSignal
import android.os.OutcomeReceiver
import android.util.Log
-import androidx.core.os.BuildCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
@@ -29,7 +28,7 @@
import org.junit.Test
import org.junit.runner.RunWith
-@SdkSuppress(minSdkVersion = 34, codeName = "UpsideDownCake")
+@SdkSuppress(minSdkVersion = 34)
@RunWith(AndroidJUnit4::class)
@SmallTest
class CredentialProviderServiceTest {
@@ -38,10 +37,6 @@
@Test
fun test_createRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
var service = CredentialProviderServiceTestImpl()
service.isTestMode = true
@@ -64,10 +59,6 @@
@Test
fun test_getRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
var service = CredentialProviderServiceTestImpl()
service.isTestMode = true
@@ -90,10 +81,6 @@
@Test
fun test_clearRequest() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
-
var service = CredentialProviderServiceTestImpl()
service.isTestMode = true
@@ -113,4 +100,4 @@
service.onClearCredentialStateRequest(request, CancellationSignal(), outcome)
assertThat(service.lastClearRequest).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTestImpl.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTestImpl.kt
index 5459287..f737e8b 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTestImpl.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/CredentialProviderServiceTestImpl.kt
@@ -55,4 +55,4 @@
) {
Log.i(LOG_TAG, "onBeginCreateCredentialRequest")
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerJavaTest.java b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerJavaTest.java
index 6490d0e..5b332ac 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerJavaTest.java
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerJavaTest.java
@@ -19,9 +19,9 @@
import static com.google.common.truth.Truth.assertThat;
import android.content.Intent;
+import android.os.Build;
import androidx.annotation.RequiresApi;
-import androidx.core.os.BuildCompat;
import androidx.credentials.CreatePasswordResponse;
import androidx.credentials.GetCredentialResponse;
import androidx.credentials.PasswordCredential;
@@ -43,7 +43,7 @@
@Test
public void test_setGetCreateCredentialException() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -62,7 +62,7 @@
@Test
public void test_setGetCreateCredentialException_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -74,7 +74,7 @@
@Test
public void test_credentialException() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -92,7 +92,7 @@
@Test
public void test_credentialException_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -102,7 +102,7 @@
@Test
public void test_beginGetResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -120,7 +120,7 @@
@Test
public void test_beginGetResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -130,7 +130,7 @@
@Test
public void test_credentialResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -148,7 +148,7 @@
@Test
public void test_credentialResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -158,7 +158,7 @@
@Test
public void test_createCredentialCredentialResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
@@ -176,7 +176,7 @@
@Test
public void test_createCredentialCredentialResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return;
}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerTest.kt
index f14c8e0..c9ed499 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/PendingIntentHandlerTest.kt
@@ -16,12 +16,11 @@
package androidx.credentials.provider
import android.content.Intent
+import android.os.Build
import androidx.annotation.RequiresApi
-import androidx.core.os.BuildCompat
import androidx.credentials.CreatePasswordResponse
import androidx.credentials.GetCredentialResponse
import androidx.credentials.PasswordCredential
-import androidx.credentials.equals
import androidx.credentials.exceptions.CreateCredentialInterruptedException
import androidx.credentials.exceptions.GetCredentialInterruptedException
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -38,7 +37,7 @@
class PendingIntentHandlerTest {
@Test
fun test_createCredentialException() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -54,7 +53,7 @@
@Test()
fun test_createCredentialException_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -64,7 +63,7 @@
@Test
fun test_credentialException() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -80,7 +79,7 @@
@Test
fun test_credentialException_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -90,7 +89,7 @@
@Test
fun test_beginGetResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -106,7 +105,7 @@
@Test
fun test_beginGetResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -116,7 +115,7 @@
@Test
fun test_credentialResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -133,7 +132,7 @@
@Test
fun test_credentialResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -143,7 +142,7 @@
@Test
fun test_createCredentialCredentialResponse() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -159,7 +158,7 @@
@Test
fun test_createCredentialCredentialResponse_throwsWhenEmptyIntent() {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
return
}
@@ -167,4 +166,4 @@
val r = intent.getCreateCredentialCredentialResponse()
assertThat(r).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderClearCredentialStateRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderClearCredentialStateRequestTest.kt
index 63f06b6..15f7ee2 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderClearCredentialStateRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderClearCredentialStateRequestTest.kt
@@ -38,4 +38,4 @@
assertThat(equals(callingAppInfo, request.callingAppInfo)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderCreateCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderCreateCredentialRequestTest.kt
index 09f7864..615edc4 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderCreateCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderCreateCredentialRequestTest.kt
@@ -38,4 +38,4 @@
CallingAppInfo("name",
SigningInfo()))
}
- }
\ No newline at end of file
+ }
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderGetCredentialRequestTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderGetCredentialRequestTest.kt
index 608b50c..9aecc89 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderGetCredentialRequestTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ProviderGetCredentialRequestTest.kt
@@ -132,4 +132,4 @@
assertThat(actualPackageName).isEqualTo(expectedPackageName)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/ActionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/ActionTest.kt
index 102ef17..cb4dfb8 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/ActionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/ActionTest.kt
@@ -76,4 +76,4 @@
private val TITLE: CharSequence = "title"
private val SUBTITLE: CharSequence = "subtitle"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/AuthenticationActionTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/AuthenticationActionTest.kt
index 8c13327..c3368fb 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/AuthenticationActionTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/AuthenticationActionTest.kt
@@ -78,4 +78,4 @@
companion object {
private val TITLE: CharSequence = "title"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CreateEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CreateEntryTest.kt
index b363f1d..f9beea4 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CreateEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CreateEntryTest.kt
@@ -190,4 +190,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CustomCredentialEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CustomCredentialEntryTest.kt
index a1b107b..b98f3ce 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CustomCredentialEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/CustomCredentialEntryTest.kt
@@ -218,4 +218,4 @@
)
private const val IS_AUTO_SELECT_ALLOWED = true
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PasswordCredentialEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PasswordCredentialEntryTest.kt
index d0f1114..63793da 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PasswordCredentialEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PasswordCredentialEntryTest.kt
@@ -184,4 +184,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PublicKeyCredentialEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PublicKeyCredentialEntryTest.kt
index 74c9a24..69ba63c 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PublicKeyCredentialEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/PublicKeyCredentialEntryTest.kt
@@ -168,4 +168,4 @@
100, 100, Bitmap.Config.ARGB_8888))
private const val IS_AUTO_SELECT_ALLOWED = true
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/RemoteEntryTest.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/RemoteEntryTest.kt
index ba8e42f..ec430cf 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/RemoteEntryTest.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/RemoteEntryTest.kt
@@ -65,4 +65,4 @@
assertThat(fromSlice.pendingIntent).isEqualTo(mPendingIntent)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/UiUtils.kt b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/UiUtils.kt
index 60cd479..65cc56d 100644
--- a/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/UiUtils.kt
+++ b/credentials/credentials/src/androidTest/java/androidx/credentials/provider/ui/UiUtils.kt
@@ -119,4 +119,4 @@
return RemoteEntry(sPendingIntent)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/ClearCredentialStateRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/ClearCredentialStateRequest.kt
index b8d3296..e72b8d3 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/ClearCredentialStateRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/ClearCredentialStateRequest.kt
@@ -19,4 +19,4 @@
/**
* Request class for clearing a user's credential state from the credential providers.
*/
-class ClearCredentialStateRequest
\ No newline at end of file
+class ClearCredentialStateRequest
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialRequest.kt
index b5f580e..0bd8e7a 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialRequest.kt
@@ -79,4 +79,4 @@
init {
require(type.isNotEmpty()) { "type should not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialResponse.kt
index a623a2e..d56acfa 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CreateCustomCredentialResponse.kt
@@ -45,4 +45,4 @@
init {
require(type.isNotEmpty()) { "type should not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordRequest.kt
index 33f8b28..0c41df0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordRequest.kt
@@ -195,4 +195,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordResponse.kt
index bd173fc..48c3357 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CreatePasswordResponse.kt
@@ -33,4 +33,4 @@
return CreatePasswordResponse(data)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CreatePublicKeyCredentialResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/CreatePublicKeyCredentialResponse.kt
index 75c2f12..52c8f9b 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CreatePublicKeyCredentialResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CreatePublicKeyCredentialResponse.kt
@@ -71,4 +71,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CredentialManager.kt b/credentials/credentials/src/main/java/androidx/credentials/CredentialManager.kt
index 86dedcf..d4f1a18 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CredentialManager.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CredentialManager.kt
@@ -446,4 +446,4 @@
*/
@RequiresApi(34)
fun createSettingsPendingIntent(): PendingIntent
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerCallback.kt b/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerCallback.kt
index 01cd115..88b7ab3 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerCallback.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerCallback.kt
@@ -30,4 +30,4 @@
fun onResult(result: R)
fun onError(e: E)
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerImpl.kt b/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerImpl.kt
index c1a50eb..f39f2ef 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerImpl.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CredentialManagerImpl.kt
@@ -276,4 +276,4 @@
intent.setData(Uri.parse("package:" + context.getPackageName()))
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CredentialProvider.kt b/credentials/credentials/src/main/java/androidx/credentials/CredentialProvider.kt
index 1dab141..9ff58c3 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CredentialProvider.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CredentialProvider.kt
@@ -133,4 +133,4 @@
executor: Executor,
callback: CredentialManagerCallback<GetCredentialResponse, GetCredentialException>,
) {}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CredentialProviderFrameworkImpl.kt b/credentials/credentials/src/main/java/androidx/credentials/CredentialProviderFrameworkImpl.kt
index 7b571a4..426f370 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CredentialProviderFrameworkImpl.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CredentialProviderFrameworkImpl.kt
@@ -29,17 +29,23 @@
import androidx.credentials.exceptions.ClearCredentialUnknownException
import androidx.credentials.exceptions.ClearCredentialUnsupportedException
import androidx.credentials.exceptions.CreateCredentialCancellationException
+import androidx.credentials.exceptions.CreateCredentialCustomException
import androidx.credentials.exceptions.CreateCredentialException
import androidx.credentials.exceptions.CreateCredentialInterruptedException
import androidx.credentials.exceptions.CreateCredentialNoCreateOptionException
import androidx.credentials.exceptions.CreateCredentialUnknownException
import androidx.credentials.exceptions.CreateCredentialUnsupportedException
import androidx.credentials.exceptions.GetCredentialCancellationException
+import androidx.credentials.exceptions.GetCredentialCustomException
import androidx.credentials.exceptions.GetCredentialException
import androidx.credentials.exceptions.GetCredentialInterruptedException
import androidx.credentials.exceptions.GetCredentialUnknownException
import androidx.credentials.exceptions.GetCredentialUnsupportedException
import androidx.credentials.exceptions.NoCredentialException
+import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException
+import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException
+import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialDomException
+import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialException
import androidx.credentials.internal.FrameworkImplHelper
import java.util.concurrent.Executor
@@ -275,6 +281,7 @@
internal fun convertToJetpackGetException(error: android.credentials.GetCredentialException):
GetCredentialException {
+
return when (error.type) {
android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL ->
NoCredentialException(error.message)
@@ -285,7 +292,16 @@
android.credentials.GetCredentialException.TYPE_INTERRUPTED ->
GetCredentialInterruptedException(error.message)
- else -> GetCredentialUnknownException(error.message)
+ android.credentials.GetCredentialException.TYPE_UNKNOWN ->
+ GetCredentialUnknownException(error.message)
+
+ else -> {
+ if (error.type.startsWith(GET_DOM_EXCEPTION_PREFIX)) {
+ GetPublicKeyCredentialException.createFrom(error.type, error.message)
+ } else {
+ GetCredentialCustomException(error.type, error.message)
+ }
+ }
}
}
@@ -302,7 +318,16 @@
android.credentials.CreateCredentialException.TYPE_INTERRUPTED ->
CreateCredentialInterruptedException(error.message)
- else -> CreateCredentialUnknownException(error.message)
+ android.credentials.CreateCredentialException.TYPE_UNKNOWN ->
+ CreateCredentialUnknownException(error.message)
+
+ else -> {
+ if (error.type.startsWith(CREATE_DOM_EXCEPTION_PREFIX)) {
+ CreatePublicKeyCredentialException.createFrom(error.type, error.message)
+ } else {
+ CreateCredentialCustomException(error.type, error.message)
+ }
+ }
}
}
@@ -373,5 +398,10 @@
private companion object {
private const val TAG = "CredManProvService"
+
+ private const val GET_DOM_EXCEPTION_PREFIX =
+ GetPublicKeyCredentialDomException.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION
+ private const val CREATE_DOM_EXCEPTION_PREFIX =
+ CreatePublicKeyCredentialDomException.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/CustomCredential.kt b/credentials/credentials/src/main/java/androidx/credentials/CustomCredential.kt
index a229a32..eadbc79 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/CustomCredential.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/CustomCredential.kt
@@ -46,4 +46,4 @@
init {
require(type.isNotEmpty()) { "type should not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/FederatedCredential.kt b/credentials/credentials/src/main/java/androidx/credentials/FederatedCredential.kt
index e30588e..0726bd7 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/FederatedCredential.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/FederatedCredential.kt
@@ -32,4 +32,4 @@
/** The type value for federated credential related operations. */
const val TYPE_FEDERATED_CREDENTIAL: String = "type.federated_credential"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/GetCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/GetCredentialRequest.kt
index 0f2e462..2dcd33e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/GetCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/GetCredentialRequest.kt
@@ -205,4 +205,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/GetCustomCredentialOption.kt b/credentials/credentials/src/main/java/androidx/credentials/GetCustomCredentialOption.kt
index 5ced43a..898ae67e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/GetCustomCredentialOption.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/GetCustomCredentialOption.kt
@@ -70,4 +70,4 @@
init {
require(type.isNotEmpty()) { "type should not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/GetPasswordOption.kt b/credentials/credentials/src/main/java/androidx/credentials/GetPasswordOption.kt
index c37d50d..c423f5b 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/GetPasswordOption.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/GetPasswordOption.kt
@@ -92,4 +92,4 @@
return bundle
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/PrepareGetCredentialResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/PrepareGetCredentialResponse.kt
index e4d2572..7129ef1 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/PrepareGetCredentialResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/PrepareGetCredentialResponse.kt
@@ -194,18 +194,21 @@
private var hasCredentialResultsDelegate: HasCredentialResultsDelegate? = null
/** Sets the credential type handler. */
+ @VisibleForTesting
fun setCredentialTypeDelegate(handler: HasCredentialResultsDelegate): TestBuilder {
this.hasCredentialResultsDelegate = handler
return this
}
/** Sets the has authentication results bit. */
+ @VisibleForTesting
fun setHasAuthResultsDelegate(handler: HasAuthenticationResultsDelegate): TestBuilder {
this.hasAuthResultsDelegate = handler
return this
}
/** Sets the has remote results bit. */
+ @VisibleForTesting
fun setHasRemoteResultsDelegate(handler: HasRemoteResultsDelegate): TestBuilder {
this.hasRemoteResultsDelegate = handler
return this
@@ -231,4 +234,4 @@
typealias HasAuthenticationResultsDelegate = () -> Boolean
-typealias HasRemoteResultsDelegate = () -> Boolean
\ No newline at end of file
+typealias HasRemoteResultsDelegate = () -> Boolean
diff --git a/credentials/credentials/src/main/java/androidx/credentials/PublicKeyCredential.kt b/credentials/credentials/src/main/java/androidx/credentials/PublicKeyCredential.kt
index f3789dc..8bb3797 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/PublicKeyCredential.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/PublicKeyCredential.kt
@@ -80,4 +80,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCustomCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialCustomException.kt
similarity index 95%
rename from credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCustomCredentialException.kt
rename to credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialCustomException.kt
index babc2fe..3519fb9 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCustomCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialCustomException.kt
@@ -30,11 +30,11 @@
* @throws IllegalArgumentException If [type] is empty
* @throws NullPointerException If [type] is null
*/
-class ClearCustomCredentialException @JvmOverloads constructor(
+class ClearCredentialCustomException @JvmOverloads constructor(
override val type: String,
errorMessage: CharSequence? = null
) : ClearCredentialException(type, errorMessage) {
init {
require(type.isNotEmpty()) { "type must not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialException.kt
index 166e8bf..da97d99 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialException.kt
@@ -32,4 +32,4 @@
open val type: String,
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
open val errorMessage: CharSequence? = null
-) : Exception(errorMessage?.toString())
\ No newline at end of file
+) : Exception(errorMessage?.toString())
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialInterruptedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialInterruptedException.kt
index 40225aa9..b87d8b7 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialInterruptedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialInterruptedException.kt
@@ -30,4 +30,4 @@
internal const val TYPE_CLEAR_CREDENTIAL_INTERRUPTED_EXCEPTION =
"androidx.credentials.TYPE_CLEAR_CREDENTIAL_INTERRUPTED_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationException.kt
index a85e8aa..df68df0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialProviderConfigurationException.kt
@@ -30,4 +30,4 @@
internal const val TYPE_CLEAR_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION =
"androidx.credentials.TYPE_CLEAR_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnknownException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnknownException.kt
index a311e17..baaeb61 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnknownException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnknownException.kt
@@ -28,4 +28,4 @@
internal const val TYPE_CLEAR_CREDENTIAL_UNKNOWN_EXCEPTION =
"android.credentials.ClearCredentialStateException.TYPE_UNKNOWN"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnsupportedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnsupportedException.kt
index 1c522ad..814cc4d 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnsupportedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/ClearCredentialUnsupportedException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_CLEAR_CREDENTIAL_UNSUPPORTED_EXCEPTION =
"androidx.credentials.TYPE_CLEAR_CREDENTIAL_UNSUPPORTED_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCancellationException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCancellationException.kt
index 5bc8f11..e9bd40f 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCancellationException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCancellationException.kt
@@ -30,4 +30,4 @@
internal const val TYPE_CREATE_CREDENTIAL_CANCELLATION_EXCEPTION =
"android.credentials.CreateCredentialException.TYPE_USER_CANCELED"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCustomCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCustomException.kt
similarity index 95%
rename from credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCustomCredentialException.kt
rename to credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCustomException.kt
index c37ef3e..46e4045 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCustomCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialCustomException.kt
@@ -30,11 +30,11 @@
* @throws IllegalArgumentException If [type] is empty
* @throws NullPointerException If [type] is null
*/
-class CreateCustomCredentialException @JvmOverloads constructor(
+class CreateCredentialCustomException @JvmOverloads constructor(
override val type: String,
errorMessage: CharSequence? = null
) : CreateCredentialException(type, errorMessage) {
init {
require(type.isNotEmpty()) { "type must not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialException.kt
index 78a6f26..91130b8 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialException.kt
@@ -33,4 +33,4 @@
open val type: String,
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
open val errorMessage: CharSequence? = null
-) : Exception(errorMessage?.toString())
\ No newline at end of file
+) : Exception(errorMessage?.toString())
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialInterruptedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialInterruptedException.kt
index 1e1f176..34d1fed 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialInterruptedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialInterruptedException.kt
@@ -30,4 +30,4 @@
internal const val TYPE_CREATE_CREDENTIAL_INTERRUPTED_EXCEPTION =
"android.credentials.CreateCredentialException.TYPE_INTERRUPTED"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException.kt
index 0382924..936b642 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException.kt
@@ -29,4 +29,4 @@
internal const val TYPE_CREATE_CREDENTIAL_NO_CREATE_OPTION =
"android.credentials.CreateCredentialException.TYPE_NO_CREATE_OPTIONS"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException.kt
index f371d7e..01a5b55 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_CREATE_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION =
"androidx.credentials.TYPE_CREATE_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnknownException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnknownException.kt
index cb16a64..6325bde 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnknownException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnknownException.kt
@@ -29,4 +29,4 @@
internal const val TYPE_CREATE_CREDENTIAL_UNKNOWN_EXCEPTION =
"android.credentials.CreateCredentialException.TYPE_UNKNOWN"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnsupportedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnsupportedException.kt
index df0250c..4df3040 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnsupportedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/CreateCredentialUnsupportedException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_CREATE_CREDENTIAL_UNSUPPORTED_EXCEPTION =
"androidx.credentials.TYPE_CREATE_CREDENTIAL_UNSUPPORTED_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCancellationException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCancellationException.kt
index 9cf49be..3218631 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCancellationException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCancellationException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_GET_CREDENTIAL_CANCELLATION_EXCEPTION =
"android.credentials.GetCredentialException.TYPE_USER_CANCELED"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCustomCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCustomException.kt
similarity index 95%
rename from credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCustomCredentialException.kt
rename to credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCustomException.kt
index 8cfa559..2c22b5e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCustomCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialCustomException.kt
@@ -30,11 +30,11 @@
* @throws IllegalArgumentException If [type] is empty
* @throws NullPointerException If [type] is null
*/
-class GetCustomCredentialException @JvmOverloads constructor(
+class GetCredentialCustomException @JvmOverloads constructor(
override val type: String,
errorMessage: CharSequence? = null
) : GetCredentialException(type, errorMessage) {
init {
require(type.isNotEmpty()) { "type must not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialException.kt
index d6383e9..5a712ed 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialException.kt
@@ -33,4 +33,4 @@
open val type: String,
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
open val errorMessage: CharSequence? = null
-) : Exception(errorMessage?.toString())
\ No newline at end of file
+) : Exception(errorMessage?.toString())
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialInterruptedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialInterruptedException.kt
index 8ed0357..3ad6719 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialInterruptedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialInterruptedException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_GET_CREDENTIAL_INTERRUPTED_EXCEPTION =
"android.credentials.GetCredentialException.TYPE_INTERRUPTED"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationException.kt
index 2fceba4..2b0b3c0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialProviderConfigurationException.kt
@@ -30,4 +30,4 @@
internal const val TYPE_GET_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION =
"androidx.credentials.TYPE_GET_CREDENTIAL_PROVIDER_CONFIGURATION_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnknownException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnknownException.kt
index fca2aa7..42fc109 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnknownException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnknownException.kt
@@ -29,4 +29,4 @@
internal const val TYPE_GET_CREDENTIAL_UNKNOWN_EXCEPTION =
"android.credentials.GetCredentialException.TYPE_UNKNOWN"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnsupportedException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnsupportedException.kt
index 827050d..7694d3f2 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnsupportedException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/GetCredentialUnsupportedException.kt
@@ -31,4 +31,4 @@
internal const val TYPE_GET_CREDENTIAL_UNSUPPORTED_EXCEPTION =
"androidx.credentials.TYPE_GET_CREDENTIAL_UNSUPPORTED_EXCEPTION"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/NoCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/NoCredentialException.kt
index 961dfb2..94b90d1 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/NoCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/NoCredentialException.kt
@@ -34,4 +34,4 @@
internal const val TYPE_FRAMEWORK_TYPE_NO_CREDENTIAL =
"android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/AbortError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/AbortError.kt
index dee644b..d23ce5f 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/AbortError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/AbortError.kt
@@ -26,6 +26,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ABORT_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ABORT_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ABORT_ERROR"
+ "androidx.credentials.TYPE_ABORT_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ConstraintError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ConstraintError.kt
index f6cb08a..2943f84 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ConstraintError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ConstraintError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_CONSTRAINT_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_CONSTRAINT_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_CONSTRAINT_ERROR"
+ "androidx.credentials.TYPE_CONSTRAINT_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataCloneError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataCloneError.kt
index b9bb35f..2203405 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataCloneError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataCloneError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_CLONE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_CLONE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_CLONE_ERROR"
+ "androidx.credentials.TYPE_DATA_CLONE_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataError.kt
index 334f169..3a34b42 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DataError.kt
@@ -27,6 +27,6 @@
class DataError : DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_ERROR"
+ "androidx.credentials.TYPE_DATA_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DomError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DomError.kt
index e4ed965..f2d4084 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DomError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/DomError.kt
@@ -47,4 +47,4 @@
@get:VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
open val type: String
-)
\ No newline at end of file
+)
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/EncodingError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/EncodingError.kt
index 288ded0..4279d69 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/EncodingError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/EncodingError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ENCODING_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ENCODING_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ENCODING_ERROR"
+ "androidx.credentials.TYPE_ENCODING_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/HierarchyRequestError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/HierarchyRequestError.kt
index f676b25..2697895 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/HierarchyRequestError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/HierarchyRequestError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_HIERARCHY_REQUEST_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_HIERARCHY_REQUEST_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_HIERARCHY_REQUEST_ERROR"
+ "androidx.credentials.TYPE_HIERARCHY_REQUEST_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InUseAttributeError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InUseAttributeError.kt
index 56de3f6..c1b192c 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InUseAttributeError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InUseAttributeError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_IN_USE_ATTRIBUTE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_IN_USE_ATTRIBUTE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_IN_USE_ATTRIBUTE_ERROR"
+ "androidx.credentials.TYPE_IN_USE_ATTRIBUTE_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidCharacterError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidCharacterError.kt
index e35872e..eb47791 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidCharacterError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidCharacterError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_CHARACTER_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_CHARACTER_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_CHARACTER_ERROR"
+ "androidx.credentials.TYPE_INVALID_CHARACTER_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidModificationError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidModificationError.kt
index 29a6ff8..f340995 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidModificationError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidModificationError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_MODIFICATION_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_MODIFICATION_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_MODIFICATION_ERROR"
+ "androidx.credentials.TYPE_INVALID_MODIFICATION_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidNodeTypeError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidNodeTypeError.kt
index c5dd16c..c1eaebe 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidNodeTypeError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidNodeTypeError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_NODE_TYPE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_NODE_TYPE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_NODE_TYPE_ERROR"
+ "androidx.credentials.TYPE_INVALID_NODE_TYPE_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidStateError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidStateError.kt
index 472d378..79853da 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidStateError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/InvalidStateError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_STATE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_STATE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_STATE_ERROR"
+ "androidx.credentials.TYPE_INVALID_STATE_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NamespaceError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NamespaceError.kt
index 0a17765..22fc31d 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NamespaceError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NamespaceError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NAMESPACE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NAMESPACE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NAMESPACE_ERROR"
+ "androidx.credentials.TYPE_NAMESPACE_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NetworkError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NetworkError.kt
index c571e88..c2b7aaf 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NetworkError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NetworkError.kt
@@ -26,6 +26,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NETWORK_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NETWORK_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NETWORK_ERROR"
+ "androidx.credentials.TYPE_NETWORK_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NoModificationAllowedError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NoModificationAllowedError.kt
index 0186cf4..36da1e7 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NoModificationAllowedError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NoModificationAllowedError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NO_MODIFICATION_ALLOWED_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NO_MODIFICATION_ALLOWED_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NO_MODIFICATION_ALLOWED_ERROR"
+ "androidx.credentials.TYPE_NO_MODIFICATION_ALLOWED_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotAllowedError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotAllowedError.kt
index 756998e..78538e0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotAllowedError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotAllowedError.kt
@@ -28,6 +28,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_ALLOWED_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_ALLOWED_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_ALLOWED_ERROR"
+ "androidx.credentials.TYPE_NOT_ALLOWED_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotFoundError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotFoundError.kt
index 25d974c..3236283 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotFoundError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotFoundError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_FOUND_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_FOUND_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_FOUND_ERROR"
+ "androidx.credentials.TYPE_NOT_FOUND_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotReadableError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotReadableError.kt
index 312506c..b07b868 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotReadableError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotReadableError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_READABLE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_READABLE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_READABLE_ERROR"
+ "androidx.credentials.TYPE_NOT_READABLE_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotSupportedError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotSupportedError.kt
index eff95cf..c2a3202 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotSupportedError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/NotSupportedError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_SUPPORTED_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_SUPPORTED_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_SUPPORTED_ERROR"
+ "androidx.credentials.TYPE_NOT_SUPPORTED_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OperationError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OperationError.kt
index f55f92d..ec738e1 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OperationError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OperationError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPERATION_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPERATION_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPERATION_ERROR"
+ "androidx.credentials.TYPE_OPERATION_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OptOutError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OptOutError.kt
index e45d315..37c4a0b 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OptOutError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/OptOutError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPT_OUT_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPT_OUT_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPT_OUT_ERROR"
+ "androidx.credentials.TYPE_OPT_OUT_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/QuotaExceededError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/QuotaExceededError.kt
index c00f181..21bc479 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/QuotaExceededError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/QuotaExceededError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_QUOTA_EXCEEDED_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_QUOTA_EXCEEDED_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_QUOTA_EXCEEDED_ERROR"
+ "androidx.credentials.TYPE_QUOTA_EXCEEDED_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ReadOnlyError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ReadOnlyError.kt
index 692ee25..fe4d3e9 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ReadOnlyError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/ReadOnlyError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_READ_ONLY_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_READ_ONLY_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_READ_ONLY_ERROR"
+ "androidx.credentials.TYPE_READ_ONLY_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SecurityError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SecurityError.kt
index 47edb55..6358dfc 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SecurityError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SecurityError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SECURITY_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SECURITY_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SECURITY_ERROR"
+ "androidx.credentials.TYPE_SECURITY_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SyntaxError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SyntaxError.kt
index ef01d77..77145cd 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SyntaxError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/SyntaxError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SYNTAX_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SYNTAX_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SYNTAX_ERROR"
+ "androidx.credentials.TYPE_SYNTAX_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TimeoutError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TimeoutError.kt
index f37cb1e..8ba6a1e0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TimeoutError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TimeoutError.kt
@@ -26,6 +26,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TIMEOUT_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TIMEOUT_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TIMEOUT_ERROR"
+ "androidx.credentials.TYPE_TIMEOUT_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TransactionInactiveError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TransactionInactiveError.kt
index fd1dbcd..8464c4a 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TransactionInactiveError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/TransactionInactiveError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TRANSACTION_INACTIVE_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TRANSACTION_INACTIVE_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TRANSACTION_INACTIVE_ERROR"
+ "androidx.credentials.TYPE_TRANSACTION_INACTIVE_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/UnknownError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/UnknownError.kt
index 70f8db2..beb4212 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/UnknownError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/UnknownError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_UNKNOWN_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_UNKNOWN_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_UNKNOWN_ERROR"
+ "androidx.credentials.TYPE_UNKNOWN_ERROR"
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/VersionError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/VersionError.kt
index 39b12f1..33d4975 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/VersionError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/VersionError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_VERSION_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_VERSION_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_VERSION_ERROR"
+ "androidx.credentials.TYPE_VERSION_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/WrongDocumentError.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/WrongDocumentError.kt
index 0040020..25fced2 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/WrongDocumentError.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/domerrors/WrongDocumentError.kt
@@ -27,6 +27,6 @@
DomError(TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_WRONG_DOCUMENT_ERROR) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_WRONG_DOCUMENT_ERROR: String =
- "androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_WRONG_DOCUMENT_ERROR"
+ "androidx.credentials.TYPE_WRONG_DOCUMENT_ERROR"
}
}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException.kt
index c71d09c..584247b 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException.kt
@@ -16,7 +16,13 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.annotation.RestrictTo
+import androidx.credentials.exceptions.CreateCredentialCustomException
+import androidx.credentials.exceptions.CreateCredentialException
import androidx.credentials.exceptions.domerrors.DomError
+import androidx.credentials.exceptions.domerrors.UnknownError
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
+import androidx.credentials.internal.FrameworkClassParsingException
/**
* During the create-passkey flow, this is thrown when a DOM Exception is thrown,
@@ -32,10 +38,23 @@
val domError: DomError,
errorMessage: CharSequence? = null
) : CreatePublicKeyCredentialException(
- TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + domError.type,
+ TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR + domError.type,
errorMessage) {
internal companion object {
internal const val TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION: String =
"androidx.credentials.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION"
+ @JvmStatic
+ @RestrictTo(RestrictTo.Scope.LIBRARY) // used from java tests
+ fun createFrom(type: String, msg: String?): CreateCredentialException {
+ val prefix = "$TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION$SEPARATOR"
+ return try {
+ DomExceptionUtils.generateDomException(type, prefix, msg,
+ CreatePublicKeyCredentialDomException(UnknownError()))
+ } catch (t: FrameworkClassParsingException) {
+ // Parsing failed but don't crash the process. Instead just output a response
+ // with the raw framework values.
+ CreateCredentialCustomException(type, msg)
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException.kt
index 9647903..9b8367f 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException.kt
@@ -18,7 +18,9 @@
import androidx.annotation.RestrictTo
import androidx.credentials.CredentialManager
+import androidx.credentials.exceptions.CreateCredentialCustomException
import androidx.credentials.exceptions.CreateCredentialException
+import androidx.credentials.internal.FrameworkClassParsingException
/**
* A subclass of CreateCredentialException for unique exceptions thrown specific only to
@@ -36,4 +38,25 @@
init {
require(type.isNotEmpty()) { "type must not be empty" }
}
-}
\ No newline at end of file
+
+ internal companion object {
+ @JvmStatic
+ @RestrictTo(RestrictTo.Scope.LIBRARY) // used from java tests
+ fun createFrom(type: String, msg: String?): CreateCredentialException {
+ return try {
+ with(type) {
+ when {
+ contains(CreatePublicKeyCredentialDomException
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION) ->
+ CreatePublicKeyCredentialDomException.createFrom(type, msg)
+ else -> { throw FrameworkClassParsingException() }
+ }
+ }
+ } catch (t: FrameworkClassParsingException) {
+ // Parsing failed but don't crash the process. Instead just output a response
+ // with the raw framework values.
+ CreateCredentialCustomException(type, msg)
+ }
+ }
+ }
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/DomExceptionUtils.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/DomExceptionUtils.kt
new file mode 100644
index 0000000..b9cf8ae
--- /dev/null
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/DomExceptionUtils.kt
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.credentials.exceptions.publickeycredential
+
+import androidx.annotation.RestrictTo
+import androidx.credentials.exceptions.domerrors.AbortError
+import androidx.credentials.exceptions.domerrors.ConstraintError
+import androidx.credentials.exceptions.domerrors.DataCloneError
+import androidx.credentials.exceptions.domerrors.DataError
+import androidx.credentials.exceptions.domerrors.DomError
+import androidx.credentials.exceptions.domerrors.EncodingError
+import androidx.credentials.exceptions.domerrors.HierarchyRequestError
+import androidx.credentials.exceptions.domerrors.InUseAttributeError
+import androidx.credentials.exceptions.domerrors.InvalidCharacterError
+import androidx.credentials.exceptions.domerrors.InvalidModificationError
+import androidx.credentials.exceptions.domerrors.InvalidNodeTypeError
+import androidx.credentials.exceptions.domerrors.InvalidStateError
+import androidx.credentials.exceptions.domerrors.NamespaceError
+import androidx.credentials.exceptions.domerrors.NetworkError
+import androidx.credentials.exceptions.domerrors.NoModificationAllowedError
+import androidx.credentials.exceptions.domerrors.NotAllowedError
+import androidx.credentials.exceptions.domerrors.NotFoundError
+import androidx.credentials.exceptions.domerrors.NotReadableError
+import androidx.credentials.exceptions.domerrors.NotSupportedError
+import androidx.credentials.exceptions.domerrors.OperationError
+import androidx.credentials.exceptions.domerrors.OptOutError
+import androidx.credentials.exceptions.domerrors.QuotaExceededError
+import androidx.credentials.exceptions.domerrors.ReadOnlyError
+import androidx.credentials.exceptions.domerrors.SecurityError
+import androidx.credentials.exceptions.domerrors.SyntaxError
+import androidx.credentials.exceptions.domerrors.TimeoutError
+import androidx.credentials.exceptions.domerrors.TransactionInactiveError
+import androidx.credentials.exceptions.domerrors.UnknownError
+import androidx.credentials.exceptions.domerrors.VersionError
+import androidx.credentials.exceptions.domerrors.WrongDocumentError
+import androidx.credentials.internal.FrameworkClassParsingException
+
+/**
+ * An internal class that parses dom exceptions originating from providers.
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+internal class DomExceptionUtils {
+ companion object {
+
+ const val SEPARATOR = "/"
+
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ internal inline fun <reified T>
+ generateDomException(type: String, prefix: String, msg: String?, t: T): T {
+
+ return when (type) {
+ prefix + AbortError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ABORT_ERROR ->
+ generateException(AbortError(), msg, t)
+ prefix + ConstraintError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_CONSTRAINT_ERROR ->
+ generateException(ConstraintError(), msg, t)
+ prefix + DataCloneError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_CLONE_ERROR ->
+ generateException(DataCloneError(), msg, t)
+ prefix + DataError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_DATA_ERROR ->
+ generateException(DataError(), msg, t)
+ prefix + EncodingError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_ENCODING_ERROR ->
+ generateException(EncodingError(), msg, t)
+ prefix + HierarchyRequestError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_HIERARCHY_REQUEST_ERROR ->
+ generateException(HierarchyRequestError(), msg, t)
+ prefix + InUseAttributeError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_IN_USE_ATTRIBUTE_ERROR ->
+ generateException(InUseAttributeError(), msg, t)
+ prefix + InvalidCharacterError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_CHARACTER_ERROR ->
+ generateException(InvalidCharacterError(), msg, t)
+ prefix + InvalidModificationError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_MODIFICATION_ERROR ->
+ generateException(InvalidModificationError(), msg, t)
+ prefix + InvalidNodeTypeError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_NODE_TYPE_ERROR ->
+ generateException(InvalidNodeTypeError(), msg, t)
+ prefix + InvalidStateError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_INVALID_STATE_ERROR ->
+ generateException(InvalidStateError(), msg, t)
+ prefix + NamespaceError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NAMESPACE_ERROR ->
+ generateException(NamespaceError(), msg, t)
+ prefix + NetworkError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NETWORK_ERROR ->
+ generateException(NetworkError(), msg, t)
+ prefix + NoModificationAllowedError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NO_MODIFICATION_ALLOWED_ERROR ->
+ generateException(NoModificationAllowedError(), msg, t)
+ prefix + NotAllowedError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_ALLOWED_ERROR ->
+ generateException(NotAllowedError(), msg, t)
+ prefix + NotFoundError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_FOUND_ERROR ->
+ generateException(NotFoundError(), msg, t)
+ prefix + NotReadableError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_READABLE_ERROR ->
+ generateException(NotReadableError(), msg, t)
+ prefix + NotSupportedError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_NOT_SUPPORTED_ERROR ->
+ generateException(NotSupportedError(), msg, t)
+ prefix + OperationError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPERATION_ERROR ->
+ generateException(OperationError(), msg, t)
+ prefix + OptOutError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_OPT_OUT_ERROR ->
+ generateException(OptOutError(), msg, t)
+ prefix + QuotaExceededError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_QUOTA_EXCEEDED_ERROR ->
+ generateException(QuotaExceededError(), msg, t)
+ prefix + ReadOnlyError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_READ_ONLY_ERROR ->
+ generateException(ReadOnlyError(), msg, t)
+ prefix + SecurityError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SECURITY_ERROR ->
+ generateException(SecurityError(), msg, t)
+ prefix + SyntaxError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_SYNTAX_ERROR ->
+ generateException(SyntaxError(), msg, t)
+ prefix + TimeoutError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TIMEOUT_ERROR ->
+ generateException(TimeoutError(), msg, t)
+ prefix + TransactionInactiveError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_TRANSACTION_INACTIVE_ERROR ->
+ generateException(TransactionInactiveError(), msg, t)
+ prefix + UnknownError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_UNKNOWN_ERROR ->
+ generateException(UnknownError(), msg, t)
+ prefix + VersionError.TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_VERSION_ERROR ->
+ generateException(VersionError(), msg, t)
+ prefix + WrongDocumentError
+ .TYPE_CREATE_PUBLIC_KEY_CREDENTIAL_WRONG_DOCUMENT_ERROR ->
+ generateException(WrongDocumentError(), msg, t)
+ else -> throw FrameworkClassParsingException()
+ }
+ }
+
+ @Suppress("UNCHECKED_CAST") // Checked, worst case we throw a parsing exception
+ private fun <T> generateException(domError: DomError, msg: String?, t: T): T {
+ return when (t) {
+ is CreatePublicKeyCredentialDomException -> {
+ CreatePublicKeyCredentialDomException(domError, msg) as T
+ }
+ is GetPublicKeyCredentialDomException -> {
+ GetPublicKeyCredentialDomException(domError, msg) as T
+ }
+ else -> {
+ throw FrameworkClassParsingException()
+ }
+ }
+ }
+ }
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomException.kt
index ba91548..e49dd71 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomException.kt
@@ -16,7 +16,13 @@
package androidx.credentials.exceptions.publickeycredential
+import androidx.annotation.RestrictTo
+import androidx.credentials.exceptions.GetCredentialCustomException
+import androidx.credentials.exceptions.GetCredentialException
import androidx.credentials.exceptions.domerrors.DomError
+import androidx.credentials.exceptions.domerrors.UnknownError
+import androidx.credentials.exceptions.publickeycredential.DomExceptionUtils.Companion.SEPARATOR
+import androidx.credentials.internal.FrameworkClassParsingException
/**
* During the get-passkey flow, this is thrown when a DOM Exception is thrown,
@@ -32,10 +38,25 @@
val domError: DomError,
errorMessage: CharSequence? = null
) : GetPublicKeyCredentialException(
- TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + domError.type,
+ TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION + SEPARATOR + domError.type,
errorMessage) {
internal companion object {
internal const val TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION: String =
"androidx.credentials.TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION"
+
+ @JvmStatic
+ @RestrictTo(RestrictTo.Scope.LIBRARY) // used from java tests
+ fun createFrom(type: String, msg: String?): GetCredentialException {
+ val prefix =
+ "$TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION$SEPARATOR"
+ return try {
+ DomExceptionUtils.generateDomException(type, prefix, msg,
+ GetPublicKeyCredentialDomException(UnknownError()))
+ } catch (t: FrameworkClassParsingException) {
+ // Parsing failed but don't crash the process. Instead just output a response
+ // with the raw framework values.
+ GetCredentialCustomException(type, msg)
+ }
+ }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException.kt b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException.kt
index d5b999f..46258f6 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException.kt
@@ -18,7 +18,9 @@
import androidx.annotation.RestrictTo
import androidx.credentials.CredentialManager
+import androidx.credentials.exceptions.GetCredentialCustomException
import androidx.credentials.exceptions.GetCredentialException
+import androidx.credentials.internal.FrameworkClassParsingException
/**
* A subclass of CreateCredentialException for unique exceptions thrown specific only to
@@ -36,4 +38,25 @@
init {
require(type.isNotEmpty()) { "type must not be empty" }
}
-}
\ No newline at end of file
+
+ internal companion object {
+ @JvmStatic
+ @RestrictTo(RestrictTo.Scope.LIBRARY) // used from java tests
+ fun createFrom(type: String, msg: String?): GetCredentialException {
+ return try {
+ with(type) {
+ when {
+ startsWith(GetPublicKeyCredentialDomException
+ .TYPE_GET_PUBLIC_KEY_CREDENTIAL_DOM_EXCEPTION) ->
+ GetPublicKeyCredentialDomException.createFrom(type, msg)
+ else -> { throw FrameworkClassParsingException() }
+ }
+ }
+ } catch (t: FrameworkClassParsingException) {
+ // Parsing failed but don't crash the process. Instead just output a response
+ // with the raw framework values.
+ GetCredentialCustomException(type, msg)
+ }
+ }
+ }
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkClassParsingException.kt b/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkClassParsingException.kt
index 4110de5..aa783cd 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkClassParsingException.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkClassParsingException.kt
@@ -20,4 +20,4 @@
* Internal exception used to indicate a parsing error while converting from a framework type to
* a jetpack type.
*/
-internal class FrameworkClassParsingException : Exception()
\ No newline at end of file
+internal class FrameworkClassParsingException : Exception()
diff --git a/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkImplHelper.kt b/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkImplHelper.kt
index 9d9f7b2..4377fab 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkImplHelper.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/internal/FrameworkImplHelper.kt
@@ -59,4 +59,4 @@
return createCredentialData
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/internal/RequestValidationHelper.kt b/credentials/credentials/src/main/java/androidx/credentials/internal/RequestValidationHelper.kt
index 7c281d9..81a5f42 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/internal/RequestValidationHelper.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/internal/RequestValidationHelper.kt
@@ -38,4 +38,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
index 2ef577c..7fa6e48 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/Action.kt
@@ -187,4 +187,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialRequest.kt
index 73a1935..dd824cf 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialRequest.kt
@@ -88,4 +88,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialResponse.kt
index cc6c167..4fe08a3 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCredentialResponse.kt
@@ -38,7 +38,7 @@
val remoteEntry: RemoteEntry? = null
) {
- /** Builder for [BeginCreateCredentialResponse]. **/
+ /** Builder for [BeginCreateCredentialResponse]. */
class Builder {
private var createEntries: MutableList<CreateEntry> = mutableListOf()
private var remoteEntry: RemoteEntry? = null
@@ -159,4 +159,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCustomCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCustomCredentialRequest.kt
index 0ee1b04..9a1b2db 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCustomCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreateCustomCredentialRequest.kt
@@ -52,4 +52,4 @@
init {
require(type.isNotEmpty()) { "type should not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest.kt
index 41a07cf..d58130e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginCreatePublicKeyCredentialRequest.kt
@@ -19,6 +19,7 @@
import android.app.PendingIntent
import android.content.Intent
import android.os.Bundle
+import androidx.annotation.VisibleForTesting
import androidx.credentials.CreatePublicKeyCredentialRequest
import androidx.credentials.CreatePublicKeyCredentialRequest.Companion.BUNDLE_KEY_CLIENT_DATA_HASH
import androidx.credentials.CreatePublicKeyCredentialRequest.Companion.BUNDLE_KEY_REQUEST_JSON
@@ -76,7 +77,14 @@
}
internal companion object {
+
@JvmStatic
+ @VisibleForTesting
+ fun createForTest(data: Bundle, callingAppInfo: CallingAppInfo?):
+ BeginCreatePublicKeyCredentialRequest {
+ return createFrom(data, callingAppInfo)
+ }
+
internal fun createFrom(data: Bundle, callingAppInfo: CallingAppInfo?):
BeginCreatePublicKeyCredentialRequest {
try {
@@ -89,4 +97,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialOption.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialOption.kt
index 669c5a6..c4800d7 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialOption.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialOption.kt
@@ -64,4 +64,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialRequest.kt
index 8639447..cd41ff9 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialRequest.kt
@@ -99,4 +99,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialResponse.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialResponse.kt
index 5225e5a..8af070e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialResponse.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetCredentialResponse.kt
@@ -46,7 +46,7 @@
val authenticationActions: List<AuthenticationAction> = listOf(),
val remoteEntry: RemoteEntry? = null
) {
- /** Builder for [BeginGetCredentialResponse]. **/
+ /** Builder for [BeginGetCredentialResponse]. */
class Builder {
private var credentialEntries: MutableList<CredentialEntry> = mutableListOf()
private var actions: MutableList<Action> = mutableListOf()
@@ -213,4 +213,4 @@
return null
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetPasswordOption.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetPasswordOption.kt
index 6ae4eed..2cce06e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetPasswordOption.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/BeginGetPasswordOption.kt
@@ -18,6 +18,7 @@
import android.os.Bundle
import android.service.credentials.BeginGetCredentialResponse
+import androidx.annotation.VisibleForTesting
import androidx.credentials.GetPasswordOption
import androidx.credentials.PasswordCredential
@@ -46,14 +47,12 @@
internal companion object {
@JvmStatic
- internal fun createFrom(data: Bundle, id: String): BeginGetPasswordOption {
- val allowUserIdList = data.getStringArrayList(
- GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS)
- return BeginGetPasswordOption(allowUserIdList?.toSet() ?: emptySet(), data, id)
+ @VisibleForTesting
+ fun createForTest(data: Bundle, id: String): BeginGetPasswordOption {
+ return createFrom(data, id)
}
- @JvmStatic
- internal fun createFromEntrySlice(data: Bundle, id: String): BeginGetPasswordOption {
+ internal fun createFrom(data: Bundle, id: String): BeginGetPasswordOption {
val allowUserIdList = data.getStringArrayList(
GetPasswordOption.BUNDLE_KEY_ALLOWED_USER_IDS)
return BeginGetPasswordOption(allowUserIdList?.toSet() ?: emptySet(), data, id)
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/CallingAppInfo.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/CallingAppInfo.kt
index 33ee07a..6109c2f 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/CallingAppInfo.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/CallingAppInfo.kt
@@ -17,6 +17,8 @@
package androidx.credentials.provider
import android.content.pm.SigningInfo
+import androidx.annotation.RestrictTo
+import androidx.credentials.provider.utils.RequestValidationUtil
/**
* Information pertaining to the calling application.
@@ -37,10 +39,33 @@
class CallingAppInfo @JvmOverloads constructor(
val packageName: String,
val signingInfo: SigningInfo,
+ @get:RestrictTo(RestrictTo.Scope.LIBRARY)
val origin: String? = null
) {
+ /**
+ * Returns the origin of the calling app. This is only non-null if a
+ * privileged app like a browser calls Credential Manager APIs on
+ * behalf of another application.
+ *
+ * Additionally, in order to get the origin, the credential provider must
+ * provide an allowlist of privileged browsers/apps that it trusts.
+ * This allowlist must be in the form of a valid, non-empty JSON. The
+ * origin will only be returned if the [packageName] and [signingInfo]
+ * match with an app allowlisted in [privilegedAllowlist].
+ *
+ * @throws IllegalArgumentException If [privilegedAllowlist] is empty, or an
+ * invalid JSON
+ */
+ fun getOrigin(privilegedAllowlist: String): String? {
+ if (!RequestValidationUtil.isValidJSON(privilegedAllowlist)) {
+ throw IllegalArgumentException("privilegedAllowlist must not be " +
+ "empty, and must be a valid JSON")
+ }
+ return null
+ }
+
init {
require(packageName.isNotEmpty()) { "packageName must not be empty" }
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/CredentialEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/CredentialEntry.kt
index c02bf01..a71b4f0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/CredentialEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/CredentialEntry.kt
@@ -59,4 +59,4 @@
return null
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
index 1dc6f2a..7700bdb0 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/PasswordCredentialEntry.kt
@@ -280,7 +280,7 @@
lastUsedTime,
icon!!,
autoSelectAllowed,
- BeginGetPasswordOption.createFromEntrySlice(
+ BeginGetPasswordOption.createFrom(
Bundle(),
beginGetPasswordOptionId!!.toString()
),
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderClearCredentialStateRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderClearCredentialStateRequest.kt
index c796764..9cf0c99 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderClearCredentialStateRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderClearCredentialStateRequest.kt
@@ -28,4 +28,4 @@
* Note : Credential providers are not expected to utilize the constructor in this class for any
* production flow. This constructor must only be used for testing purposes.
*/
-class ProviderClearCredentialStateRequest constructor(val callingAppInfo: CallingAppInfo)
\ No newline at end of file
+class ProviderClearCredentialStateRequest constructor(val callingAppInfo: CallingAppInfo)
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderCreateCredentialRequest.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderCreateCredentialRequest.kt
index 2bc48ee..3b39ebb 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderCreateCredentialRequest.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/ProviderCreateCredentialRequest.kt
@@ -40,4 +40,4 @@
class ProviderCreateCredentialRequest constructor(
val callingRequest: CreateCredentialRequest,
val callingAppInfo: CallingAppInfo
-)
\ No newline at end of file
+)
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
index 4ee6202..84dac25 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/RemoteEntry.kt
@@ -121,4 +121,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginCreateCredentialUtil.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginCreateCredentialUtil.kt
index 6a14add..556eeef 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginCreateCredentialUtil.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginCreateCredentialUtil.kt
@@ -161,4 +161,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginGetCredentialUtil.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginGetCredentialUtil.kt
index 71056aa..b1de34e 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginGetCredentialUtil.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/BeginGetCredentialUtil.kt
@@ -174,4 +174,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/ClearCredentialUtil.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/ClearCredentialUtil.kt
index 0ee7924..ea1b500 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/ClearCredentialUtil.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/ClearCredentialUtil.kt
@@ -37,4 +37,4 @@
request.callingAppInfo.origin))
}
}
-}
\ No newline at end of file
+}
diff --git a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/RequestValidationUtil.kt b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/RequestValidationUtil.kt
index 308115f..844447b8 100644
--- a/credentials/credentials/src/main/java/androidx/credentials/provider/utils/RequestValidationUtil.kt
+++ b/credentials/credentials/src/main/java/androidx/credentials/provider/utils/RequestValidationUtil.kt
@@ -38,4 +38,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/customview/customview-poolingcontainer/src/androidTest/kotlin/androidx/customview/poolingcontainer/PoolingContainerTest.kt b/customview/customview-poolingcontainer/src/androidTest/kotlin/androidx/customview/poolingcontainer/PoolingContainerTest.kt
index a6acb7c..3b4f2aa 100644
--- a/customview/customview-poolingcontainer/src/androidTest/kotlin/androidx/customview/poolingcontainer/PoolingContainerTest.kt
+++ b/customview/customview-poolingcontainer/src/androidTest/kotlin/androidx/customview/poolingcontainer/PoolingContainerTest.kt
@@ -200,4 +200,4 @@
view.callPoolingContainerOnRelease()
assertThat(callbacks).isEqualTo(intArrayOf(1, 2, 1))
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-benchmark/src/androidTest/java/androidx/datastore/core/SingleProcessDatastoreTest.kt b/datastore/datastore-benchmark/src/androidTest/java/androidx/datastore/core/SingleProcessDatastoreTest.kt
index f74d565..7ed76dd 100644
--- a/datastore/datastore-benchmark/src/androidTest/java/androidx/datastore/core/SingleProcessDatastoreTest.kt
+++ b/datastore/datastore-benchmark/src/androidTest/java/androidx/datastore/core/SingleProcessDatastoreTest.kt
@@ -107,4 +107,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/CountActivity.kt b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/CountActivity.kt
index ff0c660..241a449 100644
--- a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/CountActivity.kt
+++ b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/CountActivity.kt
@@ -122,4 +122,4 @@
MaterialTheme {
Counters("test", 1, {}, {})
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountRepository.kt b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountRepository.kt
index 428b189..5a1792f 100644
--- a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountRepository.kt
+++ b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountRepository.kt
@@ -135,4 +135,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountSerializer.kt b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountSerializer.kt
index 2e10667..56f66e1 100644
--- a/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountSerializer.kt
+++ b/datastore/datastore-compose-samples/src/main/java/com/example/datastorecomposesamples/data/CountSerializer.kt
@@ -39,4 +39,4 @@
}
override suspend fun writeTo(t: CountPreferences, output: OutputStream) = t.writeTo(output)
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core-okio/build.gradle b/datastore/datastore-core-okio/build.gradle
index 555b3db..75c82c7 100644
--- a/datastore/datastore-core-okio/build.gradle
+++ b/datastore/datastore-core-okio/build.gradle
@@ -46,7 +46,6 @@
api(libs.kotlinStdlib)
api(libs.kotlinCoroutinesCore)
api(libs.okio)
- api(libs.atomicFu)
}
}
jvmMain {
@@ -57,12 +56,12 @@
}
commonTest {
dependencies {
- api(project(":internal-testutils-kmp"))
+ api(project(":kruth:kruth"))
api(libs.kotlinTestCommon)
api(libs.kotlinTestAnnotationsCommon)
api(libs.kotlinCoroutinesTest)
api(project(":internal-testutils-datastore"))
- api(project(":internal-testutils-kmp"))
+ api(project(":kruth:kruth"))
}
}
jvmTest {
@@ -71,7 +70,7 @@
implementation(libs.kotlinTest)
implementation(libs.kotlinTestAnnotationsCommon)
api(project(":internal-testutils-datastore"))
- api(project(":internal-testutils-kmp"))
+ api(project(":kruth:kruth"))
}
}
@@ -83,12 +82,6 @@
}
}
- targets.withType(KotlinNativeTarget).configureEach {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
-
targets.all { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
diff --git a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/Atomic.kt b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/Atomic.kt
index 2aad982..b883c4c 100644
--- a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/Atomic.kt
+++ b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/Atomic.kt
@@ -29,3 +29,15 @@
fun get(): Boolean
fun set(value: Boolean)
}
+
+/**
+ * Simple class to provide synchronization blocks.
+ *
+ * On JVM/ART, this uses simple JDK's synchronization.
+ * On other platforms, it uses atomic-fu.
+ *
+ * @see withLock
+ */
+internal expect class Synchronizer() {
+ inline fun <T> withLock(crossinline block: () -> T): T
+}
diff --git a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioSerializer.kt b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioSerializer.kt
index cbd6d75..963b699 100644
--- a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioSerializer.kt
+++ b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioSerializer.kt
@@ -46,4 +46,4 @@
* @param sink the BufferedSink to serialize data to
*/
public suspend fun writeTo(t: T, sink: BufferedSink)
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioStorage.kt b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioStorage.kt
index 234680e..1b88c6c 100644
--- a/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioStorage.kt
+++ b/datastore/datastore-core-okio/src/commonMain/kotlin/androidx/datastore/core/okio/OkioStorage.kt
@@ -23,9 +23,6 @@
import androidx.datastore.core.WriteScope
import androidx.datastore.core.createSingleProcessCoordinator
import androidx.datastore.core.use
-import kotlinx.atomicfu.atomic
-import kotlinx.atomicfu.locks.SynchronizedObject
-import kotlinx.atomicfu.locks.synchronized
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import okio.FileNotFoundException
@@ -64,7 +61,7 @@
override fun createConnection(): StorageConnection<T> {
canonicalPath.toString().let { path ->
- synchronized(activeFilesLock) {
+ activeFilesLock.withLock {
check(!activeFiles.contains(path)) {
"There are multiple DataStores active for the same file: $path. You should " +
"either maintain your DataStore as a singleton or confirm that there is " +
@@ -80,7 +77,7 @@
serializer,
coordinatorProducer(canonicalPath, fileSystem)
) {
- synchronized(activeFilesLock) {
+ activeFilesLock.withLock {
activeFiles.remove(canonicalPath.toString())
}
}
@@ -88,10 +85,7 @@
internal companion object {
internal val activeFiles = mutableSetOf<String>()
-
- class Sync : SynchronizedObject()
-
- internal val activeFilesLock = Sync()
+ val activeFilesLock = Synchronizer()
}
}
@@ -174,7 +168,7 @@
protected val serializer: OkioSerializer<T>
) : ReadScope<T> {
- private var closed by atomic(false)
+ private val closed = AtomicBoolean(false)
override suspend fun readData(): T {
checkClose()
@@ -194,11 +188,11 @@
}
override fun close() {
- closed = true
+ closed.set(true)
}
protected fun checkClose() {
- check(!closed) { "This scope has already been closed." }
+ check(!closed.get()) { "This scope has already been closed." }
}
}
@@ -219,4 +213,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core-okio/src/commonTest/kotlin/androidx/datastore/core/okio/OkioStorageTest.kt b/datastore/datastore-core-okio/src/commonTest/kotlin/androidx/datastore/core/okio/OkioStorageTest.kt
index 11db7e0..33f1b2d 100644
--- a/datastore/datastore-core-okio/src/commonTest/kotlin/androidx/datastore/core/okio/OkioStorageTest.kt
+++ b/datastore/datastore-core-okio/src/commonTest/kotlin/androidx/datastore/core/okio/OkioStorageTest.kt
@@ -342,4 +342,4 @@
testConnection.writeData(1)
assertThat(testConnection.readData()).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core-okio/src/jvmMain/kotlin/androidx/datastore/core/okio/Atomic.jvm.kt b/datastore/datastore-core-okio/src/jvmMain/kotlin/androidx/datastore/core/okio/Atomic.jvm.kt
index 93fc2f2..ff5ce72 100644
--- a/datastore/datastore-core-okio/src/jvmMain/kotlin/androidx/datastore/core/okio/Atomic.jvm.kt
+++ b/datastore/datastore-core-okio/src/jvmMain/kotlin/androidx/datastore/core/okio/Atomic.jvm.kt
@@ -39,4 +39,15 @@
actual fun set(value: Boolean) {
delegate.set(value)
}
-}
\ No newline at end of file
+}
+
+internal actual class Synchronizer {
+ actual inline fun<T> withLock(block: () -> T): T {
+ // technically, it is wrong to sync on `this` but we are only using it from common
+ // code hence there is no way to access JVM/ART's sync; so I decided to be cheap here
+ // and avoid another object.
+ return synchronized(this) {
+ block()
+ }
+ }
+}
diff --git a/datastore/datastore-core-okio/src/nativeMain/kotlin/androidx/datastore/core/okio/Atomic.native.kt b/datastore/datastore-core-okio/src/nativeMain/kotlin/androidx/datastore/core/okio/Atomic.native.kt
index a27d82f..3937e03 100644
--- a/datastore/datastore-core-okio/src/nativeMain/kotlin/androidx/datastore/core/okio/Atomic.native.kt
+++ b/datastore/datastore-core-okio/src/nativeMain/kotlin/androidx/datastore/core/okio/Atomic.native.kt
@@ -19,6 +19,8 @@
import kotlinx.atomicfu.AtomicBoolean as AtomicFuAtomicBoolean
import kotlinx.atomicfu.AtomicInt as AtomicFuAtomicInt
import kotlinx.atomicfu.atomic
+import kotlinx.atomicfu.locks.SynchronizedObject
+import kotlinx.atomicfu.locks.synchronized
internal actual class AtomicInt actual constructor(initialValue: Int) {
private var delegate: AtomicFuAtomicInt = atomic(initialValue)
@@ -46,4 +48,16 @@
actual fun set(value: Boolean) {
property = value
}
-}
\ No newline at end of file
+}
+
+internal actual class Synchronizer {
+ /**
+ * This is public to allow inlining withLock. Since we use it from common, for all
+ * intents and purposes, delegate is not visible. So it is cheaper to do this instead
+ * of forcing an object creation to call withLock.
+ */
+ val delegate = SynchronizedObject()
+ actual inline fun<T> withLock(crossinline block: () -> T): T {
+ return synchronized(delegate, block)
+ }
+}
diff --git a/datastore/datastore-core/build.gradle b/datastore/datastore-core/build.gradle
index 9679678..9931fbc 100644
--- a/datastore/datastore-core/build.gradle
+++ b/datastore/datastore-core/build.gradle
@@ -92,7 +92,7 @@
implementation(libs.kotlinCoroutinesTest)
implementation(libs.okio)
api(project(":datastore:datastore-core-okio"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
}
}
@@ -101,7 +101,7 @@
dependencies {
implementation(libs.junit)
implementation(libs.kotlinTest)
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
// Workaround bug in 1.8.0, was supposed be fixed in RC2/final, but apparently not.
@@ -139,11 +139,6 @@
}
}
- targets.withType(KotlinNativeTarget).configureEach {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
targets.all { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
diff --git a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/ExperimentalMultiProcessDataStore.kt b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/ExperimentalMultiProcessDataStore.kt
index 49a2d2d..27d4798 100644
--- a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/ExperimentalMultiProcessDataStore.kt
+++ b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/ExperimentalMultiProcessDataStore.kt
@@ -22,4 +22,4 @@
)
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalMultiProcessDataStore
\ No newline at end of file
+annotation class ExperimentalMultiProcessDataStore
diff --git a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/MultiProcessCoordinator.kt b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/MultiProcessCoordinator.kt
index 4d91dad..48f575b 100644
--- a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/MultiProcessCoordinator.kt
+++ b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/MultiProcessCoordinator.kt
@@ -190,4 +190,4 @@
*/
@Suppress("StreamFiles")
fun createMultiProcessCoordinator(context: CoroutineContext, file: File): InterProcessCoordinator =
- MultiProcessCoordinator(context, file)
\ No newline at end of file
+ MultiProcessCoordinator(context, file)
diff --git a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/SharedCounter.kt b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/SharedCounter.kt
index 25d6562..dd295be 100644
--- a/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/SharedCounter.kt
+++ b/datastore/datastore-core/src/androidMain/kotlin/androidx/datastore/core/SharedCounter.kt
@@ -84,4 +84,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/DirectTestService.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/DirectTestService.kt
index 1dbe386..cc77d47 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/DirectTestService.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/DirectTestService.kt
@@ -29,7 +29,7 @@
import android.os.Message
import android.os.Messenger
import android.os.RemoteException
-import androidx.testing.TestMessageProto.FooProto
+import androidx.datastore.testing.TestMessageProto.FooProto
import com.google.common.collect.ImmutableList
import java.io.Serializable
import java.util.concurrent.CountDownLatch
@@ -276,4 +276,4 @@
for (connection in connections) {
connection.propagateRemoteExceptionIfPresent()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreMultiProcessTest.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreMultiProcessTest.kt
index 27d5641..5535964 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreMultiProcessTest.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreMultiProcessTest.kt
@@ -22,8 +22,8 @@
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.core.okio.OkioSerializer
import androidx.datastore.core.okio.OkioStorage
+import androidx.datastore.testing.TestMessageProto.FooProto
import androidx.test.core.app.ApplicationProvider
-import androidx.testing.TestMessageProto.FooProto
import com.google.common.truth.Truth.assertThat
import com.google.protobuf.ExtensionRegistryLite
import java.io.File
@@ -31,6 +31,7 @@
import java.io.IOException
import java.io.OutputStreamWriter
import kotlin.coroutines.CoroutineContext
+import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -153,7 +154,7 @@
fun testSimpleUpdateData_okio() = testSimpleUpdateData_runner(StorageVariant.OKIO)
private fun testSimpleUpdateData_runner(variant: StorageVariant) =
- runTest(dispatchTimeoutMs = 10000) {
+ runTest(timeout = 10000.milliseconds) {
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
createDataStore(testData, dataStoreScope, context = dataStoreContext)
@@ -195,7 +196,7 @@
fun testConcurrentReadUpdate_okio() = testConcurrentReadUpdate_runner(StorageVariant.OKIO)
private fun testConcurrentReadUpdate_runner(variant: StorageVariant) =
- runTest(dispatchTimeoutMs = 10000) {
+ runTest(timeout = 10000.milliseconds) {
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
createDataStore(testData, dataStoreScope, context = dataStoreContext)
@@ -272,7 +273,7 @@
fun testInterleavedUpdateData_okio() = testInterleavedUpdateData_runner(StorageVariant.OKIO)
private fun testInterleavedUpdateData_runner(variant: StorageVariant) =
- runTest(UnconfinedTestDispatcher(), dispatchTimeoutMs = 10000) {
+ runTest(UnconfinedTestDispatcher(), timeout = 10000.milliseconds) {
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
createDataStore(testData, dataStoreScope, context = dataStoreContext)
@@ -334,7 +335,7 @@
testInterleavedUpdateDataWithLocalRead_runner(StorageVariant.OKIO)
private fun testInterleavedUpdateDataWithLocalRead_runner(variant: StorageVariant) =
- runTest(UnconfinedTestDispatcher(), dispatchTimeoutMs = 10000) {
+ runTest(UnconfinedTestDispatcher(), timeout = 10000.milliseconds) {
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
createDataStore(testData, dataStoreScope, context = dataStoreContext)
@@ -427,7 +428,7 @@
private fun testUpdateDataExceptionUnblocksOtherProcessFromWriting_runner(
variant: StorageVariant
- ) = runTest(dispatchTimeoutMs = 10000) {
+ ) = runTest(timeout = 10000.milliseconds) {
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
createDataStore(testData, dataStoreScope, context = dataStoreContext)
@@ -492,7 +493,7 @@
private fun testUpdateDataCancellationUnblocksOtherProcessFromWriting_runner(
variant: StorageVariant
- ) = runTest(UnconfinedTestDispatcher(), dispatchTimeoutMs = 10000) {
+ ) = runTest(UnconfinedTestDispatcher(), timeout = 10000.milliseconds) {
val localScope = TestScope(UnconfinedTestDispatcher() + Job())
val testData: Bundle = createDataStoreBundle(testFile.absolutePath, variant)
val dataStore: DataStore<FooProto> =
@@ -554,7 +555,7 @@
fun testReadUpdateCorrupt_okio() = testReadUpdateCorrupt_runner(StorageVariant.OKIO)
private fun testReadUpdateCorrupt_runner(variant: StorageVariant) =
- runTest(dispatchTimeoutMs = 10000) {
+ runTest(timeout = 10000.milliseconds) {
FileOutputStream(testFile).use {
OutputStreamWriter(it).write("garbage")
}
@@ -605,4 +606,4 @@
}
class InterleavedHandlerUpdateDataOkioService : InterleavedHandlerUpdateDataFileService()
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessFileTest.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessFileTest.kt
index 24288ef..2190e7f 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessFileTest.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessFileTest.kt
@@ -27,10 +27,8 @@
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.Job
-import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.cancelAndJoin
@@ -42,7 +40,7 @@
import kotlinx.coroutines.test.runTest
import org.junit.Test
-@OptIn(ExperimentalCoroutinesApi::class, ObsoleteCoroutinesApi::class, FlowPreview::class)
+@OptIn(ExperimentalCoroutinesApi::class)
@InternalCoroutinesApi
class MultiProcessDataStoreSingleProcessFileTest :
MultiProcessDataStoreSingleProcessTest<JavaIOFile>(FileTestIO()) {
@@ -149,4 +147,4 @@
listOf(reader, writer).awaitAll()
testJob.cancelAndJoin()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessOkioTest.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessOkioTest.kt
index d71d516..8dbe972 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessOkioTest.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessOkioTest.kt
@@ -31,4 +31,4 @@
override fun getJavaFile(file: OkioPath): File {
return file.path.toFile()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessTest.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessTest.kt
index 0ffe3d0..952fc5d 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessTest.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/MultiProcessDataStoreSingleProcessTest.kt
@@ -33,7 +33,6 @@
import java.util.concurrent.atomic.AtomicInteger
import kotlin.coroutines.AbstractCoroutineContextElement
import kotlin.coroutines.CoroutineContext
-import kotlin.random.Random
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
@@ -70,7 +69,7 @@
@ExperimentalCoroutinesApi
@LargeTest
@RunWith(JUnit4::class)
-abstract class MultiProcessDataStoreSingleProcessTest<F : TestFile>(
+abstract class MultiProcessDataStoreSingleProcessTest<F : TestFile<F>>(
protected val testIO: TestIO<F, *>
) {
protected lateinit var store: DataStore<Byte>
@@ -82,7 +81,7 @@
abstract fun getJavaFile(file: F): File
private fun newDataStore(
- file: TestFile = testFile,
+ file: F = testFile,
scope: CoroutineScope = dataStoreScope,
initTasksList: List<suspend (api: InitializerApi<Byte>) -> Unit> = listOf(),
corruptionHandler: CorruptionHandler<Byte> = NoOpCorruptionHandler<Byte>()
@@ -105,8 +104,8 @@
@Before
fun setUp() {
serializerConfig = TestingSerializerConfig()
- tempFolder = testIO.tempDir()
- testFile = testIO.newTempFile(tempFolder)
+ tempFolder = testIO.newTempFile().also { it.mkdirs() }
+ testFile = testIO.newTempFile(parentFile = tempFolder)
dataStoreScope = TestScope(UnconfinedTestDispatcher() + Job())
store = testIO.getStore(
serializerConfig,
@@ -210,12 +209,10 @@
@Test
fun testWriteToNonExistentDir() = runBlocking {
val fileInNonExistentDir = testIO.newTempFile(
- testIO.tempDir(
- "/this/does/not/exist",
- makeDirs = false,
- parentDir = testIO.tempDir()
- )
+ relativePath = "/this/does/not/exist/ds.txt"
)
+ assertThat(fileInNonExistentDir.exists()).isFalse()
+ assertThat(fileInNonExistentDir.parentFile()!!.exists()).isFalse()
runTest {
val newStore = newDataStore(fileInNonExistentDir, scope = backgroundScope)
@@ -232,16 +229,17 @@
@Test
fun testReadFromNonExistentFile() = runTest {
- testFile.deleteIfExists()
val newStore = newDataStore(testFile)
assertThat(newStore.data.first()).isEqualTo(0)
}
@Test
fun testWriteToDirFails() = runTest {
- val directoryFile = testIO.tempDir("/this/is/a${Random.nextInt()}/directory")
+ val directoryFile = testIO.newTempFile(relativePath = "this/is/a/directory").also {
+ it.mkdirs()
+ }
- assertThat(testIO.isDirectory(directoryFile))
+ assertThat(directoryFile.isDirectory()).isTrue()
val newStore = newDataStore(directoryFile)
assertThrows<IOException> { newStore.data.first() }
@@ -298,7 +296,7 @@
@Test
fun testWriteAfterTransientBadRead() = runTest {
- testFile.createIfNotExists()
+ testFile.write("")
assertThat(testFile.exists()).isTrue()
serializerConfig.failingRead = true
@@ -313,7 +311,7 @@
@Test
fun testWriteWithBadReadFails() = runTest {
- testFile.createIfNotExists()
+ testFile.write("")
assertThat(testFile.exists()).isTrue()
serializerConfig.failingRead = true
@@ -792,8 +790,6 @@
@Test
fun testDefaultValueUsedWhenNoDataOnDisk() = runTest {
- testFile.deleteIfExists()
-
val dataStore = testIO.getStore(
TestingSerializerConfig(defaultValue = 99),
dataStoreScope,
@@ -895,7 +891,7 @@
@Test
fun testCreateDuplicateActiveDataStore() = runTest {
- val file = testIO.newTempFile(tempFolder)
+ val file = testIO.newTempFile(parentFile = tempFolder)
val dataStore = newDataStore(file = file, scope = CoroutineScope(Job()))
dataStore.data.first()
@@ -909,7 +905,7 @@
@Test
fun testCreateDataStore_withSameFileAsInactiveDataStore() = runTest {
- val file = testIO.newTempFile(tempFolder)
+ val file = testIO.newTempFile(parentFile = tempFolder)
val scope1 = CoroutineScope(Job())
val dataStore1 = newDataStore(file = file, scope = scope1)
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoOkioSerializer.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoOkioSerializer.kt
index 29540b5..6fe43fa 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoOkioSerializer.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoOkioSerializer.kt
@@ -51,4 +51,4 @@
override suspend fun writeTo(t: T, sink: BufferedSink) {
t.writeTo(sink.outputStream())
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoSerializer.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoSerializer.kt
index 4df5bcf..ea2ebca 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoSerializer.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/ProtoSerializer.kt
@@ -47,4 +47,4 @@
override suspend fun writeTo(t: T, output: OutputStream) {
t.writeTo(output)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/SharedCounterTest.kt b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/SharedCounterTest.kt
index 5179249..6e63de3 100644
--- a/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/SharedCounterTest.kt
+++ b/datastore/datastore-core/src/androidTest/java/androidx/datastore/core/SharedCounterTest.kt
@@ -121,4 +121,4 @@
}
deferred.await()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/androidTest/proto/test.proto b/datastore/datastore-core/src/androidTest/proto/test.proto
index 0ad7b69..019bc60 100644
--- a/datastore/datastore-core/src/androidTest/proto/test.proto
+++ b/datastore/datastore-core/src/androidTest/proto/test.proto
@@ -17,9 +17,9 @@
// Protos for use in tests
syntax = "proto2";
-package androidx.testing;
+package androidx.datastore.testing;
-option java_package = "androidx.testing";
+option java_package = "androidx.datastore.testing";
option java_outer_classname = "TestMessageProto";
message FooProto {
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionException.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionException.kt
index 8ae3cb7..97555f3 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionException.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionException.kt
@@ -22,4 +22,4 @@
* due to a transient IO issue or permissions issue.
*/
public class CorruptionException(message: String, cause: Throwable? = null) :
- IOException(message, cause)
\ No newline at end of file
+ IOException(message, cause)
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionHandler.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionHandler.kt
index 0ce09b6..78797c2 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionHandler.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/CorruptionHandler.kt
@@ -30,6 +30,6 @@
*
* @param ex is the exception encountered when attempting to deserialize data from disk.
* @return The value that DataStore should attempt to write to disk.
- **/
+ */
public suspend fun handleCorruption(ex: CorruptionException): T
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigration.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigration.kt
index 711821b..6b0aa65 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigration.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigration.kt
@@ -73,4 +73,4 @@
* DataStore doesn't return data until all migrations complete.
*/
public suspend fun cleanUp()
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigrationInitializer.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigrationInitializer.kt
index 24d900c..decd8a5 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigrationInitializer.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataMigrationInitializer.kt
@@ -68,4 +68,4 @@
cleanUpFailure?.let { throw it }
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStore.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStore.kt
index 4fd3b86..f77f927 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStore.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStore.kt
@@ -64,4 +64,4 @@
* @throws Exception when thrown by the transform function
*/
public suspend fun updateData(transform: suspend (t: T) -> T): T
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreFactory.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreFactory.kt
index 99e9228..3308b46 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreFactory.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreFactory.kt
@@ -30,4 +30,4 @@
migrations: List<DataMigration<T>> = listOf(),
scope: CoroutineScope = CoroutineScope(ioDispatcher() + SupervisorJob()),
): DataStore<T>
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreImpl.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreImpl.kt
index 386a01a..da2b8fd 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreImpl.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/DataStoreImpl.kt
@@ -475,4 +475,4 @@
didRun = true
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Expect.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Expect.kt
index 4678e2be..c0278a2 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Expect.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Expect.kt
@@ -38,4 +38,4 @@
fun set(value: Boolean)
}
-internal expect fun ioDispatcher(): CoroutineDispatcher
\ No newline at end of file
+internal expect fun ioDispatcher(): CoroutineDispatcher
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InitializerApi.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InitializerApi.kt
index bf36ecd..bc015e0 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InitializerApi.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InitializerApi.kt
@@ -28,4 +28,4 @@
*/
internal interface InitializerApi<T> {
suspend fun updateData(transform: suspend (t: T) -> T): T
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InterProcessCoordinator.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InterProcessCoordinator.kt
index 2f909d6..f23f7ed 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InterProcessCoordinator.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InterProcessCoordinator.kt
@@ -76,4 +76,4 @@
/**
* Create a coordinator for single process use cases.
*/
-fun createSingleProcessCoordinator(): InterProcessCoordinator = SingleProcessCoordinator()
\ No newline at end of file
+fun createSingleProcessCoordinator(): InterProcessCoordinator = SingleProcessCoordinator()
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Message.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Message.kt
index acc90f3..c2e32d0 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Message.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/Message.kt
@@ -41,4 +41,4 @@
override val lastState: State<T>?,
val callerContext: CoroutineContext
) : Message<T>()
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/MutexUtils.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/MutexUtils.kt
index 6c4fa3b..528fa08 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/MutexUtils.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/MutexUtils.kt
@@ -41,4 +41,4 @@
unlock(owner)
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SimpleActor.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SimpleActor.kt
index 7894e59..cae4b2e 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SimpleActor.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SimpleActor.kt
@@ -123,4 +123,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SingleProcessCoordinator.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SingleProcessCoordinator.kt
index c455240..68ce1c0 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SingleProcessCoordinator.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/SingleProcessCoordinator.kt
@@ -51,4 +51,4 @@
// increment version and return the new one
override suspend fun incrementAndGetVersion(): Int = version.incrementAndGet()
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/State.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/State.kt
index 35cd3aa..d517693 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/State.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/State.kt
@@ -43,4 +43,4 @@
/**
* The scope has been cancelled. This DataStore cannot process any new reads or writes.
*/
-internal class Final<T>(val finalException: Throwable) : State<T>(Int.MAX_VALUE)
\ No newline at end of file
+internal class Final<T>(val finalException: Throwable) : State<T>(Int.MAX_VALUE)
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.kt
index f4316ef..f44e598 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.kt
@@ -20,4 +20,4 @@
/**
* Default corruption handler which does nothing but rethrow the exception.
*/
-internal expect class NoOpCorruptionHandler<T> constructor() : CorruptionHandler<T>
\ No newline at end of file
+internal expect class NoOpCorruptionHandler<T> constructor() : CorruptionHandler<T>
diff --git a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.kt b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.kt
index 4b16f63..eb79cb1 100644
--- a/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.kt
+++ b/datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.kt
@@ -25,4 +25,4 @@
* If the handler encounters an exception when attempting to replace data, the new exception is
* added as a suppressed exception to the original exception and the original exception is thrown.
*/
-public expect class ReplaceFileCorruptionHandler<T> : CorruptionHandler<T>
\ No newline at end of file
+public expect class ReplaceFileCorruptionHandler<T> : CorruptionHandler<T>
diff --git a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CloseDownstreamOnCloseTest.kt b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CloseDownstreamOnCloseTest.kt
new file mode 100644
index 0000000..ded8cbc
--- /dev/null
+++ b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CloseDownstreamOnCloseTest.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.datastore.core
+
+import androidx.datastore.TestFile
+import androidx.datastore.TestIO
+import androidx.datastore.TestingSerializerConfig
+import androidx.kruth.assertThat
+import androidx.kruth.assertThrows
+import kotlin.test.BeforeTest
+import kotlin.test.Test
+import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.async
+import kotlinx.coroutines.cancel
+import kotlinx.coroutines.flow.toList
+import kotlinx.coroutines.test.StandardTestDispatcher
+import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.runTest
+
+abstract class CloseDownstreamOnCloseTest<F : TestFile<F>>(private val testIO: TestIO<F, *>) {
+ private val dispatcher = StandardTestDispatcher()
+ private val testScope = TestScope(dispatcher)
+ private val datastoreScope = testScope.backgroundScope
+ private lateinit var store: DataStore<Byte>
+
+ @BeforeTest
+ fun createDataStore() {
+ store = testIO.getStore(
+ serializerConfig = TestingSerializerConfig(),
+ scope = datastoreScope,
+ coordinatorProducer = { createSingleProcessCoordinator() }
+ ) { testIO.newTempFile() }
+ }
+
+ @Test
+ fun closeWhileCollecting() = testScope.runTest {
+ val collector = async {
+ store.data.toList().map { it.toInt() }
+ }
+ store.updateData { 1 }
+ datastoreScope.cancel()
+ dispatcher.scheduler.advanceUntilIdle()
+ assertThat(collector.await()).isEqualTo(listOf(0, 1))
+ }
+
+ @Test
+ fun closeBeforeCollecting() = testScope.runTest {
+ datastoreScope.cancel()
+ assertThrows(CancellationException::class) {
+ store.data.toList()
+ }
+ }
+}
diff --git a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CommonTests.kt b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CommonTests.kt
index 3fc0429..1c7a877 100644
--- a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CommonTests.kt
+++ b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/CommonTests.kt
@@ -18,17 +18,11 @@
import androidx.datastore.OkioPath
import androidx.datastore.OkioTestIO
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.FlowPreview
-import kotlinx.coroutines.InternalCoroutinesApi
-import kotlinx.coroutines.ObsoleteCoroutinesApi
import okio.IOException
-@OptIn(ExperimentalCoroutinesApi::class, ObsoleteCoroutinesApi::class, FlowPreview::class)
-@InternalCoroutinesApi
class DataMigrationInitializerTestOkioTest :
DataMigrationInitializerTest<OkioPath, IOException>(OkioTestIO())
-@OptIn(ExperimentalCoroutinesApi::class, ObsoleteCoroutinesApi::class, FlowPreview::class)
-@InternalCoroutinesApi
-class SingleProcessDataStoreOkioTest : SingleProcessDataStoreTest<OkioPath>(OkioTestIO())
\ No newline at end of file
+class SingleProcessDataStoreOkioTest : SingleProcessDataStoreTest<OkioPath>(OkioTestIO())
+
+class CloseDownstreamOnCloseOkioTest : CloseDownstreamOnCloseTest<OkioPath>(OkioTestIO())
diff --git a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/DataMigrationInitializerTest.kt b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/DataMigrationInitializerTest.kt
index c61f858..4ac3c9e 100644
--- a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/DataMigrationInitializerTest.kt
+++ b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/DataMigrationInitializerTest.kt
@@ -23,6 +23,7 @@
import androidx.kruth.assertThrows
import kotlin.test.BeforeTest
import kotlin.test.Test
+import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
@@ -32,7 +33,7 @@
import kotlinx.coroutines.test.runTest
@OptIn(ExperimentalCoroutinesApi::class)
-abstract class DataMigrationInitializerTest<F : TestFile, IOE : Throwable>
+abstract class DataMigrationInitializerTest<F : TestFile<F>, IOE : Throwable>
(private val testIO: TestIO<F, IOE>) {
private lateinit var storage: Storage<Byte>
@@ -46,7 +47,7 @@
}
fun doTest(test: suspend TestScope.() -> Unit) {
- testScope.runTest(dispatchTimeoutMs = 10000) {
+ testScope.runTest(timeout = 10000.milliseconds) {
test(testScope)
}
}
@@ -216,4 +217,4 @@
override suspend fun cleanUp() = cleanUpFunction()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/SingleProcessDataStoreTest.kt b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/SingleProcessDataStoreTest.kt
index 6d93034..c9582f5 100644
--- a/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/SingleProcessDataStoreTest.kt
+++ b/datastore/datastore-core/src/commonTest/kotlin/androidx/datastore/core/SingleProcessDataStoreTest.kt
@@ -27,7 +27,6 @@
import kotlin.coroutines.AbstractCoroutineContextElement
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.cancellation.CancellationException
-import kotlin.random.Random
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlinx.coroutines.CompletableDeferred
@@ -54,7 +53,7 @@
import kotlinx.coroutines.withContext
@OptIn(ExperimentalCoroutinesApi::class)
-abstract class SingleProcessDataStoreTest<F : TestFile>(private val testIO: TestIO<F, *>) {
+abstract class SingleProcessDataStoreTest<F : TestFile<F>>(private val testIO: TestIO<F, *>) {
protected lateinit var store: DataStore<Byte>
private lateinit var serializerConfig: TestingSerializerConfig
@@ -65,8 +64,8 @@
@BeforeTest
fun setUp() {
serializerConfig = TestingSerializerConfig()
- tempFolder = testIO.tempDir()
- testFile = testIO.newTempFile(tempFolder)
+ tempFolder = testIO.newTempFile().also { it.mkdirs() }
+ testFile = testIO.newTempFile(parentFile = tempFolder)
dataStoreScope = TestScope(UnconfinedTestDispatcher())
store = testIO.getStore(
serializerConfig,
@@ -182,7 +181,7 @@
@Test
fun testWriteToNonExistentDir() = doTest {
val fileInNonExistentDir = testIO.newTempFile(
- testIO.tempDir("/this/does/not/exist", makeDirs = false)
+ relativePath = "this/does/not/exist"
)
coroutineScope {
@@ -201,17 +200,16 @@
@Test
fun testReadFromNonExistentFile() = doTest {
- // TODO remove deleteIfExists after b/276983736
- testFile.deleteIfExists()
val newStore = newDataStore(testFile)
assertThat(newStore.data.first()).isEqualTo(0)
}
@Test
fun testWriteToDirFails() = doTest {
- val directoryFile = testIO.tempDir("/this/is/a${Random.nextInt()}/directory")
-
- assertThat(testIO.isDirectory(directoryFile))
+ val directoryFile = testIO.newTempFile(relativePath = "/this/is/a/directory").also {
+ it.mkdirs(mustCreate = true)
+ }
+ assertThat(directoryFile.isDirectory()).isTrue()
val newStore = newDataStore(directoryFile)
assertThrows(testIO.ioExceptionClass()) { newStore.data.first() }
@@ -703,7 +701,6 @@
@Test
fun testDefaultValueUsedWhenNoDataOnDisk() = doTest {
- testFile.deleteIfExists()
val dataStore = newDataStore(
serializerConfig = TestingSerializerConfig(defaultValue = 99),
scope = dataStoreScope
@@ -967,7 +964,7 @@
}
private fun newDataStore(
- file: TestFile = testFile,
+ file: F = testFile,
serializerConfig: TestingSerializerConfig = this.serializerConfig,
scope: CoroutineScope = dataStoreScope,
initTasksList: List<InitTaskList> = listOf(),
@@ -992,4 +989,4 @@
assertThat(
coordinator.incrementAndGetVersion()
).isEqualTo(currentVersion + 1)
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/Actual.jvm.kt b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/Actual.jvm.kt
index d74c459..b83dbc6 100644
--- a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/Actual.jvm.kt
+++ b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/Actual.jvm.kt
@@ -51,4 +51,4 @@
}
}
-internal actual fun ioDispatcher(): CoroutineDispatcher = Dispatchers.IO
\ No newline at end of file
+internal actual fun ioDispatcher(): CoroutineDispatcher = Dispatchers.IO
diff --git a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/UncloseableOutputStream.kt b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/UncloseableOutputStream.kt
index a7c9054..9ac2fe1 100644
--- a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/UncloseableOutputStream.kt
+++ b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/UncloseableOutputStream.kt
@@ -44,4 +44,4 @@
override fun flush() {
fileOutputStream.flush()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.jvm.kt b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.jvm.kt
index 9b6a568..7d42d00 100644
--- a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.jvm.kt
+++ b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.jvm.kt
@@ -27,4 +27,4 @@
override suspend fun handleCorruption(ex: CorruptionException): T {
throw ex
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.jvm.kt b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.jvm.kt
index f76c3c7..4d09636 100644
--- a/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.jvm.kt
+++ b/datastore/datastore-core/src/jvmMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.jvm.kt
@@ -40,4 +40,4 @@
override suspend fun handleCorruption(ex: CorruptionException): T {
return produceNewData(ex)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/DataStoreFactoryTest.kt b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/DataStoreFactoryTest.kt
index f6dcfbc..88163b9 100644
--- a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/DataStoreFactoryTest.kt
+++ b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/DataStoreFactoryTest.kt
@@ -108,4 +108,4 @@
assertThat(store.data.first()).isEqualTo(migratedByte)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/JvmTests.kt b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/JvmTests.kt
index b8a32d1..3db293c 100644
--- a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/JvmTests.kt
+++ b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/JvmTests.kt
@@ -23,19 +23,16 @@
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.InternalCoroutinesApi
-import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.flow.first
import org.junit.Test
-@OptIn(ExperimentalCoroutinesApi::class, ObsoleteCoroutinesApi::class, FlowPreview::class)
@InternalCoroutinesApi
class DataMigrationInitializerTestFileTest :
DataMigrationInitializerTest<JavaIOFile, IOException>(FileTestIO())
-@OptIn(ExperimentalCoroutinesApi::class)
+class CloseDownstreamOnCloseJavaTest : CloseDownstreamOnCloseTest<JavaIOFile>(FileTestIO())
+
@InternalCoroutinesApi
class SingleProcessDataStoreJavaTest : SingleProcessDataStoreTest<JavaIOFile>(FileTestIO()) {
@@ -119,4 +116,4 @@
// Mutable wrapper around a byte
data class ByteWrapper(var byte: Byte)
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SimpleActorTest.kt b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SimpleActorTest.kt
index 154e868..bb3b250 100644
--- a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SimpleActorTest.kt
+++ b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SimpleActorTest.kt
@@ -292,4 +292,4 @@
@Volatile
var int = 0
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SingleProcessDataStoreStressTest.kt b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SingleProcessDataStoreStressTest.kt
index 61ac515a..ffbfe17 100644
--- a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SingleProcessDataStoreStressTest.kt
+++ b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/SingleProcessDataStoreStressTest.kt
@@ -243,4 +243,4 @@
DataOutputStream(output).writeLong(t)
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandlerTest.kt b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandlerTest.kt
index 951f37c..40da0d2 100644
--- a/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandlerTest.kt
+++ b/datastore/datastore-core/src/jvmTest/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandlerTest.kt
@@ -144,4 +144,4 @@
).updateData { byte }
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/Actual.native.kt b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/Actual.native.kt
index d1770ea..dff9e55 100644
--- a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/Actual.native.kt
+++ b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/Actual.native.kt
@@ -19,6 +19,7 @@
import kotlinx.atomicfu.atomic
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.IO
/**
* Common IOException mapped to a custom exception class in native code.
@@ -56,5 +57,4 @@
}
}
-// TODO(b/234049307): Pick a better dispatcher for IO
-internal actual fun ioDispatcher(): CoroutineDispatcher = Dispatchers.Default
\ No newline at end of file
+internal actual fun ioDispatcher(): CoroutineDispatcher = Dispatchers.IO
diff --git a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.native.kt b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.native.kt
index 3243c75..5151d5c 100644
--- a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.native.kt
+++ b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/NoOpCorruptionHandler.native.kt
@@ -26,4 +26,4 @@
override suspend fun handleCorruption(ex: CorruptionException): T {
throw ex
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.native.kt b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.native.kt
index cb73664..3df5335 100644
--- a/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.native.kt
+++ b/datastore/datastore-core/src/nativeMain/kotlin/androidx/datastore/core/handlers/ReplaceFileCorruptionHandler.native.kt
@@ -37,4 +37,4 @@
override suspend fun handleCorruption(ex: CorruptionException): T {
return produceNewData(ex)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/build.gradle b/datastore/datastore-preferences-core/build.gradle
index 968d4ae..10aff40 100644
--- a/datastore/datastore-preferences-core/build.gradle
+++ b/datastore/datastore-preferences-core/build.gradle
@@ -58,7 +58,7 @@
implementation(libs.kotlinTestAnnotationsCommon)
implementation(libs.kotlinCoroutinesTest)
implementation(project(":datastore:datastore-core"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
}
}
@@ -71,7 +71,7 @@
implementation(libs.junit)
implementation(libs.kotlinTest)
implementation(project(":internal-testutils-datastore"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
}
}
if (enableNative) {
@@ -88,16 +88,11 @@
dependencies {
implementation(libs.kotlinTest)
implementation(project(":internal-testutils-datastore"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
}
}
}
- targets.withType(KotlinNativeTarget).configureEach {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
targets.all { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
diff --git a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.kt b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.kt
index 085b1a6..efbaec3 100644
--- a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.kt
+++ b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.kt
@@ -100,4 +100,4 @@
transformed
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/Preferences.kt b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/Preferences.kt
index bb40dc3..c1334ad 100644
--- a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/Preferences.kt
+++ b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/Preferences.kt
@@ -357,4 +357,4 @@
// PreferencesDataStore.updateData()
it.toMutablePreferences().apply { transform(this) }
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesFactory.kt b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesFactory.kt
index d10b2b4..1d24c56 100644
--- a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesFactory.kt
+++ b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesFactory.kt
@@ -55,4 +55,4 @@
*/
@JvmName("createMutable")
public fun mutablePreferencesOf(vararg pairs: Preferences.Pair<*>): MutablePreferences =
- MutablePreferences(startFrozen = false).apply { putAll(*pairs) }
\ No newline at end of file
+ MutablePreferences(startFrozen = false).apply { putAll(*pairs) }
diff --git a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesKeys.kt b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesKeys.kt
index c6ee440..1a0cf62 100644
--- a/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesKeys.kt
+++ b/datastore/datastore-preferences-core/src/commonMain/kotlin/androidx/datastore/preferences/core/PreferencesKeys.kt
@@ -112,4 +112,4 @@
* @return the Preferences.Key<ByteArray> for [name]
*/
@JvmName("byteArrayKey")
-public fun byteArrayPreferencesKey(name: String): Preferences.Key<ByteArray> = Preferences.Key(name)
\ No newline at end of file
+public fun byteArrayPreferencesKey(name: String): Preferences.Key<ByteArray> = Preferences.Key(name)
diff --git a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesCompatibilityTest.kt b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesCompatibilityTest.kt
index 8ec132a..e343d16 100644
--- a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesCompatibilityTest.kt
+++ b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesCompatibilityTest.kt
@@ -18,6 +18,7 @@
import kotlin.test.Test
import kotlin.test.assertEquals
+import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.test.runTest
import okio.Buffer
import okio.ByteString.Companion.decodeBase64
@@ -28,7 +29,7 @@
class PreferencesCompatibilityTest {
@Test
- fun testWireCompatibility() = runTest(dispatchTimeoutMs = 10000) {
+ fun testWireCompatibility() = runTest(timeout = 10000.milliseconds) {
// base64 output of serializing "expectedProto"
val protoBase64 = "ChAKB215RmxvYXQSBRXNzIw/ChUKCG15RG91YmxlEgk5mpmZmZmZ8T8KCwoFbXlJbnQSAh" +
@@ -51,4 +52,4 @@
val protoPrefsFromBytes = PreferencesSerializer.readFrom(protoBuffer)
assertEquals(expectedProto, protoPrefsFromBytes)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerTest.kt b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerTest.kt
index b216558..710e522 100644
--- a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerTest.kt
+++ b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerTest.kt
@@ -22,6 +22,7 @@
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
+import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import okio.FileSystem
@@ -45,7 +46,7 @@
fileSystem.createDirectories(testFile.path.parent!!)
}
fun doTest(test: suspend TestScope.() -> Unit) {
- runTest(dispatchTimeoutMs = 10000) {
+ runTest(timeout = 10000.milliseconds) {
test(this)
}
}
@@ -204,4 +205,4 @@
assertEquals(prefs, readPrefs)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesTest.kt b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesTest.kt
index 61d7c07..c2e9e7a 100644
--- a/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesTest.kt
+++ b/datastore/datastore-preferences-core/src/commonTest/kotlin/androidx/datastore/preferences/core/PreferencesTest.kt
@@ -436,4 +436,4 @@
prefs.toString()
)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.jvm.kt b/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.jvm.kt
index d458300..a6cdacb 100644
--- a/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.jvm.kt
+++ b/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.jvm.kt
@@ -141,4 +141,4 @@
produceFile = { produceFile().toFile() }
)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferencesSerializer.jvm.kt b/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferencesSerializer.jvm.kt
index 3ba4afd..4fe495e 100644
--- a/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferencesSerializer.jvm.kt
+++ b/datastore/datastore-preferences-core/src/jvmMain/kotlin/androidx/datastore/preferences/core/PreferencesSerializer.jvm.kt
@@ -111,4 +111,4 @@
null -> throw CorruptionException("Value case is null.")
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryTest.kt b/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryTest.kt
index 355b3c1..770c9a1 100644
--- a/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryTest.kt
+++ b/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryTest.kt
@@ -167,4 +167,4 @@
preferencesOf(stringKey to "ABCDEF")
)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerJavaTest.kt b/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerJavaTest.kt
index 74fb405..14601ae 100644
--- a/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerJavaTest.kt
+++ b/datastore/datastore-preferences-core/src/jvmTest/kotlin/androidx/datastore/preferences/core/PreferencesSerializerJavaTest.kt
@@ -25,6 +25,7 @@
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
+import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import okio.FileSystem
@@ -43,10 +44,9 @@
@BeforeTest
fun setUp() {
testFile = testIO.newTempFile()
- fileSystem.createDirectories(testFile.path.parent!!)
}
fun doTest(test: suspend TestScope.() -> Unit) {
- runTest(dispatchTimeoutMs = 10000) {
+ runTest(timeout = 10000.milliseconds) {
test(this)
}
}
@@ -140,4 +140,4 @@
// variable
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/nativeMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.native.kt b/datastore/datastore-preferences-core/src/nativeMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.native.kt
index 7f69d8f..ff6f3e5 100644
--- a/datastore/datastore-preferences-core/src/nativeMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.native.kt
+++ b/datastore/datastore-preferences-core/src/nativeMain/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactory.native.kt
@@ -98,4 +98,4 @@
scope = scope
))
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-core/src/nativeTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryNativeTest.kt b/datastore/datastore-preferences-core/src/nativeTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryNativeTest.kt
index 145b556..59eae12b 100644
--- a/datastore/datastore-preferences-core/src/nativeTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryNativeTest.kt
+++ b/datastore/datastore-preferences-core/src/nativeTest/kotlin/androidx/datastore/preferences/core/PreferenceDataStoreFactoryNativeTest.kt
@@ -30,7 +30,6 @@
import kotlinx.coroutines.test.runTest
import okio.FileSystem
import okio.Path
-import okio.Path.Companion.toPath
@OptIn(ExperimentalCoroutinesApi::class)
class PreferenceDataStoreFactoryNativeTest {
@@ -45,7 +44,7 @@
@BeforeTest
fun setUp() {
testIO = OkioTestIO()
- testFile = testIO.tempDir().path / "test.preferences_pb".toPath()
+ testFile = testIO.newTempFile(relativePath = "test.preferences_pb").path
dataStoreScope = TestScope(UnconfinedTestDispatcher())
}
@@ -167,4 +166,4 @@
preferencesOf(stringKey to "ABCDEF")
)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-proto/src/main/java/androidx/datastore/preferences/PreferencesMapCompat.kt b/datastore/datastore-preferences-proto/src/main/java/androidx/datastore/preferences/PreferencesMapCompat.kt
index 319024e1..87181a3 100644
--- a/datastore/datastore-preferences-proto/src/main/java/androidx/datastore/preferences/PreferencesMapCompat.kt
+++ b/datastore/datastore-preferences-proto/src/main/java/androidx/datastore/preferences/PreferencesMapCompat.kt
@@ -35,4 +35,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-proto/src/main/proto/preferences.proto b/datastore/datastore-preferences-proto/src/main/proto/preferences.proto
index f9acb5a..157eb67 100644
--- a/datastore/datastore-preferences-proto/src/main/proto/preferences.proto
+++ b/datastore/datastore-preferences-proto/src/main/proto/preferences.proto
@@ -1,7 +1,7 @@
// Proto for use by PreferencesSerializer
syntax = "proto2";
-package androidx.testing;
+package androidx.datastore.testing;
option java_package = "androidx.datastore.preferences";
option java_outer_classname = "PreferencesProto";
diff --git a/datastore/datastore-preferences-rxjava2/src/androidTest/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegateTest.kt b/datastore/datastore-preferences-rxjava2/src/androidTest/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegateTest.kt
index 225374a..ec5d7ae 100644
--- a/datastore/datastore-preferences-rxjava2/src/androidTest/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegateTest.kt
+++ b/datastore/datastore-preferences-rxjava2/src/androidTest/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegateTest.kt
@@ -119,4 +119,4 @@
}.build().data().blockingFirst()
).isEqualTo(preferencesOf(intKey to 99))
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreBuilder.kt b/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreBuilder.kt
index f3540b9..d44818f 100644
--- a/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreBuilder.kt
+++ b/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreBuilder.kt
@@ -178,4 +178,4 @@
override suspend fun cleanUp() {
migration.cleanUp().await()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegate.kt b/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegate.kt
index 2745344..3e95ec2 100644
--- a/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegate.kt
+++ b/datastore/datastore-preferences-rxjava2/src/main/java/androidx/datastore/preferences/rxjava2/RxPreferenceDataStoreDelegate.kt
@@ -110,4 +110,4 @@
INSTANCE!!
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-rxjava3/src/androidTest/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegateTest.kt b/datastore/datastore-preferences-rxjava3/src/androidTest/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegateTest.kt
index 74e85ff..a86dbc2 100644
--- a/datastore/datastore-preferences-rxjava3/src/androidTest/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegateTest.kt
+++ b/datastore/datastore-preferences-rxjava3/src/androidTest/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegateTest.kt
@@ -120,4 +120,4 @@
}.build().data().blockingFirst()
).isEqualTo(preferencesOf(intKey to 99))
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreBuilder.kt b/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreBuilder.kt
index 57bef8b..bb66568 100644
--- a/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreBuilder.kt
+++ b/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreBuilder.kt
@@ -178,4 +178,4 @@
override suspend fun cleanUp() {
migration.cleanUp().await()
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegate.kt b/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegate.kt
index f6b199d..10be1a7 100644
--- a/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegate.kt
+++ b/datastore/datastore-preferences-rxjava3/src/main/java/androidx/datastore/preferences/rxjava3/RxPreferenceDataStoreDelegate.kt
@@ -110,4 +110,4 @@
INSTANCE!!
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegateTest.kt b/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegateTest.kt
index 031ec48..c0a24f9 100644
--- a/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegateTest.kt
+++ b/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegateTest.kt
@@ -129,4 +129,4 @@
assertEquals(expectedPreferences, context.withMigrations.data.first())
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt b/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
index 76f1db1..10b8d7d 100644
--- a/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
+++ b/datastore/datastore-preferences/src/androidAndroidTest/kotlin/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
@@ -450,4 +450,4 @@
// here
return File(prefsFile.path + ".bak")
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences/src/androidMain/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegate.kt b/datastore/datastore-preferences/src/androidMain/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegate.kt
index 7532736..bd39ff0 100644
--- a/datastore/datastore-preferences/src/androidMain/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegate.kt
+++ b/datastore/datastore-preferences/src/androidMain/kotlin/androidx/datastore/preferences/PreferenceDataStoreDelegate.kt
@@ -110,4 +110,4 @@
INSTANCE!!
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-preferences/src/commonMain/kotlin/androidx/datastore/preferences/PreferencesDataStoreDelegateUtils.kt b/datastore/datastore-preferences/src/commonMain/kotlin/androidx/datastore/preferences/PreferencesDataStoreDelegateUtils.kt
index dd12e64..292f82a 100644
--- a/datastore/datastore-preferences/src/commonMain/kotlin/androidx/datastore/preferences/PreferencesDataStoreDelegateUtils.kt
+++ b/datastore/datastore-preferences/src/commonMain/kotlin/androidx/datastore/preferences/PreferencesDataStoreDelegateUtils.kt
@@ -22,4 +22,4 @@
* This is needed to have the native artifacts build. Otherwise there is no code in common and
* the 'buildOnServer' task fails during our presubmits.
*/
-internal class PreferencesDataStoreDelegateUtils
\ No newline at end of file
+internal class PreferencesDataStoreDelegateUtils
diff --git a/datastore/datastore-proto/src/main/java/androidx/datastore/protos/ProtoSerializer.kt b/datastore/datastore-proto/src/main/java/androidx/datastore/protos/ProtoSerializer.kt
index eb25438..2218db3 100644
--- a/datastore/datastore-proto/src/main/java/androidx/datastore/protos/ProtoSerializer.kt
+++ b/datastore/datastore-proto/src/main/java/androidx/datastore/protos/ProtoSerializer.kt
@@ -49,4 +49,4 @@
override suspend fun writeTo(t: T, output: OutputStream) {
t.writeTo(output)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-proto/src/test/java/androidx/datastore/protos/ProtoSerializerTest.kt b/datastore/datastore-proto/src/test/java/androidx/datastore/protos/ProtoSerializerTest.kt
index f093509..c6899f9 100644
--- a/datastore/datastore-proto/src/test/java/androidx/datastore/protos/ProtoSerializerTest.kt
+++ b/datastore/datastore-proto/src/test/java/androidx/datastore/protos/ProtoSerializerTest.kt
@@ -17,9 +17,9 @@
package androidx.datastore.protos
import androidx.datastore.core.CorruptionException
-import androidx.testing.TestMessageProto.ExtendableProto
-import androidx.testing.TestMessageProto.ExtensionProto
-import androidx.testing.TestMessageProto.FooProto
+import androidx.datastore.testing.TestMessageProto.ExtendableProto
+import androidx.datastore.testing.TestMessageProto.ExtensionProto
+import androidx.datastore.testing.TestMessageProto.FooProto
import androidx.testutils.assertThrows
import com.google.common.truth.Truth.assertThat
import com.google.protobuf.ExtensionRegistryLite
@@ -96,4 +96,4 @@
file.inputStream().use { protoSerializer.readFrom(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-proto/src/test/proto/test.proto b/datastore/datastore-proto/src/test/proto/test.proto
index 5a79dd2..36afc4c 100644
--- a/datastore/datastore-proto/src/test/proto/test.proto
+++ b/datastore/datastore-proto/src/test/proto/test.proto
@@ -1,9 +1,9 @@
// Protos for use in tests
syntax = "proto2";
-package androidx.testing;
+package androidx.datastore.testing;
-option java_package = "androidx.testing";
+option java_package = "androidx.datastore.testing";
option java_outer_classname = "TestMessageProto";
message FooProto {
diff --git a/datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreDelegateTest.kt b/datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreDelegateTest.kt
index fb05a48..e4e1f0d 100644
--- a/datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreDelegateTest.kt
+++ b/datastore/datastore-rxjava2/src/androidTest/java/androidx/datastore/rxjava2/RxDataStoreDelegateTest.kt
@@ -103,4 +103,4 @@
).build().data().blockingFirst()
).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreDelegate.kt b/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreDelegate.kt
index 3ab84ca..a9eb447 100644
--- a/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreDelegate.kt
+++ b/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxDataStoreDelegate.kt
@@ -113,4 +113,4 @@
INSTANCE!!
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxSharedPreferencesMigration.kt b/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxSharedPreferencesMigration.kt
index ae5de44c..a385212 100644
--- a/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxSharedPreferencesMigration.kt
+++ b/datastore/datastore-rxjava2/src/main/java/androidx/datastore/rxjava2/RxSharedPreferencesMigration.kt
@@ -27,7 +27,7 @@
@JvmDefaultWithCompatibility
/**
* Client implemented migration interface.
- **/
+ */
public interface RxSharedPreferencesMigration<T> {
/**
* Whether or not the migration should be run. This can be used to skip a read from the
diff --git a/datastore/datastore-rxjava2/src/test-common/java/androidx/datastore/rxjava2/TestingSerializer.kt b/datastore/datastore-rxjava2/src/test-common/java/androidx/datastore/rxjava2/TestingSerializer.kt
index 2dedd9a..c3bfd60 100644
--- a/datastore/datastore-rxjava2/src/test-common/java/androidx/datastore/rxjava2/TestingSerializer.kt
+++ b/datastore/datastore-rxjava2/src/test-common/java/androidx/datastore/rxjava2/TestingSerializer.kt
@@ -54,4 +54,4 @@
}
override val defaultValue: Byte = 0
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxDataStoreDelegateTest.kt b/datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxDataStoreDelegateTest.kt
index aca2cd7..f74c702 100644
--- a/datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxDataStoreDelegateTest.kt
+++ b/datastore/datastore-rxjava3/src/androidTest/java/androidx/datastore/rxjava3/RxDataStoreDelegateTest.kt
@@ -103,4 +103,4 @@
).build().data().blockingFirst()
).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStore.kt b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStore.kt
index 06229a7..cec4b2c 100644
--- a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStore.kt
+++ b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStore.kt
@@ -126,4 +126,4 @@
}
}.asSingle(scope.coroutineContext.minusKey(Job))
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStoreDelegate.kt b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStoreDelegate.kt
index 767ae35..866b823 100644
--- a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStoreDelegate.kt
+++ b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxDataStoreDelegate.kt
@@ -113,4 +113,4 @@
INSTANCE!!
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxSharedPreferencesMigration.kt b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxSharedPreferencesMigration.kt
index c7cb50e..6dfdf1e 100644
--- a/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxSharedPreferencesMigration.kt
+++ b/datastore/datastore-rxjava3/src/main/java/androidx/datastore/rxjava3/RxSharedPreferencesMigration.kt
@@ -27,7 +27,7 @@
@JvmDefaultWithCompatibility
/**
* Client implemented migration interface.
- **/
+ */
public interface RxSharedPreferencesMigration<T> {
/**
* Whether or not the migration should be run. This can be used to skip a read from the
diff --git a/datastore/datastore-rxjava3/src/test-common/java/androidx/datastore/rxjava3/TestingSerializer.kt b/datastore/datastore-rxjava3/src/test-common/java/androidx/datastore/rxjava3/TestingSerializer.kt
index 5a51410..e850698 100644
--- a/datastore/datastore-rxjava3/src/test-common/java/androidx/datastore/rxjava3/TestingSerializer.kt
+++ b/datastore/datastore-rxjava3/src/test-common/java/androidx/datastore/rxjava3/TestingSerializer.kt
@@ -54,4 +54,4 @@
}
override val defaultValue: Byte = 0
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
index e1057f7..2517c52 100644
--- a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
+++ b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/KotlinSerializationActivity.kt
@@ -130,4 +130,4 @@
override suspend fun writeTo(t: MySettings, output: OutputStream) {
output.write(Json.encodeToString(t).encodeToByteArray())
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
index 3ff3a6a..c30a313 100644
--- a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
+++ b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/PreferencesDataStoreActivity.kt
@@ -95,4 +95,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/ProtoDataStoreActivity.kt b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/ProtoDataStoreActivity.kt
index 476e5be..2162f87 100644
--- a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/ProtoDataStoreActivity.kt
+++ b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/ProtoDataStoreActivity.kt
@@ -116,4 +116,4 @@
override suspend fun writeTo(t: Settings, output: OutputStream) = t.writeTo(output)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/SettingsFragment.kt b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/SettingsFragment.kt
index 0b68e58..bc1a6a1 100644
--- a/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/SettingsFragment.kt
+++ b/datastore/datastore-sampleapp/src/main/java/com/example/datastoresampleapp/SettingsFragment.kt
@@ -163,4 +163,4 @@
}
override suspend fun writeTo(t: Settings, output: OutputStream) = t.writeTo(output)
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore/build.gradle b/datastore/datastore/build.gradle
index 474f8c8..6f9b832 100644
--- a/datastore/datastore/build.gradle
+++ b/datastore/datastore/build.gradle
@@ -53,7 +53,7 @@
implementation(libs.okio)
api(project(":datastore:datastore-core"))
api(project(":datastore:datastore-core-okio"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
}
}
@@ -65,7 +65,7 @@
dependsOn(commonTest)
dependencies {
implementation(libs.kotlinTest)
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
}
}
@@ -81,7 +81,7 @@
implementation(libs.junit)
implementation(libs.truth)
implementation(project(":internal-testutils-truth"))
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
implementation(project(":internal-testutils-datastore"))
implementation(libs.kotlinCoroutinesTest)
implementation(libs.testRunner)
@@ -89,11 +89,7 @@
}
}
- targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget).configureEach {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
+
targets.all { target ->
if (target.platformType == org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
diff --git a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreDelegateTest.kt b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreDelegateTest.kt
index 11ace8e..2ecff9e 100644
--- a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreDelegateTest.kt
+++ b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreDelegateTest.kt
@@ -144,4 +144,4 @@
scope = scope
)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreFileTest.kt b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreFileTest.kt
index 7eca1d1..cea2d7e 100644
--- a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreFileTest.kt
+++ b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/DataStoreFileTest.kt
@@ -31,4 +31,4 @@
val expectedFile = File(context.filesDir, "datastore/name")
assertThat(file.absolutePath).isEqualTo(expectedFile.absolutePath)
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/TestingSerializer.kt b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/TestingSerializer.kt
index ffc73f3..2465fe8 100644
--- a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/TestingSerializer.kt
+++ b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/TestingSerializer.kt
@@ -54,4 +54,4 @@
}
output.write(t.toInt())
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/migrations/SharedPreferencesMigrationTest.kt b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/migrations/SharedPreferencesMigrationTest.kt
index 51dd177..2220020 100644
--- a/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/migrations/SharedPreferencesMigrationTest.kt
+++ b/datastore/datastore/src/androidAndroidTest/kotlin/androidx/datastore/migrations/SharedPreferencesMigrationTest.kt
@@ -202,4 +202,4 @@
scope = TestScope(UnconfinedTestDispatcher())
) { datastoreFile }
}
-}
\ No newline at end of file
+}
diff --git a/datastore/datastore/src/commonMain/kotlin/androidx/datastore/DataStoreDelegateUtils.kt b/datastore/datastore/src/commonMain/kotlin/androidx/datastore/DataStoreDelegateUtils.kt
index 08047af..e22696f 100644
--- a/datastore/datastore/src/commonMain/kotlin/androidx/datastore/DataStoreDelegateUtils.kt
+++ b/datastore/datastore/src/commonMain/kotlin/androidx/datastore/DataStoreDelegateUtils.kt
@@ -22,4 +22,4 @@
* This is needed to have the native artifacts build. Otherwise there is no code in common and
* the 'buildOnServer' task fails during our presubmits.
*/
-internal class DataStoreDelegateUtils
\ No newline at end of file
+internal class DataStoreDelegateUtils
diff --git a/datastore/settings.gradle b/datastore/settings.gradle
index 1b88d33..fe28d88 100644
--- a/datastore/settings.gradle
+++ b/datastore/settings.gradle
@@ -32,7 +32,7 @@
if (name.startsWith(":datastore")) return true
if (name == ":annotation:annotation-sampled") return true
if (name == ":internal-testutils-datastore") return true
- if (name == ":internal-testutils-kmp") return true
+ if (name == ":kruth:kruth") return true
if (name == ":internal-testutils-truth") return true
return false
})
diff --git a/development/build_log_simplifier/messages.ignore b/development/build_log_simplifier/messages.ignore
index 093c24e..408df66 100644
--- a/development/build_log_simplifier/messages.ignore
+++ b/development/build_log_simplifier/messages.ignore
@@ -1316,4 +1316,12 @@
spdx sboms require a version but project: noto\-emoji\-compat\-flatbuffers has no specified version
# > Task :paging:paging-samples:lintReportDebug
Warning: Lint will treat :paging:paging\-common as an external dependency and not analyze it\.
-\* Recommended Action: Apply the 'com\.android\.lint' plugin to java library project :paging:paging\-common\. to enable lint to analyze those sources\.
\ No newline at end of file
+\* Recommended Action: Apply the 'com\.android\.lint' plugin to java library project :paging:paging\-common\. to enable lint to analyze those sources\.
+# > Configure project :androidx-demos
+WARNING: The option setting 'android\.experimental\.disableCompileSdkChecks=true' is experimental\.
+The current default is 'false'\.
+WARNING: The option setting 'android\.r[0-9]+\.maxWorkers=[0-9]+' is experimental\.
+# > Task :compose:ui:ui:compileReleaseKotlinAndroid
+e: Daemon compilation failed: Could not connect to Kotlin compile daemon
+java\.lang\.RuntimeException: Could not connect to Kotlin compile daemon
+Errors were stored into \$SUPPORT/\.gradle/kotlin/errors/errors\-[0-9]+\.log
\ No newline at end of file
diff --git a/development/project-creator/compose-template/groupId/artifactId/build.gradle b/development/project-creator/compose-template/groupId/artifactId/build.gradle
index b3b12f8..17cf909 100644
--- a/development/project-creator/compose-template/groupId/artifactId/build.gradle
+++ b/development/project-creator/compose-template/groupId/artifactId/build.gradle
@@ -92,7 +92,6 @@
if (desktopEnabled) {
desktopTest {
dependsOn(jvmTest)
- dependsOn(desktopMain)
dependencies {
}
}
diff --git a/docs/api_guidelines/annotations.md b/docs/api_guidelines/annotations.md
new file mode 100644
index 0000000..728d85a2
--- /dev/null
+++ b/docs/api_guidelines/annotations.md
@@ -0,0 +1,286 @@
+## Annotations {#annotation}
+
+### Annotation processors {#annotation-processor}
+
+Annotation processors should opt-in to incremental annotation processing to
+avoid triggering a full recompilation on every client source code change. See
+Gradle's
+[Incremental annotation processing](https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing)
+documentation for information on how to opt-in.
+
+### `@RequiresOptIn` APIs {#experimental-api}
+
+Jetpack libraries may choose to annotate API surfaces as unstable using either
+Kotlin's
+[`@RequiresOptIn` meta-annotation](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-requires-opt-in/)
+for APIs written in Kotlin or Jetpack's
+[`@RequiresOptIn` meta-annotation](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn)
+for APIs written in Java.
+
+> `@RequiresOptIn` at-a-glance:
+>
+> * Use for unstable API surfaces
+> * Can be called by anyone
+> * Documented in public documentation
+> * Does not maintain compatibility
+
+For either annotation, API surfaces marked as opt-in are considered alpha and
+will be excluded from API compatibility guarantees. Due to the lack of
+compatibility guarantees, stable libraries *must never* call experimental APIs
+exposed by other libraries outside of their
+[same-version group](#same-version-atomic-groups) and *may not* use the `@OptIn`
+annotation except in the following cases:
+
+* A library within a same-version group *may* call an experimental API exposed
+ by another library **within its same-version group**. In this case, API
+ compatibility guarantees are covered under the same-version group policies
+ and the library *may* use the `@OptIn` annotation to prevent propagation of
+ the experimental property. **Library owners must exercise care to ensure
+ that post-alpha APIs backed by experimental APIs actually meet the release
+ criteria for post-alpha APIs.**
+* An `alpha` library may use experimental APIs from outside its same-version
+ group. These usages must be removed when the library moves to `beta`.
+
+NOTE JetBrains's own usage of `@RequiresOptIn` in Kotlin language libraries
+varies and may indicate binary instability, functional instability, or simply
+that an API is really difficult to use. Jetpack libraries should treat instances
+of `@RequiresOptIn` in JetBrains libraries as indicating **binary instability**
+and avoid using them outside of `alpha`; however, teams are welcome to obtain
+written assurance from JetBrains regarding binary stability of specific APIs.
+`@RequiresOptIn` APIs that are guaranteed to remain binary compatible *may* be
+used in `beta`, but usages must be removed when the library moves to `rc`.
+
+#### When to mark an API surface as experimental
+
+*Do not* use `@RequiresOptIn` for a stable API surface that is difficult to use.
+It is not a substitute for a properly-designed API surface.
+
+*Do not* use `@RequiresOptIn` for an API surface that is unreliable or unstable
+because it is missing tests. It is not a substitute for a properly-tested API
+surface, and all APIs -- including those in `alpha` -- are expected to be
+functionally stable.
+
+*Do not* use `@RequiresOptIn` for an internal-facing API surface. Use either the
+appropriate language visibility (ex. `private` or `internal`) or `@RestrictTo`.
+
+*Do not* use `@RequiresOptIn` for an API that you expect library developers to
+call. Experimental APIs do not maintain binary compatibility guarantees, and you
+will put external clients in a difficult situation.
+
+*Do* use `@RequiresOptIn` for API surfaces that must be publicly available and
+documented but need the flexibility to stay in `alpha` during the rest of the
+library's `beta`, `rc`, or stable cycles, and continue to break compatibility in
+`beta`.
+
+#### How to mark an API surface as experimental
+
+All libraries using `@RequiresOptIn` annotations *must* depend on the
+`androidx.annotation:annotation-experimental` artifact regardless of whether
+they are using the `androidx` or Kotlin annotation. This artifact provides Lint
+enforcement of experimental usage restrictions for Kotlin callers as well as
+Java (which the Kotlin annotation doesn't handle on its own, since it's a Kotlin
+compiler feature). Libraries *may* include the dependency as `api`-type to make
+`@OptIn` available to Java clients; however, this will also unnecessarily expose
+the `@RequiresOptIn` annotation.
+
+```java
+dependencies {
+ implementation(project(":annotation:annotation-experimental"))
+}
+```
+
+See Kotlin's
+[opt-in requirements documentation](https://kotlinlang.org/docs/reference/opt-in-requirements.html)
+for general usage information. If you are writing experimental Java APIs, you
+will use the Jetpack
+[`@RequiresOptIn` annotation](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn)
+rather than the Kotlin compiler's annotation.
+
+#### How to transition an API out of experimental
+
+When an API surface is ready to transition out of experimental, the annotation
+may only be removed during an alpha pre-release stage. Removing the experimental
+marker from an API is equivalent to adding the API to the current API surface.
+
+When transitioning an entire feature surface out of experimental, you *should*
+remove the definition for the associated experimental marker annotation.
+
+When making any change to the experimental API surface, you *must* run
+`./gradlew updateApi` prior to uploading your change.
+
+NOTE Experimental marker annotation *are themselves* experimental, meaning that
+it's considered binary compatible to refactor or remove an experimental marker
+annotation.
+
+### `@RestrictTo` APIs {#restricted-api}
+
+Jetpack's library tooling supports hiding JVM-visible (ex. `public` and
+`protected`) APIs from developers using a combination of the `@RestrictTo`
+source annotation.
+
+> `@RestrictTo` at-a-glance:
+>
+> * Use for internal-facing API surfaces
+> * Can be called within the specified `Scope`
+> * Does not appear in public documentation
+> * Does not maintain compatibility in most scopes
+
+While restricted APIs do not appear in documentation and Android Studio will
+warn against calling them, hiding an API does *not* provide strong guarantees
+about usage:
+
+* There are no runtime restrictions on calling hidden APIs
+* Android Studio will not warn if hidden APIs are called using reflection
+* Hidden APIs will still show in Android Studio's auto-complete
+
+These annotations indicate that developers should not call an API that is
+*technically* public from a JVM visibility perspective. Hiding APIs is often a
+sign of a poorly-abstracted API surface, and priority should be given to
+creating public, maintainable APIs and using Java visibility modifiers.
+
+*Do not* use `@RestrictTo` to bypass API tracking and review for production
+APIs; instead, rely on API+1 and API Council review to ensure APIs are reviewed
+on a timely basis.
+
+*Do not* use `@RestrictTo` for implementation detail APIs that are used between
+libraries and could reasonably be made public.
+
+*Do* use `@RestrictTo(LIBRARY)` for implementation detail APIs used within a
+single library (but prefer Java language `private` or `default` visibility).
+
+#### `RestrictTo.Scope` and inter- versus intra-library API surfaces {#private-api-types}
+
+To maintain binary compatibility between different versions of libraries,
+restricted API surfaces that are used between libraries within Jetpack
+(inter-library APIs) must follow the same Semantic Versioning rules as public
+APIs. Inter-library APIs should be annotated with the
+`@RestrictTo(LIBRARY_GROUP)` source annotation.
+
+Restricted API surfaces used within a single library (intra-library APIs), on
+the other hand, may be added or removed without any compatibility
+considerations. It is safe to assume that developers *never* call these APIs,
+even though it is technically feasible. Intra-library APIs should be annotated
+with the `@RestrictTo(LIBRARY)` source annotation.
+
+In all cases, correctness and compatibility tracking are handled by AndroidX's
+build system and lint checks.
+
+The following table shows the visibility of a hypothetical API within Maven
+coordinate `androidx.concurrent:concurrent` when annotated with a variety of
+scopes:
+
+<table>
+ <tr>
+ <td><code>RestrictTo.Scope</code></td>
+ <td>Visibility by Maven coordinate</td>
+ <td>Versioning</td>
+ <td>Note</td>
+ </tr>
+ <tr>
+ <td><code>LIBRARY</code></td>
+ <td><code>androidx.concurrent:concurrent</code></td>
+ <td>No compatibility guarantees (same as private)</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><code>LIBRARY_GROUP</code></td>
+ <td><code>androidx.concurrent:*</code></td>
+ <td>Semantic versioning (including deprecation)</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><code>LIBRARY_GROUP_PREFIX</code></td>
+ <td><code>androidx.*:*</code></td>
+ <td>Semantic versioning (including deprecation)</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><code>TEST</code></td>
+ <td><code>*</code></td>
+ <td>No compatibility guarantees (same as private)</td>
+ <td>Not recommended. Prefer language visibility, e.g. `internal` or package-private.</td>
+ </tr>
+</table>
+
+#### `@IntDef` `@StringDef` and `@LongDef` and visibility
+
+All `@IntDef`, `@StringDef`, and `@LongDef` will be stripped from resulting
+artifacts to avoid issues where compiler inlining constants removes information
+as to which `@IntDef` defined the value of `1`. The annotations are extracted
+and packaged separately to be read by Android Studio and lint which enforces the
+types in application code.
+
+* Libraries *must* `@RestrictTo` all `@IntDef`, `@StringDef`, and `@LongDef`
+ declarations to create a warning when the type is used incorrectly.
+* Libraries *must* expose constants used to define the `@IntDef` etc at the
+ same Java visibility as the hidden `@IntDef`
+
+Here is a complete example of an `@IntDef`
+
+```java
+// constants match Java visibility of ExifStreamType
+// code outside this module interacting with ExifStreamType uses these constants
+public static final int STREAM_TYPE_FULL_IMAGE_DATA = 1;
+public static final int STREAM_TYPE_EXIF_DATA_ONLY = 2;
+
+@RestrictTo(RestrictTo.Scope.LIBRARY) // Don't export ExifStreamType outside module
+@Retention(RetentionPolicy.SOURCE)
+@IntDef({
+ STREAM_TYPE_FULL_IMAGE_DATA,
+ STREAM_TYPE_EXIF_DATA_ONLY,
+})
+public @interface ExifStreamType {}
+```
+
+Java visibility should be set as appropriate for the code in question
+(`private`, `package`, or `public`) and is unrelated to hiding.
+
+For more, read the section in
+[Android API Council Guidelines](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/index.md#no-public-typedefs)
+
+#### `*current.txt` File Explanation {#currenttxt}
+
+In this example, `1.3.0-beta02.txt` is just used for an example. This will match
+the current library version.
+
+<table>
+ <tr>
+ <td><code>api/current.txt</code></td>
+ <td>All public APIs.</td>
+ </tr>
+ <tr>
+ <td><code>api/1.3.0-beta02.txt</code></td>
+ <td>All public APIs available in version <code>1.3.0-beta02</code>.
+ Used to enforce compatibility in later versions. This file is only
+ generated during Beta.</td>
+ </tr>
+ <tr>
+ <td><code>api/public_plus_experimental_current.txt </code></td>
+ <td>Superset of all public APIs (<code>api/current.txt</code>) and all
+ experimental/<code>RequiresOptIn</code> APIs.
+ </td>
+ </tr>
+ <tr>
+ <td><code>api/public_plus_experimental_1.3.0-beta03.txt</code></td>
+ <td>Superset of all public APIs (<code>api/1.3.0-beta02.txt.txt</code>) and all
+ experimental/RequiresOptIn APIs, as available in version
+ <code>1.3.0-beta02.txt</code>. Only generated during Beta.</td>
+ <tr>
+ <td><code>api/restricted_current.txt</code></td>
+ <td>Superset of all public APIs (<code>api/current.txt</code>) and
+ all <code>RestrictTo</code> APIs that require compatibility across
+ versions.
+ <p/>Specifically, includes <code>@RestrictTo(LIBRARY_GROUP)</code> and
+ <code>@RestrictTo(LIBRARY_GROUP_PREFIX)</code>.</td>
+ </tr>
+ <tr>
+ <td><code>api/restricted_1.3.0-beta02.txt.txt</code></td>
+ <td>Superset of all public APIs (<code>api/current.txt</code>) and
+ all <code>RestrictTo</code> APIs that require compatibility across
+ versions, as available in version <code>1.3.0-beta02.txt</code>.
+ <p/>
+ Specifically, includes <code>@RestrictTo(LIBRARY_GROUP)</code> and
+ <code>@RestrictTo(LIBRARY_GROUP_PREFIX)</code>. This file is only
+ generated during Beta.</td>
+ </tr>
+</table>
diff --git a/docs/api_guidelines/async.md b/docs/api_guidelines/async.md
new file mode 100644
index 0000000..cc2ebad
--- /dev/null
+++ b/docs/api_guidelines/async.md
@@ -0,0 +1,123 @@
+## Asynchronous work {#async}
+
+### With return values {#async-return}
+
+#### Kotlin
+
+Traditionally, asynchronous work on Android that results in an output value
+would use a callback; however, better alternatives exist for libraries.
+
+Kotlin libraries should consider
+[coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html) and
+`suspend` functions for APIs according to the following rules, but please refer
+to the guidance on [allowable dependencies](#dependencies-coroutines) before
+adding a new dependency on coroutines.
+
+Kotlin suspend fun vs blocking | Behavior
+------------------------------------ | --------------------------
+blocking function with @WorkerThread | API is blocking
+suspend | API is async (e.g. Future)
+
+In general, do not introduce a suspend function entirely to switch threads for
+blocking calls. To do so correctly requires that we allow the developer to
+configure the Dispatcher. As there is already a coroutines-based API for
+changing dispatchers (withContext) that the caller may use to switch threads, it
+is unecessary API overhead to provide a duplicate mechanism. In addition, it
+unecessary limits callers to coroutine contexts.
+
+```kotlin
+// DO expose blocking calls as blocking calls
+@WorkerThread
+fun blockingCall()
+
+// DON'T wrap in suspend functions (only to switch threads)
+suspend fun blockingCallWrappedInSuspend(
+ dispatcher: CoroutineDispatcher = Dispatchers.Default
+) = withContext(dispatcher) { /* ... */ }
+
+// DO expose async calls as suspend funs
+suspend fun asyncCall(): ReturnValue
+
+// DON'T expose async calls as a callback-based API (for the main API)
+fun asyncCall(executor: Executor, callback: (ReturnValue) -> Unit)
+```
+
+#### Java
+
+Java libraries should prefer `ListenableFuture` and the
+[`CallbackToFutureAdapter`](https://developer.android.com/reference/androidx/concurrent/futures/CallbackToFutureAdapter)
+implementation provided by the `androidx.concurrent:concurrent-futures` library.
+Functions and methods that return `ListenableFuture` should be suffixed by,
+`Async` to reserve the shorter, unmodified name for a `suspend` method or
+extension function in Kotlin that returns the value normally in accordance with
+structured concurrency.
+
+Libraries **must not** use `java.util.concurrent.CompletableFuture`, as it has a
+large API surface that permits arbitrary mutation of the future's value and has
+error-prone defaults.
+
+See the [Dependencies](#dependencies) section for more information on using
+Kotlin coroutines and Guava in your library.
+
+### Cancellation
+
+Libraries that expose APIs for performing asynchronous work should support
+cancellation. There are *very few* cases where it is not feasible to support
+cancellation.
+
+Libraries that use `ListenableFuture` must be careful to follow the exact
+specification of
+[`Future.cancel(boolean mayInterruptIfRunning)`](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html?is-external=true#cancel-boolean-)
+behavior.
+
+```java {.bad}
+@Override
+public boolean cancel(boolean mayInterruptIfRunning) {
+ // Does not support cancellation.
+ return false;
+}
+```
+
+```java {.bad}
+@Override
+public boolean cancel(boolean mayInterruptIfRunning) {
+ // Aggressively does not support cancellation.
+ throw new UnsupportedOperationException();
+}
+```
+
+```java {.good}
+@Override
+public boolean cancel(boolean mayInterruptIfRunning) {
+ // Pseudocode that ignores threading but follows the spec.
+ if (mCompleted
+ || mCancelled
+ || mRunning && !mayInterruptIfRunning) {
+ return false;
+ }
+ mCancelled = true;
+ return true;
+}
+```
+
+### Avoid `synchronized` methods
+
+Whenever multiple threads are interacting with shared (mutable) references those
+reads and writes must be synchronized in some way. However synchronized blocks
+make your code thread-safe at the expense of concurrent execution. Any time
+execution enters a synchronized block or method any other thread trying to enter
+a synchronized block on the same object has to wait; even if in practice the
+operations are unrelated (e.g. they interact with different fields). This can
+dramatically reduce the benefit of trying to write multi-threaded code in the
+first place.
+
+Locking with synchronized is a heavyweight form of ensuring ordering between
+threads, and there are a number of common APIs and patterns that you can use
+that are more lightweight, depending on your use case:
+
+* Compute a value once and make it available to all threads
+* Update Set and Map data structures across threads
+* Allow a group of threads to process a stream of data concurrently
+* Provide instances of a non-thread-safe type to multiple threads
+* Update a value from multiple threads atomically
+* Maintain granular control of your concurrency invariants
diff --git a/docs/api_guidelines/checks.md b/docs/api_guidelines/checks.md
index eb381e9..28e0008 100644
--- a/docs/api_guidelines/checks.md
+++ b/docs/api_guidelines/checks.md
@@ -1,6 +1,9 @@
-## Android Lint Guidelines
+## Correctness checks {#checks}
-### Suppression vs Baselines
+### Android lint {#checks-lint}
+
+Android lint runs correctness checks on all library source code, with a limited
+subset of checks run on test sources.
Lint sometimes flags false positives, even though it is safe to ignore these
errors (for example `WeakerAccess` warnings when you are avoiding synthetic
@@ -30,9 +33,9 @@
./gradlew :core:core:updateLintBaseline
```
-## Metalava API Lint
+### Metalava API lint {#checks-metalava}
-As well as Android Lint, which runs on all source code, Metalava will also run
+As well as Android lint, which runs on all source code, Metalava will also run
checks on the public API surface of each library. Similar to with Android Lint,
there can sometimes be false positives / intended deviations from the API
guidelines that Metalava will lint your API surface against. When this happens,
@@ -47,23 +50,23 @@
This will create/amend the `api_lint.ignore` file that lives in a library's
`api` directory.
-## Build Output Guidelines
+### Build output {#checks-build}
In order to more easily identify the root cause of build failures, we want to
keep the amount of output generated by a successful build to a minimum.
-Consequently, we track build output similarly to the way in which we track Lint
+Consequently, we track build output similarly to the way in which we track lint
warnings.
-### Invoking build output validation
+#### Invoking build output validation {#checks-build-invoke}
-You can add `-Pandroidx.validateNoUnrecognizedMessages` to any other AndroidX
-gradlew command to enable validation of build output. For example:
+You can add `-Pandroidx.validateNoUnrecognizedMessages` to any other `gradlew`
+command to enable validation of build output. For example:
```shell
-/gradlew -Pandroidx.validateNoUnrecognizedMessages :help
+./gradlew -Pandroidx.validateNoUnrecognizedMessages :help
```
-### Exempting new build output messages
+#### Exempting new build output messages {#checks-build-suppress}
Please avoid exempting new build output and instead fix or suppress the warnings
themselves, because that will take effect not only on the build server but also
@@ -84,7 +87,7 @@
2. modify the new lines to be appropriately generalized
```
-Each line in this exemptions file is a regular expressing matching one or more
+Each line in this exemptions file is a regular expression matching one or more
lines of output to be exempted. You may want to make these expressions as
specific as possible to ensure that the addition of new, similar messages will
also be detected (for example, discovering an existing warning in a new source
diff --git a/docs/api_guidelines/compat.md b/docs/api_guidelines/compat.md
index ca1d990..6ec06be 100644
--- a/docs/api_guidelines/compat.md
+++ b/docs/api_guidelines/compat.md
@@ -246,6 +246,20 @@
... I dex2oat : Soft verification failures in
```
+#### View constructors {#compat-view-constructors}
+
+The four-arg View constructor -- `View(Context, AttributeSet, int, int)` -- was
+added in SDK 21 and allows a developer to pass in an explicit default style
+resource rather than relying on a theme attribute to resolve the default style
+resource. Because this API was added in SDK 21, care must be taken to ensure
+that it is not called through any < SDK 21 code path.
+
+Views *may* implement a four-arg constructor in one of the following ways:
+
+1. Do not implement.
+1. Implement and annotate with `@RequiresApi(21)`. This means the three-arg
+ constructor **must not** call into the four-arg constructor.
+
#### Device-specific issues {#compat-oem}
Library code may work around device- or manufacturer-specific issues -- issues
diff --git a/docs/api_guidelines/index.md b/docs/api_guidelines/index.md
index ff923a4..737c3c9 100644
--- a/docs/api_guidelines/index.md
+++ b/docs/api_guidelines/index.md
@@ -26,7 +26,13 @@
<!--#include file="/company/teams/androidx/api_guidelines/dependencies.md"-->
-<!--#include file="/company/teams/androidx/api_guidelines/misc.md"-->
+<!--#include file="/company/teams/androidx/api_guidelines/annotations.md"-->
+
+<!--#include file="/company/teams/androidx/api_guidelines/async.md"-->
+
+<!--#include file="/company/teams/androidx/api_guidelines/processors.md"-->
+
+<!--#include file="/company/teams/androidx/api_guidelines/kotlin.md"-->
<!--#include file="/company/teams/androidx/api_guidelines/testing.md"-->
diff --git a/docs/api_guidelines/kotlin.md b/docs/api_guidelines/kotlin.md
new file mode 100644
index 0000000..7d26a56
--- /dev/null
+++ b/docs/api_guidelines/kotlin.md
@@ -0,0 +1,373 @@
+## Kotlin-specific guidelines {#kotlin}
+
+Generally speaking, Kotlin code should follow the compatibility guidelines
+outlined at:
+
+- The official Android Developers
+ [Kotlin-Java interop guide](https://developer.android.com/kotlin/interop)
+- Android API guidelines for
+ [Kotlin-Java interop](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/index.md#kotin-interop)
+- Android API guidelines for
+ [asynchronous and non-blocking APIs](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/async.md)
+- Library-specific guidance outlined below
+
+### Nullability
+
+#### Annotations on new Java APIs
+
+All new Java APIs should be annotated either `@Nullable` or `@NonNull` for all
+reference parameters and reference return types.
+
+```java
+ @Nullable
+ public Object someNewApi(@NonNull Thing arg1, @Nullable List<WhatsIt> arg2) {
+ if(/** something **/) {
+ return someObject;
+ } else {
+ return null;
+ }
+```
+
+#### Adding annotations to existing Java APIs
+
+Adding `@Nullable` or `@NonNull` annotations to existing APIs to document their
+existing nullability is allowed. This is a source-breaking change for Kotlin
+consumers, and you should ensure that it's noted in the release notes and try to
+minimize the frequency of these updates in releases.
+
+Changing the nullability of an API is a behavior-breaking change and should be
+avoided.
+
+#### Extending APIs that are missing annotations
+
+[Platform types](https://kotlinlang.org/docs/java-interop.html#null-safety-and-platform-types)
+are exposed by Java types that do not have a `@Nullable` or `@NonNull`
+annotation. In Kotlin they are indicated with the `!` suffix.
+
+When interacting with an Android platform API that exposes APIs with unknown
+nullability follow these rules:
+
+1. If wrapping the type in a new API, define and handle `@Nullable` or
+ `@NonNull` in the library. Treat types with unknown nullability passed into
+ or return from Android as `@Nullable` in the library.
+2. If extending an existing API (e.g. `@Override`), pass through the existing
+ types with unknown nullability and annotate each with
+ `@SuppressLint("UnknownNullness")`
+
+In Kotlin, a type with unknown nullability is exposed as a "platform type"
+(indicated with a `!` suffix) which has unknown nullability in the type checker,
+and may bypass type checking leading to runtime errors. When possible, do not
+directly expose types with unknown nullability in new public APIs.
+
+#### Extending `@RecentlyNonNull` and `@RecentlyNullable` APIs
+
+Platform APIs are annotated in the platform SDK artifacts with fake annotations
+`@RecentlyNonNull` and `@RecentlyNullable` to avoid breaking builds when we
+annotated platform APIs with nullability. These annotations cause warnings
+instead of build failures. The `RecentlyNonNull` and `RecentlyNullable`
+annotations are added by Metalava and do not appear in platform code.
+
+When extending an API that is annotated `@RecentlyNonNull`, you should annotate
+the override with `@NonNull`, and the same for `@RecentlyNullable` and
+`@Nullable`.
+
+For example `SpannableStringBuilder.append` is annotated `RecentlyNonNull` and
+an override should look like:
+
+```java
+ @NonNull
+ @Override
+ public SpannableStringBuilder append(@SuppressLint("UnknownNullness") CharSequence text) {
+ super.append(text);
+ return this;
+ }
+```
+
+### Data classes {#kotlin-data}
+
+Kotlin `data` classes provide a convenient way to define simple container
+objects, where Kotlin will generate `equals()` and `hashCode()` for you.
+However, they are not designed to preserve API/binary compatibility when members
+are added. This is due to other methods which are generated for you -
+[destructuring declarations](https://kotlinlang.org/docs/reference/multi-declarations.html),
+and [copying](https://kotlinlang.org/docs/reference/data-classes.html#copying).
+
+Example data class as tracked by metalava:
+
+<pre>
+ public final class TargetAnimation {
+ ctor public TargetAnimation(float target, androidx.animation.AnimationBuilder animation);
+ <b>method public float component1();</b>
+ <b>method public androidx.animation.AnimationBuilder component2();</b>
+ <b>method public androidx.animation.TargetAnimation copy(float target, androidx.animation.AnimationBuilder animation);</b>
+ method public androidx.animation.AnimationBuilder getAnimation();
+ method public float getTarget();
+ }
+</pre>
+
+Because members are exposed as numbered components for destructuring, you can
+only safely add members at the end of the member list. As `copy` is generated
+with every member name in order as well, you'll also have to manually
+re-implement any old `copy` variants as items are added. If these constraints
+are acceptable, data classes may still be useful to you.
+
+As a result, Kotlin `data` classes are *strongly discouraged* in library APIs.
+Instead, follow best-practices for Java data classes including implementing
+`equals`, `hashCode`, and `toString`.
+
+See Jake Wharton's article on
+[Public API challenges in Kotlin](https://jakewharton.com/public-api-challenges-in-kotlin/)
+for more details.
+
+### Exhaustive `when` and `sealed class`/`enum class` {#exhaustive-when}
+
+A key feature of Kotlin's `sealed class` and `enum class` declarations is that
+they permit the use of **exhaustive `when` expressions.** For example:
+
+```kotlin
+enum class CommandResult { Permitted, DeniedByUser }
+
+val message = when (commandResult) {
+ Permitted -> "the operation was permitted"
+ DeniedByUser -> "the user said no"
+}
+
+println(message)
+```
+
+This highlights challenges for library API design and compatibility. Consider
+the following addition to the `CommandResult` possibilities:
+
+```kotlin {.bad}
+enum class CommandResult {
+ Permitted,
+ DeniedByUser,
+ DeniedByAdmin // New in androidx.mylibrary:1.1.0!
+}
+```
+
+This change is both **source and binary breaking.**
+
+It is **source breaking** because the author of the `when` block above will see
+a compiler error about not handling the new result value.
+
+It is **binary breaking** because if the `when` block above was compiled as part
+of a library `com.example.library:1.0.0` that transitively depends on
+`androidx.mylibrary:1.0.0`, and an app declares the dependencies:
+
+```kotlin
+implementation("com.example.library:1.0.0")
+implementation("androidx.mylibrary:1.1.0") // Updated!
+```
+
+`com.example.library:1.0.0` does not handle the new result value, leading to a
+runtime exception.
+
+**Note:** The above example is one where Kotlin's `enum class` is the correct
+tool and the library should **not** add a new constant! Kotlin turns this
+semantic API design problem into a compiler or runtime error. This type of
+library API change could silently cause app logic errors or data corruption
+without the protection provided by exhaustive `when`. See
+[When to use exhaustive types](#when-to-use-exhaustive-types).
+
+`sealed class` exhibits the same characteristic; adding a new subtype of an
+existing sealed class is a breaking change for the following code:
+
+```kotlin
+val message = when (command) {
+ is Command.Migrate -> "migrating to ${command.destination}"
+ is Command.Quack -> "quack!"
+}
+```
+
+#### Non-exhaustive alternatives to `enum class`
+
+Kotlin's `@JvmInline value class` with a `private constructor` can be used to
+create type-safe sets of non-exhaustive constants as of Kotlin 1.5. Compose's
+`BlendMode` uses the following pattern:
+
+```kotlin {.good}
+@JvmInline
+value class BlendMode private constructor(val value: Int) {
+ companion object {
+ /** Drop both the source and destination images, leaving nothing. */
+ val Clear = BlendMode(0)
+ /** Drop the destination image, only paint the source image. */
+ val Src = BlendMode(1)
+ // ...
+ }
+}
+```
+
+**Note:** This recommendation may be temporary. Kotlin may add new annotations
+or other language features to declare non-exhaustive enum classes in the future.
+
+Alternatively, the existing `@IntDef` mechanism used in Java-language androidx
+libraries may also be used, but type checking of constants will only be
+performed by lint, and functions overloaded with parameters of different value
+class types are not supported. Prefer the `@JvmInline value class` solution for
+new code unless it would break local consistency with other API in the same
+module that already uses `@IntDef`.
+
+#### Non-exhaustive alternatives to `sealed class`
+
+Abstract classes with constructors marked as `internal` or `private` can
+represent the same subclassing restrictions of sealed classes as seen from
+outside of a library module's own codebase:
+
+```kotlin
+abstract class Command private constructor() {
+ class Migrate(val destination: String) : Command()
+ object Quack : Command()
+}
+```
+
+Using an `internal` constructor will permit non-nested subclasses, but will
+**not** restrict subclasses to the same package within the module, as sealed
+classes do.
+
+#### When to use exhaustive types
+
+Use `enum class` or `sealed class` when the values or subtypes are intended to
+be exhaustive by design from the API's initial release. Use non-exhaustive
+alternatives when the set of constants or subtypes might expand in a minor
+version release.
+
+Consider using an **exhaustive** (`enum class` or `sealed class`) type
+declaration if:
+
+* The developer is expected to **accept** values of the type
+* The developer is expected to **act** on **any and all** values received
+
+Consider using a **non-exhaustive** type declaration if:
+
+* The developer is expected to **provide** values of the type to APIs exposed
+ by the same module **only**
+* The developer is expected to **ignore** unknown values received
+
+The `CommandResult` example above is a good example of a type that **should**
+use the exhaustive `enum class`; `CommandResult`s are **returned** to the
+developer and the developer cannot implement correct app behavior by ignoring
+unrecognized result values. Adding a new result value would semantically break
+existing code regardless of the language facility used to express the type.
+
+```kotlin {.good}
+enum class CommandResult { Permitted, DeniedByUser, DeniedByAdmin }
+```
+
+Compose's `BlendMode` is a good example of a type that **should not** use the
+exhaustive `enum class`; blending modes are used as arguments to Compose
+graphics APIs and are not intended for interpretation by app code. Additionally,
+there is historical precedent from `android.graphics` for new blending modes to
+be added in the future.
+
+### Extension and top-level functions {#kotlin-extension-functions}
+
+If your Kotlin file contains any symbols outside of class-like types
+(extension/top-level functions, properties, etc), the file must be annotated
+with `@JvmName`. This ensures unanticipated use-cases from Java callers don't
+get stuck using `BlahKt` files.
+
+Example:
+
+```kotlin {.bad}
+package androidx.example
+
+fun String.foo() = // ...
+```
+
+```kotlin {.good}
+@file:JvmName("StringUtils")
+
+package androidx.example
+
+fun String.foo() = // ...
+```
+
+NOTE This guideline may be ignored for APIs that will only be referenced from
+Kotlin sources, such as Compose.
+
+### Extension functions on platform classes {#kotlin-extension-platform}
+
+While it may be tempting to backport new platform APIs using extension
+functions, the Kotlin compiler will always resolve collisions between extension
+functions and platform-defined methods by calling the platform-defined method --
+even if the method doesn't exist on earlier SDKs.
+
+```kotlin {.bad}
+fun AccessibilityNodeInfo.getTextSelectionEnd() {
+ // ... delegate to platform on SDK 18+ ...
+}
+```
+
+For the above example, any calls to `getTextSelectionEnd()` will resolve to the
+platform method -- the extension function will never be used -- and crash with
+`MethodNotFoundException` on older SDKs.
+
+Even when an extension function on a platform class does not collide with an
+existing API *yet*, there is a possibility that a conflicting API with a
+matching signature will be added in the future. As such, Jetpack libraries
+should avoid adding extension functions on platform classes.
+
+### Function parameters order {#kotlin-params-order}
+
+In Kotlin function parameters can have default values, which are used when you
+skip the corresponding argument.
+
+If a default parameter precedes a parameter with no default value, the default
+value can only be used by calling the function with named arguments:
+
+```kotlin
+fun foo(
+ someBoolean: Boolean = true,
+ someInt: Int,
+) { /*...*/ }
+
+// usage:
+foo(1) // does not compile as we try to set 1 as a value for "someBoolean" and
+ // didn't specify "someInt".
+foo(someInt = 1) // this compiles as we used named arguments syntax.
+```
+
+To not force our users to use named arguments we enforce the following
+parameters order for the public Kotlin functions:
+
+1. All parameters without default values.
+2. All parameters with default values.
+3. An optional last parameter without default value which can be used as a
+ trailing lambda.
+
+### Default interface methods {#kotlin-jvm-default}
+
+The Kotlin compiler is capable of generating Kotlin-specific default interface
+methods that are compatible with Java 7 language level; however, Jetpack
+libraries ship as Java 8 language level and should use the native Java
+implementation of default methods.
+
+To maximize compatibility, Jetpack libraries should pass `-Xjvm-default=all` to
+the Kotlin compiler:
+
+```
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ freeCompilerArgs += ["-Xjvm-default=all"]
+ }
+}
+```
+
+Before adding this argument, library owners must ensure that existing interfaces
+with default methods in stable API surfaces are annotated with
+`@JvmDefaultWithCompatibility` to preserve binary compatibility:
+
+1. Any interface with stable default method implementations from before the
+ `all` conversion
+1. Any interface with stable methods that have default argument values from
+ before the `all` conversion
+1. Any interface that extends another `@JvmDefaultWithCompatibility` interface
+
+Unstable API surfaces do not need to be annotated, e.g. if the methods or whole
+interface is `@RequiresOptIn` or was never released in a stable library version.
+
+One way to handle this task is to search the API `.txt` file from the latest
+release for `default` or `optional` and add the annotation by hand, then look
+for public sub-interfaces and add the annotation there as well.
diff --git a/docs/api_guidelines/misc.md b/docs/api_guidelines/misc.md
deleted file mode 100644
index f1a6e7f..0000000
--- a/docs/api_guidelines/misc.md
+++ /dev/null
@@ -1,881 +0,0 @@
-## Annotations {#annotation}
-
-### Annotation processors {#annotation-processor}
-
-Annotation processors should opt-in to incremental annotation processing to
-avoid triggering a full recompilation on every client source code change. See
-Gradle's
-[Incremental annotation processing](https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing)
-documentation for information on how to opt-in.
-
-### `@RequiresOptIn` APIs {#experimental-api}
-
-Jetpack libraries may choose to annotate API surfaces as unstable using either
-Kotlin's
-[`@RequiresOptIn` meta-annotation](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-requires-opt-in/)
-for APIs written in Kotlin or Jetpack's
-[`@RequiresOptIn` meta-annotation](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn)
-for APIs written in Java.
-
-> `@RequiresOptIn` at-a-glance:
->
-> * Use for unstable API surfaces
-> * Can be called by anyone
-> * Documented in public documentation
-> * Does not maintain compatibility
-
-For either annotation, API surfaces marked as opt-in are considered alpha and
-will be excluded from API compatibility guarantees. Due to the lack of
-compatibility guarantees, stable libraries *must never* call experimental APIs
-exposed by other libraries outside of their
-[same-version group](#same-version-atomic-groups) and *may not* use the `@OptIn`
-annotation except in the following cases:
-
-* A library within a same-version group *may* call an experimental API exposed
- by another library **within its same-version group**. In this case, API
- compatibility guarantees are covered under the same-version group policies
- and the library *may* use the `@OptIn` annotation to prevent propagation of
- the experimental property. **Library owners must exercise care to ensure
- that post-alpha APIs backed by experimental APIs actually meet the release
- criteria for post-alpha APIs.**
-* An `alpha` library may use experimental APIs from outside its same-version
- group. These usages must be removed when the library moves to `beta`.
-
-NOTE JetBrains's own usage of `@RequiresOptIn` in Kotlin language libraries
-varies and may indicate binary instability, functional instability, or simply
-that an API is really difficult to use. Jetpack libraries should treat instances
-of `@RequiresOptIn` in JetBrains libraries as indicating **binary instability**
-and avoid using them outside of `alpha`; however, teams are welcome to obtain
-written assurance from JetBrains regarding binary stability of specific APIs.
-`@RequiresOptIn` APIs that are guaranteed to remain binary compatible *may* be
-used in `beta`, but usages must be removed when the library moves to `rc`.
-
-#### When to mark an API surface as experimental
-
-*Do not* use `@RequiresOptIn` for a stable API surface that is difficult to use.
-It is not a substitute for a properly-designed API surface.
-
-*Do not* use `@RequiresOptIn` for an API surface that is unreliable or unstable
-because it is missing tests. It is not a substitute for a properly-tested API
-surface, and all APIs -- including those in `alpha` -- are expected to be
-functionally stable.
-
-*Do not* use `@RequiresOptIn` for an internal-facing API surface. Use either the
-appropriate language visibility (ex. `private` or `internal`) or `@RestrictTo`.
-
-*Do not* use `@RequiresOptIn` for an API that you expect library developers to
-call. Experimental APIs do not maintain binary compatibility guarantees, and you
-will put external clients in a difficult situation.
-
-*Do* use `@RequiresOptIn` for API surfaces that must be publicly available and
-documented but need the flexibility to stay in `alpha` during the rest of the
-library's `beta`, `rc`, or stable cycles, and continue to break compatibility in
-`beta`.
-
-#### How to mark an API surface as experimental
-
-All libraries using `@RequiresOptIn` annotations *must* depend on the
-`androidx.annotation:annotation-experimental` artifact regardless of whether
-they are using the `androidx` or Kotlin annotation. This artifact provides Lint
-enforcement of experimental usage restrictions for Kotlin callers as well as
-Java (which the Kotlin annotation doesn't handle on its own, since it's a Kotlin
-compiler feature). Libraries *may* include the dependency as `api`-type to make
-`@OptIn` available to Java clients; however, this will also unnecessarily expose
-the `@RequiresOptIn` annotation.
-
-```java
-dependencies {
- implementation(project(":annotation:annotation-experimental"))
-}
-```
-
-See Kotlin's
-[opt-in requirements documentation](https://kotlinlang.org/docs/reference/opt-in-requirements.html)
-for general usage information. If you are writing experimental Java APIs, you
-will use the Jetpack
-[`@RequiresOptIn` annotation](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresOptIn)
-rather than the Kotlin compiler's annotation.
-
-#### How to transition an API out of experimental
-
-When an API surface is ready to transition out of experimental, the annotation
-may only be removed during an alpha pre-release stage. Removing the experimental
-marker from an API is equivalent to adding the API to the current API surface.
-
-When transitioning an entire feature surface out of experimental, you *should*
-remove the definition for the associated experimental marker annotation.
-
-When making any change to the experimental API surface, you *must* run
-`./gradlew updateApi` prior to uploading your change.
-
-NOTE Experimental marker annotation *are themselves* experimental, meaning that
-it's considered binary compatible to refactor or remove an experimental marker
-annotation.
-
-### `@RestrictTo` APIs {#restricted-api}
-
-Jetpack's library tooling supports hiding JVM-visible (ex. `public` and
-`protected`) APIs from developers using a combination of the `@RestrictTo`
-source annotation.
-
-> `@RestrictTo` at-a-glance:
->
-> * Use for internal-facing API surfaces
-> * Can be called within the specified `Scope`
-> * Does not appear in public documentation
-> * Does not maintain compatibility in most scopes
-
-While restricted APIs do not appear in documentation and Android Studio will
-warn against calling them, hiding an API does *not* provide strong guarantees
-about usage:
-
-* There are no runtime restrictions on calling hidden APIs
-* Android Studio will not warn if hidden APIs are called using reflection
-* Hidden APIs will still show in Android Studio's auto-complete
-
-These annotations indicate that developers should not call an API that is
-*technically* public from a JVM visibility perspective. Hiding APIs is often a
-sign of a poorly-abstracted API surface, and priority should be given to
-creating public, maintainable APIs and using Java visibility modifiers.
-
-*Do not* use `@RestrictTo` to bypass API tracking and review for production
-APIs; instead, rely on API+1 and API Council review to ensure APIs are reviewed
-on a timely basis.
-
-*Do not* use `@RestrictTo` for implementation detail APIs that are used between
-libraries and could reasonably be made public.
-
-*Do* use `@RestrictTo(LIBRARY)` for implementation detail APIs used within a
-single library (but prefer Java language `private` or `default` visibility).
-
-#### `RestrictTo.Scope` and inter- versus intra-library API surfaces {#private-api-types}
-
-To maintain binary compatibility between different versions of libraries,
-restricted API surfaces that are used between libraries within Jetpack
-(inter-library APIs) must follow the same Semantic Versioning rules as public
-APIs. Inter-library APIs should be annotated with the
-`@RestrictTo(LIBRARY_GROUP)` source annotation.
-
-Restricted API surfaces used within a single library (intra-library APIs), on
-the other hand, may be added or removed without any compatibility
-considerations. It is safe to assume that developers *never* call these APIs,
-even though it is technically feasible. Intra-library APIs should be annotated
-with the `@RestrictTo(LIBRARY)` source annotation.
-
-In all cases, correctness and compatibility tracking are handled by AndroidX's
-build system and lint checks.
-
-The following table shows the visibility of a hypothetical API within Maven
-coordinate `androidx.concurrent:concurrent` when annotated with a variety of
-scopes:
-
-<table>
- <tr>
- <td><code>RestrictTo.Scope</code></td>
- <td>Visibility by Maven coordinate</td>
- <td>Versioning</td>
- <td>Note</td>
- </tr>
- <tr>
- <td><code>LIBRARY</code></td>
- <td><code>androidx.concurrent:concurrent</code></td>
- <td>No compatibility guarantees (same as private)</td>
- <td></td>
- </tr>
- <tr>
- <td><code>LIBRARY_GROUP</code></td>
- <td><code>androidx.concurrent:*</code></td>
- <td>Semantic versioning (including deprecation)</td>
- <td></td>
- </tr>
- <tr>
- <td><code>LIBRARY_GROUP_PREFIX</code></td>
- <td><code>androidx.*:*</code></td>
- <td>Semantic versioning (including deprecation)</td>
- <td></td>
- </tr>
- <tr>
- <td><code>TEST</code></td>
- <td><code>*</code></td>
- <td>No compatibility guarantees (same as private)</td>
- <td>Not recommended. Prefer language visibility, e.g. `internal` or package-private.</td>
- </tr>
-</table>
-
-#### `@IntDef` `@StringDef` and `@LongDef` and visibility
-
-All `@IntDef`, `@StringDef`, and `@LongDef` will be stripped from resulting
-artifacts to avoid issues where compiler inlining constants removes information
-as to which `@IntDef` defined the value of `1`. The annotations are extracted
-and packaged separately to be read by Android Studio and lint which enforces the
-types in application code.
-
-* Libraries *must* `@RestrictTo` all `@IntDef`, `@StringDef`, and `@LongDef`
- declarations to create a warning when the type is used incorrectly.
-* Libraries *must* expose constants used to define the `@IntDef` etc at the
- same Java visibility as the hidden `@IntDef`
-
-Here is a complete example of an `@IntDef`
-
-```java
-// constants match Java visibility of ExifStreamType
-// code outside this module interacting with ExifStreamType uses these constants
-public static final int STREAM_TYPE_FULL_IMAGE_DATA = 1;
-public static final int STREAM_TYPE_EXIF_DATA_ONLY = 2;
-
-@RestrictTo(RestrictTo.Scope.LIBRARY) // Don't export ExifStreamType outside module
-@Retention(RetentionPolicy.SOURCE)
-@IntDef({
- STREAM_TYPE_FULL_IMAGE_DATA,
- STREAM_TYPE_EXIF_DATA_ONLY,
-})
-public @interface ExifStreamType {}
-```
-
-Java visibilty should be set as appropriate for the code in question (`private`,
-`package` or `public`) and is unrelated to hiding.
-
-For more, read the section in
-[Android API Council Guidelines](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/index.md#no-public-typedefs)
-
-#### `*current.txt` File Explanation {#currenttxt}
-
-In this example, `1.3.0-beta02.txt` is just used for an example. This will match
-the current library version.
-
-<table>
- <tr>
- <td><code>api/current.txt</code></td>
- <td>All public APIs.</td>
- </tr>
- <tr>
- <td><code>api/1.3.0-beta02.txt</code></td>
- <td>All public APIs available in version <code>1.3.0-beta02</code>.
- Used to enforce compatibility in later versions. This file is only
- generated during Beta.</td>
- </tr>
- <tr>
- <td><code>api/public_plus_experimental_current.txt </code></td>
- <td>Superset of all public APIs (<code>api/current.txt</code>) and all
- experimental/<code>RequiresOptIn</code> APIs.
- </td>
- </tr>
- <tr>
- <td><code>api/public_plus_experimental_1.3.0-beta03.txt</code></td>
- <td>Superset of all public APIs (<code>api/1.3.0-beta02.txt.txt</code>) and all
- experimental/RequiresOptIn APIs, as available in version
- <code>1.3.0-beta02.txt</code>. Only generated during Beta.</td>
- <tr>
- <td><code>api/restricted_current.txt</code></td>
- <td>Superset of all public APIs (<code>api/current.txt</code>) and
- all <code>RestrictTo</code> APIs that require compatibility across
- versions.
- <p/>Specifically, includes <code>@RestrictTo(LIBRARY_GROUP)</code> and
- <code>@RestrictTo(LIBRARY_GROUP_PREFIX)</code>.</td>
- </tr>
- <tr>
- <td><code>api/restricted_1.3.0-beta02.txt.txt</code></td>
- <td>Superset of all public APIs (<code>api/current.txt</code>) and
- all <code>RestrictTo</code> APIs that require compatibility across
- versions, as available in version <code>1.3.0-beta02.txt</code>.
- <p/>
- Specifically, includes <code>@RestrictTo(LIBRARY_GROUP)</code> and
- <code>@RestrictTo(LIBRARY_GROUP_PREFIX)</code>. This file is only
- generated during Beta.</td>
- </tr>
-</table>
-
-## Constructors {#constructors}
-
-### View constructors {#view-constructors}
-
-The four-arg View constructor -- `View(Context, AttributeSet, int, int)` -- was
-added in SDK 21 and allows a developer to pass in an explicit default style
-resource rather than relying on a theme attribute to resolve the default style
-resource. Because this API was added in SDK 21, care must be taken to ensure
-that it is not called through any < SDK 21 code path.
-
-Views *may* implement a four-arg constructor in one of the following ways:
-
-1. Do not implement.
-1. Implement and annotate with `@RequiresApi(21)`. This means the three-arg
- constructor **must not** call into the four-arg constructor.
-
-## Asynchronous work {#async}
-
-### With return values {#async-return}
-
-#### Kotlin
-
-Traditionally, asynchronous work on Android that results in an output value
-would use a callback; however, better alternatives exist for libraries.
-
-Kotlin libraries should consider
-[coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html) and
-`suspend` functions for APIs according to the following rules, but please refer
-to the guidance on [allowable dependencies](#dependencies-coroutines) before
-adding a new dependency on coroutines.
-
-Kotlin suspend fun vs blocking | Behavior
------------------------------------- | --------------------------
-blocking function with @WorkerThread | API is blocking
-suspend | API is async (e.g. Future)
-
-In general, do not introduce a suspend function entirely to switch threads for
-blocking calls. To do so correctly requires that we allow the developer to
-configure the Dispatcher. As there is already a coroutines-based API for
-changing dispatchers (withContext) that the caller may use to switch threads, it
-is unecessary API overhead to provide a duplicate mechanism. In addition, it
-unecessary limits callers to coroutine contexts.
-
-```kotlin
-// DO expose blocking calls as blocking calls
-@WorkerThread
-fun blockingCall()
-
-// DON'T wrap in suspend functions (only to switch threads)
-suspend fun blockingCallWrappedInSuspend(
- dispatcher: CoroutineDispatcher = Dispatchers.Default
-) = withContext(dispatcher) { /* ... */ }
-
-// DO expose async calls as suspend funs
-suspend fun asyncCall(): ReturnValue
-
-// DON'T expose async calls as a callback-based API (for the main API)
-fun asyncCall(executor: Executor, callback: (ReturnValue) -> Unit)
-```
-
-#### Java
-
-Java libraries should prefer `ListenableFuture` and the
-[`CallbackToFutureAdapter`](https://developer.android.com/reference/androidx/concurrent/futures/CallbackToFutureAdapter)
-implementation provided by the `androidx.concurrent:concurrent-futures` library.
-Functions and methods that return `ListenableFuture` should be suffixed by,
-`Async` to reserve the shorter, unmodified name for a `suspend` method or
-extension function in Kotlin that returns the value normally in accordance with
-structured concurrency.
-
-Libraries **must not** use `java.util.concurrent.CompletableFuture`, as it has a
-large API surface that permits arbitrary mutation of the future's value and has
-error-prone defaults.
-
-See the [Dependencies](#dependencies) section for more information on using
-Kotlin coroutines and Guava in your library.
-
-### Cancellation
-
-Libraries that expose APIs for performing asynchronous work should support
-cancellation. There are *very few* cases where it is not feasible to support
-cancellation.
-
-Libraries that use `ListenableFuture` must be careful to follow the exact
-specification of
-[`Future.cancel(boolean mayInterruptIfRunning)`](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html?is-external=true#cancel-boolean-)
-behavior.
-
-```java {.bad}
-@Override
-public boolean cancel(boolean mayInterruptIfRunning) {
- // Does not support cancellation.
- return false;
-}
-```
-
-```java {.bad}
-@Override
-public boolean cancel(boolean mayInterruptIfRunning) {
- // Aggressively does not support cancellation.
- throw new UnsupportedOperationException();
-}
-```
-
-```java {.good}
-@Override
-public boolean cancel(boolean mayInterruptIfRunning) {
- // Pseudocode that ignores threading but follows the spec.
- if (mCompleted
- || mCancelled
- || mRunning && !mayInterruptIfRunning) {
- return false;
- }
- mCancelled = true;
- return true;
-}
-```
-
-### Avoid `synchronized` methods
-
-Whenever multiple threads are interacting with shared (mutable) references those
-reads and writes must be synchronized in some way. However synchronized blocks
-make your code thread-safe at the expense of concurrent execution. Any time
-execution enters a synchronized block or method any other thread trying to enter
-a synchronized block on the same object has to wait; even if in practice the
-operations are unrelated (e.g. they interact with different fields). This can
-dramatically reduce the benefit of trying to write multi-threaded code in the
-first place.
-
-Locking with synchronized is a heavyweight form of ensuring ordering between
-threads, and there are a number of common APIs and patterns that you can use
-that are more lightweight, depending on your use case:
-
-* Compute a value once and make it available to all threads
-* Update Set and Map data structures across threads
-* Allow a group of threads to process a stream of data concurrently
-* Provide instances of a non-thread-safe type to multiple threads
-* Update a value from multiple threads atomically
-* Maintain granular control of your concurrency invariants
-
-## Kotlin-specific guidelines {#kotlin}
-
-Generally speaking, Kotlin code should follow the compatibility guidelines
-outlined at:
-
-- The official Android Developers
- [Kotlin-Java interop guide](https://developer.android.com/kotlin/interop)
-- Android API guidelines for
- [Kotlin-Java interop](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/index.md#kotin-interop)
-- Android API guidelines for
- [asynchronous and non-blocking APIs](https://android.googlesource.com/platform/developers/docs/+/refs/heads/master/api-guidelines/async.md)
-- Library-specific guidance outlined below
-
-### Nullability
-
-#### Annotations on new Java APIs
-
-All new Java APIs should be annotated either `@Nullable` or `@NonNull` for all
-reference parameters and reference return types.
-
-```java
- @Nullable
- public Object someNewApi(@NonNull Thing arg1, @Nullable List<WhatsIt> arg2) {
- if(/** something **/) {
- return someObject;
- } else {
- return null;
- }
-```
-
-#### Adding annotations to existing Java APIs
-
-Adding `@Nullable` or `@NonNull` annotations to existing APIs to document their
-existing nullability is allowed. This is a source-breaking change for Kotlin
-consumers, and you should ensure that it's noted in the release notes and try to
-minimize the frequency of these updates in releases.
-
-Changing the nullability of an API is a behavior-breaking change and should be
-avoided.
-
-#### Extending APIs that are missing annotations
-
-[Platform types](https://kotlinlang.org/docs/java-interop.html#null-safety-and-platform-types)
-are exposed by Java types that do not have a `@Nullable` or `@NonNull`
-annotation. In Kotlin they are indicated with the `!` suffix.
-
-When interacting with an Android platform API that exposes APIs with unknown
-nullability follow these rules:
-
-1. If wrapping the type in a new API, define and handle `@Nullable` or
- `@NonNull` in the library. Treat types with unknown nullability passed into
- or return from Android as `@Nullable` in the library.
-2. If extending an existing API (e.g. `@Override`), pass through the existing
- types with unknown nullability and annotate each with
- `@SuppressLint("UnknownNullness")`
-
-In Kotlin, a type with unknown nullability is exposed as a "platform type"
-(indicated with a `!` suffix) which has unknown nullability in the type checker,
-and may bypass type checking leading to runtime errors. When possible, do not
-directly expose types with unknown nullability in new public APIs.
-
-#### Extending `@RecentlyNonNull` and `@RecentlyNullable` APIs
-
-Platform APIs are annotated in the platform SDK artifacts with fake annotations
-`@RecentlyNonNull` and `@RecentlyNullable` to avoid breaking builds when we
-annotated platform APIs with nullability. These annotations cause warnings
-instead of build failures. The `RecentlyNonNull` and `RecentlyNullable`
-annotations are added by Metalava and do not appear in platform code.
-
-When extending an API that is annotated `@RecentlyNonNull`, you should annotate
-the override with `@NonNull`, and the same for `@RecentlyNullable` and
-`@Nullable`.
-
-For example `SpannableStringBuilder.append` is annotated `RecentlyNonNull` and
-an override should look like:
-
-```java
- @NonNull
- @Override
- public SpannableStringBuilder append(@SuppressLint("UnknownNullness") CharSequence text) {
- super.append(text);
- return this;
- }
-```
-
-### Data classes {#kotlin-data}
-
-Kotlin `data` classes provide a convenient way to define simple container
-objects, where Kotlin will generate `equals()` and `hashCode()` for you.
-However, they are not designed to preserve API/binary compatibility when members
-are added. This is due to other methods which are generated for you -
-[destructuring declarations](https://kotlinlang.org/docs/reference/multi-declarations.html),
-and [copying](https://kotlinlang.org/docs/reference/data-classes.html#copying).
-
-Example data class as tracked by metalava:
-
-<pre>
- public final class TargetAnimation {
- ctor public TargetAnimation(float target, androidx.animation.AnimationBuilder animation);
- <b>method public float component1();</b>
- <b>method public androidx.animation.AnimationBuilder component2();</b>
- <b>method public androidx.animation.TargetAnimation copy(float target, androidx.animation.AnimationBuilder animation);</b>
- method public androidx.animation.AnimationBuilder getAnimation();
- method public float getTarget();
- }
-</pre>
-
-Because members are exposed as numbered components for destructuring, you can
-only safely add members at the end of the member list. As `copy` is generated
-with every member name in order as well, you'll also have to manually
-re-implement any old `copy` variants as items are added. If these constraints
-are acceptable, data classes may still be useful to you.
-
-As a result, Kotlin `data` classes are *strongly discouraged* in library APIs.
-Instead, follow best-practices for Java data classes including implementing
-`equals`, `hashCode`, and `toString`.
-
-See Jake Wharton's article on
-[Public API challenges in Kotlin](https://jakewharton.com/public-api-challenges-in-kotlin/)
-for more details.
-
-### Exhaustive `when` and `sealed class`/`enum class` {#exhaustive-when}
-
-A key feature of Kotlin's `sealed class` and `enum class` declarations is that
-they permit the use of **exhaustive `when` expressions.** For example:
-
-```kotlin
-enum class CommandResult { Permitted, DeniedByUser }
-
-val message = when (commandResult) {
- Permitted -> "the operation was permitted"
- DeniedByUser -> "the user said no"
-}
-
-println(message)
-```
-
-This highlights challenges for library API design and compatibility. Consider
-the following addition to the `CommandResult` possibilities:
-
-```kotlin {.bad}
-enum class CommandResult {
- Permitted,
- DeniedByUser,
- DeniedByAdmin // New in androidx.mylibrary:1.1.0!
-}
-```
-
-This change is both **source and binary breaking.**
-
-It is **source breaking** because the author of the `when` block above will see
-a compiler error about not handling the new result value.
-
-It is **binary breaking** because if the `when` block above was compiled as part
-of a library `com.example.library:1.0.0` that transitively depends on
-`androidx.mylibrary:1.0.0`, and an app declares the dependencies:
-
-```kotlin
-implementation("com.example.library:1.0.0")
-implementation("androidx.mylibrary:1.1.0") // Updated!
-```
-
-`com.example.library:1.0.0` does not handle the new result value, leading to a
-runtime exception.
-
-**Note:** The above example is one where Kotlin's `enum class` is the correct
-tool and the library should **not** add a new constant! Kotlin turns this
-semantic API design problem into a compiler or runtime error. This type of
-library API change could silently cause app logic errors or data corruption
-without the protection provided by exhaustive `when`. See
-[When to use exhaustive types](#when-to-use-exhaustive-types).
-
-`sealed class` exhibits the same characteristic; adding a new subtype of an
-existing sealed class is a breaking change for the following code:
-
-```kotlin
-val message = when (command) {
- is Command.Migrate -> "migrating to ${command.destination}"
- is Command.Quack -> "quack!"
-}
-```
-
-#### Non-exhaustive alternatives to `enum class`
-
-Kotlin's `@JvmInline value class` with a `private constructor` can be used to
-create type-safe sets of non-exhaustive constants as of Kotlin 1.5. Compose's
-`BlendMode` uses the following pattern:
-
-```kotlin {.good}
-@JvmInline
-value class BlendMode private constructor(val value: Int) {
- companion object {
- /** Drop both the source and destination images, leaving nothing. */
- val Clear = BlendMode(0)
- /** Drop the destination image, only paint the source image. */
- val Src = BlendMode(1)
- // ...
- }
-}
-```
-
-**Note:** This recommendation may be temporary. Kotlin may add new annotations
-or other language features to declare non-exhaustive enum classes in the future.
-
-Alternatively, the existing `@IntDef` mechanism used in Java-language androidx
-libraries may also be used, but type checking of constants will only be
-performed by lint, and functions overloaded with parameters of different value
-class types are not supported. Prefer the `@JvmInline value class` solution for
-new code unless it would break local consistency with other API in the same
-module that already uses `@IntDef`.
-
-#### Non-exhaustive alternatives to `sealed class`
-
-Abstract classes with constructors marked as `internal` or `private` can
-represent the same subclassing restrictions of sealed classes as seen from
-outside of a library module's own codebase:
-
-```kotlin
-abstract class Command private constructor() {
- class Migrate(val destination: String) : Command()
- object Quack : Command()
-}
-```
-
-Using an `internal` constructor will permit non-nested subclasses, but will
-**not** restrict subclasses to the same package within the module, as sealed
-classes do.
-
-#### When to use exhaustive types
-
-Use `enum class` or `sealed class` when the values or subtypes are intended to
-be exhaustive by design from the API's initial release. Use non-exhaustive
-alternatives when the set of constants or subtypes might expand in a minor
-version release.
-
-Consider using an **exhaustive** (`enum class` or `sealed class`) type
-declaration if:
-
-* The developer is expected to **accept** values of the type
-* The developer is expected to **act** on **any and all** values received
-
-Consider using a **non-exhaustive** type declaration if:
-
-* The developer is expected to **provide** values of the type to APIs exposed
- by the same module **only**
-* The developer is expected to **ignore** unknown values received
-
-The `CommandResult` example above is a good example of a type that **should**
-use the exhaustive `enum class`; `CommandResult`s are **returned** to the
-developer and the developer cannot implement correct app behavior by ignoring
-unrecognized result values. Adding a new result value would semantically break
-existing code regardless of the language facility used to express the type.
-
-```kotlin {.good}
-enum class CommandResult { Permitted, DeniedByUser, DeniedByAdmin }
-```
-
-Compose's `BlendMode` is a good example of a type that **should not** use the
-exhaustive `enum class`; blending modes are used as arguments to Compose
-graphics APIs and are not intended for interpretation by app code. Additionally,
-there is historical precedent from `android.graphics` for new blending modes to
-be added in the future.
-
-### Extension and top-level functions {#kotlin-extension-functions}
-
-If your Kotlin file contains any symbols outside of class-like types
-(extension/top-level functions, properties, etc), the file must be annotated
-with `@JvmName`. This ensures unanticipated use-cases from Java callers don't
-get stuck using `BlahKt` files.
-
-Example:
-
-```kotlin {.bad}
-package androidx.example
-
-fun String.foo() = // ...
-```
-
-```kotlin {.good}
-@file:JvmName("StringUtils")
-
-package androidx.example
-
-fun String.foo() = // ...
-```
-
-NOTE This guideline may be ignored for APIs that will only be referenced from
-Kotlin sources, such as Compose.
-
-### Extension functions on platform classes {#kotlin-extension-platform}
-
-While it may be tempting to backport new platform APIs using extension
-functions, the Kotlin compiler will always resolve collisions between extension
-functions and platform-defined methods by calling the platform-defined method --
-even if the method doesn't exist on earlier SDKs.
-
-```kotlin {.bad}
-fun AccessibilityNodeInfo.getTextSelectionEnd() {
- // ... delegate to platform on SDK 18+ ...
-}
-```
-
-For the above example, any calls to `getTextSelectionEnd()` will resolve to the
-platform method -- the extension function will never be used -- and crash with
-`MethodNotFoundException` on older SDKs.
-
-Even when an extension function on a platform class does not collide with an
-existing API *yet*, there is a possibility that a conflicting API with a
-matching signature will be added in the future. As such, Jetpack libraries
-should avoid adding extension functions on platform classes.
-
-### Function paremeters order {#kotlin-params-order}
-
-In Kotlin function parameters can have default values, which are used when you
-skip the corresponding argument.
-
-If a default parameter precedes a parameter with no default value, the default
-value can only be used by calling the function with named arguments:
-
-```kotlin
-fun foo(
- someBoolean: Boolean = true,
- someInt: Int,
-) { /*...*/ }
-
-// usage:
-foo(1) // does not compile as we try to set 1 as a value for "someBoolean" and
- // didn't specify "someInt".
-foo(someInt = 1) // this compiles as we used named arguments syntax.
-```
-
-To not force our users to use named arguments we enforce the following
-parameters order for the public Kotlin functions:
-
-1. All parameters without default values.
-2. All parameters with default values.
-3. An optional last parameter without default value which can be used as a
- trailing lambda.
-
-### Default interface methods {#kotlin-jvm-default}
-
-The Kotlin compiler is capable of generating Kotlin-specific default interface
-methods that are compatible with Java 7 language level; however, Jetpack
-libraries ship as Java 8 language level and should use the native Java
-implementation of default methods.
-
-To maximize compatibility, Jetpack libraries should pass `-Xjvm-default=all` to
-the Kotlin compiler:
-
-```
-tasks.withType(KotlinCompile).configureEach {
- kotlinOptions {
- freeCompilerArgs += ["-Xjvm-default=all"]
- }
-}
-```
-
-Before adding this argument, library owners must ensure that existing interfaces
-with default methods in stable API surfaces are annotated with
-`@JvmDefaultWithCompatibility` to preserve binary compatibility:
-
-1. Any interface with stable default method implementations from before the
- `all` conversion
-1. Any interface with stable methods that have default argument values from
- before the `all` conversion
-1. Any interface that extends another `@JvmDefaultWithCompatibility` interface
-
-Unstable API surfaces do not need to be annotated, e.g. if the methods or whole
-interface is `@RequiresOptIn` or was never released in a stable library version.
-
-One way to handle this task is to search the API `.txt` file from the latest
-release for `default` or `optional` and add the annotation by hand, then look
-for public sub-interfaces and add the annotation there as well.
-
-## Proguard configuration
-
-Proguard configurations allow libraries to specify how post-processing tools
-like optimizers and shrinkers should operate on library bytecode. Note that
-while Proguard is the name of a specific tool, a Proguard configuration may be
-read by R8 or any number of other post-processing tools.
-
-NOTE Jetpack libraries **must not** run Proguard on their release artifacts. Do
-not specify `minifyEnabled`, `shrinkResources`, or `proguardFiles` in your build
-configuration.
-
-### Bundling with a library
-
-**Android libraries (AARs)** can bundle consumer-facing Proguard rules using the
-`consumerProguardFiles` (*not* `proguardFiles`) field in their `build.gradle`
-file's `defaultConfig`:
-
-```
-android {
- defaultConfig {
- consumerProguardFiles 'proguard-rules.pro'
- }
-}
-```
-
-Libraries *do not* need to specify this field on `buildTypes.all`.
-
-**Java-only libraries (JARs)** can bundle consumer-facing Proguard rules by
-placing the file under the `META-INF` resources directory. The file **must** be
-named using the library's unique Maven coordinate to avoid build-time merging
-issues:
-
-```
-<project>/src/main/resources/META-INF/proguard/androidx.core_core.pro
-```
-
-### Conditional Proguard Rules
-
-Libraries are strongly encouraged to minimize the number of classes that are
-kept as part of keep rules. More specifically, library authors are expected to
-identify the entry points of their library that call into code paths that may
-require classes to be exempt from proguard rules. This may be due to internal
-reflection usages or JNI code. In the case of JNI code, java/kotlin classes and
-methods that are implemented in native must be exempt in order to avoid JNI
-linking errors in libraries that are consumed by applications built with
-proguard enabled.
-
-A common pattern is to create an annotation class that is used to annotate all
-classes and methods that are to be excluded from proguard obfuscation.
-
-For example:
-
-```
-/// in MyProguardExceptionAnnotation.kt
-internal annotation class MyProguardExemptionAnnotation
-```
-
-Then reference this annotation within your proguard config conditionally
-whenever the public API is consumed that leverages facilities that need to be
-excluded from proguard optimization.
-
-```
-# in proguard-rules.pro
-# The following keeps classes annotated with MyProguardExemptionAnnotation
-# defined above
--if class androidx.mylibrary.MyPublicApi
--keep @androidx.mylibrary.MyProguardExemptionAnnotation public class *
-
-# The following keeps methods annotated with MyProguardExcemptionAnnotation
--if class androidx.mylibrary.MyPublicApi
--keepclasseswithmembers class * {
- @androidx.mylibrary.MyProguardExcemptionAnnotation *;
-}
-```
-
-Note that for each public API entry point an additional proguard rule would need
-to be introduced in the corresponding proguard-rules.pro. This is because as of
-writing there is no "or" operator within proguard that can be used to include
-the keep rules for multiple conditions. So each rule would need to be
-copy/pasted for each public API entrypoint.
diff --git a/docs/api_guidelines/processors.md b/docs/api_guidelines/processors.md
new file mode 100644
index 0000000..ca050de
--- /dev/null
+++ b/docs/api_guidelines/processors.md
@@ -0,0 +1,82 @@
+## Processors
+
+### Proguard {#proguard}
+
+Proguard configurations allow libraries to specify how post-processing tools
+like optimizers and shrinkers should operate on library bytecode. Note that
+while Proguard is the name of a specific tool, a Proguard configuration may be
+read by R8 or any number of other post-processing tools.
+
+NOTE Jetpack libraries **must not** run Proguard on their release artifacts. Do
+not specify `minifyEnabled`, `shrinkResources`, or `proguardFiles` in your build
+configuration.
+
+#### Bundling with a library {#proguard-rules}
+
+**Android libraries (AARs)** can bundle consumer-facing Proguard rules using the
+`consumerProguardFiles` (*not* `proguardFiles`) field in their `build.gradle`
+file's `defaultConfig`:
+
+```
+android {
+ defaultConfig {
+ consumerProguardFiles 'proguard-rules.pro'
+ }
+}
+```
+
+Libraries *do not* need to specify this field on `buildTypes.all`.
+
+**Java-only libraries (JARs)** can bundle consumer-facing Proguard rules by
+placing the file under the `META-INF` resources directory. The file **must** be
+named using the library's unique Maven coordinate to avoid build-time merging
+issues:
+
+```
+<project>/src/main/resources/META-INF/proguard/androidx.core_core.pro
+```
+
+#### Conditional Proguard Rules {#proguard-conditional}
+
+Libraries are strongly encouraged to minimize the number of classes that are
+kept as part of keep rules. More specifically, library authors are expected to
+identify the entry points of their library that call into code paths that may
+require classes to be exempt from proguard rules. This may be due to internal
+reflection usages or JNI code. In the case of JNI code, java/kotlin classes and
+methods that are implemented in native must be exempt in order to avoid JNI
+linking errors in libraries that are consumed by applications built with
+proguard enabled.
+
+A common pattern is to create an annotation class that is used to annotate all
+classes and methods that are to be excluded from proguard obfuscation.
+
+For example:
+
+```
+/// in MyProguardExceptionAnnotation.kt
+internal annotation class MyProguardExemptionAnnotation
+```
+
+Then reference this annotation within your proguard config conditionally
+whenever the public API is consumed that leverages facilities that need to be
+excluded from proguard optimization.
+
+```
+# in proguard-rules.pro
+# The following keeps classes annotated with MyProguardExemptionAnnotation
+# defined above
+-if class androidx.mylibrary.MyPublicApi
+-keep @androidx.mylibrary.MyProguardExemptionAnnotation public class *
+
+# The following keeps methods annotated with MyProguardExcemptionAnnotation
+-if class androidx.mylibrary.MyPublicApi
+-keepclasseswithmembers class * {
+ @androidx.mylibrary.MyProguardExcemptionAnnotation *;
+}
+```
+
+Note that for each public API entry point an additional proguard rule would need
+to be introduced in the corresponding proguard-rules.pro. This is because as of
+writing there is no "or" operator within proguard that can be used to include
+the keep rules for multiple conditions. So each rule would need to be
+copy/pasted for each public API entrypoint.
diff --git a/docs/api_guidelines/resources.md b/docs/api_guidelines/resources.md
index 2220c81..cad5351 100644
--- a/docs/api_guidelines/resources.md
+++ b/docs/api_guidelines/resources.md
@@ -133,7 +133,8 @@
Developers **must not** add `<application>`-level `<meta-data>` tags to library
manifests or advise developers to add such tags to their application manifests.
-Doing so may *inadvertently cause denial-of-service attacks against other apps*.
+Doing so may *inadvertently cause denial-of-service attacks against other apps*
+(see b/194303997).
Assume a library adds a single item of meta-data at the application level. When
an app uses the library, that meta-data will be merged into the resulting app's
@@ -174,20 +175,5 @@
</application>
```
-```java {.good}
-package androidx.libraryname.featurename;
-
-/**
- * A placeholder service to avoid adding application-level metadata. The service
- * is only used to expose metadata defined in the library's manifest. It is
- * never invoked.
- */
-public final class MetadataHolderService {
- public MetadataHolderService() {}
-
- @Override
- public IBinder onBind(Intent intent) {
- throw new UnsupportedOperationException();
- }
-}
-```
+Note: there is no need to provide a definition for the `MetadataHolderService`
+class, as it is merely a placeholder and will never be called.
diff --git a/docs/manual_prebuilts_dance.md b/docs/manual_prebuilts_dance.md
deleted file mode 100644
index 4dcbf63..0000000
--- a/docs/manual_prebuilts_dance.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# The Manual Prebuilts Dance™
-
-NOTE There is also a
-[script](/company/teams/androidx/releasing_detailed.md#the-prebuilts-dance™)
-that automates this step.
-
-Public-facing Jetpack library docs are built from prebuilts to reconcile our
-monolithic docs update process with our independently-versioned library release
-process.
-
-Submit the following changes in the same Gerrit topic so that they merge in the
-same build ID:
-
-1. Commit your release artifact to the AndroidX AOSP checkout's local Maven
- repository under `prebuilts/androidx/internal`.
-
-2. Update the version for your library in the public docs configuration
- ([docs-public/build.gradle](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:docs-public/build.gradle)).
- If this is the first time that your library is being published, you will
- need to add a new entry.
-
-Once both changes are, make sure to note the build ID where they landed. You
-will need to put this in your release request bug for Docs team.
diff --git a/dynamicanimation/dynamicanimation-ktx/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.kt b/dynamicanimation/dynamicanimation-ktx/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.kt
index 8166c4e..df857c6 100644
--- a/dynamicanimation/dynamicanimation-ktx/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.kt
+++ b/dynamicanimation/dynamicanimation-ktx/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.kt
@@ -83,4 +83,4 @@
setter.invoke(value)
}
}
-}
\ No newline at end of file
+}
diff --git a/dynamicanimation/dynamicanimation/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.java b/dynamicanimation/dynamicanimation/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.java
index e99a8cc..6ed0e9a 100644
--- a/dynamicanimation/dynamicanimation/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.java
+++ b/dynamicanimation/dynamicanimation/src/main/java/androidx/dynamicanimation/animation/DynamicAnimation.java
@@ -796,7 +796,7 @@
/****************Sub class animations**************/
/**
* Returns the acceleration at the given value with the given velocity.
- **/
+ */
abstract float getAcceleration(float value, float velocity);
/**
diff --git a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiProcessBenchmark.kt b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiProcessBenchmark.kt
index 5c54aa9c..8c7d9aa 100644
--- a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiProcessBenchmark.kt
+++ b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiProcessBenchmark.kt
@@ -121,4 +121,4 @@
allEmojiMetadata.getSpans(0, text.length, EmojiSpan::class.java)
.forEach { it.typefaceRasterizer.resetHasGlyphCache() }
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiStrings.kt b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiStrings.kt
index fa6c533..1f31692 100644
--- a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiStrings.kt
+++ b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/EmojiStrings.kt
@@ -47,4 +47,4 @@
}
result
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/InitializeEmojiCompat.kt b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/InitializeEmojiCompat.kt
index aec408a..43e7ed5 100644
--- a/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/InitializeEmojiCompat.kt
+++ b/emoji2/emoji2-benchmark/src/androidTest/java/androidx/emoji2/benchmark/text/InitializeEmojiCompat.kt
@@ -37,4 +37,4 @@
})
EmojiCompat.reset(config).load()
latch.await(2, TimeUnit.SECONDS)
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/samples/src/main/java/androidx/emoji2/emojipicker/samples/MainActivity.kt b/emoji2/emoji2-emojipicker/samples/src/main/java/androidx/emoji2/emojipicker/samples/MainActivity.kt
index def8ee3..cd46f5d 100644
--- a/emoji2/emoji2-emojipicker/samples/src/main/java/androidx/emoji2/emojipicker/samples/MainActivity.kt
+++ b/emoji2/emoji2-emojipicker/samples/src/main/java/androidx/emoji2/emojipicker/samples/MainActivity.kt
@@ -97,4 +97,4 @@
.putString(PREF_KEY_CUSTOM_EMOJI_FREQ, emoji2Frequency.entries.joinToString(SPLIT_CHAR))
.commit()
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/androidTest/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManagerTest.kt b/emoji2/emoji2-emojipicker/src/androidTest/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManagerTest.kt
index bfbe8f3..ce4fbc9 100644
--- a/emoji2/emoji2-emojipicker/src/androidTest/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManagerTest.kt
+++ b/emoji2/emoji2-emojipicker/src/androidTest/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManagerTest.kt
@@ -42,4 +42,4 @@
"\u0023\uFE0F\u20E3"
)
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/BundledEmojiListLoader.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/BundledEmojiListLoader.kt
index 65b90c6..84594c9 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/BundledEmojiListLoader.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/BundledEmojiListLoader.kt
@@ -136,4 +136,4 @@
val categoryName: String,
val emojiDataList: List<EmojiViewItem>
)
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerBodyAdapter.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerBodyAdapter.kt
index de10ce6..8ad826c 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerBodyAdapter.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerBodyAdapter.kt
@@ -134,4 +134,4 @@
)
init?.invoke(it)
}) {}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerConstants.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerConstants.kt
index 0956f96..601f021 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerConstants.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerConstants.kt
@@ -32,4 +32,4 @@
const val REMOVE_VIEW_EXCEPTION_MESSAGE =
"Removing views from the EmojiPickerView is unsupported"
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerHeaderAdapter.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerHeaderAdapter.kt
index 4dac647..75921ca 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerHeaderAdapter.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerHeaderAdapter.kt
@@ -78,4 +78,4 @@
override fun getItemCount(): Int {
return emojiPickerItems.numGroups
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerItems.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerItems.kt
index 7ac2aa6..9c7df41 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerItems.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerItems.kt
@@ -107,4 +107,4 @@
}
override fun iterator(): Iterator<ItemViewData> = groups.flatMap { it.getAll() }.iterator()
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerView.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerView.kt
index c7f1d07..b46c684 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerView.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiPickerView.kt
@@ -430,4 +430,4 @@
override fun removeViewsInLayout(start: Int, count: Int) {
throw UnsupportedOperationException(EmojiPickerConstants.REMOVE_VIEW_EXCEPTION_MESSAGE)
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiView.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiView.kt
index c242938..7891134 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiView.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiView.kt
@@ -177,4 +177,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiViewHolder.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiViewHolder.kt
index 94e4abc..f63400d 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiViewHolder.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiViewHolder.kt
@@ -122,4 +122,4 @@
private fun makeEmojiViewItem(emoji: String) =
EmojiViewItem(emoji, BundledEmojiListLoader.getEmojiVariantsLookup()[emoji] ?: listOf())
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/PopupViewHelper.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/PopupViewHelper.kt
index e000eb32..2ba24b8 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/PopupViewHelper.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/PopupViewHelper.kt
@@ -165,4 +165,4 @@
paint?.let { drawCircle(width / 2f, height / 2f, radius, it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiAsyncProvider.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiAsyncProvider.kt
index 2ef673f..a679446 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiAsyncProvider.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiAsyncProvider.kt
@@ -40,4 +40,4 @@
override suspend fun getRecentEmojiList() =
recentEmojiAsyncProvider.getRecentEmojiListAsync().await()
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiProvider.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiProvider.kt
index 1189b5f..ea575da 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiProvider.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/RecentEmojiProvider.kt
@@ -32,4 +32,4 @@
* frequency to low click frequency.
*/
suspend fun getRecentEmojiList(): List<String>
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/FileCache.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/FileCache.kt
index c3bfbf8..af21998 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/FileCache.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/FileCache.kt
@@ -19,12 +19,15 @@
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
+import android.util.Log;
+import androidx.annotation.GuardedBy
import androidx.annotation.RequiresApi
import androidx.annotation.VisibleForTesting
import androidx.core.content.ContextCompat
import androidx.emoji2.emojipicker.BundledEmojiListLoader
import androidx.emoji2.emojipicker.EmojiViewItem
import java.io.File
+import java.io.IOException
/**
* A class that manages cache files for the emoji picker. All cache files are stored in DE
@@ -33,19 +36,21 @@
*
* Currently this class is only used by [BundledEmojiListLoader]. All renderable emojis will be
* cached by categories under
- * /app.package.name/cache/emoji_picker/<osVersion|appVersion>
+ * /app.package.name/cache/emoji_picker/<osVersion.appVersion>
* /emoji.<emojiPickerVersion>.<emojiCompatMetadataHashCode>.<categoryIndex>.<ifEmoji12Supported>
*/
internal class FileCache(context: Context) {
@VisibleForTesting
+ @GuardedBy("lock")
internal val emojiPickerCacheDir: File
private val currentProperty: String
+ private val lock = Any()
init {
val osVersion = "${Build.VERSION.SDK_INT}_${Build.TIME}"
val appVersion = getVersionCode(context)
- currentProperty = "$osVersion|$appVersion"
+ currentProperty = "$osVersion.$appVersion"
emojiPickerCacheDir =
File(getDeviceProtectedStorageContext(context).cacheDir, EMOJI_PICKER_FOLDER)
if (!emojiPickerCacheDir.exists())
@@ -57,15 +62,17 @@
key: String,
defaultValue: () -> List<EmojiViewItem>
): List<EmojiViewItem> {
- val targetDir = File(emojiPickerCacheDir, currentProperty)
- // No matching cache folder for current property, clear stale cache directory if any
- if (!targetDir.exists()) {
- emojiPickerCacheDir.listFiles()?.forEach { it.deleteRecursively() }
- targetDir.mkdirs()
- }
+ synchronized(lock) {
+ val targetDir = File(emojiPickerCacheDir, currentProperty)
+ // No matching cache folder for current property, clear stale cache directory if any
+ if (!targetDir.exists()) {
+ emojiPickerCacheDir.listFiles()?.forEach { it.deleteRecursively() }
+ targetDir.mkdirs()
+ }
- val targetFile = File(targetDir, key)
- return readFrom(targetFile) ?: writeTo(targetFile, defaultValue)
+ val targetFile = File(targetDir, key)
+ return readFrom(targetFile) ?: writeTo(targetFile, defaultValue)
+ }
}
private fun readFrom(targetFile: File): List<EmojiViewItem>? {
@@ -82,6 +89,14 @@
defaultValue: () -> List<EmojiViewItem>
): List<EmojiViewItem> {
val data = defaultValue.invoke()
+ if (targetFile.exists()) {
+ if (!targetFile.delete()) {
+ Log.wtf(TAG, "Can't delete file: $targetFile");
+ }
+ }
+ if (!targetFile.createNewFile()) {
+ throw IOException("Can't create file: $targetFile")
+ }
targetFile.bufferedWriter()
.use { out ->
for (emoji in data) {
@@ -122,6 +137,7 @@
}
private const val EMOJI_PICKER_FOLDER = "emoji_picker"
+ private const val TAG = "emojipicker.FileCache";
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
@@ -142,4 +158,4 @@
/* flags= */ 0
).longVersionCode
}
-}
\ No newline at end of file
+}
diff --git a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManager.kt b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManager.kt
index 9762e78..f5a8f4a 100644
--- a/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManager.kt
+++ b/emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/utils/UnicodeRenderableManager.kt
@@ -81,4 +81,4 @@
}
private fun String.takeIfHasGlyph() = takeIf { PaintCompat.hasGlyph(paint, this) }
-}
\ No newline at end of file
+}
diff --git a/enterprise/enterprise-feedback-testing/src/main/java/androidx/enterprise/feedback/FakeKeyedAppStatesReporter.java b/enterprise/enterprise-feedback-testing/src/main/java/androidx/enterprise/feedback/FakeKeyedAppStatesReporter.java
index 9b221bd..2164e24 100644
--- a/enterprise/enterprise-feedback-testing/src/main/java/androidx/enterprise/feedback/FakeKeyedAppStatesReporter.java
+++ b/enterprise/enterprise-feedback-testing/src/main/java/androidx/enterprise/feedback/FakeKeyedAppStatesReporter.java
@@ -55,7 +55,7 @@
Collections.synchronizedMap(new HashMap<String, KeyedAppState>());
private AtomicInteger mNumberOfUploads = new AtomicInteger();
- /** @deprecated see {@link #setStates(Collection, KeyedAppStatesCallback)}. **/
+ /** @deprecated see {@link #setStates(Collection, KeyedAppStatesCallback)}. */
@Override
@Deprecated
public void setStates(@NonNull Collection<KeyedAppState> states) {
@@ -81,7 +81,7 @@
}
}
- /** @deprecated See {@link #setStatesImmediate(Collection, KeyedAppStatesCallback)}. **/
+ /** @deprecated See {@link #setStatesImmediate(Collection, KeyedAppStatesCallback)}. */
@Override
@Deprecated
public void setStatesImmediate(@NonNull Collection<KeyedAppState> states) {
diff --git a/exifinterface/exifinterface/src/androidTest/java/androidx/exifinterface/media/ExifInterfaceTest.java b/exifinterface/exifinterface/src/androidTest/java/androidx/exifinterface/media/ExifInterfaceTest.java
index 0955535..35c63ca 100644
--- a/exifinterface/exifinterface/src/androidTest/java/androidx/exifinterface/media/ExifInterfaceTest.java
+++ b/exifinterface/exifinterface/src/androidTest/java/androidx/exifinterface/media/ExifInterfaceTest.java
@@ -50,6 +50,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -579,6 +580,7 @@
@Test
@LargeTest
+ @Ignore("b/290382533")
public void testDoNotFailOnCorruptedImage() throws Throwable {
// ExifInterface shouldn't raise any exceptions except an IOException when unable to open
// a file, even with a corrupted image. Generates randomly corrupted image stream for
@@ -664,6 +666,7 @@
@Test
@SmallTest
+ @Ignore("b/290382533")
public void testSetGpsInfo() throws IOException {
final String provider = "ExifInterfaceTest";
final long timestamp = System.currentTimeMillis();
@@ -758,6 +761,7 @@
*/
@Test
@SmallTest
+ @Ignore("b/290382533")
public void testGetSetDateTime() throws IOException {
final long expectedGetDatetimeValue =
1454027547000L /* TAG_DATETIME value ("2016:01:29 18:32:27") converted to msec */
diff --git a/fragment/fragment-ktx/src/androidTest/java/androidx/fragment/app/FragmentViewModelLazyTest.kt b/fragment/fragment-ktx/src/androidTest/java/androidx/fragment/app/FragmentViewModelLazyTest.kt
index 504a5af..8803f35 100644
--- a/fragment/fragment-ktx/src/androidTest/java/androidx/fragment/app/FragmentViewModelLazyTest.kt
+++ b/fragment/fragment-ktx/src/androidTest/java/androidx/fragment/app/FragmentViewModelLazyTest.kt
@@ -137,4 +137,4 @@
} as T
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt
index 6bd7c95..309123e 100644
--- a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt
+++ b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt
@@ -77,4 +77,4 @@
} else {
node
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/EmptyFragmentActivity.kt b/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/EmptyFragmentActivity.kt
index c1d6c7b..1a60987 100644
--- a/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/EmptyFragmentActivity.kt
+++ b/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/EmptyFragmentActivity.kt
@@ -53,4 +53,4 @@
const val THEME_EXTRAS_BUNDLE_KEY = "androidx.fragment.app.testing.FragmentScenario" +
".EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY"
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/FragmentFactoryHolderViewModel.kt b/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/FragmentFactoryHolderViewModel.kt
index 00840ca..3e6e67d 100644
--- a/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/FragmentFactoryHolderViewModel.kt
+++ b/fragment/fragment-testing-manifest/src/main/java/androidx/fragment/app/testing/FragmentFactoryHolderViewModel.kt
@@ -52,4 +52,4 @@
return viewModel
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
index d986e5e..89ec018 100644
--- a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
+++ b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
@@ -278,4 +278,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/OptionsMenuFragment.kt b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/OptionsMenuFragment.kt
index 4ab5079..e4fe305 100644
--- a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/OptionsMenuFragment.kt
+++ b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/OptionsMenuFragment.kt
@@ -36,4 +36,4 @@
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.example_menu, menu)
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/ThemedFragment.kt b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/ThemedFragment.kt
index 40dda59..63eea80 100644
--- a/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/ThemedFragment.kt
+++ b/fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/ThemedFragment.kt
@@ -33,4 +33,4 @@
attrs.recycle()
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/ControllerHostCallbacks.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/ControllerHostCallbacks.kt
index f4ba719b..93c0389 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/ControllerHostCallbacks.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/ControllerHostCallbacks.kt
@@ -154,4 +154,4 @@
val w = activity.window
return w?.peekDecorView() != null
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/EpicenterTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/EpicenterTest.kt
index cc28826..c6b0840 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/EpicenterTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/EpicenterTest.kt
@@ -119,4 +119,4 @@
}
return view
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt
index be9369c..4cdf138 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatedContainerTest.kt
@@ -112,4 +112,4 @@
onDetachLatch.countDown()
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
index 7874c18..65b14e8 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentContainerViewTest.kt
@@ -800,4 +800,4 @@
drawnFirstCountDownLatch.countDown()
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt
index 74c143b..de41c38 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentFocusTest.kt
@@ -179,4 +179,4 @@
return animator
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTransitionAnimTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTransitionAnimTest.kt
index ed669b4..4e287f7 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTransitionAnimTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentTransitionAnimTest.kt
@@ -355,4 +355,4 @@
private const val TIMEOUT = 1000L
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewLifecycleOwnerTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewLifecycleOwnerTest.kt
index 6a83cf8..ecdf555 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewLifecycleOwnerTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentViewLifecycleOwnerTest.kt
@@ -185,4 +185,4 @@
public class FragmentWithFactoryOverride : StrictViewFragment() {
public override val defaultViewModelProviderFactory = FakeViewModelProviderFactory()
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
index 370fad4..846297a 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/OnBackStackChangedListenerTest.kt
@@ -498,7 +498,11 @@
executePendingTransactions()
}
- assertThat(startedCount).isEqualTo(1)
+ if (FragmentManager.USE_PREDICTIVE_BACK) {
+ assertThat(startedCount).isEqualTo(1)
+ } else {
+ assertThat(startedCount).isEqualTo(0)
+ }
assertThat(committedCount).isEqualTo(0)
withActivity {
@@ -560,17 +564,25 @@
executePendingTransactions()
}
- assertThat(startedCount).isEqualTo(1)
+ if (FragmentManager.USE_PREDICTIVE_BACK) {
+ assertThat(startedCount).isEqualTo(1)
+ } else {
+ assertThat(startedCount).isEqualTo(0)
+ }
assertThat(committedCount).isEqualTo(0)
withActivity {
onBackPressedDispatcher.dispatchOnBackCancelled()
}
- assertThat(startedCount).isEqualTo(1)
+ if (FragmentManager.USE_PREDICTIVE_BACK) {
+ assertThat(startedCount).isEqualTo(1)
+ } else {
+ assertThat(startedCount).isEqualTo(0)
+ }
assertThat(committedCount).isEqualTo(0)
assertThat(fragment2).isSameInstanceAs(fragmentManager.findFragmentById(R.id.content))
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/OptionsMenuFragmentTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/OptionsMenuFragmentTest.kt
index eb41633..276a004 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/OptionsMenuFragmentTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/OptionsMenuFragmentTest.kt
@@ -652,4 +652,4 @@
inflater.inflate(R.menu.example_menu, menu)
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveStateFragmentTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveStateFragmentTest.kt
index f9bcff3..ec14484 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveStateFragmentTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveStateFragmentTest.kt
@@ -736,4 +736,4 @@
}
class SaveViewStateFragment : StrictViewFragment(R.layout.with_edit_text)
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/TargetFragmentLifeCycleTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/TargetFragmentLifeCycleTest.kt
index 15e5a3c..79a6ecc 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/TargetFragmentLifeCycleTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/TargetFragmentLifeCycleTest.kt
@@ -427,4 +427,4 @@
.that(target.calledCreate).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/StateSaveFragment.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/StateSaveFragment.kt
index 1edd340..f1ff6af 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/StateSaveFragment.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/StateSaveFragment.kt
@@ -49,4 +49,4 @@
companion object {
private const val STATE_KEY = "state"
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
index b63f54d..a3872a4 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
@@ -106,4 +106,4 @@
const val FRAGMENT_TAG_2 = "f2"
const val FRAGMENT_TAG_BACK_STACK = "back_stack"
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt b/fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
index b8b80b9..a22ff32 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
@@ -139,32 +139,32 @@
startedAnyTransition: Boolean,
startedTransitions: Map<Operation, Boolean>
) {
- val context = container.context
val animationsToRun = mutableListOf<AnimationInfo>()
-
- // First run Animators
var startedAnyAnimator = false
- for (animationInfo: AnimationInfo in animationInfos) {
- if (animationInfo.isVisibilityUnchanged) {
+ // Find all Animators and add the effect to the operation
+ for (animatorInfo: AnimationInfo in animationInfos) {
+ val context = container.context
+ if (animatorInfo.isVisibilityUnchanged) {
// No change in visibility, so we can immediately complete the animation
- animationInfo.completeSpecialEffect()
+ animatorInfo.completeSpecialEffect()
continue
}
- val anim = animationInfo.getAnimation(context)
+ val anim = animatorInfo.getAnimation(context)
if (anim == null) {
// No Animator or Animation, so we can immediately complete the animation
- animationInfo.completeSpecialEffect()
+ animatorInfo.completeSpecialEffect()
continue
}
val animator = anim.animator
+ val operation: Operation = animatorInfo.operation
if (animator == null) {
// We must have an Animation to run. Save those for a second pass
- animationsToRun.add(animationInfo)
+ animationsToRun.add(animatorInfo)
continue
}
// First make sure we haven't already started a Transition for this Operation
- val operation: Operation = animationInfo.operation
+
val fragment = operation.fragment
val startedTransition = startedTransitions[operation] == true
if (startedTransition) {
@@ -173,11 +173,9 @@
"Ignoring Animator set on $fragment as this Fragment was involved " +
"in a Transition.")
}
- animationInfo.completeSpecialEffect()
+ animatorInfo.completeSpecialEffect()
continue
}
-
- // Okay, let's run the Animator!
startedAnyAnimator = true
val isHideOperation = operation.finalState === Operation.State.GONE
if (isHideOperation) {
@@ -186,92 +184,11 @@
// when the Animator ends.
awaitingContainerChanges.remove(operation)
}
- val viewToAnimate = fragment.mView
- container.startViewTransition(viewToAnimate)
- animator.addListener(object : AnimatorListenerAdapter() {
- override fun onAnimationEnd(anim: Animator) {
- container.endViewTransition(viewToAnimate)
- if (isHideOperation) {
- // Specifically for hide operations with Animator, we can't
- // applyState until the Animator finishes
- operation.finalState.applyState(viewToAnimate)
- }
- animationInfo.completeSpecialEffect()
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animator from operation $operation has ended.")
- }
- }
- })
- animator.setTarget(viewToAnimate)
- if (Build.VERSION.SDK_INT >= 34 && operation.fragment.mTransitioning) {
- val animatorSet = animationInfo.getAnimation(container.context)?.animator
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(
- FragmentManager.TAG,
- "Adding BackProgressCallbacks for Animators to operation $operation"
- )
- }
- operation.addBackProgressCallbacks({ backEvent ->
- if (animatorSet != null) {
- val totalDuration = Api24Impl.totalDuration(animatorSet)
- var time = (backEvent.progress * totalDuration).toLong()
- // We cannot let the time get to 0 or the totalDuration to avoid
- // completing the operation accidentally.
- if (time == 0L) {
- time = 1L
- }
- if (time == totalDuration) {
- time = totalDuration - 1
- }
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(
- FragmentManager.TAG,
- "Setting currentPlayTime to $time for Animator $animatorSet on " +
- "operation $operation"
- )
- }
- Api26Impl.setCurrentPlayTime(animatorSet, time)
- }
- }) {
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(
- FragmentManager.TAG,
- "Back Progress Callback Animator has been started."
- )
- }
- animatorSet?.start()
- }
- } else {
- animator.start()
- }
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animator from operation $operation has started.")
- }
- // Listen for cancellation and use that to cancel the Animator
- val signal: CancellationSignal = animationInfo.signal
- signal.setOnCancelListener {
- if (operation.isSeeking) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- Api26Impl.reverse(animator)
- }
- } else {
- animator.end()
- }
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(
- FragmentManager.TAG,
- "Animator from operation $operation has been canceled" +
- "${if (operation.isSeeking) " with seeking." else "."} "
- )
- }
- }
+ operation.effects.add(AnimatorEffect(animatorInfo))
}
- // Now run Animations
+ // Find all Animations and add the effect to the operation
for (animationInfo: AnimationInfo in animationsToRun) {
- // First make sure we haven't already started any Transition
val operation: Operation = animationInfo.operation
val fragment = operation.fragment
if (startedAnyTransition) {
@@ -293,64 +210,15 @@
animationInfo.completeSpecialEffect()
continue
}
+ operation.effects.add(AnimationEffect(animationInfo))
+ }
- // Okay, let's run the Animation!
- val viewToAnimate = fragment.mView
- val anim = checkNotNull(checkNotNull(animationInfo.getAnimation(context)).animation)
- val finalState = operation.finalState
- if (finalState !== Operation.State.REMOVED) {
- // If the operation does not remove the view, we can't use a
- // AnimationSet due that causing the introduction of visual artifacts (b/163084315).
- viewToAnimate.startAnimation(anim)
- // This means we can't use setAnimationListener() without overriding
- // any listener that the Fragment has set themselves, so we
- // just mark the special effect as complete immediately.
- animationInfo.completeSpecialEffect()
- } else {
- container.startViewTransition(viewToAnimate)
- val animation: Animation = FragmentAnim.EndViewTransitionAnimation(anim,
- container, viewToAnimate)
- animation.setAnimationListener(object : Animation.AnimationListener {
- override fun onAnimationStart(animation: Animation) {
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animation from operation $operation has reached " +
- "onAnimationStart.")
- }
- }
-
- override fun onAnimationEnd(animation: Animation) {
- // onAnimationEnd() comes during draw(), so there can still be some
- // draw events happening after this call. We don't want to complete the
- // animation until after the onAnimationEnd()
- container.post {
- container.endViewTransition(viewToAnimate)
- animationInfo.completeSpecialEffect()
- }
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animation from operation $operation has ended.")
- }
- }
-
- override fun onAnimationRepeat(animation: Animation) {}
- })
- viewToAnimate.startAnimation(animation)
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animation from operation $operation has started.")
- }
- }
- // Listen for cancellation and use that to cancel the Animation
- val signal: CancellationSignal = animationInfo.signal
- signal.setOnCancelListener {
- viewToAnimate.clearAnimation()
- container.endViewTransition(viewToAnimate)
- animationInfo.completeSpecialEffect()
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Animation from operation $operation has been cancelled.")
- }
+ // Run all effects
+ for (anim: AnimationInfo in animationInfos) {
+ val operation: Operation = anim.operation
+ operation.effects.forEach { effect ->
+ effect.onStart(container)
+ effect.onCommit(container)
}
}
}
@@ -363,6 +231,7 @@
lastIn: Operation?
): Map<Operation, Boolean> {
val startedTransitions = mutableMapOf<Operation, Boolean>()
+
// First verify that we can run all transitions together
val transitionImpl = transitionInfos.filterNot { transitionInfo ->
// If there is no change in visibility, we can skip the TransitionInfo
@@ -388,425 +257,16 @@
return startedTransitions
}
- // Every transition needs to target at least one View so that they
- // don't interfere with one another. This is the view we use
- // in cases where there are no real views to target
- val nonExistentView = View(container.context)
+ val transitionEffect =
+ TransitionEffect(transitionInfos, awaitingContainerChanges, isPop, firstOut,
+ lastIn, transitionImpl, startedTransitions)
- // Now find the shared element transition if it exists
- var sharedElementTransition: Any? = null
- var firstOutEpicenterView: View? = null
- var hasLastInEpicenter = false
- val lastInEpicenterRect = Rect()
- val sharedElementFirstOutViews = ArrayList<View>()
- val sharedElementLastInViews = ArrayList<View>()
- val sharedElementNameMapping = ArrayMap<String, String>()
- for (transitionInfo: TransitionInfo in transitionInfos) {
- val hasSharedElementTransition = transitionInfo.hasSharedElementTransition()
- // Compute the shared element transition between the firstOut and lastIn Fragments
- if (hasSharedElementTransition && (firstOut != null) && (lastIn != null)) {
- // swapSharedElementTargets requires wrapping this in a TransitionSet
- sharedElementTransition = transitionImpl.wrapTransitionInSet(
- transitionImpl.cloneTransition(transitionInfo.sharedElementTransition))
- // The exiting shared elements default to the source names from the
- // last in fragment
- val exitingNames = lastIn.fragment.sharedElementSourceNames
- // But if we're doing multiple transactions, we may need to re-map
- // the names from the first out fragment
- val firstOutSourceNames = firstOut.fragment.sharedElementSourceNames
- val firstOutTargetNames = firstOut.fragment.sharedElementTargetNames
- // We do this by iterating through each first out target,
- // seeing if there is a match from the last in sources
- for (index in firstOutTargetNames.indices) {
- val nameIndex = exitingNames.indexOf(firstOutTargetNames[index])
- if (nameIndex != -1) {
- // If we found a match, replace the last in source name
- // with the first out source name
- exitingNames[nameIndex] = firstOutSourceNames[index]
- }
- }
- val enteringNames = lastIn.fragment.sharedElementTargetNames
- val (exitingCallback, enteringCallback) = if (!isPop) {
- // Forward transitions have firstOut fragment exiting and the
- // lastIn fragment entering
- firstOut.fragment.exitTransitionCallback to
- lastIn.fragment.enterTransitionCallback
- } else {
- // A pop is the reverse: the firstOut fragment is entering and the
- // lastIn fragment is exiting
- firstOut.fragment.enterTransitionCallback to
- lastIn.fragment.exitTransitionCallback
- }
- val numSharedElements = exitingNames.size
- for (i in 0 until numSharedElements) {
- val exitingName = exitingNames[i]
- val enteringName = enteringNames[i]
- sharedElementNameMapping[exitingName] = enteringName
- }
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG, ">>> entering view names <<<")
- for (name: String? in enteringNames) {
- Log.v(FragmentManager.TAG, "Name: $name")
- }
- Log.v(FragmentManager.TAG, ">>> exiting view names <<<")
- for (name: String? in exitingNames) {
- Log.v(FragmentManager.TAG, "Name: $name")
- }
- }
+ transitionEffect.onStart(container)
+ transitionEffect.onCommit(container)
- // Find all of the Views from the firstOut fragment that are
- // part of the shared element transition
- val firstOutViews = ArrayMap<String, View>()
- findNamedViews(firstOutViews, firstOut.fragment.mView)
- firstOutViews.retainAll(exitingNames)
- if (exitingCallback != null) {
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Executing exit callback for operation $firstOut")
- }
- // Give the SharedElementCallback a chance to override the default mapping
- exitingCallback.onMapSharedElements(exitingNames, firstOutViews)
- for (i in exitingNames.indices.reversed()) {
- val name = exitingNames[i]
- val view = firstOutViews[name]
- if (view == null) {
- sharedElementNameMapping.remove(name)
- } else if (name != ViewCompat.getTransitionName(view)) {
- val targetValue = sharedElementNameMapping.remove(name)
- sharedElementNameMapping[ViewCompat.getTransitionName(view)] =
- targetValue
- }
- }
- } else {
- // Only keep the mapping of elements that were found in the firstOut Fragment
- sharedElementNameMapping.retainAll(firstOutViews.keys)
- }
-
- // Find all of the Views from the lastIn fragment that are
- // part of the shared element transition
- val lastInViews = ArrayMap<String, View>()
- findNamedViews(lastInViews, lastIn.fragment.mView)
- lastInViews.retainAll(enteringNames)
- lastInViews.retainAll(sharedElementNameMapping.values)
- if (enteringCallback != null) {
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Executing enter callback for operation $lastIn")
- }
- // Give the SharedElementCallback a chance to override the default mapping
- enteringCallback.onMapSharedElements(enteringNames, lastInViews)
- for (i in enteringNames.indices.reversed()) {
- val name = enteringNames[i]
- val view = lastInViews[name]
- if (view == null) {
- val key = sharedElementNameMapping.findKeyForValue(name)
- if (key != null) {
- sharedElementNameMapping.remove(key)
- }
- } else if (name != ViewCompat.getTransitionName(view)) {
- val key = sharedElementNameMapping.findKeyForValue(name)
- if (key != null) {
- sharedElementNameMapping[key] = ViewCompat.getTransitionName(view)
- }
- }
- }
- } else {
- // Only keep the mapping of elements that were found in the lastIn Fragment
- sharedElementNameMapping.retainValues(lastInViews)
- }
-
- // Now make a final pass through the Views list to ensure they
- // don't still have elements that were removed from the mapping
- firstOutViews.retainMatchingViews(sharedElementNameMapping.keys)
- lastInViews.retainMatchingViews(sharedElementNameMapping.values)
- @Suppress("UsePropertyAccessSyntax") /* Collection 1.3.X requires isEmpty() */
- if (sharedElementNameMapping.isEmpty()) {
- // We couldn't find any valid shared element mappings, so clear out
- // the shared element transition information entirely
- sharedElementTransition = null
- sharedElementFirstOutViews.clear()
- sharedElementLastInViews.clear()
- } else {
- // Call through to onSharedElementStart() before capturing the
- // starting values for the shared element transition
- callSharedElementStartEnd(lastIn.fragment, firstOut.fragment, isPop,
- firstOutViews, true)
- // Trigger the onSharedElementEnd callback in the next frame after
- // the starting values are captured and before capturing the end states
- OneShotPreDrawListener.add(container) {
- callSharedElementStartEnd(lastIn.fragment, firstOut.fragment, isPop,
- lastInViews, false)
- }
- sharedElementFirstOutViews.addAll(firstOutViews.values)
-
- // Compute the epicenter of the firstOut transition
- if (exitingNames.isNotEmpty()) {
- val epicenterViewName = exitingNames[0]
- firstOutEpicenterView = firstOutViews[epicenterViewName]
- transitionImpl.setEpicenter(sharedElementTransition, firstOutEpicenterView)
- }
- sharedElementLastInViews.addAll(lastInViews.values)
-
- // Compute the epicenter of the lastIn transition
- if (enteringNames.isNotEmpty()) {
- val epicenterViewName = enteringNames[0]
- val lastInEpicenterView = lastInViews[epicenterViewName]
- if (lastInEpicenterView != null) {
- hasLastInEpicenter = true
- // We can't set the epicenter here directly since the View might
- // not have been laid out as of yet, so instead we set a Rect as
- // the epicenter and compute the bounds one frame later
- val impl: FragmentTransitionImpl = transitionImpl
- OneShotPreDrawListener.add(container) {
- impl.getBoundsOnScreen(lastInEpicenterView, lastInEpicenterRect)
- }
- }
- }
-
- // Now set the transition's targets to only the firstOut Fragment's views
- // It'll be swapped to the lastIn Fragment's views after the
- // transition is started
- transitionImpl.setSharedElementTargets(sharedElementTransition,
- nonExistentView, sharedElementFirstOutViews)
- // After the swap to the lastIn Fragment's view (done below), we
- // need to clean up those targets. We schedule this here so that it
- // runs directly after the swap
- transitionImpl.scheduleRemoveTargets(sharedElementTransition, null, null,
- null, null, sharedElementTransition, sharedElementLastInViews)
- // Both the firstOut and lastIn Operations are now associated
- // with a Transition
- startedTransitions[firstOut] = true
- startedTransitions[lastIn] = true
- }
- }
- }
- val enteringViews = ArrayList<View>()
- // These transitions run together, overlapping one another
- var mergedTransition: Any? = null
- // These transitions run only after all of the other transitions complete
- var mergedNonOverlappingTransition: Any? = null
- // Now iterate through the set of transitions and merge them together
- for (transitionInfo: TransitionInfo in transitionInfos) {
- if (transitionInfo.isVisibilityUnchanged) {
- // No change in visibility, so we can immediately complete the transition
- startedTransitions[transitionInfo.operation] = false
- transitionInfo.completeSpecialEffect()
- continue
- }
- val transition = transitionImpl.cloneTransition(transitionInfo.transition)
- val operation: Operation = transitionInfo.operation
- val involvedInSharedElementTransition = (sharedElementTransition != null &&
- (operation === firstOut || operation === lastIn))
- if (transition == null) {
- // Nothing more to do if the transition is null
- if (!involvedInSharedElementTransition) {
- // Only complete the transition if this fragment isn't involved
- // in the shared element transition (as otherwise we need to wait
- // for that to finish)
- startedTransitions[operation] = false
- transitionInfo.completeSpecialEffect()
- }
- } else {
- // Target the Transition to *only* the set of transitioning views
- val transitioningViews = ArrayList<View>()
- captureTransitioningViews(transitioningViews, operation.fragment.mView)
- if (involvedInSharedElementTransition) {
- // Remove all of the shared element views from the transition
- if (operation === firstOut) {
- transitioningViews.removeAll(sharedElementFirstOutViews.toSet())
- } else {
- transitioningViews.removeAll(sharedElementLastInViews.toSet())
- }
- }
- if (transitioningViews.isEmpty()) {
- transitionImpl.addTarget(transition, nonExistentView)
- } else {
- transitionImpl.addTargets(transition, transitioningViews)
- transitionImpl.scheduleRemoveTargets(transition, transition,
- transitioningViews, null, null, null, null)
- if (operation.finalState === Operation.State.GONE) {
- // We're hiding the Fragment. This requires a bit of extra work
- // First, we need to avoid immediately applying the container change as
- // that will stop the Transition from occurring.
- awaitingContainerChanges.remove(operation)
- // Then schedule the actual hide of the fragment's view,
- // essentially doing what applyState() would do for us
- val transitioningViewsToHide = ArrayList(transitioningViews)
- transitioningViewsToHide.remove(operation.fragment.mView)
- transitionImpl.scheduleHideFragmentView(transition,
- operation.fragment.mView, transitioningViewsToHide)
- // This OneShotPreDrawListener gets fired before the delayed start of
- // the Transition and changes the visibility of any exiting child views
- // that *ARE NOT* shared element transitions. The TransitionManager then
- // properly considers exiting views and marks them as disappearing,
- // applying a transition and a listener to take proper actions once the
- // transition is complete.
- OneShotPreDrawListener.add(container) {
- setViewVisibility(transitioningViews, View.INVISIBLE)
- }
- }
- }
- if (operation.finalState === Operation.State.VISIBLE) {
- enteringViews.addAll(transitioningViews)
- if (hasLastInEpicenter) {
- transitionImpl.setEpicenter(transition, lastInEpicenterRect)
- }
- } else {
- transitionImpl.setEpicenter(transition, firstOutEpicenterView)
- }
- startedTransitions[operation] = true
- // Now determine how this transition should be merged together
- if (transitionInfo.isOverlapAllowed) {
- // Overlap is allowed, so add them to the mergeTransition set
- mergedTransition = transitionImpl.mergeTransitionsTogether(
- mergedTransition, transition, null)
- } else {
- // Overlap is not allowed, add them to the mergedNonOverlappingTransition
- mergedNonOverlappingTransition = transitionImpl.mergeTransitionsTogether(
- mergedNonOverlappingTransition, transition, null)
- }
- }
- }
-
- // Make sure that the mergedNonOverlappingTransition set
- // runs after the mergedTransition set is complete
- mergedTransition = transitionImpl.mergeTransitionsInSequence(mergedTransition,
- mergedNonOverlappingTransition, sharedElementTransition)
-
- // If there's no transitions playing together, no non-overlapping transitions,
- // and no shared element transitions, mergedTransition will be null and
- // there's nothing else we need to do
- if (mergedTransition == null) {
- return startedTransitions
- }
-
- // Now set up our completion signal on the completely merged transition set
- transitionInfos.filterNot { transitionInfo ->
- // If there's change in visibility, we've already completed the transition
- transitionInfo.isVisibilityUnchanged
- }.forEach { transitionInfo: TransitionInfo ->
- val transition: Any? = transitionInfo.transition
- val operation: Operation = transitionInfo.operation
- val involvedInSharedElementTransition = sharedElementTransition != null &&
- (operation === firstOut || operation === lastIn)
- if (transition != null || involvedInSharedElementTransition) {
- // If the container has never been laid out, transitions will not start so
- // so lets instantly complete them.
- if (!ViewCompat.isLaidOut(container)) {
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "SpecialEffectsController: Container $container has not been " +
- "laid out. Completing operation $operation")
- }
- transitionInfo.completeSpecialEffect()
- } else {
- transitionImpl.setListenerForTransitionEnd(
- transitionInfo.operation.fragment,
- mergedTransition,
- transitionInfo.signal,
- Runnable {
- transitionInfo.completeSpecialEffect()
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG,
- "Transition for operation $operation has completed")
- }
- })
- }
- }
- }
- // Transitions won't run if the container isn't laid out so
- // we can return early here to avoid doing unnecessary work.
- if (!ViewCompat.isLaidOut(container)) {
- return startedTransitions
- }
- // First, hide all of the entering views so they're in
- // the correct initial state
- setViewVisibility(enteringViews, View.INVISIBLE)
- val inNames = transitionImpl.prepareSetNameOverridesReordered(sharedElementLastInViews)
- if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
- Log.v(FragmentManager.TAG, ">>>>> Beginning transition <<<<<")
- Log.v(FragmentManager.TAG, ">>>>> SharedElementFirstOutViews <<<<<")
- for (view: View in sharedElementFirstOutViews) {
- Log.v(FragmentManager.TAG,
- "View: $view Name: ${ViewCompat.getTransitionName(view)}")
- }
- Log.v(FragmentManager.TAG, ">>>>> SharedElementLastInViews <<<<<")
- for (view: View in sharedElementLastInViews) {
- Log.v(FragmentManager.TAG,
- "View: $view Name: ${ViewCompat.getTransitionName(view)}")
- }
- }
- // Now actually start the transition
- transitionImpl.beginDelayedTransition(container, mergedTransition)
- transitionImpl.setNameOverridesReordered(container, sharedElementFirstOutViews,
- sharedElementLastInViews, inNames, sharedElementNameMapping)
- // Then, show all of the entering views, putting them into
- // the correct final state
- setViewVisibility(enteringViews, View.VISIBLE)
- transitionImpl.swapSharedElementTargets(sharedElementTransition,
- sharedElementFirstOutViews, sharedElementLastInViews)
return startedTransitions
}
- /**
- * Retain only the views that have a transition name that is in the set of [names].
- */
- private fun ArrayMap<String, View>.retainMatchingViews(names: Collection<String>) {
- entries.retainAll { entry ->
- names.contains(ViewCompat.getTransitionName(entry.value))
- }
- }
-
- /**
- * Gets the Views in the hierarchy affected by entering and exiting transitions.
- *
- * @param transitioningViews This View will be added to transitioningViews if it has a
- * transition name, is VISIBLE and a normal View, or a ViewGroup with
- * [android.view.ViewGroup.isTransitionGroup] true.
- * @param view The base of the view hierarchy to look in.
- */
- private fun captureTransitioningViews(transitioningViews: ArrayList<View>, view: View) {
- if (view is ViewGroup) {
- if (ViewGroupCompat.isTransitionGroup(view)) {
- if (!transitioningViews.contains(view)) {
- transitioningViews.add(view)
- }
- } else {
- val count = view.childCount
- for (i in 0 until count) {
- val child = view.getChildAt(i)
- if (child.visibility == View.VISIBLE) {
- captureTransitioningViews(transitioningViews, child)
- }
- }
- }
- } else {
- if (!transitioningViews.contains(view)) {
- transitioningViews.add(view)
- }
- }
- }
-
- /**
- * Finds all views that have transition names in the hierarchy under the given view and
- * stores them in [namedViews] map with the name as the key.
- */
- private fun findNamedViews(namedViews: MutableMap<String, View>, view: View) {
- val transitionName = ViewCompat.getTransitionName(view)
- if (transitionName != null) {
- namedViews[transitionName] = view
- }
- if (view is ViewGroup) {
- val count = view.childCount
- for (i in 0 until count) {
- val child = view.getChildAt(i)
- if (child.visibility == View.VISIBLE) {
- findNamedViews(namedViews, child)
- }
- }
- }
- }
-
private fun applyContainerChanges(operation: Operation) {
val view = operation.fragment.mView
operation.finalState.applyState(view)
@@ -930,6 +390,609 @@
}
}
+ private class AnimationEffect(val animationInfo: AnimationInfo) : Effect() {
+ override fun onCommit(container: ViewGroup) {
+ val context = container.context
+ val operation: Operation = animationInfo.operation
+ val fragment = operation.fragment
+
+ // Okay, let's run the Animation!
+ val viewToAnimate = fragment.mView
+ val anim = checkNotNull(checkNotNull(animationInfo.getAnimation(context)).animation)
+ val finalState = operation.finalState
+ if (finalState !== Operation.State.REMOVED) {
+ // If the operation does not remove the view, we can't use a
+ // AnimationSet due that causing the introduction of visual artifacts (b/163084315).
+ viewToAnimate.startAnimation(anim)
+ // This means we can't use setAnimationListener() without overriding
+ // any listener that the Fragment has set themselves, so we
+ // just mark the special effect as complete immediately.
+ animationInfo.completeSpecialEffect()
+ } else {
+ container.startViewTransition(viewToAnimate)
+ val animation: Animation = FragmentAnim.EndViewTransitionAnimation(anim,
+ container, viewToAnimate)
+ animation.setAnimationListener(object : Animation.AnimationListener {
+ override fun onAnimationStart(animation: Animation) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animation from operation $operation has reached " +
+ "onAnimationStart.")
+ }
+ }
+
+ override fun onAnimationEnd(animation: Animation) {
+ // onAnimationEnd() comes during draw(), so there can still be some
+ // draw events happening after this call. We don't want to complete the
+ // animation until after the onAnimationEnd()
+ container.post {
+ container.endViewTransition(viewToAnimate)
+ animationInfo.completeSpecialEffect()
+ }
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animation from operation $operation has ended.")
+ }
+ }
+
+ override fun onAnimationRepeat(animation: Animation) {}
+ })
+ viewToAnimate.startAnimation(animation)
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animation from operation $operation has started.")
+ }
+ }
+ // Listen for cancellation and use that to cancel the Animation
+ val signal: CancellationSignal = animationInfo.signal
+ signal.setOnCancelListener {
+ viewToAnimate.clearAnimation()
+ container.endViewTransition(viewToAnimate)
+ animationInfo.completeSpecialEffect()
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animation from operation $operation has been cancelled.")
+ }
+ }
+ }
+ }
+
+ private class AnimatorEffect(val animatorInfo: AnimationInfo) : Effect() {
+ override fun onStart(container: ViewGroup) {
+ val context = container.context
+ val animator = animatorInfo.getAnimation(context)?.animator
+ val operation: Operation = animatorInfo.operation
+ val fragment = operation.fragment
+
+ // Okay, let's run the Animator!
+ val isHideOperation = operation.finalState === Operation.State.GONE
+ val viewToAnimate = fragment.mView
+ container.startViewTransition(viewToAnimate)
+ animator?.addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(anim: Animator) {
+ container.endViewTransition(viewToAnimate)
+ if (isHideOperation) {
+ // Specifically for hide operations with Animator, we can't
+ // applyState until the Animator finishes
+ operation.finalState.applyState(viewToAnimate)
+ }
+ animatorInfo.completeSpecialEffect()
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animator from operation $operation has ended.")
+ }
+ }
+ })
+ animator?.setTarget(viewToAnimate)
+ // Listen for cancellation and use that to cancel the Animation
+ animatorInfo.signal.setOnCancelListener {
+ onCancel(container)
+ }
+ }
+
+ override fun onCommit(container: ViewGroup) {
+ val operation = animatorInfo.operation
+ val animatorSet = animatorInfo.getAnimation(container.context)?.animator
+ if (animatorSet != null &&
+ Build.VERSION.SDK_INT >= 34 && operation.fragment.mTransitioning
+ ) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(
+ FragmentManager.TAG,
+ "Adding BackProgressCallbacks for Animators to operation $operation"
+ )
+ }
+ operation.addBackProgressCallbacks({ backEvent ->
+ val totalDuration = Api24Impl.totalDuration(animatorSet)
+ var time = (backEvent.progress * totalDuration).toLong()
+ // We cannot let the time get to 0 or the totalDuration to avoid
+ // completing the operation accidentally.
+ if (time == 0L) {
+ time = 1L
+ }
+ if (time == totalDuration) {
+ time = totalDuration - 1
+ }
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(
+ FragmentManager.TAG,
+ "Setting currentPlayTime to $time for Animator $animatorSet on " +
+ "operation $operation"
+ )
+ }
+ Api26Impl.setCurrentPlayTime(animatorSet, time)
+ }) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(
+ FragmentManager.TAG,
+ "Back Progress Callback Animator has been started."
+ )
+ }
+ animatorSet.start()
+ }
+ } else {
+ animatorSet?.start()
+ }
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Animator from operation $operation has started.")
+ }
+ }
+
+ override fun onCancel(container: ViewGroup) {
+ val animator = animatorInfo.getAnimation(container.context)?.animator
+ if (animator != null) {
+ val operation = animatorInfo.operation
+ if (operation.isSeeking) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ Api26Impl.reverse(animator)
+ }
+ } else {
+ animator.end()
+ }
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(
+ FragmentManager.TAG,
+ "Animator from operation $operation has been canceled" +
+ "${if (operation.isSeeking) " with seeking." else "."} "
+ )
+ }
+ }
+ }
+ }
+
+ private class TransitionEffect(
+ val transitionInfos: List<TransitionInfo>,
+ val awaitingContainerChanges: MutableList<Operation>,
+ val isPop: Boolean,
+ val firstOut: Operation?,
+ val lastIn: Operation?,
+ val transitionImpl: FragmentTransitionImpl,
+ val startedTransitions: MutableMap<Operation, Boolean>
+ ) : Effect() {
+ override fun onCommit(container: ViewGroup) {
+ // Every transition needs to target at least one View so that they
+ // don't interfere with one another. This is the view we use
+ // in cases where there are no real views to target
+ val nonExistentView = View(container.context)
+
+ // Now find the shared element transition if it exists
+ var sharedElementTransition: Any? = null
+ var firstOutEpicenterView: View? = null
+ var hasLastInEpicenter = false
+ val lastInEpicenterRect = Rect()
+ val sharedElementFirstOutViews = ArrayList<View>()
+ val sharedElementLastInViews = ArrayList<View>()
+ val sharedElementNameMapping = ArrayMap<String, String>()
+ for (transitionInfo: TransitionInfo in transitionInfos) {
+ val hasSharedElementTransition = transitionInfo.hasSharedElementTransition()
+ // Compute the shared element transition between the firstOut and lastIn Fragments
+ if (hasSharedElementTransition && (firstOut != null) && (lastIn != null)) {
+ // swapSharedElementTargets requires wrapping this in a TransitionSet
+ sharedElementTransition = transitionImpl.wrapTransitionInSet(
+ transitionImpl.cloneTransition(transitionInfo.sharedElementTransition))
+ // The exiting shared elements default to the source names from the
+ // last in fragment
+ val exitingNames = lastIn.fragment.sharedElementSourceNames
+ // But if we're doing multiple transactions, we may need to re-map
+ // the names from the first out fragment
+ val firstOutSourceNames = firstOut.fragment.sharedElementSourceNames
+ val firstOutTargetNames = firstOut.fragment.sharedElementTargetNames
+ // We do this by iterating through each first out target,
+ // seeing if there is a match from the last in sources
+ for (index in firstOutTargetNames.indices) {
+ val nameIndex = exitingNames.indexOf(firstOutTargetNames[index])
+ if (nameIndex != -1) {
+ // If we found a match, replace the last in source name
+ // with the first out source name
+ exitingNames[nameIndex] = firstOutSourceNames[index]
+ }
+ }
+ val enteringNames = lastIn.fragment.sharedElementTargetNames
+ val (exitingCallback, enteringCallback) = if (!isPop) {
+ // Forward transitions have firstOut fragment exiting and the
+ // lastIn fragment entering
+ firstOut.fragment.exitTransitionCallback to
+ lastIn.fragment.enterTransitionCallback
+ } else {
+ // A pop is the reverse: the firstOut fragment is entering and the
+ // lastIn fragment is exiting
+ firstOut.fragment.enterTransitionCallback to
+ lastIn.fragment.exitTransitionCallback
+ }
+ val numSharedElements = exitingNames.size
+ for (i in 0 until numSharedElements) {
+ val exitingName = exitingNames[i]
+ val enteringName = enteringNames[i]
+ sharedElementNameMapping[exitingName] = enteringName
+ }
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG, ">>> entering view names <<<")
+ for (name: String? in enteringNames) {
+ Log.v(FragmentManager.TAG, "Name: $name")
+ }
+ Log.v(FragmentManager.TAG, ">>> exiting view names <<<")
+ for (name: String? in exitingNames) {
+ Log.v(FragmentManager.TAG, "Name: $name")
+ }
+ }
+
+ // Find all of the Views from the firstOut fragment that are
+ // part of the shared element transition
+ val firstOutViews = ArrayMap<String, View>()
+ findNamedViews(firstOutViews, firstOut.fragment.mView)
+ firstOutViews.retainAll(exitingNames)
+ if (exitingCallback != null) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Executing exit callback for operation $firstOut")
+ }
+ // Give the SharedElementCallback a chance to override the default mapping
+ exitingCallback.onMapSharedElements(exitingNames, firstOutViews)
+ for (i in exitingNames.indices.reversed()) {
+ val name = exitingNames[i]
+ val view = firstOutViews[name]
+ if (view == null) {
+ sharedElementNameMapping.remove(name)
+ } else if (name != ViewCompat.getTransitionName(view)) {
+ val targetValue = sharedElementNameMapping.remove(name)
+ sharedElementNameMapping[ViewCompat.getTransitionName(view)] =
+ targetValue
+ }
+ }
+ } else {
+ // Only keep the mapping of elements that were found in the firstOut Fragment
+ sharedElementNameMapping.retainAll(firstOutViews.keys)
+ }
+
+ // Find all of the Views from the lastIn fragment that are
+ // part of the shared element transition
+ val lastInViews = ArrayMap<String, View>()
+ findNamedViews(lastInViews, lastIn.fragment.mView)
+ lastInViews.retainAll(enteringNames)
+ lastInViews.retainAll(sharedElementNameMapping.values)
+ if (enteringCallback != null) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Executing enter callback for operation $lastIn")
+ }
+ // Give the SharedElementCallback a chance to override the default mapping
+ enteringCallback.onMapSharedElements(enteringNames, lastInViews)
+ for (i in enteringNames.indices.reversed()) {
+ val name = enteringNames[i]
+ val view = lastInViews[name]
+ if (view == null) {
+ val key = sharedElementNameMapping.findKeyForValue(name)
+ if (key != null) {
+ sharedElementNameMapping.remove(key)
+ }
+ } else if (name != ViewCompat.getTransitionName(view)) {
+ val key = sharedElementNameMapping.findKeyForValue(name)
+ if (key != null) {
+ sharedElementNameMapping[key] =
+ ViewCompat.getTransitionName(view)
+ }
+ }
+ }
+ } else {
+ // Only keep the mapping of elements that were found in the lastIn Fragment
+ sharedElementNameMapping.retainValues(lastInViews)
+ }
+
+ // Now make a final pass through the Views list to ensure they
+ // don't still have elements that were removed from the mapping
+ firstOutViews.retainMatchingViews(sharedElementNameMapping.keys)
+ lastInViews.retainMatchingViews(sharedElementNameMapping.values)
+ @Suppress("UsePropertyAccessSyntax") /* Collection 1.3.X requires isEmpty() */
+ if (sharedElementNameMapping.isEmpty()) {
+ // We couldn't find any valid shared element mappings, so clear out
+ // the shared element transition information entirely
+ sharedElementTransition = null
+ sharedElementFirstOutViews.clear()
+ sharedElementLastInViews.clear()
+ } else {
+ // Call through to onSharedElementStart() before capturing the
+ // starting values for the shared element transition
+ callSharedElementStartEnd(lastIn.fragment, firstOut.fragment, isPop,
+ firstOutViews, true)
+ // Trigger the onSharedElementEnd callback in the next frame after
+ // the starting values are captured and before capturing the end states
+ OneShotPreDrawListener.add(container) {
+ callSharedElementStartEnd(lastIn.fragment, firstOut.fragment, isPop,
+ lastInViews, false)
+ }
+ sharedElementFirstOutViews.addAll(firstOutViews.values)
+
+ // Compute the epicenter of the firstOut transition
+ if (exitingNames.isNotEmpty()) {
+ val epicenterViewName = exitingNames[0]
+ firstOutEpicenterView = firstOutViews[epicenterViewName]
+ transitionImpl.setEpicenter(
+ sharedElementTransition, firstOutEpicenterView
+ )
+ }
+ sharedElementLastInViews.addAll(lastInViews.values)
+
+ // Compute the epicenter of the lastIn transition
+ if (enteringNames.isNotEmpty()) {
+ val epicenterViewName = enteringNames[0]
+ val lastInEpicenterView = lastInViews[epicenterViewName]
+ if (lastInEpicenterView != null) {
+ hasLastInEpicenter = true
+ // We can't set the epicenter here directly since the View might
+ // not have been laid out as of yet, so instead we set a Rect as
+ // the epicenter and compute the bounds one frame later
+ val impl: FragmentTransitionImpl = transitionImpl
+ OneShotPreDrawListener.add(container) {
+ impl.getBoundsOnScreen(lastInEpicenterView, lastInEpicenterRect)
+ }
+ }
+ }
+
+ // Now set the transition's targets to only the firstOut Fragment's views
+ // It'll be swapped to the lastIn Fragment's views after the
+ // transition is started
+ transitionImpl.setSharedElementTargets(sharedElementTransition,
+ nonExistentView, sharedElementFirstOutViews)
+ // After the swap to the lastIn Fragment's view (done below), we
+ // need to clean up those targets. We schedule this here so that it
+ // runs directly after the swap
+ transitionImpl.scheduleRemoveTargets(sharedElementTransition, null, null,
+ null, null, sharedElementTransition, sharedElementLastInViews)
+ // Both the firstOut and lastIn Operations are now associated
+ // with a Transition
+ startedTransitions[firstOut] = true
+ startedTransitions[lastIn] = true
+ }
+ }
+ }
+ val enteringViews = ArrayList<View>()
+ // These transitions run together, overlapping one another
+ var mergedTransition: Any? = null
+ // These transitions run only after all of the other transitions complete
+ var mergedNonOverlappingTransition: Any? = null
+ // Now iterate through the set of transitions and merge them together
+ for (transitionInfo: TransitionInfo in transitionInfos) {
+ if (transitionInfo.isVisibilityUnchanged) {
+ // No change in visibility, so we can immediately complete the transition
+ startedTransitions[transitionInfo.operation] = false
+ transitionInfo.completeSpecialEffect()
+ continue
+ }
+ val transition = transitionImpl.cloneTransition(transitionInfo.transition)
+ val operation: Operation = transitionInfo.operation
+ val involvedInSharedElementTransition = (sharedElementTransition != null &&
+ (operation === firstOut || operation === lastIn))
+ if (transition == null) {
+ // Nothing more to do if the transition is null
+ if (!involvedInSharedElementTransition) {
+ // Only complete the transition if this fragment isn't involved
+ // in the shared element transition (as otherwise we need to wait
+ // for that to finish)
+ startedTransitions[operation] = false
+ transitionInfo.completeSpecialEffect()
+ }
+ } else {
+ // Target the Transition to *only* the set of transitioning views
+ val transitioningViews = ArrayList<View>()
+ captureTransitioningViews(transitioningViews, operation.fragment.mView)
+ if (involvedInSharedElementTransition) {
+ // Remove all of the shared element views from the transition
+ if (operation === firstOut) {
+ transitioningViews.removeAll(sharedElementFirstOutViews.toSet())
+ } else {
+ transitioningViews.removeAll(sharedElementLastInViews.toSet())
+ }
+ }
+ if (transitioningViews.isEmpty()) {
+ transitionImpl.addTarget(transition, nonExistentView)
+ } else {
+ transitionImpl.addTargets(transition, transitioningViews)
+ transitionImpl.scheduleRemoveTargets(transition, transition,
+ transitioningViews, null, null, null, null)
+ if (operation.finalState === Operation.State.GONE) {
+ // We're hiding the Fragment. This requires a bit of extra work
+ // First, we need to avoid immediately applying the container change as
+ // that will stop the Transition from occurring.
+ awaitingContainerChanges.remove(operation)
+ // Then schedule the actual hide of the fragment's view,
+ // essentially doing what applyState() would do for us
+ val transitioningViewsToHide = ArrayList(transitioningViews)
+ transitioningViewsToHide.remove(operation.fragment.mView)
+ transitionImpl.scheduleHideFragmentView(transition,
+ operation.fragment.mView, transitioningViewsToHide)
+ // This OneShotPreDrawListener gets fired before the delayed start of
+ // the Transition and changes the visibility of any exiting child views
+ // that *ARE NOT* shared element transitions. The TransitionManager then
+ // properly considers exiting views and marks them as disappearing,
+ // applying a transition and a listener to take proper actions once the
+ // transition is complete.
+ OneShotPreDrawListener.add(container) {
+ setViewVisibility(transitioningViews, View.INVISIBLE)
+ }
+ }
+ }
+ if (operation.finalState === Operation.State.VISIBLE) {
+ enteringViews.addAll(transitioningViews)
+ if (hasLastInEpicenter) {
+ transitionImpl.setEpicenter(transition, lastInEpicenterRect)
+ }
+ } else {
+ transitionImpl.setEpicenter(transition, firstOutEpicenterView)
+ }
+ startedTransitions[operation] = true
+ // Now determine how this transition should be merged together
+ if (transitionInfo.isOverlapAllowed) {
+ // Overlap is allowed, so add them to the mergeTransition set
+ mergedTransition = transitionImpl.mergeTransitionsTogether(
+ mergedTransition, transition, null)
+ } else {
+ // Overlap is not allowed, add them to the mergedNonOverlappingTransition
+ mergedNonOverlappingTransition = transitionImpl.mergeTransitionsTogether(
+ mergedNonOverlappingTransition, transition, null)
+ }
+ }
+ }
+
+ // Make sure that the mergedNonOverlappingTransition set
+ // runs after the mergedTransition set is complete
+ mergedTransition = transitionImpl.mergeTransitionsInSequence(mergedTransition,
+ mergedNonOverlappingTransition, sharedElementTransition)
+
+ // If there's no transitions playing together, no non-overlapping transitions,
+ // and no shared element transitions, mergedTransition will be null and
+ // there's nothing else we need to do
+ if (mergedTransition == null) {
+ return
+ }
+
+ // Now set up our completion signal on the completely merged transition set
+ transitionInfos.filterNot { transitionInfo ->
+ // If there's change in visibility, we've already completed the transition
+ transitionInfo.isVisibilityUnchanged
+ }.forEach { transitionInfo: TransitionInfo ->
+ val transition: Any? = transitionInfo.transition
+ val operation: Operation = transitionInfo.operation
+ val involvedInSharedElementTransition = sharedElementTransition != null &&
+ (operation === firstOut || operation === lastIn)
+ if (transition != null || involvedInSharedElementTransition) {
+ // If the container has never been laid out, transitions will not start so
+ // so lets instantly complete them.
+ if (!ViewCompat.isLaidOut(container)) {
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "SpecialEffectsController: Container $container has not been " +
+ "laid out. Completing operation $operation")
+ }
+ transitionInfo.completeSpecialEffect()
+ } else {
+ transitionImpl.setListenerForTransitionEnd(
+ transitionInfo.operation.fragment,
+ mergedTransition,
+ transitionInfo.signal,
+ Runnable {
+ transitionInfo.completeSpecialEffect()
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG,
+ "Transition for operation $operation has completed")
+ }
+ })
+ }
+ }
+ }
+ // Transitions won't run if the container isn't laid out so
+ // we can return early here to avoid doing unnecessary work.
+ if (!ViewCompat.isLaidOut(container)) {
+ return
+ }
+ // First, hide all of the entering views so they're in
+ // the correct initial state
+ setViewVisibility(enteringViews, View.INVISIBLE)
+ val inNames = transitionImpl.prepareSetNameOverridesReordered(sharedElementLastInViews)
+ if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) {
+ Log.v(FragmentManager.TAG, ">>>>> Beginning transition <<<<<")
+ Log.v(FragmentManager.TAG, ">>>>> SharedElementFirstOutViews <<<<<")
+ for (view: View in sharedElementFirstOutViews) {
+ Log.v(FragmentManager.TAG,
+ "View: $view Name: ${ViewCompat.getTransitionName(view)}")
+ }
+ Log.v(FragmentManager.TAG, ">>>>> SharedElementLastInViews <<<<<")
+ for (view: View in sharedElementLastInViews) {
+ Log.v(FragmentManager.TAG,
+ "View: $view Name: ${ViewCompat.getTransitionName(view)}")
+ }
+ }
+ // Now actually start the transition
+ transitionImpl.beginDelayedTransition(container, mergedTransition)
+ transitionImpl.setNameOverridesReordered(container, sharedElementFirstOutViews,
+ sharedElementLastInViews, inNames, sharedElementNameMapping)
+ // Then, show all of the entering views, putting them into
+ // the correct final state
+ setViewVisibility(enteringViews, View.VISIBLE)
+ transitionImpl.swapSharedElementTargets(sharedElementTransition,
+ sharedElementFirstOutViews, sharedElementLastInViews)
+ }
+
+ /**
+ * Retain only the views that have a transition name that is in the set of [names].
+ */
+ private fun ArrayMap<String, View>.retainMatchingViews(names: Collection<String>) {
+ entries.retainAll { entry ->
+ names.contains(ViewCompat.getTransitionName(entry.value))
+ }
+ }
+
+ /**
+ * Gets the Views in the hierarchy affected by entering and exiting transitions.
+ *
+ * @param transitioningViews This View will be added to transitioningViews if it has a
+ * transition name, is VISIBLE and a normal View, or a ViewGroup with
+ * [android.view.ViewGroup.isTransitionGroup] true.
+ * @param view The base of the view hierarchy to look in.
+ */
+ private fun captureTransitioningViews(transitioningViews: ArrayList<View>, view: View) {
+ if (view is ViewGroup) {
+ if (ViewGroupCompat.isTransitionGroup(view)) {
+ if (!transitioningViews.contains(view)) {
+ transitioningViews.add(view)
+ }
+ } else {
+ val count = view.childCount
+ for (i in 0 until count) {
+ val child = view.getChildAt(i)
+ if (child.visibility == View.VISIBLE) {
+ captureTransitioningViews(transitioningViews, child)
+ }
+ }
+ }
+ } else {
+ if (!transitioningViews.contains(view)) {
+ transitioningViews.add(view)
+ }
+ }
+ }
+
+ /**
+ * Finds all views that have transition names in the hierarchy under the given view and
+ * stores them in [namedViews] map with the name as the key.
+ */
+ private fun findNamedViews(namedViews: MutableMap<String, View>, view: View) {
+ val transitionName = ViewCompat.getTransitionName(view)
+ if (transitionName != null) {
+ namedViews[transitionName] = view
+ }
+ if (view is ViewGroup) {
+ val count = view.childCount
+ for (i in 0 until count) {
+ val child = view.getChildAt(i)
+ if (child.visibility == View.VISIBLE) {
+ findNamedViews(namedViews, child)
+ }
+ }
+ }
+ }
+ }
+
@RequiresApi(24)
internal object Api24Impl {
@DoNotInline
@@ -950,4 +1013,4 @@
animatorSet.currentPlayTime = time
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransition.kt b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransition.kt
index 399643a..db51e04 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransition.kt
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransition.kt
@@ -119,4 +119,4 @@
fun supportsTransition(): Boolean {
return PLATFORM_IMPL != null || SUPPORT_IMPL != null
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/PredictiveBackControl.kt b/fragment/fragment/src/main/java/androidx/fragment/app/PredictiveBackControl.kt
index 81a1209..bbe9477 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/PredictiveBackControl.kt
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/PredictiveBackControl.kt
@@ -21,4 +21,4 @@
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
-annotation class PredictiveBackControl
\ No newline at end of file
+annotation class PredictiveBackControl
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt b/fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
index 9534df8..ac472f0 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
@@ -530,6 +530,8 @@
var isStarted = false
private set
+ val effects = mutableListOf<Effect>()
+
init {
// Connect the CancellationSignal to our own
cancellationSignal.setOnCancelListener { cancel() }
@@ -748,6 +750,14 @@
}
}
+ internal open class Effect {
+ open fun onStart(container: ViewGroup) { }
+
+ open fun onCommit(container: ViewGroup) { }
+
+ open fun onCancel(container: ViewGroup) { }
+ }
+
companion object {
/**
* Get the [SpecialEffectsController] for a given container if it already exists
@@ -790,4 +800,4 @@
return newController
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/main/java/androidx/fragment/app/strictmode/TargetFragmentUsageViolation.kt b/fragment/fragment/src/main/java/androidx/fragment/app/strictmode/TargetFragmentUsageViolation.kt
index a5d1d4e..9e8ea3e 100644
--- a/fragment/fragment/src/main/java/androidx/fragment/app/strictmode/TargetFragmentUsageViolation.kt
+++ b/fragment/fragment/src/main/java/androidx/fragment/app/strictmode/TargetFragmentUsageViolation.kt
@@ -23,4 +23,4 @@
abstract class TargetFragmentUsageViolation internal constructor(
fragment: Fragment,
message: String? = null
-) : Violation(fragment, message)
\ No newline at end of file
+) : Violation(fragment, message)
diff --git a/fragment/fragment/src/test/java/androidx/fragment/app/FragmentPagerActivity.kt b/fragment/fragment/src/test/java/androidx/fragment/app/FragmentPagerActivity.kt
index 06e5b8f..d6edee8 100644
--- a/fragment/fragment/src/test/java/androidx/fragment/app/FragmentPagerActivity.kt
+++ b/fragment/fragment/src/test/java/androidx/fragment/app/FragmentPagerActivity.kt
@@ -79,4 +79,4 @@
return ViewFragment()
}
}
-}
\ No newline at end of file
+}
diff --git a/fragment/fragment/src/test/java/androidx/fragment/app/FragmentRoboAnimTest.kt b/fragment/fragment/src/test/java/androidx/fragment/app/FragmentRoboAnimTest.kt
index 8813665..641312d 100644
--- a/fragment/fragment/src/test/java/androidx/fragment/app/FragmentRoboAnimTest.kt
+++ b/fragment/fragment/src/test/java/androidx/fragment/app/FragmentRoboAnimTest.kt
@@ -78,4 +78,4 @@
}
return null
}
-}
\ No newline at end of file
+}
diff --git a/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/basicAnimators/BasicFragmentAnimatorFragment.kt b/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/basicAnimators/BasicFragmentAnimatorFragment.kt
index 10cfa82..cf2e8ef 100644
--- a/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/basicAnimators/BasicFragmentAnimatorFragment.kt
+++ b/fragment/integration-tests/testapp/src/main/java/androidx/fragment/testapp/basicAnimators/BasicFragmentAnimatorFragment.kt
@@ -92,4 +92,4 @@
view.setBackgroundColor(myarg)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetPreviews.kt b/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetPreviews.kt
index de68697..1e997e2 100644
--- a/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetPreviews.kt
+++ b/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetPreviews.kt
@@ -64,4 +64,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapterTest.kt b/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapterTest.kt
index 20f1961..a41f02ec 100644
--- a/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapterTest.kt
+++ b/glance/glance-appwidget-preview/src/androidTest/kotlin/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapterTest.kt
@@ -130,4 +130,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/ComposableInvoker.kt b/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/ComposableInvoker.kt
index 8505a8f..799ee8e 100644
--- a/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/ComposableInvoker.kt
+++ b/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/ComposableInvoker.kt
@@ -202,4 +202,4 @@
throw ClassNotFoundException("Composable Method '$className.$methodName' not found", e)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapter.kt b/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapter.kt
index 53c5222..d484f5f 100644
--- a/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapter.kt
+++ b/glance/glance-appwidget-preview/src/main/java/androidx/glance/appwidget/preview/GlanceAppWidgetViewAdapter.kt
@@ -77,4 +77,4 @@
init(className, methodName)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ActionAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ActionAppWidget.kt
index 13498e5..4c26019 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ActionAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ActionAppWidget.kt
@@ -273,4 +273,4 @@
super.onReceive(context, intent)
Log.d(this::class.simpleName, "Action Demo Broadcast: $intent")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DefaultStateAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DefaultStateAppWidget.kt
index c4cdd7a..95e7e85f 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DefaultStateAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DefaultStateAppWidget.kt
@@ -88,4 +88,4 @@
class DefaultStateAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = DefaultStateAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DemoApplication.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DemoApplication.kt
index 1eb82f6..e0d82a9 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DemoApplication.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/DemoApplication.kt
@@ -24,4 +24,4 @@
StrictMode.enableDefaults()
super.onCreate()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/GlanceAppWidgetDemoActivity.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/GlanceAppWidgetDemoActivity.kt
index 801f260..1586684 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/GlanceAppWidgetDemoActivity.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/GlanceAppWidgetDemoActivity.kt
@@ -187,4 +187,4 @@
data class AppWidgetDesc(
val appWidgetId: GlanceId,
val sizes: List<DpSize>,
-)
\ No newline at end of file
+)
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ImageAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ImageAppWidget.kt
index fddee1b..4409f8c 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ImageAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ImageAppWidget.kt
@@ -116,4 +116,4 @@
class ImageAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = ImageAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
index 171a220..065cbe6 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
@@ -141,4 +141,4 @@
)
val colors = ColorProviders(light = LightColors, dark = DarkColors)
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResizingAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResizingAppWidget.kt
index b801043..e28a5cc 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResizingAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResizingAppWidget.kt
@@ -121,4 +121,4 @@
class ResizingAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = ResizingAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResponsiveAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResponsiveAppWidget.kt
index aaf9c38..0587fac 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResponsiveAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResponsiveAppWidget.kt
@@ -177,4 +177,4 @@
class ResponsiveAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = ResponsiveAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/RippleAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/RippleAppWidget.kt
index c84c97f..d25e148 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/RippleAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/RippleAppWidget.kt
@@ -203,4 +203,4 @@
class RippleAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = RippleAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ScrollableAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ScrollableAppWidget.kt
index 74acc8e..ba9cbef 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ScrollableAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ScrollableAppWidget.kt
@@ -279,4 +279,4 @@
class ScrollableAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = ScrollableAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/VerticalGridAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/VerticalGridAppWidget.kt
index 6998de4..8ca035a 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/VerticalGridAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/VerticalGridAppWidget.kt
@@ -119,4 +119,4 @@
class VerticalGridAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = VerticalGridAppWidget()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/java/androidx/glance/appwidget/macrobenchmark/AppWidgetUpdateBenchmark.kt b/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/java/androidx/glance/appwidget/macrobenchmark/AppWidgetUpdateBenchmark.kt
index f354fdf..ceed3e9 100644
--- a/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/java/androidx/glance/appwidget/macrobenchmark/AppWidgetUpdateBenchmark.kt
+++ b/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/java/androidx/glance/appwidget/macrobenchmark/AppWidgetUpdateBenchmark.kt
@@ -86,4 +86,4 @@
fun parameters() =
listOf(arrayOf(StartupMode.COLD), arrayOf(StartupMode.WARM))
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/samples/src/main/java/androidx/glance/appwidget/samples/GlanceAppWidgetSamples.kt b/glance/glance-appwidget/samples/src/main/java/androidx/glance/appwidget/samples/GlanceAppWidgetSamples.kt
index a31aa95..2b0f690 100644
--- a/glance/glance-appwidget/samples/src/main/java/androidx/glance/appwidget/samples/GlanceAppWidgetSamples.kt
+++ b/glance/glance-appwidget/samples/src/main/java/androidx/glance/appwidget/samples/GlanceAppWidgetSamples.kt
@@ -78,4 +78,4 @@
MyWidget().updateAll(context)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CheckBoxTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CheckBoxTest.kt
index b854dfd..f3d526e 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CheckBoxTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CheckBoxTest.kt
@@ -149,4 +149,4 @@
}
private fun Dp.toPx() = toPixels(context.resources.displayMetrics)
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CoroutineBroadcastReceiverTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CoroutineBroadcastReceiverTest.kt
index 551c543..ed76d96 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CoroutineBroadcastReceiverTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/CoroutineBroadcastReceiverTest.kt
@@ -107,4 +107,4 @@
const val BROADCAST_ACTION = "androidx.glance.appwidget.utils.TEST_ACTION"
const val EXTRA_STRING = "extra_string"
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetManagerTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetManagerTest.kt
index 0656823..1181f98 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetManagerTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetManagerTest.kt
@@ -137,4 +137,4 @@
private class DummyGlanceAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = TestGlanceAppWidget
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiverTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiverTest.kt
index f9960be..22f4460 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiverTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiverTest.kt
@@ -22,6 +22,7 @@
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.GradientDrawable
import android.os.Build
+import android.os.FileObserver
import android.text.SpannedString
import android.text.style.StyleSpan
import android.text.style.TextAppearanceSpan
@@ -103,18 +104,19 @@
import java.util.concurrent.atomic.AtomicReference
import kotlin.test.assertIs
import kotlin.test.assertNotNull
-import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.Job
import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.collectIndexed
+import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.take
+import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
-import kotlinx.coroutines.test.runTest
import org.junit.After
-import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -126,7 +128,6 @@
const val RECEIVER_TEST_TAG = "GAWRT" // shorten to avoid long tag lint
-@OptIn(ExperimentalCoroutinesApi::class)
@SdkSuppress(minSdkVersion = 29)
@MediumTest
class GlanceAppWidgetReceiverTest {
@@ -147,6 +148,7 @@
@After
fun cleanUp() {
TestGlanceAppWidget.resetOnDeleteBlock()
+ CompoundButtonActionTest.reset()
}
@Test
@@ -622,27 +624,28 @@
val fileKey = createUniqueRemoteUiName((glanceId as AppWidgetId).appWidgetId)
val preferencesFile = PreferencesGlanceStateDefinition.getLocation(context, fileKey)
- assertThat(preferencesFile.exists())
-
- val deleteLatch = CountDownLatch(1)
- TestGlanceAppWidget.setOnDeleteBlock {
- deleteLatch.countDown()
+ assertThat(preferencesFile.exists()).isTrue()
+ val fileIsDeleted = CountDownLatch(1)
+ val fileDeletionObserver = object : FileObserver(preferencesFile, DELETE_SELF) {
+ override fun onEvent(event: Int, path: String?) {
+ if (event == DELETE_SELF) {
+ fileIsDeleted.countDown()
+ }
+ }
}
-
+ fileDeletionObserver.startWatching()
mHostRule.removeAppWidget()
-
- deleteLatch.await(5, TimeUnit.SECONDS)
- val interval = 200L
- for (timeout in 0..2000L step interval) {
- if (!preferencesFile.exists()) return
- Thread.sleep(interval)
+ try {
+ assertWithMessage("View state file is deleted").that(
+ fileIsDeleted.await(5, TimeUnit.SECONDS)
+ ).isTrue()
+ } finally {
+ fileDeletionObserver.stopWatching()
}
- assertWithMessage("View state file exists").that(preferencesFile.exists())
- .isFalse()
}
@Test
- fun updateAll() = runTest {
+ fun updateAll() = runBlocking<Unit> {
TestGlanceAppWidget.uiDefinition = {
Text("text")
}
@@ -655,7 +658,7 @@
}
@Test
- fun updateIf() = runTest {
+ fun updateIf() = runBlocking<Unit> {
val didRun = AtomicBoolean(false)
TestGlanceAppWidget.uiDefinition = {
currentState<Preferences>()
@@ -687,7 +690,7 @@
didRun.set(false)
// Waiting for the update should timeout since it is never triggered.
- val exception = assertThrows(IllegalArgumentException::class.java) {
+ val updateResult = runCatching {
// AppWidgetService may send an APPWIDGET_UPDATE broadcast, which is not relevant to
// this and should be ignored.
mHostRule.ignoreBroadcasts {
@@ -700,7 +703,10 @@
}
}
}
- assertThat(exception).hasMessageThat().contains("Timeout before getting RemoteViews")
+ assertThat(updateResult.exceptionOrNull()).apply {
+ isInstanceOf(IllegalArgumentException::class.java)
+ hasMessageThat().contains("Timeout before getting RemoteViews")
+ }
assertThat(didRun.get()).isFalse()
}
@@ -839,7 +845,7 @@
}
@Test
- fun compoundButtonAction() = runTest {
+ fun compoundButtonAction() = runBlocking<Unit> {
val checkbox = "checkbox"
val switch = "switch"
val checkBoxClicked = MutableStateFlow(false)
@@ -938,7 +944,7 @@
@Test
@SdkSuppress(minSdkVersion = 31)
- fun lambdaActionCallback() = runTest {
+ fun lambdaActionCallback() = runBlocking<Unit> {
TestGlanceAppWidget.uiDefinition = {
val text = remember { mutableStateOf("initial") }
Button(
@@ -966,7 +972,7 @@
@Test
@SdkSuppress(minSdkVersion = 29, maxSdkVersion = 30)
- fun lambdaActionCallback_backportButton() = runTest {
+ fun lambdaActionCallback_backportButton() = runBlocking<Unit> {
TestGlanceAppWidget.uiDefinition = {
val text = remember { mutableStateOf("initial") }
Button(
@@ -993,7 +999,7 @@
}
@Test
- fun unsetActionCallback() = runTest {
+ fun unsetActionCallback() = runBlocking<Unit> {
var enabled by mutableStateOf(true)
TestGlanceAppWidget.uiDefinition = {
Text(
@@ -1025,7 +1031,7 @@
}
@Test
- fun unsetCompoundButtonActionCallback() = runTest {
+ fun unsetCompoundButtonActionCallback() = runBlocking<Unit> {
TestGlanceAppWidget.uiDefinition = {
val enabled = currentState<Preferences>()[testBoolKey] ?: true
CheckBox(
@@ -1040,15 +1046,12 @@
}
mHostRule.startHost()
-
- CompoundButtonActionTest.received.set(emptyList())
- CompoundButtonActionTest.latch = CountDownLatch(1)
+ CompoundButtonActionTest.reset()
mHostRule.onUnboxedHostView<ViewGroup> { root ->
checkNotNull(root.findChild<TextView> { it.text.toString() == "checkbox" })
.performCompoundButtonClick()
}
- CompoundButtonActionTest.latch.await(5, TimeUnit.SECONDS)
- assertThat(CompoundButtonActionTest.received.get()).containsExactly(
+ assertThat(CompoundButtonActionTest.nextValue()).containsExactly(
"checkbox" to true
)
@@ -1059,14 +1062,13 @@
TestGlanceAppWidget.update(context, AppWidgetId(mHostRule.appWidgetId))
}
- CompoundButtonActionTest.received.set(emptyList())
- CompoundButtonActionTest.latch = CountDownLatch(1)
+ CompoundButtonActionTest.reset()
mHostRule.onUnboxedHostView<ViewGroup> { root ->
checkNotNull(root.findChild<TextView> { it.text.toString() == "checkbox" })
.performCompoundButtonClick()
}
- assertThat(CompoundButtonActionTest.latch.await(5, TimeUnit.SECONDS)).isFalse()
- assertThat(CompoundButtonActionTest.received.get()).isEmpty()
+ delay(5.seconds)
+ assertThat(CompoundButtonActionTest.currentValue).isNull()
}
@SdkSuppress(minSdkVersion = 31)
@@ -1150,7 +1152,7 @@
}
@Test
- fun cancellingContentCoroutineCausesContentToLeaveComposition() = runBlocking {
+ fun cancellingContentCoroutineCausesContentToLeaveComposition() = runBlocking<Unit> {
val currentEffectState = MutableStateFlow(EffectState.Initial)
var contentJob: Job? = null
TestGlanceAppWidget.onProvideGlance = {
@@ -1179,7 +1181,7 @@
}
@Test
- fun rootViewIdIsNotReservedId() = runTest {
+ fun rootViewIdIsNotReservedId() = runBlocking<Unit> {
TestGlanceAppWidget.uiDefinition = {
Column {}
}
@@ -1285,13 +1287,17 @@
) {
val target = checkNotNull(parameters[key])
val value = checkNotNull(parameters[ToggleableStateKey])
- received.update { it + (target to value) }
- latch.countDown()
+ received.update { (it ?: emptyList()) + (target to value) }
}
companion object {
- lateinit var latch: CountDownLatch
- val received = AtomicReference<List<Pair<String, Boolean>>>(emptyList())
+ private val received = MutableStateFlow<List<Pair<String, Boolean>>?>(null)
val key = ActionParameters.Key<String>("eventTarget")
+ fun reset() {
+ received.value = null
+ }
+ val currentValue
+ get() = received.value
+ suspend fun nextValue() = received.filterNotNull().first()
}
}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/LazyColumnTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/LazyColumnTest.kt
index 2b819fa..bb96d75 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/LazyColumnTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/LazyColumnTest.kt
@@ -664,4 +664,4 @@
// LazyColumn
val alignmentView = assertIs<FrameLayout>(getUnboxedListItem(itemPosition))
return alignmentView.getChildAt(viewPosition).getTargetView()
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/RemoteCollectionItemsTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/RemoteCollectionItemsTest.kt
index 41561f8..3a3f270 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/RemoteCollectionItemsTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/RemoteCollectionItemsTest.kt
@@ -109,4 +109,4 @@
.build()
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ResourceResolutionTest.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ResourceResolutionTest.kt
index 35ef162..0c468152 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ResourceResolutionTest.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ResourceResolutionTest.kt
@@ -96,4 +96,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ScreenshotsTests.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ScreenshotsTests.kt
index 23379d6..4ac3e32 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ScreenshotsTests.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/ScreenshotsTests.kt
@@ -39,4 +39,4 @@
rootView.draw(canvas)
assertBitmapAgainstGolden(bmp, expectedGolden, MSSIMMatcher(threshold))
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/WithNightMode.kt b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/WithNightMode.kt
index cf36c45..5ce1e69 100644
--- a/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/WithNightMode.kt
+++ b/glance/glance-appwidget/src/androidTest/kotlin/androidx/glance/appwidget/WithNightMode.kt
@@ -70,4 +70,4 @@
}
private val Description.testMethod: Method
- get() = testClass.getMethod(methodName)
\ No newline at end of file
+ get() = testClass.getMethod(methodName)
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AlignmentModifier.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AlignmentModifier.kt
index 304c783..a0f53c3 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AlignmentModifier.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AlignmentModifier.kt
@@ -19,4 +19,4 @@
import androidx.glance.GlanceModifier
import androidx.glance.layout.Alignment
-internal class AlignmentModifier(val alignment: Alignment) : GlanceModifier.Element
\ No newline at end of file
+internal class AlignmentModifier(val alignment: Alignment) : GlanceModifier.Element
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AppWidgetModifiers.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AppWidgetModifiers.kt
index b035845..ace6d64 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AppWidgetModifiers.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/AppWidgetModifiers.kt
@@ -31,4 +31,4 @@
* the Android View meaning of enabled.
*/
internal fun GlanceModifier.enabled(enabled: Boolean) = this.then(EnabledModifier(enabled))
-internal data class EnabledModifier(val enabled: Boolean) : GlanceModifier.Element
\ No newline at end of file
+internal data class EnabledModifier(val enabled: Boolean) : GlanceModifier.Element
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CompositionLocals.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CompositionLocals.kt
index 45be98b..d3a3e8f 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CompositionLocals.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CompositionLocals.kt
@@ -26,4 +26,4 @@
* See [AppWidgetManager#getAppWidgetOptions] for details
*/
val LocalAppWidgetOptions: ProvidableCompositionLocal<Bundle> =
- compositionLocalOf { Bundle() }
\ No newline at end of file
+ compositionLocalOf { Bundle() }
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CoroutineBroadcastReceiver.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CoroutineBroadcastReceiver.kt
index b963763..673fe9b 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CoroutineBroadcastReceiver.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/CoroutineBroadcastReceiver.kt
@@ -63,4 +63,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/GlanceRemoteViewsService.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/GlanceRemoteViewsService.kt
index 2f0d9d6..cdaf208 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/GlanceRemoteViewsService.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/GlanceRemoteViewsService.kt
@@ -260,4 +260,4 @@
}
.build()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/IgnoreResult.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/IgnoreResult.kt
index 63414ce..59062de 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/IgnoreResult.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/IgnoreResult.kt
@@ -54,4 +54,4 @@
if (children.any { it.shouldIgnoreResult() }) return true
}
return false
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/MyPackageReplacedReceiver.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/MyPackageReplacedReceiver.kt
index d341bdc..fc925c8 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/MyPackageReplacedReceiver.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/MyPackageReplacedReceiver.kt
@@ -34,4 +34,4 @@
manager.cleanReceivers()
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/TintAndAlphaColorFilterParams.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/TintAndAlphaColorFilterParams.kt
index 03a01af..d50e334 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/TintAndAlphaColorFilterParams.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/TintAndAlphaColorFilterParams.kt
@@ -26,4 +26,4 @@
internal class TintAndAlphaColorFilterParams(val colorProvider: ColorProvider) : ColorFilterParams {
override fun toString() =
"TintAndAlphaColorFilterParams(colorProvider=$colorProvider))"
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/Utils.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/Utils.kt
index cea6860..48771c7 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/Utils.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/Utils.kt
@@ -67,4 +67,4 @@
return viewId
}
-internal const val GlanceAppWidgetTag = "GlanceAppWidget"
\ No newline at end of file
+internal const val GlanceAppWidgetTag = "GlanceAppWidget"
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/WidgetLayout.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/WidgetLayout.kt
index 54daf92..49e0d30 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/WidgetLayout.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/WidgetLayout.kt
@@ -366,4 +366,4 @@
} else {
LayoutProto.DimensionType.WRAP
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/ActionCallbackBroadcastReceiver.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/ActionCallbackBroadcastReceiver.kt
index 5e5d3bf..726772e 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/ActionCallbackBroadcastReceiver.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/ActionCallbackBroadcastReceiver.kt
@@ -95,4 +95,4 @@
return this
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/InvisibleActionTrampolineActivity.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/InvisibleActionTrampolineActivity.kt
index 9c3a42b..0462188 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/InvisibleActionTrampolineActivity.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/InvisibleActionTrampolineActivity.kt
@@ -30,4 +30,4 @@
super.onCreate(savedInstanceState)
launchTrampolineAction(intent)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/LambdaActionBroadcasts.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/LambdaActionBroadcasts.kt
index ebc4cde..c409171 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/LambdaActionBroadcasts.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/action/LambdaActionBroadcasts.kt
@@ -40,4 +40,4 @@
.setAction(ActionTriggerLambda)
.putExtra(ExtraActionKey, actionKey)
.putExtra(ExtraAppWidgetId, appWidgetId)
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonApi31Impl.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonApi31Impl.kt
index c4b04e0..a3573cf 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonApi31Impl.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonApi31Impl.kt
@@ -27,4 +27,4 @@
fun setCompoundButtonChecked(rv: RemoteViews, viewId: Int, checked: Boolean) {
rv.setCompoundButtonChecked(viewId, checked)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonTranslator.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonTranslator.kt
index 0ec0c95..f92be40 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonTranslator.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/CompoundButtonTranslator.kt
@@ -78,4 +78,4 @@
internal fun RemoteViews.setImageViewColorFilter(viewId: Int, color: Color) {
setImageViewColorFilter(viewId, color.toArgb())
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/LazyVerticalGridTranslator.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/LazyVerticalGridTranslator.kt
index e88f348..eda245b 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/LazyVerticalGridTranslator.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/LazyVerticalGridTranslator.kt
@@ -146,4 +146,4 @@
GridCells.Fixed(4) -> LayoutType.VerticalGridFourColumns
GridCells.Fixed(5) -> LayoutType.VerticalGridFiveColumns
else -> LayoutType.VerticalGridAutoFit
- }
\ No newline at end of file
+ }
diff --git a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/TextTranslator.kt b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/TextTranslator.kt
index 8a75049..6a219a7 100644
--- a/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/TextTranslator.kt
+++ b/glance/glance-appwidget/src/main/java/androidx/glance/appwidget/translators/TextTranslator.kt
@@ -193,4 +193,4 @@
fun setTextViewGravity(rv: RemoteViews, viewId: Int, gravity: Int) {
rv.setTextViewGravity(viewId, gravity)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ActionCallbackBroadcastReceiverTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ActionCallbackBroadcastReceiverTest.kt
index 310431e..bd64160 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ActionCallbackBroadcastReceiverTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ActionCallbackBroadcastReceiverTest.kt
@@ -83,4 +83,4 @@
// Placeholder mutable class that does not implement toString()
private class PlaceholderMutableClass(var value: Boolean) : Serializable
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ApplyDimensionModifierTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ApplyDimensionModifierTest.kt
index 378cecf..cd0a03e 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ApplyDimensionModifierTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/ApplyDimensionModifierTest.kt
@@ -357,4 +357,4 @@
assertIs<TextView>(sizeView)
return sizeView
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/GlanceRemoteViewsTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/GlanceRemoteViewsTest.kt
index e080178..6d8d4f0 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/GlanceRemoteViewsTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/GlanceRemoteViewsTest.kt
@@ -102,4 +102,4 @@
assertIs<TextView>(view)
Truth.assertThat(view.text.toString()).isEqualTo("No error thrown")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/LambdaActionTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/LambdaActionTest.kt
index 3c2d2ed..9685bb7 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/LambdaActionTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/LambdaActionTest.kt
@@ -42,4 +42,4 @@
assertThat(lambdas.size).isEqualTo(3)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/SizeBoxTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/SizeBoxTest.kt
index d72e0f2..769f691 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/SizeBoxTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/SizeBoxTest.kt
@@ -272,4 +272,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CheckBoxBackportTranslatorTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CheckBoxBackportTranslatorTest.kt
index eb4b190..bacbc34 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CheckBoxBackportTranslatorTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CheckBoxBackportTranslatorTest.kt
@@ -240,4 +240,4 @@
val checkboxRoot = assertIs<ViewGroup>(context.applyRemoteViews(rv))
assertThat(checkboxRoot.contentDescription).isEqualTo("Custom checkbox description")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CompoundButtonTranslatorTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CompoundButtonTranslatorTest.kt
index 7b0067b..676b3e1 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CompoundButtonTranslatorTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/CompoundButtonTranslatorTest.kt
@@ -70,4 +70,4 @@
assertThat(colorProvider.getColor(darkContext, isChecked = true))
.isSameColorAs("#FFFF00")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/RadioButtonBackportTranslatorTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/RadioButtonBackportTranslatorTest.kt
index cc9f17e..53b21bb 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/RadioButtonBackportTranslatorTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/RadioButtonBackportTranslatorTest.kt
@@ -292,4 +292,4 @@
shadowOf(it.drawable).createdFromResId ==
androidx.glance.appwidget.R.drawable.glance_btn_radio_material_anim
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/SwitchBackportTranslatorTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/SwitchBackportTranslatorTest.kt
index fbb441e..86ceb0f 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/SwitchBackportTranslatorTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/SwitchBackportTranslatorTest.kt
@@ -303,4 +303,4 @@
shadowOf(it.drawable).createdFromResId ==
androidx.glance.appwidget.R.drawable.glance_switch_track
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/TextTranslatorTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/TextTranslatorTest.kt
index 69176c6..8a48f5e 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/TextTranslatorTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/translators/TextTranslatorTest.kt
@@ -503,4 +503,4 @@
assertIs<T>(obj)
check(obj)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt
index dfe943a..e58fdc7 100644
--- a/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt
+++ b/glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt
@@ -114,4 +114,4 @@
assertThat(ColorProvider(Color.Blue, Color.Red).getColor(context))
.isSameColorAs(Color.Red)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-material3/src/main/java/androidx/glance/material3/Material3Themes.kt b/glance/glance-material3/src/main/java/androidx/glance/material3/Material3Themes.kt
index ad4718f..ea90a7c 100644
--- a/glance/glance-material3/src/main/java/androidx/glance/material3/Material3Themes.kt
+++ b/glance/glance-material3/src/main/java/androidx/glance/material3/Material3Themes.kt
@@ -117,4 +117,4 @@
inverseSurface = ColorProvider(color = scheme.inverseSurface),
inversePrimary = ColorProvider(color = scheme.inversePrimary),
)
-}
\ No newline at end of file
+}
diff --git a/glance/glance-preview/src/main/java/androidx/glance/preview/ExperimentalGlancePreviewApi.kt b/glance/glance-preview/src/main/java/androidx/glance/preview/ExperimentalGlancePreviewApi.kt
index 0a5ac68..822c9bf 100644
--- a/glance/glance-preview/src/main/java/androidx/glance/preview/ExperimentalGlancePreviewApi.kt
+++ b/glance/glance-preview/src/main/java/androidx/glance/preview/ExperimentalGlancePreviewApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalGlancePreviewApi
\ No newline at end of file
+annotation class ExperimentalGlancePreviewApi
diff --git a/glance/glance-template/src/main/java/androidx/glance/template/FreeformTemplateLayouts.kt b/glance/glance-template/src/main/java/androidx/glance/template/FreeformTemplateLayouts.kt
index 3b398c1..5bb9896 100644
--- a/glance/glance-template/src/main/java/androidx/glance/template/FreeformTemplateLayouts.kt
+++ b/glance/glance-template/src/main/java/androidx/glance/template/FreeformTemplateLayouts.kt
@@ -103,4 +103,4 @@
}
return result
-}
\ No newline at end of file
+}
diff --git a/glance/glance-template/src/main/java/androidx/glance/template/ListTemplateData.kt b/glance/glance-template/src/main/java/androidx/glance/template/ListTemplateData.kt
index 1d0de24..de58c1f 100644
--- a/glance/glance-template/src/main/java/androidx/glance/template/ListTemplateData.kt
+++ b/glance/glance-template/src/main/java/androidx/glance/template/ListTemplateData.kt
@@ -121,4 +121,4 @@
*/
val Brief: ListStyle = ListStyle(1)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/FirstGlancePreview.kt b/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/FirstGlancePreview.kt
index a585320..ff743c4 100644
--- a/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/FirstGlancePreview.kt
+++ b/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/FirstGlancePreview.kt
@@ -62,4 +62,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapterTest.kt b/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapterTest.kt
index debe385..5be15d8 100644
--- a/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapterTest.kt
+++ b/glance/glance-wear-tiles-preview/src/androidTest/kotlin/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapterTest.kt
@@ -107,4 +107,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/ComposableInvoker.kt b/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/ComposableInvoker.kt
index 4fc04d9..2105f3c 100644
--- a/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/ComposableInvoker.kt
+++ b/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/ComposableInvoker.kt
@@ -202,4 +202,4 @@
throw ClassNotFoundException("Composable Method '$className.$methodName' not found", e)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapter.kt b/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapter.kt
index 944d3ed..0f9ece1 100644
--- a/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapter.kt
+++ b/glance/glance-wear-tiles-preview/src/main/java/androidx/glance/wear/tiles/preview/GlanceTileServiceViewAdapter.kt
@@ -107,4 +107,4 @@
init(className, methodName)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarActivity.kt b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarActivity.kt
index 54fe5bc..e19ada2 100644
--- a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarActivity.kt
+++ b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarActivity.kt
@@ -34,4 +34,4 @@
}
)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarTileService.kt b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarTileService.kt
index f178143..7fc14dc 100644
--- a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarTileService.kt
+++ b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CalendarTileService.kt
@@ -99,4 +99,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CountTileService.kt b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CountTileService.kt
index 4b6af16..4f4f5bb 100644
--- a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CountTileService.kt
+++ b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/CountTileService.kt
@@ -137,4 +137,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/HelloTileService.kt b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/HelloTileService.kt
index bf46887..bb437dd 100644
--- a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/HelloTileService.kt
+++ b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/HelloTileService.kt
@@ -69,4 +69,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/TilePreviewActivity.kt b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/TilePreviewActivity.kt
index 92bff5a..d7b2b7d 100644
--- a/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/TilePreviewActivity.kt
+++ b/glance/glance-wear-tiles/integration-tests/demos/src/main/java/androidx/glance/wear/tiles/demos/TilePreviewActivity.kt
@@ -86,4 +86,4 @@
override fun getItemCount(): Int = NUM_PAGES
override fun createFragment(position: Int): Fragment = TilePageFragment(fa, position)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/androidTest/kotlin/androidx/glance/wear/tiles/ScreenshotTests.kt b/glance/glance-wear-tiles/src/androidTest/kotlin/androidx/glance/wear/tiles/ScreenshotTests.kt
index d5f8bc0..b40cee8 100644
--- a/glance/glance-wear-tiles/src/androidTest/kotlin/androidx/glance/wear/tiles/ScreenshotTests.kt
+++ b/glance/glance-wear-tiles/src/androidTest/kotlin/androidx/glance/wear/tiles/ScreenshotTests.kt
@@ -449,4 +449,4 @@
}
internal class UnSupportedModifier() : GlanceModifier.Element
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/CompositionLocals.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/CompositionLocals.kt
index 233dab9..a2d78b8 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/CompositionLocals.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/CompositionLocals.kt
@@ -22,4 +22,4 @@
* Time interval of the glance tile UI being generated.
*/
public val LocalTimeInterval =
- staticCompositionLocalOf<TimeInterval?> { error("No default time interval") }
\ No newline at end of file
+ staticCompositionLocalOf<TimeInterval?> { error("No default time interval") }
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/ExperimentalGlanceWearTilesApi.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/ExperimentalGlanceWearTilesApi.kt
index 8966090..66f3d01 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/ExperimentalGlanceWearTilesApi.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/ExperimentalGlanceWearTilesApi.kt
@@ -18,4 +18,4 @@
@RequiresOptIn("This API is experimental and is likely to change in the future.")
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalGlanceWearTilesApi
\ No newline at end of file
+annotation class ExperimentalGlanceWearTilesApi
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/GlanceWearTiles.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/GlanceWearTiles.kt
index ac1bded..550115c 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/GlanceWearTiles.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/GlanceWearTiles.kt
@@ -145,4 +145,4 @@
errorUiLayout,
androidx.wear.tiles.ResourceBuilders.Resources.Builder())
}
- }
\ No newline at end of file
+ }
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/NormalizeCompositionTree.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/NormalizeCompositionTree.kt
index b0a0795c..557632d 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/NormalizeCompositionTree.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/NormalizeCompositionTree.kt
@@ -173,4 +173,4 @@
}
else -> error("Unknown image provider type: ${this.javaClass.canonicalName}")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/TimelineMode.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/TimelineMode.kt
index a4e8c81..3265efd 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/TimelineMode.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/TimelineMode.kt
@@ -70,4 +70,4 @@
public override fun toString(): String =
"TimelineMode.TimeBoundEntries(timeIntervals=$timeIntervals)"
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/curved/GlanceCurvedModifier.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/curved/GlanceCurvedModifier.kt
index dd08bc9..1130cea 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/curved/GlanceCurvedModifier.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/curved/GlanceCurvedModifier.kt
@@ -166,7 +166,7 @@
null to this
}
-/** @suppress **/
+/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public data class SweepAngleModifier(public val degrees: Float) : GlanceCurvedModifier.Element
@@ -176,7 +176,7 @@
public fun GlanceCurvedModifier.sweepAngleDegrees(degrees: Float) =
this.then(SweepAngleModifier(degrees))
-/** @suppress **/
+/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public data class ThicknessModifier(public val thickness: Dp) : GlanceCurvedModifier.Element
@@ -186,7 +186,7 @@
public fun GlanceCurvedModifier.thickness(thickness: Dp) =
this.then(ThicknessModifier(thickness))
-/** @suppress **/
+/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public data class ActionCurvedModifier(public val action: Action) : GlanceCurvedModifier.Element
@@ -196,7 +196,7 @@
public fun GlanceCurvedModifier.clickable(onClick: Action): GlanceCurvedModifier =
this.then(ActionCurvedModifier(onClick))
-/** @suppress **/
+/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public data class SemanticsCurvedModifier(
val configuration: SemanticsConfiguration
diff --git a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/state/GlanceWearTilesState.kt b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/state/GlanceWearTilesState.kt
index cbb18a9..c40b7f1 100644
--- a/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/state/GlanceWearTilesState.kt
+++ b/glance/glance-wear-tiles/src/main/java/androidx/glance/wear/tiles/state/GlanceWearTilesState.kt
@@ -62,4 +62,4 @@
): T {
require(glanceId is WearTileId) { "The glance ID is not the one of a wear tile" }
return GlanceState.getValue(context, definition, glanceId.tileServiceClass.name)
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/BorderTest.kt b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/BorderTest.kt
index 6f88fd0..db79abb 100644
--- a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/BorderTest.kt
+++ b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/BorderTest.kt
@@ -74,4 +74,4 @@
const val density = 2f
const val dimensionInDp = 3f
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/GlanceTileServiceTest.kt b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/GlanceTileServiceTest.kt
index 8f27c64..a3249fa 100644
--- a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/GlanceTileServiceTest.kt
+++ b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/GlanceTileServiceTest.kt
@@ -386,4 +386,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/TimelineModeTest.kt b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/TimelineModeTest.kt
index d159631..203ec57 100644
--- a/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/TimelineModeTest.kt
+++ b/glance/glance-wear-tiles/src/test/kotlin/androidx/glance/wear/tiles/TimelineModeTest.kt
@@ -51,4 +51,4 @@
assertThat(intervals.elementAt(3).start).isEqualTo(time4)
assertThat(intervals.elementAt(3).end.toEpochMilli()).isEqualTo(Long.MAX_VALUE)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/androidTest/kotlin/androidx/glance/session/GlanceSessionManagerTest.kt b/glance/glance/src/androidTest/kotlin/androidx/glance/session/GlanceSessionManagerTest.kt
index 78fc16b..3f4fa05 100644
--- a/glance/glance/src/androidTest/kotlin/androidx/glance/session/GlanceSessionManagerTest.kt
+++ b/glance/glance/src/androidTest/kotlin/androidx/glance/session/GlanceSessionManagerTest.kt
@@ -236,4 +236,4 @@
}
}
-private suspend fun <T> Flow<T?>.firstNotNull() = first { it != null }!!
\ No newline at end of file
+private suspend fun <T> Flow<T?>.firstNotNull() = first { it != null }!!
diff --git a/glance/glance/src/main/java/androidx/glance/Button.kt b/glance/glance/src/main/java/androidx/glance/Button.kt
index 57c9fd2..ff70130 100644
--- a/glance/glance/src/main/java/androidx/glance/Button.kt
+++ b/glance/glance/src/main/java/androidx/glance/Button.kt
@@ -203,4 +203,4 @@
backgroundColor = backgroundColor,
contentColor = contentColor
)
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/Emittables.kt b/glance/glance/src/main/java/androidx/glance/Emittables.kt
index 9e549ca..52a538a 100644
--- a/glance/glance/src/main/java/androidx/glance/Emittables.kt
+++ b/glance/glance/src/main/java/androidx/glance/Emittables.kt
@@ -42,4 +42,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
abstract class EmittableLazyItemWithChildren : EmittableWithChildren() {
var alignment: Alignment = Alignment.CenterStart
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/GlanceComposable.kt b/glance/glance/src/main/java/androidx/glance/GlanceComposable.kt
index b3b877c..79defe9 100644
--- a/glance/glance/src/main/java/androidx/glance/GlanceComposable.kt
+++ b/glance/glance/src/main/java/androidx/glance/GlanceComposable.kt
@@ -32,4 +32,4 @@
AnnotationTarget.TYPE,
AnnotationTarget.TYPE_PARAMETER,
)
-annotation class GlanceComposable
\ No newline at end of file
+annotation class GlanceComposable
diff --git a/glance/glance/src/main/java/androidx/glance/GlanceId.kt b/glance/glance/src/main/java/androidx/glance/GlanceId.kt
index 60d0f92..872b067 100644
--- a/glance/glance/src/main/java/androidx/glance/GlanceId.kt
+++ b/glance/glance/src/main/java/androidx/glance/GlanceId.kt
@@ -17,4 +17,4 @@
package androidx.glance
/** Opaque object used to describe a glance view. */
-interface GlanceId
\ No newline at end of file
+interface GlanceId
diff --git a/glance/glance/src/main/java/androidx/glance/GlanceModifier.kt b/glance/glance/src/main/java/androidx/glance/GlanceModifier.kt
index bf8ffc9..ddc1c74 100644
--- a/glance/glance/src/main/java/androidx/glance/GlanceModifier.kt
+++ b/glance/glance/src/main/java/androidx/glance/GlanceModifier.kt
@@ -125,4 +125,4 @@
override fun toString(): String = "[" + foldIn("") { acc, element ->
if (acc.isEmpty()) element.toString() else "$acc, $element"
} + "]"
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/action/LambdaAction.kt b/glance/glance/src/main/java/androidx/glance/action/LambdaAction.kt
index 8076cd7..525e618 100644
--- a/glance/glance/src/main/java/androidx/glance/action/LambdaAction.kt
+++ b/glance/glance/src/main/java/androidx/glance/action/LambdaAction.kt
@@ -43,4 +43,4 @@
): Action {
val finalKey = if (!key.isNullOrEmpty()) key else currentCompositeKeyHash.toString()
return LambdaAction(finalKey, block)
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/color/DayNightColorProviders.kt b/glance/glance/src/main/java/androidx/glance/color/DayNightColorProviders.kt
index aa1e76c..32fe325 100644
--- a/glance/glance/src/main/java/androidx/glance/color/DayNightColorProviders.kt
+++ b/glance/glance/src/main/java/androidx/glance/color/DayNightColorProviders.kt
@@ -40,4 +40,4 @@
val Context.isNightMode: Boolean
@RestrictTo(RestrictTo.Scope.LIBRARY)
get() = (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) ==
- Configuration.UI_MODE_NIGHT_YES
\ No newline at end of file
+ Configuration.UI_MODE_NIGHT_YES
diff --git a/glance/glance/src/main/java/androidx/glance/layout/SizeModifiers.kt b/glance/glance/src/main/java/androidx/glance/layout/SizeModifiers.kt
index 1142d0b..f64ee76 100644
--- a/glance/glance/src/main/java/androidx/glance/layout/SizeModifiers.kt
+++ b/glance/glance/src/main/java/androidx/glance/layout/SizeModifiers.kt
@@ -96,4 +96,4 @@
this.wrapContentHeight().wrapContentWidth()
/** Set both the width and height to the maximum available space. */
-fun GlanceModifier.fillMaxSize(): GlanceModifier = this.fillMaxWidth().fillMaxHeight()
\ No newline at end of file
+fun GlanceModifier.fillMaxSize(): GlanceModifier = this.fillMaxWidth().fillMaxHeight()
diff --git a/glance/glance/src/main/java/androidx/glance/semantics/SemanticsModifier.kt b/glance/glance/src/main/java/androidx/glance/semantics/SemanticsModifier.kt
index 9467c58..76f5ad3 100644
--- a/glance/glance/src/main/java/androidx/glance/semantics/SemanticsModifier.kt
+++ b/glance/glance/src/main/java/androidx/glance/semantics/SemanticsModifier.kt
@@ -18,7 +18,7 @@
import androidx.annotation.RestrictTo
import androidx.glance.GlanceModifier
-/** @suppress **/
+/** @suppress */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
data class SemanticsModifier(
val configuration: SemanticsConfiguration
diff --git a/glance/glance/src/main/java/androidx/glance/semantics/SemanticsProperties.kt b/glance/glance/src/main/java/androidx/glance/semantics/SemanticsProperties.kt
index 235baa1..e40a921 100644
--- a/glance/glance/src/main/java/androidx/glance/semantics/SemanticsProperties.kt
+++ b/glance/glance/src/main/java/androidx/glance/semantics/SemanticsProperties.kt
@@ -113,4 +113,4 @@
fun <T> getOrNull(key: SemanticsPropertyKey<T>): T? {
return getOrElseNullable(key) { null }
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/session/IdleEventBroadcastReceiver.kt b/glance/glance/src/main/java/androidx/glance/session/IdleEventBroadcastReceiver.kt
index 372f57c..7929994 100644
--- a/glance/glance/src/main/java/androidx/glance/session/IdleEventBroadcastReceiver.kt
+++ b/glance/glance/src/main/java/androidx/glance/session/IdleEventBroadcastReceiver.kt
@@ -89,4 +89,4 @@
} finally {
context.unregisterReceiver(idleReceiver)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/session/InteractiveFrameClock.kt b/glance/glance/src/main/java/androidx/glance/session/InteractiveFrameClock.kt
index 806d974..58f3a1b 100644
--- a/glance/glance/src/main/java/androidx/glance/session/InteractiveFrameClock.kt
+++ b/glance/glance/src/main/java/androidx/glance/session/InteractiveFrameClock.kt
@@ -132,4 +132,4 @@
@VisibleForTesting
internal fun currentHz() = synchronized(lock) { currentHz }
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/main/java/androidx/glance/text/FontWeight.kt b/glance/glance/src/main/java/androidx/glance/text/FontWeight.kt
index 4e151be..f386ea3 100644
--- a/glance/glance/src/main/java/androidx/glance/text/FontWeight.kt
+++ b/glance/glance/src/main/java/androidx/glance/text/FontWeight.kt
@@ -21,7 +21,7 @@
*/
@JvmInline
value class FontWeight private constructor(
- /** numerical value for the weight (a number from 0 to 1000) **/
+ /** numerical value for the weight (a number from 0 to 1000) */
val value: Int,
) {
companion object {
diff --git a/glance/glance/src/test/kotlin/androidx/glance/CombinedGlanceModifierTest.kt b/glance/glance/src/test/kotlin/androidx/glance/CombinedGlanceModifierTest.kt
index 25cd34f..bab4226 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/CombinedGlanceModifierTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/CombinedGlanceModifierTest.kt
@@ -67,4 +67,4 @@
private data class Element(val value: Int) : GlanceModifier.Element
private fun GlanceModifier.element(value: Int) =
- this.then(Element(value))
\ No newline at end of file
+ this.then(Element(value))
diff --git a/glance/glance/src/test/kotlin/androidx/glance/ImageTest.kt b/glance/glance/src/test/kotlin/androidx/glance/ImageTest.kt
index 07f00f1..059204d 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/ImageTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/ImageTest.kt
@@ -91,4 +91,4 @@
assertThat(colorFilterParams.colorProvider).isEqualTo(colorProvider)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/VisibilityTest.kt b/glance/glance/src/test/kotlin/androidx/glance/VisibilityTest.kt
index ce9ddd3..d34e7db 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/VisibilityTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/VisibilityTest.kt
@@ -27,4 +27,4 @@
assertThat(modifier.findModifier<VisibilityModifier>()?.visibility)
.isEqualTo(Visibility.Gone)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/action/TestActivity.kt b/glance/glance/src/test/kotlin/androidx/glance/action/TestActivity.kt
index 6d3f905..703dbfb 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/action/TestActivity.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/action/TestActivity.kt
@@ -18,4 +18,4 @@
import android.app.Activity
-class TestActivity : Activity()
\ No newline at end of file
+class TestActivity : Activity()
diff --git a/glance/glance/src/test/kotlin/androidx/glance/color/ColorProvidersTest.kt b/glance/glance/src/test/kotlin/androidx/glance/color/ColorProvidersTest.kt
index 8ca45c7..64bb914 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/color/ColorProvidersTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/color/ColorProvidersTest.kt
@@ -332,4 +332,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/layout/BoxTest.kt b/glance/glance/src/test/kotlin/androidx/glance/layout/BoxTest.kt
index aefe11d..eb53adb 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/layout/BoxTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/layout/BoxTest.kt
@@ -93,4 +93,4 @@
assertThat(leafBox0.contentAlignment).isEqualTo(Alignment.BottomCenter)
assertThat(leafBox1.contentAlignment).isEqualTo(Alignment.TopCenter)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/layout/ColumnTest.kt b/glance/glance/src/test/kotlin/androidx/glance/layout/ColumnTest.kt
index 7f72a59..06c67c9 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/layout/ColumnTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/layout/ColumnTest.kt
@@ -97,4 +97,4 @@
assertThat(heightModifier.height).isSameInstanceAs(Dimension.Expand)
assertThat(box.modifier.findModifier<WidthModifier>()).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/layout/RowTest.kt b/glance/glance/src/test/kotlin/androidx/glance/layout/RowTest.kt
index 7ee121e..43d4abb 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/layout/RowTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/layout/RowTest.kt
@@ -97,4 +97,4 @@
assertThat(widthModifier.width).isSameInstanceAs(Dimension.Expand)
assertThat(box.modifier.findModifier<HeightModifier>()).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/layout/SpacerTest.kt b/glance/glance/src/test/kotlin/androidx/glance/layout/SpacerTest.kt
index 9ebc68a..94f5504 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/layout/SpacerTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/layout/SpacerTest.kt
@@ -86,4 +86,4 @@
val height = assertIs<Dimension.Dp>(heightModifier.height)
assertThat(height.dp).isEqualTo(15.dp)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/semantics/SemanticsTest.kt b/glance/glance/src/test/kotlin/androidx/glance/semantics/SemanticsTest.kt
index 59c32de..b336b0b 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/semantics/SemanticsTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/semantics/SemanticsTest.kt
@@ -32,4 +32,4 @@
.get(SemanticsProperties.ContentDescription).joinToString())
.isEqualTo("test_description")
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/session/IdleEventBroadcastReceiverTest.kt b/glance/glance/src/test/kotlin/androidx/glance/session/IdleEventBroadcastReceiverTest.kt
index 5d20c8f..7e73137 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/session/IdleEventBroadcastReceiverTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/session/IdleEventBroadcastReceiverTest.kt
@@ -62,4 +62,4 @@
receiver.onReceive(context, Intent(PowerManager.ACTION_DEVICE_LIGHT_IDLE_MODE_CHANGED))
assertThat(onIdleCalled.get()).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/session/InteractiveFrameClockTest.kt b/glance/glance/src/test/kotlin/androidx/glance/session/InteractiveFrameClockTest.kt
index 640af9f..827d25d3 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/session/InteractiveFrameClockTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/session/InteractiveFrameClockTest.kt
@@ -112,4 +112,4 @@
assertThat(interactiveJob.isCompleted)
assertThat(clock.currentHz()).isEqualTo(BASELINE_HZ)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/session/SessionManagerImplTest.kt b/glance/glance/src/test/kotlin/androidx/glance/session/SessionManagerImplTest.kt
index 3fccf2d..9a05800 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/session/SessionManagerImplTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/session/SessionManagerImplTest.kt
@@ -106,4 +106,4 @@
suspendCoroutine<Unit> {}
return Result.success()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/session/SessionWorkerTest.kt b/glance/glance/src/test/kotlin/androidx/glance/session/SessionWorkerTest.kt
index 43a1916..90bf629 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/session/SessionWorkerTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/session/SessionWorkerTest.kt
@@ -221,4 +221,4 @@
require(event is Function0<*>)
event.invoke()
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/state/StateDefinitionTest.kt b/glance/glance/src/test/kotlin/androidx/glance/state/StateDefinitionTest.kt
index 7082643..79ae930 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/state/StateDefinitionTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/state/StateDefinitionTest.kt
@@ -127,4 +127,4 @@
assertThat(store[stringKey]).isEqualTo(storedMessage2)
}
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/text/TextStyleTest.kt b/glance/glance/src/test/kotlin/androidx/glance/text/TextStyleTest.kt
index 4cbab34..6dcd415 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/text/TextStyleTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/text/TextStyleTest.kt
@@ -81,4 +81,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/glance/glance/src/test/kotlin/androidx/glance/text/TextTest.kt b/glance/glance/src/test/kotlin/androidx/glance/text/TextTest.kt
index 9b7516d..7851610 100644
--- a/glance/glance/src/test/kotlin/androidx/glance/text/TextTest.kt
+++ b/glance/glance/src/test/kotlin/androidx/glance/text/TextTest.kt
@@ -125,4 +125,4 @@
val child = assertIs<EmittableText>(root.children[0])
assertThat(child.style?.textAlign).isEqualTo(TextAlign.Center)
}
-}
\ No newline at end of file
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index d57b8e5..28f0bff 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -36,12 +36,14 @@
hilt = "2.44"
incap = "0.2"
jcodec = "0.2.5"
+kotlin17 = "1.7.10"
+kotlin18 = "1.8.22"
+kotlin19 = "1.9.0-Beta"
kotlin = "1.8.22"
kotlinBenchmark = "0.4.8"
kotlinNative = "1.8.22"
kotlinCompileTesting = "1.4.9"
-kotlinCoroutines = "1.6.4"
-kotlinCoroutines171 = "1.7.1"
+kotlinCoroutines = "1.7.1"
kotlinSerialization = "1.3.3"
ksp = "1.8.20-1.0.11"
ktfmt = "0.44"
@@ -161,44 +163,44 @@
guavaTestlib = { module = "com.google.guava:guava-testlib", version.ref = "guavaJre" }
gradleIncapHelper = { module = "net.ltgt.gradle.incap:incap", version.ref = "incap" }
gradleIncapHelperProcessor = { module = "net.ltgt.gradle.incap:incap-processor", version.ref = "incap" }
-kotlinAnnotationProcessingEmbeddable = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable", version.ref = "kotlin" }
+kotlinAnnotationProcessingEmbeddable = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable" }
kotlinBenchmarkRuntime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinBenchmark" }
kotlinBom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" }
kotlinCompiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlin" }
-kotlinCompilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" }
+kotlinCompilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable" }
kotlinCompileTesting = { module = "com.github.tschuchortdev:kotlin-compile-testing", version.ref = "kotlinCompileTesting" }
kotlinCompileTestingKsp = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version.ref = "kotlinCompileTesting" }
kotlinCoroutinesAndroid = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinCoroutines" }
kotlinCoroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinCoroutines" }
kotlinCoroutinesCore = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" }
-kotlinCoroutinesCore171 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines171" }
kotlinCoroutinesGuava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinCoroutines" }
kotlinCoroutinesPlayServices = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinCoroutines" }
kotlinCoroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinCoroutines" }
kotlinCoroutinesRx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinCoroutines" }
kotlinCoroutinesRx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinCoroutines" }
-kotlinDaemonEmbeddable = { module = "org.jetbrains.kotlin:kotlin-daemon-embeddable", version.ref = "kotlin" }
-kotlinKlibCommonizer = { module = "org.jetbrains.kotlin:kotlin-klib-commonizer", version.ref = "kotlin" }
+kotlinDaemonEmbeddable = { module = "org.jetbrains.kotlin:kotlin-daemon-embeddable" }
+kotlinKlibCommonizer = { module = "org.jetbrains.kotlin:kotlin-klib-commonizer" }
kotlinMetadataJvm = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version = "0.6.2" }
kotlinSerializationCore = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinSerialization" }
kotlinSerializationProtobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinSerialization" }
-kotlinStdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
-kotlinStdlibCommon = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin" }
-kotlinStdlibJdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
-kotlinStdlibJs = { module = "org.jetbrains.kotlin:kotlin-stdlib-js", version.ref = "kotlin" }
kotlinGradlePluginz = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
-kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
-kotlinTestAnnotationsCommon = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" }
-kotlinTestCommon = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlin" }
-kotlinTestJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
-kotlinTestJs = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
-kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
+kotlinStdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" }
+kotlinStdlibCommon = { module = "org.jetbrains.kotlin:kotlin-stdlib-common" }
+kotlinStdlibJdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" }
+kotlinStdlibJs = { module = "org.jetbrains.kotlin:kotlin-stdlib-js" }
+kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test" }
+kotlinTestAnnotationsCommon = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common" }
+kotlinTestCommon = { module = "org.jetbrains.kotlin:kotlin-test-common" }
+kotlinTestJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit" }
+kotlinTestJs = { module = "org.jetbrains.kotlin:kotlin-test-js" }
+kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect" }
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.12.0" }
kotlinPoetJavaPoet = { module = "com.squareup:kotlinpoet-javapoet", version = "1.12.0" }
kotlinXHtml = { module = "org.jetbrains.kotlinx:kotlinx-html-jvm", version = "0.7.3" }
ksp = { module = "com.google.devtools.ksp:symbol-processing", version.ref = "ksp" }
kspApi = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
kspGradlePluginz = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
+ktfmt = { module = "com.facebook:ktfmt", version.ref = "ktfmt" }
kxml2 = { module = "net.sf.kxml:kxml2", version = "2.3.0" }
leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" }
leakcanaryInstrumentation = { module = "com.squareup.leakcanary:leakcanary-android-instrumentation", version.ref = "leakcanary" }
@@ -225,7 +227,7 @@
multidex = { module = "androidx.multidex:multidex", version = "2.0.1" }
nullaway = { module = "com.uber.nullaway:nullaway", version = "0.3.7" }
okhttpMockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version = "3.14.7" }
-okio = { module = "com.squareup.okio:okio", version = "3.1.0" }
+okio = { module = "com.squareup.okio:okio", version = "3.4.0" }
opentest4j = { module = "org.opentest4j:opentest4j", version = "1.2.0" }
playFeatureDelivery = { module = "com.google.android.play:feature-delivery", version = "2.0.1" }
playCore = { module = "com.google.android.play:core", version = "1.10.3" }
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/MultiBufferedCanvasRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/MultiBufferedCanvasRendererTest.kt
index 85138d1..e02e234 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/MultiBufferedCanvasRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/MultiBufferedCanvasRendererTest.kt
@@ -20,6 +20,7 @@
import android.graphics.Color
import android.graphics.ColorSpace
import android.graphics.RenderNode
+import android.hardware.HardwareBuffer
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SdkSuppress
@@ -55,7 +56,7 @@
val renderer = MultiBufferedCanvasRenderer(renderNode, TEST_WIDTH, TEST_HEIGHT)
try {
val renderLatch = CountDownLatch(1)
- renderer.renderFrame(executor) {
+ renderer.renderFrame(executor) { _, _ ->
renderLatch.countDown()
}
assertTrue(renderLatch.await(1000, TimeUnit.MILLISECONDS))
@@ -79,7 +80,7 @@
try {
val renderLatch = CountDownLatch(1)
renderer.release()
- renderer.renderFrame(executor) {
+ renderer.renderFrame(executor) { _, _ ->
renderLatch.countDown()
}
assertFalse(renderLatch.await(1000, TimeUnit.MILLISECONDS))
@@ -124,7 +125,9 @@
try {
val renderLatch = CountDownLatch(1)
var bitmap: Bitmap? = null
- renderer.renderFrame(executor) { buffer ->
+ renderer.renderFrame(executor) { buffer, fence ->
+ fence?.awaitForever()
+ fence?.close()
val colorSpace = ColorSpace.get(ColorSpace.Named.LINEAR_SRGB)
bitmap = Bitmap.wrapHardwareBuffer(buffer, colorSpace)
?.copy(Bitmap.Config.ARGB_8888, false)
@@ -138,4 +141,58 @@
executor.shutdownNow()
}
}
-}
\ No newline at end of file
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
+ @Test
+ fun testRendererBlocksOnBufferRelease() {
+ val renderNode = RenderNode("node").apply {
+ setPosition(0, 0, TEST_WIDTH, TEST_HEIGHT)
+ val canvas = beginRecording()
+ canvas.drawColor(Color.RED)
+ endRecording()
+ }
+ val renderer = MultiBufferedCanvasRenderer(
+ renderNode,
+ TEST_WIDTH,
+ TEST_HEIGHT,
+ maxImages = 2
+ )
+ val executor = Executors.newSingleThreadExecutor()
+ try {
+ val latch1 = CountDownLatch(1)
+ val latch2 = CountDownLatch(1)
+ val latch3 = CountDownLatch(1)
+ var hardwareBuffer: HardwareBuffer? = null
+ renderer.renderFrame(executor) { buffer, fence ->
+ fence?.awaitForever()
+ fence?.close()
+ hardwareBuffer = buffer
+ latch1.countDown()
+ }
+ assertTrue(latch1.await(1000, TimeUnit.MILLISECONDS))
+
+ var canvas = renderNode.beginRecording()
+ canvas.drawColor(Color.BLUE)
+ renderNode.endRecording()
+
+ renderer.renderFrame(executor) { _, _ -> latch2.countDown() }
+
+ assertTrue(latch2.await(1000, TimeUnit.MILLISECONDS))
+
+ canvas = renderNode.beginRecording()
+ canvas.drawColor(Color.GREEN)
+ renderNode.endRecording()
+
+ renderer.renderFrame(executor) { _, _ -> latch3.countDown() }
+
+ // The 3rd render request should be blocked until the buffer is released
+ assertFalse(latch3.await(1000, TimeUnit.MILLISECONDS))
+ assertNotNull(hardwareBuffer)
+ renderer.releaseBuffer(hardwareBuffer!!, null)
+ assertTrue(latch3.await(1000, TimeUnit.MILLISECONDS))
+ } finally {
+ renderer.release()
+ executor.shutdownNow()
+ }
+ }
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/SurfaceTextureRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/SurfaceTextureRendererTest.kt
index 308bfed..61c2797 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/SurfaceTextureRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/SurfaceTextureRendererTest.kt
@@ -191,4 +191,4 @@
handlerThread.quit()
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/TestUtils.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/TestUtils.kt
index 7958b18..6cdfb73 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/TestUtils.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/TestUtils.kt
@@ -119,4 +119,4 @@
egl.release()
Assert.assertEquals(EGLVersion.Unknown, egl.eglVersion)
Assert.assertEquals(EGL14.EGL_NO_CONTEXT, egl.eglContext)
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformHintResolverTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformHintResolverTest.kt
index e7dc260..92aa850 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformHintResolverTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformHintResolverTest.kt
@@ -170,4 +170,4 @@
// Ignore other errors
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformerTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformerTest.kt
index ff9a987..81a9856 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformerTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/BufferTransformerTest.kt
@@ -140,4 +140,4 @@
assertTrue("Index: $i, actual: ${actual[i]} expected: ${expected[i]}", result)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/CanvasFrontBufferedRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/CanvasFrontBufferedRendererTest.kt
index cd8f0ec..c47ca25 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/CanvasFrontBufferedRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/CanvasFrontBufferedRendererTest.kt
@@ -700,7 +700,8 @@
!(Build.MODEL.contains("gphone") &&
(Build.VERSION.SDK_INT == 33 || Build.VERSION.SDK_INT == 30))
+ @OptIn(BuildCompat.PrereleaseSdkCheck::class)
private fun isSupportedCuttlefish() =
!(Build.MODEL.contains("Cuttlefish") &&
(Build.VERSION.SDK_INT == 30 || BuildCompat.isAtLeastV()))
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLFrontBufferedRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLFrontBufferedRendererTest.kt
index 8899880..1923f63 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLFrontBufferedRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLFrontBufferedRendererTest.kt
@@ -1604,4 +1604,4 @@
fail("GLFrontBufferedRenderer is not initialized")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLUtils.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLUtils.kt
index 04d04be..4b2a08c 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLUtils.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/GLUtils.kt
@@ -25,4 +25,4 @@
GLES20.glCompileShader(shader)
return shader
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkCanvasView.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkCanvasView.kt
index 77303ac..79cd6fc 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkCanvasView.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkCanvasView.kt
@@ -28,7 +28,9 @@
class InkCanvasView(context: Context) : SurfaceView(context) {
private var mCanvasFrontBufferedRenderer: CanvasFrontBufferedRenderer<FloatArray>? = null
- private val mLinesDrawable = LinesDrawable()
+ private val mLinesDrawable = LinesDrawable().apply {
+ strokeWidth = 15f
+ }
private val mSceneParams = ArrayList<FloatArray>()
private val mCallbacks = object : CanvasFrontBufferedRenderer.Callback<FloatArray> {
@@ -41,7 +43,8 @@
with(mLinesDrawable) {
setBounds(0, 0, bufferWidth, bufferHeight)
setLines(param)
- setColor(Color.CYAN)
+ setColor(Color.MAGENTA)
+ alpha = 128
draw(canvas)
}
}
@@ -56,6 +59,7 @@
with(mLinesDrawable) {
setBounds(0, 0, bufferWidth, bufferHeight)
setColor(Color.MAGENTA)
+ alpha = 128
for (param in mSceneParams) {
setLines(param)
draw(canvas)
@@ -70,6 +74,7 @@
private var mCurrentY: Float = 0f
init {
+ setZOrderOnTop(true)
setOnTouchListener { _, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
@@ -112,4 +117,4 @@
mCanvasFrontBufferedRenderer?.release(true)
mCanvasFrontBufferedRenderer = null
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkSurfaceView.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkSurfaceView.kt
index 650c29c..3392982 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkSurfaceView.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/InkSurfaceView.kt
@@ -120,6 +120,7 @@
val renderCount = AtomicInteger(0)
init {
+ setZOrderOnTop(true)
setOnTouchListener { _, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
@@ -175,4 +176,4 @@
private companion object {
private const val LINE_WIDTH = 5f
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LineRenderer.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LineRenderer.kt
index 363422b..c583baa 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LineRenderer.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LineRenderer.kt
@@ -157,4 +157,4 @@
}
"""
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LinesDrawable.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LinesDrawable.kt
index 8111e7a..21883f4 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LinesDrawable.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/LinesDrawable.kt
@@ -70,4 +70,4 @@
}
override fun getOpacity(): Int = PixelFormat.TRANSLUCENT
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/ParamQueueTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/ParamQueueTest.kt
index 5ac0c6c..2b0d343 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/ParamQueueTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/ParamQueueTest.kt
@@ -88,4 +88,4 @@
assertEquals(10, count)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/Rectangle.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/Rectangle.kt
index 2b8b469..c34b498 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/Rectangle.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/Rectangle.kt
@@ -155,4 +155,4 @@
val COORDS_PER_VERTEX = 3
val DRAW_ORDER = shortArrayOf(0, 1, 2, 0, 2, 3) // order to draw vertices
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SampleInkViewActivity.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SampleInkViewActivity.kt
index 458ad0c..cc94198 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SampleInkViewActivity.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SampleInkViewActivity.kt
@@ -17,6 +17,7 @@
package androidx.graphics.lowlatency
import android.app.Activity
+import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.view.Gravity
@@ -51,6 +52,7 @@
}
container = FrameLayout(this).apply {
addView(toggle)
+ setBackgroundColor(Color.BLACK)
}
toggleLowLatencyView()
setContentView(container)
@@ -69,4 +71,4 @@
container?.addView(inkView, FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT))
container?.bringChildToFront(toggle)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29Test.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29Test.kt
index 91a0c85..a9ac499 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29Test.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29Test.kt
@@ -392,4 +392,4 @@
assertTrue(latch.await(3000, TimeUnit.MILLISECONDS))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34Test.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34Test.kt
index b1ade98..fab1a46 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34Test.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34Test.kt
@@ -20,8 +20,6 @@
import android.graphics.Color
import android.graphics.ColorSpace
import android.hardware.HardwareBuffer
-import android.os.Build
-import androidx.core.os.BuildCompat
import androidx.graphics.drawSquares
import androidx.graphics.isAllColor
import androidx.graphics.opengl.egl.supportsNativeAndroidFence
@@ -42,7 +40,7 @@
import org.junit.Test
import org.junit.runner.RunWith
-@SdkSuppress(minSdkVersion = Build.VERSION_CODES.KITKAT)
+@SdkSuppress(minSdkVersion = 34)
@RunWith(AndroidJUnit4::class)
@SmallTest
class SingleBufferedCanvasRendererV34Test {
@@ -137,9 +135,6 @@
@Test
fun testClearRenderer() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
val transformer = BufferTransformer().apply {
computeTransform(TEST_WIDTH, TEST_HEIGHT, BUFFER_TRANSFORM_IDENTITY)
}
@@ -190,9 +185,6 @@
@Test
fun testCancelPending() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
val transformer = BufferTransformer().apply {
computeTransform(TEST_WIDTH, TEST_HEIGHT, BUFFER_TRANSFORM_IDENTITY)
}
@@ -250,9 +242,6 @@
@Test
fun testMultiReleasesDoesNotCrash() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
val transformer = BufferTransformer().apply {
computeTransform(TEST_WIDTH, TEST_HEIGHT, BUFFER_TRANSFORM_IDENTITY)
}
@@ -291,9 +280,6 @@
@Test
fun testRendererVisibleFlag() {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
var supportsNativeAndroidFence = false
withEgl { eglManager ->
supportsNativeAndroidFence = eglManager.supportsNativeAndroidFence()
@@ -352,9 +338,6 @@
actualColors: RectColors,
expectedColors: RectColors
) {
- if (!BuildCompat.isAtLeastU()) {
- return
- }
val transformer = BufferTransformer()
transformer.computeTransform(TEST_WIDTH, TEST_HEIGHT, transform)
val executor = Executors.newSingleThreadExecutor()
@@ -410,4 +393,4 @@
assertTrue(latch.await(3000, TimeUnit.MILLISECONDS))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferPoolTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferPoolTest.kt
index 756ab20..c481525 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferPoolTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferPoolTest.kt
@@ -254,4 +254,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferView.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferView.kt
index 98744f6..3e720ada 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferView.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/FrameBufferView.kt
@@ -136,4 +136,4 @@
private companion object {
private const val LINE_WIDTH = 5f
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLFrameBufferRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLFrameBufferRendererTest.kt
index e7f6682..1d69de6 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLFrameBufferRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLFrameBufferRendererTest.kt
@@ -505,4 +505,4 @@
fail("GLFrameBufferRenderer is not initialized")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLRendererTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLRendererTest.kt
index 8d31c50..6798577 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLRendererTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLRendererTest.kt
@@ -1354,4 +1354,4 @@
buffer[0] = texId
GLES20.glDeleteTextures(1, buffer, 0)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLTestActivity.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLTestActivity.kt
index 103c36b..4dce2ce 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLTestActivity.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/GLTestActivity.kt
@@ -47,4 +47,4 @@
setContentView(ll)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SurfaceViewTestActivity.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SurfaceViewTestActivity.kt
index da9d40f..fc1c6c9 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SurfaceViewTestActivity.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SurfaceViewTestActivity.kt
@@ -73,4 +73,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SyncStrategyTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SyncStrategyTest.kt
index 482afc6..a313b17 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SyncStrategyTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/SyncStrategyTest.kt
@@ -97,4 +97,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
index 2f4a0c3..7584030 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
@@ -110,4 +110,4 @@
}
return false
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLExtensionsTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLExtensionsTest.kt
index 15cb5ba..0be57df 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLExtensionsTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLExtensionsTest.kt
@@ -190,4 +190,4 @@
assertTrue(contains(EGL_ANDROID_NATIVE_FENCE_SYNC))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
index 8a8486e..b0ec6e1 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
@@ -776,4 +776,4 @@
assertEquals(EGL14.EGL_NO_CONTEXT, eglContext)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestActivity.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestActivity.kt
index ddbdf2d..dcff5a4 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestActivity.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestActivity.kt
@@ -132,4 +132,4 @@
mAnimator?.cancel()
mGLRenderer.stop(true)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestUtils.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestUtils.kt
index 5098b90..fa5f38b 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestUtils.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLTestUtils.kt
@@ -34,4 +34,4 @@
*/
fun EGLManager.supportsNativeAndroidFence(): Boolean =
isExtensionSupported(EGLExt.EGL_KHR_FENCE_SYNC) &&
- isExtensionSupported(EGLExt.EGL_ANDROID_NATIVE_FENCE_SYNC)
\ No newline at end of file
+ isExtensionSupported(EGLExt.EGL_ANDROID_NATIVE_FENCE_SYNC)
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLVersionTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLVersionTest.kt
index 83cdf96..bbcc352 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLVersionTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLVersionTest.kt
@@ -48,4 +48,4 @@
val hashCode = 31 * 8 + 4
assertEquals(hashCode, EGLVersion(8, 4).hashCode())
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlCompatTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlCompatTest.kt
index de0763d..f0bcbdf 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlCompatTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlCompatTest.kt
@@ -2108,4 +2108,4 @@
assertEquals(EGLVersion.Unknown, egl.eglVersion)
assertEquals(EGL14.EGL_NO_CONTEXT, egl.eglContext)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlUtils.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlUtils.kt
index ead3b1d..4e89941 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlUtils.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/surface/SurfaceControlUtils.kt
@@ -183,4 +183,4 @@
System.loadLibrary("graphics-core")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceCompatTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceCompatTest.kt
index af174be..22e694f 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceCompatTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceCompatTest.kt
@@ -132,4 +132,4 @@
assertEquals(EGL14.EGL_NO_CONTEXT, eglContext)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceV19Test.kt b/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceV19Test.kt
index 7bedd9b..7a0a842 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceV19Test.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/hardware/SyncFenceV19Test.kt
@@ -93,4 +93,4 @@
fun testResolveSyncFileInfoFree() {
assertTrue(SyncFenceBindings.nResolveSyncFileInfoFree())
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/MultiBufferedCanvasRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/MultiBufferedCanvasRenderer.kt
index a9feab6..1fa2a84 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/MultiBufferedCanvasRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/MultiBufferedCanvasRenderer.kt
@@ -21,11 +21,16 @@
import android.graphics.PixelFormat
import android.graphics.RenderNode
import android.hardware.HardwareBuffer
+import android.media.Image
import android.media.ImageReader
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
+import androidx.hardware.SyncFenceCompat
+import androidx.hardware.SyncFenceV33
import java.util.concurrent.Executor
+import java.util.concurrent.locks.ReentrantLock
+import kotlin.concurrent.withLock
/**
* Helper class used to draw RenderNode content into a HardwareBuffer instance. The contents of the
@@ -38,34 +43,61 @@
height: Int,
format: Int = PixelFormat.RGBA_8888,
usage: Long = HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE or HardwareBuffer.USAGE_GPU_COLOR_OUTPUT,
- maxImages: Int = 2
+ maxImages: Int = 3
) {
// PixelFormat.RGBA_8888 should be accepted here but Android Studio flags as a warning
@SuppressLint("WrongConstant")
private val mImageReader = ImageReader.newInstance(width, height, format, maxImages, usage)
private var mHardwareRenderer: HardwareRenderer? = HardwareRenderer().apply {
+ // HardwareRenderer will preserve contents of the buffers if the isOpaque flag is true
+ // otherwise it will clear contents across subsequent renders
+ isOpaque = true
setContentRoot(renderNode)
setSurface(mImageReader.surface)
start()
}
+ /**
+ * Lock used to provide thread safe access to the underlying pool that maps between outstanding
+ * HardwareBuffer instances and the Image it is associated with
+ */
+ private val mBufferLock = ReentrantLock()
+
+ /**
+ * Condition used to signal when an Image is available after it was previously released
+ */
+ private val mBufferSignal = mBufferLock.newCondition()
+
+ /**
+ * Mapping of [HardwareBuffer] instances to the corresponding [Image] they are associated with.
+ * Because [ImageReader] allocates a new [Image] instance each time acquireNextImage is called,
+ * we cannot rely on the fact that the [ImageReader] will cycle through the same [Image]
+ * instances. So instead create a mapping of buffers to Images that will be added to and removed
+ * on each render.
+ */
+ private val mAllocatedBuffers = HashMap<HardwareBuffer, Image>()
+
+ var preserveContents: Boolean = true
+ set(value) {
+ mHardwareRenderer?.isOpaque = value
+ field = value
+ }
+
private var mIsReleased = false
- fun renderFrame(executor: Executor, bufferAvailable: (HardwareBuffer) -> Unit) {
+ fun renderFrame(
+ executor: Executor,
+ bufferAvailable: (HardwareBuffer, SyncFenceCompat?) -> Unit
+ ) {
val renderer = mHardwareRenderer
if (renderer != null && !mIsReleased) {
with(renderer) {
createRenderRequest()
.setFrameCommitCallback(executor) {
- val nextImage = mImageReader.acquireNextImage()
- nextImage?.let { image ->
- val buffer = image.hardwareBuffer
- if (buffer != null) {
- executor.execute {
- bufferAvailable(buffer)
- }
+ acquireBuffer { buffer, fence ->
+ executor.execute {
+ bufferAvailable(buffer, fence)
}
- image.close()
}
}
.syncAndDraw()
@@ -75,8 +107,91 @@
}
}
+ /**
+ * Acquires the next [Image] from the [ImageReader]. This method will block until the
+ * number of outstanding [Image]s acquired is below the maximum number of buffers specified
+ * by maxImages. This is because [ImageReader] will throw exceptions if an additional
+ * [Image] is acquired beyond the maximum amount of buffers.
+ */
+ private inline fun acquireBuffer(block: (HardwareBuffer, SyncFenceCompat?) -> Unit) {
+ mBufferLock.withLock {
+ // Block until the number of outstanding Images is less than the maximum specified
+ while (mAllocatedBuffers.size >= mImageReader.maxImages) {
+ mBufferSignal.await()
+ }
+ val image = mImageReader.acquireNextImage()
+ if (image != null) {
+ // Be sure to call Image#getHardwareBuffer once as each call creates a new java object
+ // and we are relying on referential equality to map the HardwareBuffer back to the
+ // Image that it came from in order to close the Image when the buffer is released
+ val buffer = image.hardwareBuffer
+ if (buffer != null) {
+ // Insert a new mapping of hardware buffer to Image, closing any previous Image
+ // that maybe inserted for the hardware buffer
+ mAllocatedBuffers.put(buffer, image)?.waitAndClose()
+ val fence = image.getFenceCompat()
+ block(buffer, fence)
+ // If we are leveraging single buffered rendering, release the buffer right away
+ if (mImageReader.maxImages == 1) {
+ releaseBuffer(buffer, fence)
+ }
+ } else {
+ // If we do not have a HardwareBuffer associated with this Image, close it
+ // and return null
+ image.waitAndClose()
+ }
+ }
+ }
+ }
+
+ private fun Image.getFenceCompat(): SyncFenceCompat? =
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ ImageVerificationHelper.getFence(this)
+ } else {
+ null
+ }
+
+ private fun Image.waitAndClose() {
+ getFenceCompat()?.let { fence ->
+ fence.awaitForever()
+ fence.close()
+ }
+ close()
+ }
+
+ /**
+ * Release the buffer and close the corresponding [Image] instance to allow for the buffer
+ * to be re-used on a subsequent render
+ */
+ fun releaseBuffer(hardwareBuffer: HardwareBuffer, fence: SyncFenceCompat?) {
+ mBufferLock.withLock {
+ // Remove the mapping of HardwareBuffer to Image and close the Image associated with
+ // this HardwareBuffer instance
+ val image = mAllocatedBuffers.remove(hardwareBuffer)
+ if (image != null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ ImageVerificationHelper.setFence(image, fence)
+ image.close()
+ } else {
+ image.waitAndClose()
+ }
+ }
+ mBufferSignal.signal()
+ }
+ }
+
+ private fun closeBuffers() = mBufferLock.withLock {
+ for (entry in mAllocatedBuffers) {
+ entry.key.close() // HardwareBuffer
+ entry.value.waitAndClose() // Image
+ }
+ mAllocatedBuffers.clear()
+ mBufferSignal.signal()
+ }
+
fun release() {
if (!mIsReleased) {
+ closeBuffers()
mImageReader.close()
mHardwareRenderer?.let { renderer ->
renderer.stop()
@@ -90,4 +205,25 @@
internal companion object {
const val TAG = "MultiBufferRenderer"
}
-}
\ No newline at end of file
+}
+
+/**
+ * Helper class to avoid class verification failures
+ */
+@RequiresApi(Build.VERSION_CODES.TIRAMISU)
+internal class ImageVerificationHelper private constructor() {
+ companion object {
+
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
+ @androidx.annotation.DoNotInline
+ fun getFence(image: Image): SyncFenceCompat = SyncFenceCompat(image.fence)
+
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
+ @androidx.annotation.DoNotInline
+ fun setFence(image: Image, fence: SyncFenceCompat?) {
+ if (fence != null && fence.mImpl is SyncFenceV33) {
+ image.fence = fence.mImpl.mSyncFence
+ }
+ }
+ }
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/SurfaceTextureRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/SurfaceTextureRenderer.kt
index a323ed6..da6c9c0 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/SurfaceTextureRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/SurfaceTextureRenderer.kt
@@ -123,4 +123,4 @@
companion object {
private val TAG = "SurfaceTextureRenderer"
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferInfo.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferInfo.kt
index 862799f..6bfee3e 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferInfo.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferInfo.kt
@@ -57,4 +57,4 @@
*/
var frameBufferId: Int = frameBufferId
internal set
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformHintResolver.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformHintResolver.kt
index 0f8906c..1cda188 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformHintResolver.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformHintResolver.kt
@@ -128,4 +128,4 @@
fun resolveBufferTransformHint(view: View): Int =
view.rootSurfaceControl?.bufferTransformHint ?: 0
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformer.kt
index 6367e09..d9a5fb1 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/BufferTransformer.kt
@@ -96,4 +96,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/CanvasFrontBufferedRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/CanvasFrontBufferedRenderer.kt
index 08f5c9e..26edcfb 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/CanvasFrontBufferedRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/CanvasFrontBufferedRenderer.kt
@@ -31,6 +31,7 @@
import androidx.graphics.MultiBufferedCanvasRenderer
import androidx.graphics.surface.SurfaceControlCompat
import androidx.hardware.SyncFenceCompat
+import java.util.Collections
import java.util.concurrent.CountDownLatch
import java.util.concurrent.Executors
@@ -128,15 +129,12 @@
private var inverse = BufferTransformHintResolver.UNKNOWN_TRANSFORM
private val mBufferTransform = BufferTransformer()
private val mParentLayerTransform = android.graphics.Matrix()
+ private var mWidth = -1
+ private var mHeight = -1
+ private var mTransform = BufferTransformHintResolver.UNKNOWN_TRANSFORM
+ private val mTransformResolver = BufferTransformHintResolver()
private val mHolderCallback = object : SurfaceHolder.Callback2 {
- private var mWidth = -1
- private var mHeight = -1
-
- private var transformHint = BufferTransformHintResolver.UNKNOWN_TRANSFORM
-
- private val mTransformResolver = BufferTransformHintResolver()
-
override fun surfaceCreated(p0: SurfaceHolder) {
// NO-OP
}
@@ -147,10 +145,47 @@
width: Int,
height: Int
) {
+ update(surfaceView, width, height)
+ }
+
+ override fun surfaceDestroyed(p0: SurfaceHolder) {
+ releaseInternal(true)
+ }
+
+ override fun surfaceRedrawNeeded(holder: SurfaceHolder) {
+ val latch = CountDownLatch(1)
+ renderMultiBufferedLayerInternal {
+ latch.countDown()
+ }
+ latch.await()
+ }
+
+ override fun surfaceRedrawNeededAsync(
+ holder: SurfaceHolder,
+ drawingFinished: Runnable
+ ) {
+ renderMultiBufferedLayerInternal(callback = drawingFinished)
+ }
+ }
+
+ init {
+ surfaceView.holder.addCallback(mHolderCallback)
+ with(surfaceView.holder) {
+ if (surface != null && surface.isValid) {
+ update(surfaceView, surfaceView.width, surfaceView.height)
+ renderMultiBufferedLayerInternal()
+ }
+ }
+ }
+
+ internal fun update(surfaceView: SurfaceView, width: Int, height: Int) {
+ val transformHint = mTransformResolver.getBufferTransformHint(surfaceView)
+ if ((mTransform != transformHint || mWidth != width || mHeight != height) && isValid()) {
+ mTransform = transformHint
mWidth = width
mHeight = height
releaseInternal(true)
- transformHint = mTransformResolver.getBufferTransformHint(surfaceView)
+
inverse = mBufferTransform.invertBufferTransform(transformHint)
mBufferTransform.computeTransform(width, height, inverse)
updateMatrixTransform(width.toFloat(), height.toFloat(), inverse)
@@ -219,8 +254,9 @@
mMultiBufferedCanvasRenderer = MultiBufferedCanvasRenderer(
multiBufferNode,
mBufferTransform.glWidth,
- mBufferTransform.glHeight
- )
+ mBufferTransform.glHeight,
+ usage = FrontBufferUtils.BaseFlags
+ ).apply { preserveContents = false }
mFrontBufferSurfaceControl = SurfaceControlCompat.Builder()
.setParent(parentSurfaceControl)
@@ -229,36 +265,6 @@
mParentSurfaceControl = parentSurfaceControl
}
-
- override fun surfaceDestroyed(p0: SurfaceHolder) {
- releaseInternal(true)
- }
-
- override fun surfaceRedrawNeeded(holder: SurfaceHolder) {
- val latch = CountDownLatch(1)
- surfaceRedrawNeededAsync(holder) {
- latch.countDown()
- }
- latch.await()
- }
-
- override fun surfaceRedrawNeededAsync(
- holder: SurfaceHolder,
- drawingFinished: Runnable
- ) {
- val renderer = mMultiBufferedCanvasRenderer
- if (renderer != null) {
- renderer.renderFrame(mExecutor) { buffer ->
- setParentSurfaceControlBuffer(buffer, drawingFinished)
- }
- } else {
- drawingFinished.run()
- }
- }
- }
-
- init {
- surfaceView.holder.addCallback(mHolderCallback)
}
private inline fun RenderNode.record(block: (canvas: Canvas) -> Unit): RenderNode {
@@ -311,12 +317,23 @@
* [Callback.onDrawMultiBufferedLayer]
*/
fun renderMultiBufferedLayer(params: Collection<T>) {
+ renderMultiBufferedLayerInternal(params)
+ }
+
+ /**
+ * Helper method to commit contents to the multi buffered layer invoking an optional
+ * callback when rendering is complete
+ */
+ internal fun renderMultiBufferedLayerInternal(
+ params: Collection<T> = Collections.emptyList(),
+ callback: Runnable? = null
+ ) {
if (isValid()) {
mParams.addAll(params)
- commit()
+ commitInternal(callback)
} else {
Log.w(TAG, "Attempt to render to the multi buffered layer when " +
- "CanvasFrontBufferedRenderer has been released"
+ "CanvasFrontBufferedRenderer has been released"
)
}
}
@@ -332,10 +349,7 @@
fun isValid() = !mIsReleased
@SuppressLint("WrongConstant")
- internal fun setParentSurfaceControlBuffer(
- buffer: HardwareBuffer,
- block: Runnable? = null
- ) {
+ internal fun setParentSurfaceControlBuffer(buffer: HardwareBuffer, fence: SyncFenceCompat?) {
val frontBufferSurfaceControl = mFrontBufferSurfaceControl
val parentSurfaceControl = mParentSurfaceControl
if (frontBufferSurfaceControl != null && parentSurfaceControl != null) {
@@ -346,36 +360,13 @@
// gets invoked and we can clear the content of the front buffer
.setBuffer(frontBufferSurfaceControl, null)
.setVisibility(parentSurfaceControl, true)
- .setBuffer(parentSurfaceControl, buffer) { releaseFence ->
- releaseFence.awaitForever()
- buffer.close()
+ .setBuffer(parentSurfaceControl, buffer, fence) { releaseFence ->
+ mMultiBufferedCanvasRenderer?.releaseBuffer(buffer, releaseFence)
}
if (inverse != BufferTransformHintResolver.UNKNOWN_TRANSFORM) {
transaction.setBufferTransform(parentSurfaceControl, inverse)
}
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
- val listener = if (block != null) {
- object : SurfaceControlCompat.TransactionCommittedListener {
- override fun onTransactionCommitted() {
- mCommitListener.onTransactionCommitted()
- block.run()
- }
- }
- } else {
- mCommitListener
- }
- transaction.addTransactionCommittedListener(mExecutor, listener)
- } else {
- if (block != null) {
- mExecutor.execute {
- mCommitRunnable.run()
- block.run()
- }
- } else {
- mExecutor.execute(mCommitRunnable)
- }
- }
callback.onMultiBufferedLayerRenderComplete(
frontBufferSurfaceControl, transaction)
transaction.commit()
@@ -394,6 +385,14 @@
* this call is ignored.
*/
fun commit() {
+ commitInternal()
+ }
+
+ /**
+ * Helper method to commit contents to the multi buffered layer, invoking an optional
+ * callback on completion
+ */
+ private fun commitInternal(onComplete: Runnable? = null) {
if (isValid()) {
mPersistedCanvasRenderer?.cancelPending()
val params = mParams
@@ -405,19 +404,18 @@
mMultiBufferNode?.record { canvas ->
canvas.save()
canvas.setMatrix(mParentLayerTransform)
- // clear previous renderings to the multi buffered content
- canvas.drawColor(Color.BLACK, BlendMode.CLEAR)
callback.onDrawMultiBufferedLayer(canvas, width, height, params)
canvas.restore()
}
params.clear()
- mMultiBufferedCanvasRenderer?.renderFrame(mExecutor) { buffer ->
- setParentSurfaceControlBuffer(buffer)
+ mMultiBufferedCanvasRenderer?.renderFrame(mExecutor) { buffer, fence ->
+ setParentSurfaceControlBuffer(buffer, fence)
+ onComplete?.run()
}
}
} else {
Log.w(TAG, "Attempt to render to the multi buffered layer when " +
- "CanvasFrontBufferedRenderer has been released"
+ "CanvasFrontBufferedRenderer has been released"
)
}
}
@@ -466,16 +464,6 @@
}
}
- private val mCommitListener = object : SurfaceControlCompat.TransactionCommittedListener {
- override fun onTransactionCommitted() {
- mPersistedCanvasRenderer?.clear()
- }
- }
-
- private val mCommitRunnable = Runnable {
- mPersistedCanvasRenderer?.clear()
- }
-
internal fun releaseInternal(cancelPending: Boolean, releaseCallback: (() -> Unit)? = null) {
mPersistedCanvasRenderer?.release(cancelPending) {
mMultiBufferNode?.discardDisplayList()
@@ -488,6 +476,9 @@
mParentSurfaceControl = null
mPersistedCanvasRenderer = null
mMultiBufferedCanvasRenderer = null
+ mWidth = -1
+ mHeight = -1
+ mTransform = BufferTransformHintResolver.UNKNOWN_TRANSFORM
releaseCallback?.invoke()
}
}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferSyncStrategy.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferSyncStrategy.kt
index a7579b7..b500c89 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferSyncStrategy.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferSyncStrategy.kt
@@ -78,4 +78,4 @@
return null
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferUtils.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferUtils.kt
index d70cbbf..6d20ece 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferUtils.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/FrontBufferUtils.kt
@@ -101,4 +101,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/GLFrontBufferedRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/GLFrontBufferedRenderer.kt
index 3d85d7d..692c161 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/GLFrontBufferedRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/GLFrontBufferedRenderer.kt
@@ -822,4 +822,4 @@
// Default implementation is a no-op
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/ParamQueue.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/ParamQueue.kt
index 167bd13..85538b9 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/ParamQueue.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/ParamQueue.kt
@@ -84,4 +84,4 @@
fun count(): Int = mLock.withLock { mParams.size }
fun isEmpty() = count() == 0
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRenderer.kt
index ffc799b..3c35ea7 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRenderer.kt
@@ -19,10 +19,8 @@
import android.graphics.Canvas
import android.hardware.HardwareBuffer
import android.os.Build
-import androidx.annotation.OptIn
import androidx.annotation.RequiresApi
import androidx.annotation.WorkerThread
-import androidx.core.os.BuildCompat
import androidx.hardware.SyncFenceCompat
import java.util.concurrent.Executor
@@ -70,7 +68,6 @@
companion object {
- @OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
fun <T> create(
width: Int,
height: Int,
@@ -78,7 +75,7 @@
executor: Executor,
bufferReadyListener: RenderCallbacks<T>
): SingleBufferedCanvasRenderer<T> {
- return if (BuildCompat.isAtLeastU()) {
+ return if (Build.VERSION.SDK_INT >= 34) {
SingleBufferedCanvasRendererV34(
width,
height,
@@ -97,4 +94,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29.kt
index 2c2fe10..e59b31e 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV29.kt
@@ -75,6 +75,7 @@
mRenderNode,
bufferTransformer.glWidth,
bufferTransformer.glHeight,
+ usage = FrontBufferUtils.obtainHardwareBufferUsageFlags(),
maxImages = 1
)
@@ -99,8 +100,8 @@
canvasOperations(canvas)
mRenderNode.endRecording()
mPendingDraw = true
- mBufferedRenderer.renderFrame(executor) { hardwareBuffer ->
- callbacks.onBufferReady(hardwareBuffer, null)
+ mBufferedRenderer.renderFrame(executor) { hardwareBuffer, fence ->
+ callbacks.onBufferReady(hardwareBuffer, fence)
mPendingDraw = false
onDrawComplete.invoke()
}
@@ -136,6 +137,10 @@
private fun isPendingDraw() = mPendingDraw || mPendingParams.isNotEmpty()
override var isVisible: Boolean = false
+ set(value) {
+ mBufferedRenderer.preserveContents = isVisible
+ field = value
+ }
@WorkerThread // Executor thread
private fun tearDown() {
@@ -197,4 +202,4 @@
const val CLEAR = 1
const val RELEASE = 2
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34.kt
index 114a8c2..7835f75 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/SingleBufferedCanvasRendererV34.kt
@@ -157,4 +157,4 @@
private fun Handler.post(token: Any?, runnable: Runnable) {
postAtTime(runnable, token, SystemClock.uptimeMillis())
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/TextureProducer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/TextureProducer.kt
index a632a1b..8a04c56 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/TextureProducer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/lowlatency/TextureProducer.kt
@@ -187,4 +187,4 @@
*/
const val MAX_PENDING_RENDERS = 2
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBuffer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBuffer.kt
index 666a63a..4d90416 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBuffer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBuffer.kt
@@ -110,4 +110,4 @@
isClosed = true
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBufferPool.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBufferPool.kt
index 4f44af4..186c521 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBufferPool.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/FrameBufferPool.kt
@@ -244,4 +244,4 @@
return fallback
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLFrameBufferRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLFrameBufferRenderer.kt
index ebf738c..14277ec 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLFrameBufferRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLFrameBufferRenderer.kt
@@ -817,4 +817,4 @@
internal const val DefaultNumBuffers = 3
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLThread.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLThread.kt
index d492781..afd433b 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLThread.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLThread.kt
@@ -402,4 +402,4 @@
*/
var height: Int = 0
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/QuadTextureRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/QuadTextureRenderer.kt
index f838ec4..80e132a 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/QuadTextureRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/QuadTextureRenderer.kt
@@ -328,4 +328,4 @@
GLES20.glCompileShader(shader)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
index 1852fbb..4adbd70 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
@@ -204,4 +204,4 @@
EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLManager.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLManager.kt
index 37438b5..0c02bf5 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLManager.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLManager.kt
@@ -247,4 +247,4 @@
companion object {
private const val TAG = "EglManager"
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLSpec.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLSpec.kt
index 53c24d27..97d6f65 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLSpec.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLSpec.kt
@@ -602,4 +602,4 @@
@JvmField
val Unknown = EGLVersion(-1, -1)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlCompat.kt b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlCompat.kt
index d7af2c2..0413291 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlCompat.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlCompat.kt
@@ -520,7 +520,7 @@
*
* Must be finite && >= 1.0f
* @return this
- **/
+ */
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
fun setExtendedRangeBrightness(
surfaceControl: SurfaceControlCompat,
@@ -624,4 +624,4 @@
@androidx.annotation.DoNotInline
fun createTransactionV29(): SurfaceControlImpl.Transaction = SurfaceControlV29.Transaction()
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlImpl.kt b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlImpl.kt
index 000acae..dc5db9e 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlImpl.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlImpl.kt
@@ -352,4 +352,4 @@
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
fun commitTransactionOnDraw(attachedSurfaceControl: AttachedSurfaceControl)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV29.kt b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV29.kt
index a30c654..86d25c2 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV29.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV29.kt
@@ -462,4 +462,4 @@
throw IllegalArgumentException("Parent implementation is only for Android T+.")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV33.kt b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV33.kt
index caf7b44..365cffd 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV33.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlV33.kt
@@ -367,4 +367,4 @@
fun setDataSpace(transaction: Transaction, surfaceControl: SurfaceControl, dataspace: Int) {
transaction.setDataSpace(surfaceControl, dataspace)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlWrapper.kt b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlWrapper.kt
index 314a641..88a178d 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlWrapper.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/surface/SurfaceControlWrapper.kt
@@ -738,4 +738,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/utils/HandlerUtils.kt b/graphics/graphics-core/src/main/java/androidx/graphics/utils/HandlerUtils.kt
index 9698f11..7dfb466 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/utils/HandlerUtils.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/utils/HandlerUtils.kt
@@ -26,4 +26,4 @@
*/
internal fun Handler.post(token: Any?, runnable: Runnable) {
postAtTime(runnable, token, SystemClock.uptimeMillis())
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceBindings.kt b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceBindings.kt
index 2e6cec8..e424347 100644
--- a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceBindings.kt
+++ b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceBindings.kt
@@ -38,4 +38,4 @@
System.loadLibrary("graphics-core")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceCompat.kt b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceCompat.kt
index 64cb8a1..581b0b2 100644
--- a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceCompat.kt
+++ b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceCompat.kt
@@ -165,4 +165,4 @@
return syncFenceCompat
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceImpl.kt b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceImpl.kt
index a460188..3185a75 100644
--- a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceImpl.kt
+++ b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceImpl.kt
@@ -50,4 +50,4 @@
* @return `true` if it is valid, `false` otherwise
*/
fun isValid(): Boolean
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV19.kt b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV19.kt
index f1360dd..072bf30 100644
--- a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV19.kt
+++ b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV19.kt
@@ -147,4 +147,4 @@
System.loadLibrary("graphics-core")
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV33.kt b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV33.kt
index 86bc660f..9b80920 100644
--- a/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV33.kt
+++ b/graphics/graphics-core/src/main/java/androidx/hardware/SyncFenceV33.kt
@@ -60,4 +60,4 @@
override fun isValid(): Boolean {
return mSyncFence.isValid
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/opengl/EGLExt.kt b/graphics/graphics-core/src/main/java/androidx/opengl/EGLExt.kt
index 958011a..b851c5d 100644
--- a/graphics/graphics-core/src/main/java/androidx/opengl/EGLExt.kt
+++ b/graphics/graphics-core/src/main/java/androidx/opengl/EGLExt.kt
@@ -752,4 +752,4 @@
@androidx.annotation.DoNotInline
fun getNativeHandle(eglDisplay: EGLDisplay): Long = eglDisplay.nativeHandle
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/opengl/EGLHandle.kt b/graphics/graphics-core/src/main/java/androidx/opengl/EGLHandle.kt
index e799fb7..c091af01 100644
--- a/graphics/graphics-core/src/main/java/androidx/opengl/EGLHandle.kt
+++ b/graphics/graphics-core/src/main/java/androidx/opengl/EGLHandle.kt
@@ -30,4 +30,4 @@
* @return the native handle of the wrapped EGL object.
*/
val nativeHandle: Long
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/opengl/EGLImageKHR.kt b/graphics/graphics-core/src/main/java/androidx/opengl/EGLImageKHR.kt
index 3a27e89..282d70c 100644
--- a/graphics/graphics-core/src/main/java/androidx/opengl/EGLImageKHR.kt
+++ b/graphics/graphics-core/src/main/java/androidx/opengl/EGLImageKHR.kt
@@ -41,4 +41,4 @@
override fun toString(): String {
return "EGLImageKHR(nativeHandle=$nativeHandle)"
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-core/src/main/java/androidx/opengl/EGLSyncKHR.kt b/graphics/graphics-core/src/main/java/androidx/opengl/EGLSyncKHR.kt
index 262dfbc..bc5e8cb 100644
--- a/graphics/graphics-core/src/main/java/androidx/opengl/EGLSyncKHR.kt
+++ b/graphics/graphics-core/src/main/java/androidx/opengl/EGLSyncKHR.kt
@@ -39,4 +39,4 @@
override fun toString(): String {
return "EGLSyncKHR(nativeHandle=$nativeHandle)"
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-path/api/current.txt b/graphics/graphics-path/api/current.txt
index 46797f0..fa843fa 100644
--- a/graphics/graphics-path/api/current.txt
+++ b/graphics/graphics-path/api/current.txt
@@ -1,7 +1,7 @@
// Signature format: 4.0
package androidx.graphics.path {
- @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public final class PathIterator implements java.util.Iterator<androidx.graphics.path.PathSegment> kotlin.jvm.internal.markers.KMappedMarker {
+ public final class PathIterator implements java.util.Iterator<androidx.graphics.path.PathSegment> kotlin.jvm.internal.markers.KMappedMarker {
ctor public PathIterator(android.graphics.Path path, optional androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
method public int calculateSize(optional boolean includeConvertedConics);
method public androidx.graphics.path.PathIterator.ConicEvaluation getConicEvaluation();
@@ -53,8 +53,8 @@
}
public final class PathUtilities {
- method @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static operator androidx.graphics.path.PathIterator iterator(android.graphics.Path);
- method @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static androidx.graphics.path.PathIterator iterator(android.graphics.Path, androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
+ method public static operator androidx.graphics.path.PathIterator iterator(android.graphics.Path);
+ method public static androidx.graphics.path.PathIterator iterator(android.graphics.Path, androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
}
}
diff --git a/graphics/graphics-path/api/restricted_current.txt b/graphics/graphics-path/api/restricted_current.txt
index 46797f0..fa843fa 100644
--- a/graphics/graphics-path/api/restricted_current.txt
+++ b/graphics/graphics-path/api/restricted_current.txt
@@ -1,7 +1,7 @@
// Signature format: 4.0
package androidx.graphics.path {
- @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public final class PathIterator implements java.util.Iterator<androidx.graphics.path.PathSegment> kotlin.jvm.internal.markers.KMappedMarker {
+ public final class PathIterator implements java.util.Iterator<androidx.graphics.path.PathSegment> kotlin.jvm.internal.markers.KMappedMarker {
ctor public PathIterator(android.graphics.Path path, optional androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
method public int calculateSize(optional boolean includeConvertedConics);
method public androidx.graphics.path.PathIterator.ConicEvaluation getConicEvaluation();
@@ -53,8 +53,8 @@
}
public final class PathUtilities {
- method @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static operator androidx.graphics.path.PathIterator iterator(android.graphics.Path);
- method @SuppressCompatibility @androidx.core.os.BuildCompat.PrereleaseSdkCheck public static androidx.graphics.path.PathIterator iterator(android.graphics.Path, androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
+ method public static operator androidx.graphics.path.PathIterator iterator(android.graphics.Path);
+ method public static androidx.graphics.path.PathIterator iterator(android.graphics.Path, androidx.graphics.path.PathIterator.ConicEvaluation conicEvaluation, optional float tolerance);
}
}
diff --git a/graphics/graphics-path/src/main/java/androidx/graphics/path/ConicConverter.kt b/graphics/graphics-path/src/main/java/androidx/graphics/path/ConicConverter.kt
index 445bd47..c273201 100644
--- a/graphics/graphics-path/src/main/java/androidx/graphics/path/ConicConverter.kt
+++ b/graphics/graphics-path/src/main/java/androidx/graphics/path/ConicConverter.kt
@@ -99,4 +99,4 @@
tolerance: Float,
offset: Int
): Int
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIterator.kt b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIterator.kt
index 6567419..51eafd7 100644
--- a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIterator.kt
+++ b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIterator.kt
@@ -17,8 +17,7 @@
package androidx.graphics.path
import android.graphics.Path
-import androidx.core.os.BuildCompat
-import androidx.core.os.BuildCompat.PrereleaseSdkCheck
+import android.os.Build
/**
* A path iterator can be used to iterate over all the [segments][PathSegment] that make up
@@ -31,7 +30,6 @@
* [PathIterator], call one of the two [Path.iterator] extension functions.
*/
@Suppress("NotCloseable", "IllegalExperimentalApiUsage")
-@PrereleaseSdkCheck
class PathIterator constructor(
val path: Path,
val conicEvaluation: ConicEvaluation = ConicEvaluation.AsQuadratics,
@@ -42,9 +40,7 @@
init {
implementation =
when {
- // TODO: replace isAtLeastU() check with below or similar when U is released
- // Build.VERSION.SDK_INT >= 34 -> {
- BuildCompat.isAtLeastU() -> {
+ Build.VERSION.SDK_INT >= 34 -> {
PathIteratorApi34Impl(path, conicEvaluation, tolerance)
}
else -> {
@@ -131,8 +127,6 @@
* conics as quadratics. To preserve conics, use the [Path.iterator] function that takes a
* [PathIterator.ConicEvaluation] parameter.
*/
-@Suppress("IllegalExperimentalApiUsage")
-@PrereleaseSdkCheck
operator fun Path.iterator() = PathIterator(this)
/**
@@ -140,7 +134,5 @@
* conics (not convert them to quadratics), set [conicEvaluation] to
* [PathIterator.ConicEvaluation.AsConic].
*/
-@Suppress("IllegalExperimentalApiUsage")
-@PrereleaseSdkCheck
fun Path.iterator(conicEvaluation: PathIterator.ConicEvaluation, tolerance: Float = 0.25f) =
PathIterator(this, conicEvaluation, tolerance)
diff --git a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIteratorImpl.kt b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIteratorImpl.kt
index 65fa2c1..1d88342 100644
--- a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIteratorImpl.kt
+++ b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathIteratorImpl.kt
@@ -20,7 +20,6 @@
import android.graphics.PathIterator as PlatformPathIterator
import android.graphics.PointF
import androidx.annotation.RequiresApi
-import androidx.core.os.BuildCompat
import androidx.graphics.path.PathIterator.ConicEvaluation
/**
@@ -29,7 +28,6 @@
* to perform conic conversion.
*/
@Suppress("IllegalExperimentalApiUsage")
-@BuildCompat.PrereleaseSdkCheck
internal abstract class PathIteratorImpl(
val path: Path,
val conicEvaluation: ConicEvaluation = ConicEvaluation.AsQuadratics,
@@ -154,8 +152,6 @@
* [calculateSize], which is implemented here.
*/
@RequiresApi(34)
-@Suppress("IllegalExperimentalApiUsage")
-@BuildCompat.PrereleaseSdkCheck
internal class PathIteratorApi34Impl(
path: Path,
conicEvaluation: ConicEvaluation = ConicEvaluation.AsQuadratics,
@@ -242,8 +238,6 @@
* structure). But if the caller wants conic conversion, then we need to iterate through
* and convert appropriately, counting as we iterate.
*/
-@Suppress("IllegalExperimentalApiUsage")
-@BuildCompat.PrereleaseSdkCheck
internal class PathIteratorPreApi34Impl(
path: Path,
conicEvaluation: ConicEvaluation = ConicEvaluation.AsQuadratics,
@@ -338,4 +332,4 @@
protected fun finalize() {
destroyInternalPathIterator(internalPathIterator)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathSegment.kt b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathSegment.kt
index 863d6d0..1817d07 100644
--- a/graphics/graphics-path/src/main/java/androidx/graphics/path/PathSegment.kt
+++ b/graphics/graphics-path/src/main/java/androidx/graphics/path/PathSegment.kt
@@ -140,4 +140,4 @@
/**
* Cache of [PathSegment.Type] values to avoid internal allocation on each use.
*/
-internal val pathSegmentTypes = PathSegment.Type.values()
\ No newline at end of file
+internal val pathSegmentTypes = PathSegment.Type.values()
diff --git a/graphics/graphics-shapes/api/current.txt b/graphics/graphics-shapes/api/current.txt
index 826e6be..315aaf1 100644
--- a/graphics/graphics-shapes/api/current.txt
+++ b/graphics/graphics-shapes/api/current.txt
@@ -15,37 +15,45 @@
}
public final class Cubic {
- ctor public Cubic(android.graphics.PointF p0, android.graphics.PointF p1, android.graphics.PointF p2, android.graphics.PointF p3);
ctor public Cubic(androidx.graphics.shapes.Cubic cubic);
- method public static androidx.graphics.shapes.Cubic circularArc(android.graphics.PointF center, android.graphics.PointF p0, android.graphics.PointF p1);
+ ctor public Cubic(float anchorX0, float anchorY0, float controlX0, float controlY0, float controlX1, float controlY1, float anchorX1, float anchorY1);
+ method public static androidx.graphics.shapes.Cubic circularArc(float centerX, float centerY, float x0, float y0, float x1, float y1);
method public operator androidx.graphics.shapes.Cubic div(float x);
method public operator androidx.graphics.shapes.Cubic div(int x);
- method public android.graphics.PointF getP0();
- method public android.graphics.PointF getP1();
- method public android.graphics.PointF getP2();
- method public android.graphics.PointF getP3();
+ method public float getAnchorX0();
+ method public float getAnchorX1();
+ method public float getAnchorY0();
+ method public float getAnchorY1();
+ method public float getControlX0();
+ method public float getControlX1();
+ method public float getControlY0();
+ method public float getControlY1();
method public static androidx.graphics.shapes.Cubic interpolate(androidx.graphics.shapes.Cubic start, androidx.graphics.shapes.Cubic end, float t);
method public operator androidx.graphics.shapes.Cubic plus(androidx.graphics.shapes.Cubic o);
method public android.graphics.PointF pointOnCurve(float t);
method public android.graphics.PointF pointOnCurve(float t, optional android.graphics.PointF result);
method public androidx.graphics.shapes.Cubic reverse();
method public kotlin.Pair<androidx.graphics.shapes.Cubic,androidx.graphics.shapes.Cubic> split(float t);
- method public static androidx.graphics.shapes.Cubic straightLine(android.graphics.PointF p0, android.graphics.PointF p1);
+ method public static androidx.graphics.shapes.Cubic straightLine(float x0, float y0, float x1, float y1);
method public operator androidx.graphics.shapes.Cubic times(float x);
method public operator androidx.graphics.shapes.Cubic times(int x);
method public void transform(android.graphics.Matrix matrix);
method public void transform(android.graphics.Matrix matrix, optional float[] points);
- property public final android.graphics.PointF p0;
- property public final android.graphics.PointF p1;
- property public final android.graphics.PointF p2;
- property public final android.graphics.PointF p3;
+ property public final float anchorX0;
+ property public final float anchorX1;
+ property public final float anchorY0;
+ property public final float anchorY1;
+ property public final float controlX0;
+ property public final float controlX1;
+ property public final float controlY0;
+ property public final float controlY1;
field public static final androidx.graphics.shapes.Cubic.Companion Companion;
}
public static final class Cubic.Companion {
- method public androidx.graphics.shapes.Cubic circularArc(android.graphics.PointF center, android.graphics.PointF p0, android.graphics.PointF p1);
+ method public androidx.graphics.shapes.Cubic circularArc(float centerX, float centerY, float x0, float y0, float x1, float y1);
method public androidx.graphics.shapes.Cubic interpolate(androidx.graphics.shapes.Cubic start, androidx.graphics.shapes.Cubic end, float t);
- method public androidx.graphics.shapes.Cubic straightLine(android.graphics.PointF p0, android.graphics.PointF p1);
+ method public androidx.graphics.shapes.Cubic straightLine(float x0, float y0, float x1, float y1);
}
public final class CubicShape {
@@ -66,32 +74,32 @@
public final class Morph {
ctor public Morph(androidx.graphics.shapes.RoundedPolygon start, androidx.graphics.shapes.RoundedPolygon end);
- method public java.util.List<androidx.graphics.shapes.Cubic> asCubics();
- method public android.graphics.Path asPath();
+ method public java.util.List<androidx.graphics.shapes.Cubic> asCubics(float progress);
+ method public android.graphics.Path asPath(float progress);
+ method public android.graphics.Path asPath(float progress, optional android.graphics.Path path);
method public android.graphics.RectF getBounds();
- method public float getProgress();
- method public void setProgress(float);
method public void transform(android.graphics.Matrix matrix);
property public final android.graphics.RectF bounds;
- property public final float progress;
}
public final class MorphKt {
- method public static void drawMorph(android.graphics.Canvas, androidx.graphics.shapes.Morph morph, android.graphics.Paint paint);
+ method public static void drawMorph(android.graphics.Canvas, androidx.graphics.shapes.Morph morph, android.graphics.Paint paint, optional float progress);
}
public final class RoundedPolygon {
ctor public RoundedPolygon(androidx.graphics.shapes.RoundedPolygon source);
- ctor public RoundedPolygon(@IntRange(from=3L) int numVertices, optional float radius, optional android.graphics.PointF center, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
- ctor public RoundedPolygon(java.util.List<? extends android.graphics.PointF> vertices, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF? center);
+ ctor public RoundedPolygon(float[] vertices, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
+ ctor public RoundedPolygon(@IntRange(from=3L) int numVertices, optional float radius, optional float centerX, optional float centerY, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
method public android.graphics.RectF getBounds();
- method public android.graphics.PointF getCenter();
+ method public float getCenterX();
+ method public float getCenterY();
method public void setBounds(android.graphics.RectF);
method public androidx.graphics.shapes.CubicShape toCubicShape();
method public android.graphics.Path toPath();
method public void transform(android.graphics.Matrix matrix);
property public final android.graphics.RectF bounds;
- property public final android.graphics.PointF center;
+ property public final float centerX;
+ property public final float centerY;
field public static final androidx.graphics.shapes.RoundedPolygon.Companion Companion;
}
@@ -106,15 +114,17 @@
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion);
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices);
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius);
- method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional android.graphics.PointF center);
- method public static androidx.graphics.shapes.RoundedPolygon rectangle(androidx.graphics.shapes.RoundedPolygon.Companion, optional float width, optional float height, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF center);
+ method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional float centerX);
+ method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional float centerX, optional float centerY);
+ method public static androidx.graphics.shapes.RoundedPolygon rectangle(androidx.graphics.shapes.RoundedPolygon.Companion, optional float width, optional float height, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
- method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF center);
+ method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX);
+ method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
}
}
diff --git a/graphics/graphics-shapes/api/restricted_current.txt b/graphics/graphics-shapes/api/restricted_current.txt
index 826e6be..315aaf1 100644
--- a/graphics/graphics-shapes/api/restricted_current.txt
+++ b/graphics/graphics-shapes/api/restricted_current.txt
@@ -15,37 +15,45 @@
}
public final class Cubic {
- ctor public Cubic(android.graphics.PointF p0, android.graphics.PointF p1, android.graphics.PointF p2, android.graphics.PointF p3);
ctor public Cubic(androidx.graphics.shapes.Cubic cubic);
- method public static androidx.graphics.shapes.Cubic circularArc(android.graphics.PointF center, android.graphics.PointF p0, android.graphics.PointF p1);
+ ctor public Cubic(float anchorX0, float anchorY0, float controlX0, float controlY0, float controlX1, float controlY1, float anchorX1, float anchorY1);
+ method public static androidx.graphics.shapes.Cubic circularArc(float centerX, float centerY, float x0, float y0, float x1, float y1);
method public operator androidx.graphics.shapes.Cubic div(float x);
method public operator androidx.graphics.shapes.Cubic div(int x);
- method public android.graphics.PointF getP0();
- method public android.graphics.PointF getP1();
- method public android.graphics.PointF getP2();
- method public android.graphics.PointF getP3();
+ method public float getAnchorX0();
+ method public float getAnchorX1();
+ method public float getAnchorY0();
+ method public float getAnchorY1();
+ method public float getControlX0();
+ method public float getControlX1();
+ method public float getControlY0();
+ method public float getControlY1();
method public static androidx.graphics.shapes.Cubic interpolate(androidx.graphics.shapes.Cubic start, androidx.graphics.shapes.Cubic end, float t);
method public operator androidx.graphics.shapes.Cubic plus(androidx.graphics.shapes.Cubic o);
method public android.graphics.PointF pointOnCurve(float t);
method public android.graphics.PointF pointOnCurve(float t, optional android.graphics.PointF result);
method public androidx.graphics.shapes.Cubic reverse();
method public kotlin.Pair<androidx.graphics.shapes.Cubic,androidx.graphics.shapes.Cubic> split(float t);
- method public static androidx.graphics.shapes.Cubic straightLine(android.graphics.PointF p0, android.graphics.PointF p1);
+ method public static androidx.graphics.shapes.Cubic straightLine(float x0, float y0, float x1, float y1);
method public operator androidx.graphics.shapes.Cubic times(float x);
method public operator androidx.graphics.shapes.Cubic times(int x);
method public void transform(android.graphics.Matrix matrix);
method public void transform(android.graphics.Matrix matrix, optional float[] points);
- property public final android.graphics.PointF p0;
- property public final android.graphics.PointF p1;
- property public final android.graphics.PointF p2;
- property public final android.graphics.PointF p3;
+ property public final float anchorX0;
+ property public final float anchorX1;
+ property public final float anchorY0;
+ property public final float anchorY1;
+ property public final float controlX0;
+ property public final float controlX1;
+ property public final float controlY0;
+ property public final float controlY1;
field public static final androidx.graphics.shapes.Cubic.Companion Companion;
}
public static final class Cubic.Companion {
- method public androidx.graphics.shapes.Cubic circularArc(android.graphics.PointF center, android.graphics.PointF p0, android.graphics.PointF p1);
+ method public androidx.graphics.shapes.Cubic circularArc(float centerX, float centerY, float x0, float y0, float x1, float y1);
method public androidx.graphics.shapes.Cubic interpolate(androidx.graphics.shapes.Cubic start, androidx.graphics.shapes.Cubic end, float t);
- method public androidx.graphics.shapes.Cubic straightLine(android.graphics.PointF p0, android.graphics.PointF p1);
+ method public androidx.graphics.shapes.Cubic straightLine(float x0, float y0, float x1, float y1);
}
public final class CubicShape {
@@ -66,32 +74,32 @@
public final class Morph {
ctor public Morph(androidx.graphics.shapes.RoundedPolygon start, androidx.graphics.shapes.RoundedPolygon end);
- method public java.util.List<androidx.graphics.shapes.Cubic> asCubics();
- method public android.graphics.Path asPath();
+ method public java.util.List<androidx.graphics.shapes.Cubic> asCubics(float progress);
+ method public android.graphics.Path asPath(float progress);
+ method public android.graphics.Path asPath(float progress, optional android.graphics.Path path);
method public android.graphics.RectF getBounds();
- method public float getProgress();
- method public void setProgress(float);
method public void transform(android.graphics.Matrix matrix);
property public final android.graphics.RectF bounds;
- property public final float progress;
}
public final class MorphKt {
- method public static void drawMorph(android.graphics.Canvas, androidx.graphics.shapes.Morph morph, android.graphics.Paint paint);
+ method public static void drawMorph(android.graphics.Canvas, androidx.graphics.shapes.Morph morph, android.graphics.Paint paint, optional float progress);
}
public final class RoundedPolygon {
ctor public RoundedPolygon(androidx.graphics.shapes.RoundedPolygon source);
- ctor public RoundedPolygon(@IntRange(from=3L) int numVertices, optional float radius, optional android.graphics.PointF center, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
- ctor public RoundedPolygon(java.util.List<? extends android.graphics.PointF> vertices, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF? center);
+ ctor public RoundedPolygon(float[] vertices, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
+ ctor public RoundedPolygon(@IntRange(from=3L) int numVertices, optional float radius, optional float centerX, optional float centerY, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
method public android.graphics.RectF getBounds();
- method public android.graphics.PointF getCenter();
+ method public float getCenterX();
+ method public float getCenterY();
method public void setBounds(android.graphics.RectF);
method public androidx.graphics.shapes.CubicShape toCubicShape();
method public android.graphics.Path toPath();
method public void transform(android.graphics.Matrix matrix);
property public final android.graphics.RectF bounds;
- property public final android.graphics.PointF center;
+ property public final float centerX;
+ property public final float centerY;
field public static final androidx.graphics.shapes.RoundedPolygon.Companion Companion;
}
@@ -106,15 +114,17 @@
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion);
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices);
method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius);
- method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional android.graphics.PointF center);
- method public static androidx.graphics.shapes.RoundedPolygon rectangle(androidx.graphics.shapes.RoundedPolygon.Companion, optional float width, optional float height, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF center);
+ method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional float centerX);
+ method public static androidx.graphics.shapes.RoundedPolygon circle(androidx.graphics.shapes.RoundedPolygon.Companion, optional @IntRange(from=3L) int numVertices, optional float radius, optional float centerX, optional float centerY);
+ method public static androidx.graphics.shapes.RoundedPolygon rectangle(androidx.graphics.shapes.RoundedPolygon.Companion, optional float width, optional float height, optional androidx.graphics.shapes.CornerRounding rounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding);
method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding);
- method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional android.graphics.PointF center);
+ method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX);
+ method public static androidx.graphics.shapes.RoundedPolygon star(androidx.graphics.shapes.RoundedPolygon.Companion, int numVerticesPerRadius, optional float radius, optional float innerRadius, optional androidx.graphics.shapes.CornerRounding rounding, optional androidx.graphics.shapes.CornerRounding? innerRounding, optional java.util.List<androidx.graphics.shapes.CornerRounding>? perVertexRounding, optional float centerX, optional float centerY);
}
}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CornerRoundingTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CornerRoundingTest.kt
index b4e78e3..cb31924 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CornerRoundingTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CornerRoundingTest.kt
@@ -45,4 +45,4 @@
assertEquals(5f, roundedAndSmoothed.radius)
assertEquals(.5f, roundedAndSmoothed.smoothing)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt
index e65ea69..2658b26 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt
@@ -43,7 +43,8 @@
val cubic1 = Cubic(point4, point5, point6, point7)
fun getClosingCubic(first: Cubic, last: Cubic): Cubic {
- return Cubic(last.p3, last.p3, first.p0, first.p0)
+ return Cubic(last.anchorX1, last.anchorY1, last.anchorX1, last.anchorY1,
+ first.anchorX0, first.anchorY0, first.anchorX0, first.anchorY0)
}
@Test
@@ -99,9 +100,13 @@
translator.mapPoints(translatedPoints)
shape.transform(translator)
val cubic = shape.cubics[0]
- assertPointsEqualish(PointF(translatedPoints[0], translatedPoints[1]), cubic.p0)
- assertPointsEqualish(PointF(translatedPoints[2], translatedPoints[3]), cubic.p1)
- assertPointsEqualish(PointF(translatedPoints[4], translatedPoints[5]), cubic.p2)
- assertPointsEqualish(PointF(translatedPoints[6], translatedPoints[7]), cubic.p3)
+ assertPointsEqualish(PointF(translatedPoints[0], translatedPoints[1]),
+ PointF(cubic.anchorX0, cubic.anchorY0))
+ assertPointsEqualish(PointF(translatedPoints[2], translatedPoints[3]),
+ PointF(cubic.controlX0, cubic.controlY0))
+ assertPointsEqualish(PointF(translatedPoints[4], translatedPoints[5]),
+ PointF(cubic.controlX1, cubic.controlY1))
+ assertPointsEqualish(PointF(translatedPoints[6], translatedPoints[7]),
+ PointF(cubic.anchorX1, cubic.anchorY1))
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt
index e66fe68..5102900 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt
@@ -41,30 +41,34 @@
@Test
fun constructionTest() {
- assertEquals(p0, cubic.p0)
- assertEquals(p1, cubic.p1)
- assertEquals(p2, cubic.p2)
- assertEquals(p3, cubic.p3)
+ assertEquals(p0, PointF(cubic.anchorX0, cubic.anchorY0))
+ assertEquals(p1, PointF(cubic.controlX0, cubic.controlY0))
+ assertEquals(p2, PointF(cubic.controlX1, cubic.controlY1))
+ assertEquals(p3, PointF(cubic.anchorX1, cubic.anchorY1))
}
@Test
fun copyTest() {
val copy = Cubic(cubic)
- assertEquals(p0, copy.p0)
- assertEquals(p1, copy.p1)
- assertEquals(p2, copy.p2)
- assertEquals(p3, copy.p3)
- assertEquals(cubic.p0, copy.p0)
- assertEquals(cubic.p1, copy.p1)
- assertEquals(cubic.p2, copy.p2)
- assertEquals(cubic.p3, copy.p3)
+ assertEquals(p0, PointF(copy.anchorX0, copy.anchorY0))
+ assertEquals(p1, PointF(copy.controlX0, copy.controlY0))
+ assertEquals(p2, PointF(copy.controlX1, copy.controlY1))
+ assertEquals(p3, PointF(copy.anchorX1, copy.anchorY1))
+ assertEquals(PointF(cubic.anchorX0, cubic.anchorY0),
+ PointF(copy.anchorX0, copy.anchorY0))
+ assertEquals(PointF(cubic.controlX0, cubic.controlY0),
+ PointF(copy.controlX0, copy.controlY0))
+ assertEquals(PointF(cubic.controlX1, cubic.controlY1),
+ PointF(copy.controlX1, copy.controlY1))
+ assertEquals(PointF(cubic.anchorX1, cubic.anchorY1),
+ PointF(copy.anchorX1, copy.anchorY1))
}
@Test
fun circularArcTest() {
- val arcCubic = Cubic.circularArc(zero, p0, p3)
- assertEquals(p0, arcCubic.p0)
- assertEquals(p3, arcCubic.p3)
+ val arcCubic = Cubic.circularArc(zero.x, zero.y, p0.x, p0.y, p3.x, p3.y)
+ assertEquals(p0, PointF(arcCubic.anchorX0, arcCubic.anchorY0))
+ assertEquals(p3, PointF(arcCubic.anchorX1, arcCubic.anchorY1))
}
@Test
@@ -74,58 +78,62 @@
divCubic = cubic / 1
assertCubicsEqua1ish(cubic, divCubic)
divCubic = cubic / 2f
- assertPointsEqualish(p0 / 2f, divCubic.p0)
- assertPointsEqualish(p1 / 2f, divCubic.p1)
- assertPointsEqualish(p2 / 2f, divCubic.p2)
- assertPointsEqualish(p3 / 2f, divCubic.p3)
+ assertPointsEqualish(p0 / 2f, PointF(divCubic.anchorX0, divCubic.anchorY0))
+ assertPointsEqualish(p1 / 2f, PointF(divCubic.controlX0, divCubic.controlY0))
+ assertPointsEqualish(p2 / 2f, PointF(divCubic.controlX1, divCubic.controlY1))
+ assertPointsEqualish(p3 / 2f, PointF(divCubic.anchorX1, divCubic.anchorY1))
divCubic = cubic / 2
- assertPointsEqualish(p0 / 2f, divCubic.p0)
- assertPointsEqualish(p1 / 2f, divCubic.p1)
- assertPointsEqualish(p2 / 2f, divCubic.p2)
- assertPointsEqualish(p3 / 2f, divCubic.p3)
+ assertPointsEqualish(p0 / 2f, PointF(divCubic.anchorX0, divCubic.anchorY0))
+ assertPointsEqualish(p1 / 2f, PointF(divCubic.controlX0, divCubic.controlY0))
+ assertPointsEqualish(p2 / 2f, PointF(divCubic.controlX1, divCubic.controlY1))
+ assertPointsEqualish(p3 / 2f, PointF(divCubic.anchorX1, divCubic.anchorY1))
}
@Test
fun timesTest() {
var timesCubic = cubic * 1f
- assertEquals(p0, timesCubic.p0)
- assertEquals(p1, timesCubic.p1)
- assertEquals(p2, timesCubic.p2)
- assertEquals(p3, timesCubic.p3)
+ assertEquals(p0, PointF(timesCubic.anchorX0, timesCubic.anchorY0))
+ assertEquals(p1, PointF(timesCubic.controlX0, timesCubic.controlY0))
+ assertEquals(p2, PointF(timesCubic.controlX1, timesCubic.controlY1))
+ assertEquals(p3, PointF(timesCubic.anchorX1, timesCubic.anchorY1))
timesCubic = cubic * 1
- assertEquals(p0, timesCubic.p0)
- assertEquals(p1, timesCubic.p1)
- assertEquals(p2, timesCubic.p2)
- assertEquals(p3, timesCubic.p3)
+ assertEquals(p0, PointF(timesCubic.anchorX0, timesCubic.anchorY0))
+ assertEquals(p1, PointF(timesCubic.controlX0, timesCubic.controlY0))
+ assertEquals(p2, PointF(timesCubic.controlX1, timesCubic.controlY1))
+ assertEquals(p3, PointF(timesCubic.anchorX1, timesCubic.anchorY1))
timesCubic = cubic * 2f
- assertPointsEqualish(p0 * 2f, timesCubic.p0)
- assertPointsEqualish(p1 * 2f, timesCubic.p1)
- assertPointsEqualish(p2 * 2f, timesCubic.p2)
- assertPointsEqualish(p3 * 2f, timesCubic.p3)
+ assertPointsEqualish(p0 * 2f, PointF(timesCubic.anchorX0, timesCubic.anchorY0))
+ assertPointsEqualish(p1 * 2f, PointF(timesCubic.controlX0, timesCubic.controlY0))
+ assertPointsEqualish(p2 * 2f, PointF(timesCubic.controlX1, timesCubic.controlY1))
+ assertPointsEqualish(p3 * 2f, PointF(timesCubic.anchorX1, timesCubic.anchorY1))
timesCubic = cubic * 2
- assertPointsEqualish(p0 * 2f, timesCubic.p0)
- assertPointsEqualish(p1 * 2f, timesCubic.p1)
- assertPointsEqualish(p2 * 2f, timesCubic.p2)
- assertPointsEqualish(p3 * 2f, timesCubic.p3)
+ assertPointsEqualish(p0 * 2f, PointF(timesCubic.anchorX0, timesCubic.anchorY0))
+ assertPointsEqualish(p1 * 2f, PointF(timesCubic.controlX0, timesCubic.controlY0))
+ assertPointsEqualish(p2 * 2f, PointF(timesCubic.controlX1, timesCubic.controlY1))
+ assertPointsEqualish(p3 * 2f, PointF(timesCubic.anchorX1, timesCubic.anchorY1))
}
@Test
fun plusTest() {
val offsetCubic = cubic * 2f
var plusCubic = cubic + offsetCubic
- assertPointsEqualish(p0 + offsetCubic.p0, plusCubic.p0)
- assertPointsEqualish(p1 + offsetCubic.p1, plusCubic.p1)
- assertPointsEqualish(p2 + offsetCubic.p2, plusCubic.p2)
- assertPointsEqualish(p3 + offsetCubic.p3, plusCubic.p3)
+ assertPointsEqualish(p0 + PointF(offsetCubic.anchorX0, offsetCubic.anchorY0),
+ PointF(plusCubic.anchorX0, plusCubic.anchorY0))
+ assertPointsEqualish(p1 + PointF(offsetCubic.controlX0, offsetCubic.controlY0),
+ PointF(plusCubic.controlX0, plusCubic.controlY0))
+ assertPointsEqualish(p2 + PointF(offsetCubic.controlX1, offsetCubic.controlY1),
+ PointF(plusCubic.controlX1, plusCubic.controlY1))
+ assertPointsEqualish(p3 + PointF(offsetCubic.anchorX1, offsetCubic.anchorY1),
+ PointF(plusCubic.anchorX1, plusCubic.anchorY1))
}
@Test
fun reverseTest() {
val reverseCubic = cubic.reverse()
- assertEquals(p3, reverseCubic.p0)
- assertEquals(p2, reverseCubic.p1)
- assertEquals(p1, reverseCubic.p2)
- assertEquals(p0, reverseCubic.p3)
+ assertEquals(p3, PointF(reverseCubic.anchorX0, reverseCubic.anchorY0))
+ assertEquals(p2, PointF(reverseCubic.controlX0, reverseCubic.controlY0))
+ assertEquals(p1, PointF(reverseCubic.controlX1, reverseCubic.controlY1))
+ assertEquals(p0, PointF(reverseCubic.anchorX1, reverseCubic.anchorY1))
}
fun assertBetween(end0: PointF, end1: PointF, actual: PointF) {
@@ -141,11 +149,11 @@
@Test
fun straightLineTest() {
- val lineCubic = Cubic.straightLine(p0, p3)
- assertEquals(p0, lineCubic.p0)
- assertEquals(p3, lineCubic.p3)
- assertBetween(p0, p3, lineCubic.p1)
- assertBetween(p0, p3, lineCubic.p2)
+ val lineCubic = Cubic.straightLine(p0.x, p0.y, p3.x, p3.y)
+ assertEquals(p0, PointF(lineCubic.anchorX0, lineCubic.anchorY0))
+ assertEquals(p3, PointF(lineCubic.anchorX1, lineCubic.anchorY1))
+ assertBetween(p0, p3, PointF(lineCubic.controlX0, lineCubic.controlY0))
+ assertBetween(p0, p3, PointF(lineCubic.controlX1, lineCubic.controlY1))
}
@Test
@@ -159,17 +167,24 @@
@Test
fun splitTest() {
val (split0, split1) = cubic.split(.5f)
- assertEquals(cubic.p0, split0.p0)
- assertEquals(cubic.p3, split1.p3)
- assertBetween(cubic.p0, cubic.p3, split0.p3)
- assertBetween(cubic.p0, cubic.p3, split1.p0)
+ assertEquals(PointF(cubic.anchorX0, cubic.anchorY0),
+ PointF(split0.anchorX0, split0.anchorY0))
+ assertEquals(PointF(cubic.anchorX1, cubic.anchorY1),
+ PointF(split1.anchorX1, split1.anchorY1))
+ assertBetween(PointF(cubic.anchorX0, cubic.anchorY0),
+ PointF(cubic.anchorX1, cubic.anchorY1),
+ PointF(split0.anchorX1, split0.anchorY1))
+ assertBetween(PointF(cubic.anchorX0, cubic.anchorY0),
+ PointF(cubic.anchorX1, cubic.anchorY1),
+ PointF(split1.anchorX0, split1.anchorY0))
}
@Test
fun pointOnCurveTest() {
var halfway = cubic.pointOnCurve(.5f)
- assertBetween(cubic.p0, cubic.p3, halfway)
- val straightLineCubic = Cubic.straightLine(p0, p3)
+ assertBetween(PointF(cubic.anchorX0, cubic.anchorY0),
+ PointF(cubic.anchorX1, cubic.anchorY1), halfway)
+ val straightLineCubic = Cubic.straightLine(p0.x, p0.y, p3.x, p3.y)
halfway = straightLineCubic.pointOnCurve(.5f)
val computedHalfway = PointF(p0.x + .5f * (p3.x - p0.x), p0.y + .5f * (p3.y - p0.y))
assertPointsEqualish(computedHalfway, halfway)
@@ -193,9 +208,13 @@
transformedCubic = Cubic(cubic)
matrix.setTranslate(tx, ty)
transformedCubic.transform(matrix)
- assertPointsEqualish(cubic.p0 + translationVector, transformedCubic.p0)
- assertPointsEqualish(cubic.p1 + translationVector, transformedCubic.p1)
- assertPointsEqualish(cubic.p2 + translationVector, transformedCubic.p2)
- assertPointsEqualish(cubic.p3 + translationVector, transformedCubic.p3)
+ assertPointsEqualish(PointF(cubic.anchorX0, cubic.anchorY0) + translationVector,
+ PointF(transformedCubic.anchorX0, transformedCubic.anchorY0))
+ assertPointsEqualish(PointF(cubic.controlX0, cubic.controlY0) + translationVector,
+ PointF(transformedCubic.controlX0, transformedCubic.controlY0))
+ assertPointsEqualish(PointF(cubic.controlX1, cubic.controlY1) + translationVector,
+ PointF(transformedCubic.controlX1, transformedCubic.controlY1))
+ assertPointsEqualish(PointF(cubic.anchorX1, cubic.anchorY1) + translationVector,
+ PointF(transformedCubic.anchorX1, transformedCubic.anchorY1))
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/FloatMappingTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/FloatMappingTest.kt
index 4cb3a8d..d503068 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/FloatMappingTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/FloatMappingTest.kt
@@ -92,4 +92,4 @@
assertEqualish(source, mapper.mapBack(target))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt
index bcc921c..dd75e73 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt
@@ -16,7 +16,6 @@
package androidx.graphics.shapes
-import android.graphics.PointF
import androidx.test.filters.SmallTest
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -36,11 +35,11 @@
@Test
fun irregularTriangleAngleMeasure() = irregularPolygonAngleMeasure(
RoundedPolygon(
- vertices = listOf(
- PointF(0f, -1f),
- PointF(1f, 1f),
- PointF(0f, 0.5f),
- PointF(-1f, 1f)
+ vertices = floatArrayOf(
+ 0f, -1f,
+ 1f, 1f,
+ 0f, 0.5f,
+ -1f, 1f
),
perVertexRounding = listOf(
CornerRounding(0.2f, 0.5f),
@@ -54,11 +53,11 @@
@Test
fun quarterAngleMeasure() = irregularPolygonAngleMeasure(
RoundedPolygon(
- vertices = listOf(
- PointF(-1f, -1f),
- PointF(1f, -1f),
- PointF(1f, 1f),
- PointF(-1f, 1f)
+ vertices = floatArrayOf(
+ -1f, -1f,
+ 1f, -1f,
+ 1f, 1f,
+ -1f, 1f
),
perVertexRounding = listOf(
CornerRounding.Unrounded,
@@ -71,7 +70,7 @@
private fun polygonAngleMeasure(sides: Int) {
val polygon = RoundedPolygon(sides)
- val measurer = AngleMeasurer(polygon.center)
+ val measurer = AngleMeasurer(polygon.centerX, polygon.centerY)
val measuredPolygon = MeasuredPolygon.measurePolygon(measurer, polygon)
@@ -85,7 +84,7 @@
}
private fun irregularPolygonAngleMeasure(polygon: RoundedPolygon) {
- val measurer = AngleMeasurer(polygon.center)
+ val measurer = AngleMeasurer(polygon.centerX, polygon.centerY)
val measuredPolygon = MeasuredPolygon.measurePolygon(measurer, polygon)
@@ -101,4 +100,4 @@
assertTrue(measuredCubic.endOutlineProgress >= measuredCubic.startOutlineProgress)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt
index 610fa3e..c6dd7b7 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt
@@ -45,7 +45,7 @@
max = max * 2f
assertInBounds(doubleSquare.toCubicShape(), min, max)
- val offsetSquare = RoundedPolygon(4, center = PointF(1f, 2f))
+ val offsetSquare = RoundedPolygon(4, centerX = 1f, centerY = 2f)
min = PointF(0f, 1f)
max = PointF(2f, 3f)
assertInBounds(offsetSquare.toCubicShape(), min, max)
@@ -59,14 +59,21 @@
val p1 = PointF(0f, 1f)
val p2 = PointF(-1f, 0f)
val p3 = PointF(0f, -1f)
- val manualSquare = RoundedPolygon(listOf(p0, p1, p2, p3))
+ val manualSquare = RoundedPolygon(floatArrayOf(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y,
+ p3.x, p3.y))
min = PointF(-1f, -1f)
max = PointF(1f, 1f)
assertInBounds(manualSquare.toCubicShape(), min, max)
val offset = PointF(1f, 2f)
+ val p0Offset = p0 + offset
+ val p1Offset = p1 + offset
+ val p2Offset = p2 + offset
+ val p3Offset = p3 + offset
val manualSquareOffset = RoundedPolygon(
- vertices = listOf(p0 + offset, p1 + offset, p2 + offset, p3 + offset), center = offset)
+ vertices = floatArrayOf(p0Offset.x, p0Offset.y, p1Offset.x, p1Offset.y,
+ p2Offset.x, p2Offset.y, p3Offset.x, p3Offset.y),
+ centerX = offset.x, centerY = offset.y)
min = PointF(0f, 1f)
max = PointF(2f, 3f)
assertInBounds(manualSquareOffset.toCubicShape(), min, max)
@@ -89,7 +96,7 @@
@Test
fun centerTest() {
- assertPointsEqualish(PointF(0f, 0f), square.center)
+ assertPointsEqualish(PointF(0f, 0f), PointF(square.centerX, square.centerY))
}
@Test
@@ -109,10 +116,18 @@
val squareCubics = square.toCubicShape().cubics
val squareCopyCubics = squareCopy.toCubicShape().cubics
for (i in 0 until squareCubics.size) {
- assertPointsEqualish(squareCopyCubics[i].p0 + offset, squareCubics[i].p0)
- assertPointsEqualish(squareCopyCubics[i].p1 + offset, squareCubics[i].p1)
- assertPointsEqualish(squareCopyCubics[i].p2 + offset, squareCubics[i].p2)
- assertPointsEqualish(squareCopyCubics[i].p3 + offset, squareCubics[i].p3)
+ assertPointsEqualish(PointF(squareCopyCubics[i].anchorX0,
+ squareCopyCubics[i].anchorY0) + offset,
+ PointF(squareCubics[i].anchorX0, squareCubics[i].anchorY0))
+ assertPointsEqualish(PointF(squareCopyCubics[i].controlX0,
+ squareCopyCubics[i].controlY0) + offset,
+ PointF(squareCubics[i].controlX0, squareCubics[i].controlY0))
+ assertPointsEqualish(PointF(squareCopyCubics[i].controlX1,
+ squareCopyCubics[i].controlY1) + offset,
+ PointF(squareCubics[i].controlX1, squareCubics[i].controlY1))
+ assertPointsEqualish(PointF(squareCopyCubics[i].anchorX1,
+ squareCopyCubics[i].anchorY1) + offset,
+ PointF(squareCubics[i].anchorX1, squareCubics[i].anchorY1))
}
}
@@ -159,4 +174,4 @@
assertNotEquals(preTransformVertices, postTransformVertices)
assertNotEquals(preTransformCenters, postTransformCenters)
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt
index eabbc8d..74c2569 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt
@@ -17,7 +17,6 @@
package androidx.graphics.shapes
import android.graphics.PointF
-import androidx.core.graphics.plus
import androidx.core.graphics.times
import androidx.test.filters.SmallTest
import org.junit.Assert
@@ -63,35 +62,48 @@
val p1 = PointF(0f, 1f)
val p2 = PointF(-1f, 0f)
val p3 = PointF(0f, -1f)
+ val verts = floatArrayOf(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
Assert.assertThrows(IllegalArgumentException::class.java) {
- RoundedPolygon(listOf(p0, p1))
+ RoundedPolygon(floatArrayOf(p0.x, p0.y, p1.x, p1.y))
}
- val manualSquare = RoundedPolygon(listOf(p0, p1, p2, p3))
+ val manualSquare = RoundedPolygon(verts)
var min = PointF(-1f, -1f)
var max = PointF(1f, 1f)
assertInBounds(manualSquare.toCubicShape(), min, max)
val offset = PointF(1f, 2f)
- val manualSquareOffset = RoundedPolygon(
- listOf(p0 + offset, p1 + offset, p2 + offset, p3 + offset), center = offset)
+ val offsetVerts = floatArrayOf(p0.x + offset.x, p0.y + offset.y,
+ p1.x + offset.x, p1.y + offset.y, p2.x + offset.x, p2.y + offset.y,
+ p3.x + offset.x, p3.y + offset.y)
+ val manualSquareOffset = RoundedPolygon(offsetVerts, centerX = offset.x, centerY = offset.y)
min = PointF(0f, 1f)
max = PointF(2f, 3f)
assertInBounds(manualSquareOffset.toCubicShape(), min, max)
- val manualSquareRounded = RoundedPolygon(listOf(p0, p1, p2, p3), rounding = rounding)
+ val manualSquareRounded = RoundedPolygon(verts, rounding = rounding)
min = PointF(-1f, -1f)
max = PointF(1f, 1f)
assertInBounds(manualSquareRounded.toCubicShape(), min, max)
- val manualSquarePVRounded = RoundedPolygon(listOf(p0, p1, p2, p3),
+ val manualSquarePVRounded = RoundedPolygon(verts,
perVertexRounding = perVtxRounded)
min = PointF(-1f, -1f)
max = PointF(1f, 1f)
assertInBounds(manualSquarePVRounded.toCubicShape(), min, max)
}
+ fun pointsToFloats(points: List<PointF>): FloatArray {
+ val result = FloatArray(points.size * 2)
+ var index = 0
+ for (point in points) {
+ result[index++] = point.x
+ result[index++] = point.y
+ }
+ return result
+ }
+
@Test
fun roundingSpaceUsageTest() {
val p0 = PointF(0f, 0f)
@@ -103,7 +115,7 @@
CornerRounding.Unrounded,
)
val polygon = RoundedPolygon(
- vertices = listOf(p0, p1, p2),
+ vertices = pointsToFloats(listOf(p0, p1, p2)),
perVertexRounding = pvRounding
)
@@ -114,10 +126,10 @@
assertEquals(1, lowerEdgeFeature.cubics.size)
val lowerEdge = lowerEdgeFeature.cubics.first()
- assertEqualish(0.5f, lowerEdge.p0.x)
- assertEqualish(0.0f, lowerEdge.p0.y)
- assertEqualish(0.5f, lowerEdge.p3.x)
- assertEqualish(0.0f, lowerEdge.p3.y)
+ assertEqualish(0.5f, lowerEdge.anchorX0)
+ assertEqualish(0.0f, lowerEdge.anchorY0)
+ assertEqualish(0.5f, lowerEdge.anchorX1)
+ assertEqualish(0.0f, lowerEdge.anchorY1)
}
/*
@@ -211,14 +223,14 @@
rounding3,
)
val polygon = RoundedPolygon(
- vertices = listOf(p0, p1, p2, p3),
+ vertices = pointsToFloats(listOf(p0, p1, p2, p3)),
perVertexRounding = pvRounding
)
val (e01, _, _, e30) = polygon.features.filterIsInstance<RoundedPolygon.Edge>()
val msg = "r0 = ${show(rounding0)}, r3 = ${show(rounding3)}"
- assertEqualish(expectedV0SX, e01.cubics.first().p0.x, msg)
- assertEqualish(expectedV0SY, e30.cubics.first().p3.y, msg)
- assertEqualish(expectedV3SY, 1f - e30.cubics.first().p0.y, msg)
+ assertEqualish(expectedV0SX, e01.cubics.first().anchorX0, msg)
+ assertEqualish(expectedV0SY, e30.cubics.first().anchorY1, msg)
+ assertEqualish(expectedV3SY, 1f - e30.cubics.first().anchorY0, msg)
}
private fun show(cr: CornerRounding) = "(r=${cr.radius}, s=${cr.smoothing})"
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt
index abd569c..21480b6 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt
@@ -64,8 +64,8 @@
radius2: Float = radius1,
center: PointF = Zero
) {
- assertPointOnRadii(cubic.p0, radius1, radius2, center)
- assertPointOnRadii(cubic.p3, radius1, radius2, center)
+ assertPointOnRadii(PointF(cubic.anchorX0, cubic.anchorY0), radius1, radius2, center)
+ assertPointOnRadii(PointF(cubic.anchorX1, cubic.anchorY1), radius1, radius2, center)
}
/**
@@ -108,7 +108,7 @@
assertCircleShape(bigCircle.toCubicShape(), radius = 3f)
val center = PointF(1f, 2f)
- val offsetCircle = RoundedPolygon.circle(center = center)
+ val offsetCircle = RoundedPolygon.circle(centerX = center.x, centerY = center.y)
assertCircleShape(offsetCircle.toCubicShape(), center = center)
}
@@ -128,7 +128,8 @@
}
val center = PointF(1f, 2f)
- star = RoundedPolygon.star(4, innerRadius = innerRadius, center = center)
+ star = RoundedPolygon.star(4, innerRadius = innerRadius,
+ centerX = center.x, centerY = center.y)
shape = star.toCubicShape()
for (cubic in shape.cubics) {
assertCubicOnRadii(cubic, radius, innerRadius, center)
@@ -174,4 +175,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt
index 31d0440..95cc411 100644
--- a/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt
+++ b/graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt
@@ -29,10 +29,14 @@
}
fun assertCubicsEqua1ish(expected: Cubic, actual: Cubic) {
- assertPointsEqualish(expected.p0, actual.p0)
- assertPointsEqualish(expected.p1, actual.p1)
- assertPointsEqualish(expected.p2, actual.p2)
- assertPointsEqualish(expected.p3, actual.p3)
+ assertPointsEqualish(PointF(expected.anchorX0, expected.anchorY0),
+ PointF(actual.anchorX0, actual.anchorY0))
+ assertPointsEqualish(PointF(expected.controlX0, expected.controlY0),
+ PointF(actual.controlX0, actual.controlY0))
+ assertPointsEqualish(PointF(expected.controlX1, expected.controlY1),
+ PointF(actual.controlX1, actual.controlY1))
+ assertPointsEqualish(PointF(expected.anchorX1, expected.anchorY1),
+ PointF(actual.anchorX1, actual.anchorY1))
}
fun assertPointGreaterish(expected: PointF, actual: PointF) {
@@ -52,13 +56,13 @@
fun assertInBounds(shape: CubicShape, minPoint: PointF, maxPoint: PointF) {
val cubics = shape.cubics
for (cubic in cubics) {
- assertPointGreaterish(minPoint, cubic.p0)
- assertPointLessish(maxPoint, cubic.p0)
- assertPointGreaterish(minPoint, cubic.p1)
- assertPointLessish(maxPoint, cubic.p1)
- assertPointGreaterish(minPoint, cubic.p2)
- assertPointLessish(maxPoint, cubic.p2)
- assertPointGreaterish(minPoint, cubic.p3)
- assertPointLessish(maxPoint, cubic.p3)
+ assertPointGreaterish(minPoint, PointF(cubic.anchorX0, cubic.anchorY0))
+ assertPointLessish(maxPoint, PointF(cubic.anchorX0, cubic.anchorY0))
+ assertPointGreaterish(minPoint, PointF(cubic.controlX0, cubic.controlY0))
+ assertPointLessish(maxPoint, PointF(cubic.controlX0, cubic.controlY0))
+ assertPointGreaterish(minPoint, PointF(cubic.controlX1, cubic.controlY1))
+ assertPointLessish(maxPoint, PointF(cubic.controlX1, cubic.controlY1))
+ assertPointGreaterish(minPoint, PointF(cubic.anchorX1, cubic.anchorY1))
+ assertPointLessish(maxPoint, PointF(cubic.anchorX1, cubic.anchorY1))
}
}
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CornerRounding.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CornerRounding.kt
index 9214c0f..3efe136 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CornerRounding.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CornerRounding.kt
@@ -64,4 +64,4 @@
@JvmField
val Unrounded = CornerRounding()
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt
index a0d55cf..ca95d66 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt
@@ -18,75 +18,115 @@
import android.graphics.Matrix
import android.graphics.PointF
-import androidx.core.graphics.minus
-import androidx.core.graphics.plus
-import androidx.core.graphics.times
import kotlin.math.sqrt
/**
- * This class holds the anchor and control point data for a single cubic Bézier curve.
+ * This class holds the anchor and control point data for a single cubic Bézier curve,
+ * with anchor points ([anchorX0], [anchorY0]) and ([anchorX1], [anchorY1]) at either end
+ * and control points ([controlX0], [controlY0]) and ([controlX1], [controlY1]) determining
+ * the slope of the curve between the anchor points.
*
- * @param p0 the first anchor point
- * @param p1 the first control point
- * @param p2 the second control point
- * @param p3 the second anchor point
+ * @param anchorX0 the first anchor point x coordinate
+ * @param anchorY0 the first anchor point y coordinate
+ * @param controlX0 the first control point x coordinate
+ * @param controlY0 the first control point y coordinate
+ * @param controlX1 the second control point x coordinate
+ * @param controlY1 the second control point y coordinate
+ * @param anchorX1 the second anchor point x coordinate
+ * @param anchorY1 the second anchor point y coordinate
*/
-class Cubic(p0: PointF, p1: PointF, p2: PointF, p3: PointF) {
-
- // TODO: cubic points should not be mutable. Consider switching to Floats instead of Points,
- /**
- * The first anchor point
- */
- val p0: PointF
+class Cubic(
+ anchorX0: Float,
+ anchorY0: Float,
+ controlX0: Float,
+ controlY0: Float,
+ controlX1: Float,
+ controlY1: Float,
+ anchorX1: Float,
+ anchorY1: Float
+) {
/**
- * The first control point
+ * The first anchor point x coordinate
*/
- val p1: PointF
+ var anchorX0: Float = anchorX0
+ private set
/**
- * The second control point
+ * The first anchor point y coordinate
*/
- val p2: PointF
+ var anchorY0: Float = anchorY0
+ private set
/**
- * The second anchor point
+ * The first control point x coordinate
*/
- val p3: PointF
+ var controlX0: Float = controlX0
+ private set
- // Defensive copy to new PointF objects
- init {
- this.p0 = PointF(p0.x, p0.y)
- this.p1 = PointF(p1.x, p1.y)
- this.p2 = PointF(p2.x, p2.y)
- this.p3 = PointF(p3.x, p3.y)
- }
+ /**
+ * The first control point y coordinate
+ */
+ var controlY0: Float = controlY0
+ private set
+
+ /**
+ * The second control point x coordinate
+ */
+ var controlX1: Float = controlX1
+ private set
+
+ /**
+ * The second control point y coordinate
+ */
+ var controlY1: Float = controlY1
+ private set
+
+ /**
+ * The second anchor point x coordinate
+ */
+ var anchorX1: Float = anchorX1
+ private set
+
+ /**
+ * The second anchor point y coordinate
+ */
+ var anchorY1: Float = anchorY1
+ private set
+
+ internal constructor(p0: PointF, p1: PointF, p2: PointF, p3: PointF) :
+ this(p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
/**
* Copy constructor which creates a copy of the given object.
*/
- constructor(cubic: Cubic) : this(cubic.p0, cubic.p1, cubic.p2, cubic.p3)
+ constructor(cubic: Cubic) : this(
+ cubic.anchorX0, cubic.anchorY0, cubic.controlX0, cubic.controlY0,
+ cubic.controlX1, cubic.controlY1, cubic.anchorX1, cubic.anchorY1,
+ )
override fun toString(): String {
- return "p0: $p0, p1: $p1, p2: $p2, p3: $p3"
+ return "p0: ($anchorX0, $anchorY0) p1: ($controlX0, $controlY0), " +
+ "p2: ($controlX1, $controlY1), p3: ($anchorX1, $anchorY1)"
}
/**
* Returns a point on the curve for parameter t, representing the proportional distance
- * along the curve between its starting ([p0]) and ending ([p3]) anchor points.
+ * along the curve between its starting ([anchorX0], [anchorY0]) and ending
+ * ([anchorX1], [anchorY1]) anchor points.
*
- * @param t The distance along the curve between the anchor points, where 0 is at [p0] and
- * 1 is at [p1]
+ * @param t The distance along the curve between the anchor points, where 0 is at
+ * ([anchorX0], [anchorY0]) and 1 is at ([controlX0], [controlY0])
* @param result Optional object to hold the result, can be passed in to avoid allocating a
* new PointF object.
*/
@JvmOverloads
fun pointOnCurve(t: Float, result: PointF = PointF()): PointF {
val u = 1 - t
- result.x = p0.x * (u * u * u) + p1.x * (3 * t * u * u) +
- p2.x * (3 * t * t * u) + p3.x * (t * t * t)
- result.y = p0.y * (u * u * u) + p1.y * (3 * t * u * u) +
- p2.y * (3 * t * t * u) + p3.y * (t * t * t)
+ result.x = anchorX0 * (u * u * u) + controlX0 * (3 * t * u * u) +
+ controlX1 * (3 * t * t * u) + anchorX1 * (t * t * t)
+ result.y = anchorY0 * (u * u * u) + controlY0 * (3 * t * u * u) +
+ controlY1 * (3 * t * t * u) + anchorY1 * (t * t * t)
return result
}
@@ -97,34 +137,48 @@
// TODO: cartesian optimization?
fun split(t: Float): Pair<Cubic, Cubic> {
val u = 1 - t
+ val pointOnCurve = pointOnCurve(t)
return Cubic(
- p0,
- p0 * u + p1 * t,
- p0 * (u * u) + p1 * (2 * u * t) + p2 * (t * t),
- pointOnCurve(t)
+ anchorX0, anchorY0,
+ anchorX0 * u + controlX0 * t, anchorY0 * u + controlY0 * t,
+ anchorX0 * (u * u) + controlX0 * (2 * u * t) + controlX1 * (t * t),
+ anchorY0 * (u * u) + controlY0 * (2 * u * t) + controlY1 * (t * t),
+ pointOnCurve.x, pointOnCurve.y
) to Cubic(
// TODO: should calculate once and share the result
- pointOnCurve(t),
- p1 * (u * u) + p2 * (2 * u * t) + p3 * (t * t),
- p2 * u + p3 * t,
- p3
+ pointOnCurve.x, pointOnCurve.y,
+ controlX0 * (u * u) + controlX1 * (2 * u * t) + anchorX1 * (t * t),
+ controlY0 * (u * u) + controlY1 * (2 * u * t) + anchorY1 * (t * t),
+ controlX1 * u + anchorX1 * t, controlY1 * u + anchorY1 * t,
+ anchorX1, anchorY1
)
}
/**
* Utility function to reverse the control/anchor points for this curve.
*/
- fun reverse() = Cubic(p3, p2, p1, p0)
+ fun reverse() = Cubic(anchorX1, anchorY1, controlX1, controlY1, controlX0, controlY0,
+ anchorX0, anchorY0)
/**
* Operator overload to enable adding Cubic objects together, like "c0 + c1"
*/
- operator fun plus(o: Cubic) = Cubic(p0 + o.p0, p1 + o.p1, p2 + o.p2, p3 + o.p3)
+ operator fun plus(o: Cubic) = Cubic(
+ anchorX0 + o.anchorX0, anchorY0 + o.anchorY0,
+ controlX0 + o.controlX0, controlY0 + o.controlY0,
+ controlX1 + o.controlX1, controlY1 + o.controlY1,
+ anchorX1 + o.anchorX1, anchorY1 + o.anchorY1
+ )
/**
* Operator overload to enable multiplying Cubics by a scalar value x, like "c0 * x"
*/
- operator fun times(x: Float) = Cubic(p0 * x, p1 * x, p2 * x, p3 * x)
+ operator fun times(x: Float) = Cubic(
+ anchorX0 * x, anchorY0 * x,
+ controlX0 * x, controlY0 * x,
+ controlX1 * x, controlY1 * x,
+ anchorX1 * x, anchorY1 * x
+ )
/**
* Operator overload to enable multiplying Cubics by an Int scalar value x, like "c0 * x"
@@ -156,23 +210,23 @@
if (points.size < 8) {
throw IllegalArgumentException("points array must be of size >= 8")
}
- points[0] = p0.x
- points[1] = p0.y
- points[2] = p1.x
- points[3] = p1.y
- points[4] = p2.x
- points[5] = p2.y
- points[6] = p3.x
- points[7] = p3.y
+ points[0] = anchorX0
+ points[1] = anchorY0
+ points[2] = controlX0
+ points[3] = controlY0
+ points[4] = controlX1
+ points[5] = controlY1
+ points[6] = anchorX1
+ points[7] = anchorY1
matrix.mapPoints(points)
- p0.x = points[0]
- p0.y = points[1]
- p1.x = points[2]
- p1.y = points[3]
- p2.x = points[4]
- p2.y = points[5]
- p3.x = points[6]
- p3.y = points[7]
+ anchorX0 = points[0]
+ anchorY0 = points[1]
+ controlX0 = points[2]
+ controlY0 = points[3]
+ controlX1 = points[4]
+ controlY1 = points[5]
+ anchorX1 = points[6]
+ anchorY1 = points[7]
}
override fun equals(other: Any?): Boolean {
@@ -181,19 +235,27 @@
other as Cubic
- if (p0 != other.p0) return false
- if (p1 != other.p1) return false
- if (p2 != other.p2) return false
- if (p3 != other.p3) return false
+ if (anchorX0 != other.anchorX0) return false
+ if (anchorY0 != other.anchorY0) return false
+ if (controlX0 != other.controlX0) return false
+ if (controlY0 != other.controlY0) return false
+ if (controlX1 != other.controlX1) return false
+ if (controlY1 != other.controlY1) return false
+ if (anchorX1 != other.anchorX1) return false
+ if (anchorY1 != other.anchorY1) return false
return true
}
override fun hashCode(): Int {
- var result = p0.hashCode()
- result = 31 * result + p1.hashCode()
- result = 31 * result + p2.hashCode()
- result = 31 * result + p3.hashCode()
+ var result = anchorX0.hashCode()
+ result = 31 * result + anchorY0.hashCode()
+ result = 31 * result + controlX0.hashCode()
+ result = 31 * result + controlY0.hashCode()
+ result = 31 * result + controlX1.hashCode()
+ result = 31 * result + controlY1.hashCode()
+ result = 31 * result + anchorX1.hashCode()
+ result = 31 * result + anchorY1.hashCode()
return result
}
@@ -203,12 +265,14 @@
* The control points lie 1/3 of the distance from their respective anchor points.
*/
@JvmStatic
- fun straightLine(p0: PointF, p1: PointF): Cubic {
+ fun straightLine(x0: Float, y0: Float, x1: Float, y1: Float): Cubic {
return Cubic(
- p0,
- interpolate(p0, p1, 1f / 3f),
- interpolate(p0, p1, 2f / 3f),
- p1
+ x0, y0,
+ interpolate(x0, x1, 1f / 3f),
+ interpolate(y0, y1, 1f / 3f),
+ interpolate(x0, x1, 2f / 3f),
+ interpolate(y0, y1, 2f / 3f),
+ x1, y1
)
}
@@ -222,17 +286,28 @@
* equidistant from the center.
*/
@JvmStatic
- fun circularArc(center: PointF, p0: PointF, p1: PointF): Cubic {
- val p0d = (p0 - center).getDirection()
- val p1d = (p1 - center).getDirection()
- p0d.rotate90()
- val clockwise = p0d.rotate90().dotProduct(p1 - center) >= 0
+ fun circularArc(
+ centerX: Float,
+ centerY: Float,
+ x0: Float,
+ y0: Float,
+ x1: Float,
+ y1: Float
+ ): Cubic {
+ val p0d = directionVector(x0 - centerX, y0 - centerY)
+ val p1d = directionVector(x1 - centerX, y1 - centerY)
+ val rotatedP0 = p0d.rotate90()
+ val rotatedP1 = p1d.rotate90()
+ val clockwise = rotatedP0.dotProduct(x1 - centerX, y1 - centerY) >= 0
val cosa = p0d.dotProduct(p1d)
- if (cosa > 0.999f) /* p0 ~= p1 */ return straightLine(p0, p1)
- val k = (p0 - center).getDistance() * 4f / 3f *
- (sqrt(2 * (1 - cosa)) - sqrt(1 - cosa * cosa)) / (1 - cosa) *
- if (clockwise) 1f else -1f
- return Cubic(p0, p0 + p0d.rotate90() * k, p1 - p1d.rotate90() * k, p1)
+ if (cosa > 0.999f) /* p0 ~= p1 */ return straightLine(x0, y0, x1, y1)
+ val k = distance(x0 - centerX, y0 - centerY) * 4f / 3f *
+ (sqrt(2 * (1 - cosa)) - sqrt(1 - cosa * cosa)) / (1 - cosa) *
+ if (clockwise) 1f else -1f
+ return Cubic(
+ x0, y0, x0 + rotatedP0.x * k, y0 + rotatedP0.y * k,
+ x1 - rotatedP1.x * k, y1 - rotatedP1.y * k, x1, y1
+ )
}
/**
@@ -243,11 +318,15 @@
@JvmStatic
fun interpolate(start: Cubic, end: Cubic, t: Float): Cubic {
return (Cubic(
- interpolate(start.p0, end.p0, t),
- interpolate(start.p1, end.p1, t),
- interpolate(start.p2, end.p2, t),
- interpolate(start.p3, end.p3, t),
+ interpolate(start.anchorX0, end.anchorX0, t),
+ interpolate(start.anchorY0, end.anchorY0, t),
+ interpolate(start.controlX0, end.controlX0, t),
+ interpolate(start.controlY0, end.controlY0, t),
+ interpolate(start.controlX1, end.controlX1, t),
+ interpolate(start.controlY1, end.controlY1, t),
+ interpolate(start.anchorX1, end.anchorX1, t),
+ interpolate(start.anchorY1, end.anchorY1, t),
))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt
index 90f1cfa..01f0233 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt
@@ -43,13 +43,13 @@
val copy = mutableListOf<Cubic>()
var prevCubic = cubics[cubics.size - 1]
for (cubic in cubics) {
- if (cubic.p0 != prevCubic.p3) {
+ if (cubic.anchorX0 != prevCubic.anchorX1 || cubic.anchorY0 != prevCubic.anchorY1) {
throw IllegalArgumentException("CubicShapes must be contiguous, with the anchor " +
"points of all curves matching the anchor points of the preceding and " +
"succeeding cubics")
}
prevCubic = cubic
- copy.add(Cubic(cubic.p0, cubic.p1, cubic.p2, cubic.p3))
+ copy.add(Cubic(cubic))
}
updateCubics(copy)
}
@@ -132,15 +132,16 @@
private fun updatePath() {
path.rewind()
if (cubics.isNotEmpty()) {
- path.moveTo(cubics[0].p0.x, cubics[0].p0.y)
+ path.moveTo(cubics[0].anchorX0, cubics[0].anchorY0)
for (bezier in cubics) {
path.cubicTo(
- bezier.p1.x, bezier.p1.y,
- bezier.p2.x, bezier.p2.y,
- bezier.p3.x, bezier.p3.y
+ bezier.controlX0, bezier.controlY0,
+ bezier.controlX1, bezier.controlY1,
+ bezier.anchorX1, bezier.anchorY1
)
}
}
+ path.close()
}
internal fun draw(canvas: Canvas, paint: Paint) {
@@ -157,26 +158,22 @@
var maxX = Float.MIN_VALUE
var maxY = Float.MIN_VALUE
for (bezier in cubics) {
- with(bezier.p0) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(bezier.p1) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(bezier.p2) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- // No need to use p3, since it is already taken into account in the next
- // curve's p0 point.
+ if (bezier.anchorX0 < minX) minX = bezier.anchorX0
+ if (bezier.anchorY0 < minY) minY = bezier.anchorY0
+ if (bezier.anchorX0 > maxX) maxX = bezier.anchorX0
+ if (bezier.anchorY0 > maxY) maxY = bezier.anchorY0
+
+ if (bezier.controlX0 < minX) minX = bezier.controlX0
+ if (bezier.controlY0 < minY) minY = bezier.controlY0
+ if (bezier.controlX0 > maxX) maxX = bezier.controlX0
+ if (bezier.controlY0 > maxY) maxY = bezier.controlY0
+
+ if (bezier.controlX1 < minX) minX = bezier.controlX1
+ if (bezier.controlY1 < minY) minY = bezier.controlY1
+ if (bezier.controlX1 > maxX) maxX = bezier.controlX1
+ if (bezier.controlY1 > maxY) maxY = bezier.controlY1
+ // No need to use x3/y3, since it is already taken into account in the next
+ // curve's x0/y0 point.
}
bounds.set(minX, minY, maxX, maxY)
}
@@ -204,4 +201,4 @@
*/
fun Canvas.drawCubicShape(shape: CubicShape, paint: Paint) {
shape.draw(this, paint)
-}
\ No newline at end of file
+}
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt
index 670ffbd..8b2073a 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt
@@ -16,10 +16,6 @@
package androidx.graphics.shapes
-import androidx.core.graphics.div
-import androidx.core.graphics.minus
-import androidx.core.graphics.plus
-
/**
* MeasuredFeatures contains a list of all features in a polygon along with the [0..1] progress
* at that feature
@@ -67,11 +63,13 @@
debugLog(LOG_TAG) { "*** Feature distance ∞ for convex-vs-concave corners" }
return Float.MAX_VALUE
}
- val (c1, c2) = listOf(f1, f2).map { f ->
- (f.cubics.first().p0 + f.cubics.last().p3) / 2f
- }
- val d = c1 - c2
- return d.x * d.x + d.y * d.y
+ val c1x = (f1.cubics.first().anchorX0 + f1.cubics.last().anchorX1) / 2f
+ val c1y = (f1.cubics.first().anchorY0 + f1.cubics.last().anchorY1) / 2f
+ val c2x = (f2.cubics.first().anchorX0 + f2.cubics.last().anchorX1) / 2f
+ val c2y = (f2.cubics.first().anchorY0 + f2.cubics.last().anchorY1) / 2f
+ val dx = c1x - c2x
+ val dy = c1y - c2y
+ return dx * dx + dy * dy
}
/**
@@ -104,4 +102,4 @@
return ret
}
-private val LOG_TAG = "FeatureMapping"
\ No newline at end of file
+private val LOG_TAG = "FeatureMapping"
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt
index b22bf9f..194520d 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt
@@ -38,18 +38,18 @@
progressInRange(x, xValues[it], xValues[(it + 1) % xValues.size])
}
val segmentEndIndex = (segmentStartIndex + 1) % xValues.size
- val segmentSizeX = positiveModule(
+ val segmentSizeX = positiveModulo(
xValues[segmentEndIndex] - xValues[segmentStartIndex],
1f
)
- val segmentSizeY = positiveModule(
+ val segmentSizeY = positiveModulo(
yValues[segmentEndIndex] - yValues[segmentStartIndex],
1f
)
val positionInSegment = segmentSizeX.let {
- if (it < 0.001f) 0.5f else positiveModule(x - xValues[segmentStartIndex], 1f) / it
+ if (it < 0.001f) 0.5f else positiveModulo(x - xValues[segmentStartIndex], 1f) / it
}
- return positiveModule(
+ return positiveModulo(
yValues[segmentStartIndex] + segmentSizeY * positionInSegment,
1f
)
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt
index a54af3d..641a16b 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt
@@ -50,14 +50,12 @@
private var morphMatch = match(start, end)
// path is used to draw the object
+ // It is cached to avoid recalculating it if the progress has not changed
private val path = Path()
- // These temp anchor/control points are used when progress changes to hold interpolated values
- // Using these structures avoids allocations during morph animation
- private val tempA0 = PointF()
- private val tempC0 = PointF()
- private val tempC1 = PointF()
- private val tempA1 = PointF()
+ // last value for which the cached path was constructed. We cache this and the path
+ // to avoid recreating the path for the same progress value
+ private var currentPathProgress: Float = Float.MIN_VALUE
/**
* The bounds of the morph object are estimated by control and anchor points of all cubic curves
@@ -67,7 +65,6 @@
init {
calculateBounds(bounds)
- updatePath()
}
/**
@@ -81,68 +78,48 @@
var maxX = Float.MIN_VALUE
var maxY = Float.MIN_VALUE
for (pair in morphMatch) {
- with(pair.first.p0) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(pair.second.p0) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(pair.first.p1) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(pair.second.p1) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(pair.first.p2) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- with(pair.second.p2) {
- if (x < minX) minX = x
- if (y < minY) minY = y
- if (x > maxX) maxX = x
- if (y > maxY) maxY = y
- }
- // Skip p3 since every p3 is the next curve's p0
+ if (pair.first.anchorX0 < minX) minX = pair.first.anchorX0
+ if (pair.first.anchorY0 < minY) minY = pair.first.anchorY0
+ if (pair.first.anchorX0 > maxX) maxX = pair.first.anchorX0
+ if (pair.first.anchorY0 > maxY) maxY = pair.first.anchorY0
+
+ if (pair.second.anchorX0 < minX) minX = pair.second.anchorX0
+ if (pair.second.anchorY0 < minY) minY = pair.second.anchorY0
+ if (pair.second.anchorX0 > maxX) maxX = pair.second.anchorX0
+ if (pair.second.anchorY0 > maxY) maxY = pair.second.anchorY0
+
+ if (pair.first.controlX0 < minX) minX = pair.first.controlX0
+ if (pair.first.controlY0 < minY) minY = pair.first.controlY0
+ if (pair.first.controlX0 > maxX) maxX = pair.first.controlX0
+ if (pair.first.controlY0 > maxY) maxY = pair.first.controlY0
+
+ if (pair.second.controlX0 < minX) minX = pair.second.controlX0
+ if (pair.second.controlY0 < minY) minY = pair.second.controlY0
+ if (pair.second.controlX0 > maxX) maxX = pair.second.controlX0
+ if (pair.second.controlY0 > maxY) maxY = pair.second.controlY0
+
+ if (pair.first.controlX1 < minX) minX = pair.first.controlX1
+ if (pair.first.controlY1 < minY) minY = pair.first.controlY1
+ if (pair.first.controlX1 > maxX) maxX = pair.first.controlX1
+ if (pair.first.controlY1 > maxY) maxY = pair.first.controlY1
+
+ if (pair.second.controlX1 < minX) minX = pair.second.controlX1
+ if (pair.second.controlY1 < minY) minY = pair.second.controlY1
+ if (pair.second.controlX1 > maxX) maxX = pair.second.controlX1
+ if (pair.second.controlY1 > maxY) maxY = pair.second.controlY1
+ // Skip x3/y3 since every last point is the next curve's first point
}
bounds.set(minX, minY, maxX, maxY)
}
/**
- * The progress of a [Morph] object is a value from 0 to 1 that determines its current
- * shape, between the start and end shapes provided at construction time. A value of 0 results
- * in the start shape, a value of 1 results in the end shape, and any value in between
- * results in a shape which is a linear interpolation between those two shapes.
- *
- * The range is generally [0..1] and values outside could result in undefined shapes, but
- * values close to (but outside) the range can be used to get an exaggerated effect
- * (e.g., for a bounce or overshoot animation).
- */
- var progress: Float = 0.0f
- set(value) {
- field = value
- updatePath()
- }
-
- /**
* This function updates the [path] object which holds the rendering information for the
* morph shape, using the current [progress] property for the morph.
*/
- private fun updatePath() {
+ private fun getPath(progress: Float): Path {
+ // Noop if we have already
+ if (progress == currentPathProgress) return path
+
// In a future release, Path interpolation may be possible through the Path API
// itself. Until then, we have to rewind and repopulate with the new/interpolated
// values
@@ -150,17 +127,27 @@
// If the list is not empty, do an initial moveTo using the first element of the match.
morphMatch.firstOrNull()?. let { first ->
- interpolate(first.first.p0, first.second.p0, tempA0, progress)
- path.moveTo(tempA0.x, tempA0.y)
+ path.moveTo(
+ interpolate(first.first.anchorX0, first.second.anchorX0, progress),
+ interpolate(first.first.anchorY0, first.second.anchorY0, progress)
+ )
}
// And one cubicTo for each element, including the first.
- for (element in morphMatch) {
- interpolate(element.first.p1, element.second.p1, tempC0, progress)
- interpolate(element.first.p2, element.second.p2, tempC1, progress)
- interpolate(element.first.p3, element.second.p3, tempA1, progress)
- path.cubicTo(tempC0.x, tempC0.y, tempC1.x, tempC1.y, tempA1.x, tempA1.y)
+ for (i in 0..morphMatch.lastIndex) {
+ val element = morphMatch[i]
+ path.cubicTo(
+ interpolate(element.first.controlX0, element.second.controlX0, progress),
+ interpolate(element.first.controlY0, element.second.controlY0, progress),
+ interpolate(element.first.controlX1, element.second.controlX1, progress),
+ interpolate(element.first.controlY1, element.second.controlY1, progress),
+ interpolate(element.first.anchorX1, element.second.anchorX1, progress),
+ interpolate(element.first.anchorY1, element.second.anchorY1, progress),
+ )
}
+ path.close()
+ currentPathProgress = progress
+ return path
}
/**
@@ -177,7 +164,8 @@
pair.second.transform(matrix)
}
calculateBounds(bounds)
- updatePath()
+ // Reset cached progress value to force recalculation due to transform change
+ currentPathProgress = Float.MIN_VALUE
}
/**
@@ -185,17 +173,38 @@
* retrieved for use outside of this class. Note that this function returns a copy of
* the internal [Path] to maintain immutability, thus there is some overhead in retrieving
* the path with this function.
+ *
+ * @param progress a value from 0 to 1 that determines the morph's current
+ * shape, between the start and end shapes provided at construction time. A value of 0 results
+ * in the start shape, a value of 1 results in the end shape, and any value in between
+ * results in a shape which is a linear interpolation between those two shapes.
+ * The range is generally [0..1] and values outside could result in undefined shapes, but
+ * values close to (but outside) the range can be used to get an exaggerated effect
+ * (e.g., for a bounce or overshoot animation).
+ * @param path optional Path object to be used to hold the resulting Path data. If provided,
+ * that Path's data will be replaced with the internal Path data for the Morph. If none
+ * is provided, new Path object will be created and used instead.
*/
- fun asPath(): Path {
- return Path(path)
+ @JvmOverloads
+ fun asPath(progress: Float, path: Path = Path()): Path {
+ path.set(getPath(progress))
+ return path
}
/**
- * Returns a view of the current state of this morph as a list of Cubics.
+ * Returns a representation of the morph object at a given [progress] value as a list of Cubics.
* Note that this function causes a new list to be created and populated, so there is some
* overhead.
+ *
+ * @param progress a value from 0 to 1 that determines the morph's current
+ * shape, between the start and end shapes provided at construction time. A value of 0 results
+ * in the start shape, a value of 1 results in the end shape, and any value in between
+ * results in a shape which is a linear interpolation between those two shapes.
+ * The range is generally [0..1] and values outside could result in undefined shapes, but
+ * values close to (but outside) the range can be used to get an exaggerated effect
+ * (e.g., for a bounce or overshoot animation).
*/
- fun asCubics() =
+ fun asCubics(progress: Float) =
mutableListOf<Cubic>().apply {
clear()
for (pair in morphMatch) {
@@ -239,8 +248,10 @@
// Measure polygons, returns lists of measured cubics for each polygon, which
// we then use to match start/end curves
- val measuredPolygon1 = MeasuredPolygon.measurePolygon(AngleMeasurer(p1.center), p1)
- val measuredPolygon2 = MeasuredPolygon.measurePolygon(AngleMeasurer(p2.center), p2)
+ val measuredPolygon1 = MeasuredPolygon.measurePolygon(
+ AngleMeasurer(p1.centerX, p1.centerY), p1)
+ val measuredPolygon2 = MeasuredPolygon.measurePolygon(
+ AngleMeasurer(p2.centerX, p2.centerY), p2)
// features1 and 2 will contain the list of corners (just the inner circular curve)
// along with the progress at the middle of those corners. These measurement values
@@ -295,7 +306,7 @@
// b1a, b2a are ending progress values of current measured cubics in [0,1] range
val b1a = if (i1 == bs1.size) 1f else b1.endOutlineProgress
val b2a = if (i2 == bs2.size) 1f else doubleMapper.mapBack(
- positiveModule(b2.endOutlineProgress + polygon2CutPoint, 1f)
+ positiveModulo(b2.endOutlineProgress + polygon2CutPoint, 1f)
)
val minb = min(b1a, b2a)
debugLog(LOG_TAG) { "$b1a $b2a | $minb" }
@@ -310,7 +321,7 @@
}
val (seg2, newb2) = if (b2a > minb + AngleEpsilon) {
debugLog(LOG_TAG) { "Cut 2" }
- b2.cutAtProgress(positiveModule(doubleMapper.map(minb) - polygon2CutPoint, 1f))
+ b2.cutAtProgress(positiveModulo(doubleMapper.map(minb) - polygon2CutPoint, 1f))
} else {
b2 to bs2.getOrNull(i2++)
}
@@ -329,11 +340,12 @@
repeat(2) { listIx ->
val points = ret.map { if (listIx == 0) it.first else it.second }
debugLog(LOG_TAG) {
- "M " + showPoint(points.first().p0) + " " +
+ "M " + showPoint(PointF(points.first().anchorX0,
+ points.first().anchorY0)) + " " +
points.joinToString(" ") {
- "C " + showPoint(it.p1) + ", " +
- showPoint(it.p2) + ", " +
- showPoint(it.p3)
+ "C " + showPoint(PointF(it.controlX0, it.controlY0)) + ", " +
+ showPoint(PointF(it.controlX1, it.controlY1)) + ", " +
+ showPoint(PointF(it.anchorX1, it.anchorY1))
} + " Z"
}
}
@@ -346,7 +358,8 @@
* Draws the Morph object. This is called by the public extension function
* [Canvas.drawMorph]. By default, it simply calls [Canvas.drawPath].
*/
- internal fun draw(canvas: Canvas, paint: Paint) {
+ internal fun draw(canvas: Canvas, paint: Paint, progress: Float) {
+ val path = getPath(progress)
canvas.drawPath(path, paint)
}
}
@@ -358,10 +371,17 @@
* path. This extension function avoids that overhead when rendering).
*
* @param morph The object to be drawn
- * @param paint The attributes
+ * @param paint The drawing attributes to be used when rendering the morph object
+ * @param progress a value from 0 to 1 that determines the morph's current
+ * shape, between the start and end shapes provided at construction time. A value of 0 results
+ * in the start shape, a value of 1 results in the end shape, and any value in between
+ * results in a shape which is a linear interpolation between those two shapes.
+ * The range is generally [0..1] and values outside could result in undefined shapes, but
+ * values close to (but outside) the range can be used to get an exaggerated effect
+ * (e.g., for a bounce or overshoot animation).
*/
-fun Canvas.drawMorph(morph: Morph, paint: Paint) {
- morph.draw(this, paint)
+fun Canvas.drawMorph(morph: Morph, paint: Paint, progress: Float = 0f) {
+ morph.draw(this, paint, progress)
}
-private val LOG_TAG = "Morph"
\ No newline at end of file
+private val LOG_TAG = "Morph"
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt
index 51db27d..152ea9a 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt
@@ -18,7 +18,6 @@
import android.graphics.PointF
import androidx.annotation.FloatRange
-import androidx.core.graphics.minus
import kotlin.math.abs
internal class MeasuredPolygon : AbstractList<MeasuredPolygon.MeasuredCubic> {
@@ -103,7 +102,7 @@
*/
fun cutAtProgress(cutOutlineProgress: Float): Pair<MeasuredCubic, MeasuredCubic> {
val outlineProgressSize = endOutlineProgress - startOutlineProgress
- val progressFromStart = positiveModule(cutOutlineProgress - startOutlineProgress, 1f)
+ val progressFromStart = positiveModulo(cutOutlineProgress - startOutlineProgress, 1f)
// progressFromStart should be in the [0 .. outlineProgressSize] range.
// If it's not, cap to that range.
val mid = if (progressFromStart > (1 + outlineProgressSize) / 2)
@@ -211,14 +210,14 @@
cubics.size + 1 -> 1f
else -> {
val cubicIndex = (targetIndex + index - 1) % cubics.size
- positiveModule(cubics[cubicIndex].endOutlineProgress - cuttingPoint, 1f)
+ positiveModulo(cubics[cubicIndex].endOutlineProgress - cuttingPoint, 1f)
}
}
}.asList()
// Shift the feature's outline progress too.
val newFeatures = features.map { (outlineProgress, feature) ->
- positiveModule(outlineProgress - cuttingPoint, 1f) to feature
+ positiveModulo(outlineProgress - cuttingPoint, 1f) to feature
}
// Filter out all empty cubics (i.e. start and end anchor are (almost) the same point.)
@@ -297,14 +296,19 @@
* no concept of a center, or the angles computed for an arbitrary center point might not be
* consistent enough across the curves to work for general measurement.
*/
-internal class AngleMeasurer(val center: PointF) : Measurer {
+internal class AngleMeasurer(val centerX: Float, val centerY: Float) : Measurer {
+
+ // Holds temporary pointOnCurve result, avoids re-allocations
+ private val tempPoint = PointF()
+
/**
* The measurement for a given cubic is the difference in angles between the start
* and end points (first and last anchors) of the cubic.
*/
override fun measureCubic(c: Cubic) =
- positiveModule(
- (c.p3 - center).angle() - (c.p0 - center).angle(),
+ positiveModulo(
+ angle(c.anchorX1 - centerX, c.anchorY1 - centerY) -
+ angle(c.anchorX0 - centerX, c.anchorY0 - centerY),
TwoPi
).let {
// Avoid an empty cubic to measure almost TwoPi
@@ -312,12 +316,14 @@
}
override fun findCubicCutPoint(c: Cubic, m: Float): Float {
- val angle0 = (c.p0 - center).angle()
+ val angle0 = angle(c.anchorX0 - centerX, c.anchorY0 - centerY)
// TODO: use binary search.
return findMinimum(0f, 1f, tolerance = 1e-5f) { t ->
- abs(positiveModule((c.pointOnCurve(t) - center).angle() - angle0, TwoPi) - m)
+ val curvePoint = c.pointOnCurve(t, tempPoint)
+ val angle = angle(curvePoint.x - centerX, curvePoint.y - centerY)
+ abs(positiveModulo(angle - angle0, TwoPi) - m)
}
}
}
-private val LOG_TAG = "PolygonMeasure"
\ No newline at end of file
+private val LOG_TAG = "PolygonMeasure"
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt
index 520b787..e492545 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt
@@ -59,12 +59,23 @@
// TODO center point should not be mutable
/**
- * The center of this polygon. The center is determined at construction time, either calculated
+ * The X coordinated of the center of this polygon.
+ * The center is determined at construction time, either calculated
* to be an average of all of the vertices of the polygon, or passed in as a parameter. This
* center may be used in later operations, to help determine (for example) the relative
* placement of points along the perimeter of the polygon.
*/
- var center: PointF
+ var centerX: Float
+ private set
+
+ /**
+ * The Y coordinated of the center of this polygon.
+ * The center is determined at construction time, either calculated
+ * to be an average of all of the vertices of the polygon, or passed in as a parameter. This
+ * center may be used in later operations, to help determine (for example) the relative
+ * placement of points along the perimeter of the polygon.
+ */
+ var centerY: Float
private set
/**
@@ -82,7 +93,7 @@
* corner-rounding parameters for all corners or per-corner.
*
* A RoundedPolygon without any rounding parameters is equivalent to a [RoundedPolygon]
- * constructed with the same [vertices] and [center].
+ * constructed with the same [vertices] and ([centerX], [centerY]) values.
*
* @param vertices The list of vertices in this polygon. This should be an ordered list
* (with the outline of the shape going from each vertex to the next in order of this
@@ -95,20 +106,33 @@
* parameter is not null, then it must have the same size as [vertices]. If this parameter
* is null, then the polygon will use the [rounding] parameter for every vertex instead. The
* default value is null.
- * @param center An optionally declared center of the polygon. If null or not supplied, this
- * will be calculated based on the supplied vertices.
+ * @param centerX The X coordinate of an optionally declared center of the polygon. If either
+ * [centerX] or [centerY] is not supplied, both will be calculated based on the supplied
+ * vertices.
+ * @param centerY The Y coordinate of an optionally declared center of the polygon. If either
+ * [centerX] or [centerY] is not supplied, both will be calculated based on the supplied
+ * vertices.
*
* @throws IllegalArgumentException If [perVertexRounding] is not null, it must be
* the same size as the [vertices] list.
* @throws IllegalArgumentException [vertices] must have a size of at least three.
*/
constructor(
- vertices: List<PointF>,
+ vertices: FloatArray,
rounding: CornerRounding = CornerRounding.Unrounded,
perVertexRounding: List<CornerRounding>? = null,
- center: PointF? = null
+ centerX: Float = Float.MIN_VALUE,
+ centerY: Float = Float.MIN_VALUE
) {
- this.center = center?.copy() ?: calculateCenter(vertices)
+ if (centerX == Float.MIN_VALUE || centerY == Float.MIN_VALUE) {
+ val center = PointF()
+ calculateCenter(vertices, center)
+ this.centerX = center.x
+ this.centerY = center.y
+ } else {
+ this.centerX = centerX
+ this.centerY = centerY
+ }
setupPolygon(vertices, rounding, perVertexRounding)
}
@@ -128,8 +152,10 @@
* @param radius The radius of the polygon, in pixels. This radius determines the
* initial size of the object, but it can be transformed later by setting
* a matrix on it.
- * @param center The center of the polygon, around which all vertices will be placed. The
- * default center is at (0,0).
+ * @param centerX The X coordinate of the center of the polygon, around which all vertices
+ * will be placed. The default center is at (0,0).
+ * @param centerY The Y coordinate of the center of the polygon, around which all vertices
+ * will be placed. The default center is at (0,0).
* @param rounding The [CornerRounding] properties of every vertex. If some vertices should
* have different rounding properties, then use [perVertexRounding] instead. The default
* rounding value is [CornerRounding.Unrounded], meaning that the polygon will use the vertices
@@ -146,14 +172,16 @@
constructor(
@IntRange(from = 3) numVertices: Int,
radius: Float = 1f,
- center: PointF = PointF(0f, 0f),
+ centerX: Float = 0f,
+ centerY: Float = 0f,
rounding: CornerRounding = CornerRounding.Unrounded,
perVertexRounding: List<CornerRounding>? = null
) : this(
- vertices = (0 until numVertices).map {
- radialToCartesian(radius, (FloatPi / numVertices * 2 * it)) + center
- },
- rounding = rounding, perVertexRounding = perVertexRounding, center = center)
+ verticesFromNumVerts(numVertices, radius, centerX, centerY),
+ rounding = rounding,
+ perVertexRounding = perVertexRounding,
+ centerX = centerX,
+ centerY = centerY)
constructor(source: RoundedPolygon) {
val newCubics = mutableListOf<Cubic>()
@@ -169,7 +197,8 @@
}
}
features = tempFeatures
- center = PointF(source.center.x, source.center.y)
+ centerX = source.centerX
+ centerY = source.centerY
cubicShape.updateCubics(newCubics)
}
@@ -192,28 +221,30 @@
* default value is null.
*/
private fun setupPolygon(
- vertices: List<PointF>,
+ vertices: FloatArray,
rounding: CornerRounding = CornerRounding.Unrounded,
perVertexRounding: List<CornerRounding>? = null
) {
- if (vertices.size < 3) {
+ if (vertices.size < 6) {
throw IllegalArgumentException("Polygons must have at least 3 vertices")
}
- if (perVertexRounding != null && perVertexRounding.size != vertices.size) {
+ if (perVertexRounding != null && perVertexRounding.size != vertices.size / 2) {
throw IllegalArgumentException("perVertexRounding list should be either null or " +
- "the same size as the vertices list")
+ "the same size as the number of vertices (2 * vertices.size)")
}
val cubics = mutableListOf<Cubic>()
val corners = mutableListOf<List<Cubic>>()
- val n = vertices.size
+ val n = vertices.size / 2
val roundedCorners = mutableListOf<RoundedCorner>()
for (i in 0 until n) {
val vtxRounding = perVertexRounding?.get(i) ?: rounding
+ val prevIndex = ((i + n - 1) % n) * 2
+ val nextIndex = ((i + 1) % n) * 2
roundedCorners.add(
RoundedCorner(
- vertices[(i + n - 1) % n],
- vertices[i],
- vertices[(i + 1) % n],
+ PointF(vertices[prevIndex], vertices[prevIndex + 1]),
+ PointF(vertices[i * 2], vertices[i * 2 + 1]),
+ PointF(vertices[nextIndex], vertices[nextIndex + 1]),
vtxRounding
)
)
@@ -229,7 +260,11 @@
roundedCorners[(ix + 1) % n].expectedRoundCut
val expectedCut = roundedCorners[ix].expectedCut +
roundedCorners[(ix + 1) % n].expectedCut
- val sideSize = (vertices[ix] - vertices[(ix + 1) % n]).getDistance()
+ val vtxX = vertices[ix * 2]
+ val vtxY = vertices[ix * 2 + 1]
+ val nextVtxX = vertices[((ix + 1) % n) * 2]
+ val nextVtxY = vertices[((ix + 1) % n) * 2 + 1]
+ val sideSize = distance(vtxX - nextVtxX, vtxY - nextVtxY)
// Check expectedRoundCut first, and ensure we fulfill rounding needs first for
// both corners before using space for smoothing
@@ -271,13 +306,19 @@
}
// Determine whether corner at this vertex is concave or convex, based on the
// relationship of the prev->curr/curr->next vectors
- val prevVertex = vertices[(i + vertices.size - 1) % vertices.size]
- val nextVertex = vertices[(i + 1) % vertices.size]
- val convex = (vertices[i] - prevVertex).clockwise(nextVertex - vertices[i])
- tempFeatures.add(Corner(cornerIndices, roundedCorners[i].center, vertices[i],
- convex))
+ // Note that these indices are for pairs of values (points), they need to be
+ // doubled to access the xy values in the vertices float array
+ val prevVtxIndex = (i + n - 1) % n
+ val nextVtxIndex = (i + 1) % n
+ val currVertex = PointF(vertices[i * 2], vertices[i * 2 + 1])
+ val prevVertex = PointF(vertices[prevVtxIndex * 2], vertices[prevVtxIndex * 2 + 1])
+ val nextVertex = PointF(vertices[nextVtxIndex * 2], vertices[nextVtxIndex * 2 + 1])
+ val convex = (currVertex - prevVertex).clockwise(nextVertex - currVertex)
+ tempFeatures.add(Corner(cornerIndices, roundedCorners[i].center, currVertex,
+ convex))
tempFeatures.add(Edge(listOf(cubics.size)))
- cubics.add(Cubic.straightLine(corners[i].last().p3, corners[(i + 1) % n].first().p0))
+ cubics.add(Cubic.straightLine(corners[i].last().anchorX1, corners[i].last().anchorY1,
+ corners[(i + 1) % n].first().anchorX0, corners[(i + 1) % n].first().anchorY0))
}
features = tempFeatures
cubicShape.updateCubics(cubics)
@@ -302,11 +343,11 @@
fun transform(matrix: Matrix) {
cubicShape.transform(matrix)
val point = scratchTransformPoint
- point[0] = center.x
- point[1] = center.y
+ point[0] = centerX
+ point[1] = centerY
matrix.mapPoints(point)
- center.x = point[0]
- center.y = point[1]
+ centerX = point[0]
+ centerY = point[1]
for (feature in features) {
feature.transform(matrix)
}
@@ -335,26 +376,27 @@
}
/**
- * Calculates an estimated center position for the polygon, storing it in the [center] property.
+ * Calculates an estimated center position for the polygon, storing it in the [centerX]
+ * and [centerY] properties.
* This function should only be called if the center is not already calculated or provided.
* The Polygon constructor which takes `numVertices` calculates its own center, since it
- * knows exactly where it starts out (0, 0).
+ * knows exactly where it is centered, at (0, 0).
*
* Note that this center will be transformed whenever the shape itself is transformed.
* Any transforms that occur before the center is calculated will be taken into account
* automatically since the center calculation is an average of the current location of
* all cubic anchor points.
*/
- private fun calculateCenter(vertices: List<PointF>): PointF {
+ private fun calculateCenter(vertices: FloatArray, result: PointF) {
var cumulativeX = 0f
var cumulativeY = 0f
- for (vertex in vertices) {
- // Only care about anchor points, and since all cubics share one of their anchors,
- // only need one anchor per cubic
- cumulativeX += vertex.x
- cumulativeY += vertex.y
+ var index = 0
+ while (index < vertices.size) {
+ cumulativeX += vertices[index++]
+ cumulativeY += vertices[index++]
}
- return PointF(cumulativeX / vertices.size, cumulativeY / vertices.size)
+ result.x = cumulativeX / vertices.size / 2
+ result.y = cumulativeY / vertices.size / 2
}
/**
@@ -489,7 +531,7 @@
cornerRadius < DistanceEpsilon
) {
center = p1
- return listOf(Cubic.straightLine(p1, p1))
+ return listOf(Cubic.straightLine(p1.x, p1.y, p1.x, p1.y))
}
// How much of the cut is required for the rounding part.
val actualRoundCut = min(allowedCut, expectedRoundCut)
@@ -516,7 +558,8 @@
).reverse()
return listOf(
flanking0,
- Cubic.circularArc(center, flanking0.p3, flanking2.p0),
+ Cubic.circularArc(center.x, center.y, flanking0.anchorX1, flanking0.anchorY1,
+ flanking2.anchorX0, flanking2.anchorY0),
flanking2
)
}
@@ -573,12 +616,15 @@
// We use an approximation to cut a part of the circle section proportional to 1 - smooth,
// When smooth = 0, we take the full section, when smooth = 1, we take nothing.
// TODO: revisit this, it can be problematic as it approaches 19- degrees
- val p = interpolate(circleSegmentIntersection,
- (circleSegmentIntersection + otherCircleSegmentIntersection) / 2f,
- actualSmoothingValues
- )
+ val px = interpolate(circleSegmentIntersection.x,
+ (circleSegmentIntersection.x + otherCircleSegmentIntersection.x) / 2f,
+ actualSmoothingValues)
+ val py = interpolate(circleSegmentIntersection.y,
+ (circleSegmentIntersection.y + otherCircleSegmentIntersection.y) / 2f,
+ actualSmoothingValues)
// The flanking curve ends on the circle
- val curveEnd = circleCenter + (p - circleCenter).getDirection() * actualR
+ val curveEnd = circleCenter +
+ directionVector(px - circleCenter.x, py - circleCenter.y) * actualR
// The anchor on the circle segment side is in the intersection between the tangent to the
// circle in the circle/flanking curve boundary and the linear segment.
val circleTangent = (curveEnd - circleCenter).rotate90()
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt
index 7c4d3ec..24c1e9c 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt
@@ -16,7 +16,6 @@
package androidx.graphics.shapes
-import android.graphics.PointF
import androidx.annotation.IntRange
import kotlin.math.cos
@@ -27,7 +26,8 @@
* @param numVertices The number of vertices in the underlying polygon with which to
* approximate the circle, default value is 8
* @param radius optional radius for the circle, default value is 1.0
- * @param center optional center for the circle, default value is (0, 0)
+ * @param centerX X coordinate of optional center for the circle, default value is 0
+ * @param centerY Y coordinate of optional center for the circle, default value is 0
*
* @throws IllegalArgumentException [numVertices] must be at least 3
*/
@@ -35,7 +35,8 @@
fun RoundedPolygon.Companion.circle(
@IntRange(from = 3) numVertices: Int = 8,
radius: Float = 1f,
- center: PointF = Zero
+ centerX: Float = 0f,
+ centerY: Float = 0f
): RoundedPolygon {
if (numVertices < 3) throw IllegalArgumentException("Circle must have at least three vertices")
@@ -46,7 +47,7 @@
val polygonRadius = radius / cos(theta)
return RoundedPolygon(
numVertices, rounding = CornerRounding(radius), radius = polygonRadius,
- center = center
+ centerX = centerX, centerY = centerY
)
}
@@ -69,26 +70,27 @@
* parameter is not null, then it must be of size 4 for the four corners of the shape. If this
* parameter is null, then the polygon will use the [rounding] parameter for every vertex instead.
* The default value is null.
- * @param center The center of the rectangle, around which all vertices will be placed
- * equidistantly. The default center is at (0,0).
+ * @param centerX The X coordinate of the center of the rectangle, around which all vertices will
+ * be placed equidistantly. The default center is at (0,0).
+ * @param centerY The X coordinate of the center of the rectangle, around which all vertices will
+ * be placed equidistantly. The default center is at (0,0).
*/
fun RoundedPolygon.Companion.rectangle(
width: Float = 2f,
height: Float = 2f,
rounding: CornerRounding = CornerRounding.Unrounded,
perVertexRounding: List<CornerRounding>? = null,
- center: PointF = Zero
+ centerX: Float = 0f,
+ centerY: Float = 0f
): RoundedPolygon {
- val left = center.x - width / 2
- val top = center.y - height / 2
- val right = center.x + width / 2
- val bottom = center.y + height / 2
+ val left = centerX - width / 2
+ val top = centerY - height / 2
+ val right = centerX + width / 2
+ val bottom = centerY + height / 2
return RoundedPolygon(
- listOf(
- PointF(right, bottom), PointF(left, bottom), PointF(left, top),
- PointF(right, top)
- ), rounding, perVertexRounding, center
+ floatArrayOf(right, bottom, left, bottom, left, top, right, top),
+ rounding, perVertexRounding, centerX, centerY
)
}
@@ -114,8 +116,10 @@
* parameter is not null, then it must have the same size as 2 * [numVerticesPerRadius]. If this
* parameter is null, then the polygon will use the [rounding] parameter for every vertex instead.
* The default value is null.
- * @param center The center of the polygon, around which all vertices will be placed. The
- * default center is at (0,0).
+ * @param centerX The X coordinate of the center of the polygon, around which all vertices will
+ * be placed. The default center is at (0,0).
+ * @param centerY The Y coordinate of the center of the polygon, around which all vertices will
+ * be placed. The default center is at (0,0).
*
* @throws IllegalArgumentException if either [radius] or [innerRadius] are <= 0 or
* [innerRadius] > [radius].
@@ -128,7 +132,8 @@
rounding: CornerRounding = CornerRounding.Unrounded,
innerRounding: CornerRounding? = null,
perVertexRounding: List<CornerRounding>? = null,
- center: PointF = Zero
+ centerX: Float = 0f,
+ centerY: Float = 0f
): RoundedPolygon {
if (radius <= 0f || innerRadius <= 0f) {
throw IllegalArgumentException("Star radii must both be greater than 0")
@@ -148,10 +153,7 @@
// Star polygon is just a polygon with all vertices supplied (where we generate
// those vertices to be on the inner/outer radii)
- return RoundedPolygon((0 until numVerticesPerRadius).flatMap {
- listOf(
- radialToCartesian(radius, (FloatPi / numVerticesPerRadius * 2 * it), center),
- radialToCartesian(innerRadius, FloatPi / numVerticesPerRadius * (2 * it + 1), center)
- )
- }, rounding, pvRounding, center)
+ return RoundedPolygon(
+ starVerticesFromNumVerts(numVerticesPerRadius, radius, innerRadius, centerX, centerY),
+ rounding, pvRounding, centerX, centerY)
}
diff --git a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt
index 23d9bfd..9ed7748 100644
--- a/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt
+++ b/graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt
@@ -35,25 +35,10 @@
internal fun interpolate(start: Float, stop: Float, fraction: Float) =
(start * (1 - fraction) + stop * fraction)
-internal fun interpolate(start: PointF, stop: PointF, fraction: Float): PointF {
- return PointF(
- interpolate(start.x, stop.x, fraction),
- interpolate(start.y, stop.y, fraction)
- )
-}
-
-/**
- * Non-allocating version of interpolate; values are stored in [result]
- */
-internal fun interpolate(start: PointF, stop: PointF, result: PointF, fraction: Float): PointF {
- result.x = interpolate(start.x, stop.x, fraction)
- result.y = interpolate(start.y, stop.y, fraction)
- return result
-}
-
internal fun PointF.getDistance() = sqrt(x * x + y * y)
internal fun PointF.dotProduct(other: PointF) = x * other.x + y * other.y
+internal fun PointF.dotProduct(otherX: Float, otherY: Float) = x * otherX + y * otherY
/**
* Compute the Z coordinate of the cross product of two vectors, to check if the second vector is
@@ -71,6 +56,16 @@
this / d
}
+internal fun distance(x: Float, y: Float) = sqrt(x * x + y * y)
+
+/**
+ * Returns unit vector representing the direction to this point from (0, 0)
+ */
+internal fun directionVector(x: Float, y: Float): PointF {
+ val d = distance(x, y)
+ require(d > 0f)
+ return PointF(x / d, y / d)
+}
/**
* These epsilon values are used internally to determine when two points are the same, within
* some reasonable roundoff error. The distance epsilon is smaller, with the intention that the
@@ -96,10 +91,12 @@
internal fun PointF.angle() = ((atan2(y, x) + TwoPi) % TwoPi)
+internal fun angle(x: Float, y: Float) = ((atan2(y, x) + TwoPi) % TwoPi)
+
internal fun radialToCartesian(radius: Float, angleRadians: Float, center: PointF = Zero) =
directionVector(angleRadians) * radius + center
-internal fun positiveModule(num: Float, mod: Float) = (num % mod + mod) % mod
+internal fun positiveModulo(num: Float, mod: Float) = (num % mod + mod) % mod
/*
* Does a ternary search in [v0..v1] to find the parameter that minimizes the given function.
@@ -128,9 +125,48 @@
return (a + b) / 2
}
+internal fun verticesFromNumVerts(
+ numVertices: Int,
+ radius: Float,
+ centerX: Float,
+ centerY: Float
+): FloatArray {
+ val result = FloatArray(numVertices * 2)
+ var arrayIndex = 0
+ for (i in 0 until numVertices) {
+ val vertex = radialToCartesian(radius, (FloatPi / numVertices * 2 * i)) +
+ PointF(centerX, centerY)
+ result[arrayIndex++] = vertex.x
+ result[arrayIndex++] = vertex.y
+ }
+ return result
+}
+
+internal fun starVerticesFromNumVerts(
+ numVerticesPerRadius: Int,
+ radius: Float,
+ innerRadius: Float,
+ centerX: Float,
+ centerY: Float
+): FloatArray {
+ val result = FloatArray(numVerticesPerRadius * 4)
+ var arrayIndex = 0
+ for (i in 0 until numVerticesPerRadius) {
+ var vertex = radialToCartesian(radius, (FloatPi / numVerticesPerRadius * 2 * i)) +
+ PointF(centerX, centerY)
+ result[arrayIndex++] = vertex.x
+ result[arrayIndex++] = vertex.y
+ vertex = radialToCartesian(innerRadius, (FloatPi / numVerticesPerRadius * (2 * i + 1))) +
+ PointF(centerX, centerY)
+ result[arrayIndex++] = vertex.x
+ result[arrayIndex++] = vertex.y
+ }
+ return result
+}
+
// Used to enable debug logging in the library
-internal val DEBUG = true
+internal val DEBUG = false
internal inline fun debugLog(tag: String, messageFactory: () -> String) {
if (DEBUG) messageFactory().split("\n").forEach { Log.d(tag, it) }
-}
\ No newline at end of file
+}
diff --git a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt
index 95bd121..613c6a8 100644
--- a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt
+++ b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt
@@ -27,7 +27,8 @@
import androidx.graphics.shapes.CubicShape
import androidx.graphics.shapes.Morph
-internal fun DrawScope.debugDraw(morph: Morph) = debugDraw(morph.asCubics(), morph.asPath())
+internal fun DrawScope.debugDraw(morph: Morph, progress: Float) =
+ debugDraw(morph.asCubics(progress), morph.asPath(progress))
internal fun DrawScope.debugDraw(cubicShape: CubicShape) =
debugDraw(cubicShape.cubics, cubicShape.toPath())
@@ -37,17 +38,19 @@
for (bezier in cubics) {
// Draw red circles for start and end.
- drawCircle(bezier.p0, 6f, Color.Red, strokeWidth = 2f)
- drawCircle(bezier.p3, 8f, Color.Magenta, strokeWidth = 2f)
+ drawCircle(bezier.anchorX0, bezier.anchorY0, 6f, Color.Red, strokeWidth = 2f)
+ drawCircle(bezier.anchorX1, bezier.anchorY1, 8f, Color.Magenta, strokeWidth = 2f)
// Draw a circle for the first control point, and a line from start to it.
// The curve will start in this direction
- drawLine(bezier.p0, bezier.p1, Color.Yellow, strokeWidth = 0f)
- drawCircle(bezier.p1, 4f, Color.Yellow, strokeWidth = 2f)
+ drawLine(bezier.anchorX0, bezier.anchorY0, bezier.controlX0, bezier.controlY0, Color.Yellow,
+ strokeWidth = 0f)
+ drawCircle(bezier.controlX0, bezier.controlY0, 4f, Color.Yellow, strokeWidth = 2f)
// Draw a circle for the second control point, and a line from it to the end.
// The curve will end in this direction
- drawLine(bezier.p2, bezier.p3, Color.Yellow, strokeWidth = 0f)
- drawCircle(bezier.p2, 4f, Color.Yellow, strokeWidth = 2f)
+ drawLine(bezier.controlX1, bezier.controlY1, bezier.anchorX1, bezier.anchorY1, Color.Yellow,
+ strokeWidth = 0f)
+ drawCircle(bezier.controlX1, bezier.controlY1, 4f, Color.Yellow, strokeWidth = 2f)
}
}
@@ -64,6 +67,28 @@
) {
drawCircle(color, radius, center.asOffset(), style = Stroke(strokeWidth))
}
+
+private fun DrawScope.drawCircle(
+ centerX: Float,
+ centerY: Float,
+ radius: Float,
+ color: Color,
+ strokeWidth: Float = 2f
+) {
+ drawCircle(color, radius, Offset(centerX, centerY), style = Stroke(strokeWidth))
+}
+
private fun DrawScope.drawLine(start: PointF, end: PointF, color: Color, strokeWidth: Float = 2f) {
drawLine(color, start.asOffset(), end.asOffset(), strokeWidth = strokeWidth)
}
+
+private fun DrawScope.drawLine(
+ startX: Float,
+ startY: Float,
+ endX: Float,
+ endY: Float,
+ color: Color,
+ strokeWidth: Float = 2f
+) {
+ drawLine(color, Offset(startX, startY), Offset(endX, endY), strokeWidth = strokeWidth)
+}
diff --git a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/MainActivity.kt b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/MainActivity.kt
index d49c55a..f174290 100644
--- a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/MainActivity.kt
+++ b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/MainActivity.kt
@@ -53,7 +53,6 @@
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asComposePath
-import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.unit.dp
import androidx.fragment.app.FragmentActivity
import androidx.graphics.shapes.Morph
@@ -69,13 +68,10 @@
@Composable
private fun MorphComposable(
sizedMorph: SizedMorph,
- progress: () -> Float,
+ progress: Float,
modifier: Modifier = Modifier,
isDebug: Boolean = false
-) =
- MorphComposableImpl(sizedMorph, modifier, isDebug) {
- sizedMorph.morph.progress = progress()
- }
+) = MorphComposableImpl(sizedMorph, modifier, isDebug, progress)
internal fun calculateMatrix(bounds: RectF, width: Float, height: Float): Matrix {
val originalWidth = bounds.right - bounds.left
@@ -123,19 +119,18 @@
sizedMorph: SizedMorph,
modifier: Modifier = Modifier,
isDebug: Boolean = false,
- prep: ContentDrawScope.() -> Unit
+ progress: Float
) {
Box(
modifier
.fillMaxSize()
.drawWithContent {
- prep()
drawContent()
sizedMorph.resizeMaybe(size.width, size.height)
if (isDebug) {
- debugDraw(sizedMorph.morph)
+ debugDraw(sizedMorph.morph, progress = progress)
} else {
- drawPath(sizedMorph.morph.asPath().asComposePath(), Color.White)
+ drawPath(sizedMorph.morph.asPath(progress).asComposePath(), Color.White)
}
})
}
@@ -369,7 +364,7 @@
Slider(value = progress.value.coerceIn(0f, 1f), onValueChange = {
scope.launch { progress.snapTo(it) }
})
- MorphComposable(morphed, { progress.value },
+ MorphComposable(morphed, progress.value,
Modifier
.fillMaxSize()
.clickable(
diff --git a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt
index 7df2d10..abe70b1c 100644
--- a/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt
+++ b/graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt
@@ -167,16 +167,20 @@
),
ShapeItem(
"Triangle", shapegen = {
- val points = listOf(
- radialToCartesian(1f, 270f.toRadians()),
- radialToCartesian(1f, 30f.toRadians()),
- radialToCartesian(this.innerRadius.value, 90f.toRadians()),
- radialToCartesian(1f, 150f.toRadians()),
+ val points = floatArrayOf(
+ radialToCartesian(1f, 270f.toRadians()).x,
+ radialToCartesian(1f, 270f.toRadians()).y,
+ radialToCartesian(1f, 30f.toRadians()).x,
+ radialToCartesian(1f, 30f.toRadians()).y,
+ radialToCartesian(this.innerRadius.value, 90f.toRadians()).x,
+ radialToCartesian(this.innerRadius.value, 90f.toRadians()).y,
+ radialToCartesian(1f, 150f.toRadians()).x,
+ radialToCartesian(1f, 150f.toRadians()).y
)
RoundedPolygon(
points,
CornerRounding(this.roundness.value, this.smooth.value),
- center = PointZero
+ centerX = PointZero.x, centerY = PointZero.y
)
},
debugDump = {
@@ -194,14 +198,13 @@
val sx = this.innerRadius.value.coerceAtLeast(0.1f)
val sy = this.roundness.value.coerceAtLeast(0.1f)
RoundedPolygon(
- listOf(
- PointF(-sx, -sy),
- PointF(sx, -sy),
- PointF(sx, sy),
- PointF(-sx, sy),
+ vertices = floatArrayOf(-sx, -sy,
+ sx, -sy,
+ sx, sy,
+ -sx, sy,
),
rounding = CornerRounding(min(sx, sy), this.smooth.value),
- center = PointZero
+ centerX = 0f, centerY = 0f
)
},
debugDump = {
@@ -217,14 +220,14 @@
ShapeItem(
"CornerSE", shapegen = {
RoundedPolygon(
- SquarePoints(),
+ squarePoints(),
perVertexRounding = listOf(
CornerRounding(this.roundness.value, this.smooth.value),
CornerRounding(1f),
CornerRounding(1f),
CornerRounding(1f)
),
- center = PointZero
+ centerX = PointZero.x, centerY = PointZero.y
)
},
debugDump = {
@@ -287,7 +290,6 @@
transform(Matrix().apply {
if (autoSize) {
// Move the center to the origin.
- center
postTranslate(-(bounds.left + bounds.right) / 2, -(bounds.top + bounds.bottom) / 2)
// Scale to the [-1, 1] range
@@ -420,13 +422,7 @@
return PointF(this.x * factor, this.y * factor)
}
-// Create a new list every time, because mutability is complicated.
-private fun SquarePoints() = listOf(
- PointF(1f, 1f),
- PointF(-1f, 1f),
- PointF(-1f, -1f),
- PointF(1f, -1f)
-)
+private fun squarePoints() = floatArrayOf(1f, 1f, -1f, 1f, -1f, -1f, 1f, -1f)
internal fun directionVectorPointF(angleRadians: Float) =
PointF(cos(angleRadians), sin(angleRadians))
diff --git a/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt b/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt
index 0a61eae..6d04424 100644
--- a/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt
+++ b/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt
@@ -37,12 +37,8 @@
return PointF(this.x * factor, this.y * factor)
}
- private val SquarePoints = listOf(
- PointF(1f, 1f),
- PointF(-1f, 1f),
- PointF(-1f, -1f),
- PointF(1f, -1f)
- )
+ private val SquarePoints = floatArrayOf(1f, 1f, -1f, 1f, -1f, -1f, 1f, -1f)
+
internal fun Float.toRadians(): Float {
return this / 360f * 2 * FloatPI
}
@@ -56,12 +52,16 @@
directionVector(angleRadians) * radius + center
@JvmStatic
- fun triangleChip(radiusRatio: Float, rounding: CornerRounding): RoundedPolygon {
- val points = listOf(
- radialToCartesian(1f, 270f.toRadians()),
- radialToCartesian(1f, 30f.toRadians()),
- radialToCartesian(radiusRatio, 90f.toRadians()),
- radialToCartesian(1f, 150f.toRadians()),
+ fun triangleChip(innerRadius: Float, rounding: CornerRounding): RoundedPolygon {
+ val points = floatArrayOf(
+ radialToCartesian(1f, 270f.toRadians()).x,
+ radialToCartesian(1f, 270f.toRadians()).y,
+ radialToCartesian(1f, 30f.toRadians()).x,
+ radialToCartesian(1f, 30f.toRadians()).y,
+ radialToCartesian(innerRadius, 90f.toRadians()).x,
+ radialToCartesian(innerRadius, 90f.toRadians()).y,
+ radialToCartesian(1f, 150f.toRadians()).x,
+ radialToCartesian(1f, 150f.toRadians()).y
)
return RoundedPolygon(points, rounding)
}
@@ -80,14 +80,12 @@
@JvmOverloads
@JvmStatic
- fun blobR(radiusRatio: Float, roundnessRatio: Float, smooth: Float = 0f): RoundedPolygon {
- return RoundedPolygon(listOf(
- PointF(-radiusRatio, -roundnessRatio),
- PointF(radiusRatio, -roundnessRatio),
- PointF(radiusRatio, roundnessRatio),
- PointF(-radiusRatio, roundnessRatio),
- ), CornerRounding(roundnessRatio, smooth)
- )
+ fun blobR(innerRadius: Float, roundness: Float, smooth: Float = 0f): RoundedPolygon {
+ val sx = innerRadius.coerceAtLeast(0.1f)
+ val sy = roundness.coerceAtLeast(0.1f)
+ return RoundedPolygon(
+ vertices = floatArrayOf(-sx, -sy, sx, -sy, sx, sy, -sx, sy,
+ ), CornerRounding(roundness, smooth))
}
@JvmOverloads
@@ -152,4 +150,4 @@
return RoundedPolygon(numVertices = 5, rounding = CornerRounding(.3f))
}
}
-}
\ No newline at end of file
+}
diff --git a/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/ShapeView.kt b/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/ShapeView.kt
index 176f118..e93bc68 100644
--- a/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/ShapeView.kt
+++ b/graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/ShapeView.kt
@@ -64,4 +64,4 @@
override fun onDraw(canvas: Canvas) {
canvas.drawPolygon(shape, paint)
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/lint-baseline.xml b/health/connect/connect-client/lint-baseline.xml
index dfb1ec9..d0e77cb 100644
--- a/health/connect/connect-client/lint-baseline.xml
+++ b/health/connect/connect-client/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.1.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta02)" variant="all" version="8.1.0-beta02">
+<issues format="6" by="lint 8.1.0-beta05" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta05)" variant="all" version="8.1.0-beta05">
<issue
id="BanSynchronizedMethods"
@@ -11,42 +11,6 @@
</issue>
<issue
- id="PrereleaseSdkCoreDependency"
- message="Prelease SDK check isAtLeastU cannot be called as this project has a versioned dependency on androidx.core:core"
- errorLine1=" if (BuildCompat.isAtLeastU()) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/health/connect/client/PermissionController.kt"/>
- </issue>
-
- <issue
- id="PrereleaseSdkCoreDependency"
- message="Prelease SDK check isAtLeastU cannot be called as this project has a versioned dependency on androidx.core:core"
- errorLine1=" if (BuildCompat.isAtLeastU()) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/health/connect/client/PermissionController.kt"/>
- </issue>
-
- <issue
- id="PrereleaseSdkCoreDependency"
- message="Prelease SDK check isAtLeastU cannot be called as this project has a versioned dependency on androidx.core:core"
- errorLine1=" if (BuildCompat.isAtLeastU()) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/health/connect/client/PermissionController.kt"/>
- </issue>
-
- <issue
- id="PrereleaseSdkCoreDependency"
- message="Prelease SDK check isAtLeastU cannot be called as this project has a versioned dependency on androidx.core:core"
- errorLine1=" if (BuildCompat.isAtLeastU()) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/health/connect/client/PermissionController.kt"/>
- </issue>
-
- <issue
id="RequireUnstableAidlAnnotation"
message="Unstable AIDL files must be annotated with `@RequiresOptIn` marker"
errorLine1="parcelable AggregateDataRequest;"
diff --git a/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/records/package-info.java b/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/records/package-info.java
index c5b8a8e..597a6c1 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/records/package-info.java
+++ b/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/records/package-info.java
@@ -16,8 +16,6 @@
/**
* Helps with conversions to the platform record and API objects.
- *
- * @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
package androidx.health.connect.client.impl.platform.records;
diff --git a/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/response/package-info.java b/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/response/package-info.java
index f8b9cb7..a743964 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/response/package-info.java
+++ b/health/connect/connect-client/src/main/java/androidx/health/connect/client/impl/platform/response/package-info.java
@@ -16,8 +16,6 @@
/**
* Helps with conversions to the platform record and API objects.
- *
- * @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
package androidx.health.connect.client.impl.platform.response;
diff --git a/health/connect/connect-client/src/main/java/androidx/health/connect/client/records/MenstruationPeriodRecord.kt b/health/connect/connect-client/src/main/java/androidx/health/connect/client/records/MenstruationPeriodRecord.kt
index c256001..d81ee8e 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/connect/client/records/MenstruationPeriodRecord.kt
+++ b/health/connect/connect-client/src/main/java/androidx/health/connect/client/records/MenstruationPeriodRecord.kt
@@ -42,7 +42,7 @@
/*
* Generated by the IDE: Code -> Generate -> "equals() and hashCode()".
- **/
+ */
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is MenstruationPeriodRecord) return false
@@ -58,7 +58,7 @@
/*
* Generated by the IDE: Code -> Generate -> "equals() and hashCode()".
- **/
+ */
override fun hashCode(): Int {
var result = startTime.hashCode()
result = 31 * result + (startZoneOffset?.hashCode() ?: 0)
@@ -71,4 +71,4 @@
private companion object {
private val MAX_DURATION = Duration.ofDays(31)
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/RegisterForDataNotificationsRequest.kt b/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/RegisterForDataNotificationsRequest.kt
index 3e810cd..65a4a24 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/RegisterForDataNotificationsRequest.kt
+++ b/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/RegisterForDataNotificationsRequest.kt
@@ -34,4 +34,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/UnregisterFromDataNotificationsRequest.kt b/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/UnregisterFromDataNotificationsRequest.kt
index 4422d71..581da9b 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/UnregisterFromDataNotificationsRequest.kt
+++ b/health/connect/connect-client/src/main/java/androidx/health/platform/client/request/UnregisterFromDataNotificationsRequest.kt
@@ -34,4 +34,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseLapTest.kt b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseLapTest.kt
index 48c7202..1fe9c08 100644
--- a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseLapTest.kt
+++ b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseLapTest.kt
@@ -76,4 +76,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseSegmentTest.kt b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseSegmentTest.kt
index b1d35f8..37340b6 100644
--- a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseSegmentTest.kt
+++ b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/ExerciseSegmentTest.kt
@@ -281,4 +281,4 @@
message = "$sessionType and $segmentType is not compatible"
)
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/RecordArgumentOrderTest.kt b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/RecordArgumentOrderTest.kt
index eb29a03a..a191790 100644
--- a/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/RecordArgumentOrderTest.kt
+++ b/health/connect/connect-client/src/test/java/androidx/health/connect/client/records/RecordArgumentOrderTest.kt
@@ -40,4 +40,4 @@
assertThat(pars).containsNoneOf(Instant::class.java, ZoneOffset::class.java)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/connect/connect-client/src/test/java/androidx/health/platform/client/utils/IntentExtTest.kt b/health/connect/connect-client/src/test/java/androidx/health/platform/client/utils/IntentExtTest.kt
index 0e117fb..e2e2625 100644
--- a/health/connect/connect-client/src/test/java/androidx/health/platform/client/utils/IntentExtTest.kt
+++ b/health/connect/connect-client/src/test/java/androidx/health/platform/client/utils/IntentExtTest.kt
@@ -101,4 +101,4 @@
return newIntent
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/HealthServicesException.kt b/health/health-services-client/src/main/java/androidx/health/services/client/HealthServicesException.kt
index c9628dc..20fc0c7 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/HealthServicesException.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/HealthServicesException.kt
@@ -17,4 +17,4 @@
package androidx.health.services.client
/** Exception class for all the Health Services errors. */
-class HealthServicesException(message: String) : Exception(message)
\ No newline at end of file
+class HealthServicesException(message: String) : Exception(message)
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/ListenableFutureExtension.kt b/health/health-services-client/src/main/java/androidx/health/services/client/ListenableFutureExtension.kt
index 4f9086d..dd5254b 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/ListenableFutureExtension.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/ListenableFutureExtension.kt
@@ -39,4 +39,4 @@
throw HealthServicesException("An unknown error has occurred")
}
return t
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/PassiveMonitoringClientExtension.kt b/health/health-services-client/src/main/java/androidx/health/services/client/PassiveMonitoringClientExtension.kt
index 91794f5..4642a90 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/PassiveMonitoringClientExtension.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/PassiveMonitoringClientExtension.kt
@@ -100,4 +100,4 @@
*/
@kotlin.jvm.Throws(HealthServicesException::class)
public suspend fun PassiveMonitoringClient.getCapabilities() =
- getCapabilitiesAsync().awaitWithException()
\ No newline at end of file
+ getCapabilitiesAsync().awaitWithException()
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/CumulativeDataPoint.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/CumulativeDataPoint.kt
index 6b6fe5c..1530b38 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/CumulativeDataPoint.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/CumulativeDataPoint.kt
@@ -61,4 +61,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPointContainer.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPointContainer.kt
index 821a8cc..8b4ae6d 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPointContainer.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/DataPointContainer.kt
@@ -76,4 +76,4 @@
fun <T : Number, D : DataPoint<T>> getData(type: AggregateDataType<T, D>): D? {
return (dataPoints[type] as? List<D>)?.lastOrNull()
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/GolfExerciseTypeConfig.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/GolfExerciseTypeConfig.kt
index 067c87a..fd0113d 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/GolfExerciseTypeConfig.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/GolfExerciseTypeConfig.kt
@@ -126,4 +126,4 @@
.setGolfShotTrackingPlaceInfo(golfShotTrackingPlaceInfo.toProto())
.build()
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/HealthEvent.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/HealthEvent.kt
index 19bdd36..bcf82b4 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/HealthEvent.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/HealthEvent.kt
@@ -148,4 +148,4 @@
return DataPointContainer(dataTypeToDataPoints)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/IntervalDataPoint.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/IntervalDataPoint.kt
index 1bcdbb5..9dc1bc3 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/IntervalDataPoint.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/IntervalDataPoint.kt
@@ -112,4 +112,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
index 8537b1b..cacbc7c 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/LocationData.kt
@@ -144,4 +144,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/SampleDataPoint.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/SampleDataPoint.kt
index 1a12f1a..e018596 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/SampleDataPoint.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/SampleDataPoint.kt
@@ -102,4 +102,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/data/StatisticalDataPoint.kt b/health/health-services-client/src/main/java/androidx/health/services/client/data/StatisticalDataPoint.kt
index c04634c..d51087b 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/data/StatisticalDataPoint.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/data/StatisticalDataPoint.kt
@@ -68,4 +68,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/main/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequest.kt b/health/health-services-client/src/main/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequest.kt
index 596413b..a64df78 100644
--- a/health/health-services-client/src/main/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequest.kt
+++ b/health/health-services-client/src/main/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequest.kt
@@ -47,4 +47,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/PassiveListenerServiceTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/PassiveListenerServiceTest.kt
index fd4487f..9c3e655 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/PassiveListenerServiceTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/PassiveListenerServiceTest.kt
@@ -262,4 +262,4 @@
permissionLostCount++
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/CumulativeDataPointTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/CumulativeDataPointTest.kt
index 1c419fc..615ebe0 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/CumulativeDataPointTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/CumulativeDataPointTest.kt
@@ -42,4 +42,4 @@
Truth.assertThat(dataPoint.start).isEqualTo(10.instant())
Truth.assertThat(dataPoint.end).isEqualTo(99.instant())
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/DataPointContainerTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/DataPointContainerTest.kt
index f258b1e..4166404 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/DataPointContainerTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/DataPointContainerTest.kt
@@ -205,4 +205,4 @@
ABSOLUTE_ELEVATION_STATS
)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/DataTypeConditionTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/DataTypeConditionTest.kt
index d2a8d71..c2be8ae 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/DataTypeConditionTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/DataTypeConditionTest.kt
@@ -48,4 +48,4 @@
assertThat(observed.threshold).isEqualTo(10.5)
assertThat(observed.comparisonType).isEqualTo(GREATER_THAN)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseCapabilitiesTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseCapabilitiesTest.kt
index 2de499a..4a43798 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseCapabilitiesTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseCapabilitiesTest.kt
@@ -155,4 +155,4 @@
private val EXERCISE_CAPABILITIES: ExerciseCapabilities =
ExerciseCapabilities(EXERCISE_TYPE_TO_EXERCISE_CAPABILITIES_MAPPING)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseGoalTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseGoalTest.kt
index 08c73d9..0f98db2 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseGoalTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseGoalTest.kt
@@ -59,4 +59,4 @@
assertThat(goal.dataTypeCondition.comparisonType).isEqualTo(GREATER_THAN)
assertThat(goal.period).isEqualTo(1000.0)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseLapSummaryTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseLapSummaryTest.kt
index ae1dbef..be36832 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseLapSummaryTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/ExerciseLapSummaryTest.kt
@@ -75,4 +75,4 @@
assertThat(hrStats.start).isEqualTo(startTime)
assertThat(hrStats.end).isEqualTo(endTime)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/HealthEventTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/HealthEventTest.kt
index 7b3e17e..200d2a3 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/HealthEventTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/HealthEventTest.kt
@@ -63,4 +63,4 @@
assertThat(event.eventTime).isEqualTo(30.instant())
assertThat(event.metrics.dataPoints).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/IntervalDataPointTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/IntervalDataPointTest.kt
index 048f207..befaf0c 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/IntervalDataPointTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/IntervalDataPointTest.kt
@@ -72,4 +72,4 @@
Truth.assertThat(dataPoint.metadata.keySet()).isEmpty()
Truth.assertThat(dataPoint.accuracy).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/LocationAccuracyTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/LocationAccuracyTest.kt
index ce0d03f..1ffa5a8 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/LocationAccuracyTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/LocationAccuracyTest.kt
@@ -43,4 +43,4 @@
Assert.assertNotNull(validLocationAccuracy)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/MilestoneMarkerSummaryTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/MilestoneMarkerSummaryTest.kt
index 5aaad5b..c5e8ff0 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/MilestoneMarkerSummaryTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/MilestoneMarkerSummaryTest.kt
@@ -52,4 +52,4 @@
assertThat(summary.achievedGoal.dataTypeCondition.dataType).isEqualTo(CALORIES_TOTAL)
assertThat(summary.summaryMetrics.getData(CALORIES_TOTAL)!!.total).isEqualTo(130.0)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/PassiveGoalTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/PassiveGoalTest.kt
index f7b7185..0dedc77 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/PassiveGoalTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/PassiveGoalTest.kt
@@ -77,4 +77,4 @@
assertThat(goal1).isNotEqualTo(goal2)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/SampleDataPointTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/SampleDataPointTest.kt
index 8c2906e..73e85e7 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/SampleDataPointTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/SampleDataPointTest.kt
@@ -130,4 +130,4 @@
assertThat(accuracy.horizontalPositionErrorMeters).isEqualTo(3.5)
assertThat(accuracy.verticalPositionErrorMeters).isEqualTo(Double.MAX_VALUE)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/data/StatisticalDataPointTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/data/StatisticalDataPointTest.kt
index 6e69001..dad09d1 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/data/StatisticalDataPointTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/data/StatisticalDataPointTest.kt
@@ -47,4 +47,4 @@
assertThat(dataPoint.start).isEqualTo(10.instant())
assertThat(dataPoint.end).isEqualTo(99.instant())
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/impl/ServiceBackedMeasureClientTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/impl/ServiceBackedMeasureClientTest.kt
index f42c82c..a8a7128 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/impl/ServiceBackedMeasureClientTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/impl/ServiceBackedMeasureClientTest.kt
@@ -248,4 +248,4 @@
return MeasureCapabilitiesResponse(MeasureCapabilities(supportedDataTypes))
}
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/ExerciseGoalRequestTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/ExerciseGoalRequestTest.kt
index d7745be..7319896 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/ExerciseGoalRequestTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/ExerciseGoalRequestTest.kt
@@ -49,4 +49,4 @@
Truth.assertThat(request).isEqualTo(fromParcel)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequestTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequestTest.kt
index 4fece94..47497da 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequestTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/impl/request/UpdateExerciseTypeConfigRequestTest.kt
@@ -43,4 +43,4 @@
Truth.assertThat(request).isEqualTo(fromParcel)
}
-}
\ No newline at end of file
+}
diff --git a/health/health-services-client/src/test/java/androidx/health/services/client/impl/response/PassiveMonitoringGoalResponseTest.kt b/health/health-services-client/src/test/java/androidx/health/services/client/impl/response/PassiveMonitoringGoalResponseTest.kt
index 54ee821..3d2bf89 100644
--- a/health/health-services-client/src/test/java/androidx/health/services/client/impl/response/PassiveMonitoringGoalResponseTest.kt
+++ b/health/health-services-client/src/test/java/androidx/health/services/client/impl/response/PassiveMonitoringGoalResponseTest.kt
@@ -37,4 +37,4 @@
assertThat(response.passiveGoal.dataTypeCondition.dataType).isEqualTo(STEPS_DAILY)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/AssistedFactoryGenerator.kt b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/AssistedFactoryGenerator.kt
index 1257acd..b452df0 100644
--- a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/AssistedFactoryGenerator.kt
+++ b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/AssistedFactoryGenerator.kt
@@ -113,4 +113,4 @@
)
.build()
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/DependencyRequest.kt b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/DependencyRequest.kt
index a2edb27..822c778 100644
--- a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/DependencyRequest.kt
+++ b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/assisted/DependencyRequest.kt
@@ -65,4 +65,4 @@
) && qualifier == null,
qualifier = qualifier
)
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/ext/javaPoet.kt b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/ext/javaPoet.kt
index e8dcec0..d3fc1c2 100644
--- a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/ext/javaPoet.kt
+++ b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/ext/javaPoet.kt
@@ -39,4 +39,4 @@
).ifPresent { generatedAnnotation ->
addAnnotation(generatedAnnotation)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerElements.kt b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerElements.kt
index 0b6c84d..f62c1ee 100644
--- a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerElements.kt
+++ b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerElements.kt
@@ -51,4 +51,4 @@
val dependencyRequests = constructorElement.parameters.map { constructorArg ->
constructorArg.toDependencyRequest()
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerStep.kt b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerStep.kt
index 0fbdfa3..d06abf9 100644
--- a/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerStep.kt
+++ b/hilt/hilt-compiler/src/main/kotlin/androidx/hilt/work/WorkerStep.kt
@@ -150,4 +150,4 @@
private fun error(message: String, element: Element? = null) {
messager.printMessage(Diagnostic.Kind.ERROR, message, element)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/testUtils.kt b/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/testUtils.kt
index 7001368..b24ad5e 100644
--- a/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/testUtils.kt
+++ b/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/testUtils.kt
@@ -62,4 +62,4 @@
fun compiler(): Compiler = javac().withProcessors(AndroidXHiltProcessor())
-fun String.toJFO(qName: String) = JavaFileObjects.forSourceString(qName, this.trimIndent())
\ No newline at end of file
+fun String.toJFO(qName: String) = JavaFileObjects.forSourceString(qName, this.trimIndent())
diff --git a/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/work/WorkerStepTest.kt b/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/work/WorkerStepTest.kt
index 9783c14..5d7c63a 100644
--- a/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/work/WorkerStepTest.kt
+++ b/hilt/hilt-compiler/src/test/kotlin/androidx/hilt/work/WorkerStepTest.kt
@@ -228,4 +228,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-navigation-compose/src/androidTest/java/androidx/hilt/navigation/compose/TestRunner.kt b/hilt/hilt-navigation-compose/src/androidTest/java/androidx/hilt/navigation/compose/TestRunner.kt
index 2ec8516..5519acf 100644
--- a/hilt/hilt-navigation-compose/src/androidTest/java/androidx/hilt/navigation/compose/TestRunner.kt
+++ b/hilt/hilt-navigation-compose/src/androidTest/java/androidx/hilt/navigation/compose/TestRunner.kt
@@ -29,4 +29,4 @@
): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-navigation-compose/src/main/java/androidx/hilt/navigation/compose/HiltViewModel.kt b/hilt/hilt-navigation-compose/src/main/java/androidx/hilt/navigation/compose/HiltViewModel.kt
index e90d5b5..5619fe3 100644
--- a/hilt/hilt-navigation-compose/src/main/java/androidx/hilt/navigation/compose/HiltViewModel.kt
+++ b/hilt/hilt-navigation-compose/src/main/java/androidx/hilt/navigation/compose/HiltViewModel.kt
@@ -62,4 +62,4 @@
// Use the default factory provided by the ViewModelStoreOwner
// and assume it is an @AndroidEntryPoint annotated fragment or activity
null
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-navigation-compose/src/test/kotlin/EmptyFile.kt b/hilt/hilt-navigation-compose/src/test/kotlin/EmptyFile.kt
index b1634a1..2f7ed51 100644
--- a/hilt/hilt-navigation-compose/src/test/kotlin/EmptyFile.kt
+++ b/hilt/hilt-navigation-compose/src/test/kotlin/EmptyFile.kt
@@ -15,4 +15,4 @@
*/
// NOTE(b/190438045):
-// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
\ No newline at end of file
+// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
diff --git a/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazyTest.kt b/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazyTest.kt
index 6cc6dc8..f454761 100644
--- a/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazyTest.kt
+++ b/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazyTest.kt
@@ -174,4 +174,4 @@
val otherDep: OtherDep
) : ViewModel()
-class OtherDep @Inject constructor()
\ No newline at end of file
+class OtherDep @Inject constructor()
diff --git a/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/TestRunner.kt b/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/TestRunner.kt
index 137ceda..4e2ba8d 100644
--- a/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/TestRunner.kt
+++ b/hilt/hilt-navigation-fragment/src/androidTest/java/androidx/hilt/navigation/fragment/TestRunner.kt
@@ -29,4 +29,4 @@
): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/hilt-navigation-fragment/src/test/kotlin/EmptyFile.kt b/hilt/hilt-navigation-fragment/src/test/kotlin/EmptyFile.kt
index b1634a1..2f7ed51 100644
--- a/hilt/hilt-navigation-fragment/src/test/kotlin/EmptyFile.kt
+++ b/hilt/hilt-navigation-fragment/src/test/kotlin/EmptyFile.kt
@@ -15,4 +15,4 @@
*/
// NOTE(b/190438045):
-// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
\ No newline at end of file
+// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
diff --git a/hilt/hilt-navigation/src/main/java/androidx/hilt/navigation/HiltNavBackStackEntry.kt b/hilt/hilt-navigation/src/main/java/androidx/hilt/navigation/HiltNavBackStackEntry.kt
index 714de85..bfe393e 100644
--- a/hilt/hilt-navigation/src/main/java/androidx/hilt/navigation/HiltNavBackStackEntry.kt
+++ b/hilt/hilt-navigation/src/main/java/androidx/hilt/navigation/HiltNavBackStackEntry.kt
@@ -80,4 +80,4 @@
/* defaultArgs = */ null,
/* delegateFactory = */ delegateFactory
)
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/ActivityInjectionTest.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/ActivityInjectionTest.kt
index f7a9c11..ba64f40 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/ActivityInjectionTest.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/ActivityInjectionTest.kt
@@ -60,4 +60,4 @@
val myInjectedViewModel by viewModels<MyInjectedViewModel>()
val myNestedInjectedViewModel by viewModels<TopClass.MyNestedInjectedViewModel>()
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseActivityInjectionTest.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseActivityInjectionTest.kt
index ced0083..72ab3c6 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseActivityInjectionTest.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseActivityInjectionTest.kt
@@ -60,4 +60,4 @@
val myViewModel by viewModels<MyViewModel>()
val myInjectedViewModel by viewModels<MyInjectedViewModel>()
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseFragmentInjectionTest.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseFragmentInjectionTest.kt
index fe73005..2cf94ec 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseFragmentInjectionTest.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseFragmentInjectionTest.kt
@@ -71,4 +71,4 @@
val myViewModel by viewModels<MyViewModel>()
val myInjectedViewModel by viewModels<MyInjectedViewModel>()
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/Bindings.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/Bindings.kt
index 610e7a1..87d1c26 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/Bindings.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/Bindings.kt
@@ -20,4 +20,4 @@
class Foo @Inject constructor()
-class Bar @Inject constructor()
\ No newline at end of file
+class Bar @Inject constructor()
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/FragmentInjectionTest.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/FragmentInjectionTest.kt
index 647f22c..8fb0c58 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/FragmentInjectionTest.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/FragmentInjectionTest.kt
@@ -128,4 +128,4 @@
companion object {
const val FRAGMENT_TAG = "tag"
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/MyViewModels.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/MyViewModels.kt
index 7f87072..040777a 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/MyViewModels.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/MyViewModels.kt
@@ -36,4 +36,4 @@
@Suppress("UNUSED_PARAMETER")
@HiltViewModel
class MyNestedInjectedViewModel @Inject constructor(foo: Foo) : ViewModel()
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/TestRunner.kt b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/TestRunner.kt
index b8c8e9d..7d2c73a 100644
--- a/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/TestRunner.kt
+++ b/hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/TestRunner.kt
@@ -29,4 +29,4 @@
): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/App.kt b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/App.kt
index 9dc8b39..06579d2 100644
--- a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/App.kt
+++ b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/App.kt
@@ -20,4 +20,4 @@
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
-class App : Application()
\ No newline at end of file
+class App : Application()
diff --git a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleActivity.kt b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleActivity.kt
index d4a63e9..996d77c 100644
--- a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleActivity.kt
+++ b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleActivity.kt
@@ -40,4 +40,4 @@
.commit()
}
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleFragment.kt b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleFragment.kt
index 5afea57..b7c54cf 100644
--- a/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleFragment.kt
+++ b/hilt/integration-tests/viewmodelapp/src/main/java/androidx/hilt/integration/viewmodelapp/SimpleFragment.kt
@@ -35,4 +35,4 @@
Log.d("SimpleFragment", simpleViewModel.hi())
Log.d("SimpleFragment", activitySimpleViewModel.hi())
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/viewmodelapp/src/test/kotlin/EmptyFile.kt b/hilt/integration-tests/viewmodelapp/src/test/kotlin/EmptyFile.kt
index b1634a1..2f7ed51 100644
--- a/hilt/integration-tests/viewmodelapp/src/test/kotlin/EmptyFile.kt
+++ b/hilt/integration-tests/viewmodelapp/src/test/kotlin/EmptyFile.kt
@@ -15,4 +15,4 @@
*/
// NOTE(b/190438045):
-// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
\ No newline at end of file
+// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
diff --git a/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/SimpleTest.kt b/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/SimpleTest.kt
index 46cc51c..4ea236c 100644
--- a/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/SimpleTest.kt
+++ b/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/SimpleTest.kt
@@ -83,4 +83,4 @@
val result = worker.doWork()
assertThat(result).isEqualTo(ListenableWorker.Result.success())
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/TestRunner.kt b/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/TestRunner.kt
index b5d51ac..c454059 100644
--- a/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/TestRunner.kt
+++ b/hilt/integration-tests/workerapp/src/androidTest/java/androidx/hilt/integration/workerapp/TestRunner.kt
@@ -29,4 +29,4 @@
): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/App.kt b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/App.kt
index ff0527d..7ff239b 100644
--- a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/App.kt
+++ b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/App.kt
@@ -20,4 +20,4 @@
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
-class App : Application()
\ No newline at end of file
+class App : Application()
diff --git a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleActivity.kt b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleActivity.kt
index 9d4aca5..3cf8053 100644
--- a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleActivity.kt
+++ b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleActivity.kt
@@ -40,4 +40,4 @@
workManager.enqueue(OneTimeWorkRequestBuilder<SimpleCoroutineWorker>().build())
}
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleWorker.kt b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleWorker.kt
index 5fc9f80..f82899a 100644
--- a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleWorker.kt
+++ b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/SimpleWorker.kt
@@ -65,4 +65,4 @@
fun log(s: String) {
Log.i("MyLogger", s)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/WorkManagerModule.kt b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/WorkManagerModule.kt
index 36bdac7..50fa678 100644
--- a/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/WorkManagerModule.kt
+++ b/hilt/integration-tests/workerapp/src/main/java/androidx/hilt/integration/workerapp/WorkManagerModule.kt
@@ -44,4 +44,4 @@
)
return WorkManager.getInstance(context)
}
-}
\ No newline at end of file
+}
diff --git a/hilt/integration-tests/workerapp/src/test/kotlin/EmptyFile.kt b/hilt/integration-tests/workerapp/src/test/kotlin/EmptyFile.kt
index b1634a1..2f7ed51 100644
--- a/hilt/integration-tests/workerapp/src/test/kotlin/EmptyFile.kt
+++ b/hilt/integration-tests/workerapp/src/test/kotlin/EmptyFile.kt
@@ -15,4 +15,4 @@
*/
// NOTE(b/190438045):
-// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
\ No newline at end of file
+// This file is intentionally left empty to temporarily work around a bug in AGP 7.1.0-alpha02
diff --git a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/system/SystemMotionEventPredictor.java b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/system/SystemMotionEventPredictor.java
index 7184156..93beded 100644
--- a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/system/SystemMotionEventPredictor.java
+++ b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/system/SystemMotionEventPredictor.java
@@ -19,6 +19,7 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import android.content.Context;
+import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.MotionPredictor;
@@ -75,7 +76,9 @@
public MotionEvent predict() {
final int predictionTimeDelta = mPredictionEstimator.estimate();
if (mUsingSystemPredictor) {
- return mSystemPredictor.predict(TimeUnit.MILLISECONDS.toNanos(predictionTimeDelta));
+ return mSystemPredictor.predict(
+ TimeUnit.MILLISECONDS.toNanos(SystemClock.uptimeMillis() + predictionTimeDelta)
+ );
} else {
return getKalmanPredictor().predict(predictionTimeDelta);
}
diff --git a/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/AGPExtensions.kt b/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/AGPExtensions.kt
index 2ee7633..6d6a8e6 100644
--- a/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/AGPExtensions.kt
+++ b/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/AGPExtensions.kt
@@ -45,4 +45,4 @@
): File {
val inspectionDir = File(project.buildDir, "androidx_inspection")
return File(File(inspectionDir, baseName), variant.dirName)
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/EchoInspectionTest.kt b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/EchoInspectionTest.kt
index 2492132..64138cd 100644
--- a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/EchoInspectionTest.kt
+++ b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/EchoInspectionTest.kt
@@ -115,4 +115,4 @@
}
internal fun fakeCallCodeInApp() = TickleManager.tickle()
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/EchoInspector.kt b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/EchoInspector.kt
index a1d4bb3..58f1c4a 100644
--- a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/EchoInspector.kt
+++ b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/EchoInspector.kt
@@ -74,4 +74,4 @@
class EchoInspectorFactory : InspectorFactory<EchoInspector>(ECHO_INSPECTION_ID) {
override fun createInspector(connection: Connection, unusedEnvironment: InspectorEnvironment) =
EchoInspector(connection)
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/TickleManager.kt b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/TickleManager.kt
index 6d63471..a9877ed 100644
--- a/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/TickleManager.kt
+++ b/inspection/inspection-testing/src/androidTest/java/androidx/inspection/testing/echo/TickleManager.kt
@@ -35,4 +35,4 @@
fun tickle() {
channel.trySend(Unit)
}
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection-testing/src/main/java/androidx/inspection/testing/TestInspectorExecutors.kt b/inspection/inspection-testing/src/main/java/androidx/inspection/testing/TestInspectorExecutors.kt
index 645cea9..0e29f03 100644
--- a/inspection/inspection-testing/src/main/java/androidx/inspection/testing/TestInspectorExecutors.kt
+++ b/inspection/inspection-testing/src/main/java/androidx/inspection/testing/TestInspectorExecutors.kt
@@ -59,4 +59,4 @@
}
override fun io() = ioExecutor
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection/src/androidTest/java/androidx/inspection/InspectorTest.kt b/inspection/inspection/src/androidTest/java/androidx/inspection/InspectorTest.kt
index 4936980..1e6965d 100644
--- a/inspection/inspection/src/androidTest/java/androidx/inspection/InspectorTest.kt
+++ b/inspection/inspection/src/androidTest/java/androidx/inspection/InspectorTest.kt
@@ -35,4 +35,4 @@
}
assertThat(value).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/inspection/inspection/src/androidTest/java/androidx/inspection/rules/JvmtiRule.kt b/inspection/inspection/src/androidTest/java/androidx/inspection/rules/JvmtiRule.kt
index 3a93a310..dc7cdeb 100644
--- a/inspection/inspection/src/androidTest/java/androidx/inspection/rules/JvmtiRule.kt
+++ b/inspection/inspection/src/androidTest/java/androidx/inspection/rules/JvmtiRule.kt
@@ -41,4 +41,4 @@
override fun before() {
ensureInitialised()
}
-}
\ No newline at end of file
+}
diff --git a/javascriptengine/javascriptengine/api/current.txt b/javascriptengine/javascriptengine/api/current.txt
index 27d3a38..e523e0b 100644
--- a/javascriptengine/javascriptengine/api/current.txt
+++ b/javascriptengine/javascriptengine/api/current.txt
@@ -52,7 +52,6 @@
public final class JavaScriptIsolate implements java.lang.AutoCloseable {
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_CONSOLE_MESSAGING, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public void clearConsoleCallback();
method public void close();
- method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_EVALUATE_WITHOUT_TRANSACTION_LIMIT, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public com.google.common.util.concurrent.ListenableFuture<java.lang.String!> evaluateJavaScriptAsync(byte[]);
method public com.google.common.util.concurrent.ListenableFuture<java.lang.String!> evaluateJavaScriptAsync(String);
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_PROVIDE_CONSUME_ARRAY_BUFFER, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public boolean provideNamedData(String, byte[]);
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_CONSOLE_MESSAGING, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public void setConsoleCallback(androidx.javascriptengine.JavaScriptConsoleCallback);
diff --git a/javascriptengine/javascriptengine/api/restricted_current.txt b/javascriptengine/javascriptengine/api/restricted_current.txt
index 27d3a38..e523e0b 100644
--- a/javascriptengine/javascriptengine/api/restricted_current.txt
+++ b/javascriptengine/javascriptengine/api/restricted_current.txt
@@ -52,7 +52,6 @@
public final class JavaScriptIsolate implements java.lang.AutoCloseable {
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_CONSOLE_MESSAGING, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public void clearConsoleCallback();
method public void close();
- method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_EVALUATE_WITHOUT_TRANSACTION_LIMIT, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public com.google.common.util.concurrent.ListenableFuture<java.lang.String!> evaluateJavaScriptAsync(byte[]);
method public com.google.common.util.concurrent.ListenableFuture<java.lang.String!> evaluateJavaScriptAsync(String);
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_PROVIDE_CONSUME_ARRAY_BUFFER, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public boolean provideNamedData(String, byte[]);
method @RequiresFeature(name=androidx.javascriptengine.JavaScriptSandbox.JS_FEATURE_CONSOLE_MESSAGING, enforcement="androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported") public void setConsoleCallback(androidx.javascriptengine.JavaScriptConsoleCallback);
diff --git a/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java b/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
index f28f89f..8252afd 100644
--- a/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
+++ b/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
@@ -849,31 +849,6 @@
@Test
@LargeTest
- public void testLargeScriptByteArrayJsEvaluation() throws Throwable {
- final String longString = Strings.repeat("a", 2000000);
- final String codeString = ""
- + "let " + longString + " = 0;"
- + "\"PASS\"";
- final byte[] code = codeString.getBytes(StandardCharsets.UTF_8);
- final String expected = "PASS";
- Context context = ApplicationProvider.getApplicationContext();
-
- ListenableFuture<JavaScriptSandbox> jsSandboxFuture =
- JavaScriptSandbox.createConnectedInstanceAsync(context);
- try (JavaScriptSandbox jsSandbox = jsSandboxFuture.get(5, TimeUnit.SECONDS)) {
- Assume.assumeTrue(jsSandbox.isFeatureSupported(
- JavaScriptSandbox.JS_FEATURE_EVALUATE_WITHOUT_TRANSACTION_LIMIT));
- try (JavaScriptIsolate jsIsolate = jsSandbox.createIsolate()) {
- ListenableFuture<String> resultFuture = jsIsolate.evaluateJavaScriptAsync(code);
- String result = resultFuture.get(10, TimeUnit.SECONDS);
-
- Assert.assertEquals(expected, result);
- }
- }
- }
-
- @Test
- @LargeTest
public void testLargeReturn() throws Throwable {
final String code = "'a'.repeat(2000000);";
final String expected = Strings.repeat("a", 2000000);
diff --git a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/EnvironmentDeadState.java b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/EnvironmentDeadState.java
index 870d5ee..0c99deb 100644
--- a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/EnvironmentDeadState.java
+++ b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/EnvironmentDeadState.java
@@ -38,16 +38,6 @@
@NonNull
@Override
- public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code) {
- return CallbackToFutureAdapter.getFuture(completer -> {
- final String futureDebugMessage = "evaluateJavascript Future";
- completer.setException(mException);
- return futureDebugMessage;
- });
- }
-
- @NonNull
- @Override
public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull String code) {
return CallbackToFutureAdapter.getFuture(completer -> {
final String futureDebugMessage = "evaluateJavascript Future";
diff --git a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateClosedState.java b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateClosedState.java
index 0742719..927bbe0 100644
--- a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateClosedState.java
+++ b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateClosedState.java
@@ -31,13 +31,6 @@
@NonNull
@Override
- public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code) {
- throw new IllegalStateException("Calling evaluateJavaScriptAsync() after closing the"
- + "Isolate");
- }
-
- @NonNull
- @Override
public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull String code) {
throw new IllegalStateException("Calling evaluateJavaScriptAsync() after closing the"
+ "Isolate");
diff --git a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateState.java b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateState.java
index a5fea09..5a44f48 100644
--- a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateState.java
+++ b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateState.java
@@ -34,8 +34,6 @@
* Refer: https://en.wikipedia.org/wiki/State_pattern
*/
interface IsolateState {
- @NonNull
- ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code);
@NonNull
ListenableFuture<String> evaluateJavaScriptAsync(@NonNull String code);
diff --git a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateUsableState.java b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateUsableState.java
index 6ae6286..e253c86 100644
--- a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateUsableState.java
+++ b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/IsolateUsableState.java
@@ -224,34 +224,6 @@
@NonNull
@Override
- public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code) {
- return CallbackToFutureAdapter.getFuture(completer -> {
- final String futureDebugMessage = "evaluateJavascript Future";
- IJsSandboxIsolateSyncCallbackStubWrapper callbackStub =
- new IJsSandboxIsolateSyncCallbackStubWrapper(completer);
- try {
- // We pass the codeAfd to the separate sandbox process but we still need to
- // close it on our end to avoid file descriptor leaks.
- try (AssetFileDescriptor codeAfd = Utils.writeBytesIntoPipeAsync(code,
- mJsIsolate.mJsSandbox.mThreadPoolTaskExecutor)) {
- mJsIsolateStub.evaluateJavascriptWithFd(codeAfd,
- callbackStub);
- }
- addToPendingCompleterSet(completer);
- } catch (DeadObjectException e) {
- // The sandbox process has died.
- mJsIsolate.maybeSetSandboxDead();
- completer.setException(new SandboxDeadException());
- } catch (RemoteException | IOException e) {
- completer.setException(new RuntimeException(e));
- }
- // Debug string.
- return futureDebugMessage;
- });
- }
-
- @NonNull
- @Override
public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull String code) {
if (mJsIsolate.mJsSandbox.isFeatureSupported(
JavaScriptSandbox.JS_FEATURE_EVALUATE_WITHOUT_TRANSACTION_LIMIT)) {
@@ -407,4 +379,31 @@
ele.setException(e);
}
}
+
+ @NonNull
+ ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code) {
+ return CallbackToFutureAdapter.getFuture(completer -> {
+ final String futureDebugMessage = "evaluateJavascript Future";
+ IJsSandboxIsolateSyncCallbackStubWrapper callbackStub =
+ new IJsSandboxIsolateSyncCallbackStubWrapper(completer);
+ try {
+ // We pass the codeAfd to the separate sandbox process but we still need to
+ // close it on our end to avoid file descriptor leaks.
+ try (AssetFileDescriptor codeAfd = Utils.writeBytesIntoPipeAsync(code,
+ mJsIsolate.mJsSandbox.mThreadPoolTaskExecutor)) {
+ mJsIsolateStub.evaluateJavascriptWithFd(codeAfd,
+ callbackStub);
+ }
+ addToPendingCompleterSet(completer);
+ } catch (DeadObjectException e) {
+ // The sandbox process has died.
+ mJsIsolate.maybeSetSandboxDead();
+ completer.setException(new SandboxDeadException());
+ } catch (RemoteException | IOException e) {
+ completer.setException(new RuntimeException(e));
+ }
+ // Debug string.
+ return futureDebugMessage;
+ });
+ }
}
diff --git a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/JavaScriptIsolate.java b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/JavaScriptIsolate.java
index c07746b..df63307 100644
--- a/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/JavaScriptIsolate.java
+++ b/javascriptengine/javascriptengine/src/main/java/androidx/javascriptengine/JavaScriptIsolate.java
@@ -141,35 +141,6 @@
}
/**
- * Evaluates the given JavaScript code which is encoded in UTF-8 and returns the result.
- * <p>
- * Please refer to the documentation of {@link #evaluateJavaScriptAsync(String)} as the
- * behavior of this method is similar other than for the input type.
- * <p>
- * <strong>Note: The {@code byte[]} must be UTF-8 encoded.</strong>
- * <p>
- * This overload is provided for clients to pass in a UTF-8 encoded {@code byte[]} directly
- * instead of having to convert it into a {@code String} to use
- * {@link #evaluateJavaScriptAsync(String)}.
- *
- * @param code UTF-8 encoded JavaScript code to evaluate. The script should return a
- * JavaScript String or, alternatively, a Promise that will resolve to a String if
- * {@link JavaScriptSandbox#JS_FEATURE_PROMISE_RETURN} is supported. The byte
- * array must not be modified until the evaluation has completed.
- * @return Future that evaluates to the result String of the evaluation or exceptions (see
- * {@link JavaScriptException} and subclasses) if there is an error
- */
- @NonNull
- @RequiresFeature(name = JavaScriptSandbox.JS_FEATURE_EVALUATE_WITHOUT_TRANSACTION_LIMIT,
- enforcement = "androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported")
- public ListenableFuture<String> evaluateJavaScriptAsync(@NonNull byte[] code) {
- Objects.requireNonNull(code);
- synchronized (mLock) {
- return mIsolateState.evaluateJavaScriptAsync(code);
- }
- }
-
- /**
* Closes the {@link JavaScriptIsolate} object and renders it unusable.
* <p>
* Once closed, no more method calls should be made. Pending evaluations resolve with
diff --git a/testutils/testutils-kmp/OWNERS b/kruth/kruth/OWNERS
similarity index 60%
rename from testutils/testutils-kmp/OWNERS
rename to kruth/kruth/OWNERS
index e750dab..44cebdc 100644
--- a/testutils/testutils-kmp/OWNERS
+++ b/kruth/kruth/OWNERS
@@ -1,3 +1,2 @@
dustinlam@google.com
-paulmalolepsy@google.com
yboyar@google.com
diff --git a/kruth/kruth/api/api_lint.ignore b/kruth/kruth/api/api_lint.ignore
new file mode 100644
index 0000000..53eae8f
--- /dev/null
+++ b/kruth/kruth/api/api_lint.ignore
@@ -0,0 +1,53 @@
+// Baseline format: 1.0
+ArrayReturn: androidx.kruth.IterableSubject#containsAnyIn(Object[]) parameter #0:
+ Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
+ArrayReturn: androidx.kruth.IterableSubject#containsAtLeastElementsIn(Object[]) parameter #0:
+ Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
+ArrayReturn: androidx.kruth.IterableSubject#containsExactlyElementsIn(Object[]) parameter #0:
+ Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
+ArrayReturn: androidx.kruth.IterableSubject#containsNoneIn(Object[]) parameter #0:
+ Method parameter should be Collection<Object> (or subclass) instead of raw array; was `java.lang.Object[]`
+
+
+AutoBoxing: androidx.kruth.KruthKt#assertThat(Boolean) parameter #0:
+ Must avoid boxed primitives (`java.lang.Boolean`)
+AutoBoxing: androidx.kruth.KruthKt#assertThat(Double) parameter #0:
+ Must avoid boxed primitives (`java.lang.Double`)
+AutoBoxing: androidx.kruth.StandardSubjectBuilder#that(Boolean) parameter #0:
+ Must avoid boxed primitives (`java.lang.Boolean`)
+AutoBoxing: androidx.kruth.StandardSubjectBuilder#that(Double) parameter #0:
+ Must avoid boxed primitives (`java.lang.Double`)
+
+
+BuilderSetStyle: androidx.kruth.SimpleSubjectBuilder#that(T):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.SimpleSubjectBuilder.that(T)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#about(androidx.kruth.Subject.Factory<T,? extends S>):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.about(androidx.kruth.Subject.Factory<T,? extends S>)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#fail():
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.fail()
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(Boolean):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(Boolean)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(Double):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(Double)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(Iterable<? extends T>):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(Iterable<? extends T>)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(String):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(String)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(T):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(T)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#that(java.util.Map<K,? extends V>):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.that(java.util.Map<K,? extends V>)
+BuilderSetStyle: androidx.kruth.StandardSubjectBuilder#withMessage(String):
+ Builder methods names should use setFoo() / addFoo() / clearFoo() style: method androidx.kruth.StandardSubjectBuilder.withMessage(String)
+
+
+MissingBuildMethod: androidx.kruth.SimpleSubjectBuilder:
+ androidx.kruth.SimpleSubjectBuilder does not declare a `build()` method, but builder classes are expected to
+MissingBuildMethod: androidx.kruth.StandardSubjectBuilder:
+ androidx.kruth.StandardSubjectBuilder does not declare a `build()` method, but builder classes are expected to
+
+
+TopLevelBuilder: androidx.kruth.SimpleSubjectBuilder:
+ Builder should be defined as inner class: androidx.kruth.SimpleSubjectBuilder
+TopLevelBuilder: androidx.kruth.StandardSubjectBuilder:
+ Builder should be defined as inner class: androidx.kruth.StandardSubjectBuilder
diff --git a/kruth/kruth/api/current.txt b/kruth/kruth/api/current.txt
new file mode 100644
index 0000000..2208eb3
--- /dev/null
+++ b/kruth/kruth/api/current.txt
@@ -0,0 +1,168 @@
+// Signature format: 4.0
+package androidx.kruth {
+
+ public final class BooleanSubject extends androidx.kruth.Subject<java.lang.Boolean> {
+ method public void isFalse();
+ method public void isTrue();
+ }
+
+ public class ComparableSubject<T extends java.lang.Comparable<? super T>> extends androidx.kruth.Subject<T> {
+ method public final void isAtLeast(T? other);
+ method public final void isAtMost(T? other);
+ method public final void isEquivalentAccordingToCompareTo(T? expected);
+ method public final void isGreaterThan(T? other);
+ method public final void isLessThan(T? other);
+ }
+
+ public final class DoubleSubject extends androidx.kruth.ComparableSubject<java.lang.Double> {
+ method public void isAtLeast(int other);
+ method public void isAtMost(int other);
+ method public void isFinite();
+ method public void isGreaterThan(int other);
+ method public void isLessThan(int other);
+ method public void isNaN();
+ method public void isNegativeInfinity();
+ method public void isNonZero();
+ method public void isNotNaN();
+ method public androidx.kruth.DoubleSubject.TolerantDoubleComparison isNotWithin(double tolerance);
+ method public void isPositiveInfinity();
+ method public androidx.kruth.DoubleSubject.TolerantDoubleComparison isWithin(double tolerance);
+ method public void isZero();
+ }
+
+ public abstract static class DoubleSubject.TolerantDoubleComparison {
+ method @Deprecated public boolean equals(Object? other);
+ method @Deprecated public int hashCode();
+ method public abstract void of(double expected);
+ }
+
+ public final class FailureMetadata {
+ method public java.util.List<java.lang.String> component1();
+ method public androidx.kruth.FailureMetadata copy(java.util.List<java.lang.String> messagesToPrepend);
+ method public java.util.List<java.lang.String> getMessagesToPrepend();
+ property public final java.util.List<java.lang.String> messagesToPrepend;
+ }
+
+ public class IterableSubject<T> extends androidx.kruth.Subject<java.lang.Iterable<? extends T>> {
+ method public final void contains(Object? element);
+ method public final void containsAnyIn(Iterable<?>? expected);
+ method public final void containsAnyIn(Object![]? expected);
+ method public final void containsAnyOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public final androidx.kruth.Ordered containsAtLeast(Object? firstExpected, Object? secondExpected, java.lang.Object?... restOfExpected);
+ method public final androidx.kruth.Ordered containsAtLeastElementsIn(Iterable<?>? expected);
+ method public final androidx.kruth.Ordered containsAtLeastElementsIn(Object![]? expected);
+ method public final androidx.kruth.Ordered containsExactly(java.lang.Object?... expected);
+ method public final androidx.kruth.Ordered containsExactlyElementsIn(Iterable<?>? required);
+ method public final androidx.kruth.Ordered containsExactlyElementsIn(Object![]? expected);
+ method public final void containsNoDuplicates();
+ method public final void containsNoneIn(Iterable<?>? excluded);
+ method public final void containsNoneIn(Object![]? excluded);
+ method public final void containsNoneOf(Object? firstExcluded, Object? secondExcluded, java.lang.Object?... restOfExcluded);
+ method public final void doesNotContain(Object? element);
+ method public final void hasSize(int expectedSize);
+ method public final void isEmpty();
+ method public final void isInOrder();
+ method public final void isInOrder(java.util.Comparator<?>? comparator);
+ method public final void isInStrictOrder();
+ method public final void isInStrictOrder(java.util.Comparator<?>? comparator);
+ method @Deprecated public void isNoneOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public final void isNotEmpty();
+ method @Deprecated public void isNotIn(Iterable<?>? iterable);
+ }
+
+ public final class KruthExtKt {
+ method public static inline <reified T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThrows(kotlin.jvm.functions.Function0<kotlin.Unit> block);
+ method public static inline <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThrows(kotlin.reflect.KClass<T> exceptionClass, kotlin.jvm.functions.Function0<kotlin.Unit> block);
+ }
+
+ public final class KruthKt {
+ method public static <T, S extends androidx.kruth.Subject<? extends T>> androidx.kruth.SimpleSubjectBuilder<T,S> assertAbout(androidx.kruth.Subject.Factory<T,? extends S> subjectFactory);
+ method public static androidx.kruth.BooleanSubject assertThat(Boolean? actual);
+ method public static androidx.kruth.DoubleSubject assertThat(Double? actual);
+ method public static <T> androidx.kruth.IterableSubject<T> assertThat(Iterable<? extends T>? actual);
+ method public static androidx.kruth.StringSubject assertThat(String? actual);
+ method public static <K, V> androidx.kruth.MapSubject<K,V> assertThat(java.util.Map<K,? extends V>? actual);
+ method public static <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> assertThat(T? actual);
+ method public static <T> androidx.kruth.Subject<T> assertThat(T? actual);
+ method public static <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThat(T? actual);
+ method public static androidx.kruth.StandardSubjectBuilder assertWithMessage(String messageToPrepend);
+ }
+
+ public final class MapSubject<K, V> extends androidx.kruth.Subject<java.util.Map<K,? extends V>> {
+ method public androidx.kruth.Ordered containsExactly(kotlin.Pair<? extends K,? extends V>... entries);
+ method public androidx.kruth.Ordered containsExactlyEntriesIn(java.util.Map<K,? extends V> expectedMap);
+ method public void containsKey(Object? key);
+ method public void hasSize(int expectedSize);
+ method public void isEmpty();
+ method public void isNotEmpty();
+ }
+
+ public interface Ordered {
+ method public void inOrder();
+ }
+
+ public final class SimpleSubjectBuilder<T, S extends androidx.kruth.Subject<? extends T>> {
+ method public S that(T actual);
+ }
+
+ public final class StandardSubjectBuilder {
+ method public <T, S extends androidx.kruth.Subject<? extends T>> androidx.kruth.SimpleSubjectBuilder<T,S> about(androidx.kruth.Subject.Factory<T,? extends S> subjectFactory);
+ method public Void fail();
+ method public androidx.kruth.BooleanSubject that(Boolean? actual);
+ method public androidx.kruth.DoubleSubject that(Double? actual);
+ method public <T> androidx.kruth.IterableSubject<T> that(Iterable<? extends T>? actual);
+ method public androidx.kruth.StringSubject that(String? actual);
+ method public <K, V> androidx.kruth.MapSubject<K,V> that(java.util.Map<K,? extends V>? actual);
+ method public <T> androidx.kruth.Subject<T> that(T actual);
+ method public <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> that(T? actual);
+ method public <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> that(T? actual);
+ method public androidx.kruth.StandardSubjectBuilder withMessage(String messageToPrepend);
+ }
+
+ public final class StringSubject extends androidx.kruth.ComparableSubject<java.lang.String> {
+ method public void contains(CharSequence charSequence);
+ method public void doesNotContain(CharSequence string);
+ method public void endsWith(String string);
+ method public void hasLength(int expectedLength);
+ method public androidx.kruth.StringSubject.CaseInsensitiveStringComparison ignoringCase();
+ method public void isEmpty();
+ method public void isNotEmpty();
+ method public void startsWith(String string);
+ }
+
+ public final class StringSubject.CaseInsensitiveStringComparison {
+ method public void contains(CharSequence? expected);
+ method public void doesNotContain(CharSequence? expected);
+ method public void isEqualTo(String? expected);
+ method public void isNotEqualTo(String? unexpected);
+ }
+
+ public class Subject<T> {
+ ctor public Subject(T? actual, optional androidx.kruth.FailureMetadata metadata);
+ method protected final Void failWithActual(java.lang.String... messages);
+ method public final T? getActual();
+ method public void isAnyOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public void isEqualTo(Object? expected);
+ method public void isIn(Iterable<?>? iterable);
+ method public inline <reified V> void isInstanceOf();
+ method public void isNoneOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public void isNotEqualTo(Object? unexpected);
+ method public void isNotIn(Iterable<?>? iterable);
+ method public inline <reified V> void isNotInstanceOf();
+ method public void isNotNull();
+ method public void isNotSameInstanceAs(Object? unexpected);
+ method public void isNull();
+ method public void isSameInstanceAs(Object? expected);
+ property public final T? actual;
+ }
+
+ public static fun interface Subject.Factory<T, S extends androidx.kruth.Subject<? extends T>> {
+ method public S createSubject(androidx.kruth.FailureMetadata metadata, T actual);
+ }
+
+ public final class ThrowableSubject<T extends java.lang.Throwable> extends androidx.kruth.Subject<T> {
+ method public androidx.kruth.StringSubject hasMessageThat();
+ }
+
+}
+
diff --git a/kruth/kruth/api/restricted_current.txt b/kruth/kruth/api/restricted_current.txt
new file mode 100644
index 0000000..380eaee
--- /dev/null
+++ b/kruth/kruth/api/restricted_current.txt
@@ -0,0 +1,169 @@
+// Signature format: 4.0
+package androidx.kruth {
+
+ public final class BooleanSubject extends androidx.kruth.Subject<java.lang.Boolean> {
+ method public void isFalse();
+ method public void isTrue();
+ }
+
+ public class ComparableSubject<T extends java.lang.Comparable<? super T>> extends androidx.kruth.Subject<T> {
+ method public final void isAtLeast(T? other);
+ method public final void isAtMost(T? other);
+ method public final void isEquivalentAccordingToCompareTo(T? expected);
+ method public final void isGreaterThan(T? other);
+ method public final void isLessThan(T? other);
+ }
+
+ public final class DoubleSubject extends androidx.kruth.ComparableSubject<java.lang.Double> {
+ method public void isAtLeast(int other);
+ method public void isAtMost(int other);
+ method public void isFinite();
+ method public void isGreaterThan(int other);
+ method public void isLessThan(int other);
+ method public void isNaN();
+ method public void isNegativeInfinity();
+ method public void isNonZero();
+ method public void isNotNaN();
+ method public androidx.kruth.DoubleSubject.TolerantDoubleComparison isNotWithin(double tolerance);
+ method public void isPositiveInfinity();
+ method public androidx.kruth.DoubleSubject.TolerantDoubleComparison isWithin(double tolerance);
+ method public void isZero();
+ }
+
+ public abstract static class DoubleSubject.TolerantDoubleComparison {
+ method @Deprecated public boolean equals(Object? other);
+ method @Deprecated public int hashCode();
+ method public abstract void of(double expected);
+ }
+
+ public final class FailureMetadata {
+ method public java.util.List<java.lang.String> component1();
+ method public androidx.kruth.FailureMetadata copy(java.util.List<java.lang.String> messagesToPrepend);
+ method public java.util.List<java.lang.String> getMessagesToPrepend();
+ property public final java.util.List<java.lang.String> messagesToPrepend;
+ }
+
+ public class IterableSubject<T> extends androidx.kruth.Subject<java.lang.Iterable<? extends T>> {
+ method public final void contains(Object? element);
+ method public final void containsAnyIn(Iterable<?>? expected);
+ method public final void containsAnyIn(Object![]? expected);
+ method public final void containsAnyOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public final androidx.kruth.Ordered containsAtLeast(Object? firstExpected, Object? secondExpected, java.lang.Object?... restOfExpected);
+ method public final androidx.kruth.Ordered containsAtLeastElementsIn(Iterable<?>? expected);
+ method public final androidx.kruth.Ordered containsAtLeastElementsIn(Object![]? expected);
+ method public final androidx.kruth.Ordered containsExactly(java.lang.Object?... expected);
+ method public final androidx.kruth.Ordered containsExactlyElementsIn(Iterable<?>? required);
+ method public final androidx.kruth.Ordered containsExactlyElementsIn(Object![]? expected);
+ method public final void containsNoDuplicates();
+ method public final void containsNoneIn(Iterable<?>? excluded);
+ method public final void containsNoneIn(Object![]? excluded);
+ method public final void containsNoneOf(Object? firstExcluded, Object? secondExcluded, java.lang.Object?... restOfExcluded);
+ method public final void doesNotContain(Object? element);
+ method public final void hasSize(int expectedSize);
+ method public final void isEmpty();
+ method public final void isInOrder();
+ method public final void isInOrder(java.util.Comparator<?>? comparator);
+ method public final void isInStrictOrder();
+ method public final void isInStrictOrder(java.util.Comparator<?>? comparator);
+ method @Deprecated public void isNoneOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public final void isNotEmpty();
+ method @Deprecated public void isNotIn(Iterable<?>? iterable);
+ }
+
+ public final class KruthExtKt {
+ method public static inline <reified T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThrows(kotlin.jvm.functions.Function0<kotlin.Unit> block);
+ method public static inline <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThrows(kotlin.reflect.KClass<T> exceptionClass, kotlin.jvm.functions.Function0<kotlin.Unit> block);
+ }
+
+ public final class KruthKt {
+ method public static <T, S extends androidx.kruth.Subject<? extends T>> androidx.kruth.SimpleSubjectBuilder<T,S> assertAbout(androidx.kruth.Subject.Factory<T,? extends S> subjectFactory);
+ method public static androidx.kruth.BooleanSubject assertThat(Boolean? actual);
+ method public static androidx.kruth.DoubleSubject assertThat(Double? actual);
+ method public static <T> androidx.kruth.IterableSubject<T> assertThat(Iterable<? extends T>? actual);
+ method public static androidx.kruth.StringSubject assertThat(String? actual);
+ method public static <K, V> androidx.kruth.MapSubject<K,V> assertThat(java.util.Map<K,? extends V>? actual);
+ method public static <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> assertThat(T? actual);
+ method public static <T> androidx.kruth.Subject<T> assertThat(T? actual);
+ method public static <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> assertThat(T? actual);
+ method public static androidx.kruth.StandardSubjectBuilder assertWithMessage(String messageToPrepend);
+ }
+
+ public final class MapSubject<K, V> extends androidx.kruth.Subject<java.util.Map<K,? extends V>> {
+ method public androidx.kruth.Ordered containsExactly(kotlin.Pair<? extends K,? extends V>... entries);
+ method public androidx.kruth.Ordered containsExactlyEntriesIn(java.util.Map<K,? extends V> expectedMap);
+ method public void containsKey(Object? key);
+ method public void hasSize(int expectedSize);
+ method public void isEmpty();
+ method public void isNotEmpty();
+ }
+
+ public interface Ordered {
+ method public void inOrder();
+ }
+
+ public final class SimpleSubjectBuilder<T, S extends androidx.kruth.Subject<? extends T>> {
+ method public S that(T actual);
+ }
+
+ public final class StandardSubjectBuilder {
+ method public <T, S extends androidx.kruth.Subject<? extends T>> androidx.kruth.SimpleSubjectBuilder<T,S> about(androidx.kruth.Subject.Factory<T,? extends S> subjectFactory);
+ method public Void fail();
+ method public androidx.kruth.BooleanSubject that(Boolean? actual);
+ method public androidx.kruth.DoubleSubject that(Double? actual);
+ method public <T> androidx.kruth.IterableSubject<T> that(Iterable<? extends T>? actual);
+ method public androidx.kruth.StringSubject that(String? actual);
+ method public <K, V> androidx.kruth.MapSubject<K,V> that(java.util.Map<K,? extends V>? actual);
+ method public <T> androidx.kruth.Subject<T> that(T actual);
+ method public <T extends java.lang.Comparable<? super T>> androidx.kruth.ComparableSubject<T> that(T? actual);
+ method public <T extends java.lang.Throwable> androidx.kruth.ThrowableSubject<T> that(T? actual);
+ method public androidx.kruth.StandardSubjectBuilder withMessage(String messageToPrepend);
+ }
+
+ public final class StringSubject extends androidx.kruth.ComparableSubject<java.lang.String> {
+ method public void contains(CharSequence charSequence);
+ method public void doesNotContain(CharSequence string);
+ method public void endsWith(String string);
+ method public void hasLength(int expectedLength);
+ method public androidx.kruth.StringSubject.CaseInsensitiveStringComparison ignoringCase();
+ method public void isEmpty();
+ method public void isNotEmpty();
+ method public void startsWith(String string);
+ }
+
+ public final class StringSubject.CaseInsensitiveStringComparison {
+ method public void contains(CharSequence? expected);
+ method public void doesNotContain(CharSequence? expected);
+ method public void isEqualTo(String? expected);
+ method public void isNotEqualTo(String? unexpected);
+ }
+
+ public class Subject<T> {
+ ctor public Subject(T? actual, optional androidx.kruth.FailureMetadata metadata);
+ method @kotlin.PublishedApi internal final void doFail(String message);
+ method protected final Void failWithActual(java.lang.String... messages);
+ method public final T? getActual();
+ method public void isAnyOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public void isEqualTo(Object? expected);
+ method public void isIn(Iterable<?>? iterable);
+ method public inline <reified V> void isInstanceOf();
+ method public void isNoneOf(Object? first, Object? second, java.lang.Object?... rest);
+ method public void isNotEqualTo(Object? unexpected);
+ method public void isNotIn(Iterable<?>? iterable);
+ method public inline <reified V> void isNotInstanceOf();
+ method public void isNotNull();
+ method public void isNotSameInstanceAs(Object? unexpected);
+ method public void isNull();
+ method public void isSameInstanceAs(Object? expected);
+ property public final T? actual;
+ }
+
+ public static fun interface Subject.Factory<T, S extends androidx.kruth.Subject<? extends T>> {
+ method public S createSubject(androidx.kruth.FailureMetadata metadata, T actual);
+ }
+
+ public final class ThrowableSubject<T extends java.lang.Throwable> extends androidx.kruth.Subject<T> {
+ method public androidx.kruth.StringSubject hasMessageThat();
+ }
+
+}
+
diff --git a/testutils/testutils-kmp/build.gradle b/kruth/kruth/build.gradle
similarity index 80%
rename from testutils/testutils-kmp/build.gradle
rename to kruth/kruth/build.gradle
index 8a85a37..a03ba66 100644
--- a/testutils/testutils-kmp/build.gradle
+++ b/kruth/kruth/build.gradle
@@ -15,6 +15,9 @@
*/
import androidx.build.LibraryType
+import androidx.build.PlatformIdentifier
+import androidx.build.Publish
+import androidx.build.RunApiTasks
plugins {
id("AndroidXPlugin")
@@ -26,6 +29,8 @@
linux()
ios()
+ defaultPlatform(PlatformIdentifier.JVM)
+
sourceSets {
commonMain {
dependencies {
@@ -58,5 +63,8 @@
}
androidx {
+ legacyDisableKotlinStrictApiMode = true // Temporarily enabled to allow API tracking
+ publish = Publish.SNAPSHOT_ONLY
+ runApiTasks = new RunApiTasks.Yes() // Used to diff against Google Truth
type = LibraryType.INTERNAL_TEST_LIBRARY
}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/BooleanSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/BooleanSubject.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/BooleanSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/BooleanSubject.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt
index 3cd3459..f456f03 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/ComparableSubject.kt
@@ -97,4 +97,4 @@
asserter.fail("Expected to be at least $other, but was $actual")
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt
index f8eac62..0448cc7 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/DoubleSubject.kt
@@ -194,4 +194,4 @@
fun isAtLeast(other: Int) {
isAtLeast(other.toDouble())
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
index 1c5fafb..3ba1a75 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/FailingOrdered.kt
@@ -27,4 +27,4 @@
override fun inOrder() {
asserter.fail(message())
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailureMetadata.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/FailureMetadata.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/FailureMetadata.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/FailureMetadata.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/IterableSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/IterableSubject.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/IterableSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/IterableSubject.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Kruth.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/Kruth.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Kruth.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/Kruth.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt
index cfca771..6d0c4bb 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthAsserter.kt
@@ -99,4 +99,4 @@
return actual
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthExt.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthExt.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthExt.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthExt.kt
index 4e59342..48497eb 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/KruthExt.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/KruthExt.kt
@@ -36,4 +36,4 @@
ThrowableSubject<T> {
val e = assertFailsWith<T>(exceptionClass = exceptionClass, block = block)
return assertThat(e)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/MapSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/MapSubject.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/MapSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/MapSubject.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/MathUtil.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/MathUtil.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/MathUtil.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/MathUtil.kt
index d3c9a5a..bd9ffc8 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/MathUtil.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/MathUtil.kt
@@ -58,4 +58,4 @@
*/
internal fun notEqualWithinTolerance(left: Float, right: Float, tolerance: Float): Boolean {
return notEqualWithinTolerance(left.toDouble(), right.toDouble(), tolerance.toDouble())
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/NoopOrdered.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/NoopOrdered.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/NoopOrdered.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/NoopOrdered.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Ordered.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/Ordered.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Ordered.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/Ordered.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt
index 405eb04..a336739 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/SimpleSubjectBuilder.kt
@@ -36,4 +36,4 @@
fun that(actual: T): S =
subjectFactory.createSubject(metadata, actual)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/StandardSubjectBuilder.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/StandardSubjectBuilder.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/StandardSubjectBuilder.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/StandardSubjectBuilder.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/StringSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/StringSubject.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/StringSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/StringSubject.kt
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Subject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/Subject.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Subject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/Subject.kt
index 9ec8b1c..76c5ae1b 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Subject.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/Subject.kt
@@ -67,7 +67,7 @@
/**
* Fails if the subject is null.
- **/
+ */
open fun isNotNull() {
actual.standardIsNotEqualTo(null)
}
@@ -134,7 +134,7 @@
/**
* Fails if the subject is an instance of the given class.
- **/
+ */
inline fun <reified V> isNotInstanceOf() {
if (actual is V) {
doFail("Expected $actual to be not an instance of ${typeOf<V>()} but it was")
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt
index 2305ed4..f613adf 100644
--- a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt
+++ b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/ThrowableSubject.kt
@@ -30,4 +30,4 @@
fun hasMessageThat(): StringSubject {
return StringSubject(actual = actual?.message, metadata = metadata)
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Utils.kt b/kruth/kruth/src/commonMain/kotlin/androidx/kruth/Utils.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonMain/kotlin/androidx/kruth/Utils.kt
rename to kruth/kruth/src/commonMain/kotlin/androidx/kruth/Utils.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt
index 57e27d4..85f4d9f 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/AssertWithMessageTest.kt
@@ -87,4 +87,4 @@
}
private data class Some(val value: Int)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt
index 06ce90d..3b851ca 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/BooleanSubjectTest.kt
@@ -67,4 +67,4 @@
assertThat(true).isFalse()
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt
index 8e7a938..4e58b3f 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/ComparableSubjectTest.kt
@@ -166,4 +166,4 @@
override fun toString(): String {
return wrapped.toString()
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt
index 5a90e17..7e0f09d 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/DoubleSubjectTest.kt
@@ -494,4 +494,4 @@
assertThat(2.0).isAtMost(2)
assertThat(2.0).isAtMost(3)
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/IterableSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/IterableSubjectTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/IterableSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/IterableSubjectTest.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt
index bce09ef..0adf072 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/KruthAsserterTest.kt
@@ -100,4 +100,4 @@
asserter.assertNotNull(actual = null, message = "Msg")
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt
index 6ee7a7b..438664d 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/MapSubjectKruthTest.kt
@@ -41,4 +41,4 @@
mapInOrderReversed.inOrder()
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MapSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/MapSubjectTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MapSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/MapSubjectTest.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt
index 32a094b..20884f7 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/MathUtilTest.kt
@@ -113,4 +113,4 @@
.isFalse()
assertThat(notEqualWithinTolerance(Double.NaN, Double.NaN, 0.01)).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt
similarity index 99%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt
index 5ead763..bd5c785 100644
--- a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt
+++ b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/RetainMatchingToStringTest.kt
@@ -51,4 +51,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/StringSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/StringSubjectTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/StringSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/StringSubjectTest.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/SubjectKruthTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/SubjectKruthTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/SubjectKruthTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/SubjectKruthTest.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/SubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/SubjectTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/SubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/SubjectTest.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/TestingUtils.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/TestingUtils.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/TestingUtils.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/TestingUtils.kt
diff --git a/testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/ThrowableSubjectTest.kt b/kruth/kruth/src/commonTest/kotlin/androidx/kruth/ThrowableSubjectTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/commonTest/kotlin/androidx/kruth/ThrowableSubjectTest.kt
rename to kruth/kruth/src/commonTest/kotlin/androidx/kruth/ThrowableSubjectTest.kt
diff --git a/testutils/testutils-kmp/src/jvmTest/kotlin/androidx/kruth/IterableSubjectJvmTest.kt b/kruth/kruth/src/jvmTest/kotlin/androidx/kruth/IterableSubjectJvmTest.kt
similarity index 100%
rename from testutils/testutils-kmp/src/jvmTest/kotlin/androidx/kruth/IterableSubjectJvmTest.kt
rename to kruth/kruth/src/jvmTest/kotlin/androidx/kruth/IterableSubjectJvmTest.kt
diff --git a/leanback/leanback-grid/src/main/java/androidx/leanback/widget/GridLayoutManager.java b/leanback/leanback-grid/src/main/java/androidx/leanback/widget/GridLayoutManager.java
index ca7116d..f31e65c 100644
--- a/leanback/leanback-grid/src/main/java/androidx/leanback/widget/GridLayoutManager.java
+++ b/leanback/leanback-grid/src/main/java/androidx/leanback/widget/GridLayoutManager.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
+import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
@@ -461,6 +462,8 @@
final SparseIntArray mPositionToRowInPostLayout = new SparseIntArray();
int[] mDisappearingPositions;
+ AudioManager mAudioManager;
+
RecyclerView.Recycler mRecycler;
private static final Rect sTempRect = new Rect();
@@ -1238,6 +1241,14 @@
return p.getOpticalTop(v) + p.getAlignY();
}
+ AudioManager getAudioManager() {
+ if (mAudioManager == null) {
+ mAudioManager = (AudioManager) mBaseGridView.getContext()
+ .getSystemService(Context.AUDIO_SERVICE);
+ }
+ return mAudioManager;
+ }
+
/**
* Save Recycler and State for convenience. Must be paired with leaveContext().
*/
@@ -2861,6 +2872,21 @@
mPendingMoveSmoothScroller.decreasePendingMoves();
}
}
+ int soundEffect;
+ if (mOrientation == HORIZONTAL) {
+ boolean rtl = getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
+ if (rtl) {
+ soundEffect = forward ? AudioManager.FX_FOCUS_NAVIGATION_LEFT :
+ AudioManager.FX_FOCUS_NAVIGATION_RIGHT;
+ } else {
+ soundEffect = forward ? AudioManager.FX_FOCUS_NAVIGATION_RIGHT :
+ AudioManager.FX_FOCUS_NAVIGATION_LEFT;
+ }
+ } else {
+ soundEffect = forward ? AudioManager.FX_FOCUS_NAVIGATION_DOWN :
+ AudioManager.FX_FOCUS_NAVIGATION_UP;
+ }
+ getAudioManager().playSoundEffect(soundEffect);
}
@Override
diff --git a/leanback/leanback-paging/src/androidTest/java/androidx/leanback/paging/PagingDataAdapterTest.kt b/leanback/leanback-paging/src/androidTest/java/androidx/leanback/paging/PagingDataAdapterTest.kt
index 2cda1ef..67ca9a3 100644
--- a/leanback/leanback-paging/src/androidTest/java/androidx/leanback/paging/PagingDataAdapterTest.kt
+++ b/leanback/leanback-paging/src/androidTest/java/androidx/leanback/paging/PagingDataAdapterTest.kt
@@ -226,4 +226,4 @@
override fun areItemsTheSame(oldItem: Int, newItem: Int): Boolean {
return oldItem == newItem
}
-}
\ No newline at end of file
+}
diff --git a/leanback/leanback/src/main/java/androidx/leanback/app/package-info.java b/leanback/leanback/src/main/java/androidx/leanback/app/package-info.java
index b3bb913..4e7a474 100644
--- a/leanback/leanback/src/main/java/androidx/leanback/app/package-info.java
+++ b/leanback/leanback/src/main/java/androidx/leanback/app/package-info.java
@@ -62,6 +62,6 @@
* A {@link androidx.leanback.app.GuidedStepSupportFragment} is used to guide the user
* through a decision or series of decisions.
* </p>
- **/
+ */
package androidx.leanback.app;
diff --git a/libraryversions.toml b/libraryversions.toml
index 386c109..0f78aef 100644
--- a/libraryversions.toml
+++ b/libraryversions.toml
@@ -12,7 +12,7 @@
BENCHMARK = "1.2.0-alpha16"
BIOMETRIC = "1.2.0-alpha06"
BLUETOOTH = "1.0.0-alpha01"
-BROWSER = "1.6.0-beta01"
+BROWSER = "1.6.0-rc01"
BUILDSRC_TESTS = "1.0.0-alpha01"
CAMERA = "1.3.0-beta01"
CAMERA_PIPE = "1.0.0-alpha01"
@@ -29,7 +29,7 @@
CONSTRAINTLAYOUT_CORE = "1.1.0-alpha11"
CONTENTPAGER = "1.1.0-alpha01"
COORDINATORLAYOUT = "1.3.0-alpha01"
-CORE = "1.12.0-alpha05"
+CORE = "1.12.0-alpha06"
CORE_ANIMATION = "1.0.0-rc01"
CORE_ANIMATION_TESTING = "1.0.0-rc01"
CORE_APPDIGEST = "1.0.0-alpha01"
@@ -77,6 +77,7 @@
INSPECTION = "1.0.0"
INTERPOLATOR = "1.1.0-alpha01"
JAVASCRIPTENGINE = "1.0.0-alpha06"
+KRUTH = "0.1.0-dev01"
LEANBACK = "1.2.0-alpha03"
LEANBACK_GRID = "1.0.0-alpha02"
LEANBACK_PAGING = "1.1.0-alpha10"
@@ -89,7 +90,7 @@
LOADER = "1.2.0-alpha01"
MEDIA = "1.7.0-alpha02"
MEDIA2 = "1.3.0-alpha01"
-MEDIAROUTER = "1.6.0-alpha05"
+MEDIAROUTER = "1.6.0-beta01"
METRICS = "1.0.0-alpha05"
NAVIGATION = "2.7.0-beta02"
PAGING = "3.3.0-alpha01"
@@ -222,6 +223,7 @@
INSPECTION_EXTENSIONS = { group = "androidx.inspection.extensions", atomicGroupVersion = "versions.SQLITE_INSPECTOR", overrideInclude = [ ":sqlite:sqlite-inspection" ] }
INTERPOLATOR = { group = "androidx.interpolator", atomicGroupVersion = "versions.INTERPOLATOR" }
JAVASCRIPTENGINE = { group = "androidx.javascriptengine", atomicGroupVersion = "versions.JAVASCRIPTENGINE" }
+KRUTH = { group = "androidx.kruth", atomicGroupVersion = "versions.KRUTH" }
LEANBACK = { group = "androidx.leanback" }
LEGACY = { group = "androidx.legacy" }
LIBYUV = { group = "libyuv", atomicGroupVersion = "versions.LIBYUV" }
diff --git a/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleCoroutineScopeAndroidTest.kt b/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleCoroutineScopeAndroidTest.kt
index 77d4db8..66d41e1 100644
--- a/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleCoroutineScopeAndroidTest.kt
+++ b/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleCoroutineScopeAndroidTest.kt
@@ -23,4 +23,4 @@
* To ensure consistent behavior, we run these tests both on androidTest and test
*/
@RunWith(AndroidJUnit4::class)
-class LifecycleCoroutineScopeAndroidTest : LifecycleCoroutineScopeTestBase()
\ No newline at end of file
+class LifecycleCoroutineScopeAndroidTest : LifecycleCoroutineScopeTestBase()
diff --git a/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleScopeIntegrationTest.kt b/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleScopeIntegrationTest.kt
index 48b2542..af7dc2f 100644
--- a/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleScopeIntegrationTest.kt
+++ b/lifecycle/integration-tests/kotlintestapp/src/androidTest/java/androidx/lifecycle/LifecycleScopeIntegrationTest.kt
@@ -120,4 +120,4 @@
}
return owner
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/integration-tests/kotlintestapp/src/main/java/androidx/lifecycle/kotlintestapp/TestActivity.kt b/lifecycle/integration-tests/kotlintestapp/src/main/java/androidx/lifecycle/kotlintestapp/TestActivity.kt
index f0a2e6c..4fce916 100644
--- a/lifecycle/integration-tests/kotlintestapp/src/main/java/androidx/lifecycle/kotlintestapp/TestActivity.kt
+++ b/lifecycle/integration-tests/kotlintestapp/src/main/java/androidx/lifecycle/kotlintestapp/TestActivity.kt
@@ -16,4 +16,4 @@
package androidx.lifecycle.kotlintestapp
-class TestActivity : androidx.activity.ComponentActivity()
\ No newline at end of file
+class TestActivity : androidx.activity.ComponentActivity()
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/CompositeGeneratedAdaptersObserver.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/CompositeGeneratedAdaptersObserver.kt
index a2ee026..374e23b 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/CompositeGeneratedAdaptersObserver.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/CompositeGeneratedAdaptersObserver.kt
@@ -28,4 +28,4 @@
adapter.callMethods(source, event, true, logger)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt
index c0eef46..cdedf03 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserver.kt
@@ -90,4 +90,4 @@
* @param owner the component, whose state was changed
*/
public fun onDestroy(owner: LifecycleOwner) {}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserverAdapter.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserverAdapter.kt
index 9e69dcc..2f76a7e 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserverAdapter.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/DefaultLifecycleObserverAdapter.kt
@@ -32,4 +32,4 @@
}
lifecycleEventObserver?.onStateChanged(source, event)
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/GeneratedAdapter.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/GeneratedAdapter.kt
index e384aae..d47d6ba 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/GeneratedAdapter.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/GeneratedAdapter.kt
@@ -34,4 +34,4 @@
onAny: Boolean,
logger: MethodCallsLogger?
)
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycle.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycle.kt
index bbf1313..66ec94d 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycle.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycle.kt
@@ -442,4 +442,4 @@
}.also { addObserver(it) }
awaitClose { removeObserver(observer) }
- }.flowOn(Dispatchers.Main.immediate)
\ No newline at end of file
+ }.flowOn(Dispatchers.Main.immediate)
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleController.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleController.kt
index 4edc2fb..a07322a 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleController.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleController.kt
@@ -67,4 +67,4 @@
lifecycle.removeObserver(observer)
dispatchQueue.finish()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleEventObserver.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleEventObserver.kt
index 59c2ee3a3..4f7c104 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleEventObserver.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleEventObserver.kt
@@ -34,4 +34,4 @@
* @param event The event
*/
public fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event)
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleOwner.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleOwner.kt
index c8ddcb7..7de82f2 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleOwner.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/LifecycleOwner.kt
@@ -42,4 +42,4 @@
* [Dispatchers.Main.immediate][kotlinx.coroutines.MainCoroutineDispatcher.immediate].
*/
public val LifecycleOwner.lifecycleScope: LifecycleCoroutineScope
- get() = lifecycle.coroutineScope
\ No newline at end of file
+ get() = lifecycle.coroutineScope
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycling.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycling.kt
index 64ce3be..51efb21 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycling.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/Lifecycling.kt
@@ -173,4 +173,4 @@
public fun getAdapterName(className: String): String {
return className.replace(".", "_") + "_LifecycleAdapter"
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.kt b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.kt
index 4e8b9d3..fffe354 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.kt
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/MethodCallsLogger.kt
@@ -29,4 +29,4 @@
calledMethods[name] = mask or type
return !wasCalled
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/DefaultLifecycleObserverTest.kt b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/DefaultLifecycleObserverTest.kt
index 772e9c4..e4a6352 100644
--- a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/DefaultLifecycleObserverTest.kt
+++ b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/DefaultLifecycleObserverTest.kt
@@ -136,4 +136,4 @@
override fun onDestroy(owner: LifecycleOwner) {}
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/LifecyclingTest.kt b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/LifecyclingTest.kt
index 93b99b5..99c31e1 100644
--- a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/LifecyclingTest.kt
+++ b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/LifecyclingTest.kt
@@ -180,4 +180,4 @@
internal class DefaultLifecycleOwner : LifecycleOwner {
override val lifecycle = NoOpLifecycle()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/ReflectiveGenericLifecycleObserverTest.kt b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/ReflectiveGenericLifecycleObserverTest.kt
index f9866c2..f0ece24 100644
--- a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/ReflectiveGenericLifecycleObserverTest.kt
+++ b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/ReflectiveGenericLifecycleObserverTest.kt
@@ -348,4 +348,4 @@
fun testInvalidSuper3() {
ReflectiveGenericLifecycleObserver(DerivedClass5())
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/observers/NoOpLifecycle.kt b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/observers/NoOpLifecycle.kt
index c495f2c..4328f86 100644
--- a/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/observers/NoOpLifecycle.kt
+++ b/lifecycle/lifecycle-common/src/test/java/androidx/lifecycle/observers/NoOpLifecycle.kt
@@ -27,4 +27,4 @@
override val currentState: State
// use arbitrary State
get() = State.RESUMED
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/EventMethod.kt b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/EventMethod.kt
index 32b628f..4ef9301 100644
--- a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/EventMethod.kt
+++ b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/EventMethod.kt
@@ -30,4 +30,4 @@
fun packageName() = type.getPackageQName()
}
-data class EventMethodCall(val method: EventMethod, val syntheticAccess: TypeElement? = null)
\ No newline at end of file
+data class EventMethodCall(val method: EventMethod, val syntheticAccess: TypeElement? = null)
diff --git a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/InputModel.kt b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/InputModel.kt
index 4f10998..34b8975 100644
--- a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/InputModel.kt
+++ b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/InputModel.kt
@@ -43,4 +43,4 @@
(eventMethod.method.parameters.size + 1) == executable.parameters.size
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/LifecycleObserverInfo.kt b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/LifecycleObserverInfo.kt
index c6560fd4..8d94f64 100644
--- a/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/LifecycleObserverInfo.kt
+++ b/lifecycle/lifecycle-compiler/src/main/kotlin/androidx/lifecycle/model/LifecycleObserverInfo.kt
@@ -22,4 +22,4 @@
val type: TypeElement,
val methods: List<EventMethod>,
val parents: List<LifecycleObserverInfo> = listOf()
-)
\ No newline at end of file
+)
diff --git a/lifecycle/lifecycle-livedata-core-truth/src/test/java/androidx/lifecycle/truth/LiveDataSubjectTest.kt b/lifecycle/lifecycle-livedata-core-truth/src/test/java/androidx/lifecycle/truth/LiveDataSubjectTest.kt
index 854423b..6ff7463 100644
--- a/lifecycle/lifecycle-livedata-core-truth/src/test/java/androidx/lifecycle/truth/LiveDataSubjectTest.kt
+++ b/lifecycle/lifecycle-livedata-core-truth/src/test/java/androidx/lifecycle/truth/LiveDataSubjectTest.kt
@@ -49,4 +49,4 @@
assertThat(liveData).hasActiveObservers()
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata-core/build.gradle b/lifecycle/lifecycle-livedata-core/build.gradle
index 58101b7..a97b5994 100644
--- a/lifecycle/lifecycle-livedata-core/build.gradle
+++ b/lifecycle/lifecycle-livedata-core/build.gradle
@@ -34,6 +34,7 @@
testImplementation(libs.kotlinCoroutinesTest)
testImplementation(libs.junit)
testImplementation(libs.mockitoCore4)
+ testImplementation(libs.mockitoKotlin4)
}
androidx {
diff --git a/lifecycle/lifecycle-livedata-core/src/main/java/androidx/lifecycle/Observer.kt b/lifecycle/lifecycle-livedata-core/src/main/java/androidx/lifecycle/Observer.kt
index 2df6295..e406121 100644
--- a/lifecycle/lifecycle-livedata-core/src/main/java/androidx/lifecycle/Observer.kt
+++ b/lifecycle/lifecycle-livedata-core/src/main/java/androidx/lifecycle/Observer.kt
@@ -26,4 +26,4 @@
* Called when the data is changed is changed to [value].
*/
fun onChanged(value: T)
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.java b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.java
deleted file mode 100644
index 874db97..0000000
--- a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.java
+++ /dev/null
@@ -1,965 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_CREATE;
-import static androidx.lifecycle.Lifecycle.Event.ON_DESTROY;
-import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
-import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
-import static androidx.lifecycle.Lifecycle.Event.ON_START;
-import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.only;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
-
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.UnconfinedTestDispatcher;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.arch.core.executor.ArchTaskExecutor;
-import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
-import androidx.lifecycle.testing.TestLifecycleOwner;
-
-import org.hamcrest.CoreMatchers;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.ArgumentCaptor;
-import org.mockito.InOrder;
-import org.mockito.Mockito;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-@SuppressWarnings({"unchecked"})
-@RunWith(JUnit4.class)
-public class LiveDataTest {
-
- @Rule
- public InstantTaskExecutorRule mInstantTaskExecutorRule = new InstantTaskExecutorRule();
-
- private PublicLiveData<String> mLiveData;
- private MethodExec mActiveObserversChanged;
-
- private TestLifecycleOwner mOwner;
-
- private TestLifecycleOwner mOwner2;
-
- private LifecycleOwner mOwner3;
- private Lifecycle mLifecycle3;
- private Observer<String> mObserver3;
-
- private LifecycleOwner mOwner4;
- private Lifecycle mLifecycle4;
- private Observer<String> mObserver4;
-
- private boolean mInObserver;
-
- @Before
- public void init() {
- mLiveData = new PublicLiveData<>();
-
- mActiveObserversChanged = mock(MethodExec.class);
- mLiveData.activeObserversChanged = mActiveObserversChanged;
-
- mOwner = new TestLifecycleOwner(Lifecycle.State.INITIALIZED,
- UnconfinedTestDispatcher(null, null));
-
- mOwner2 = new TestLifecycleOwner(Lifecycle.State.INITIALIZED,
- UnconfinedTestDispatcher(null, null));
-
- mInObserver = false;
- }
-
- @Before
- public void initNonLifecycleRegistry() {
- mOwner3 = mock(LifecycleOwner.class);
- mLifecycle3 = mock(Lifecycle.class);
- mObserver3 = (Observer<String>) mock(Observer.class);
- when(mOwner3.getLifecycle()).thenReturn(mLifecycle3);
-
- mOwner4 = mock(LifecycleOwner.class);
- mLifecycle4 = mock(Lifecycle.class);
- mObserver4 = (Observer<String>) mock(Observer.class);
- when(mOwner4.getLifecycle()).thenReturn(mLifecycle4);
- }
-
- @After
- public void removeExecutorDelegate() {
- ArchTaskExecutor.getInstance().setDelegate(null);
- }
-
- @Test
- public void testIsInitialized() {
- assertThat(mLiveData.isInitialized(), is(false));
- assertThat(mLiveData.getValue(), is(nullValue()));
-
- mLiveData.setValue("a");
-
- assertThat(mLiveData.getValue(), is("a"));
- assertThat(mLiveData.isInitialized(), is(true));
- }
-
- @Test
- public void testIsInitializedNullValue() {
- assertThat(mLiveData.isInitialized(), is(false));
- assertThat(mLiveData.getValue(), is(nullValue()));
-
- mLiveData.setValue(null);
-
- assertThat(mLiveData.isInitialized(), is(true));
- assertThat(mLiveData.getValue(), is(nullValue()));
- }
-
- @Test
- public void testObserverToggle() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
-
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(false));
-
- mLiveData.removeObserver(observer);
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- assertThat(mLiveData.hasObservers(), is(false));
- assertThat(mLiveData.hasActiveObservers(), is(false));
- }
-
- @Test
- public void testActiveObserverToggle() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
-
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(false));
-
- mOwner.handleLifecycleEvent(ON_START);
- verify(mActiveObserversChanged).onCall(true);
- assertThat(mLiveData.hasActiveObservers(), is(true));
- reset(mActiveObserversChanged);
-
- mOwner.handleLifecycleEvent(ON_STOP);
- verify(mActiveObserversChanged).onCall(false);
- assertThat(mLiveData.hasActiveObservers(), is(false));
- assertThat(mLiveData.hasObservers(), is(true));
-
- reset(mActiveObserversChanged);
- mOwner.handleLifecycleEvent(ON_START);
- verify(mActiveObserversChanged).onCall(true);
- assertThat(mLiveData.hasActiveObservers(), is(true));
- assertThat(mLiveData.hasObservers(), is(true));
-
- reset(mActiveObserversChanged);
- mLiveData.removeObserver(observer);
- verify(mActiveObserversChanged).onCall(false);
- assertThat(mLiveData.hasActiveObservers(), is(false));
- assertThat(mLiveData.hasObservers(), is(false));
-
- verifyNoMoreInteractions(mActiveObserversChanged);
- }
-
- @Test
- public void testReAddSameObserverTuple() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
- mLiveData.observe(mOwner, observer);
- assertThat(mLiveData.hasObservers(), is(true));
- }
-
- @Test
- public void testAdd2ObserversWithSameOwnerAndRemove() {
- Observer<String> o1 = (Observer<String>) mock(Observer.class);
- Observer<String> o2 = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, o1);
- mLiveData.observe(mOwner, o2);
- assertThat(mLiveData.hasObservers(), is(true));
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
-
- mOwner.handleLifecycleEvent(ON_START);
- verify(mActiveObserversChanged).onCall(true);
- mLiveData.setValue("a");
- verify(o1).onChanged("a");
- verify(o2).onChanged("a");
-
- mLiveData.removeObservers(mOwner);
-
- assertThat(mLiveData.hasObservers(), is(false));
- assertThat(mOwner.getObserverCount(), is(0));
- }
-
- @Test
- public void testAddSameObserverIn2LifecycleOwners() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
-
- mLiveData.observe(mOwner, observer);
- Throwable throwable = null;
- try {
- mLiveData.observe(mOwner2, observer);
- } catch (Throwable t) {
- throwable = t;
- }
- assertThat(throwable, instanceOf(IllegalArgumentException.class));
- //noinspection ConstantConditions
- assertThat(throwable.getMessage(),
- is("Cannot add the same observer with different lifecycles"));
- }
-
- @Test
- public void testRemoveDestroyedObserver() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
- mOwner.handleLifecycleEvent(ON_START);
- verify(mActiveObserversChanged).onCall(true);
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(true));
-
- reset(mActiveObserversChanged);
-
- mOwner.handleLifecycleEvent(ON_DESTROY);
- assertThat(mLiveData.hasObservers(), is(false));
- assertThat(mLiveData.hasActiveObservers(), is(false));
- verify(mActiveObserversChanged).onCall(false);
- }
-
- @Test
- public void testInactiveRegistry() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mOwner.handleLifecycleEvent(ON_CREATE);
- mOwner.handleLifecycleEvent(ON_DESTROY);
- mLiveData.observe(mOwner, observer);
- assertThat(mLiveData.hasObservers(), is(false));
- }
-
- @Test
- public void testNotifyActiveInactive() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mOwner.handleLifecycleEvent(ON_CREATE);
- mLiveData.observe(mOwner, observer);
- mLiveData.setValue("a");
- verify(observer, never()).onChanged(anyString());
- mOwner.handleLifecycleEvent(ON_START);
- verify(observer).onChanged("a");
-
- mLiveData.setValue("b");
- verify(observer).onChanged("b");
-
- mOwner.handleLifecycleEvent(ON_STOP);
- mLiveData.setValue("c");
- verify(observer, never()).onChanged("c");
-
- mOwner.handleLifecycleEvent(ON_START);
- verify(observer).onChanged("c");
-
- reset(observer);
- mOwner.handleLifecycleEvent(ON_STOP);
- mOwner.handleLifecycleEvent(ON_START);
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void testStopObservingOwner_onDestroy() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mOwner.handleLifecycleEvent(ON_CREATE);
- mLiveData.observe(mOwner, observer);
- assertThat(mOwner.getObserverCount(), is(1));
- mOwner.handleLifecycleEvent(ON_DESTROY);
- assertThat(mOwner.getObserverCount(), is(0));
- }
-
- @Test
- public void testStopObservingOwner_onStopObserving() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mOwner.handleLifecycleEvent(ON_CREATE);
- mLiveData.observe(mOwner, observer);
- assertThat(mOwner.getObserverCount(), is(1));
-
- mLiveData.removeObserver(observer);
- assertThat(mOwner.getObserverCount(), is(0));
- }
-
- @Test
- public void testActiveChangeInCallback() {
- mOwner.handleLifecycleEvent(ON_START);
- Observer<String> observer1 = spy(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- mOwner.handleLifecycleEvent(ON_STOP);
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(false));
- }
- });
- final Observer observer2 = mock(Observer.class);
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner, observer2);
- mLiveData.setValue("bla");
- verify(observer1).onChanged(anyString());
- verify(observer2, Mockito.never()).onChanged(anyString());
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(false));
- }
-
- @Test
- public void testActiveChangeInCallback2() {
- Observer<String> observer1 = spy(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- assertThat(mInObserver, is(false));
- mInObserver = true;
- mOwner.handleLifecycleEvent(ON_START);
- assertThat(mLiveData.hasActiveObservers(), is(true));
- mInObserver = false;
- }
- });
- final Observer observer2 = spy(new FailReentranceObserver());
- mLiveData.observeForever(observer1);
- mLiveData.observe(mOwner, observer2);
- mLiveData.setValue("bla");
- verify(observer1).onChanged(anyString());
- verify(observer2).onChanged(anyString());
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(true));
- }
-
- @Test
- public void testObserverRemovalInCallback() {
- mOwner.handleLifecycleEvent(ON_START);
- Observer<String> observer = spy(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- assertThat(mLiveData.hasObservers(), is(true));
- mLiveData.removeObserver(this);
- assertThat(mLiveData.hasObservers(), is(false));
- }
- });
- mLiveData.observe(mOwner, observer);
- mLiveData.setValue("bla");
- verify(observer).onChanged(anyString());
- assertThat(mLiveData.hasObservers(), is(false));
- }
-
- @Test
- public void testObserverAdditionInCallback() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer observer2 = spy(new FailReentranceObserver());
- Observer<String> observer1 = spy(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- assertThat(mInObserver, is(false));
- mInObserver = true;
- mLiveData.observe(mOwner, observer2);
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(true));
- mInObserver = false;
- }
- });
- mLiveData.observe(mOwner, observer1);
- mLiveData.setValue("bla");
- verify(observer1).onChanged(anyString());
- verify(observer2).onChanged(anyString());
- assertThat(mLiveData.hasObservers(), is(true));
- assertThat(mLiveData.hasActiveObservers(), is(true));
- }
-
- @Test
- public void testObserverWithoutLifecycleOwner() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.setValue("boring");
- mLiveData.observeForever(observer);
- verify(mActiveObserversChanged).onCall(true);
- verify(observer).onChanged("boring");
- mLiveData.setValue("tihs");
- verify(observer).onChanged("tihs");
- mLiveData.removeObserver(observer);
- verify(mActiveObserversChanged).onCall(false);
- mLiveData.setValue("boring");
- reset(observer);
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void testSetValueDuringSetValue() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer observer1 = spy(new Observer<String>() {
- @Override
- public void onChanged(String o) {
- assertThat(mInObserver, is(false));
- mInObserver = true;
- if (o.equals(("bla"))) {
- mLiveData.setValue("gt");
- }
- mInObserver = false;
- }
- });
- final Observer observer2 = spy(new FailReentranceObserver());
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner, observer2);
- mLiveData.setValue("bla");
- verify(observer1, Mockito.times(1)).onChanged("gt");
- verify(observer2, Mockito.times(1)).onChanged("gt");
- }
-
- @Test
- public void testRemoveDuringSetValue() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer observer1 = spy(new Observer<String>() {
- @Override
- public void onChanged(String o) {
- mLiveData.removeObserver(this);
- }
- });
- Observer<String> observer2 = (Observer<String>) mock(Observer.class);
- mLiveData.observeForever(observer1);
- mLiveData.observe(mOwner, observer2);
- mLiveData.setValue("gt");
- verify(observer2).onChanged("gt");
- }
-
- @Test
- public void testDataChangeDuringStateChange() {
- mOwner.handleLifecycleEvent(ON_START);
- mOwner.getLifecycle().addObserver(new DefaultLifecycleObserver() {
- @Override
- public void onStop(@NonNull LifecycleOwner owner) {
- // change data in onStop, observer should not be called!
- mLiveData.setValue("b");
- }
- });
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.setValue("a");
- mLiveData.observe(mOwner, observer);
- verify(observer).onChanged("a");
- mOwner.handleLifecycleEvent(ON_PAUSE);
- mOwner.handleLifecycleEvent(ON_STOP);
- verify(observer, never()).onChanged("b");
-
- mOwner.handleLifecycleEvent(ON_RESUME);
- verify(observer).onChanged("b");
- }
-
- @Test
- public void testNotCallInactiveWithObserveForever() {
- mOwner.handleLifecycleEvent(ON_START);
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- Observer<String> observer2 = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
- mLiveData.observeForever(observer2);
- verify(mActiveObserversChanged).onCall(true);
- reset(mActiveObserversChanged);
- mOwner.handleLifecycleEvent(ON_STOP);
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- mOwner.handleLifecycleEvent(ON_START);
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- }
-
- @Test
- public void testRemoveDuringAddition() {
- mOwner.handleLifecycleEvent(ON_START);
- mLiveData.setValue("bla");
- mLiveData.observeForever(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- mLiveData.removeObserver(this);
- }
- });
- assertThat(mLiveData.hasActiveObservers(), is(false));
- InOrder inOrder = Mockito.inOrder(mActiveObserversChanged);
- inOrder.verify(mActiveObserversChanged).onCall(true);
- inOrder.verify(mActiveObserversChanged).onCall(false);
- inOrder.verifyNoMoreInteractions();
- }
-
- @Test
- public void testRemoveDuringBringingUpToState() {
- mLiveData.setValue("bla");
- mLiveData.observeForever(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- mLiveData.removeObserver(this);
- }
- });
- mOwner.handleLifecycleEvent(ON_RESUME);
- assertThat(mLiveData.hasActiveObservers(), is(false));
- InOrder inOrder = Mockito.inOrder(mActiveObserversChanged);
- inOrder.verify(mActiveObserversChanged).onCall(true);
- inOrder.verify(mActiveObserversChanged).onCall(false);
- inOrder.verifyNoMoreInteractions();
- }
-
- @Test
- public void setValue_neverActive_observerOnChangedNotCalled() {
- Observer<String> observer = (Observer<String>) mock(Observer.class);
- mLiveData.observe(mOwner, observer);
-
- mLiveData.setValue("1");
-
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void setValue_twoObserversTwoStartedOwners_onChangedCalledOnBoth() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
- mOwner2.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- mLiveData.setValue("1");
-
- verify(observer1).onChanged("1");
- verify(observer2).onChanged("1");
- }
-
- @Test
- public void setValue_twoObserversOneStartedOwner_onChangedCalledOnOneCorrectObserver() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- mLiveData.setValue("1");
-
- verify(observer1).onChanged("1");
- verify(observer2, never()).onChanged(anyString());
- }
-
- @Test
- public void setValue_twoObserversBothStartedAfterSetValue_onChangedCalledOnBoth() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mLiveData.setValue("1");
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
- mOwner2.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- verify(observer1).onChanged("1");
- verify(observer2).onChanged("1");
- }
-
- @Test
- public void setValue_twoObserversOneStartedAfterSetValue_onChangedCalledOnCorrectObserver() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mLiveData.setValue("1");
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- verify(observer1).onChanged("1");
- verify(observer2, never()).onChanged(anyString());
- }
-
- @Test
- public void setValue_twoObserversOneStarted_liveDataBecomesActive() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- verify(mActiveObserversChanged).onCall(true);
- }
-
- @Test
- public void setValue_twoObserversOneStopped_liveDataStaysActive() {
- Observer<String> observer1 = mock(Observer.class);
- Observer<String> observer2 = mock(Observer.class);
-
- mLiveData.observe(mOwner, observer1);
- mLiveData.observe(mOwner2, observer2);
-
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
- mOwner2.handleLifecycleEvent(Lifecycle.Event.ON_START);
-
- verify(mActiveObserversChanged).onCall(true);
-
- reset(mActiveObserversChanged);
- mOwner.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
-
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- }
-
- @Test
- public void setValue_lifecycleIsCreatedNoEvent_liveDataBecomesInactiveAndObserverNotCalled() {
-
- // Arrange.
-
- mLiveData.observe(mOwner3, mObserver3);
-
- LifecycleEventObserver lifecycleObserver = getLiveDataInternalObserver(mLifecycle3);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
-
- reset(mActiveObserversChanged);
- reset(mObserver3);
-
- // Act.
-
- mLiveData.setValue("1");
-
- // Assert.
-
- verify(mActiveObserversChanged).onCall(false);
- verify(mObserver3, never()).onChanged(anyString());
- }
-
- /*
- * Arrange: LiveData was made inactive via SetValue (because the Lifecycle it was
- * observing was in the CREATED state and no event was dispatched).
- * Act: Lifecycle enters Started state and dispatches event.
- * Assert: LiveData becomes active and dispatches new value to observer.
- */
- @Test
- public void test_liveDataInactiveViaSetValueThenLifecycleResumes() {
-
- // Arrange.
-
- mLiveData.observe(mOwner3, mObserver3);
-
- LifecycleEventObserver lifecycleObserver = getLiveDataInternalObserver(mLifecycle3);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
- mLiveData.setValue("1");
-
- reset(mActiveObserversChanged);
- reset(mObserver3);
-
- // Act.
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
-
- // Assert.
-
- verify(mActiveObserversChanged).onCall(true);
- verify(mObserver3).onChanged("1");
- }
-
- /*
- * Arrange: One of two Lifecycles enter the CREATED state without sending an event.
- * Act: Lifecycle's setValue method is called with new value.
- * Assert: LiveData stays active and new value is dispatched to Lifecycle that is still at least
- * STARTED.
- */
- @Test
- public void setValue_oneOfTwoLifecyclesAreCreatedNoEvent() {
-
- // Arrange.
-
- mLiveData.observe(mOwner3, mObserver3);
- mLiveData.observe(mOwner4, mObserver4);
-
- LifecycleEventObserver lifecycleObserver3 = getLiveDataInternalObserver(mLifecycle3);
- LifecycleEventObserver lifecycleObserver4 = getLiveDataInternalObserver(mLifecycle4);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- when(mLifecycle4.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver3.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
- lifecycleObserver4.onStateChanged(mOwner4, Lifecycle.Event.ON_START);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
-
- reset(mActiveObserversChanged);
- reset(mObserver3);
- reset(mObserver4);
-
- // Act.
-
- mLiveData.setValue("1");
-
- // Assert.
-
- verify(mActiveObserversChanged, never()).onCall(anyBoolean());
- verify(mObserver3, never()).onChanged(anyString());
- verify(mObserver4).onChanged("1");
- }
-
- /*
- * Arrange: Two observed Lifecycles enter the CREATED state without sending an event.
- * Act: Lifecycle's setValue method is called with new value.
- * Assert: LiveData becomes inactive and nothing is dispatched to either observer.
- */
- @Test
- public void setValue_twoLifecyclesAreCreatedNoEvent() {
-
- // Arrange.
-
- mLiveData.observe(mOwner3, mObserver3);
- mLiveData.observe(mOwner4, mObserver4);
-
- LifecycleEventObserver lifecycleObserver3 = getLiveDataInternalObserver(mLifecycle3);
- LifecycleEventObserver lifecycleObserver4 = getLiveDataInternalObserver(mLifecycle4);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- when(mLifecycle4.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver3.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
- lifecycleObserver4.onStateChanged(mOwner4, Lifecycle.Event.ON_START);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
- when(mLifecycle4.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
-
- reset(mActiveObserversChanged);
- reset(mObserver3);
- reset(mObserver4);
-
- // Act.
-
- mLiveData.setValue("1");
-
- // Assert.
-
- verify(mActiveObserversChanged).onCall(false);
- verify(mObserver3, never()).onChanged(anyString());
- verify(mObserver3, never()).onChanged(anyString());
- }
-
- /*
- * Arrange: LiveData was made inactive via SetValue (because both Lifecycles it was
- * observing were in the CREATED state and no event was dispatched).
- * Act: One Lifecycle enters STARTED state and dispatches lifecycle event.
- * Assert: LiveData becomes active and dispatches new value to observer associated with started
- * Lifecycle.
- */
- @Test
- public void test_liveDataInactiveViaSetValueThenOneLifecycleResumes() {
-
- // Arrange.
-
- mLiveData.observe(mOwner3, mObserver3);
- mLiveData.observe(mOwner4, mObserver4);
-
- LifecycleEventObserver lifecycleObserver3 = getLiveDataInternalObserver(mLifecycle3);
- LifecycleEventObserver lifecycleObserver4 = getLiveDataInternalObserver(mLifecycle4);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- when(mLifecycle4.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver3.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
- lifecycleObserver4.onStateChanged(mOwner4, Lifecycle.Event.ON_START);
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
- when(mLifecycle4.getCurrentState()).thenReturn(Lifecycle.State.CREATED);
-
- mLiveData.setValue("1");
-
- reset(mActiveObserversChanged);
- reset(mObserver3);
- reset(mObserver4);
-
- // Act.
-
- when(mLifecycle3.getCurrentState()).thenReturn(Lifecycle.State.STARTED);
- lifecycleObserver3.onStateChanged(mOwner3, Lifecycle.Event.ON_START);
-
- // Assert.
-
- verify(mActiveObserversChanged).onCall(true);
- verify(mObserver3).onChanged("1");
- verify(mObserver4, never()).onChanged(anyString());
- }
-
- @Test
- public void nestedForeverObserver() {
- mLiveData.setValue(".");
- mLiveData.observeForever(new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- mLiveData.observeForever(mock(Observer.class));
- mLiveData.removeObserver(this);
- }
- });
- verify(mActiveObserversChanged, only()).onCall(true);
- }
-
- @Test
- public void readdForeverObserver() {
- Observer observer = mock(Observer.class);
- mLiveData.observeForever(observer);
- mLiveData.observeForever(observer);
- mLiveData.removeObserver(observer);
- assertThat(mLiveData.hasObservers(), is(false));
- }
-
- @Test
- public void initialValue() {
- MutableLiveData<String> mutableLiveData = new MutableLiveData<>("foo");
- Observer<String> observer = mock(Observer.class);
- mOwner.handleLifecycleEvent(ON_START);
- mutableLiveData.observe(mOwner, observer);
- verify(observer).onChanged("foo");
- }
-
- @Test
- public void activeReentry_removeOnActive() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer<String> observer = new Observer<String>() {
- @Override
- public void onChanged(String s) {
-
- }
- };
- final List<Boolean> activeCalls = new ArrayList<>();
- LiveData<String> liveData = new MutableLiveData<String>("foo") {
- @Override
- protected void onActive() {
- activeCalls.add(true);
- super.onActive();
- removeObserver(observer);
- }
-
- @Override
- protected void onInactive() {
- activeCalls.add(false);
- super.onInactive();
- }
- };
-
- liveData.observe(mOwner, observer);
- assertThat(activeCalls, CoreMatchers.equalTo(Arrays.asList(true, false)));
- }
-
- @Test
- public void activeReentry_addOnInactive() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer<String> observer1 = mock(Observer.class);
- final Observer<String> observer2 = mock(Observer.class);
- final List<Boolean> activeCalls = new ArrayList<>();
- LiveData<String> liveData = new MutableLiveData<String>("foo") {
- @Override
- protected void onActive() {
- activeCalls.add(true);
- super.onActive();
- }
-
- @Override
- protected void onInactive() {
- activeCalls.add(false);
- observe(mOwner, observer2);
- super.onInactive();
- }
- };
-
- liveData.observe(mOwner, observer1);
- liveData.removeObserver(observer1);
- liveData.removeObserver(observer2);
- assertThat(activeCalls, CoreMatchers.equalTo(Arrays.asList(true, false, true, false,
- true)));
- }
-
- @Test
- public void activeReentry_lifecycleChangesActive() {
- mOwner.handleLifecycleEvent(ON_START);
- final Observer<String> observer = new Observer<String>() {
- @Override
- public void onChanged(String s) {
- mOwner.handleLifecycleEvent(ON_STOP);
- }
- };
- final List<Boolean> activeCalls = new ArrayList<>();
- LiveData<String> liveData = new MutableLiveData<String>("foo") {
- @Override
- protected void onActive() {
- activeCalls.add(true);
- super.onActive();
- }
-
- @Override
- protected void onInactive() {
- activeCalls.add(false);
- super.onInactive();
- }
- };
- liveData.observe(mOwner, observer);
- assertThat(mOwner.getCurrentState(), is(Lifecycle.State.CREATED));
- assertThat(activeCalls, is(Arrays.asList(true, false)));
- }
-
- private LifecycleEventObserver getLiveDataInternalObserver(Lifecycle lifecycle) {
- ArgumentCaptor<LifecycleEventObserver> captor =
- ArgumentCaptor.forClass(LifecycleEventObserver.class);
- verify(lifecycle).addObserver(captor.capture());
- return (captor.getValue());
- }
-
- @SuppressWarnings("WeakerAccess")
- static class PublicLiveData<T> extends LiveData<T> {
- // cannot spy due to internal calls
- public MethodExec activeObserversChanged;
-
- @Override
- protected void onActive() {
- if (activeObserversChanged != null) {
- activeObserversChanged.onCall(true);
- }
- }
-
- @Override
- protected void onInactive() {
- if (activeObserversChanged != null) {
- activeObserversChanged.onCall(false);
- }
- }
- }
-
- private class FailReentranceObserver<T> implements Observer<T> {
- @Override
- public void onChanged(@Nullable T value) {
- assertThat(mInObserver, is(false));
- }
- }
-
- interface MethodExec {
- void onCall(boolean value);
- }
-}
diff --git a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.kt b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.kt
new file mode 100644
index 0000000..b280b60
--- /dev/null
+++ b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/LiveDataTest.kt
@@ -0,0 +1,851 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import androidx.arch.core.executor.ArchTaskExecutor.getInstance
+import androidx.arch.core.executor.testing.InstantTaskExecutorRule
+import androidx.lifecycle.testing.TestLifecycleOwner
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.UnconfinedTestDispatcher
+import org.hamcrest.CoreMatchers.equalTo
+import org.hamcrest.CoreMatchers.instanceOf
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.CoreMatchers.nullValue
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.After
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.mockito.ArgumentMatchers.anyString
+import org.mockito.Mockito.anyBoolean
+import org.mockito.Mockito.`when`
+import org.mockito.kotlin.KArgumentCaptor
+import org.mockito.kotlin.argumentCaptor
+import org.mockito.kotlin.inOrder
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.never
+import org.mockito.kotlin.only
+import org.mockito.kotlin.reset
+import org.mockito.kotlin.spy
+import org.mockito.kotlin.times
+import org.mockito.kotlin.verify
+import org.mockito.kotlin.verifyNoMoreInteractions
+
+@Suppress("unchecked_cast")
+@RunWith(JUnit4::class)
+class LiveDataTest {
+ @JvmField
+ @Rule
+ var instantTaskExecutorRule = InstantTaskExecutorRule()
+
+ private lateinit var liveData: PublicLiveData<String>
+ private lateinit var activeObserversChanged: MethodExec
+ private lateinit var owner: TestLifecycleOwner
+ private lateinit var owner2: TestLifecycleOwner
+ private lateinit var owner3: LifecycleOwner
+ private lateinit var lifecycle3: Lifecycle
+ private lateinit var observer3: Observer<String>
+ private lateinit var owner4: LifecycleOwner
+ private lateinit var lifecycle4: Lifecycle
+ private lateinit var observer4: Observer<String>
+ private var inObserver = false
+
+ @OptIn(ExperimentalCoroutinesApi::class)
+ @Before
+ fun init() {
+ liveData = PublicLiveData()
+ activeObserversChanged = mock()
+ liveData.activeObserversChanged = activeObserversChanged
+ owner = TestLifecycleOwner(
+ Lifecycle.State.INITIALIZED,
+ UnconfinedTestDispatcher(null, null)
+ )
+ owner2 = TestLifecycleOwner(
+ Lifecycle.State.INITIALIZED,
+ UnconfinedTestDispatcher(null, null)
+ )
+ inObserver = false
+ }
+
+ @Before
+ fun initNonLifecycleRegistry() {
+ owner3 = mock()
+ lifecycle3 = mock()
+ observer3 = mock()
+ `when`(owner3.lifecycle).thenReturn(lifecycle3)
+ owner4 = mock()
+ lifecycle4 = mock()
+ observer4 = mock()
+ `when`(owner4.lifecycle).thenReturn(lifecycle4)
+ }
+
+ @After
+ fun removeExecutorDelegate() {
+ getInstance().setDelegate(null)
+ }
+
+ @Test
+ fun testIsInitialized() {
+ assertThat(liveData.isInitialized, `is`(false))
+ assertThat(liveData.value, `is`(nullValue()))
+ liveData.value = "a"
+ assertThat(liveData.value, `is`("a"))
+ assertThat(liveData.isInitialized, `is`(true))
+ }
+
+ @Test
+ fun testIsInitializedNullValue() {
+ assertThat(liveData.isInitialized, `is`(false))
+ assertThat(liveData.value, `is`(nullValue()))
+ liveData.value = null
+ assertThat(liveData.isInitialized, `is`(true))
+ assertThat(liveData.value, `is`(nullValue()))
+ }
+
+ @Test
+ fun testObserverToggle() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ liveData.removeObserver(observer)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ assertThat(liveData.hasObservers(), `is`(false))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ }
+
+ @Test
+ fun testActiveObserverToggle() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ reset(activeObserversChanged)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ verify(activeObserversChanged).onCall(false)
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ assertThat(liveData.hasObservers(), `is`(true))
+ reset(activeObserversChanged)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ assertThat(liveData.hasObservers(), `is`(true))
+ reset(activeObserversChanged)
+ liveData.removeObserver(observer)
+ verify(activeObserversChanged).onCall(false)
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ assertThat(liveData.hasObservers(), `is`(false))
+ verifyNoMoreInteractions(activeObserversChanged)
+ }
+
+ @Test
+ fun testReAddSameObserverTuple() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ liveData.observe(owner, observer)
+ assertThat(liveData.hasObservers(), `is`(true))
+ }
+
+ @Test
+ fun testAdd2ObserversWithSameOwnerAndRemove() {
+ val o1 = mock() as Observer<String>
+ val o2 = mock() as Observer<String>
+ liveData.observe(owner, o1)
+ liveData.observe(owner, o2)
+ assertThat(liveData.hasObservers(), `is`(true))
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ liveData.value = "a"
+ verify(o1).onChanged("a")
+ verify(o2).onChanged("a")
+ liveData.removeObservers(owner)
+ assertThat(liveData.hasObservers(), `is`(false))
+ assertThat(owner.observerCount, `is`(0))
+ }
+
+ @Test
+ fun testAddSameObserverIn2LifecycleOwners() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ lateinit var throwable: Throwable
+ try {
+ liveData.observe(owner2, observer)
+ } catch (t: Throwable) {
+ throwable = t
+ }
+ assertThat(
+ throwable,
+ instanceOf(IllegalArgumentException::class.java)
+ )
+ assertThat(
+ throwable.message,
+ `is`("Cannot add the same observer with different lifecycles")
+ )
+ }
+
+ @Test
+ fun testRemoveDestroyedObserver() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ reset(activeObserversChanged)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY)
+ assertThat(liveData.hasObservers(), `is`(false))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ verify(activeObserversChanged).onCall(false)
+ }
+
+ @Test
+ fun testInactiveRegistry() {
+ val observer = mock() as Observer<String>
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY)
+ liveData.observe(owner, observer)
+ assertThat(liveData.hasObservers(), `is`(false))
+ }
+
+ @Test
+ fun testNotifyActiveInactive() {
+ val observer = mock() as Observer<String>
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
+ liveData.observe(owner, observer)
+ liveData.value = "a"
+ verify(observer, never()).onChanged(anyString())
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(observer).onChanged("a")
+ liveData.value = "b"
+ verify(observer).onChanged("b")
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ liveData.value = "c"
+ verify(observer, never()).onChanged("c")
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(observer).onChanged("c")
+ reset(observer)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun testStopObservingOwner_onDestroy() {
+ val observer = mock() as Observer<String>
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
+ liveData.observe(owner, observer)
+ assertThat(owner.observerCount, `is`(1))
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY)
+ assertThat(owner.observerCount, `is`(0))
+ }
+
+ @Test
+ fun testStopObservingOwner_onStopObserving() {
+ val observer = mock() as Observer<String>
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_CREATE)
+ liveData.observe(owner, observer)
+ assertThat(owner.observerCount, `is`(1))
+ liveData.removeObserver(observer)
+ assertThat(owner.observerCount, `is`(0))
+ }
+
+ @Test
+ fun testActiveChangeInCallback() {
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ }
+ }
+
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer1 = spy(TestObserver())
+ val observer2 = mock() as Observer<String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner, observer2)
+ liveData.value = "bla"
+ verify(observer1).onChanged(anyString())
+ verify(observer2, never()).onChanged(anyString())
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ }
+
+ @Test
+ fun testActiveChangeInCallback2() {
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ assertThat(inObserver, `is`(false))
+ inObserver = true
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ inObserver = false
+ }
+ }
+
+ val observer1 = spy(TestObserver())
+ val observer2 =
+ spy<FailReentrantObserver<*>>(FailReentrantObserver<Any?>()) as Observer<in String>
+ liveData.observeForever(observer1)
+ liveData.observe(owner, observer2)
+ liveData.value = "bla"
+ verify(observer1).onChanged(anyString())
+ verify(observer2).onChanged(anyString())
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ }
+
+ @Test
+ fun testObserverRemovalInCallback() {
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ assertThat(liveData.hasObservers(), `is`(true))
+ liveData.removeObserver(this)
+ assertThat(liveData.hasObservers(), `is`(false))
+ }
+ }
+
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer = spy(TestObserver())
+ liveData.observe(owner, observer)
+ liveData.value = "bla"
+ verify(observer).onChanged(anyString())
+ assertThat(liveData.hasObservers(), `is`(false))
+ }
+
+ @Test
+ fun testObserverAdditionInCallback() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer2 =
+ spy<FailReentrantObserver<*>>(FailReentrantObserver<Any?>()) as Observer<in String>
+
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ assertThat(inObserver, `is`(false))
+ inObserver = true
+ liveData.observe(owner, observer2)
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ inObserver = false
+ }
+ }
+
+ val observer1 = spy(TestObserver())
+ liveData.observe(owner, observer1)
+ liveData.value = "bla"
+ verify(observer1).onChanged(anyString())
+ verify(observer2).onChanged(anyString())
+ assertThat(liveData.hasObservers(), `is`(true))
+ assertThat(liveData.hasActiveObservers(), `is`(true))
+ }
+
+ @Test
+ fun testObserverWithoutLifecycleOwner() {
+ val observer = mock() as Observer<String>
+ liveData.value = "boring"
+ liveData.observeForever(observer)
+ verify(activeObserversChanged).onCall(true)
+ verify(observer).onChanged("boring")
+ liveData.value = "this"
+ verify(observer).onChanged("this")
+ liveData.removeObserver(observer)
+ verify(activeObserversChanged).onCall(false)
+ liveData.value = "boring"
+ reset(observer)
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun testSetValueDuringSetValue() {
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ assertThat(inObserver, `is`(false))
+ inObserver = true
+ if (value == "bla") {
+ liveData.value = "gt"
+ }
+ inObserver = false
+ }
+ }
+
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer1 = spy(TestObserver())
+ val observer2 =
+ spy<FailReentrantObserver<*>>(FailReentrantObserver<Any?>()) as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner, observer2)
+ liveData.value = "bla"
+ verify(observer1, times(1)).onChanged("gt")
+ verify(observer2, times(1)).onChanged("gt")
+ }
+
+ @Test
+ fun testRemoveDuringSetValue() {
+ open class TestObserver : Observer<String> {
+ override fun onChanged(value: String) {
+ liveData.removeObserver(this)
+ }
+ }
+
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer1 = spy(TestObserver())
+ val observer2 = mock() as Observer<String>
+ liveData.observeForever(observer1)
+ liveData.observe(owner, observer2)
+ liveData.value = "gt"
+ verify(observer2).onChanged("gt")
+ }
+
+ @Test
+ fun testDataChangeDuringStateChange() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ owner.lifecycle.addObserver(object : DefaultLifecycleObserver {
+ override fun onStop(owner: LifecycleOwner) {
+ // change data in onStop, observer should not be called!
+ liveData.value = "b"
+ }
+ })
+ val observer = mock() as Observer<String>
+ liveData.value = "a"
+ liveData.observe(owner, observer)
+ verify(observer).onChanged("a")
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ verify(observer, never()).onChanged("b")
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
+ verify(observer).onChanged("b")
+ }
+
+ @Test
+ fun testNotCallInactiveWithObserveForever() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer = mock() as Observer<String>
+ val observer2 = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ liveData.observeForever(observer2)
+ verify(activeObserversChanged).onCall(true)
+ reset(activeObserversChanged)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ }
+
+ @Test
+ fun testRemoveDuringAddition() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ liveData.value = "bla"
+ liveData.observeForever(object : Observer<String> {
+ override fun onChanged(value: String) {
+ liveData.removeObserver(this)
+ }
+ })
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ val inOrder = inOrder(activeObserversChanged)
+ inOrder.verify(activeObserversChanged).onCall(true)
+ inOrder.verify(activeObserversChanged).onCall(false)
+ inOrder.verifyNoMoreInteractions()
+ }
+
+ @Test
+ fun testRemoveDuringBringingUpToState() {
+ liveData.value = "bla"
+ liveData.observeForever(object : Observer<String> {
+ override fun onChanged(value: String) {
+ liveData.removeObserver(this)
+ }
+ })
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_RESUME)
+ assertThat(liveData.hasActiveObservers(), `is`(false))
+ val inOrder = inOrder(activeObserversChanged)
+ inOrder.verify(activeObserversChanged).onCall(true)
+ inOrder.verify(activeObserversChanged).onCall(false)
+ inOrder.verifyNoMoreInteractions()
+ }
+
+ @Test
+ fun setValue_neverActive_observerOnChangedNotCalled() {
+ val observer = mock() as Observer<String>
+ liveData.observe(owner, observer)
+ liveData.value = "1"
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun setValue_twoObserversTwoStartedOwners_onChangedCalledOnBoth() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ owner2.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ liveData.value = "1"
+ verify(observer1).onChanged("1")
+ verify(observer2).onChanged("1")
+ }
+
+ @Test
+ fun setValue_twoObserversOneStartedOwner_onChangedCalledOnOneCorrectObserver() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ liveData.value = "1"
+ verify(observer1).onChanged("1")
+ verify(observer2, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun setValue_twoObserversBothStartedAfterSetValue_onChangedCalledOnBoth() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ liveData.value = "1"
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ owner2.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(observer1).onChanged("1")
+ verify(observer2).onChanged("1")
+ }
+
+ @Test
+ fun setValue_twoObserversOneStartedAfterSetValue_onChangedCalledOnCorrectObserver() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ liveData.value = "1"
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(observer1).onChanged("1")
+ verify(observer2, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun setValue_twoObserversOneStarted_liveDataBecomesActive() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ }
+
+ @Test
+ fun setValue_twoObserversOneStopped_liveDataStaysActive() {
+ val observer1 = mock() as Observer<in String>
+ val observer2 = mock() as Observer<in String>
+ liveData.observe(owner, observer1)
+ liveData.observe(owner2, observer2)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ owner2.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ verify(activeObserversChanged).onCall(true)
+ reset(activeObserversChanged)
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ }
+
+ @Test
+ fun setValue_lifecycleIsCreatedNoEvent_liveDataBecomesInactiveAndObserverNotCalled() {
+ // Arrange.
+ liveData.observe(owner3, observer3)
+ val lifecycleObserver = getLiveDataInternalObserver(lifecycle3)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver.onStateChanged(owner3, Lifecycle.Event.ON_START)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.CREATED)
+ reset(activeObserversChanged)
+ reset(observer3)
+
+ // Act.
+ liveData.value = "1"
+
+ // Assert.
+ verify(activeObserversChanged).onCall(false)
+ verify(observer3, never()).onChanged(anyString())
+ }
+
+ /*
+ * Arrange: LiveData was made inactive via SetValue (because the Lifecycle it was
+ * observing was in the CREATED state and no event was dispatched).
+ * Act: Lifecycle enters Started state and dispatches event.
+ * Assert: LiveData becomes active and dispatches new value to observer.
+ */
+ @Test
+ fun test_liveDataInactiveViaSetValueThenLifecycleResumes() {
+ // Arrange.
+ liveData.observe(owner3, observer3)
+ val lifecycleObserver = getLiveDataInternalObserver(lifecycle3)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver.onStateChanged(owner3, Lifecycle.Event.ON_START)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.CREATED)
+ liveData.value = "1"
+ reset(activeObserversChanged)
+ reset(observer3)
+
+ // Act.
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver.onStateChanged(owner3, Lifecycle.Event.ON_START)
+
+ // Assert.
+ verify(activeObserversChanged).onCall(true)
+ verify(observer3).onChanged("1")
+ }
+
+ /*
+ * Arrange: One of two Lifecycles enter the CREATED state without sending an event.
+ * Act: Lifecycle's setValue method is called with new value.
+ * Assert: LiveData stays active and new value is dispatched to Lifecycle that is still at least
+ * STARTED.
+ */
+ @Test
+ fun setValue_oneOfTwoLifecyclesAreCreatedNoEvent() {
+ // Arrange.
+ liveData.observe(owner3, observer3)
+ liveData.observe(owner4, observer4)
+ val lifecycleObserver3 = getLiveDataInternalObserver(lifecycle3)
+ val lifecycleObserver4 = getLiveDataInternalObserver(lifecycle4)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ `when`(lifecycle4.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver3.onStateChanged(owner3, Lifecycle.Event.ON_START)
+ lifecycleObserver4.onStateChanged(owner4, Lifecycle.Event.ON_START)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.CREATED)
+ reset(activeObserversChanged)
+ reset(observer3)
+ reset(observer4)
+
+ // Act.
+ liveData.value = "1"
+
+ // Assert.
+ verify(activeObserversChanged, never()).onCall(anyBoolean())
+ verify(observer3, never()).onChanged(anyString())
+ verify(observer4).onChanged("1")
+ }
+
+ /*
+ * Arrange: Two observed Lifecycles enter the CREATED state without sending an event.
+ * Act: Lifecycle's setValue method is called with new value.
+ * Assert: LiveData becomes inactive and nothing is dispatched to either observer.
+ */
+ @Test
+ fun setValue_twoLifecyclesAreCreatedNoEvent() {
+ // Arrange.
+ liveData.observe(owner3, observer3)
+ liveData.observe(owner4, observer4)
+ val lifecycleObserver3 = getLiveDataInternalObserver(lifecycle3)
+ val lifecycleObserver4 = getLiveDataInternalObserver(lifecycle4)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ `when`(lifecycle4.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver3.onStateChanged(owner3, Lifecycle.Event.ON_START)
+ lifecycleObserver4.onStateChanged(owner4, Lifecycle.Event.ON_START)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.CREATED)
+ `when`(lifecycle4.currentState).thenReturn(Lifecycle.State.CREATED)
+ reset(activeObserversChanged)
+ reset(observer3)
+ reset(observer4)
+
+ // Act.
+ liveData.value = "1"
+
+ // Assert.
+ verify(activeObserversChanged).onCall(false)
+ verify(observer3, never()).onChanged(anyString())
+ verify(observer3, never()).onChanged(anyString())
+ }
+
+ /*
+ * Arrange: LiveData was made inactive via SetValue (because both Lifecycles it was
+ * observing were in the CREATED state and no event was dispatched).
+ * Act: One Lifecycle enters STARTED state and dispatches lifecycle event.
+ * Assert: LiveData becomes active and dispatches new value to observer associated with started
+ * Lifecycle.
+ */
+ @Test
+ fun test_liveDataInactiveViaSetValueThenOneLifecycleResumes() {
+ // Arrange.
+ liveData.observe(owner3, observer3)
+ liveData.observe(owner4, observer4)
+ val lifecycleObserver3 = getLiveDataInternalObserver(lifecycle3)
+ val lifecycleObserver4 = getLiveDataInternalObserver(lifecycle4)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ `when`(lifecycle4.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver3.onStateChanged(owner3, Lifecycle.Event.ON_START)
+ lifecycleObserver4.onStateChanged(owner4, Lifecycle.Event.ON_START)
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.CREATED)
+ `when`(lifecycle4.currentState).thenReturn(Lifecycle.State.CREATED)
+ liveData.value = "1"
+ reset(activeObserversChanged)
+ reset(observer3)
+ reset(observer4)
+
+ // Act.
+ `when`(lifecycle3.currentState).thenReturn(Lifecycle.State.STARTED)
+ lifecycleObserver3.onStateChanged(owner3, Lifecycle.Event.ON_START)
+
+ // Assert.
+ verify(activeObserversChanged).onCall(true)
+ verify(observer3).onChanged("1")
+ verify(observer4, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun nestedForeverObserver() {
+ liveData.value = "."
+ liveData.observeForever(object : Observer<String> {
+ override fun onChanged(value: String) {
+ liveData.observeForever(
+ mock() as Observer<String>
+ )
+ liveData.removeObserver(this)
+ }
+ })
+ verify(activeObserversChanged, only()).onCall(true)
+ }
+
+ @Test
+ fun readForeverObserver() {
+ val observer = mock() as Observer<String>
+ liveData.observeForever(observer)
+ liveData.observeForever(observer)
+ liveData.removeObserver(observer)
+ assertThat(liveData.hasObservers(), `is`(false))
+ }
+
+ @Test
+ fun initialValue() {
+ val mutableLiveData = MutableLiveData("foo")
+ val observer = mock() as Observer<String>
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ mutableLiveData.observe(owner, observer)
+ verify(observer).onChanged("foo")
+ }
+
+ @Test
+ fun activeReentry_removeOnActive() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer: Observer<String> = Observer { }
+ val activeCalls: MutableList<Boolean> = ArrayList()
+ val liveData = object : MutableLiveData<String>("foo") {
+ override fun onActive() {
+ activeCalls.add(true)
+ super.onActive()
+ removeObserver(observer)
+ }
+
+ override fun onInactive() {
+ activeCalls.add(false)
+ super.onInactive()
+ }
+ }
+ liveData.observe(owner, observer)
+ assertThat<List<Boolean>>(
+ activeCalls,
+ equalTo(mutableListOf(true, false))
+ )
+ }
+
+ @Test
+ fun activeReentry_addOnInactive() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer1 = mock() as Observer<String>
+ val observer2 = mock() as Observer<String>
+ val activeCalls: MutableList<Boolean> = ArrayList()
+ val liveData = object : MutableLiveData<String>("foo") {
+ override fun onActive() {
+ activeCalls.add(true)
+ super.onActive()
+ }
+
+ override fun onInactive() {
+ activeCalls.add(false)
+ observe(owner, observer2)
+ super.onInactive()
+ }
+ }
+ liveData.observe(owner, observer1)
+ liveData.removeObserver(observer1)
+ liveData.removeObserver(observer2)
+ assertThat<List<Boolean>>(
+ activeCalls,
+ equalTo(mutableListOf(true, false, true, false, true))
+ )
+ }
+
+ @Test
+ fun activeReentry_lifecycleChangesActive() {
+ owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ val observer: Observer<String> =
+ Observer { owner.handleLifecycleEvent(Lifecycle.Event.ON_STOP) }
+ val activeCalls: MutableList<Boolean> = ArrayList()
+ val liveData = object : MutableLiveData<String>("foo") {
+ override fun onActive() {
+ activeCalls.add(true)
+ super.onActive()
+ }
+
+ override fun onInactive() {
+ activeCalls.add(false)
+ super.onInactive()
+ }
+ }
+ liveData.observe(owner, observer)
+ assertThat(owner.currentState, `is`(Lifecycle.State.CREATED))
+ assertThat<List<Boolean>>(
+ activeCalls,
+ `is`(mutableListOf(true, false))
+ )
+ }
+
+ private fun getLiveDataInternalObserver(lifecycle: Lifecycle?): LifecycleEventObserver {
+ val captor: KArgumentCaptor<LifecycleEventObserver> = argumentCaptor()
+ verify(lifecycle)?.addObserver(captor.capture())
+ return captor.firstValue
+ }
+
+ internal class PublicLiveData<T> : LiveData<T>() {
+ // cannot spy due to internal calls
+ var activeObserversChanged: MethodExec? = null
+ override fun onActive() {
+ if (activeObserversChanged != null) {
+ activeObserversChanged!!.onCall(true)
+ }
+ }
+
+ override fun onInactive() {
+ if (activeObserversChanged != null) {
+ activeObserversChanged!!.onCall(false)
+ }
+ }
+ }
+
+ private open inner class FailReentrantObserver<T> : Observer<T> {
+ override fun onChanged(value: T) {
+ assertThat(inObserver, `is`(false))
+ }
+ }
+
+ internal interface MethodExec {
+ fun onCall(value: Boolean)
+ }
+}
diff --git a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.java b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.java
deleted file mode 100644
index 15adaf5..0000000
--- a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_START;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.UnconfinedTestDispatcher;
-
-import androidx.annotation.Nullable;
-import androidx.arch.core.executor.JunitTaskExecutorRule;
-import androidx.arch.core.executor.TaskExecutor;
-import androidx.lifecycle.testing.TestLifecycleOwner;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(JUnit4.class)
-public class ThreadedLiveDataTest {
-
- private static final int TIMEOUT_SECS = 3;
-
- @Rule
- public JunitTaskExecutorRule mTaskExecutorRule = new JunitTaskExecutorRule(1, false);
-
- private LiveData<String> mLiveData;
- private TestLifecycleOwner mLifecycleOwner;
-
- @Before
- public void init() {
- mLiveData = new MutableLiveData<>();
- mLifecycleOwner = new TestLifecycleOwner(Lifecycle.State.INITIALIZED,
- UnconfinedTestDispatcher(null, null));
- }
-
- @Test
- public void testPostValue() throws InterruptedException {
- final TaskExecutor taskExecutor = mTaskExecutorRule.getTaskExecutor();
- final CountDownLatch finishTestLatch = new CountDownLatch(1);
- final Observer<String> observer = new Observer<String>() {
- @Override
- public void onChanged(@Nullable String newValue) {
- try {
- assertThat(taskExecutor.isMainThread(), is(true));
- assertThat(newValue, is("success"));
- } finally {
- finishTestLatch.countDown();
- }
- }
- };
- taskExecutor.executeOnMainThread(new Runnable() {
- @Override
- public void run() {
- mLifecycleOwner.handleLifecycleEvent(ON_START);
- mLiveData.observe(mLifecycleOwner, observer);
- final CountDownLatch latch = new CountDownLatch(1);
- taskExecutor.executeOnDiskIO(new Runnable() {
- @Override
- public void run() {
- mLiveData.postValue("fail");
- mLiveData.postValue("success");
- latch.countDown();
- }
- });
- try {
- assertThat(latch.await(TIMEOUT_SECS, TimeUnit.SECONDS), is(true));
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- });
- assertThat(finishTestLatch.await(TIMEOUT_SECS, TimeUnit.SECONDS), is(true));
- }
-}
diff --git a/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.kt b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.kt
new file mode 100644
index 0000000..f1e12f3
--- /dev/null
+++ b/lifecycle/lifecycle-livedata-core/src/test/java/androidx/lifecycle/ThreadedLiveDataTest.kt
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import androidx.arch.core.executor.JunitTaskExecutorRule
+import androidx.lifecycle.testing.TestLifecycleOwner
+import java.util.concurrent.CountDownLatch
+import java.util.concurrent.TimeUnit.SECONDS
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.UnconfinedTestDispatcher
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class ThreadedLiveDataTest {
+ @JvmField
+ @Rule
+ var taskExecutorRule = JunitTaskExecutorRule(1, false)
+
+ private lateinit var liveData: LiveData<String>
+ private lateinit var lifecycleOwner: TestLifecycleOwner
+
+ @OptIn(ExperimentalCoroutinesApi::class)
+ @Before
+ fun init() {
+ liveData = MutableLiveData()
+ lifecycleOwner = TestLifecycleOwner(
+ Lifecycle.State.INITIALIZED,
+ UnconfinedTestDispatcher(null, null)
+ )
+ }
+
+ @Test
+ @Throws(InterruptedException::class)
+ fun testPostValue() {
+ val taskExecutor = taskExecutorRule.taskExecutor
+ val finishTestLatch = CountDownLatch(1)
+ val observer = Observer<String?> { newValue ->
+ try {
+ assertThat(taskExecutor.isMainThread, `is`(true))
+ assertThat(newValue, `is`("success"))
+ } finally {
+ finishTestLatch.countDown()
+ }
+ }
+ taskExecutor.executeOnMainThread {
+ lifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_START)
+ liveData.observe(lifecycleOwner, observer)
+ val latch = CountDownLatch(1)
+ taskExecutor.executeOnDiskIO {
+ liveData.postValue("fail")
+ liveData.postValue("success")
+ latch.countDown()
+ }
+ try {
+ assertThat(
+ latch.await(TIMEOUT_SECS.toLong(), SECONDS),
+ `is`(true)
+ )
+ } catch (e: InterruptedException) {
+ throw RuntimeException(e)
+ }
+ }
+ assertThat(
+ finishTestLatch.await(TIMEOUT_SECS.toLong(), SECONDS),
+ `is`(true)
+ )
+ }
+
+ companion object {
+ private const val TIMEOUT_SECS = 3
+ }
+}
diff --git a/lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt b/lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
index fd50175..3b05ffd 100644
--- a/lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
+++ b/lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
@@ -156,4 +156,4 @@
public fun <T> Flow<T>.asLiveData(
context: CoroutineContext = EmptyCoroutineContext,
timeout: Duration
-): LiveData<T> = asLiveData(context, Api26Impl.toMillis(timeout))
\ No newline at end of file
+): LiveData<T> = asLiveData(context, Api26Impl.toMillis(timeout))
diff --git a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt
index ddc32ed..fbb5f3d 100644
--- a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt
+++ b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt
@@ -459,4 +459,4 @@
}
private fun <T> LiveData<T>.addObserver() = this.addObserver(scopes)
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/FlowAsLiveDataTest.kt b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/FlowAsLiveDataTest.kt
index 0f349a6..c1e21b0 100644
--- a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/FlowAsLiveDataTest.kt
+++ b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/FlowAsLiveDataTest.kt
@@ -231,4 +231,4 @@
// re-observe, get latest value only
ld.addObserver().assertItems(4)
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt
index ab075f6..5bbe0b0 100644
--- a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt
+++ b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt
@@ -134,4 +134,4 @@
assertThat(ld.hasActiveObservers()).isFalse()
assertThat(jobB.isCompleted).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/ScopesRule.kt b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/ScopesRule.kt
index d1193af..63cd8a1 100644
--- a/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/ScopesRule.kt
+++ b/lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/ScopesRule.kt
@@ -115,4 +115,4 @@
fun unsubscribe() = scopes.runOnMain {
liveData.removeObserver(this)
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.kt b/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.kt
index e2f291c..cccfd22 100644
--- a/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.kt
+++ b/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/ComputableLiveData.kt
@@ -114,4 +114,4 @@
// TODO https://issuetracker.google.com/issues/112197238
@WorkerThread
protected abstract fun compute(): T
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/Transformations.kt b/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/Transformations.kt
index c3b9ed6..c8f3cc7 100644
--- a/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/Transformations.kt
+++ b/lifecycle/lifecycle-livedata/src/main/java/androidx/lifecycle/Transformations.kt
@@ -193,4 +193,4 @@
}
}
return outputLiveData
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/ComputableLiveDataTest.kt b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/ComputableLiveDataTest.kt
index 1b5c5d4..d54cd4a 100644
--- a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/ComputableLiveDataTest.kt
+++ b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/ComputableLiveDataTest.kt
@@ -218,4 +218,4 @@
return values[valueCounter.getAndIncrement()]
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/MediatorLiveDataTest.kt b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/MediatorLiveDataTest.kt
index a312148..0d7aa94 100644
--- a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/MediatorLiveDataTest.kt
+++ b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/MediatorLiveDataTest.kt
@@ -251,4 +251,4 @@
owner.handleLifecycleEvent(Lifecycle.Event.ON_START)
assertThat(mediator.value, `is`("c"))
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.java b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.java
deleted file mode 100644
index d7f3527..0000000
--- a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.only;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.verify;
-
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.UnconfinedTestDispatcher;
-
-import androidx.annotation.Nullable;
-import androidx.arch.core.executor.ArchTaskExecutor;
-import androidx.lifecycle.testing.TestLifecycleOwner;
-import androidx.lifecycle.util.InstantTaskExecutor;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@SuppressWarnings("unchecked")
-@RunWith(JUnit4.class)
-public class TransformationsTest {
-
- private TestLifecycleOwner mOwner;
-
- @Before
- public void swapExecutorDelegate() {
- ArchTaskExecutor.getInstance().setDelegate(new InstantTaskExecutor());
- }
-
- @Before
- public void setup() {
- mOwner = new TestLifecycleOwner(Lifecycle.State.STARTED,
- UnconfinedTestDispatcher(null, null));
- }
-
- @Test
- public void testMap() {
- LiveData<String> source = new MutableLiveData<>();
- LiveData<Integer> mapped = Transformations.map(source, String::length);
- Observer<Integer> observer = mock(Observer.class);
- mapped.observe(mOwner, observer);
- source.setValue("four");
- verify(observer).onChanged(4);
- }
-
- @Test
- public void testSwitchMap() {
- LiveData<Integer> trigger = new MutableLiveData<>();
- final LiveData<String> first = new MutableLiveData<>();
- final LiveData<String> second = new MutableLiveData<>();
- LiveData<String> result = Transformations.switchMap(
- trigger,
- (Integer input) -> {
- if (input == 1) {
- return first;
- } else {
- return second;
- }
- });
-
- Observer<String> observer = mock(Observer.class);
- result.observe(mOwner, observer);
- verify(observer, never()).onChanged(anyString());
- first.setValue("first");
- trigger.setValue(1);
- verify(observer).onChanged("first");
- second.setValue("second");
- reset(observer);
- verify(observer, never()).onChanged(anyString());
- trigger.setValue(2);
- verify(observer).onChanged("second");
- reset(observer);
- first.setValue("failure");
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void testSwitchMap2() {
- LiveData<Integer> trigger = new MutableLiveData<>();
- final LiveData<String> first = new MutableLiveData<>();
- final LiveData<String> second = new MutableLiveData<>();
- LiveData<String> result = Transformations.switchMap(
- trigger,
- (Integer input) -> {
- if (input == 1) {
- return first;
- } else {
- return second;
- }
- });
-
- Observer<String> observer = mock(Observer.class);
- result.observe(mOwner, observer);
-
- verify(observer, never()).onChanged(anyString());
- trigger.setValue(1);
- verify(observer, never()).onChanged(anyString());
- first.setValue("fi");
- verify(observer).onChanged("fi");
- first.setValue("rst");
- verify(observer).onChanged("rst");
-
- second.setValue("second");
- reset(observer);
- verify(observer, never()).onChanged(anyString());
- trigger.setValue(2);
- verify(observer).onChanged("second");
- reset(observer);
- first.setValue("failure");
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void testNoRedispatchSwitchMap() {
- LiveData<Integer> trigger = new MutableLiveData<>();
- final LiveData<String> first = new MutableLiveData<>();
- LiveData<String> result = Transformations.switchMap(trigger, (Integer input) -> first);
-
- Observer<String> observer = mock(Observer.class);
- result.observe(mOwner, observer);
- verify(observer, never()).onChanged(anyString());
- first.setValue("first");
- trigger.setValue(1);
- verify(observer).onChanged("first");
- reset(observer);
- trigger.setValue(2);
- verify(observer, never()).onChanged(anyString());
- }
-
- @Test
- public void testSwitchMapToNull() {
- LiveData<Integer> trigger = new MutableLiveData<>();
- final LiveData<String> first = new MutableLiveData<>();
- LiveData<String> result = Transformations.switchMap(
- trigger,
- (Integer input) -> {
- if (input == 1) {
- return first;
- } else {
- return null;
- }
- });
-
- Observer<String> observer = mock(Observer.class);
- result.observe(mOwner, observer);
- verify(observer, never()).onChanged(anyString());
- first.setValue("first");
- trigger.setValue(1);
- verify(observer).onChanged("first");
- reset(observer);
-
- trigger.setValue(2);
- verify(observer, never()).onChanged(anyString());
- assertThat(first.hasObservers(), is(false));
- }
-
- @Test
- public void noObsoleteValueTest() {
- MutableLiveData<Integer> numbers = new MutableLiveData<>();
- LiveData<Integer> squared = Transformations.map(numbers, (Integer input) -> input * input);
-
- Observer observer = mock(Observer.class);
- squared.setValue(1);
- squared.observeForever(observer);
- verify(observer).onChanged(1);
- squared.removeObserver(observer);
- reset(observer);
- numbers.setValue(2);
- squared.observeForever(observer);
- verify(observer, only()).onChanged(4);
- }
-
- @Test
- public void testDistinctUntilChanged_initialValueIsSet() {
- MutableLiveData<String> originalLiveData = new MutableLiveData<>("value");
-
- LiveData<String> dedupedLiveData = Transformations.distinctUntilChanged(originalLiveData);
- assertThat(dedupedLiveData.getValue(), is("value"));
-
- CountingObserver<String> observer = new CountingObserver<>();
- dedupedLiveData.observe(mOwner, observer);
- assertThat(observer.mTimesUpdated, is(1));
- assertThat(dedupedLiveData.getValue(), is("value"));
- }
-
- @Test
- public void testDistinctUntilChanged_triggersOnInitialNullValue() {
- MutableLiveData<String> originalLiveData = new MutableLiveData<>();
- originalLiveData.setValue(null);
-
- LiveData<String> dedupedLiveData = Transformations.distinctUntilChanged(originalLiveData);
- assertThat(dedupedLiveData.getValue(), is(nullValue()));
-
- CountingObserver<String> observer = new CountingObserver<>();
- dedupedLiveData.observe(mOwner, observer);
- assertThat(observer.mTimesUpdated, is(1));
- assertThat(dedupedLiveData.getValue(), is(nullValue()));
- }
-
- @Test
- public void testDistinctUntilChanged_dedupesValues() {
- MutableLiveData<String> originalLiveData = new MutableLiveData<>();
- LiveData<String> dedupedLiveData = Transformations.distinctUntilChanged(originalLiveData);
- assertThat(dedupedLiveData.getValue(), is(nullValue()));
-
- CountingObserver<String> observer = new CountingObserver<>();
- dedupedLiveData.observe(mOwner, observer);
- assertThat(observer.mTimesUpdated, is(0));
-
- String value = "new value";
- originalLiveData.setValue(value);
- assertThat(dedupedLiveData.getValue(), is(value));
- assertThat(observer.mTimesUpdated, is(1));
-
- originalLiveData.setValue(value);
- assertThat(dedupedLiveData.getValue(), is(value));
- assertThat(observer.mTimesUpdated, is(1));
-
- String newerValue = "newer value";
- originalLiveData.setValue(newerValue);
- assertThat(dedupedLiveData.getValue(), is(newerValue));
- assertThat(observer.mTimesUpdated, is(2));
-
- dedupedLiveData.removeObservers(mOwner);
- }
-
- private static class CountingObserver<T> implements Observer<T> {
-
- int mTimesUpdated;
-
- @Override
- public void onChanged(@Nullable T value) {
- ++mTimesUpdated;
- }
- }
-}
diff --git a/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.kt b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.kt
new file mode 100644
index 0000000..737abdb
--- /dev/null
+++ b/lifecycle/lifecycle-livedata/src/test/java/androidx/lifecycle/TransformationsTest.kt
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import androidx.arch.core.executor.ArchTaskExecutor.getInstance
+import androidx.lifecycle.testing.TestLifecycleOwner
+import androidx.lifecycle.util.InstantTaskExecutor
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.UnconfinedTestDispatcher
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.CoreMatchers.nullValue
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.mockito.ArgumentMatchers.anyString
+import org.mockito.Mockito.mock
+import org.mockito.Mockito.never
+import org.mockito.Mockito.only
+import org.mockito.Mockito.reset
+import org.mockito.Mockito.verify
+
+@Suppress("unchecked_cast")
+@RunWith(JUnit4::class)
+class TransformationsTest {
+ private lateinit var owner: TestLifecycleOwner
+
+ @Before
+ fun swapExecutorDelegate() {
+ getInstance().setDelegate(InstantTaskExecutor())
+ }
+
+ @OptIn(ExperimentalCoroutinesApi::class)
+ @Before
+ fun setup() {
+ owner = TestLifecycleOwner(
+ Lifecycle.State.STARTED,
+ UnconfinedTestDispatcher(null, null)
+ )
+ }
+
+ @Test
+ fun testMap() {
+ val source: LiveData<String> = MutableLiveData()
+ val mapped = source.map(String::length)
+ val observer = mock(Observer::class.java) as Observer<Int>
+ mapped.observe(owner, observer)
+ source.value = "four"
+ verify(observer).onChanged(4)
+ }
+
+ @Test
+ fun testSwitchMap() {
+ val trigger: LiveData<Int> = MutableLiveData()
+ val first: LiveData<String> = MutableLiveData()
+ val second: LiveData<String> = MutableLiveData()
+ val result = trigger.switchMap { input ->
+ if (input == 1) {
+ first
+ } else {
+ second
+ }
+ }
+ val observer = mock(Observer::class.java) as Observer<String>
+ result.observe(owner, observer)
+ verify(observer, never()).onChanged(anyString())
+ first.value = "first"
+ trigger.value = 1
+ verify(observer).onChanged("first")
+ second.value = "second"
+ reset(observer)
+ verify(observer, never()).onChanged(anyString())
+ trigger.value = 2
+ verify(observer).onChanged("second")
+ reset(observer)
+ first.value = "failure"
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun testSwitchMap2() {
+ val trigger: LiveData<Int> = MutableLiveData()
+ val first: LiveData<String> = MutableLiveData()
+ val second: LiveData<String> = MutableLiveData()
+ val result = trigger.switchMap { input: Int ->
+ if (input == 1) {
+ first
+ } else {
+ second
+ }
+ }
+ val observer = mock(Observer::class.java) as Observer<String>
+ result.observe(owner, observer)
+ verify(observer, never()).onChanged(anyString())
+ trigger.value = 1
+ verify(observer, never()).onChanged(anyString())
+ first.value = "fi"
+ verify(observer).onChanged("fi")
+ first.value = "rst"
+ verify(observer).onChanged("rst")
+ second.value = "second"
+ reset(observer)
+ verify(observer, never()).onChanged(anyString())
+ trigger.value = 2
+ verify(observer).onChanged("second")
+ reset(observer)
+ first.value = "failure"
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun testNoRedispatchSwitchMap() {
+ val trigger: LiveData<Int> = MutableLiveData()
+ val first: LiveData<String> = MutableLiveData()
+ val result = trigger.switchMap { first }
+ val observer = mock(Observer::class.java) as Observer<String>
+ result.observe(owner, observer)
+ verify(observer, never()).onChanged(anyString())
+ first.value = "first"
+ trigger.value = 1
+ verify(observer).onChanged("first")
+ reset(observer)
+ trigger.value = 2
+ verify(observer, never()).onChanged(anyString())
+ }
+
+ @Test
+ fun testSwitchMapToNull() {
+ val trigger: LiveData<Int> = MutableLiveData()
+ val first: LiveData<String> = MutableLiveData()
+ val result = trigger.switchMap { input: Int ->
+ if (input == 1) {
+ first
+ } else {
+ null
+ }
+ }
+ val observer = mock(Observer::class.java) as Observer<String>
+ result.observe(owner, observer)
+ verify(observer, never()).onChanged(anyString())
+ first.value = "first"
+ trigger.value = 1
+ verify(observer).onChanged("first")
+ reset(observer)
+ trigger.value = 2
+ verify(observer, never()).onChanged(anyString())
+ assertThat(first.hasObservers(), `is`(false))
+ }
+
+ @Test
+ fun noObsoleteValueTest() {
+ val numbers = MutableLiveData<Int>()
+ val squared = numbers.map { input: Int -> input * input }
+ val observer = mock(Observer::class.java) as Observer<Int>
+ squared.value = 1
+ squared.observeForever(observer)
+ verify(observer).onChanged(1)
+ squared.removeObserver(observer)
+ reset(observer)
+ numbers.value = 2
+ squared.observeForever(observer)
+ verify(observer, only()).onChanged(4)
+ }
+
+ @Test
+ fun testDistinctUntilChanged_initialValueIsSet() {
+ val originalLiveData = MutableLiveData("value")
+ val newLiveData = originalLiveData.distinctUntilChanged()
+ assertThat(newLiveData.value, `is`("value"))
+ val observer = CountingObserver<String>()
+ newLiveData.observe(owner, observer)
+ assertThat(observer.timesUpdated, `is`(1))
+ assertThat(newLiveData.value, `is`("value"))
+ }
+
+ @Test
+ fun testDistinctUntilChanged_triggersOnInitialNullValue() {
+ val originalLiveData = MutableLiveData<String?>()
+ originalLiveData.value = null
+ val newLiveData = originalLiveData.distinctUntilChanged()
+ assertThat(newLiveData.value, `is`(nullValue()))
+ val observer = CountingObserver<String?>()
+ newLiveData.observe(owner, observer)
+ assertThat(observer.timesUpdated, `is`(1))
+ assertThat(newLiveData.value, `is`(nullValue()))
+ }
+
+ @Test
+ fun testDistinctUntilChanged_copiesValues() {
+ val originalLiveData = MutableLiveData<String>()
+ val newLiveData = originalLiveData.distinctUntilChanged()
+ assertThat(newLiveData.value, `is`(nullValue()))
+ val observer = CountingObserver<String>()
+ newLiveData.observe(owner, observer)
+ assertThat(observer.timesUpdated, `is`(0))
+ val value = "new value"
+ originalLiveData.value = value
+ assertThat(newLiveData.value, `is`(value))
+ assertThat(observer.timesUpdated, `is`(1))
+ originalLiveData.value = value
+ assertThat(newLiveData.value, `is`(value))
+ assertThat(observer.timesUpdated, `is`(1))
+ val newerValue = "newer value"
+ originalLiveData.value = newerValue
+ assertThat(newLiveData.value, `is`(newerValue))
+ assertThat(observer.timesUpdated, `is`(2))
+ newLiveData.removeObservers(owner)
+ }
+
+ private class CountingObserver<T> : Observer<T> {
+ var timesUpdated = 0
+ override fun onChanged(value: T) {
+ ++timesUpdated
+ }
+ }
+}
diff --git a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/EmptyActivityLifecycleCallbacks.kt b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/EmptyActivityLifecycleCallbacks.kt
index d1c66d9..f04af00 100644
--- a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/EmptyActivityLifecycleCallbacks.kt
+++ b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/EmptyActivityLifecycleCallbacks.kt
@@ -34,4 +34,4 @@
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
override fun onActivityDestroyed(activity: Activity) {}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/LifecycleDispatcher.kt b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/LifecycleDispatcher.kt
index 5a4ef24..5d21640 100644
--- a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/LifecycleDispatcher.kt
+++ b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/LifecycleDispatcher.kt
@@ -47,4 +47,4 @@
ReportFragment.injectIfNeededIn(activity)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleInitializer.kt b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleInitializer.kt
index 9e5d369..fe72469 100644
--- a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleInitializer.kt
+++ b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleInitializer.kt
@@ -39,4 +39,4 @@
}
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleOwner.kt b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleOwner.kt
index f29e9e4..6003da1 100644
--- a/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleOwner.kt
+++ b/lifecycle/lifecycle-process/src/main/java/androidx/lifecycle/ProcessLifecycleOwner.kt
@@ -199,4 +199,4 @@
activity.registerActivityLifecycleCallbacks(callback)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.java b/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.java
deleted file mode 100644
index 50c86f1..0000000
--- a/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.os.Bundle;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class DispatcherActivityCallbackTest {
- @Test
- public void onCreateFrameworkActivity() {
- LifecycleDispatcher.DispatcherActivityCallback callback =
- new LifecycleDispatcher.DispatcherActivityCallback();
- Activity activity = mock(Activity.class);
- checkReportFragment(callback, activity);
- }
-
- @SuppressWarnings("deprecation")
- @SuppressLint("CommitTransaction")
- private void checkReportFragment(LifecycleDispatcher.DispatcherActivityCallback callback,
- Activity activity) {
- android.app.FragmentManager fm = mock(android.app.FragmentManager.class);
- android.app.FragmentTransaction transaction = mock(android.app.FragmentTransaction.class);
- when(activity.getFragmentManager()).thenReturn(fm);
- when(fm.beginTransaction()).thenReturn(transaction);
- when(transaction.add(any(android.app.Fragment.class), anyString())).thenReturn(transaction);
- callback.onActivityCreated(activity, mock(Bundle.class));
- verify(activity).getFragmentManager();
- verify(fm).beginTransaction();
- verify(transaction).add(any(ReportFragment.class), anyString());
- verify(transaction).commit();
- }
-}
diff --git a/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.kt b/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.kt
new file mode 100644
index 0000000..5f0c0ee
--- /dev/null
+++ b/lifecycle/lifecycle-process/src/test/java/androidx/lifecycle/DispatcherActivityCallbackTest.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+@file:Suppress("DEPRECATION")
+
+package androidx.lifecycle
+
+import android.annotation.SuppressLint
+import android.app.Activity
+import android.app.Fragment
+import android.app.FragmentManager
+import android.app.FragmentTransaction
+import android.os.Bundle
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.mockito.ArgumentMatchers.any
+import org.mockito.ArgumentMatchers.anyString
+import org.mockito.Mockito.mock
+import org.mockito.Mockito.verify
+import org.mockito.Mockito.`when`
+
+@RunWith(JUnit4::class)
+class DispatcherActivityCallbackTest {
+
+ @Test
+ fun onCreateFrameworkActivity() {
+ val callback = LifecycleDispatcher.DispatcherActivityCallback()
+ val activity = mock(Activity::class.java)
+ checkReportFragment(callback, activity)
+ }
+
+ @Suppress("deprecation")
+ @SuppressLint("CommitTransaction")
+ private fun checkReportFragment(
+ callback: LifecycleDispatcher.DispatcherActivityCallback,
+ activity: Activity
+ ) {
+ val fm = mock(FragmentManager::class.java)
+ val transaction = mock(FragmentTransaction::class.java)
+ `when`(activity.fragmentManager).thenReturn(fm)
+ `when`(fm.beginTransaction()).thenReturn(transaction)
+ `when`(transaction.add(any(Fragment::class.java), anyString()))
+ .thenReturn(transaction)
+ callback.onActivityCreated(activity, mock(Bundle::class.java))
+ verify(activity).fragmentManager
+ verify(fm).beginTransaction()
+ verify(transaction).add(any(ReportFragment::class.java), anyString())
+ verify(transaction).commit()
+ }
+}
diff --git a/lifecycle/lifecycle-reactivestreams/src/main/java/androidx/lifecycle/LiveDataReactiveStreams.kt b/lifecycle/lifecycle-reactivestreams/src/main/java/androidx/lifecycle/LiveDataReactiveStreams.kt
index 5f09eb2..2489ec8 100644
--- a/lifecycle/lifecycle-reactivestreams/src/main/java/androidx/lifecycle/LiveDataReactiveStreams.kt
+++ b/lifecycle/lifecycle-reactivestreams/src/main/java/androidx/lifecycle/LiveDataReactiveStreams.kt
@@ -240,4 +240,4 @@
s?.cancel()
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsExtensionTest.kt b/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsExtensionTest.kt
index 022d9d6..b93603d 100644
--- a/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsExtensionTest.kt
+++ b/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsExtensionTest.kt
@@ -67,4 +67,4 @@
assertThat(outputProcessor.values).asList().containsExactly("foo", "bar", "baz")
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.java b/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.java
deleted file mode 100644
index f165329..0000000
--- a/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import static kotlinx.coroutines.test.TestCoroutineDispatchersKt.UnconfinedTestDispatcher;
-
-import androidx.annotation.Nullable;
-import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
-import androidx.lifecycle.testing.TestLifecycleOwner;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.reactivestreams.Subscriber;
-import org.reactivestreams.Subscription;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import io.reactivex.Flowable;
-import io.reactivex.disposables.Disposable;
-import io.reactivex.functions.Consumer;
-import io.reactivex.processors.PublishProcessor;
-import io.reactivex.processors.ReplayProcessor;
-import io.reactivex.schedulers.TestScheduler;
-import io.reactivex.subjects.AsyncSubject;
-
-public class LiveDataReactiveStreamsTest {
- @Rule public final TestRule instantTaskExecutorRule = new InstantTaskExecutorRule();
-
- private TestLifecycleOwner mLifecycleOwner;
-
- private final List<String> mLiveDataOutput = new ArrayList<>();
- private final Observer<String> mObserver = new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- mLiveDataOutput.add(s);
- }
- };
-
- private final ReplayProcessor<String> mOutputProcessor = ReplayProcessor.create();
-
- private static final TestScheduler sBackgroundScheduler = new TestScheduler();
-
- @Before
- public void init() {
- mLifecycleOwner = new TestLifecycleOwner(Lifecycle.State.RESUMED,
- UnconfinedTestDispatcher(null, null));
- }
-
- @Test
- public void convertsFromPublisher() {
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- processor.onNext("foo");
- processor.onNext("bar");
- processor.onNext("baz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "bar", "baz")));
- }
-
- @Test
- public void convertsFromPublisherSubscribeWithDelay() {
- PublishProcessor<String> processor = PublishProcessor.create();
- processor.delaySubscription(100, TimeUnit.SECONDS, sBackgroundScheduler);
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- processor.onNext("foo");
- liveData.removeObserver(mObserver);
- sBackgroundScheduler.triggerActions();
- liveData.observe(mLifecycleOwner, mObserver);
-
- processor.onNext("bar");
- processor.onNext("baz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "foo", "bar", "baz")));
- }
-
- @Test
- public void convertsFromPublisherThrowsException() {
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- IllegalStateException exception = new IllegalStateException("test exception");
- try {
- processor.onError(exception);
- fail("Runtime Exception expected");
- } catch (RuntimeException ex) {
- assertEquals(ex.getCause(), exception);
- }
- }
-
- @Test
- public void convertsFromPublisherWithMultipleObservers() {
- final List<String> output2 = new ArrayList<>();
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- processor.onNext("foo");
- processor.onNext("bar");
-
- // The second observer should only get the newest value and any later values.
- liveData.observe(mLifecycleOwner, new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- output2.add(s);
- }
- });
-
- processor.onNext("baz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "bar", "baz")));
- assertThat(output2, is(Arrays.asList("bar", "baz")));
- }
-
- @Test
- public void convertsFromPublisherWithMultipleObserversAfterInactive() {
- final List<String> output2 = new ArrayList<>();
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- processor.onNext("foo");
- processor.onNext("bar");
-
- // The second observer should only get the newest value and any later values.
- liveData.observe(mLifecycleOwner, new Observer<String>() {
- @Override
- public void onChanged(@Nullable String s) {
- output2.add(s);
- }
- });
-
- liveData.removeObserver(mObserver);
- processor.onNext("baz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "bar")));
- assertThat(output2, is(Arrays.asList("bar", "baz")));
- }
-
- @Test
- public void convertsFromPublisherAfterInactive() {
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- liveData.observe(mLifecycleOwner, mObserver);
- processor.onNext("foo");
- liveData.removeObserver(mObserver);
- processor.onNext("bar");
-
- liveData.observe(mLifecycleOwner, mObserver);
- processor.onNext("baz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "foo", "baz")));
- }
-
- @Test
- public void convertsFromPublisherManagesSubscriptions() {
- PublishProcessor<String> processor = PublishProcessor.create();
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(processor);
-
- assertThat(processor.hasSubscribers(), is(false));
- liveData.observe(mLifecycleOwner, mObserver);
-
- // once the live data is active, there's a subscriber
- assertThat(processor.hasSubscribers(), is(true));
-
- liveData.removeObserver(mObserver);
- // once the live data is inactive, the subscriber is removed
- assertThat(processor.hasSubscribers(), is(false));
- }
-
- @Test
- public void convertsFromAsyncPublisher() {
- Flowable<String> input = Flowable.just("foo")
- .concatWith(Flowable.just("bar", "baz").observeOn(sBackgroundScheduler));
- LiveData<String> liveData = LiveDataReactiveStreams.fromPublisher(input);
-
- liveData.observe(mLifecycleOwner, mObserver);
-
- assertThat(mLiveDataOutput, is(Collections.singletonList("foo")));
- sBackgroundScheduler.triggerActions();
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "bar", "baz")));
- }
-
- @Test
- public void convertsToPublisherWithSyncData() {
- MutableLiveData<String> liveData = new MutableLiveData<>();
- liveData.setValue("foo");
- assertThat(liveData.getValue(), is("foo"));
-
- Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(mLifecycleOwner, liveData))
- .subscribe(mOutputProcessor);
-
- liveData.setValue("bar");
- liveData.setValue("baz");
-
- assertThat(
- mOutputProcessor.getValues(new String[]{}),
- is(new String[]{"foo", "bar", "baz"}));
- }
-
- @Test
- public void convertingToPublisherIsCancelable() {
- MutableLiveData<String> liveData = new MutableLiveData<>();
- liveData.setValue("foo");
- assertThat(liveData.getValue(), is("foo"));
-
- Disposable disposable = Flowable
- .fromPublisher(LiveDataReactiveStreams.toPublisher(mLifecycleOwner, liveData))
- .subscribe(new Consumer<String>() {
- @Override
- public void accept(String s) throws Exception {
- mLiveDataOutput.add(s);
- }
- });
-
- liveData.setValue("bar");
- liveData.setValue("baz");
-
- assertThat(liveData.hasObservers(), is(true));
- disposable.dispose();
-
- liveData.setValue("fizz");
- liveData.setValue("buzz");
-
- assertThat(mLiveDataOutput, is(Arrays.asList("foo", "bar", "baz")));
- // Canceling disposable should also remove livedata mObserver.
- assertThat(liveData.hasObservers(), is(false));
- }
-
- @Test
- public void convertsToPublisherWithBackpressure() {
- MutableLiveData<String> liveData = new MutableLiveData<>();
-
- final AsyncSubject<Subscription> subscriptionSubject = AsyncSubject.create();
-
- Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(mLifecycleOwner, liveData))
- .subscribe(new Subscriber<String>() {
- @Override
- public void onSubscribe(Subscription s) {
- subscriptionSubject.onNext(s);
- subscriptionSubject.onComplete();
- }
-
- @Override
- public void onNext(String s) {
- mOutputProcessor.onNext(s);
- }
-
- @Override
- public void onError(Throwable t) {
- throw new RuntimeException(t);
- }
-
- @Override
- public void onComplete() {
- }
- });
-
- // Subscription should have happened synchronously. If it didn't, this will deadlock.
- final Subscription subscription = subscriptionSubject.blockingSingle();
-
- subscription.request(1);
- assertThat(mOutputProcessor.getValues(new String[]{}), is(new String[]{}));
-
- liveData.setValue("foo");
- assertThat(mOutputProcessor.getValues(new String[]{}), is(new String[]{"foo"}));
-
- subscription.request(2);
- liveData.setValue("baz");
- liveData.setValue("fizz");
-
- assertThat(
- mOutputProcessor.getValues(new String[]{}),
- is(new String[]{"foo", "baz", "fizz"}));
-
- // 'nyan' will be dropped as there is nothing currently requesting a stream.
- liveData.setValue("nyan");
- liveData.setValue("cat");
-
- assertThat(
- mOutputProcessor.getValues(new String[]{}),
- is(new String[]{"foo", "baz", "fizz"}));
-
- // When a new request comes in, the latest value will be pushed.
- subscription.request(1);
- assertThat(
- mOutputProcessor.getValues(new String[]{}),
- is(new String[]{"foo", "baz", "fizz", "cat"}));
- }
-
- @Test
- public void convertsToPublisherWithAsyncData() {
- MutableLiveData<String> liveData = new MutableLiveData<>();
-
- Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(mLifecycleOwner, liveData))
- .observeOn(sBackgroundScheduler)
- .subscribe(mOutputProcessor);
-
- liveData.setValue("foo");
-
- assertThat(mOutputProcessor.getValues(new String[]{}), is(new String[]{}));
- sBackgroundScheduler.triggerActions();
- assertThat(mOutputProcessor.getValues(new String[]{}), is(new String[]{"foo"}));
-
- liveData.setValue("bar");
- liveData.setValue("baz");
-
- assertThat(mOutputProcessor.getValues(new String[]{}), is(new String[]{"foo"}));
- sBackgroundScheduler.triggerActions();
- assertThat(mOutputProcessor.getValues(
- new String[]{}),
- is(new String[]{"foo", "bar", "baz"}));
- }
-}
diff --git a/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.kt b/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.kt
new file mode 100644
index 0000000..3256a99
--- /dev/null
+++ b/lifecycle/lifecycle-reactivestreams/src/test/java/androidx/lifecycle/LiveDataReactiveStreamsTest.kt
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import androidx.arch.core.executor.testing.InstantTaskExecutorRule
+import androidx.lifecycle.testing.TestLifecycleOwner
+import io.reactivex.Flowable.fromPublisher
+import io.reactivex.Flowable.just
+import io.reactivex.processors.PublishProcessor.create
+import io.reactivex.processors.ReplayProcessor
+import io.reactivex.schedulers.TestScheduler
+import io.reactivex.subjects.AsyncSubject
+import java.util.concurrent.TimeUnit.SECONDS
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.test.UnconfinedTestDispatcher
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Assert.assertEquals
+import org.junit.Assert.fail
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.TestRule
+import org.reactivestreams.Subscriber
+import org.reactivestreams.Subscription
+
+class LiveDataReactiveStreamsTest {
+
+ @JvmField
+ @Rule
+ val instantTaskExecutorRule: TestRule = InstantTaskExecutorRule()
+
+ private lateinit var lifecycleOwner: TestLifecycleOwner
+ private val liveDataOutput = ArrayList<String>()
+ private val observer = Observer<String> { s -> liveDataOutput.add(s) }
+ private val outputProcessor = ReplayProcessor.create<String>()
+
+ @OptIn(ExperimentalCoroutinesApi::class)
+ @Before
+ fun init() {
+ lifecycleOwner = TestLifecycleOwner(
+ Lifecycle.State.RESUMED,
+ UnconfinedTestDispatcher(null, null)
+ )
+ }
+
+ @Test
+ fun convertsFromPublisher() {
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("foo")
+ processor.onNext("bar")
+ processor.onNext("baz")
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "bar", "baz")))
+ }
+
+ @Test
+ fun convertsFromPublisherSubscribeWithDelay() {
+ val processor = create<String>()
+ processor.delaySubscription(100, SECONDS, backgroundScheduler)
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("foo")
+ liveData.removeObserver(observer)
+ backgroundScheduler.triggerActions()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("bar")
+ processor.onNext("baz")
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "foo", "bar", "baz")))
+ }
+
+ @Test
+ fun convertsFromPublisherThrowsException() {
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ val exception = IllegalStateException("test exception")
+ try {
+ processor.onError(exception)
+ fail("Runtime Exception expected")
+ } catch (ex: RuntimeException) {
+ assertEquals(ex.cause, exception)
+ }
+ }
+
+ @Test
+ fun convertsFromPublisherWithMultipleObservers() {
+ val output2 = ArrayList<String>()
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("foo")
+ processor.onNext("bar")
+
+ // The second observer should only get the newest value and any later values.
+ liveData.observe(lifecycleOwner) { s -> output2.add(s) }
+ processor.onNext("baz")
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "bar", "baz")))
+ assertThat(output2, `is`(mutableListOf("bar", "baz")))
+ }
+
+ @Test
+ fun convertsFromPublisherWithMultipleObserversAfterInactive() {
+ val output2 = ArrayList<String>()
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("foo")
+ processor.onNext("bar")
+
+ // The second observer should only get the newest value and any later values.
+ liveData.observe(lifecycleOwner) { s -> output2.add(s) }
+ liveData.removeObserver(observer)
+ processor.onNext("baz")
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "bar")))
+ assertThat(output2, `is`(mutableListOf("bar", "baz")))
+ }
+
+ @Test
+ fun convertsFromPublisherAfterInactive() {
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("foo")
+ liveData.removeObserver(observer)
+ processor.onNext("bar")
+ liveData.observe(lifecycleOwner, observer)
+ processor.onNext("baz")
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "foo", "baz")))
+ }
+
+ @Test
+ fun convertsFromPublisherManagesSubscriptions() {
+ val processor = create<String>()
+ val liveData = processor.toLiveData()
+ assertThat(processor.hasSubscribers(), `is`(false))
+ liveData.observe(lifecycleOwner, observer)
+
+ // once the live data is active, there's a subscriber
+ assertThat(processor.hasSubscribers(), `is`(true))
+ liveData.removeObserver(observer)
+ // once the live data is inactive, the subscriber is removed
+ assertThat(processor.hasSubscribers(), `is`(false))
+ }
+
+ @Test
+ fun convertsFromAsyncPublisher() {
+ val input = just("foo").concatWith(just("bar", "baz")
+ .observeOn(backgroundScheduler))
+ val liveData = input.toLiveData()
+ liveData.observe(lifecycleOwner, observer)
+ assertThat(liveDataOutput, `is`(listOf("foo")))
+ backgroundScheduler.triggerActions()
+ assertThat(liveDataOutput, `is`(mutableListOf("foo", "bar", "baz")))
+ }
+
+ @Test
+ fun convertsToPublisherWithSyncData() {
+ val liveData = MutableLiveData<String>()
+ liveData.value = "foo"
+ assertThat(liveData.value, `is`("foo"))
+ fromPublisher(toPublisher(lifecycleOwner, liveData))
+ .subscribe(outputProcessor)
+ liveData.value = "bar"
+ liveData.value = "baz"
+ assertThat(
+ outputProcessor.getValues(arrayOf()),
+ `is`(arrayOf("foo", "bar", "baz"))
+ )
+ }
+
+ @Test
+ fun convertingToPublisherIsCancelable() {
+ val liveData = MutableLiveData<String>()
+ liveData.value = "foo"
+ assertThat(liveData.value, `is`("foo"))
+ val disposable = fromPublisher(toPublisher(lifecycleOwner, liveData))
+ .subscribe { s -> liveDataOutput.add(s) }
+ liveData.value = "bar"
+ liveData.value = "baz"
+ assertThat(liveData.hasObservers(), `is`(true))
+ disposable.dispose()
+ liveData.value = "fizz"
+ liveData.value = "buzz"
+ assertThat(liveDataOutput, `is`(mutableListOf<String?>("foo", "bar", "baz")))
+ // Canceling disposable should also remove livedata mObserver.
+ assertThat(liveData.hasObservers(), `is`(false))
+ }
+
+ @Test
+ fun convertsToPublisherWithBackpressure() {
+ val liveData = MutableLiveData<String>()
+ val subscriptionSubject = AsyncSubject.create<Subscription>()
+ fromPublisher(toPublisher<String>(lifecycleOwner, liveData))
+ .subscribe(object : Subscriber<String> {
+ override fun onSubscribe(s: Subscription) {
+ subscriptionSubject.onNext(s)
+ subscriptionSubject.onComplete()
+ }
+
+ override fun onNext(s: String) {
+ outputProcessor.onNext(s)
+ }
+
+ override fun onError(t: Throwable) {
+ throw RuntimeException(t)
+ }
+
+ override fun onComplete() {}
+ })
+
+ // Subscription should have happened synchronously. If it didn't, this will deadlock.
+ val subscription = subscriptionSubject.blockingSingle()
+ subscription.request(1)
+ assertThat(outputProcessor.getValues(arrayOf()), `is`(arrayOf()))
+ liveData.value = "foo"
+ assertThat(outputProcessor.getValues(arrayOf()), `is`(arrayOf("foo")))
+ subscription.request(2)
+ liveData.value = "baz"
+ liveData.value = "fizz"
+ assertThat(
+ outputProcessor.getValues(arrayOf()),
+ `is`(arrayOf("foo", "baz", "fizz"))
+ )
+
+ // 'nyan' will be dropped as there is nothing currently requesting a stream.
+ liveData.value = "nyan"
+ liveData.value = "cat"
+ assertThat(
+ outputProcessor.getValues(arrayOf()),
+ `is`(arrayOf("foo", "baz", "fizz"))
+ )
+
+ // When a new request comes in, the latest value will be pushed.
+ subscription.request(1)
+ assertThat(
+ outputProcessor.getValues(arrayOf()),
+ `is`(arrayOf("foo", "baz", "fizz", "cat"))
+ )
+ }
+
+ @Test
+ fun convertsToPublisherWithAsyncData() {
+ val liveData = MutableLiveData<String>()
+ fromPublisher(toPublisher(lifecycleOwner, liveData))
+ .observeOn(backgroundScheduler)
+ .subscribe(outputProcessor)
+ liveData.value = "foo"
+ assertThat(outputProcessor.getValues(arrayOf()), `is`(arrayOf()))
+ backgroundScheduler.triggerActions()
+ assertThat(outputProcessor.getValues(arrayOf()), `is`(arrayOf("foo")))
+ liveData.value = "bar"
+ liveData.value = "baz"
+ assertThat(outputProcessor.getValues(arrayOf()), `is`(arrayOf("foo")))
+ backgroundScheduler.triggerActions()
+ assertThat(
+ outputProcessor.getValues(arrayOf()),
+ `is`(arrayOf("foo", "bar", "baz"))
+ )
+ }
+
+ companion object {
+ private val backgroundScheduler = TestScheduler()
+ }
+}
diff --git a/lifecycle/lifecycle-runtime-compose/samples/src/main/java/androidx/lifecycle/compose/samples/LifecycleComposeSamples.kt b/lifecycle/lifecycle-runtime-compose/samples/src/main/java/androidx/lifecycle/compose/samples/LifecycleComposeSamples.kt
index d6786be..1cf0ff6 100644
--- a/lifecycle/lifecycle-runtime-compose/samples/src/main/java/androidx/lifecycle/compose/samples/LifecycleComposeSamples.kt
+++ b/lifecycle/lifecycle-runtime-compose/samples/src/main/java/androidx/lifecycle/compose/samples/LifecycleComposeSamples.kt
@@ -119,4 +119,4 @@
// ...
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleEffectTest.kt b/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleEffectTest.kt
index 1934883..4207518 100644
--- a/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleEffectTest.kt
+++ b/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleEffectTest.kt
@@ -535,4 +535,4 @@
.isEqualTo("changed resumed disposed")
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleExtTest.kt b/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleExtTest.kt
index a9e7d4e..21777bb 100644
--- a/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleExtTest.kt
+++ b/lifecycle/lifecycle-runtime-compose/src/androidTest/java/androidx/lifecycle/compose/LifecycleExtTest.kt
@@ -62,4 +62,4 @@
}
*/
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleEffect.kt b/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleEffect.kt
index 88ee99e..d76638e 100644
--- a/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleEffect.kt
+++ b/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleEffect.kt
@@ -686,4 +686,4 @@
onPauseOrDisposeEffect()
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleExt.kt b/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleExt.kt
index 27ed591..3fbdc30 100644
--- a/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleExt.kt
+++ b/lifecycle/lifecycle-runtime-compose/src/main/java/androidx/lifecycle/compose/LifecycleExt.kt
@@ -29,4 +29,4 @@
* [State.value] usage.
*/
@Composable
-fun Lifecycle.currentStateAsState(): State<Lifecycle.State> = currentStateFlow.collectAsState()
\ No newline at end of file
+fun Lifecycle.currentStateAsState(): State<Lifecycle.State> = currentStateFlow.collectAsState()
diff --git a/lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt b/lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt
index dce48e7..167a9f3 100644
--- a/lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt
+++ b/lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt
@@ -299,4 +299,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/Expectations.kt b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/Expectations.kt
index 4194da9..a1053b6 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/Expectations.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/Expectations.kt
@@ -39,4 +39,4 @@
fun expectTotal(total: Int) {
Truth.assertThat(counter.get()).isEqualTo(total)
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/FakeLifecycleOwner.kt b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/FakeLifecycleOwner.kt
index 10d9fd9..8472158 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/FakeLifecycleOwner.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/FakeLifecycleOwner.kt
@@ -71,4 +71,4 @@
registry.observerCount
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/LaunchWhenTest.kt b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/LaunchWhenTest.kt
index 0181abe..5b5d3d3 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/LaunchWhenTest.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/LaunchWhenTest.kt
@@ -67,4 +67,4 @@
expectations.expect(10)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TaskTracker.kt b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TaskTracker.kt
index f56e505..383fbf9 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TaskTracker.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TaskTracker.kt
@@ -51,4 +51,4 @@
return idle.await(time, timeUnit)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TrackedExecutor.kt b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TrackedExecutor.kt
index d33030c..6fcfaf4 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TrackedExecutor.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/androidTest/java/androidx/lifecycle/TrackedExecutor.kt
@@ -47,4 +47,4 @@
fun inc()
fun dec()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime-ktx/src/main/java/androidx/lifecycle/View.kt b/lifecycle/lifecycle-runtime-ktx/src/main/java/androidx/lifecycle/View.kt
index 002ff2c..9d17f28 100644
--- a/lifecycle/lifecycle-runtime-ktx/src/main/java/androidx/lifecycle/View.kt
+++ b/lifecycle/lifecycle-runtime-ktx/src/main/java/androidx/lifecycle/View.kt
@@ -31,4 +31,4 @@
),
level = DeprecationLevel.HIDDEN
)
-public fun View.findViewTreeLifecycleOwner(): LifecycleOwner? = findViewTreeLifecycleOwner()
\ No newline at end of file
+public fun View.findViewTreeLifecycleOwner(): LifecycleOwner? = findViewTreeLifecycleOwner()
diff --git a/lifecycle/lifecycle-runtime-testing/src/test/java/androidx/lifecycle/testing/LifecycleEventFlowTest.kt b/lifecycle/lifecycle-runtime-testing/src/test/java/androidx/lifecycle/testing/LifecycleEventFlowTest.kt
index 8d2a43e..23982d8 100644
--- a/lifecycle/lifecycle-runtime-testing/src/test/java/androidx/lifecycle/testing/LifecycleEventFlowTest.kt
+++ b/lifecycle/lifecycle-runtime-testing/src/test/java/androidx/lifecycle/testing/LifecycleEventFlowTest.kt
@@ -107,4 +107,4 @@
owner.currentState = Lifecycle.State.RESUMED
assertThat(collectedEvents).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.java b/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.java
deleted file mode 100644
index d64f413..0000000
--- a/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import android.app.PictureInPictureParams;
-import android.os.Build;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SdkSuppress;
-import androidx.test.filters.SmallTest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N_MR1)
-@SmallTest
-@SuppressWarnings("deprecation")
-public class MissingClassTest {
- public static class ObserverWithMissingClasses {
- @SuppressWarnings("unused")
- public void newApiMethod(PictureInPictureParams params) {}
-
- @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
- public void onResume() {}
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingApi() {
- new ReflectiveGenericLifecycleObserver(new ObserverWithMissingClasses());
- }
-}
diff --git a/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.kt b/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.kt
new file mode 100644
index 0000000..3b7bfd2
--- /dev/null
+++ b/lifecycle/lifecycle-runtime/src/androidTest/java/androidx/lifecycle/MissingClassTest.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import android.app.PictureInPictureParams
+import android.os.Build
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SdkSuppress
+import androidx.test.filters.SmallTest
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N_MR1)
+@SmallTest
+@Suppress("DEPRECATION")
+class MissingClassTest {
+ @Suppress("UNUSED")
+ class ObserverWithMissingClasses {
+ @Suppress("UNUSED_PARAMETER")
+ fun newApiMethod(params: PictureInPictureParams?) {
+ }
+
+ @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
+ fun onResume() {
+ }
+ }
+
+ @Test(expected = IllegalArgumentException::class)
+ fun testMissingApi() {
+ ReflectiveGenericLifecycleObserver(ObserverWithMissingClasses())
+ }
+}
diff --git a/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/LifecycleRegistry.kt b/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/LifecycleRegistry.kt
index 88f3480..03f2836 100644
--- a/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/LifecycleRegistry.kt
+++ b/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/LifecycleRegistry.kt
@@ -344,4 +344,4 @@
return if ((state2 != null) && (state2 < state1)) state2 else state1
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/ReportFragment.kt b/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/ReportFragment.kt
index 9873795..8bcd9d0 100644
--- a/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/ReportFragment.kt
+++ b/lifecycle/lifecycle-runtime/src/main/java/androidx/lifecycle/ReportFragment.kt
@@ -201,4 +201,4 @@
) as ReportFragment
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/LifecycleService.kt b/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/LifecycleService.kt
index 17006dc..1e3eccc 100644
--- a/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/LifecycleService.kt
+++ b/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/LifecycleService.kt
@@ -64,4 +64,4 @@
override val lifecycle: Lifecycle
get() = dispatcher.lifecycle
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/ServiceLifecycleDispatcher.kt b/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/ServiceLifecycleDispatcher.kt
index 9d2d086..7a4eb91 100644
--- a/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/ServiceLifecycleDispatcher.kt
+++ b/lifecycle/lifecycle-service/src/main/java/androidx/lifecycle/ServiceLifecycleDispatcher.kt
@@ -94,4 +94,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.kt b/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.kt
index e8f0678..3383c32 100644
--- a/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.kt
+++ b/lifecycle/lifecycle-viewmodel-compose/src/androidTest/java/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.kt
@@ -39,4 +39,4 @@
public class SavedStateHandleAndApplicationViewModel(
application: Application,
@Suppress("UNUSED_PARAMETER") savedStateHandle: SavedStateHandle
-) : AndroidViewModel(application)
\ No newline at end of file
+) : AndroidViewModel(application)
diff --git a/lifecycle/lifecycle-viewmodel-ktx/src/androidTest/java/androidx/lifecycle/ViewModelTest.kt b/lifecycle/lifecycle-viewmodel-ktx/src/androidTest/java/androidx/lifecycle/ViewModelTest.kt
index b9990ac..3bbfbf6 100644
--- a/lifecycle/lifecycle-viewmodel-ktx/src/androidTest/java/androidx/lifecycle/ViewModelTest.kt
+++ b/lifecycle/lifecycle-viewmodel-ktx/src/androidTest/java/androidx/lifecycle/ViewModelTest.kt
@@ -72,4 +72,4 @@
delayingDeferred.cancelAndJoin()
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.java b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.java
deleted file mode 100644
index 71dc7a2..0000000
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import android.os.Bundle;
-import android.os.Parcel;
-
-import androidx.test.annotation.UiThreadTest;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SmallTest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.Arrays;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class SavedStateHandleParcelingTest {
-
- @UiThreadTest
- @Test
- public void test() {
- SavedStateHandle handle = new SavedStateHandle();
- handle.<String>getLiveData("livedata").setValue("para");
- handle.set("notlive", 261);
- handle.set("array", new int[]{2, 3, 9});
- Bundle savedState = handle.savedStateProvider().saveState();
- Parcel parcel = Parcel.obtain();
- savedState.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
- Bundle newBundle = Bundle.CREATOR.createFromParcel(parcel);
- SavedStateHandle newHandle = SavedStateHandle.createHandle(newBundle, null);
- assertThat(newHandle.<String>get("livedata"), is("para"));
- assertThat(newHandle.<Integer>get("notlive"), is(261));
- assertThat(Arrays.equals(newHandle.<int[]>get("array"), new int[]{2, 3, 9}), is(true));
- }
-
- @UiThreadTest
- @Test
- public void testRemoveFromDefault() {
- Bundle defaultState = new Bundle();
- defaultState.putString("string", "default");
- SavedStateHandle handle = SavedStateHandle.createHandle(null, defaultState);
- assertThat(handle.contains("string"), is(true));
- handle.remove("string");
- assertThat(handle.contains("string"), is(false));
-
- Bundle savedState = handle.savedStateProvider().saveState();
- SavedStateHandle newHandle = SavedStateHandle.createHandle(savedState, defaultState);
- assertThat(newHandle.contains("string"), is(false));
- }
-}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.kt
new file mode 100644
index 0000000..d4fac80
--- /dev/null
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/SavedStateHandleParcelingTest.kt
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import android.os.Bundle
+import android.os.Bundle.CREATOR
+import android.os.Parcel.obtain
+import androidx.lifecycle.SavedStateHandle.Companion.createHandle
+import androidx.test.annotation.UiThreadTest
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import java.util.Arrays.equals
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class SavedStateHandleParcelingTest {
+ @UiThreadTest
+ @Test
+ fun test() {
+ val handle = SavedStateHandle()
+ handle.getLiveData<String>("livedata").value = "para"
+ handle["notlive"] = 261
+ handle["array"] = intArrayOf(2, 3, 9)
+ val savedState = handle.savedStateProvider().saveState()
+ val parcel = obtain()
+ savedState.writeToParcel(parcel, 0)
+ parcel.setDataPosition(0)
+ val newBundle = CREATOR.createFromParcel(parcel)
+ val newHandle: SavedStateHandle = createHandle(newBundle, null)
+ assertThat<String>(newHandle["livedata"], `is`("para"))
+ assertThat<Int>(newHandle["notlive"], `is`(261))
+ assertThat(
+ equals(
+ newHandle["array"],
+ intArrayOf(2, 3, 9)
+ ),
+ `is`(true)
+ )
+ }
+
+ @UiThreadTest
+ @Test
+ fun testRemoveFromDefault() {
+ val defaultState = Bundle()
+ defaultState.putString("string", "default")
+ val handle = createHandle(null, defaultState)
+ assertThat(handle.contains("string"), `is`(true))
+ handle.remove<Any>("string")
+ assertThat(handle.contains("string"), `is`(false))
+ val savedState = handle.savedStateProvider().saveState()
+ val newHandle = createHandle(savedState, defaultState)
+ assertThat(newHandle.contains("string"), `is`(false))
+ }
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
index 12fe0e0..73285fc 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
@@ -207,4 +207,4 @@
extras[VIEW_MODEL_STORE_OWNER_KEY] = this
return extras
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/TestComponent.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/TestComponent.kt
index a0c00510..f28e101 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/TestComponent.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/TestComponent.kt
@@ -73,4 +73,4 @@
if (bundle != null) extras[DEFAULT_ARGS_KEY] = bundle
return extras.createSavedStateHandle()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTest.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTest.kt
index c139d47..e61217a 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTest.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTest.kt
@@ -263,4 +263,4 @@
extras[VIEW_MODEL_STORE_OWNER_KEY] = this
return extras
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/AbstractSavedStateViewModelFactory.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/AbstractSavedStateViewModelFactory.kt
index 2e06e75..7ae26bed 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/AbstractSavedStateViewModelFactory.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/AbstractSavedStateViewModelFactory.kt
@@ -153,4 +153,4 @@
internal const val TAG_SAVED_STATE_HANDLE_CONTROLLER =
"androidx.lifecycle.savedstate.vm.tag"
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/LegacySavedStateHandleController.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/LegacySavedStateHandleController.kt
index 2f3de01..d852da8 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/LegacySavedStateHandleController.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/LegacySavedStateHandleController.kt
@@ -90,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleController.kt b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleController.kt
index d50f2c7..3770888 100644
--- a/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleController.kt
+++ b/lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateHandleController.kt
@@ -38,4 +38,4 @@
source.lifecycle.removeObserver(this)
}
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/AndroidViewModelFactoryTest.kt b/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/AndroidViewModelFactoryTest.kt
index 7d851da..543d342 100644
--- a/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/AndroidViewModelFactoryTest.kt
+++ b/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/AndroidViewModelFactoryTest.kt
@@ -106,4 +106,4 @@
private fun queryApplication(): Application {
val context = InstrumentationRegistry.getInstrumentation().context.applicationContext
return context as? Application ?: throw IllegalStateException("Failed to get an application")
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/CreationExtrasTest.kt b/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/CreationExtrasTest.kt
index c992c09..f480a9a 100644
--- a/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/CreationExtrasTest.kt
+++ b/lifecycle/lifecycle-viewmodel/src/androidTest/java/androidx/lifecycle/CreationExtrasTest.kt
@@ -38,4 +38,4 @@
initial[key] = bundleOf("value" to "overridden")
assertThat(mutable[key]?.getString("value")).isEqualTo("initial")
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/AndroidViewModel.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/AndroidViewModel.kt
index 12f0b18..60bb467 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/AndroidViewModel.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/AndroidViewModel.kt
@@ -31,4 +31,4 @@
open fun <T : Application> getApplication(): T {
return application as T
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/HasDefaultViewModelProviderFactory.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/HasDefaultViewModelProviderFactory.kt
index 3a896b1..18039b69 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/HasDefaultViewModelProviderFactory.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/HasDefaultViewModelProviderFactory.kt
@@ -36,4 +36,4 @@
*/
val defaultViewModelCreationExtras: CreationExtras
get() = CreationExtras.Empty
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelLazy.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelLazy.kt
index 88cd92e..770b0b1 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelLazy.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelLazy.kt
@@ -59,4 +59,4 @@
}
override fun isInitialized(): Boolean = cached != null
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStore.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStore.kt
index 651afa0..5d8d42c 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStore.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStore.kt
@@ -70,4 +70,4 @@
}
map.clear()
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStoreOwner.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStoreOwner.kt
index 5296800..dac1275 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStoreOwner.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewModelStoreOwner.kt
@@ -30,4 +30,4 @@
* The owned [ViewModelStore]
*/
val viewModelStore: ViewModelStore
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewTreeViewModelStoreOwner.kt b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewTreeViewModelStoreOwner.kt
index 7239652..1cdd93f 100644
--- a/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewTreeViewModelStoreOwner.kt
+++ b/lifecycle/lifecycle-viewmodel/src/main/java/androidx/lifecycle/ViewTreeViewModelStoreOwner.kt
@@ -52,4 +52,4 @@
}.mapNotNull { view ->
view.getTag(R.id.view_tree_view_model_store_owner) as? ViewModelStoreOwner
}.firstOrNull()
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelLazyTest.kt b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelLazyTest.kt
index 9a9b016..3607742 100644
--- a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelLazyTest.kt
+++ b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelLazyTest.kt
@@ -40,4 +40,4 @@
override fun <T : ViewModel> create(modelClass: Class<T>): T = TestVM("spb") as T
}
-}
\ No newline at end of file
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.java b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.java
deleted file mode 100644
index a0ca24e..0000000
--- a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class ViewModelStoreTest {
-
- @Test
- public void testClear() {
- ViewModelStore store = new ViewModelStore();
- TestViewModel viewModel1 = new TestViewModel();
- TestViewModel viewModel2 = new TestViewModel();
- TestViewModel mockViewModel = mock(TestViewModel.class);
- store.put("a", viewModel1);
- store.put("b", viewModel2);
- store.put("mock", mockViewModel);
- assertThat(viewModel1.mCleared, is(false));
- assertThat(viewModel2.mCleared, is(false));
- store.clear();
- assertThat(viewModel1.mCleared, is(true));
- assertThat(viewModel2.mCleared, is(true));
- verify(mockViewModel).onCleared();
- verifyNoMoreInteractions(mockViewModel);
- assertThat(store.get("a"), nullValue());
- assertThat(store.get("b"), nullValue());
- }
-
- static class TestViewModel extends ViewModel {
- boolean mCleared = false;
-
- @Override
- protected void onCleared() {
- mCleared = true;
- }
- }
-}
diff --git a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.kt b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.kt
new file mode 100644
index 0000000..6e048f6
--- /dev/null
+++ b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelStoreTest.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.CoreMatchers.nullValue
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.mockito.Mockito.mock
+import org.mockito.Mockito.verify
+import org.mockito.Mockito.verifyNoMoreInteractions
+
+@RunWith(JUnit4::class)
+class ViewModelStoreTest {
+ @Test
+ fun testClear() {
+ val store = ViewModelStore()
+ val viewModel1 = TestViewModel()
+ val viewModel2 = TestViewModel()
+ val mockViewModel = mock(TestViewModel::class.java)
+ store.put("a", viewModel1)
+ store.put("b", viewModel2)
+ store.put("mock", mockViewModel)
+ assertThat(viewModel1.cleared, `is`(false))
+ assertThat(viewModel2.cleared, `is`(false))
+ store.clear()
+ assertThat(viewModel1.cleared, `is`(true))
+ assertThat(viewModel2.cleared, `is`(true))
+ verify(mockViewModel).onCleared()
+ verifyNoMoreInteractions(mockViewModel)
+ assertThat(store["a"], nullValue())
+ assertThat(store["b"], nullValue())
+ }
+
+ internal open class TestViewModel : ViewModel() {
+ var cleared = false
+ public override fun onCleared() {
+ cleared = true
+ }
+ }
+}
diff --git a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.java b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.java
deleted file mode 100644
index 76fd7b0..0000000
--- a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.lifecycle;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import androidx.annotation.NonNull;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.Mockito;
-
-import java.io.Closeable;
-
-@RunWith(JUnit4.class)
-public class ViewModelTest {
-
- static class CloseableImpl implements Closeable {
- boolean mWasClosed;
- @Override
- public void close() {
- mWasClosed = true;
- }
- }
-
- static class ViewModel extends androidx.lifecycle.ViewModel {
- }
-
- static class ConstructorArgViewModel extends androidx.lifecycle.ViewModel {
- ConstructorArgViewModel(@NonNull Closeable closeable) {
- super(closeable);
- }
- }
-
- @Test
- public void testCloseableTag() {
- ViewModel vm = new ViewModel();
- CloseableImpl impl = new CloseableImpl();
- vm.setTagIfAbsent("totally_not_coroutine_context", impl);
- vm.clear();
- assertTrue(impl.mWasClosed);
- }
-
- @Test
- public void testCloseableTagAlreadyClearedVM() {
- ViewModel vm = new ViewModel();
- vm.clear();
- CloseableImpl impl = new CloseableImpl();
- vm.setTagIfAbsent("key", impl);
- assertTrue(impl.mWasClosed);
-
- }
-
- @Test
- public void testAlreadyAssociatedKey() {
- ViewModel vm = new ViewModel();
- assertThat(vm.setTagIfAbsent("key", "first"), is("first"));
- assertThat(vm.setTagIfAbsent("key", "second"), is("first"));
- }
-
- @Test
- public void testMockedGetTag() {
- ViewModel vm = Mockito.mock(ViewModel.class);
- assertThat(vm.getTag("Careless mocks =|"), nullValue());
- }
-
- @Test
- public void testAddCloseable() {
- ViewModel vm = new ViewModel();
- CloseableImpl impl = new CloseableImpl();
- vm.addCloseable(impl);
- vm.clear();
- assertTrue(impl.mWasClosed);
- }
-
- @Test
- public void testConstructorCloseable() {
- CloseableImpl impl = new CloseableImpl();
- ConstructorArgViewModel vm = new ConstructorArgViewModel(impl);
- vm.clear();
- assertTrue(impl.mWasClosed);
- }
-
- @Test
- public void testMockedAddCloseable() {
- ViewModel vm = Mockito.mock(ViewModel.class);
- CloseableImpl impl = new CloseableImpl();
- // This shouldn't crash, even on a mocked object
- vm.addCloseable(impl);
- }
-}
diff --git a/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.kt b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.kt
new file mode 100644
index 0000000..6e68344
--- /dev/null
+++ b/lifecycle/lifecycle-viewmodel/src/test/java/androidx/lifecycle/ViewModelTest.kt
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.lifecycle
+
+import java.io.Closeable
+import org.hamcrest.CoreMatchers.`is`
+import org.hamcrest.CoreMatchers.nullValue
+import org.hamcrest.MatcherAssert.assertThat
+import org.junit.Assert.assertTrue
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.mockito.Mockito
+
+@RunWith(JUnit4::class)
+class ViewModelTest {
+
+ internal class CloseableImpl : Closeable {
+ var wasClosed = false
+ override fun close() {
+ wasClosed = true
+ }
+ }
+
+ internal open class ViewModel : androidx.lifecycle.ViewModel()
+ internal class ConstructorArgViewModel(closeable: Closeable) :
+ androidx.lifecycle.ViewModel(closeable)
+
+ @Test
+ fun testCloseableTag() {
+ val vm = ViewModel()
+ val impl = CloseableImpl()
+ vm.setTagIfAbsent("totally_not_coroutine_context", impl)
+ vm.clear()
+ assertTrue(impl.wasClosed)
+ }
+
+ @Test
+ fun testCloseableTagAlreadyClearedVM() {
+ val vm = ViewModel()
+ vm.clear()
+ val impl = CloseableImpl()
+ vm.setTagIfAbsent("key", impl)
+ assertTrue(impl.wasClosed)
+ }
+
+ @Test
+ fun testAlreadyAssociatedKey() {
+ val vm = ViewModel()
+ assertThat(vm.setTagIfAbsent("key", "first"), `is`("first"))
+ assertThat(vm.setTagIfAbsent("key", "second"), `is`("first"))
+ }
+
+ @Test
+ fun testMockedGetTag() {
+ val vm = Mockito.mock(ViewModel::class.java)
+ assertThat(vm.getTag("Careless mocks =|"), nullValue())
+ }
+
+ @Test
+ fun testAddCloseable() {
+ val vm = ViewModel()
+ val impl = CloseableImpl()
+ vm.addCloseable(impl)
+ vm.clear()
+ assertTrue(impl.wasClosed)
+ }
+
+ @Test
+ fun testConstructorCloseable() {
+ val impl = CloseableImpl()
+ val vm = ConstructorArgViewModel(impl)
+ vm.clear()
+ assertTrue(impl.wasClosed)
+ }
+
+ @Test
+ fun testMockedAddCloseable() {
+ val vm = Mockito.mock(ViewModel::class.java)
+ val impl = CloseableImpl()
+ // This shouldn't crash, even on a mocked object
+ vm.addCloseable(impl)
+ }
+}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/KeepAnnotationUsageKotlin.kt b/lint-checks/integration-tests/src/main/java/androidx/KeepAnnotationUsageKotlin.kt
index 2d8395e..f2b8070 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/KeepAnnotationUsageKotlin.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/KeepAnnotationUsageKotlin.kt
@@ -19,4 +19,4 @@
import androidx.annotation.Keep
@Keep
-class KeepAnnotationUsageKotlin
\ No newline at end of file
+class KeepAnnotationUsageKotlin
diff --git a/lint-checks/integration-tests/src/main/java/androidx/ParcelableUsageKotlin.kt b/lint-checks/integration-tests/src/main/java/androidx/ParcelableUsageKotlin.kt
index 6d22bfc..f205be3 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/ParcelableUsageKotlin.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/ParcelableUsageKotlin.kt
@@ -37,4 +37,4 @@
return arrayOfNulls(size)
}
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/RequiresApiKotlin.kt b/lint-checks/integration-tests/src/main/java/androidx/RequiresApiKotlin.kt
index 5bbd9c6..c6de7b9 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/RequiresApiKotlin.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/RequiresApiKotlin.kt
@@ -99,4 +99,4 @@
return 0
}
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/ThreadSleepUsageKotlin.kt b/lint-checks/integration-tests/src/main/java/androidx/ThreadSleepUsageKotlin.kt
index e1cdde4..19a4a01 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/ThreadSleepUsageKotlin.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/ThreadSleepUsageKotlin.kt
@@ -20,4 +20,4 @@
fun badMethod() {
Thread.sleep(1000)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKt.kt b/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKt.kt
index 3071bb1..9fe0848 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKt.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKt.kt
@@ -367,4 +367,4 @@
requestRelaunchActivityMethod =
getRequestRelaunchActivityMethod(activityThreadClass)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKtChecked.kt b/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKtChecked.kt
index 9951f6e..1446e04 100644
--- a/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKtChecked.kt
+++ b/lint-checks/integration-tests/src/main/java/androidx/sample/core/app/ActivityRecreatorKtChecked.kt
@@ -374,4 +374,4 @@
requestRelaunchActivityMethod =
getRequestRelaunchActivityMethod(activityThreadClass)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/build/lint/AndroidManifestServiceExportedDetector.kt b/lint-checks/src/main/java/androidx/build/lint/AndroidManifestServiceExportedDetector.kt
index 12e1e056..1283931 100644
--- a/lint-checks/src/main/java/androidx/build/lint/AndroidManifestServiceExportedDetector.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/AndroidManifestServiceExportedDetector.kt
@@ -60,4 +60,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/build/lint/BanInlineOptIn.kt b/lint-checks/src/main/java/androidx/build/lint/BanInlineOptIn.kt
index a819262..5e7fe36 100644
--- a/lint-checks/src/main/java/androidx/build/lint/BanInlineOptIn.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/BanInlineOptIn.kt
@@ -66,4 +66,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/build/lint/CameraXQuirksClassDetector.kt b/lint-checks/src/main/java/androidx/build/lint/CameraXQuirksClassDetector.kt
index 7326529..9c87cf3 100644
--- a/lint-checks/src/main/java/androidx/build/lint/CameraXQuirksClassDetector.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/CameraXQuirksClassDetector.kt
@@ -87,4 +87,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/build/lint/IdeaSuppressionDetector.kt b/lint-checks/src/main/java/androidx/build/lint/IdeaSuppressionDetector.kt
index e6acfb7..95363c8 100644
--- a/lint-checks/src/main/java/androidx/build/lint/IdeaSuppressionDetector.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/IdeaSuppressionDetector.kt
@@ -155,4 +155,4 @@
Implementation(IdeaSuppressionDetector::class.java, Scope.JAVA_FILE_SCOPE),
)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetector.kt b/lint-checks/src/main/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetector.kt
index 1136d96..bc735ea0 100644
--- a/lint-checks/src/main/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetector.kt
+++ b/lint-checks/src/main/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetector.kt
@@ -229,4 +229,4 @@
"androidx.camera.camera-camera2-pipe-testing",
)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/AidlPsiUtil.kt b/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/AidlPsiUtil.kt
index c15251f..9bc4ec4 100644
--- a/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/AidlPsiUtil.kt
+++ b/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/AidlPsiUtil.kt
@@ -95,4 +95,4 @@
else -> return null
}
return facade.findClass(fqn, scope)
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/impl/AbstractAidlDeclarationImpl.kt b/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/impl/AbstractAidlDeclarationImpl.kt
index fcc8e5e..9c04e77 100644
--- a/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/impl/AbstractAidlDeclarationImpl.kt
+++ b/lint-checks/src/main/java/androidx/com/android/tools/idea/lang/aidl/psi/impl/AbstractAidlDeclarationImpl.kt
@@ -131,4 +131,4 @@
override fun getDeclarationName(): AidlNamedElement {
return findChildByClass(AidlNamedElement::class.java)!!
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/BanConcurrentHashMapTest.kt b/lint-checks/src/test/java/androidx/build/lint/BanConcurrentHashMapTest.kt
index cc2edd6..47e2510 100644
--- a/lint-checks/src/test/java/androidx/build/lint/BanConcurrentHashMapTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/BanConcurrentHashMapTest.kt
@@ -211,4 +211,4 @@
.run()
.expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/BanHideAnnotationTest.kt b/lint-checks/src/test/java/androidx/build/lint/BanHideAnnotationTest.kt
index 1c996a8..c7c3219 100644
--- a/lint-checks/src/test/java/androidx/build/lint/BanHideAnnotationTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/BanHideAnnotationTest.kt
@@ -67,4 +67,4 @@
check(*input).expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/BanParcelableUsageTest.kt b/lint-checks/src/test/java/androidx/build/lint/BanParcelableUsageTest.kt
index b9370e6..44327ba 100644
--- a/lint-checks/src/test/java/androidx/build/lint/BanParcelableUsageTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/BanParcelableUsageTest.kt
@@ -63,4 +63,4 @@
check(*input).expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/CameraXQuirksClassDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/CameraXQuirksClassDetectorTest.kt
index 0439f2d..89ff847 100644
--- a/lint-checks/src/test/java/androidx/build/lint/CameraXQuirksClassDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/CameraXQuirksClassDetectorTest.kt
@@ -52,4 +52,4 @@
check(*input).expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/ExperimentalPropertyAnnotationDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/ExperimentalPropertyAnnotationDetectorTest.kt
index 5733f15..498bd10 100644
--- a/lint-checks/src/test/java/androidx/build/lint/ExperimentalPropertyAnnotationDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/ExperimentalPropertyAnnotationDetectorTest.kt
@@ -719,4 +719,4 @@
.expect(expected)
.expectFixDiffs(expectedFixDiffs)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/ImplicitCastVerificationFailureDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/ImplicitCastVerificationFailureDetectorTest.kt
index fd1e150..1b0b889 100644
--- a/lint-checks/src/test/java/androidx/build/lint/ImplicitCastVerificationFailureDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/ImplicitCastVerificationFailureDetectorTest.kt
@@ -770,4 +770,4 @@
check(*input).expect(expected).expectFixDiffs(expectedFixDiffs)
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetectorTest.kt
index 746a473..fb54974 100644
--- a/lint-checks/src/test/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/MissingJvmDefaultWithCompatibilityDetectorTest.kt
@@ -258,4 +258,4 @@
check(*input)
.expectClean()
}
-}
\ No newline at end of file
+}
diff --git a/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
index b62ce6d..99837b9c2 100644
--- a/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
+++ b/lint-checks/src/test/java/androidx/build/lint/TargetApiAnnotationDetectorTest.kt
@@ -69,4 +69,4 @@
check(*input).expect(expected)
}
-}
\ No newline at end of file
+}
diff --git a/media/OWNERS b/media/OWNERS
index 5e87314..1cdf81b 100644
--- a/media/OWNERS
+++ b/media/OWNERS
@@ -1,4 +1,4 @@
-# Bug component: 461042
+# Bug component: 188488
# Media Playback:
bachinger@google.com
diff --git a/media/media/src/main/java/androidx/media/app/NotificationCompat.java b/media/media/src/main/java/androidx/media/app/NotificationCompat.java
index be90897..97c445e 100644
--- a/media/media/src/main/java/androidx/media/app/NotificationCompat.java
+++ b/media/media/src/main/java/androidx/media/app/NotificationCompat.java
@@ -37,13 +37,11 @@
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RequiresPermission;
import androidx.annotation.RestrictTo;
import androidx.core.app.BundleCompat;
import androidx.core.app.NotificationBuilderWithBuilderAccessor;
-import androidx.core.os.BuildCompat;
import androidx.media.R;
/**
@@ -248,11 +246,10 @@
/**
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@RestrictTo(LIBRARY)
@Override
public void apply(NotificationBuilderWithBuilderAccessor builder) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api21Impl.setMediaStyle(builder.getBuilder(),
Api21Impl.fillInMediaStyle(Api34Impl.setRemotePlaybackInfo(
Api21Impl.createMediaStyle(), mDeviceName, mDeviceIcon,
@@ -420,11 +417,10 @@
/**
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@RestrictTo(LIBRARY)
@Override
public void apply(NotificationBuilderWithBuilderAccessor builder) {
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
Api21Impl.setMediaStyle(builder.getBuilder(), Api21Impl.fillInMediaStyle(
Api34Impl.setRemotePlaybackInfo(
Api24Impl.createDecoratedMediaCustomViewStyle(), mDeviceName,
diff --git a/media2/media2-session/src/main/java/androidx/media2/session/MediaLibraryService.java b/media2/media2-session/src/main/java/androidx/media2/session/MediaLibraryService.java
index 567f9d1..5566fb6 100644
--- a/media2/media2-session/src/main/java/androidx/media2/session/MediaLibraryService.java
+++ b/media2/media2-session/src/main/java/androidx/media2/session/MediaLibraryService.java
@@ -99,7 +99,7 @@
* <td>Actual package name via {@link Context#getPackageName()}</td>
* <td>Actual UID</td></tr>
* </table>
- **/
+ */
public static final class MediaLibrarySession extends MediaSession {
private final boolean mThrowsWhenInvalidReturn;
@@ -335,7 +335,7 @@
/**
* Prevents session to be crashed when it returns any invalid return.
*
- **/
+ */
@RestrictTo(LIBRARY)
@NonNull
@VisibleForTesting
@@ -587,7 +587,7 @@
* implementation must return the params with the {@code true} as well.
*
* @return {@code true} for offline items. {@code false} otherwise.
- **/
+ */
public boolean isOffline() {
return convertToBoolean(mOffline);
}
@@ -601,7 +601,7 @@
* media items is considered ordered by relevance, first being the top suggestion.
*
* @return {@code true} for suggested items. {@code false} otherwise
- **/
+ */
public boolean isSuggested() {
return convertToBoolean(mSuggested);
}
diff --git a/media2/media2-session/src/main/java/androidx/media2/session/MediaUtils.java b/media2/media2-session/src/main/java/androidx/media2/session/MediaUtils.java
index a7afcb0..d726eb2 100644
--- a/media2/media2-session/src/main/java/androidx/media2/session/MediaUtils.java
+++ b/media2/media2-session/src/main/java/androidx/media2/session/MediaUtils.java
@@ -969,7 +969,7 @@
*
* @param attrs audio attributes
* @return int legacy stream type from {@link AudioManager}
- **/
+ */
public static int getLegacyStreamType(@Nullable AudioAttributesCompat attrs) {
int stream;
if (attrs == null) {
diff --git a/media2/media2-session/src/main/java/androidx/media2/session/RemoteResult.java b/media2/media2-session/src/main/java/androidx/media2/session/RemoteResult.java
index 08c9682..bf836e6 100644
--- a/media2/media2-session/src/main/java/androidx/media2/session/RemoteResult.java
+++ b/media2/media2-session/src/main/java/androidx/media2/session/RemoteResult.java
@@ -21,7 +21,7 @@
/**
* Base interface for result classes in {@link MediaSession} and {@link MediaController} that may
* be sent across the processes.
- **/
+ */
interface RemoteResult extends BaseResult {
/**
* Result code representing that the session and controller were disconnected.
diff --git a/mediarouter/mediarouter-testing/api/1.6.0-beta01.txt b/mediarouter/mediarouter-testing/api/1.6.0-beta01.txt
new file mode 100644
index 0000000..14e1df6
--- /dev/null
+++ b/mediarouter/mediarouter-testing/api/1.6.0-beta01.txt
@@ -0,0 +1,9 @@
+// Signature format: 4.0
+package androidx.mediarouter.testing {
+
+ public class MediaRouterTestHelper {
+ method @MainThread public static void resetMediaRouter();
+ }
+
+}
+
diff --git a/mediarouter/mediarouter-testing/api/res-1.6.0-beta01.txt b/mediarouter/mediarouter-testing/api/res-1.6.0-beta01.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/mediarouter/mediarouter-testing/api/res-1.6.0-beta01.txt
diff --git a/mediarouter/mediarouter-testing/api/restricted_1.6.0-beta01.txt b/mediarouter/mediarouter-testing/api/restricted_1.6.0-beta01.txt
new file mode 100644
index 0000000..14e1df6
--- /dev/null
+++ b/mediarouter/mediarouter-testing/api/restricted_1.6.0-beta01.txt
@@ -0,0 +1,9 @@
+// Signature format: 4.0
+package androidx.mediarouter.testing {
+
+ public class MediaRouterTestHelper {
+ method @MainThread public static void resetMediaRouter();
+ }
+
+}
+
diff --git a/mediarouter/mediarouter/api/1.6.0-beta01.txt b/mediarouter/mediarouter/api/1.6.0-beta01.txt
new file mode 100644
index 0000000..00e0b0a
--- /dev/null
+++ b/mediarouter/mediarouter/api/1.6.0-beta01.txt
@@ -0,0 +1,621 @@
+// Signature format: 4.0
+package androidx.mediarouter.app {
+
+ public class MediaRouteActionProvider extends androidx.core.view.ActionProvider {
+ ctor public MediaRouteActionProvider(android.content.Context);
+ method @Deprecated public void enableDynamicGroup();
+ method public androidx.mediarouter.app.MediaRouteDialogFactory getDialogFactory();
+ method public androidx.mediarouter.app.MediaRouteButton? getMediaRouteButton();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public android.view.View onCreateActionView();
+ method public androidx.mediarouter.app.MediaRouteButton onCreateMediaRouteButton();
+ method @Deprecated public void setAlwaysVisible(boolean);
+ method public void setDialogFactory(androidx.mediarouter.app.MediaRouteDialogFactory);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteButton extends android.view.View {
+ ctor public MediaRouteButton(android.content.Context);
+ ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet?);
+ ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet?, int);
+ method @Deprecated public void enableDynamicGroup();
+ method public androidx.mediarouter.app.MediaRouteDialogFactory getDialogFactory();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public void onAttachedToWindow();
+ method public void onDetachedFromWindow();
+ method @Deprecated public void setAlwaysVisible(boolean);
+ method public void setDialogFactory(androidx.mediarouter.app.MediaRouteDialogFactory);
+ method public void setRemoteIndicatorDrawable(android.graphics.drawable.Drawable?);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method public boolean showDialog();
+ }
+
+ public class MediaRouteChooserDialog extends androidx.appcompat.app.AppCompatDialog {
+ ctor public MediaRouteChooserDialog(android.content.Context);
+ ctor public MediaRouteChooserDialog(android.content.Context, int);
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public boolean onFilterRoute(androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onFilterRoutes(java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!>);
+ method public void refreshRoutes();
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteChooserDialogFragment extends androidx.fragment.app.DialogFragment {
+ ctor public MediaRouteChooserDialogFragment();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public androidx.mediarouter.app.MediaRouteChooserDialog onCreateChooserDialog(android.content.Context, android.os.Bundle?);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteControllerDialog extends androidx.appcompat.app.AlertDialog {
+ ctor public MediaRouteControllerDialog(android.content.Context);
+ ctor public MediaRouteControllerDialog(android.content.Context, int);
+ method public android.view.View? getMediaControlView();
+ method public android.support.v4.media.session.MediaSessionCompat.Token? getMediaSession();
+ method public androidx.mediarouter.media.MediaRouter.RouteInfo getRoute();
+ method public boolean isVolumeControlEnabled();
+ method public android.view.View? onCreateMediaControlView(android.os.Bundle?);
+ method public void setVolumeControlEnabled(boolean);
+ }
+
+ public class MediaRouteControllerDialogFragment extends androidx.fragment.app.DialogFragment {
+ ctor public MediaRouteControllerDialogFragment();
+ method public androidx.mediarouter.app.MediaRouteControllerDialog onCreateControllerDialog(android.content.Context, android.os.Bundle?);
+ }
+
+ public class MediaRouteDialogFactory {
+ ctor public MediaRouteDialogFactory();
+ method public static androidx.mediarouter.app.MediaRouteDialogFactory getDefault();
+ method public androidx.mediarouter.app.MediaRouteChooserDialogFragment onCreateChooserDialogFragment();
+ method public androidx.mediarouter.app.MediaRouteControllerDialogFragment onCreateControllerDialogFragment();
+ }
+
+ public class MediaRouteDiscoveryFragment extends androidx.fragment.app.Fragment {
+ ctor public MediaRouteDiscoveryFragment();
+ method public androidx.mediarouter.media.MediaRouter getMediaRouter();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public androidx.mediarouter.media.MediaRouter.Callback? onCreateCallback();
+ method public int onPrepareCallbackFlags();
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public final class SystemOutputSwitcherDialogController {
+ method public static boolean showDialog(android.content.Context);
+ }
+
+}
+
+package androidx.mediarouter.media {
+
+ public final class MediaControlIntent {
+ field public static final String ACTION_END_SESSION = "android.media.intent.action.END_SESSION";
+ field public static final String ACTION_ENQUEUE = "android.media.intent.action.ENQUEUE";
+ field public static final String ACTION_GET_SESSION_STATUS = "android.media.intent.action.GET_SESSION_STATUS";
+ field public static final String ACTION_GET_STATUS = "android.media.intent.action.GET_STATUS";
+ field public static final String ACTION_PAUSE = "android.media.intent.action.PAUSE";
+ field public static final String ACTION_PLAY = "android.media.intent.action.PLAY";
+ field public static final String ACTION_REMOVE = "android.media.intent.action.REMOVE";
+ field public static final String ACTION_RESUME = "android.media.intent.action.RESUME";
+ field public static final String ACTION_SEEK = "android.media.intent.action.SEEK";
+ field public static final String ACTION_SEND_MESSAGE = "android.media.intent.action.SEND_MESSAGE";
+ field public static final String ACTION_START_SESSION = "android.media.intent.action.START_SESSION";
+ field public static final String ACTION_STOP = "android.media.intent.action.STOP";
+ field public static final String CATEGORY_LIVE_AUDIO = "android.media.intent.category.LIVE_AUDIO";
+ field public static final String CATEGORY_LIVE_VIDEO = "android.media.intent.category.LIVE_VIDEO";
+ field public static final String CATEGORY_REMOTE_PLAYBACK = "android.media.intent.category.REMOTE_PLAYBACK";
+ field public static final int ERROR_INVALID_ITEM_ID = 3; // 0x3
+ field public static final int ERROR_INVALID_SESSION_ID = 2; // 0x2
+ field public static final int ERROR_UNKNOWN = 0; // 0x0
+ field public static final int ERROR_UNSUPPORTED_OPERATION = 1; // 0x1
+ field public static final String EXTRA_ERROR_CODE = "android.media.intent.extra.ERROR_CODE";
+ field public static final String EXTRA_ITEM_CONTENT_POSITION = "android.media.intent.extra.ITEM_POSITION";
+ field public static final String EXTRA_ITEM_HTTP_HEADERS = "android.media.intent.extra.HTTP_HEADERS";
+ field public static final String EXTRA_ITEM_ID = "android.media.intent.extra.ITEM_ID";
+ field public static final String EXTRA_ITEM_METADATA = "android.media.intent.extra.ITEM_METADATA";
+ field public static final String EXTRA_ITEM_STATUS = "android.media.intent.extra.ITEM_STATUS";
+ field public static final String EXTRA_ITEM_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.ITEM_STATUS_UPDATE_RECEIVER";
+ field public static final String EXTRA_MESSAGE = "android.media.intent.extra.MESSAGE";
+ field public static final String EXTRA_MESSAGE_RECEIVER = "android.media.intent.extra.MESSAGE_RECEIVER";
+ field public static final String EXTRA_SESSION_ID = "android.media.intent.extra.SESSION_ID";
+ field public static final String EXTRA_SESSION_STATUS = "android.media.intent.extra.SESSION_STATUS";
+ field public static final String EXTRA_SESSION_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.SESSION_STATUS_UPDATE_RECEIVER";
+ }
+
+ public final class MediaItemMetadata {
+ field public static final String KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
+ field public static final String KEY_ALBUM_TITLE = "android.media.metadata.ALBUM_TITLE";
+ field public static final String KEY_ARTIST = "android.media.metadata.ARTIST";
+ field public static final String KEY_ARTWORK_URI = "android.media.metadata.ARTWORK_URI";
+ field public static final String KEY_AUTHOR = "android.media.metadata.AUTHOR";
+ field public static final String KEY_COMPOSER = "android.media.metadata.COMPOSER";
+ field public static final String KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
+ field public static final String KEY_DURATION = "android.media.metadata.DURATION";
+ field public static final String KEY_TITLE = "android.media.metadata.TITLE";
+ field public static final String KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
+ field public static final String KEY_YEAR = "android.media.metadata.YEAR";
+ }
+
+ public final class MediaItemStatus {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaItemStatus? fromBundle(android.os.Bundle?);
+ method public long getContentDuration();
+ method public long getContentPosition();
+ method public android.os.Bundle? getExtras();
+ method public int getPlaybackState();
+ method public long getTimestamp();
+ field public static final String EXTRA_HTTP_RESPONSE_HEADERS = "android.media.status.extra.HTTP_RESPONSE_HEADERS";
+ field public static final String EXTRA_HTTP_STATUS_CODE = "android.media.status.extra.HTTP_STATUS_CODE";
+ field public static final int PLAYBACK_STATE_BUFFERING = 3; // 0x3
+ field public static final int PLAYBACK_STATE_CANCELED = 5; // 0x5
+ field public static final int PLAYBACK_STATE_ERROR = 7; // 0x7
+ field public static final int PLAYBACK_STATE_FINISHED = 4; // 0x4
+ field public static final int PLAYBACK_STATE_INVALIDATED = 6; // 0x6
+ field public static final int PLAYBACK_STATE_PAUSED = 2; // 0x2
+ field public static final int PLAYBACK_STATE_PENDING = 0; // 0x0
+ field public static final int PLAYBACK_STATE_PLAYING = 1; // 0x1
+ }
+
+ public static final class MediaItemStatus.Builder {
+ ctor public MediaItemStatus.Builder(androidx.mediarouter.media.MediaItemStatus);
+ ctor public MediaItemStatus.Builder(int);
+ method public androidx.mediarouter.media.MediaItemStatus build();
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setContentDuration(long);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setContentPosition(long);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setPlaybackState(int);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setTimestamp(long);
+ }
+
+ public final class MediaRouteDescriptor {
+ method public android.os.Bundle asBundle();
+ method public boolean canDisconnectAndKeepPlaying();
+ method public static androidx.mediarouter.media.MediaRouteDescriptor? fromBundle(android.os.Bundle?);
+ method public java.util.Set<java.lang.String!> getAllowedPackages();
+ method public int getConnectionState();
+ method public java.util.List<android.content.IntentFilter!> getControlFilters();
+ method public java.util.Set<java.lang.String!> getDeduplicationIds();
+ method public String? getDescription();
+ method public int getDeviceType();
+ method public android.os.Bundle? getExtras();
+ method public android.net.Uri? getIconUri();
+ method public String getId();
+ method public String getName();
+ method public int getPlaybackStream();
+ method public int getPlaybackType();
+ method public int getPresentationDisplayId();
+ method public android.content.IntentSender? getSettingsActivity();
+ method public int getVolume();
+ method public int getVolumeHandling();
+ method public int getVolumeMax();
+ method @Deprecated public boolean isConnecting();
+ method public boolean isDynamicGroupRoute();
+ method public boolean isEnabled();
+ method public boolean isValid();
+ method public boolean isVisibilityPublic();
+ }
+
+ public static final class MediaRouteDescriptor.Builder {
+ ctor public MediaRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteDescriptor);
+ ctor public MediaRouteDescriptor.Builder(String, String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder addControlFilter(android.content.IntentFilter);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder addControlFilters(java.util.Collection<android.content.IntentFilter!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder clearControlFilters();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setCanDisconnect(boolean);
+ method @Deprecated public androidx.mediarouter.media.MediaRouteDescriptor.Builder setConnecting(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setConnectionState(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDeduplicationIds(java.util.Set<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDescription(String?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDeviceType(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setIconUri(android.net.Uri);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setId(String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setIsDynamicGroupRoute(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setName(String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPlaybackStream(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPlaybackType(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPresentationDisplayId(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setSettingsActivity(android.content.IntentSender?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVisibilityPublic();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVisibilityRestricted(java.util.Set<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolume(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolumeHandling(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolumeMax(int);
+ }
+
+ public final class MediaRouteDiscoveryRequest {
+ ctor public MediaRouteDiscoveryRequest(androidx.mediarouter.media.MediaRouteSelector, boolean);
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaRouteDiscoveryRequest? fromBundle(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaRouteSelector getSelector();
+ method public boolean isActiveScan();
+ method public boolean isValid();
+ }
+
+ public abstract class MediaRouteProvider {
+ ctor public MediaRouteProvider(android.content.Context);
+ method public final android.content.Context getContext();
+ method public final androidx.mediarouter.media.MediaRouteProviderDescriptor? getDescriptor();
+ method public final androidx.mediarouter.media.MediaRouteDiscoveryRequest? getDiscoveryRequest();
+ method public final android.os.Handler getHandler();
+ method public final androidx.mediarouter.media.MediaRouteProvider.ProviderMetadata getMetadata();
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController? onCreateDynamicGroupRouteController(String);
+ method public androidx.mediarouter.media.MediaRouteProvider.RouteController? onCreateRouteController(String);
+ method public void onDiscoveryRequestChanged(androidx.mediarouter.media.MediaRouteDiscoveryRequest?);
+ method public final void setCallback(androidx.mediarouter.media.MediaRouteProvider.Callback?);
+ method public final void setDescriptor(androidx.mediarouter.media.MediaRouteProviderDescriptor?);
+ method public final void setDiscoveryRequest(androidx.mediarouter.media.MediaRouteDiscoveryRequest?);
+ }
+
+ public abstract static class MediaRouteProvider.Callback {
+ ctor public MediaRouteProvider.Callback();
+ method public void onDescriptorChanged(androidx.mediarouter.media.MediaRouteProvider, androidx.mediarouter.media.MediaRouteProviderDescriptor?);
+ }
+
+ public abstract static class MediaRouteProvider.DynamicGroupRouteController extends androidx.mediarouter.media.MediaRouteProvider.RouteController {
+ ctor public MediaRouteProvider.DynamicGroupRouteController();
+ method public String? getGroupableSelectionTitle();
+ method public String? getTransferableSectionTitle();
+ method public final void notifyDynamicRoutesChanged(androidx.mediarouter.media.MediaRouteDescriptor, java.util.Collection<androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor!>);
+ method @Deprecated public final void notifyDynamicRoutesChanged(java.util.Collection<androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor!>);
+ method public abstract void onAddMemberRoute(String);
+ method public abstract void onRemoveMemberRoute(String);
+ method public abstract void onUpdateMemberRoutes(java.util.List<java.lang.String!>?);
+ }
+
+ public static final class MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor {
+ method public androidx.mediarouter.media.MediaRouteDescriptor getRouteDescriptor();
+ method public int getSelectionState();
+ method public boolean isGroupable();
+ method public boolean isTransferable();
+ method public boolean isUnselectable();
+ field public static final int SELECTED = 3; // 0x3
+ field public static final int SELECTING = 2; // 0x2
+ field public static final int UNSELECTED = 1; // 0x1
+ field public static final int UNSELECTING = 0; // 0x0
+ }
+
+ public static final class MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder {
+ ctor public MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteDescriptor);
+ ctor public MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsGroupable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsTransferable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsUnselectable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setSelectionState(int);
+ }
+
+ public static final class MediaRouteProvider.ProviderMetadata {
+ method public android.content.ComponentName getComponentName();
+ method public String getPackageName();
+ }
+
+ public abstract static class MediaRouteProvider.RouteController {
+ ctor public MediaRouteProvider.RouteController();
+ method public boolean onControlRequest(android.content.Intent, androidx.mediarouter.media.MediaRouter.ControlRequestCallback?);
+ method public void onRelease();
+ method public void onSelect();
+ method public void onSetVolume(int);
+ method @Deprecated public void onUnselect();
+ method public void onUnselect(int);
+ method public void onUpdateVolume(int);
+ }
+
+ public final class MediaRouteProviderDescriptor {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaRouteProviderDescriptor? fromBundle(android.os.Bundle?);
+ method public java.util.List<androidx.mediarouter.media.MediaRouteDescriptor!> getRoutes();
+ method public boolean isValid();
+ method public boolean supportsDynamicGroupRoute();
+ }
+
+ public static final class MediaRouteProviderDescriptor.Builder {
+ ctor public MediaRouteProviderDescriptor.Builder();
+ ctor public MediaRouteProviderDescriptor.Builder(androidx.mediarouter.media.MediaRouteProviderDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder addRoute(androidx.mediarouter.media.MediaRouteDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder addRoutes(java.util.Collection<androidx.mediarouter.media.MediaRouteDescriptor!>);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder setSupportsDynamicGroupRoute(boolean);
+ }
+
+ public abstract class MediaRouteProviderService extends android.app.Service {
+ ctor public MediaRouteProviderService();
+ method public androidx.mediarouter.media.MediaRouteProvider? getMediaRouteProvider();
+ method public android.os.IBinder? onBind(android.content.Intent);
+ method public abstract androidx.mediarouter.media.MediaRouteProvider? onCreateMediaRouteProvider();
+ field public static final String SERVICE_INTERFACE = "android.media.MediaRouteProviderService";
+ }
+
+ public final class MediaRouteSelector {
+ method public android.os.Bundle asBundle();
+ method public boolean contains(androidx.mediarouter.media.MediaRouteSelector);
+ method public static androidx.mediarouter.media.MediaRouteSelector? fromBundle(android.os.Bundle?);
+ method public java.util.List<java.lang.String!> getControlCategories();
+ method public boolean hasControlCategory(String?);
+ method public boolean isEmpty();
+ method public boolean isValid();
+ method public boolean matchesControlFilters(java.util.List<android.content.IntentFilter!>?);
+ field public static final androidx.mediarouter.media.MediaRouteSelector! EMPTY;
+ }
+
+ public static final class MediaRouteSelector.Builder {
+ ctor public MediaRouteSelector.Builder();
+ ctor public MediaRouteSelector.Builder(androidx.mediarouter.media.MediaRouteSelector);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addControlCategories(java.util.Collection<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addControlCategory(String);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method public androidx.mediarouter.media.MediaRouteSelector build();
+ }
+
+ public final class MediaRouter {
+ method @MainThread public void addCallback(androidx.mediarouter.media.MediaRouteSelector, androidx.mediarouter.media.MediaRouter.Callback);
+ method @MainThread public void addCallback(androidx.mediarouter.media.MediaRouteSelector, androidx.mediarouter.media.MediaRouter.Callback, int);
+ method @MainThread public void addProvider(androidx.mediarouter.media.MediaRouteProvider);
+ method @Deprecated @MainThread public void addRemoteControlClient(Object);
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo? getBluetoothRoute();
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo getDefaultRoute();
+ method @MainThread public static androidx.mediarouter.media.MediaRouter getInstance(android.content.Context);
+ method public android.support.v4.media.session.MediaSessionCompat.Token? getMediaSessionToken();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.ProviderInfo!> getProviders();
+ method @MainThread public androidx.mediarouter.media.MediaRouterParams? getRouterParams();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!> getRoutes();
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo getSelectedRoute();
+ method @MainThread public boolean isRouteAvailable(androidx.mediarouter.media.MediaRouteSelector, int);
+ method @MainThread public void removeCallback(androidx.mediarouter.media.MediaRouter.Callback);
+ method @MainThread public void removeProvider(androidx.mediarouter.media.MediaRouteProvider);
+ method @MainThread public void removeRemoteControlClient(Object);
+ method @MainThread public void selectRoute(androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @MainThread public void setMediaSession(Object?);
+ method @MainThread public void setMediaSessionCompat(android.support.v4.media.session.MediaSessionCompat?);
+ method @MainThread public void setOnPrepareTransferListener(androidx.mediarouter.media.MediaRouter.OnPrepareTransferListener?);
+ method @MainThread public void setRouteListingPreference(androidx.mediarouter.media.RouteListingPreference?);
+ method @MainThread public void setRouterParams(androidx.mediarouter.media.MediaRouterParams?);
+ method @MainThread public void unselect(int);
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo updateSelectedRoute(androidx.mediarouter.media.MediaRouteSelector);
+ field public static final int AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE = 1; // 0x1
+ field public static final int AVAILABILITY_FLAG_REQUIRE_MATCH = 2; // 0x2
+ field public static final int CALLBACK_FLAG_FORCE_DISCOVERY = 8; // 0x8
+ field public static final int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN = 1; // 0x1
+ field public static final int CALLBACK_FLAG_REQUEST_DISCOVERY = 4; // 0x4
+ field public static final int CALLBACK_FLAG_UNFILTERED_EVENTS = 2; // 0x2
+ field public static final int UNSELECT_REASON_DISCONNECTED = 1; // 0x1
+ field public static final int UNSELECT_REASON_ROUTE_CHANGED = 3; // 0x3
+ field public static final int UNSELECT_REASON_STOPPED = 2; // 0x2
+ field public static final int UNSELECT_REASON_UNKNOWN = 0; // 0x0
+ }
+
+ public abstract static class MediaRouter.Callback {
+ ctor public MediaRouter.Callback();
+ method public void onProviderAdded(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onProviderChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onProviderRemoved(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onRouteAdded(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRoutePresentationDisplayChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteRemoved(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @Deprecated public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int);
+ method public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @Deprecated public void onRouteUnselected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteUnselected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int);
+ method public void onRouteVolumeChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ }
+
+ public abstract static class MediaRouter.ControlRequestCallback {
+ ctor public MediaRouter.ControlRequestCallback();
+ method public void onError(String?, android.os.Bundle?);
+ method public void onResult(android.os.Bundle?);
+ }
+
+ public static interface MediaRouter.OnPrepareTransferListener {
+ method @MainThread public com.google.common.util.concurrent.ListenableFuture<java.lang.Void!>? onPrepareTransfer(androidx.mediarouter.media.MediaRouter.RouteInfo, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ }
+
+ public static final class MediaRouter.ProviderInfo {
+ method public android.content.ComponentName getComponentName();
+ method public String getPackageName();
+ method @MainThread public androidx.mediarouter.media.MediaRouteProvider getProviderInstance();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!> getRoutes();
+ }
+
+ public static class MediaRouter.RouteInfo {
+ method public boolean canDisconnect();
+ method public int getConnectionState();
+ method public java.util.List<android.content.IntentFilter!> getControlFilters();
+ method public String? getDescription();
+ method public int getDeviceType();
+ method public android.os.Bundle? getExtras();
+ method public android.net.Uri? getIconUri();
+ method public String getId();
+ method public String getName();
+ method public int getPlaybackStream();
+ method public int getPlaybackType();
+ method @MainThread public android.view.Display? getPresentationDisplay();
+ method public androidx.mediarouter.media.MediaRouter.ProviderInfo getProvider();
+ method public android.content.IntentSender? getSettingsIntent();
+ method public int getVolume();
+ method public int getVolumeHandling();
+ method public int getVolumeMax();
+ method @MainThread public boolean isBluetooth();
+ method @Deprecated public boolean isConnecting();
+ method @MainThread public boolean isDefault();
+ method public boolean isDeviceSpeaker();
+ method public boolean isEnabled();
+ method @MainThread public boolean isSelected();
+ method @MainThread public boolean matchesSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method @MainThread public void requestSetVolume(int);
+ method @MainThread public void requestUpdateVolume(int);
+ method @MainThread public void select();
+ method @MainThread public void sendControlRequest(android.content.Intent, androidx.mediarouter.media.MediaRouter.ControlRequestCallback?);
+ method @MainThread public boolean supportsControlAction(String, String);
+ method @MainThread public boolean supportsControlCategory(String);
+ method @MainThread public boolean supportsControlRequest(android.content.Intent);
+ field public static final int CONNECTION_STATE_CONNECTED = 2; // 0x2
+ field public static final int CONNECTION_STATE_CONNECTING = 1; // 0x1
+ field public static final int CONNECTION_STATE_DISCONNECTED = 0; // 0x0
+ field public static final int DEVICE_TYPE_AUDIO_VIDEO_RECEIVER = 4; // 0x4
+ field public static final int DEVICE_TYPE_CAR = 9; // 0x9
+ field public static final int DEVICE_TYPE_COMPUTER = 7; // 0x7
+ field public static final int DEVICE_TYPE_GAME_CONSOLE = 8; // 0x8
+ field public static final int DEVICE_TYPE_GROUP = 1000; // 0x3e8
+ field public static final int DEVICE_TYPE_SMARTWATCH = 10; // 0xa
+ field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2
+ field public static final int DEVICE_TYPE_TABLET = 5; // 0x5
+ field public static final int DEVICE_TYPE_TABLET_DOCKED = 6; // 0x6
+ field public static final int DEVICE_TYPE_TV = 1; // 0x1
+ field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0
+ field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1
+ field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0
+ field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1
+ }
+
+ public class MediaRouterParams {
+ method public int getDialogType();
+ method public boolean isMediaTransferReceiverEnabled();
+ method public boolean isOutputSwitcherEnabled();
+ method public boolean isTransferToLocalEnabled();
+ field public static final int DIALOG_TYPE_DEFAULT = 1; // 0x1
+ field public static final int DIALOG_TYPE_DYNAMIC_GROUP = 2; // 0x2
+ field public static final String ENABLE_GROUP_VOLUME_UX = "androidx.mediarouter.media.MediaRouterParams.ENABLE_GROUP_VOLUME_UX";
+ }
+
+ public static final class MediaRouterParams.Builder {
+ ctor public MediaRouterParams.Builder();
+ ctor public MediaRouterParams.Builder(androidx.mediarouter.media.MediaRouterParams);
+ method public androidx.mediarouter.media.MediaRouterParams build();
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setDialogType(int);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setMediaTransferReceiverEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setOutputSwitcherEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setTransferToLocalEnabled(boolean);
+ }
+
+ public final class MediaSessionStatus {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaSessionStatus? fromBundle(android.os.Bundle?);
+ method public android.os.Bundle? getExtras();
+ method public int getSessionState();
+ method public long getTimestamp();
+ method public boolean isQueuePaused();
+ field public static final int SESSION_STATE_ACTIVE = 0; // 0x0
+ field public static final int SESSION_STATE_ENDED = 1; // 0x1
+ field public static final int SESSION_STATE_INVALIDATED = 2; // 0x2
+ }
+
+ public static final class MediaSessionStatus.Builder {
+ ctor public MediaSessionStatus.Builder(androidx.mediarouter.media.MediaSessionStatus);
+ ctor public MediaSessionStatus.Builder(int);
+ method public androidx.mediarouter.media.MediaSessionStatus build();
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setQueuePaused(boolean);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setSessionState(int);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setTimestamp(long);
+ }
+
+ public final class MediaTransferReceiver extends android.content.BroadcastReceiver {
+ ctor public MediaTransferReceiver();
+ method public void onReceive(android.content.Context, android.content.Intent);
+ }
+
+ public class RemotePlaybackClient {
+ ctor public RemotePlaybackClient(android.content.Context, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void endSession(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void enqueue(android.net.Uri, String?, android.os.Bundle?, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public String? getSessionId();
+ method public void getSessionStatus(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void getStatus(String, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public boolean hasSession();
+ method public boolean isMessagingSupported();
+ method public boolean isQueuingSupported();
+ method public boolean isRemotePlaybackSupported();
+ method public boolean isSessionManagementSupported();
+ method public void pause(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void play(android.net.Uri, String?, android.os.Bundle?, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void release();
+ method public void remove(String, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void resume(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void seek(String, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void sendMessage(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void setOnMessageReceivedListener(androidx.mediarouter.media.RemotePlaybackClient.OnMessageReceivedListener?);
+ method public void setSessionId(String?);
+ method public void setStatusCallback(androidx.mediarouter.media.RemotePlaybackClient.StatusCallback?);
+ method public void startSession(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void stop(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ }
+
+ public abstract static class RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.ActionCallback();
+ method public void onError(String?, int, android.os.Bundle?);
+ }
+
+ public abstract static class RemotePlaybackClient.ItemActionCallback extends androidx.mediarouter.media.RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.ItemActionCallback();
+ method public void onResult(android.os.Bundle, String, androidx.mediarouter.media.MediaSessionStatus?, String, androidx.mediarouter.media.MediaItemStatus);
+ }
+
+ public static interface RemotePlaybackClient.OnMessageReceivedListener {
+ method public void onMessageReceived(String, android.os.Bundle?);
+ }
+
+ public abstract static class RemotePlaybackClient.SessionActionCallback extends androidx.mediarouter.media.RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.SessionActionCallback();
+ method public void onResult(android.os.Bundle, String, androidx.mediarouter.media.MediaSessionStatus?);
+ }
+
+ public abstract static class RemotePlaybackClient.StatusCallback {
+ ctor public RemotePlaybackClient.StatusCallback();
+ method public void onItemStatusChanged(android.os.Bundle?, String, androidx.mediarouter.media.MediaSessionStatus?, String, androidx.mediarouter.media.MediaItemStatus);
+ method public void onSessionChanged(String?);
+ method public void onSessionStatusChanged(android.os.Bundle?, String, androidx.mediarouter.media.MediaSessionStatus?);
+ }
+
+ public final class RouteListingPreference {
+ method public java.util.List<androidx.mediarouter.media.RouteListingPreference.Item!> getItems();
+ method public android.content.ComponentName? getLinkedItemComponentName();
+ method public boolean getUseSystemOrdering();
+ field public static final String ACTION_TRANSFER_MEDIA = "android.media.action.TRANSFER_MEDIA";
+ field public static final String EXTRA_ROUTE_ID = "android.media.extra.ROUTE_ID";
+ }
+
+ public static final class RouteListingPreference.Builder {
+ ctor public RouteListingPreference.Builder();
+ method public androidx.mediarouter.media.RouteListingPreference build();
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setItems(java.util.List<androidx.mediarouter.media.RouteListingPreference.Item!>);
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setLinkedItemComponentName(android.content.ComponentName?);
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setUseSystemOrdering(boolean);
+ }
+
+ public static final class RouteListingPreference.Item {
+ method public CharSequence? getCustomSubtextMessage();
+ method public int getFlags();
+ method public String getRouteId();
+ method public int getSelectionBehavior();
+ method public int getSubText();
+ field public static final int FLAG_ONGOING_SESSION = 1; // 0x1
+ field public static final int FLAG_ONGOING_SESSION_MANAGED = 2; // 0x2
+ field public static final int FLAG_SUGGESTED = 4; // 0x4
+ field public static final int SELECTION_BEHAVIOR_GO_TO_APP = 2; // 0x2
+ field public static final int SELECTION_BEHAVIOR_NONE = 0; // 0x0
+ field public static final int SELECTION_BEHAVIOR_TRANSFER = 1; // 0x1
+ field public static final int SUBTEXT_AD_ROUTING_DISALLOWED = 4; // 0x4
+ field public static final int SUBTEXT_CUSTOM = 10000; // 0x2710
+ field public static final int SUBTEXT_DEVICE_LOW_POWER = 5; // 0x5
+ field public static final int SUBTEXT_DOWNLOADED_CONTENT_ROUTING_DISALLOWED = 3; // 0x3
+ field public static final int SUBTEXT_ERROR_UNKNOWN = 1; // 0x1
+ field public static final int SUBTEXT_NONE = 0; // 0x0
+ field public static final int SUBTEXT_SUBSCRIPTION_REQUIRED = 2; // 0x2
+ field public static final int SUBTEXT_TRACK_UNSUPPORTED = 7; // 0x7
+ field public static final int SUBTEXT_UNAUTHORIZED = 6; // 0x6
+ }
+
+ public static final class RouteListingPreference.Item.Builder {
+ ctor public RouteListingPreference.Item.Builder(String);
+ method public androidx.mediarouter.media.RouteListingPreference.Item build();
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setCustomSubtextMessage(CharSequence?);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setFlags(int);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setSelectionBehavior(int);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setSubText(int);
+ }
+
+}
+
diff --git a/mediarouter/mediarouter/api/res-1.6.0-beta01.txt b/mediarouter/mediarouter/api/res-1.6.0-beta01.txt
new file mode 100644
index 0000000..620c3fe
--- /dev/null
+++ b/mediarouter/mediarouter/api/res-1.6.0-beta01.txt
@@ -0,0 +1,4 @@
+dimen mediarouter_chooser_list_item_padding_bottom
+dimen mediarouter_chooser_list_item_padding_end
+dimen mediarouter_chooser_list_item_padding_start
+dimen mediarouter_chooser_list_item_padding_top
diff --git a/mediarouter/mediarouter/api/restricted_1.6.0-beta01.txt b/mediarouter/mediarouter/api/restricted_1.6.0-beta01.txt
new file mode 100644
index 0000000..00e0b0a
--- /dev/null
+++ b/mediarouter/mediarouter/api/restricted_1.6.0-beta01.txt
@@ -0,0 +1,621 @@
+// Signature format: 4.0
+package androidx.mediarouter.app {
+
+ public class MediaRouteActionProvider extends androidx.core.view.ActionProvider {
+ ctor public MediaRouteActionProvider(android.content.Context);
+ method @Deprecated public void enableDynamicGroup();
+ method public androidx.mediarouter.app.MediaRouteDialogFactory getDialogFactory();
+ method public androidx.mediarouter.app.MediaRouteButton? getMediaRouteButton();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public android.view.View onCreateActionView();
+ method public androidx.mediarouter.app.MediaRouteButton onCreateMediaRouteButton();
+ method @Deprecated public void setAlwaysVisible(boolean);
+ method public void setDialogFactory(androidx.mediarouter.app.MediaRouteDialogFactory);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteButton extends android.view.View {
+ ctor public MediaRouteButton(android.content.Context);
+ ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet?);
+ ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet?, int);
+ method @Deprecated public void enableDynamicGroup();
+ method public androidx.mediarouter.app.MediaRouteDialogFactory getDialogFactory();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public void onAttachedToWindow();
+ method public void onDetachedFromWindow();
+ method @Deprecated public void setAlwaysVisible(boolean);
+ method public void setDialogFactory(androidx.mediarouter.app.MediaRouteDialogFactory);
+ method public void setRemoteIndicatorDrawable(android.graphics.drawable.Drawable?);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method public boolean showDialog();
+ }
+
+ public class MediaRouteChooserDialog extends androidx.appcompat.app.AppCompatDialog {
+ ctor public MediaRouteChooserDialog(android.content.Context);
+ ctor public MediaRouteChooserDialog(android.content.Context, int);
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public boolean onFilterRoute(androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onFilterRoutes(java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!>);
+ method public void refreshRoutes();
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteChooserDialogFragment extends androidx.fragment.app.DialogFragment {
+ ctor public MediaRouteChooserDialogFragment();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public androidx.mediarouter.app.MediaRouteChooserDialog onCreateChooserDialog(android.content.Context, android.os.Bundle?);
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public class MediaRouteControllerDialog extends androidx.appcompat.app.AlertDialog {
+ ctor public MediaRouteControllerDialog(android.content.Context);
+ ctor public MediaRouteControllerDialog(android.content.Context, int);
+ method public android.view.View? getMediaControlView();
+ method public android.support.v4.media.session.MediaSessionCompat.Token? getMediaSession();
+ method public androidx.mediarouter.media.MediaRouter.RouteInfo getRoute();
+ method public boolean isVolumeControlEnabled();
+ method public android.view.View? onCreateMediaControlView(android.os.Bundle?);
+ method public void setVolumeControlEnabled(boolean);
+ }
+
+ public class MediaRouteControllerDialogFragment extends androidx.fragment.app.DialogFragment {
+ ctor public MediaRouteControllerDialogFragment();
+ method public androidx.mediarouter.app.MediaRouteControllerDialog onCreateControllerDialog(android.content.Context, android.os.Bundle?);
+ }
+
+ public class MediaRouteDialogFactory {
+ ctor public MediaRouteDialogFactory();
+ method public static androidx.mediarouter.app.MediaRouteDialogFactory getDefault();
+ method public androidx.mediarouter.app.MediaRouteChooserDialogFragment onCreateChooserDialogFragment();
+ method public androidx.mediarouter.app.MediaRouteControllerDialogFragment onCreateControllerDialogFragment();
+ }
+
+ public class MediaRouteDiscoveryFragment extends androidx.fragment.app.Fragment {
+ ctor public MediaRouteDiscoveryFragment();
+ method public androidx.mediarouter.media.MediaRouter getMediaRouter();
+ method public androidx.mediarouter.media.MediaRouteSelector getRouteSelector();
+ method public androidx.mediarouter.media.MediaRouter.Callback? onCreateCallback();
+ method public int onPrepareCallbackFlags();
+ method public void setRouteSelector(androidx.mediarouter.media.MediaRouteSelector);
+ }
+
+ public final class SystemOutputSwitcherDialogController {
+ method public static boolean showDialog(android.content.Context);
+ }
+
+}
+
+package androidx.mediarouter.media {
+
+ public final class MediaControlIntent {
+ field public static final String ACTION_END_SESSION = "android.media.intent.action.END_SESSION";
+ field public static final String ACTION_ENQUEUE = "android.media.intent.action.ENQUEUE";
+ field public static final String ACTION_GET_SESSION_STATUS = "android.media.intent.action.GET_SESSION_STATUS";
+ field public static final String ACTION_GET_STATUS = "android.media.intent.action.GET_STATUS";
+ field public static final String ACTION_PAUSE = "android.media.intent.action.PAUSE";
+ field public static final String ACTION_PLAY = "android.media.intent.action.PLAY";
+ field public static final String ACTION_REMOVE = "android.media.intent.action.REMOVE";
+ field public static final String ACTION_RESUME = "android.media.intent.action.RESUME";
+ field public static final String ACTION_SEEK = "android.media.intent.action.SEEK";
+ field public static final String ACTION_SEND_MESSAGE = "android.media.intent.action.SEND_MESSAGE";
+ field public static final String ACTION_START_SESSION = "android.media.intent.action.START_SESSION";
+ field public static final String ACTION_STOP = "android.media.intent.action.STOP";
+ field public static final String CATEGORY_LIVE_AUDIO = "android.media.intent.category.LIVE_AUDIO";
+ field public static final String CATEGORY_LIVE_VIDEO = "android.media.intent.category.LIVE_VIDEO";
+ field public static final String CATEGORY_REMOTE_PLAYBACK = "android.media.intent.category.REMOTE_PLAYBACK";
+ field public static final int ERROR_INVALID_ITEM_ID = 3; // 0x3
+ field public static final int ERROR_INVALID_SESSION_ID = 2; // 0x2
+ field public static final int ERROR_UNKNOWN = 0; // 0x0
+ field public static final int ERROR_UNSUPPORTED_OPERATION = 1; // 0x1
+ field public static final String EXTRA_ERROR_CODE = "android.media.intent.extra.ERROR_CODE";
+ field public static final String EXTRA_ITEM_CONTENT_POSITION = "android.media.intent.extra.ITEM_POSITION";
+ field public static final String EXTRA_ITEM_HTTP_HEADERS = "android.media.intent.extra.HTTP_HEADERS";
+ field public static final String EXTRA_ITEM_ID = "android.media.intent.extra.ITEM_ID";
+ field public static final String EXTRA_ITEM_METADATA = "android.media.intent.extra.ITEM_METADATA";
+ field public static final String EXTRA_ITEM_STATUS = "android.media.intent.extra.ITEM_STATUS";
+ field public static final String EXTRA_ITEM_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.ITEM_STATUS_UPDATE_RECEIVER";
+ field public static final String EXTRA_MESSAGE = "android.media.intent.extra.MESSAGE";
+ field public static final String EXTRA_MESSAGE_RECEIVER = "android.media.intent.extra.MESSAGE_RECEIVER";
+ field public static final String EXTRA_SESSION_ID = "android.media.intent.extra.SESSION_ID";
+ field public static final String EXTRA_SESSION_STATUS = "android.media.intent.extra.SESSION_STATUS";
+ field public static final String EXTRA_SESSION_STATUS_UPDATE_RECEIVER = "android.media.intent.extra.SESSION_STATUS_UPDATE_RECEIVER";
+ }
+
+ public final class MediaItemMetadata {
+ field public static final String KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
+ field public static final String KEY_ALBUM_TITLE = "android.media.metadata.ALBUM_TITLE";
+ field public static final String KEY_ARTIST = "android.media.metadata.ARTIST";
+ field public static final String KEY_ARTWORK_URI = "android.media.metadata.ARTWORK_URI";
+ field public static final String KEY_AUTHOR = "android.media.metadata.AUTHOR";
+ field public static final String KEY_COMPOSER = "android.media.metadata.COMPOSER";
+ field public static final String KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
+ field public static final String KEY_DURATION = "android.media.metadata.DURATION";
+ field public static final String KEY_TITLE = "android.media.metadata.TITLE";
+ field public static final String KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
+ field public static final String KEY_YEAR = "android.media.metadata.YEAR";
+ }
+
+ public final class MediaItemStatus {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaItemStatus? fromBundle(android.os.Bundle?);
+ method public long getContentDuration();
+ method public long getContentPosition();
+ method public android.os.Bundle? getExtras();
+ method public int getPlaybackState();
+ method public long getTimestamp();
+ field public static final String EXTRA_HTTP_RESPONSE_HEADERS = "android.media.status.extra.HTTP_RESPONSE_HEADERS";
+ field public static final String EXTRA_HTTP_STATUS_CODE = "android.media.status.extra.HTTP_STATUS_CODE";
+ field public static final int PLAYBACK_STATE_BUFFERING = 3; // 0x3
+ field public static final int PLAYBACK_STATE_CANCELED = 5; // 0x5
+ field public static final int PLAYBACK_STATE_ERROR = 7; // 0x7
+ field public static final int PLAYBACK_STATE_FINISHED = 4; // 0x4
+ field public static final int PLAYBACK_STATE_INVALIDATED = 6; // 0x6
+ field public static final int PLAYBACK_STATE_PAUSED = 2; // 0x2
+ field public static final int PLAYBACK_STATE_PENDING = 0; // 0x0
+ field public static final int PLAYBACK_STATE_PLAYING = 1; // 0x1
+ }
+
+ public static final class MediaItemStatus.Builder {
+ ctor public MediaItemStatus.Builder(androidx.mediarouter.media.MediaItemStatus);
+ ctor public MediaItemStatus.Builder(int);
+ method public androidx.mediarouter.media.MediaItemStatus build();
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setContentDuration(long);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setContentPosition(long);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setPlaybackState(int);
+ method public androidx.mediarouter.media.MediaItemStatus.Builder setTimestamp(long);
+ }
+
+ public final class MediaRouteDescriptor {
+ method public android.os.Bundle asBundle();
+ method public boolean canDisconnectAndKeepPlaying();
+ method public static androidx.mediarouter.media.MediaRouteDescriptor? fromBundle(android.os.Bundle?);
+ method public java.util.Set<java.lang.String!> getAllowedPackages();
+ method public int getConnectionState();
+ method public java.util.List<android.content.IntentFilter!> getControlFilters();
+ method public java.util.Set<java.lang.String!> getDeduplicationIds();
+ method public String? getDescription();
+ method public int getDeviceType();
+ method public android.os.Bundle? getExtras();
+ method public android.net.Uri? getIconUri();
+ method public String getId();
+ method public String getName();
+ method public int getPlaybackStream();
+ method public int getPlaybackType();
+ method public int getPresentationDisplayId();
+ method public android.content.IntentSender? getSettingsActivity();
+ method public int getVolume();
+ method public int getVolumeHandling();
+ method public int getVolumeMax();
+ method @Deprecated public boolean isConnecting();
+ method public boolean isDynamicGroupRoute();
+ method public boolean isEnabled();
+ method public boolean isValid();
+ method public boolean isVisibilityPublic();
+ }
+
+ public static final class MediaRouteDescriptor.Builder {
+ ctor public MediaRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteDescriptor);
+ ctor public MediaRouteDescriptor.Builder(String, String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder addControlFilter(android.content.IntentFilter);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder addControlFilters(java.util.Collection<android.content.IntentFilter!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder clearControlFilters();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setCanDisconnect(boolean);
+ method @Deprecated public androidx.mediarouter.media.MediaRouteDescriptor.Builder setConnecting(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setConnectionState(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDeduplicationIds(java.util.Set<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDescription(String?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setDeviceType(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setIconUri(android.net.Uri);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setId(String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setIsDynamicGroupRoute(boolean);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setName(String);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPlaybackStream(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPlaybackType(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setPresentationDisplayId(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setSettingsActivity(android.content.IntentSender?);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVisibilityPublic();
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVisibilityRestricted(java.util.Set<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolume(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolumeHandling(int);
+ method public androidx.mediarouter.media.MediaRouteDescriptor.Builder setVolumeMax(int);
+ }
+
+ public final class MediaRouteDiscoveryRequest {
+ ctor public MediaRouteDiscoveryRequest(androidx.mediarouter.media.MediaRouteSelector, boolean);
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaRouteDiscoveryRequest? fromBundle(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaRouteSelector getSelector();
+ method public boolean isActiveScan();
+ method public boolean isValid();
+ }
+
+ public abstract class MediaRouteProvider {
+ ctor public MediaRouteProvider(android.content.Context);
+ method public final android.content.Context getContext();
+ method public final androidx.mediarouter.media.MediaRouteProviderDescriptor? getDescriptor();
+ method public final androidx.mediarouter.media.MediaRouteDiscoveryRequest? getDiscoveryRequest();
+ method public final android.os.Handler getHandler();
+ method public final androidx.mediarouter.media.MediaRouteProvider.ProviderMetadata getMetadata();
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController? onCreateDynamicGroupRouteController(String);
+ method public androidx.mediarouter.media.MediaRouteProvider.RouteController? onCreateRouteController(String);
+ method public void onDiscoveryRequestChanged(androidx.mediarouter.media.MediaRouteDiscoveryRequest?);
+ method public final void setCallback(androidx.mediarouter.media.MediaRouteProvider.Callback?);
+ method public final void setDescriptor(androidx.mediarouter.media.MediaRouteProviderDescriptor?);
+ method public final void setDiscoveryRequest(androidx.mediarouter.media.MediaRouteDiscoveryRequest?);
+ }
+
+ public abstract static class MediaRouteProvider.Callback {
+ ctor public MediaRouteProvider.Callback();
+ method public void onDescriptorChanged(androidx.mediarouter.media.MediaRouteProvider, androidx.mediarouter.media.MediaRouteProviderDescriptor?);
+ }
+
+ public abstract static class MediaRouteProvider.DynamicGroupRouteController extends androidx.mediarouter.media.MediaRouteProvider.RouteController {
+ ctor public MediaRouteProvider.DynamicGroupRouteController();
+ method public String? getGroupableSelectionTitle();
+ method public String? getTransferableSectionTitle();
+ method public final void notifyDynamicRoutesChanged(androidx.mediarouter.media.MediaRouteDescriptor, java.util.Collection<androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor!>);
+ method @Deprecated public final void notifyDynamicRoutesChanged(java.util.Collection<androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor!>);
+ method public abstract void onAddMemberRoute(String);
+ method public abstract void onRemoveMemberRoute(String);
+ method public abstract void onUpdateMemberRoutes(java.util.List<java.lang.String!>?);
+ }
+
+ public static final class MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor {
+ method public androidx.mediarouter.media.MediaRouteDescriptor getRouteDescriptor();
+ method public int getSelectionState();
+ method public boolean isGroupable();
+ method public boolean isTransferable();
+ method public boolean isUnselectable();
+ field public static final int SELECTED = 3; // 0x3
+ field public static final int SELECTING = 2; // 0x2
+ field public static final int UNSELECTED = 1; // 0x1
+ field public static final int UNSELECTING = 0; // 0x0
+ }
+
+ public static final class MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder {
+ ctor public MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteDescriptor);
+ ctor public MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder(androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsGroupable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsTransferable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setIsUnselectable(boolean);
+ method public androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor.Builder setSelectionState(int);
+ }
+
+ public static final class MediaRouteProvider.ProviderMetadata {
+ method public android.content.ComponentName getComponentName();
+ method public String getPackageName();
+ }
+
+ public abstract static class MediaRouteProvider.RouteController {
+ ctor public MediaRouteProvider.RouteController();
+ method public boolean onControlRequest(android.content.Intent, androidx.mediarouter.media.MediaRouter.ControlRequestCallback?);
+ method public void onRelease();
+ method public void onSelect();
+ method public void onSetVolume(int);
+ method @Deprecated public void onUnselect();
+ method public void onUnselect(int);
+ method public void onUpdateVolume(int);
+ }
+
+ public final class MediaRouteProviderDescriptor {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaRouteProviderDescriptor? fromBundle(android.os.Bundle?);
+ method public java.util.List<androidx.mediarouter.media.MediaRouteDescriptor!> getRoutes();
+ method public boolean isValid();
+ method public boolean supportsDynamicGroupRoute();
+ }
+
+ public static final class MediaRouteProviderDescriptor.Builder {
+ ctor public MediaRouteProviderDescriptor.Builder();
+ ctor public MediaRouteProviderDescriptor.Builder(androidx.mediarouter.media.MediaRouteProviderDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder addRoute(androidx.mediarouter.media.MediaRouteDescriptor);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder addRoutes(java.util.Collection<androidx.mediarouter.media.MediaRouteDescriptor!>);
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor build();
+ method public androidx.mediarouter.media.MediaRouteProviderDescriptor.Builder setSupportsDynamicGroupRoute(boolean);
+ }
+
+ public abstract class MediaRouteProviderService extends android.app.Service {
+ ctor public MediaRouteProviderService();
+ method public androidx.mediarouter.media.MediaRouteProvider? getMediaRouteProvider();
+ method public android.os.IBinder? onBind(android.content.Intent);
+ method public abstract androidx.mediarouter.media.MediaRouteProvider? onCreateMediaRouteProvider();
+ field public static final String SERVICE_INTERFACE = "android.media.MediaRouteProviderService";
+ }
+
+ public final class MediaRouteSelector {
+ method public android.os.Bundle asBundle();
+ method public boolean contains(androidx.mediarouter.media.MediaRouteSelector);
+ method public static androidx.mediarouter.media.MediaRouteSelector? fromBundle(android.os.Bundle?);
+ method public java.util.List<java.lang.String!> getControlCategories();
+ method public boolean hasControlCategory(String?);
+ method public boolean isEmpty();
+ method public boolean isValid();
+ method public boolean matchesControlFilters(java.util.List<android.content.IntentFilter!>?);
+ field public static final androidx.mediarouter.media.MediaRouteSelector! EMPTY;
+ }
+
+ public static final class MediaRouteSelector.Builder {
+ ctor public MediaRouteSelector.Builder();
+ ctor public MediaRouteSelector.Builder(androidx.mediarouter.media.MediaRouteSelector);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addControlCategories(java.util.Collection<java.lang.String!>);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addControlCategory(String);
+ method public androidx.mediarouter.media.MediaRouteSelector.Builder addSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method public androidx.mediarouter.media.MediaRouteSelector build();
+ }
+
+ public final class MediaRouter {
+ method @MainThread public void addCallback(androidx.mediarouter.media.MediaRouteSelector, androidx.mediarouter.media.MediaRouter.Callback);
+ method @MainThread public void addCallback(androidx.mediarouter.media.MediaRouteSelector, androidx.mediarouter.media.MediaRouter.Callback, int);
+ method @MainThread public void addProvider(androidx.mediarouter.media.MediaRouteProvider);
+ method @Deprecated @MainThread public void addRemoteControlClient(Object);
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo? getBluetoothRoute();
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo getDefaultRoute();
+ method @MainThread public static androidx.mediarouter.media.MediaRouter getInstance(android.content.Context);
+ method public android.support.v4.media.session.MediaSessionCompat.Token? getMediaSessionToken();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.ProviderInfo!> getProviders();
+ method @MainThread public androidx.mediarouter.media.MediaRouterParams? getRouterParams();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!> getRoutes();
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo getSelectedRoute();
+ method @MainThread public boolean isRouteAvailable(androidx.mediarouter.media.MediaRouteSelector, int);
+ method @MainThread public void removeCallback(androidx.mediarouter.media.MediaRouter.Callback);
+ method @MainThread public void removeProvider(androidx.mediarouter.media.MediaRouteProvider);
+ method @MainThread public void removeRemoteControlClient(Object);
+ method @MainThread public void selectRoute(androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @MainThread public void setMediaSession(Object?);
+ method @MainThread public void setMediaSessionCompat(android.support.v4.media.session.MediaSessionCompat?);
+ method @MainThread public void setOnPrepareTransferListener(androidx.mediarouter.media.MediaRouter.OnPrepareTransferListener?);
+ method @MainThread public void setRouteListingPreference(androidx.mediarouter.media.RouteListingPreference?);
+ method @MainThread public void setRouterParams(androidx.mediarouter.media.MediaRouterParams?);
+ method @MainThread public void unselect(int);
+ method @MainThread public androidx.mediarouter.media.MediaRouter.RouteInfo updateSelectedRoute(androidx.mediarouter.media.MediaRouteSelector);
+ field public static final int AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE = 1; // 0x1
+ field public static final int AVAILABILITY_FLAG_REQUIRE_MATCH = 2; // 0x2
+ field public static final int CALLBACK_FLAG_FORCE_DISCOVERY = 8; // 0x8
+ field public static final int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN = 1; // 0x1
+ field public static final int CALLBACK_FLAG_REQUEST_DISCOVERY = 4; // 0x4
+ field public static final int CALLBACK_FLAG_UNFILTERED_EVENTS = 2; // 0x2
+ field public static final int UNSELECT_REASON_DISCONNECTED = 1; // 0x1
+ field public static final int UNSELECT_REASON_ROUTE_CHANGED = 3; // 0x3
+ field public static final int UNSELECT_REASON_STOPPED = 2; // 0x2
+ field public static final int UNSELECT_REASON_UNKNOWN = 0; // 0x0
+ }
+
+ public abstract static class MediaRouter.Callback {
+ ctor public MediaRouter.Callback();
+ method public void onProviderAdded(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onProviderChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onProviderRemoved(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.ProviderInfo);
+ method public void onRouteAdded(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRoutePresentationDisplayChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteRemoved(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @Deprecated public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int);
+ method public void onRouteSelected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method @Deprecated public void onRouteUnselected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void onRouteUnselected(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo, int);
+ method public void onRouteVolumeChanged(androidx.mediarouter.media.MediaRouter, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ }
+
+ public abstract static class MediaRouter.ControlRequestCallback {
+ ctor public MediaRouter.ControlRequestCallback();
+ method public void onError(String?, android.os.Bundle?);
+ method public void onResult(android.os.Bundle?);
+ }
+
+ public static interface MediaRouter.OnPrepareTransferListener {
+ method @MainThread public com.google.common.util.concurrent.ListenableFuture<java.lang.Void!>? onPrepareTransfer(androidx.mediarouter.media.MediaRouter.RouteInfo, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ }
+
+ public static final class MediaRouter.ProviderInfo {
+ method public android.content.ComponentName getComponentName();
+ method public String getPackageName();
+ method @MainThread public androidx.mediarouter.media.MediaRouteProvider getProviderInstance();
+ method @MainThread public java.util.List<androidx.mediarouter.media.MediaRouter.RouteInfo!> getRoutes();
+ }
+
+ public static class MediaRouter.RouteInfo {
+ method public boolean canDisconnect();
+ method public int getConnectionState();
+ method public java.util.List<android.content.IntentFilter!> getControlFilters();
+ method public String? getDescription();
+ method public int getDeviceType();
+ method public android.os.Bundle? getExtras();
+ method public android.net.Uri? getIconUri();
+ method public String getId();
+ method public String getName();
+ method public int getPlaybackStream();
+ method public int getPlaybackType();
+ method @MainThread public android.view.Display? getPresentationDisplay();
+ method public androidx.mediarouter.media.MediaRouter.ProviderInfo getProvider();
+ method public android.content.IntentSender? getSettingsIntent();
+ method public int getVolume();
+ method public int getVolumeHandling();
+ method public int getVolumeMax();
+ method @MainThread public boolean isBluetooth();
+ method @Deprecated public boolean isConnecting();
+ method @MainThread public boolean isDefault();
+ method public boolean isDeviceSpeaker();
+ method public boolean isEnabled();
+ method @MainThread public boolean isSelected();
+ method @MainThread public boolean matchesSelector(androidx.mediarouter.media.MediaRouteSelector);
+ method @MainThread public void requestSetVolume(int);
+ method @MainThread public void requestUpdateVolume(int);
+ method @MainThread public void select();
+ method @MainThread public void sendControlRequest(android.content.Intent, androidx.mediarouter.media.MediaRouter.ControlRequestCallback?);
+ method @MainThread public boolean supportsControlAction(String, String);
+ method @MainThread public boolean supportsControlCategory(String);
+ method @MainThread public boolean supportsControlRequest(android.content.Intent);
+ field public static final int CONNECTION_STATE_CONNECTED = 2; // 0x2
+ field public static final int CONNECTION_STATE_CONNECTING = 1; // 0x1
+ field public static final int CONNECTION_STATE_DISCONNECTED = 0; // 0x0
+ field public static final int DEVICE_TYPE_AUDIO_VIDEO_RECEIVER = 4; // 0x4
+ field public static final int DEVICE_TYPE_CAR = 9; // 0x9
+ field public static final int DEVICE_TYPE_COMPUTER = 7; // 0x7
+ field public static final int DEVICE_TYPE_GAME_CONSOLE = 8; // 0x8
+ field public static final int DEVICE_TYPE_GROUP = 1000; // 0x3e8
+ field public static final int DEVICE_TYPE_SMARTWATCH = 10; // 0xa
+ field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2
+ field public static final int DEVICE_TYPE_TABLET = 5; // 0x5
+ field public static final int DEVICE_TYPE_TABLET_DOCKED = 6; // 0x6
+ field public static final int DEVICE_TYPE_TV = 1; // 0x1
+ field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0
+ field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1
+ field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0
+ field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1
+ }
+
+ public class MediaRouterParams {
+ method public int getDialogType();
+ method public boolean isMediaTransferReceiverEnabled();
+ method public boolean isOutputSwitcherEnabled();
+ method public boolean isTransferToLocalEnabled();
+ field public static final int DIALOG_TYPE_DEFAULT = 1; // 0x1
+ field public static final int DIALOG_TYPE_DYNAMIC_GROUP = 2; // 0x2
+ field public static final String ENABLE_GROUP_VOLUME_UX = "androidx.mediarouter.media.MediaRouterParams.ENABLE_GROUP_VOLUME_UX";
+ }
+
+ public static final class MediaRouterParams.Builder {
+ ctor public MediaRouterParams.Builder();
+ ctor public MediaRouterParams.Builder(androidx.mediarouter.media.MediaRouterParams);
+ method public androidx.mediarouter.media.MediaRouterParams build();
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setDialogType(int);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setMediaTransferReceiverEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setOutputSwitcherEnabled(boolean);
+ method public androidx.mediarouter.media.MediaRouterParams.Builder setTransferToLocalEnabled(boolean);
+ }
+
+ public final class MediaSessionStatus {
+ method public android.os.Bundle asBundle();
+ method public static androidx.mediarouter.media.MediaSessionStatus? fromBundle(android.os.Bundle?);
+ method public android.os.Bundle? getExtras();
+ method public int getSessionState();
+ method public long getTimestamp();
+ method public boolean isQueuePaused();
+ field public static final int SESSION_STATE_ACTIVE = 0; // 0x0
+ field public static final int SESSION_STATE_ENDED = 1; // 0x1
+ field public static final int SESSION_STATE_INVALIDATED = 2; // 0x2
+ }
+
+ public static final class MediaSessionStatus.Builder {
+ ctor public MediaSessionStatus.Builder(androidx.mediarouter.media.MediaSessionStatus);
+ ctor public MediaSessionStatus.Builder(int);
+ method public androidx.mediarouter.media.MediaSessionStatus build();
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setExtras(android.os.Bundle?);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setQueuePaused(boolean);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setSessionState(int);
+ method public androidx.mediarouter.media.MediaSessionStatus.Builder setTimestamp(long);
+ }
+
+ public final class MediaTransferReceiver extends android.content.BroadcastReceiver {
+ ctor public MediaTransferReceiver();
+ method public void onReceive(android.content.Context, android.content.Intent);
+ }
+
+ public class RemotePlaybackClient {
+ ctor public RemotePlaybackClient(android.content.Context, androidx.mediarouter.media.MediaRouter.RouteInfo);
+ method public void endSession(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void enqueue(android.net.Uri, String?, android.os.Bundle?, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public String? getSessionId();
+ method public void getSessionStatus(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void getStatus(String, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public boolean hasSession();
+ method public boolean isMessagingSupported();
+ method public boolean isQueuingSupported();
+ method public boolean isRemotePlaybackSupported();
+ method public boolean isSessionManagementSupported();
+ method public void pause(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void play(android.net.Uri, String?, android.os.Bundle?, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void release();
+ method public void remove(String, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void resume(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void seek(String, long, android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback?);
+ method public void sendMessage(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void setOnMessageReceivedListener(androidx.mediarouter.media.RemotePlaybackClient.OnMessageReceivedListener?);
+ method public void setSessionId(String?);
+ method public void setStatusCallback(androidx.mediarouter.media.RemotePlaybackClient.StatusCallback?);
+ method public void startSession(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ method public void stop(android.os.Bundle?, androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback?);
+ }
+
+ public abstract static class RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.ActionCallback();
+ method public void onError(String?, int, android.os.Bundle?);
+ }
+
+ public abstract static class RemotePlaybackClient.ItemActionCallback extends androidx.mediarouter.media.RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.ItemActionCallback();
+ method public void onResult(android.os.Bundle, String, androidx.mediarouter.media.MediaSessionStatus?, String, androidx.mediarouter.media.MediaItemStatus);
+ }
+
+ public static interface RemotePlaybackClient.OnMessageReceivedListener {
+ method public void onMessageReceived(String, android.os.Bundle?);
+ }
+
+ public abstract static class RemotePlaybackClient.SessionActionCallback extends androidx.mediarouter.media.RemotePlaybackClient.ActionCallback {
+ ctor public RemotePlaybackClient.SessionActionCallback();
+ method public void onResult(android.os.Bundle, String, androidx.mediarouter.media.MediaSessionStatus?);
+ }
+
+ public abstract static class RemotePlaybackClient.StatusCallback {
+ ctor public RemotePlaybackClient.StatusCallback();
+ method public void onItemStatusChanged(android.os.Bundle?, String, androidx.mediarouter.media.MediaSessionStatus?, String, androidx.mediarouter.media.MediaItemStatus);
+ method public void onSessionChanged(String?);
+ method public void onSessionStatusChanged(android.os.Bundle?, String, androidx.mediarouter.media.MediaSessionStatus?);
+ }
+
+ public final class RouteListingPreference {
+ method public java.util.List<androidx.mediarouter.media.RouteListingPreference.Item!> getItems();
+ method public android.content.ComponentName? getLinkedItemComponentName();
+ method public boolean getUseSystemOrdering();
+ field public static final String ACTION_TRANSFER_MEDIA = "android.media.action.TRANSFER_MEDIA";
+ field public static final String EXTRA_ROUTE_ID = "android.media.extra.ROUTE_ID";
+ }
+
+ public static final class RouteListingPreference.Builder {
+ ctor public RouteListingPreference.Builder();
+ method public androidx.mediarouter.media.RouteListingPreference build();
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setItems(java.util.List<androidx.mediarouter.media.RouteListingPreference.Item!>);
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setLinkedItemComponentName(android.content.ComponentName?);
+ method public androidx.mediarouter.media.RouteListingPreference.Builder setUseSystemOrdering(boolean);
+ }
+
+ public static final class RouteListingPreference.Item {
+ method public CharSequence? getCustomSubtextMessage();
+ method public int getFlags();
+ method public String getRouteId();
+ method public int getSelectionBehavior();
+ method public int getSubText();
+ field public static final int FLAG_ONGOING_SESSION = 1; // 0x1
+ field public static final int FLAG_ONGOING_SESSION_MANAGED = 2; // 0x2
+ field public static final int FLAG_SUGGESTED = 4; // 0x4
+ field public static final int SELECTION_BEHAVIOR_GO_TO_APP = 2; // 0x2
+ field public static final int SELECTION_BEHAVIOR_NONE = 0; // 0x0
+ field public static final int SELECTION_BEHAVIOR_TRANSFER = 1; // 0x1
+ field public static final int SUBTEXT_AD_ROUTING_DISALLOWED = 4; // 0x4
+ field public static final int SUBTEXT_CUSTOM = 10000; // 0x2710
+ field public static final int SUBTEXT_DEVICE_LOW_POWER = 5; // 0x5
+ field public static final int SUBTEXT_DOWNLOADED_CONTENT_ROUTING_DISALLOWED = 3; // 0x3
+ field public static final int SUBTEXT_ERROR_UNKNOWN = 1; // 0x1
+ field public static final int SUBTEXT_NONE = 0; // 0x0
+ field public static final int SUBTEXT_SUBSCRIPTION_REQUIRED = 2; // 0x2
+ field public static final int SUBTEXT_TRACK_UNSUPPORTED = 7; // 0x7
+ field public static final int SUBTEXT_UNAUTHORIZED = 6; // 0x6
+ }
+
+ public static final class RouteListingPreference.Item.Builder {
+ ctor public RouteListingPreference.Item.Builder(String);
+ method public androidx.mediarouter.media.RouteListingPreference.Item build();
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setCustomSubtextMessage(CharSequence?);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setFlags(int);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setSelectionBehavior(int);
+ method public androidx.mediarouter.media.RouteListingPreference.Item.Builder setSubText(int);
+ }
+
+}
+
diff --git a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/SystemOutputSwitcherDialogController.java b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/SystemOutputSwitcherDialogController.java
index 3e74545..47c6bf5 100644
--- a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/SystemOutputSwitcherDialogController.java
+++ b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/app/SystemOutputSwitcherDialogController.java
@@ -43,11 +43,11 @@
private static final String PACKAGE_NAME_SYSTEM_UI =
"com.android.systemui";
- /** Output switcher dialog intent action in Android S. **/
+ /** Output switcher dialog intent action in Android S. */
private static final String OUTPUT_SWITCHER_INTENT_ACTION_ANDROID_S =
"com.android.systemui.action.LAUNCH_MEDIA_OUTPUT_DIALOG";
- /** Output switcher dialog intent action in Android R. **/
+ /** Output switcher dialog intent action in Android R. */
private static final String OUTPUT_SWITCHER_INTENT_ACTION_ANDROID_R =
"com.android.settings.panel.action.MEDIA_OUTPUT";
diff --git a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/media/MediaRoute2Provider.java b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/media/MediaRoute2Provider.java
index f41e069..989153e 100644
--- a/mediarouter/mediarouter/src/main/java/androidx/mediarouter/media/MediaRoute2Provider.java
+++ b/mediarouter/mediarouter/src/main/java/androidx/mediarouter/media/MediaRoute2Provider.java
@@ -47,9 +47,7 @@
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
-import androidx.core.os.BuildCompat;
import androidx.mediarouter.R;
import androidx.mediarouter.media.MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor;
import androidx.mediarouter.media.MediaRouter.ControlRequestCallback;
@@ -83,8 +81,6 @@
private List<MediaRoute2Info> mRoutes = new ArrayList<>();
private Map<String, String> mRouteIdToOriginalRouteIdMap = new ArrayMap<>();
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@SuppressWarnings({"SyntheticAccessor"})
MediaRoute2Provider(@NonNull Context context, @NonNull Callback callback) {
super(context);
@@ -94,7 +90,7 @@
mHandler = new Handler(Looper.getMainLooper());
mHandlerExecutor = mHandler::post;
- if (BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT >= 34) {
mRouteCallback = new RouteCallbackUpsideDownCake();
} else {
mRouteCallback = new RouteCallback();
diff --git a/mediarouter/mediarouter/src/main/res/values-af/strings.xml b/mediarouter/mediarouter/src/main/res/values-af/strings.xml
index 135ef9d..e3bcd52 100644
--- a/mediarouter/mediarouter/src/main/res/values-af/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-af/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Speel op \'n groep"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Geen inligting beskikbaar nie"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Geen toestelle beskikbaar nie"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie foon is"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie tablet is"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie TV is"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie horlosie is"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie motor is"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Maak seker dat die ander toestel op dieselfde wi-fi-netwerk as hierdie toestel is"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Kom meer te wete"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Leer hoe om uit te saai"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-am/strings.xml b/mediarouter/mediarouter/src/main/res/values-am/strings.xml
index 77db829..037294c 100644
--- a/mediarouter/mediarouter/src/main/res/values-am/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-am/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"በቡድን ላይ ያጫውቱ"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ምንም መረጃ አይገኝም"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ምንም መሣሪያዎች አይገኙም"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ሌላኛው መሣሪያ ከዚህ ስልክ ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ሌላኛው መሣሪያ ከዚህ ጡባዊ ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ሌላኛው መሣሪያ ከዚህ ቲቪ ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ሌላኛው መሣሪያ ከዚህ የእጅ ሰዓት ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ሌላኛው መሣሪያ ከዚህ መኪና ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ሌላኛው መሣሪያ ከዚህ መሣሪያ ጋር አንድ ዓይነት የWi-Fi አውታረ መረብ ላይ መሆኑን ያረጋግጡ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"የበለጠ ለመረዳት"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"እንዴት cast እንደሚያደርጉ ይወቁ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ar/strings.xml b/mediarouter/mediarouter/src/main/res/values-ar/strings.xml
index a9d0a25..76d00dc 100644
--- a/mediarouter/mediarouter/src/main/res/values-ar/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ar/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"تشغيل على مجموعة من الأجهزة"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"لا تتوفر أي معلومات"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"لا تتوفّر أي أجهزة"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"تأكَّد من أنّ الجهاز الآخر وهذا الهاتف متّصلان بشبكة Wi-Fi نفسها."</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"تأكَّد من أنّ الجهاز الآخر وهذا الجهاز اللوحي متّصلان بشبكة Wi-Fi نفسها."</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"تأكَّد من أنّ الجهاز الآخر وهذا التلفزيون متّصلان بشبكة Wi-Fi نفسها."</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"تأكَّد من أنّ الجهاز الآخر وهذه الساعة متّصلان بشبكة Wi-Fi نفسها."</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"تأكَّد من أنّ الجهاز الآخر وهذه السيارة متّصلان بشبكة Wi-Fi نفسها."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"تأكَّد من أنّ الجهاز الآخر وهذا الجهاز متّصلان بشبكة Wi-Fi نفسها."</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"مزيد من المعلومات"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"التعرُّف على كيفية البثّ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-as/strings.xml b/mediarouter/mediarouter/src/main/res/values-as/strings.xml
index 8e5c400..863456a 100644
--- a/mediarouter/mediarouter/src/main/res/values-as/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-as/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"কোনো এটা গোটত প্লে’ কৰক"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"কোনো তথ্য নাই"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"কোনো ডিভাইচ উপলব্ধ নহয়"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"আনটো ডিভাইচ এই ফ’নটোৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"আনটো ডিভাইচ এই টেবলেটটোৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"আনটো ডিভাইচ এই টিভিটোৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"আনটো ডিভাইচ এই ঘড়ীটোৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"আনটো ডিভাইচ এই গাড়ীখনৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"আনটো ডিভাইচ এই ডিভাইচটোৰ সৈতে একেটা ৱাই-ফাই নেটৱৰ্কতে থকাটো নিশ্চিত কৰক"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"অধিক জানক"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"কেনেকৈ কাষ্ট কৰিব লাগে জানক"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-az/strings.xml b/mediarouter/mediarouter/src/main/res/values-az/strings.xml
index a79017f..31b98ac 100644
--- a/mediarouter/mediarouter/src/main/res/values-az/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-az/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Qrupda oxudun"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Əlçatan məlumat yoxdur"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Əlçatan cihaz yoxdur"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Digər cihaz bu telefon ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Digər cihaz bu planşet ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Digər cihaz bu tv ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Digər cihaz bu saat ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Digər cihaz bu avtomobil ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Digər cihaz bu cihaz ilə eyni Wi-Fi şəbəkəsində olmalıdır"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Ətraflı məlumat"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Yayım qaydasını öyrənin"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-b+sr+Latn/strings.xml b/mediarouter/mediarouter/src/main/res/values-b+sr+Latn/strings.xml
index 783f95f..1101e83 100644
--- a/mediarouter/mediarouter/src/main/res/values-b+sr+Latn/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-b+sr+Latn/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Puštajte u grupi"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nema dostupnih informacija"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nije dostupan nijedan uređaj"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj tv"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj sat"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj automobil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Uverite se da je drugi uređaj povezan na istu WiFi mrežu kao ovaj uređaj"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saznajte više"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Saznajte kako da prebacujete"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-be/strings.xml b/mediarouter/mediarouter/src/main/res/values-be/strings.xml
index 911084c..d25f79c 100644
--- a/mediarouter/mediarouter/src/main/res/values-be/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-be/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Прайграць на групе прылад"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Інфармацыя адсутнічае"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Няма даступных прылад"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і тэлефон"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і планшэт"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і тэлевізар"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і гадзіннік"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і аўтамабіль"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Упэўніцеся, што другая прылада падключана да той жа сеткі Wi-Fi, што і гэта"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Даведацца больш"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Як пачаць трансляцыю"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-bg/strings.xml b/mediarouter/mediarouter/src/main/res/values-bg/strings.xml
index c58b16f..fdcf70c 100644
--- a/mediarouter/mediarouter/src/main/res/values-bg/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-bg/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Възпроизвеждане в група"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Няма налична информация"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Няма налични устройства"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Уверете се, че телефонът и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Уверете се, че таблетът и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Уверете се, че телевизорът и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Уверете се, че часовникът и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Уверете се, че автомобилът и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Уверете се, че това и другото устройство са свързани с една и съща Wi-Fi мрежа"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Научете повече"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Научете как да предавате"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-bn/strings.xml b/mediarouter/mediarouter/src/main/res/values-bn/strings.xml
index 60d52a0..ed69a3c 100644
--- a/mediarouter/mediarouter/src/main/res/values-bn/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-bn/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"গ্রুপে প্লে করুন"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"কোনও তথ্য নেই"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"কোনও ডিভাইস উপলভ্য নেই"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"এই ফোনটি ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"এই ট্যাবলেট ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"এই টিভি ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"এই ওয়াচ ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"এই গাড়িটি ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"এই ডিভাইস ও অন্য ডিভাইস একই ওয়াই-ফাই নেটওয়ার্কের সাথে কানেক্ট করা আছে কিনা তা ভালভাবে দেখে নিন"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"আরও জানুন"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"কীভাবে কাস্ট করবেন তা জানুন"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-bs/strings.xml b/mediarouter/mediarouter/src/main/res/values-bs/strings.xml
index 633736b..a466315 100644
--- a/mediarouter/mediarouter/src/main/res/values-bs/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-bs/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproduciranje u grupi"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nema dostupnih informacija"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nema dostupnih uređaja"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i sat"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i automobil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Provjerite je li drugi uređaj na istoj WiFi mreži na kojoj je i ovaj uređaj"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saznajte više"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Saznajte kako emitirati"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ca/strings.xml b/mediarouter/mediarouter/src/main/res/values-ca/strings.xml
index 3e998bd..6744047 100644
--- a/mediarouter/mediarouter/src/main/res/values-ca/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ca/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reprodueix en un grup"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"No hi ha informació disponible"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"No hi ha cap dispositiu disponible"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquest telèfon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquesta tauleta"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquest televisor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquest rellotge"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquest cotxe"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Assegura\'t que l\'altre dispositiu estigui connectat a la mateixa xarxa Wi‑Fi que aquest dispositiu"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Més informació"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Informació sobre com pots emetre contingut"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-cs/strings.xml b/mediarouter/mediarouter/src/main/res/values-cs/strings.xml
index 26affbb..c49e396 100644
--- a/mediarouter/mediarouter/src/main/res/values-cs/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-cs/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Přehrávání ve skupině"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nejsou k dispozici žádné informace"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nejsou k dispozici žádná zařízení"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako tento telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako tento tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako tuto televizi"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako tyto hodinky"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako toto auto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Připojte druhé zařízení ke stejné síti Wi-Fi, jako toto zařízení"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Další informace"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Podívejte se, jak na to"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-da/strings.xml b/mediarouter/mediarouter/src/main/res/values-da/strings.xml
index 8364692..7bcda06 100644
--- a/mediarouter/mediarouter/src/main/res/values-da/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-da/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Afspil på en gruppe"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Der er ingen tilgængelige oplysninger"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Der er ingen tilgængelige enheder"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som denne telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som denne tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som dette fjernsyn"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som dette ur"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som denne bil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Sørg for, at den anden enhed har forbindelse til det samme Wi-Fi-netværk som denne enhed"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Få flere oplysninger"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Sådan caster du indhold"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-de/strings.xml b/mediarouter/mediarouter/src/main/res/values-de/strings.xml
index b72ce7a..f3c8246 100644
--- a/mediarouter/mediarouter/src/main/res/values-de/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-de/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Auf einem Gruppengerät abspielen"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Keine Informationen verfügbar"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Keine Geräte verfügbar"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Achte darauf, dass sich das andere Gerät im selben WLAN wie dieses Smartphone befindet"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Achte darauf, dass sich das andere Gerät im selben WLAN wie dieses Tablet befindet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Achte darauf, dass sich das andere Gerät im selben WLAN wie dieser Fernseher befindet"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Achte darauf, dass sich das andere Gerät im selben WLAN wie diese Smartwatch befindet"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Achte darauf, dass sich das andere Gerät im selben WLAN wie dieses Auto befindet"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Achte darauf, dass sich das andere Gerät im selben WLAN wie dieses Gerät befindet"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Weitere Informationen"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Informationen zum Streamen"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-el/strings.xml b/mediarouter/mediarouter/src/main/res/values-el/strings.xml
index 8311a7f..a44ecf3 100644
--- a/mediarouter/mediarouter/src/main/res/values-el/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-el/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Αναπαραγωγή σε κάποια ομάδα"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Δεν υπάρχουν διαθέσιμες πληροφορίες"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Δεν υπάρχουν διαθέσιμες συσκευές"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτό το τηλέφωνο"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτό το tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτήν την τηλεόραση"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτό το ρολόι"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτό το αυτοκίνητο"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Βεβαιωθείτε ότι η άλλη συσκευή είναι συνδεδεμένη στο ίδιο δίκτυο Wi-Fi με αυτήν τη συσκευή"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Μάθετε περισσότερα"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Μάθετε πώς μπορείτε να κάνετε μετάδοση"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-es-rUS/strings.xml b/mediarouter/mediarouter/src/main/res/values-es-rUS/strings.xml
index 55a202f..71a2e79 100644
--- a/mediarouter/mediarouter/src/main/res/values-es-rUS/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-es-rUS/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproducir en un grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Sin información disponible"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"No hay dispositivos disponibles"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que este teléfono"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que esta tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que esta TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que este reloj"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que este automóvil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Asegúrate de que el dispositivo esté conectado a la misma red Wi-Fi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Más información"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Descubre cómo transmitir contenido"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-es/strings.xml b/mediarouter/mediarouter/src/main/res/values-es/strings.xml
index 2c584e0..75c921a 100644
--- a/mediarouter/mediarouter/src/main/res/values-es/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-es/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproducir en un grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"No hay información disponible"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"No hay dispositivos disponibles"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que este teléfono"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que esta tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que esta televisión"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que este reloj"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que este coche"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Asegúrate de que el otro dispositivo esté conectado a la misma red Wi-Fi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Más información"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Consulta cómo enviar contenido"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-et/strings.xml b/mediarouter/mediarouter/src/main/res/values-et/strings.xml
index 4614887..9ee1a87 100644
--- a/mediarouter/mediarouter/src/main/res/values-et/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-et/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Grupis esitamine"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Teave puudub"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ühtegi seadet pole saadaval"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see tahvelarvuti"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see teler"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see kell"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see auto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Veenduge, et teine seade oleks samas WiFi-võrgus kui see seade"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Lisateave"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Lisateave ülekandmise kohta"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-eu/strings.xml b/mediarouter/mediarouter/src/main/res/values-eu/strings.xml
index bbd0bf9..669e17e 100644
--- a/mediarouter/mediarouter/src/main/res/values-eu/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-eu/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Erreproduzitu talde batean"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Ez dago informaziorik"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ez dago gailurik"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Ziurtatu beste gailua telefonoaren wifi-sare berera konektatuta dagoela"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Ziurtatu beste gailua tabletaren wifi-sare berera konektatuta dagoela"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Ziurtatu beste gailua telebistaren wifi-sare berera konektatuta dagoela"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Ziurtatu beste gailua erlojuaren wifi-sare berera konektatuta dagoela"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Ziurtatu beste gailua autoaren wifi-sare berera konektatuta dagoela"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Ziurtatu beste gailua gailu honen wifi-sare berera konektatuta dagoela"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Lortu informazio gehiago"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Ikasi edukia igortzen"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-fa/strings.xml b/mediarouter/mediarouter/src/main/res/values-fa/strings.xml
index 498c994..b27a5dc 100644
--- a/mediarouter/mediarouter/src/main/res/values-fa/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-fa/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"بازی در گروه"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"اطلاعاتی در دسترس نیست"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"دستگاهی موجود نیست"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"مطمئن شوید این تلفن و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"مطمئن شوید این رایانه لوحی و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"مطمئن شوید این تلویزیون و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"مطمئن شوید این ساعت و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"مطمئن شوید این خودرو و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"مطمئن شوید این دستگاه و دستگاه دیگر به شبکه Wi-Fi یکسانی متصل باشند"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"بیشتر بدانید"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"آشنایی با نحوه پخش محتوا"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-fi/strings.xml b/mediarouter/mediarouter/src/main/res/values-fi/strings.xml
index 48c3433..6b53293 100644
--- a/mediarouter/mediarouter/src/main/res/values-fi/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-fi/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Toista ryhmässä"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Ei tietoja saatavilla"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ei laitteita käytettävissä"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Varmista, että tämä ja toinen laite ovat yhdistettynä samaan Wi-Fi-verkkoon"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Lue lisää"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Näin striimaaminen onnistuu"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-fr-rCA/strings.xml b/mediarouter/mediarouter/src/main/res/values-fr-rCA/strings.xml
index 362d240..22b8438 100644
--- a/mediarouter/mediarouter/src/main/res/values-fr-rCA/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-fr-rCA/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Faire jouer sur un groupe d\'appareils"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Aucune donnée trouvée"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Aucun appareil à proximité"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que ce téléphone"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette tablette"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que ce téléviseur"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette montre"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette voiture."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cet appareil"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"En savoir plus"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Apprendre à diffuser du contenu"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-fr/strings.xml b/mediarouter/mediarouter/src/main/res/values-fr/strings.xml
index 7977c6a..754f775 100644
--- a/mediarouter/mediarouter/src/main/res/values-fr/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-fr/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Lire sur un groupe d\'appareils"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Aucune information disponible"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Aucun appareil disponible"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que ce téléphone"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette tablette"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette télévision"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette montre"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cette voiture"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Assurez-vous que l\'autre appareil est connecté au même réseau Wi-Fi que cet appareil"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"En savoir plus"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Découvrez comment caster"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-gl/strings.xml b/mediarouter/mediarouter/src/main/res/values-gl/strings.xml
index 650543f..6455657 100644
--- a/mediarouter/mediarouter/src/main/res/values-gl/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-gl/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproducir nun grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Non hai información dispoñible"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Non hai dispositivos dispoñibles"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que este teléfono"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que esta tableta"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que esta televisión"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que este reloxo"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que este coche"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Asegúrate de que o outro dispositivo estea na mesma rede wifi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Máis información"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Aprende a emitir contido"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-gu/strings.xml b/mediarouter/mediarouter/src/main/res/values-gu/strings.xml
index ad3131b..850d436 100644
--- a/mediarouter/mediarouter/src/main/res/values-gu/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-gu/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"જૂથમાં રમો"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"કોઈ માહિતી ઉપલબ્ધ નથી"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"કોઈ ડિવાઇસ ઉપલબ્ધ નથી"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ ફોન છે"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ ટૅબ્લેટ છે"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ ટીવી છે"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ વૉચ છે"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ કાર છે"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ખાતરી કરો કે અન્ય ડિવાઇસ એ જ વાઇ-ફાઇ નેટવર્ક પર હોય જેના પર આ ડિવાઇસ છે"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"વધુ જાણો"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"કાસ્ટ કરવાની રીત જાણો"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-hi/strings.xml b/mediarouter/mediarouter/src/main/res/values-hi/strings.xml
index c68b54c..1028a38 100644
--- a/mediarouter/mediarouter/src/main/res/values-hi/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-hi/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"समूह में खेलें"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"कोई जानकारी मौजूद नहीं है"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"कोई डिवाइस मौजूद नहीं है"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"पक्का करें कि दूसरा डिवाइस और यह फ़ोन, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"पक्का करें कि दूसरा डिवाइस और यह टैबलेट, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"पक्का करें कि दूसरा डिवाइस और यह टीवी, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"पक्का करें कि दूसरा डिवाइस और यह स्मार्टवॉच, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"पक्का करें कि दूसरा डिवाइस और यह कार, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"पक्का करें कि दूसरा डिवाइस और यह डिवाइस, दोनों एक ही वाई-फ़ाई नेटवर्क से जुड़े हों"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ज़्यादा जानें"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"कास्ट करने का तरीका जानें"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-hr/strings.xml b/mediarouter/mediarouter/src/main/res/values-hr/strings.xml
index 640e78d..d0b716a 100644
--- a/mediarouter/mediarouter/src/main/res/values-hr/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-hr/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reprodukcija u grupi"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Informacije nisu dostupne"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nema dostupnih uređaja"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj sat"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj automobil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Povežite drugi uređaj s istom Wi-Fi mrežom s kojom je povezan ovaj uređaj"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saznajte više"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Saznajte kako emitirati"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-hu/strings.xml b/mediarouter/mediarouter/src/main/res/values-hu/strings.xml
index 6a5076c..f03b68b 100644
--- a/mediarouter/mediarouter/src/main/res/values-hu/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-hu/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Lejátszás eszközcsoportban"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nincs információ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nincs rendelkezésre álló eszköz"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez a telefon."</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez a táblagép."</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez a tévé."</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez az óra."</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez az autó."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Gondoskodjon arról, hogy a másik eszköz ugyanahhoz a Wi-Fi-hálózathoz csatlakozzon, mint ez az eszköz."</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"További információ"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"A tartalomátküldés elsajátítása"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-hy/strings.xml b/mediarouter/mediarouter/src/main/res/values-hy/strings.xml
index 493be03..5e9a3c2 100644
--- a/mediarouter/mediarouter/src/main/res/values-hy/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-hy/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Նվագարկեք սարքերի խմբում"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Հասանելի տեղեկություններ չկան"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Հասանելի սարքեր չկան"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս հեռախոսը"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս պլանշետը"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս հեռուստացույցը"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս ժամացույցը"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս մեքենան"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Համոզվեք, որ մյուս սարքը միացած է նույն Wi-Fi ցանցին, ինչ այս սարքը"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Իմանալ ավելին"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Ինչպես հեռարձակել"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-in/strings.xml b/mediarouter/mediarouter/src/main/res/values-in/strings.xml
index f31eb66..d8d59a2 100644
--- a/mediarouter/mediarouter/src/main/res/values-in/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-in/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Putar di grup"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Info tidak tersedia"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Perangkat tidak tersedia"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan ponsel ini"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan tablet ini"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan TV ini"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan smartwatch ini"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan mobil ini"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Pastikan perangkat lainnya berada di jaringan Wi-Fi yang sama dengan perangkat ini"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Pelajari lebih lanjut"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Pelajari cara melakukan transmisi"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-is/strings.xml b/mediarouter/mediarouter/src/main/res/values-is/strings.xml
index 0ad41e7..aa7794c 100644
--- a/mediarouter/mediarouter/src/main/res/values-is/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-is/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Spila í hóp"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Engar upplýsingar í boði"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Engin tæki í boði"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þessi sími"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þessi spjaldtölva"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þetta sjónvarp"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þetta úr"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þessi bíll"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Passaðu að hitt tækið sé tengt sama WiFi-neti og þetta tæki"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Nánar"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Kynntu þér hvernig þú varpar"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-it/strings.xml b/mediarouter/mediarouter/src/main/res/values-it/strings.xml
index d6838d6..9b3b874 100644
--- a/mediarouter/mediarouter/src/main/res/values-it/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-it/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Riproduci su un gruppo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nessuna informazione disponibile"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nessun dispositivo disponibile"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questo smartphone"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questo tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questa TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questo orologio"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questa auto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Assicurati che l\'altro dispositivo sia connesso alla stessa rete Wi-Fi di questo dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Scopri di più"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Scopri come trasmettere contenuti"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-iw/strings.xml b/mediarouter/mediarouter/src/main/res/values-iw/strings.xml
index c410ed0..03371fa 100644
--- a/mediarouter/mediarouter/src/main/res/values-iw/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-iw/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"הפעלה בקבוצה"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"אין מידע זמין"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"אין מכשירים זמינים"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"מוודאים שהמכשיר השני והטלפון מחוברים לאותה רשת Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"מוודאים שהמכשיר השני והטאבלט מחוברים לאותה רשת Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"מוודאים שהמכשיר השני והטלוויזיה מחוברים לאותה רשת Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"מוודאים שהמכשיר השני והשעון מחוברים לאותה רשת Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"מוודאים שהמכשיר השני והרכב מחוברים לאותה רשת Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"מוודאים ששני המכשירים מחוברים לאותה רשת Wi-Fi"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"מידע נוסף"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"איך להעביר (cast)"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ja/strings.xml b/mediarouter/mediarouter/src/main/res/values-ja/strings.xml
index e5af2b1..b9ffc6a1 100644
--- a/mediarouter/mediarouter/src/main/res/values-ja/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ja/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"グループで再生"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"情報がありません"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"利用可能なデバイスがありません"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"他のデバイスがこのスマートフォンと同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"他のデバイスがこのタブレットと同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"他のデバイスがこのテレビと同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"他のデバイスがこのスマートウォッチと同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"他のデバイスがこの車と同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"他のデバイスがこのデバイスと同じ Wi-Fi ネットワークに接続していることを確認してください"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"詳細"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"キャスト方法"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ka/strings.xml b/mediarouter/mediarouter/src/main/res/values-ka/strings.xml
index 04d5f12..c631572 100644
--- a/mediarouter/mediarouter/src/main/res/values-ka/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ka/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ჯგუფში დაკვრა"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ინფორმაცია მიუწვდომელია"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ხელმისაწვდომი მოწყობილობები არ არის"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს ტელეფონი"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს ტაბლეტი"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს ტელევიზორი"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს საათი"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს მანქანა"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"დარწმუნდით, რომ სხვა მოწყობილობა იმავე Wi-Fi ქსელთან არის დაკავშირებული, რომელთანაც ეს მოწყობილობა"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"შეიტყვეთ მეტი"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ტრანსლირების სწავლა"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-kk/strings.xml b/mediarouter/mediarouter/src/main/res/values-kk/strings.xml
index 9e8d9f3..60e465c 100644
--- a/mediarouter/mediarouter/src/main/res/values-kk/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-kk/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Топта ойнату"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Ешқандай ақпарат жоқ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ешқандай құрылғы табылмады"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Басқа құрылғы осы телефонмен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Басқа құрылғы осы планшетпен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Басқа құрылғы осы теледидармен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Басқа құрылғы осы сағатпен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Басқа құрылғы осы көлікпен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Басқа құрылғы осы құрылғымен бірдей Wi-Fi желісінде екеніне көз жеткізіңіз."</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Толық ақпарат"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Трансляциялау жолы"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-km/strings.xml b/mediarouter/mediarouter/src/main/res/values-km/strings.xml
index 06beedb..a85983a 100644
--- a/mediarouter/mediarouter/src/main/res/values-km/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-km/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"លេងនៅលើក្រុម"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"មិនមានព័ត៌មានទេ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"មិនមានឧបករណ៍ទេ"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងទូរសព្ទនេះ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងថេប្លេតនេះ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងទូរទស្សន៍នេះ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងនាឡិកានេះ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងរថយន្តនេះ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"សូមប្រាកដថា ឧបករណ៍ផ្សេងទៀតស្ថិតនៅលើបណ្ដាញ Wi-Fi តែមួយជាមួយនឹងឧបករណ៍នេះ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ស្វែងយល់បន្ថែម"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ស្វែងយល់ពីរបៀបខាស"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-kn/strings.xml b/mediarouter/mediarouter/src/main/res/values-kn/strings.xml
index b7f91ed..8c945f6 100644
--- a/mediarouter/mediarouter/src/main/res/values-kn/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-kn/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ಗುಂಪಿನಲ್ಲಿ ಪ್ಲೇ ಮಾಡಿ"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ಯಾವುದೇ ಮಾಹಿತಿ ಲಭ್ಯವಿಲ್ಲ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ಯಾವುದೇ ಸಾಧನಗಳು ಲಭ್ಯವಿಲ್ಲ"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ಫೋನ್ನಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ಟ್ಯಾಬ್ಲೆಟ್ನಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ಟಿವಿಯಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ವಾಚ್ನಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ಕಾರಿನಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ಇನ್ನೊಂದು ಸಾಧನವು ಈ ಸಾಧನದಲ್ಲಿ ಇರುವಂತಹ ವೈ-ಫೈ ನೆಟ್ವರ್ಕ್ನಲ್ಲೇ ಇದೆ ಎಂಬುದನ್ನು ಖಚಿತಪಡಿಸಿಕೊಳ್ಳಿ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ಇನ್ನಷ್ಟು ತಿಳಿಯಿರಿ"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ಬಿತ್ತರಿಸುವುದು ಹೇಗೆಂದು ತಿಳಿಯಿರಿ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ko/strings.xml b/mediarouter/mediarouter/src/main/res/values-ko/strings.xml
index a67aa44..4ddc419 100644
--- a/mediarouter/mediarouter/src/main/res/values-ko/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ko/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"그룹에서 재생"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"사용할 수 있는 정보 없음"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"사용 가능한 기기 없음"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"다른 기기가 이 휴대전화와 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"다른 기기가 이 태블릿과 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"다른 기기가 이 TV와 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"다른 기기가 이 시계와 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"다른 기기가 이 자동차와 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"다른 기기가 이 기기와 동일한 Wi-Fi 네트워크에 연결되어 있어야 합니다."</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"자세히 알아보기"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"전송 방법 알아보기"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ky/strings.xml b/mediarouter/mediarouter/src/main/res/values-ky/strings.xml
index b68cc3d..f1eadfb 100644
--- a/mediarouter/mediarouter/src/main/res/values-ky/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ky/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Топто ойнотуу"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Эч маалымат жок"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Жеткиликтүү түзмөктөр жок"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Башка түзмөк бул телефон менен бир Wi-Fi тармагына туташып турушу керек"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Башка түзмөк бул планшет менен бир Wi-Fi тармагына туташып турушу керек"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Башка түзмөк бул сыналгы менен бир Wi-Fi тармагына туташып турушу керек"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Башка түзмөк бул саат менен бир Wi-Fi тармагына туташып турушу керек"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Башка түзмөк бул унаа менен бир Wi-Fi тармагына туташып турушу керек"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Башка түзмөк бул түзмөк менен бир Wi-Fi тармагына туташып турушу керек"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Кеңири маалымат"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Тышкы экранга чыгарууну үйрөнүү"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-lo/strings.xml b/mediarouter/mediarouter/src/main/res/values-lo/strings.xml
index 979a5ba..bfb2968 100644
--- a/mediarouter/mediarouter/src/main/res/values-lo/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-lo/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ຫຼິ້ນຢູ່ກຸ່ມ"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ບໍ່ມີຂໍ້ມູນ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ບໍ່ມີອຸປະກອນທີ່ສາມາດໃຊ້ໄດ້"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບໂທລະສັບເຄື່ອງນີ້"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບແທັບເລັດເຄື່ອງນີ້"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບໂທລະທັດເຄື່ອງນີ້"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບໂມງໜ່ວຍນີ້"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບລົດຄັນນີ້"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ກວດສອບວ່າອຸປະກອນອື່ນໃຊ້ເຄືອຂ່າຍ Wi-Fi ດຽວກັນກັບອຸປະກອນນີ້"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ສຶກສາເພີ່ມເຕີມ"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ສຶກສາວິທີສົ່ງສັນຍານ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-lt/strings.xml b/mediarouter/mediarouter/src/main/res/values-lt/strings.xml
index 760c35e..fc8e784 100644
--- a/mediarouter/mediarouter/src/main/res/values-lt/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-lt/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Leidimas grupėje"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nėra jokios informacijos"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nėra jokių pasiekiamų įrenginių"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis telefonas"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis planšetinis kompiuteris"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis televizorius"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis laikrodis"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis automobilis"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Patikrinkite, ar kitas įrenginys prijungtas prie to paties „Wi-Fi“ tinklo kaip šis įrenginys"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Sužinokite daugiau"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Sužinokite, kaip perduoti"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-lv/strings.xml b/mediarouter/mediarouter/src/main/res/values-lv/strings.xml
index 7b6f4f2..6fc17cf 100644
--- a/mediarouter/mediarouter/src/main/res/values-lv/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-lv/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Atskaņošana grupā"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nav informācijas"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nav pieejamu ierīču"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā tālrunī."</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā planšetdatorā."</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā televizorā."</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā pulkstenī."</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā automašīnā."</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Otrai ierīcei ir jābūt savienotai ar to pašu Wi-Fi tīklu, ar kuru ir izveidots savienojums šajā ierīcē."</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Uzzināt vairāk"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Uzziniet, kā veikt apraidi"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-mk/strings.xml b/mediarouter/mediarouter/src/main/res/values-mk/strings.xml
index ebc035aa..3c38d72 100644
--- a/mediarouter/mediarouter/src/main/res/values-mk/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-mk/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Пуштете на група"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Нема достапни информации"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Нема достапни уреди"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој телефон"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој таблет"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој телевизор"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој часовник"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој автомобил"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Погрижете се другиот уред да биде поврзан на истата Wi-Fi мрежа како овој уред"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Дознајте повеќе"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Дознајте како да емитувате"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ml/strings.xml b/mediarouter/mediarouter/src/main/res/values-ml/strings.xml
index f4552ec..5b9076e 100644
--- a/mediarouter/mediarouter/src/main/res/values-ml/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ml/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ഒരു ഗ്രൂപ്പിൽ പ്ലേ ചെയ്യുക"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"വിവരങ്ങളൊന്നും ലഭ്യമല്ല"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ഉപകരണങ്ങളൊന്നും ലഭ്യമല്ല"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ഈ ഫോൺ കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ഈ ടാബ്ലെറ്റ് കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ഈ ടിവി കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ഈ വാച്ച് കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ഈ കാർ കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ഈ ഉപകരണം കണക്റ്റ് ചെയ്തിരിക്കുന്ന അതേ വൈഫൈ നെറ്റ്വർക്കിലാണ് മറ്റേ ഉപകരണവും കണക്റ്റ് ചെയ്തിട്ടുള്ളതെന്ന് ഉറപ്പാക്കുക"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"കൂടുതലറിയുക"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"എങ്ങനെ കാസ്റ്റുചെയ്യണമെന്ന് അറിയുക"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-mn/strings.xml b/mediarouter/mediarouter/src/main/res/values-mn/strings.xml
index d02b1d2..f678337 100644
--- a/mediarouter/mediarouter/src/main/res/values-mn/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-mn/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Бүлэгт тоглуулах"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Мэдээлэл алга"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ямар ч боломжтой төхөөрөмж байхгүй"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Нөгөө төхөөрөмж энэ утастай ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Нөгөө төхөөрөмж энэ таблеттай ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Нөгөө төхөөрөмж энэ ТВ-тэй ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Нөгөө төхөөрөмж энэ цагтай ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Нөгөө төхөөрөмж энэ машинтай ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Нөгөө төхөөрөмж энэ төхөөрөмжтэй ижил Wi-Fi сүлжээнд байгаа болохыг баталгаажуулна уу"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Нэмэлт мэдээлэл авах"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Хэрхэн дамжуулахыг мэдэж авах"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-mr/strings.xml b/mediarouter/mediarouter/src/main/res/values-mr/strings.xml
index 585f685..3e7e22d 100644
--- a/mediarouter/mediarouter/src/main/res/values-mr/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-mr/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"गटावर प्ले करा"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"कोणतीही माहिती उपलब्ध नाही"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"कोणतीही डिव्हाइस उपलब्ध नाहीत"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"दुसरे डिव्हाइस हा फोन आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"दुसरे डिव्हाइस हा टॅबलेट आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"दुसरे डिव्हाइस हा टीव्ही आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"दुसरे डिव्हाइस हे वॉच आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"दुसरे डिव्हाइस ही कार आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"दुसरे डिव्हाइस हे डिव्हाइस आहे त्याच वाय-फाय नेटवर्कवर असल्याची खात्री करा"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"अधिक जाणून घ्या"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"कास्ट कसे करावे हे जाणून घ्या"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ms/strings.xml b/mediarouter/mediarouter/src/main/res/values-ms/strings.xml
index 76c4de0..b21e481 100644
--- a/mediarouter/mediarouter/src/main/res/values-ms/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ms/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Mainkan pada kumpulan"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Maklumat tidak tersedia"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Tiada peranti tersedia"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan telefon ini"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan tablet ini"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan TV ini"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan jam tangan ini"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan kereta ini"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Pastikan peranti lain disambungkan kepada rangkaian Wi-Fi yang sama dengan peranti ini"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Ketahui lebih lanjut"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Ketahui cara menghantar"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-my/strings.xml b/mediarouter/mediarouter/src/main/res/values-my/strings.xml
index c8eeaec..8688caf 100644
--- a/mediarouter/mediarouter/src/main/res/values-my/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-my/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"အုပ်စုလိုက် ဖွင့်ခြင်း"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"အချက်အလက် မရရှိနိုင်ပါ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"စက်များ မရနိုင်ပါ"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"အခြားစက်သည် ဤဖုန်းနှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"အခြားစက်သည် ဤတက်ဘလက်နှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"အခြားစက်သည် ဤ tv နှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"အခြားစက်သည် ဤနာရီနှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"အခြားစက်သည် ဤကားနှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"အခြားစက်သည် ဤစက်နှင့် Wi-Fi ကွန်ရက်တစ်ခုတည်းတွင် ရှိနေကြောင်း သေချာပါစေ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ပိုမိုလေ့လာရန်"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ကာစ်လုပ်ပုံကို လေ့လာရန်"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-nb/strings.xml b/mediarouter/mediarouter/src/main/res/values-nb/strings.xml
index 2731cef..5d8725b 100644
--- a/mediarouter/mediarouter/src/main/res/values-nb/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-nb/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Spill i en gruppe"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Ingen informasjon er tilgjengelig"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ingen enheter er tilgjengelige"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Sørg for at den andre enheten er på det samme wifi-nettverket som denne telefonen"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Sørg for at den andre enheten er på det samme wifi-nettverket som dette nettbrettet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Sørg for at den andre enheten er på det samme wifi-nettverket som denne TV-en"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Sørg for at den andre enheten er på det samme wifi-nettverket som denne klokken"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Sørg for at den andre enheten er på det samme wifi-nettverket som denne bilen"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Sørg for at den andre enheten er på det samme wifi-nettverket som denne enheten"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Finn ut mer"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Finn ut hvordan du caster"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ne/strings.xml b/mediarouter/mediarouter/src/main/res/values-ne/strings.xml
index c944a64..490503a 100644
--- a/mediarouter/mediarouter/src/main/res/values-ne/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ne/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"कुनै समूहमा प्ले गर्नुहोस्"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"कुनै पनि जानकारी उपलब्ध छैन"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"कुनै पनि डिभाइस उपलब्ध छैन"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"यो फोन जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"यो ट्याब्लेट जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"यो टिभी जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"यो स्मार्ट वाच जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"यो कार जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"यो डिभाइस जुन Wi-Fi नेटवर्कमा कनेक्ट गरिएको छ अर्को डिभाइस पनि उही नेटवर्कमा कनेक्ट गरिएको छ भन्ने कुरा सुनिश्चित गर्नुहोस्"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"थप जान्नुहोस्"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"कास्ट गर्ने तरिका सिक्नुहोस्"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-nl/strings.xml b/mediarouter/mediarouter/src/main/res/values-nl/strings.xml
index 2c8fcf1..73ddbd1 100644
--- a/mediarouter/mediarouter/src/main/res/values-nl/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-nl/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Afspelen in een groep"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Geen informatie beschikbaar"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Geen apparaten beschikbaar"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als deze telefoon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als deze tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als deze tv"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als deze smartwatch"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als deze auto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Zorg dat het andere apparaat is verbonden met hetzelfde wifi-netwerk als dit apparaat"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Meer informatie"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Meer informatie over casten"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-or/strings.xml b/mediarouter/mediarouter/src/main/res/values-or/strings.xml
index 54b38d5..322adc9 100644
--- a/mediarouter/mediarouter/src/main/res/values-or/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-or/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ଏକ ଗ୍ରୁପ୍ରେ ପ୍ଲେ କରନ୍ତୁ"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"କୌଣସି ସୂଚନା ଉପଲବ୍ଧ ନାହିଁ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"କୌଣସି ଡିଭାଇସ ଉପଲବ୍ଧ ନାହିଁ"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ଅନ୍ୟ ଡିଭାଇସ ଏହି ଫୋନ ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ଅନ୍ୟ ଡିଭାଇସ ଏହି ଟାବଲେଟ ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ଅନ୍ୟ ଡିଭାଇସ ଏହି ଟିଭି ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ଅନ୍ୟ ଡିଭାଇସ ଏହି ୱାଚ ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ଅନ୍ୟ ଡିଭାଇସ ଏହି କାର ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ଅନ୍ୟ ଡିଭାଇସ ଏହି ଡିଭାଇସ ପରି ସମାନ ୱାଇ-ଫାଇ ନେଟୱାର୍କରେ ଅଛି ବୋଲି ସୁନିଶ୍ଚିତ କରନ୍ତୁ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ଅଧିକ ଜାଣନ୍ତୁ"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"କିପରି କାଷ୍ଟ କରିବେ ତାହା ଜାଣନ୍ତୁ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-pa/strings.xml b/mediarouter/mediarouter/src/main/res/values-pa/strings.xml
index b3b1455..fe164cb 100644
--- a/mediarouter/mediarouter/src/main/res/values-pa/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-pa/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"ਕਿਸੇ ਗਰੁੱਪ ਵਿੱਚ ਖੇਡੋ"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ਕੋਈ ਜਾਣਕਾਰੀ ਉਪਲਬਧ ਨਹੀਂ"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ਕੋਈ ਡੀਵਾਈਸ ਉਪਲਬਧ ਨਹੀਂ ਹੈ"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਫ਼ੋਨ ਹੈ"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਟੈਬਲੈੱਟ ਹੈ"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਟੀਵੀ ਹੈ"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਘੜੀ ਹੈ"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਕਾਰ ਹੈ"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ਪੱਕਾ ਕਰੋ ਕਿ ਦੂਜਾ ਡੀਵਾਈਸ ਉਸੇ ਵਾਈ-ਫਾਈ ਨੈੱਟਵਰਕ \'ਤੇ ਹੈ, ਜਿਸ \'ਤੇ ਇਹ ਡੀਵਾਈਸ ਹੈ"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ਹੋਰ ਜਾਣੋ"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ਕਾਸਟ ਕਰਨ ਦਾ ਤਰੀਕਾ ਜਾਣੋ"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-pl/strings.xml b/mediarouter/mediarouter/src/main/res/values-pl/strings.xml
index e100acb..e967185 100644
--- a/mediarouter/mediarouter/src/main/res/values-pl/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-pl/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Odtwórz w grupie"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Brak informacji"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Brak dostępnych urządzeń"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co telewizor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co zegarek"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co samochód"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Sprawdź, czy drugie urządzenie jest połączone z tą samą siecią Wi-Fi co to urządzenie"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Więcej informacji"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Dowiedz się, jak przesyłać treści"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-pt-rBR/strings.xml b/mediarouter/mediarouter/src/main/res/values-pt-rBR/strings.xml
index 881d168..b0b3b87 100644
--- a/mediarouter/mediarouter/src/main/res/values-pt-rBR/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-pt-rBR/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproduzir em um grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nenhuma informação disponível"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nenhum dispositivo disponível"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Conecte o outro dispositivo à mesma rede Wi-Fi que este smartphone"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Conecte o outro dispositivo à mesma rede Wi-Fi que este tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Conecte o outro dispositivo à mesma rede Wi-Fi que esta TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Conecte o outro dispositivo à mesma rede Wi-Fi que este relógio"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Conecte o outro dispositivo à mesma rede Wi-Fi que este carro"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Conecte o outro dispositivo à mesma rede Wi-Fi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saiba mais"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Aprenda a transmitir conteúdo"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-pt-rPT/strings.xml b/mediarouter/mediarouter/src/main/res/values-pt-rPT/strings.xml
index 1ee7c1f..132dc35 100644
--- a/mediarouter/mediarouter/src/main/res/values-pt-rPT/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-pt-rPT/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproduzir num grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nenhuma informação disponível"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nenhum dispositivo disponível"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que este telemóvel"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que este tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que esta TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que este relógio"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que este carro"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Certifique-se de que o outro dispositivo se encontra na mesma rede Wi-Fi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saiba mais"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Saiba como transmitir"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-pt/strings.xml b/mediarouter/mediarouter/src/main/res/values-pt/strings.xml
index 881d168..b0b3b87 100644
--- a/mediarouter/mediarouter/src/main/res/values-pt/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-pt/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Reproduzir em um grupo"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nenhuma informação disponível"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nenhum dispositivo disponível"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Conecte o outro dispositivo à mesma rede Wi-Fi que este smartphone"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Conecte o outro dispositivo à mesma rede Wi-Fi que este tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Conecte o outro dispositivo à mesma rede Wi-Fi que esta TV"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Conecte o outro dispositivo à mesma rede Wi-Fi que este relógio"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Conecte o outro dispositivo à mesma rede Wi-Fi que este carro"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Conecte o outro dispositivo à mesma rede Wi-Fi que este dispositivo"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Saiba mais"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Aprenda a transmitir conteúdo"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ro/strings.xml b/mediarouter/mediarouter/src/main/res/values-ro/strings.xml
index e2d80d1..ee059b9 100644
--- a/mediarouter/mediarouter/src/main/res/values-ro/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ro/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Redă într-un grup"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nu sunt informații disponibile"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nu sunt disponibile dispozitive"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca acest telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca această tabletă"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca acest televizor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca acest ceas"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca această mașină"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Verifică dacă celălalt dispozitiv este în aceeași rețea Wi-Fi ca acest dispozitiv"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Află mai multe"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Află cum să proiectezi"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ru/strings.xml b/mediarouter/mediarouter/src/main/res/values-ru/strings.xml
index 19330fa..c7ed5a3 100644
--- a/mediarouter/mediarouter/src/main/res/values-ru/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ru/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Воспроизведение в группе"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Данных нет"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Нет доступных устройств"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и телефон"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и планшет"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и телевизор"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и часы"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и автомобиль"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Убедитесь, что другое устройство подключено к той же сети Wi-Fi, что и это устройство"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Подробнее…"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Как начать трансляцию"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-si/strings.xml b/mediarouter/mediarouter/src/main/res/values-si/strings.xml
index 7a79cdf..cd04cafb 100644
--- a/mediarouter/mediarouter/src/main/res/values-si/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-si/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"සමූහයක ධාවනය කරන්න"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ලබා ගත හැකි තොරතුරු නොමැත"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"කිසිදු උපාංගයක් නොමැත"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"අනෙක් උපාංගය මෙම දුරකථනය මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"අනෙක් උපාංගය මෙම ටැබ්ලටය මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"අනෙක් උපාංගය මෙම tv මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"අනෙක් උපාංගය මෙම ඔරලෝසුව මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"අනෙක් උපාංගය මෙම මෝටර් රථය මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"අනෙක් උපාංගය මෙම උපාංගය මෙන් එකම Wi-Fi ජාලයෙහි ඇති බවට වග බලා ගන්න"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"තව දැන ගන්න"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"විකාශය කරන්නේ කෙසේ දැයි දැන ගන්න"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sk/strings.xml b/mediarouter/mediarouter/src/main/res/values-sk/strings.xml
index b767a21..e747250 100644
--- a/mediarouter/mediarouter/src/main/res/values-sk/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sk/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Prehrávanie v skupine"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nie sú k dispozícii žiadne informácie"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nie sú k dispozícii žiadne zariadenia"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako tento telefón"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako tento tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako tento televízor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako tieto hodinky"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako toto auto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Skontrolujte, či je vaše druhé zariadenie pripojené k rovnakej sieti Wi‑Fi ako toto zariadenie"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Ďalšie informácie"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Pokyny na prenos"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sl/strings.xml b/mediarouter/mediarouter/src/main/res/values-sl/strings.xml
index de636bc..df9efe1 100644
--- a/mediarouter/mediarouter/src/main/res/values-sl/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sl/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Predvajanje v skupini"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Ni podatkov"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nobena naprava ni na voljo"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta tablični računalnik"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta televizor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta ura"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta avtomobil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Prepričajte se, da je druga naprava povezana v isto omrežje Wi-Fi kot ta naprava"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Več o tem"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Več o tem, kako predvajati"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sq/strings.xml b/mediarouter/mediarouter/src/main/res/values-sq/strings.xml
index fbd11d6..2eb6522 100644
--- a/mediarouter/mediarouter/src/main/res/values-sq/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sq/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Luaj në një grup"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Nuk jepet asnjë informacion"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Nuk ofrohet asnjë pajisje"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë tablet"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë televizor"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë orë"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë makinë"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Sigurohu që pajisja tjetër të jetë në të njëjtin rrjet Wi-Fi me këtë pajisje"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Mëso më shumë"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Mëso si të transmetosh"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sr/strings.xml b/mediarouter/mediarouter/src/main/res/values-sr/strings.xml
index ce79fb9f..9a14bac 100644
--- a/mediarouter/mediarouter/src/main/res/values-sr/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sr/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Пуштајте у групи"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Нема доступних информација"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Није доступан ниједан уређај"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај телефон"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај таблет"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај тв"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај сат"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај аутомобил"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Уверите се да је други уређај повезан на исту WiFi мрежу као овај уређај"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Сазнајте више"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Сазнајте како да пребацујете"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sv/strings.xml b/mediarouter/mediarouter/src/main/res/values-sv/strings.xml
index 96f133f..01737c5 100644
--- a/mediarouter/mediarouter/src/main/res/values-sv/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sv/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Spela upp på en grupp enheter"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Det finns ingen tillgänglig information"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Inga tillgängliga enheter"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna telefon"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna surfplatta"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna tv"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna klocka"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna bil"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Kontrollera att den andra enheten är ansluten till samma wifi-nätverk som denna enhet"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Läs mer"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Så castar du"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-sw/strings.xml b/mediarouter/mediarouter/src/main/res/values-sw/strings.xml
index 297866c9..7e564d6 100644
--- a/mediarouter/mediarouter/src/main/res/values-sw/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-sw/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Cheza kwenye kikundi"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Hakuna maelezo yaliyopatikana"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Hakuna vifaa vilivyopatikana"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na simu hii"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na kishikwambi hiki"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na televisheni hii"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na saa hii"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na gari hili"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Hakikisha kifaa hicho kingine kimeunganishwa kwenye mtandao wa Wi-Fi unaotumiwa na kifaa hiki"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Pata maelezo zaidi"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Jifunze jinsi ta kutuma"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ta/strings.xml b/mediarouter/mediarouter/src/main/res/values-ta/strings.xml
index 1cd78d0..6894b6e 100644
--- a/mediarouter/mediarouter/src/main/res/values-ta/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ta/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"குழுவில் இயக்கு"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"தகவல் எதுவுமில்லை"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"சாதனங்கள் இல்லை"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"இந்த மொபைல் இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"இந்த டேப்லெட் இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"இந்த டிவி இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"இந்த வாட்ச் இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"இந்தக் கார் இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"இந்தச் சாதனம் இணைக்கப்பட்டுள்ள அதே வைஃபை நெட்வொர்க்கில் மற்றொரு சாதனமும் இணைக்கப்பட்டுள்ளதை உறுதிசெய்துகொள்ளுங்கள்"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"மேலும் அறிக"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"அலைபரப்புவதற்கான வழிமுறையை அறிக"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-te/strings.xml b/mediarouter/mediarouter/src/main/res/values-te/strings.xml
index a4362ec..290e656 100644
--- a/mediarouter/mediarouter/src/main/res/values-te/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-te/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"గ్రూప్లో ప్లే చేయండి"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"సమాచారం అందుబాటులో లేదు"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"పరికరాలు ఏవీ అందుబాటులో లేవు"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"మరొక పరికరం ఈ ఫోన్ లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"మరొక పరికరం ఈ టాబ్లెట్ లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"మరొక పరికరం ఈ టీవీ లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"మరొక పరికరం ఈ వాచ్ లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"మరొక పరికరం ఈ కారు లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"మరొక పరికరం ఈ పరికరం లాగా అదే Wi-Fi నెట్వర్క్లో ఉందని నిర్ధారించుకోండి"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"మరింత తెలుసుకోండి"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ఎలా ప్రసారం చేయాలో తెలుసుకోండి"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-th/strings.xml b/mediarouter/mediarouter/src/main/res/values-th/strings.xml
index 5921a0f..359653b 100644
--- a/mediarouter/mediarouter/src/main/res/values-th/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-th/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"เล่นในกลุ่ม"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"ไม่มีข้อมูล"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"ไม่มีอุปกรณ์ที่ใช้ได้"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับโทรศัพท์เครื่องนี้"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับแท็บเล็ตเครื่องนี้"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับทีวีเครื่องนี้"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับนาฬิกาเรือนนี้"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับรถคันนี้"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"ตรวจสอบว่าอุปกรณ์อื่นๆ อยู่ในเครือข่าย Wi-Fi เดียวกันกับอุปกรณ์เครื่องนี้"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"ดูข้อมูลเพิ่มเติม"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"ดูวิธีแคสต์"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-tl/strings.xml b/mediarouter/mediarouter/src/main/res/values-tl/strings.xml
index ef98df1..5ae0c47 100644
--- a/mediarouter/mediarouter/src/main/res/values-tl/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-tl/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"I-play sa isang pangkat"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Walang available na impormasyon"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Walang available na device"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang teleponong ito"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang tablet na ito"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang TV na ito"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang relong ito"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang kotseng ito"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Tiyaking nasa iisang Wi-Fi network ang ibang device at ang device na ito"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Matuto pa"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Matutunan kung paano mag-cast"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-tr/strings.xml b/mediarouter/mediarouter/src/main/res/values-tr/strings.xml
index 3bc10c7..de21a62 100644
--- a/mediarouter/mediarouter/src/main/res/values-tr/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-tr/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Bir grupta oynatın"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Bilgi yok"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Kullanılabilir cihaz yok"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Diğer cihazın bu telefon ile aynı kablosuz ağa bağlandığından emin olun"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Diğer cihazın bu tablet ile aynı kablosuz ağa bağlandığından emin olun"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Diğer cihazın bu tv ile aynı kablosuz ağa bağlandığından emin olun"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Diğer cihazın bu kol saati ile aynı kablosuz ağa bağlandığından emin olun"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Diğer cihazın bu araba ile aynı kablosuz ağa bağlandığından emin olun"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Diğer cihazın bu cihaz ile aynı kablosuz ağa bağlandığından emin olun"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Daha fazla bilgi"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Nasıl yayınlayacağınızı öğrenin"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-uk/strings.xml b/mediarouter/mediarouter/src/main/res/values-uk/strings.xml
index 586c738..c917313 100644
--- a/mediarouter/mediarouter/src/main/res/values-uk/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-uk/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Увімкнути на групі пристроїв"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Немає інформації"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Немає доступних пристроїв"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей телефон"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей планшет"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей телевізор"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей годинник"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей автомобіль"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Переконайтеся, що інший пристрій підключено до тієї самої мережі Wi-Fi, що й цей пристрій"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Докладніше"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Дізнайтеся, як транслювати контент"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-ur/strings.xml b/mediarouter/mediarouter/src/main/res/values-ur/strings.xml
index cf11910..473a54a 100644
--- a/mediarouter/mediarouter/src/main/res/values-ur/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-ur/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"گروپ پر چلائیں"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"کوئی معلومات دستیاب نہیں"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"کوئی آلہ دستیاب نہیں ہے"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ فون ہے"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ ٹیبلیٹ ہے"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ tv ہے"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ گھڑی ہے"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ کار ہے"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"یقینی بنائیں کہ دوسرا آلہ اسی Wi-Fi نیٹ ورک پر ہے جس پر یہ آلہ ہے"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"مزید جانیں"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"کاسٹ کرنے کا طریقہ جانیں"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-uz/strings.xml b/mediarouter/mediarouter/src/main/res/values-uz/strings.xml
index 04a52f0..2e11e09 100644
--- a/mediarouter/mediarouter/src/main/res/values-uz/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-uz/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Guruhda ijro qilish"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Hech narsa topilmadi"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Hech qanday qurilma topilmadi"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Boshqa qurilma telefon bu bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Boshqa qurilma bu planshet bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Boshqa qurilma bu televizor bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Boshqa qurilma bu soat bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Boshqa qurilma bu avtomobil bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Boshqa qurilma bu qurilma bilan bir xil Wi-Fi tarmoqda ekaniga ishonch hosil qiling"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Batafsil"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Qanday translatsiya qilinadi"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-vi/strings.xml b/mediarouter/mediarouter/src/main/res/values-vi/strings.xml
index ce47483..68322745 100644
--- a/mediarouter/mediarouter/src/main/res/values-vi/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-vi/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Phát trên nhóm"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Không có thông tin nào"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Không có thiết bị nào"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Đảm bảo thiết bị kia và điện thoại này kết nối với cùng một mạng Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Đảm bảo thiết bị kia và máy tính bảng này kết nối với cùng một mạng Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Đảm bảo thiết bị kia và TV này kết nối với cùng một mạng Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Đảm bảo thiết bị kia và đồng hồ này kết nối với cùng một mạng Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Đảm bảo thiết bị kia và ô tô này kết nối với cùng một mạng Wi-Fi"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Đảm bảo thiết bị kia và thiết bị này kết nối với cùng một mạng Wi-Fi"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Tìm hiểu thêm"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Tìm hiểu cách truyền"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-zh-rCN/strings.xml b/mediarouter/mediarouter/src/main/res/values-zh-rCN/strings.xml
index b2b5a33..d6f9784 100644
--- a/mediarouter/mediarouter/src/main/res/values-zh-rCN/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-zh-rCN/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"在一组设备上播放"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"没有任何相关信息"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"没有可用的设备"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"确保另一设备与此手机连接到同一 WLAN 网络"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"确保另一设备与此平板电脑连接到同一 WLAN 网络"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"确保另一设备与此电视连接到同一 WLAN 网络"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"确保另一设备与此手表连接到同一 WLAN 网络"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"确保另一设备与此汽车连接到同一 WLAN 网络"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"确保另一设备与此设备连接到同一 WLAN 网络"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"了解详情"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"了解如何投放"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-zh-rHK/strings.xml b/mediarouter/mediarouter/src/main/res/values-zh-rHK/strings.xml
index 781ae37..fc7761b 100644
--- a/mediarouter/mediarouter/src/main/res/values-zh-rHK/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-zh-rHK/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"在群組裝置中播放"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"沒有資料可以提供"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"沒有可用的裝置"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"請確保另一部裝置與此手機連接同一 Wi-Fi 網絡"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"請確保另一部裝置與此平板電腦連接同一 Wi-Fi 網絡"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"請確保另一部裝置與此電視連接同一 Wi-Fi 網絡"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"請確保另一部裝置與此手錶連接同一 Wi-Fi 網絡"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"請確保另一部裝置與此汽車連接同一 Wi-Fi 網絡"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"請確保另一部裝置與此裝置連接同一 Wi-Fi 網絡"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"瞭解詳情"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"瞭解投放方式"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-zh-rTW/strings.xml b/mediarouter/mediarouter/src/main/res/values-zh-rTW/strings.xml
index a6bfa83..f945a62 100644
--- a/mediarouter/mediarouter/src/main/res/values-zh-rTW/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-zh-rTW/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"在群組上播放"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"沒有可用的資訊"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"找不到裝置"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"確認其他裝置與這部手機連上同一個 Wi-Fi 網路"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"確認其他裝置與這部平板電腦連上同一個 Wi-Fi 網路"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"確認其他裝置與這部電視連上同一個 Wi-Fi 網路"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"確認其他裝置與這支手錶連上同一個 Wi-Fi 網路"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"確認其他裝置與這輛車連上同一個 Wi-Fi 網路"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"確認其他裝置與這部裝置連上同一個 Wi-Fi 網路"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"瞭解詳情"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"瞭解如何投放"</string>
</resources>
diff --git a/mediarouter/mediarouter/src/main/res/values-zu/strings.xml b/mediarouter/mediarouter/src/main/res/values-zu/strings.xml
index 4d0d8d2..b4bf614 100644
--- a/mediarouter/mediarouter/src/main/res/values-zu/strings.xml
+++ b/mediarouter/mediarouter/src/main/res/values-zu/strings.xml
@@ -43,18 +43,12 @@
<string name="mr_dialog_transferable_header" msgid="6068257520605505468">"Dlala eqenjini"</string>
<string name="mr_cast_dialog_title_view_placeholder" msgid="2175930138959078155">"Alukho ulwazi olutholakalayo"</string>
<string name="mr_chooser_zero_routes_found_title" msgid="5213435473397442608">"Ayikho idivayisi etholakalayo"</string>
- <!-- no translation found for mr_chooser_wifi_warning_description_phone (2555886884770958244) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tablet (6038748488793588164) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_tv (5845921667085074878) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_watch (5255021372884233706) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_car (2998902945608081567) -->
- <skip />
- <!-- no translation found for mr_chooser_wifi_warning_description_unknown (3459891599800041449) -->
- <skip />
+ <string name="mr_chooser_wifi_warning_description_phone" msgid="2555886884770958244">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi njengale foni"</string>
+ <string name="mr_chooser_wifi_warning_description_tablet" msgid="6038748488793588164">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi njengale thebulethi"</string>
+ <string name="mr_chooser_wifi_warning_description_tv" msgid="5845921667085074878">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi nje ngale tv"</string>
+ <string name="mr_chooser_wifi_warning_description_watch" msgid="5255021372884233706">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi nje ngaleli washi"</string>
+ <string name="mr_chooser_wifi_warning_description_car" msgid="2998902945608081567">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi nje ngale moto"</string>
+ <string name="mr_chooser_wifi_warning_description_unknown" msgid="3459891599800041449">"Qinisekisa ukuthi enye idivayisi ikunethiwekhi efanayo ye-Wi-Fi nje ngale divayisi"</string>
<string name="mr_chooser_wifi_learn_more" msgid="3799500840179081429"><a href="https://support.google.com/chromecast/?p=trouble-finding-devices">"Funda kabanzi"</a></string>
<string name="ic_media_route_learn_more_accessibility" msgid="9119039724000326934">"Funda indlela yokusakaza"</string>
</resources>
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankAggregatorActivity.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankAggregatorActivity.kt
index d280f43..ab02ceb 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankAggregatorActivity.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankAggregatorActivity.kt
@@ -104,4 +104,4 @@
val navController = findNavController(R.id.nav_host_fragment_content_main)
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankLoggingActivity.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankLoggingActivity.kt
index 08826f4..654838f 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankLoggingActivity.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankLoggingActivity.kt
@@ -93,4 +93,4 @@
val navController = findNavController(R.id.nav_host_fragment_content_main)
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankStatsAggregator.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankStatsAggregator.kt
index aa6cd77..e9aa007 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankStatsAggregator.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/JankStatsAggregator.kt
@@ -99,4 +99,4 @@
*/
private const val REPORT_BUFFER_LIMIT = 1000
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageContent.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageContent.kt
index 9ab2f2a..a761595 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageContent.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageContent.kt
@@ -41,4 +41,4 @@
val contentsText = view.findViewById<TextView>(R.id.messageHeader)
contentsText.text = arguments?.getString("title")
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListAdapter.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListAdapter.kt
index 4946da0..199d632 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListAdapter.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListAdapter.kt
@@ -54,4 +54,4 @@
override fun getItemCount(): Int {
return messageList.size
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListFragment.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListFragment.kt
index 25f33a5..118c245 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListFragment.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MessageListFragment.kt
@@ -74,4 +74,4 @@
holder = null
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MyCustomView.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MyCustomView.kt
index 527f2ff..256e7d3 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MyCustomView.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/MyCustomView.kt
@@ -55,4 +55,4 @@
}
super.onDraw(canvas)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/SimpleLoggingActivity.kt b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/SimpleLoggingActivity.kt
index bb4eb32..067591c 100644
--- a/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/SimpleLoggingActivity.kt
+++ b/metrics/integration-tests/janktest/src/main/java/androidx/metrics/performance/janktest/SimpleLoggingActivity.kt
@@ -39,4 +39,4 @@
stateHolder.putState("stateKey2", "${Date()}")
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/JankStatsBenchmark.kt b/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/JankStatsBenchmark.kt
index f1e9621..3749d2b 100644
--- a/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/JankStatsBenchmark.kt
+++ b/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/JankStatsBenchmark.kt
@@ -177,4 +177,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/MainActivity.kt b/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/MainActivity.kt
index 8d6d624..c30c695 100644
--- a/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/MainActivity.kt
+++ b/metrics/metrics-benchmark/src/androidTest/java/androidx/metrics/performance/benchmark/MainActivity.kt
@@ -24,4 +24,4 @@
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedFragment.kt b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedFragment.kt
index 56ae51b..78de2a3 100644
--- a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedFragment.kt
+++ b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedFragment.kt
@@ -50,4 +50,4 @@
delayedView.invalidate()
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedView.kt b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedView.kt
index 0129f1f..b107f1f 100644
--- a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedView.kt
+++ b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/DelayedView.kt
@@ -61,4 +61,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/JankStatsTest.kt b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/JankStatsTest.kt
index 8f79640..58b7ba0 100644
--- a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/JankStatsTest.kt
+++ b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/JankStatsTest.kt
@@ -634,4 +634,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/MyCustomView.kt b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/MyCustomView.kt
index e5a366b..00621ed 100644
--- a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/MyCustomView.kt
+++ b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/MyCustomView.kt
@@ -58,4 +58,4 @@
}
super.onDraw(canvas)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/SecondFragment.kt b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/SecondFragment.kt
index ab1afbc..4a3914b 100644
--- a/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/SecondFragment.kt
+++ b/metrics/metrics-performance/src/androidTest/java/androidx/metrics/performance/test/SecondFragment.kt
@@ -26,4 +26,4 @@
override fun onDestroyView() {
super.onDestroyView()
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameData.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameData.kt
index f3611f8..a87b665 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameData.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameData.kt
@@ -162,4 +162,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi24.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi24.kt
index 5518a1a..5540e8e 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi24.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi24.kt
@@ -81,4 +81,4 @@
"isJank=$isJank, " +
"states=$states)"
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi31.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi31.kt
index b2264d1..f7c55c5 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi31.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/FrameDataApi31.kt
@@ -100,4 +100,4 @@
"isJank=$isJank, " +
"states=$states)"
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStats.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStats.kt
index e76e81e..9b13051 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStats.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStats.kt
@@ -197,4 +197,4 @@
volatileFrameData: FrameData
)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi16Impl.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi16Impl.kt
index 611854c..920fdb7 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi16Impl.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi16Impl.kt
@@ -292,4 +292,4 @@
return JankStatsBaseImpl.frameDuration
}
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi22Impl.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi22Impl.kt
index 679268a..149dc50 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi22Impl.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi22Impl.kt
@@ -49,4 +49,4 @@
override fun setMessageAsynchronicity(message: Message) {
message.isAsynchronous = true
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi26Impl.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi26Impl.kt
index 800b8b2..dae3ae1 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi26Impl.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi26Impl.kt
@@ -31,4 +31,4 @@
override fun getFrameStartTime(frameMetrics: FrameMetrics): Long {
return frameMetrics.getMetric(FrameMetrics.INTENDED_VSYNC_TIMESTAMP)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi31Impl.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi31Impl.kt
index 8236473..8deeba6 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi31Impl.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsApi31Impl.kt
@@ -59,4 +59,4 @@
override fun getExpectedFrameDuration(metrics: FrameMetrics): Long {
return metrics.getMetric(FrameMetrics.DEADLINE)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsBaseImpl.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsBaseImpl.kt
index 7ef56fb..4496c61 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsBaseImpl.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsBaseImpl.kt
@@ -31,4 +31,4 @@
var frameDuration: Long = -1
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsInternalsForTesting.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsInternalsForTesting.kt
index 2856ef0..b4f5083 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsInternalsForTesting.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/JankStatsInternalsForTesting.kt
@@ -59,4 +59,4 @@
fun logFrameData(frameData: FrameData) {
jankStats.logFrameData(frameData)
}
-}
\ No newline at end of file
+}
diff --git a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/PerformanceMetricsState.kt b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/PerformanceMetricsState.kt
index 742ab63..a60ce7b 100644
--- a/metrics/metrics-performance/src/main/java/androidx/metrics/performance/PerformanceMetricsState.kt
+++ b/metrics/metrics-performance/src/main/java/androidx/metrics/performance/PerformanceMetricsState.kt
@@ -415,4 +415,4 @@
var state: PerformanceMetricsState? = null
internal set
}
-}
\ No newline at end of file
+}
diff --git a/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneAdapter.kt b/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneAdapter.kt
index 2b38dc8..1a177e5 100644
--- a/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneAdapter.kt
+++ b/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneAdapter.kt
@@ -55,4 +55,4 @@
}
override fun getItemCount() = dataSet.size
-}
\ No newline at end of file
+}
diff --git a/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneFragment.kt b/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneFragment.kt
index cb905ff8..10591a8 100644
--- a/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneFragment.kt
+++ b/navigation/integration-tests/testapp/src/main/java/androidx/navigation/testapp/TwoPaneFragment.kt
@@ -74,4 +74,4 @@
"fifth" to R.id.fifth_fragment
)
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-benchmark/src/androidTest/java/androidx/navigation/NavDeepLinkBenchmark.kt b/navigation/navigation-benchmark/src/androidTest/java/androidx/navigation/NavDeepLinkBenchmark.kt
index 561a1d3..2759419 100644
--- a/navigation/navigation-benchmark/src/androidTest/java/androidx/navigation/NavDeepLinkBenchmark.kt
+++ b/navigation/navigation-benchmark/src/androidTest/java/androidx/navigation/NavDeepLinkBenchmark.kt
@@ -70,4 +70,4 @@
const val START_DESTINATION_ID = 0
const val GRAPH_ID = 111
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/api/2.7.0-beta02.txt b/navigation/navigation-common/api/2.7.0-beta02.txt
index 51a77a6..95166e9 100644
--- a/navigation/navigation-common/api/2.7.0-beta02.txt
+++ b/navigation/navigation-common/api/2.7.0-beta02.txt
@@ -128,6 +128,10 @@
property public final androidx.lifecycle.SavedStateHandle savedStateHandle;
property public androidx.savedstate.SavedStateRegistry savedStateRegistry;
property public androidx.lifecycle.ViewModelStore viewModelStore;
+ field public static final androidx.navigation.NavBackStackEntry.Companion Companion;
+ }
+
+ public static final class NavBackStackEntry.Companion {
}
public final class NavDeepLink {
diff --git a/navigation/navigation-common/api/current.txt b/navigation/navigation-common/api/current.txt
index 51a77a6..95166e9 100644
--- a/navigation/navigation-common/api/current.txt
+++ b/navigation/navigation-common/api/current.txt
@@ -128,6 +128,10 @@
property public final androidx.lifecycle.SavedStateHandle savedStateHandle;
property public androidx.savedstate.SavedStateRegistry savedStateRegistry;
property public androidx.lifecycle.ViewModelStore viewModelStore;
+ field public static final androidx.navigation.NavBackStackEntry.Companion Companion;
+ }
+
+ public static final class NavBackStackEntry.Companion {
}
public final class NavDeepLink {
diff --git a/navigation/navigation-common/api/restricted_2.7.0-beta02.txt b/navigation/navigation-common/api/restricted_2.7.0-beta02.txt
index 51a77a6..95166e9 100644
--- a/navigation/navigation-common/api/restricted_2.7.0-beta02.txt
+++ b/navigation/navigation-common/api/restricted_2.7.0-beta02.txt
@@ -128,6 +128,10 @@
property public final androidx.lifecycle.SavedStateHandle savedStateHandle;
property public androidx.savedstate.SavedStateRegistry savedStateRegistry;
property public androidx.lifecycle.ViewModelStore viewModelStore;
+ field public static final androidx.navigation.NavBackStackEntry.Companion Companion;
+ }
+
+ public static final class NavBackStackEntry.Companion {
}
public final class NavDeepLink {
diff --git a/navigation/navigation-common/api/restricted_current.txt b/navigation/navigation-common/api/restricted_current.txt
index 51a77a6..95166e9 100644
--- a/navigation/navigation-common/api/restricted_current.txt
+++ b/navigation/navigation-common/api/restricted_current.txt
@@ -128,6 +128,10 @@
property public final androidx.lifecycle.SavedStateHandle savedStateHandle;
property public androidx.savedstate.SavedStateRegistry savedStateRegistry;
property public androidx.lifecycle.ViewModelStore viewModelStore;
+ field public static final androidx.navigation.NavBackStackEntry.Companion Companion;
+ }
+
+ public static final class NavBackStackEntry.Companion {
}
public final class NavDeepLink {
diff --git a/navigation/navigation-common/lint-baseline.xml b/navigation/navigation-common/lint-baseline.xml
deleted file mode 100644
index af90ea4..0000000
--- a/navigation/navigation-common/lint-baseline.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.1.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta02)" variant="all" version="8.1.0-beta02">
-
- <issue
- id="BanHideAnnotation"
- message="@hide is not allowed in Javadoc"
- errorLine1=" public companion object {"
- errorLine2=" ~~~~~~">
- <location
- file="src/main/java/androidx/navigation/NavBackStackEntry.kt"/>
- </issue>
-
-</issues>
diff --git a/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkActionTest.kt b/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkActionTest.kt
index 539817a..458a770 100644
--- a/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkActionTest.kt
+++ b/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkActionTest.kt
@@ -103,4 +103,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkMimeTypeTest.kt b/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkMimeTypeTest.kt
index 959dc2c..bc54d82 100644
--- a/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkMimeTypeTest.kt
+++ b/navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDeepLinkMimeTypeTest.kt
@@ -171,4 +171,4 @@
)
.isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavDestination.kt b/navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavDestination.kt
index bd6c390..5472fd1 100644
--- a/navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavDestination.kt
+++ b/navigation/navigation-common/src/androidTest/java/androidx/navigation/test/NavDestination.kt
@@ -19,4 +19,4 @@
import android.net.Uri
internal fun NavDestination.matchDeepLink(uri: Uri) =
- matchDeepLink(NavDeepLinkRequest(uri, null, null))
\ No newline at end of file
+ matchDeepLink(NavDeepLinkRequest(uri, null, null))
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NamedNavArgument.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NamedNavArgument.kt
index 8032df6..d898cc0 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NamedNavArgument.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NamedNavArgument.kt
@@ -48,4 +48,4 @@
* Provides destructuring access to this [NamedNavArgument]'s [argument]
*/
public operator fun component2(): NavArgument = argument
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NavAction.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NavAction.kt
index 67ace8f..3eea87f 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NavAction.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NavAction.kt
@@ -50,4 +50,4 @@
* @return bundle of default argument values
*/
public var defaultArguments: Bundle? = null
-)
\ No newline at end of file
+)
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
index 285294d..d8903e8 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NavArgument.kt
@@ -200,4 +200,4 @@
} else false
}.keys
return requiredArgumentKeys.filter { key -> isArgumentMissing(key) }
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
index 0cf2b96..0d605ee 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
@@ -84,10 +84,6 @@
maxLifecycle = entry.maxLifecycle
}
- /**
- * @hide
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public companion object {
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun create(
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
index 218012d..d370c0e 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NavDestinationBuilder.kt
@@ -256,4 +256,4 @@
public fun build(): NavArgument {
return builder.build()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt b/navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt
index 2eaac12..f1061dd 100644
--- a/navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt
+++ b/navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt
@@ -91,4 +91,4 @@
)
navigator.navigate(listOf(startDestinationEntry), navOptions, navigatorExtras)
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-common/src/test/java/androidx/navigation/ActionOnlyNavDirectionsTest.kt b/navigation/navigation-common/src/test/java/androidx/navigation/ActionOnlyNavDirectionsTest.kt
index 42a66adc..6c84215 100644
--- a/navigation/navigation-common/src/test/java/androidx/navigation/ActionOnlyNavDirectionsTest.kt
+++ b/navigation/navigation-common/src/test/java/androidx/navigation/ActionOnlyNavDirectionsTest.kt
@@ -39,4 +39,4 @@
assertThat(ActionOnlyNavDirections(1).hashCode())
.isNotEqualTo(ActionOnlyNavDirections(2).hashCode())
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt b/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
index b6b5d155..ee9cf21 100644
--- a/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
+++ b/navigation/navigation-compose-lint/src/main/java/androidx/navigation/compose/lint/NavigationComposeIssueRegistry.kt
@@ -38,4 +38,4 @@
vendorName = "Jetpack Navigation Compose",
identifier = "androidx.navigation.compose"
)
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt
index 243a1d1..a39e8ab 100644
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt
+++ b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt
@@ -68,4 +68,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NestedNavDemo.kt b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NestedNavDemo.kt
index 379a5669..205649e 100644
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NestedNavDemo.kt
+++ b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NestedNavDemo.kt
@@ -28,4 +28,4 @@
@Composable
fun NestNavInGraphDemo() {
NestedNavInGraph()
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt b/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
index 4cc5ef4..ae36260 100644
--- a/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
+++ b/navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
@@ -20,6 +20,7 @@
import android.os.Parcelable
import androidx.annotation.Sampled
import androidx.annotation.StringRes
+import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -73,8 +74,48 @@
val navController = rememberNavController()
NavHost(navController, startDestination = Screen.Profile.route) {
composable(Screen.Profile.route) { Profile(navController) }
- composable(Screen.Dashboard.route) { Dashboard(navController) }
- composable(Screen.Scrollable.route) { Scrollable(navController) }
+ composable(
+ Screen.Dashboard.route,
+ enterTransition = {
+ if (initialState.destination.route == Screen.Scrollable.route) {
+ // Slide in when entering from Scrollable
+ slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Start)
+ } else {
+ null
+ }
+ },
+ popExitTransition = {
+ if (targetState.destination.route == Screen.Scrollable.route) {
+ // Slide out when popping back to Scrollable
+ slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.End)
+ } else {
+ null
+ }
+ }
+ ) {
+ Dashboard(navController)
+ }
+ composable(
+ Screen.Scrollable.route,
+ exitTransition = {
+ if (targetState.destination.route == Screen.Dashboard.route) {
+ // Slide out when navigating to Dashboard
+ slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Start)
+ } else {
+ null
+ }
+ },
+ popEnterTransition = {
+ if (initialState.destination.route == Screen.Dashboard.route) {
+ // Slide back in when returning from Dashboard
+ slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.End)
+ } else {
+ null
+ }
+ }
+ ) {
+ Scrollable(navController)
+ }
dialog(Screen.Dialog.route) { DialogContent(navController) }
}
}
diff --git a/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt b/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
index 619b7db..2f5ba2f 100644
--- a/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
+++ b/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
@@ -216,4 +216,4 @@
private const val firstRoute = "first"
private const val secondRoute = "second"
-private const val thirdRoute = "third"
\ No newline at end of file
+private const val thirdRoute = "third"
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavGraphNavigator.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavGraphNavigator.kt
new file mode 100644
index 0000000..58f5c51
--- /dev/null
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavGraphNavigator.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.navigation.compose
+
+import androidx.compose.animation.AnimatedContentTransitionScope
+import androidx.compose.animation.EnterTransition
+import androidx.compose.animation.ExitTransition
+import androidx.navigation.NavBackStackEntry
+import androidx.navigation.NavGraph
+import androidx.navigation.NavGraphNavigator
+import androidx.navigation.Navigator
+import androidx.navigation.NavigatorProvider
+
+/**
+ * Custom subclass of [NavGraphNavigator] that adds support for defining
+ * transitions at the navigation graph level.
+ */
+@Navigator.Name("navigation")
+internal class ComposeNavGraphNavigator(
+ navigatorProvider: NavigatorProvider
+) : NavGraphNavigator(navigatorProvider) {
+ override fun createDestination(): NavGraph {
+ return ComposeNavGraph(this)
+ }
+
+ internal class ComposeNavGraph(
+ navGraphNavigator: Navigator<out NavGraph>
+ ) : NavGraph(navGraphNavigator) {
+ internal var enterTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null
+
+ internal var exitTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null
+
+ internal var popEnterTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null
+
+ internal var popExitTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null
+ }
+}
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigator.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigator.kt
index 9603330..d087489 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigator.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigator.kt
@@ -17,6 +17,9 @@
package androidx.navigation.compose
import androidx.compose.animation.AnimatedContentScope
+import androidx.compose.animation.AnimatedContentTransitionScope
+import androidx.compose.animation.EnterTransition
+import androidx.compose.animation.ExitTransition
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.navigation.NavBackStackEntry
@@ -97,6 +100,18 @@
navigator: ComposeNavigator,
content: @Composable (NavBackStackEntry) -> @JvmSuppressWildcards Unit
) : this(navigator, content = { entry -> content(entry) })
+
+ internal var enterTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null
+
+ internal var exitTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null
+
+ internal var popEnterTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)? = null
+
+ internal var popExitTransition: (@JvmSuppressWildcards
+ AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)? = null
}
internal companion object {
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
index 52e53bf..31be078 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
@@ -103,10 +103,10 @@
deepLinks.forEach { deepLink ->
addDeepLink(deepLink)
}
- enterTransition?.let { enterTransitions[route] = enterTransition }
- exitTransition?.let { exitTransitions[route] = exitTransition }
- popEnterTransition?.let { popEnterTransitions[route] = popEnterTransition }
- popExitTransition?.let { popExitTransitions[route] = popExitTransition }
+ this.enterTransition = enterTransition
+ this.exitTransition = exitTransition
+ this.popEnterTransition = popEnterTransition
+ this.popExitTransition = popExitTransition
}
)
}
@@ -186,10 +186,12 @@
deepLinks.forEach { deepLink ->
addDeepLink(deepLink)
}
- enterTransition?.let { enterTransitions[route] = enterTransition }
- exitTransition?.let { exitTransitions[route] = exitTransition }
- popEnterTransition?.let { popEnterTransitions[route] = popEnterTransition }
- popExitTransition?.let { popExitTransitions[route] = popExitTransition }
+ if (this is ComposeNavGraphNavigator.ComposeNavGraph) {
+ this.enterTransition = enterTransition
+ this.exitTransition = exitTransition
+ this.popEnterTransition = popEnterTransition
+ this.popExitTransition = popExitTransition
+ }
}
)
}
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
index 47687128..2bcda5b 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
@@ -252,11 +252,11 @@
if (composeNavigator.isPop.value) {
targetDestination.hierarchy.firstNotNullOfOrNull { destination ->
- popEnterTransitions[destination.route]?.invoke(this)
+ destination.createPopEnterTransition(this)
} ?: popEnterTransition.invoke(this)
} else {
targetDestination.hierarchy.firstNotNullOfOrNull { destination ->
- enterTransitions[destination.route]?.invoke(this)
+ destination.createEnterTransition(this)
} ?: enterTransition.invoke(this)
}
}
@@ -266,11 +266,11 @@
if (composeNavigator.isPop.value) {
initialDestination.hierarchy.firstNotNullOfOrNull { destination ->
- popExitTransitions[destination.route]?.invoke(this)
+ destination.createPopExitTransition(this)
} ?: popExitTransition.invoke(this)
} else {
initialDestination.hierarchy.firstNotNullOfOrNull { destination ->
- exitTransitions[destination.route]?.invoke(this)
+ destination.createExitTransition(this)
} ?: exitTransition.invoke(this)
}
}
@@ -337,18 +337,33 @@
DialogHost(dialogNavigator)
}
-internal val enterTransitions =
- mutableMapOf<String?,
- (AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)?>()
+private fun NavDestination.createEnterTransition(
+ scope: AnimatedContentTransitionScope<NavBackStackEntry>
+): EnterTransition? = when (this) {
+ is ComposeNavigator.Destination -> this.enterTransition?.invoke(scope)
+ is ComposeNavGraphNavigator.ComposeNavGraph -> this.enterTransition?.invoke(scope)
+ else -> null
+}
-internal val exitTransitions =
- mutableMapOf<String?,
- (AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)?>()
+private fun NavDestination.createExitTransition(
+ scope: AnimatedContentTransitionScope<NavBackStackEntry>
+): ExitTransition? = when (this) {
+ is ComposeNavigator.Destination -> this.exitTransition?.invoke(scope)
+ is ComposeNavGraphNavigator.ComposeNavGraph -> this.exitTransition?.invoke(scope)
+ else -> null
+}
-internal val popEnterTransitions =
- mutableMapOf<String?,
- (AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition?)?>()
-
-internal val popExitTransitions =
- mutableMapOf<String?,
- (AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition?)?>()
\ No newline at end of file
+private fun NavDestination.createPopEnterTransition(
+ scope: AnimatedContentTransitionScope<NavBackStackEntry>
+): EnterTransition? = when (this) {
+ is ComposeNavigator.Destination -> this.popEnterTransition?.invoke(scope)
+ is ComposeNavGraphNavigator.ComposeNavGraph -> this.popEnterTransition?.invoke(scope)
+ else -> null
+}
+private fun NavDestination.createPopExitTransition(
+ scope: AnimatedContentTransitionScope<NavBackStackEntry>
+): ExitTransition? = when (this) {
+ is ComposeNavigator.Destination -> this.popExitTransition?.invoke(scope)
+ is ComposeNavGraphNavigator.ComposeNavGraph -> this.popExitTransition?.invoke(scope)
+ else -> null
+}
diff --git a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
index 60ca1e9..2c84ae7 100644
--- a/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
+++ b/navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
@@ -68,6 +68,7 @@
private fun createNavController(context: Context) =
NavHostController(context).apply {
+ navigatorProvider.addNavigator(ComposeNavGraphNavigator(navigatorProvider))
navigatorProvider.addNavigator(ComposeNavigator())
navigatorProvider.addNavigator(DialogNavigator())
}
diff --git a/navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragmentTest.kt b/navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragmentTest.kt
index b05a6cc..54267a3 100644
--- a/navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragmentTest.kt
+++ b/navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragmentTest.kt
@@ -93,4 +93,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt b/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt
index d90be5f..cbb10b0 100644
--- a/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt
+++ b/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicIncludeNavGraphBuilderTest.kt
@@ -195,4 +195,4 @@
private const val GRAPH_ROUTE = "graph"
private const val MODULE_NAME = "myModule"
private const val GRAPH_PACKAGE = "com.example.mypackage"
-private const val GRAPH_RESOURCE_NAME = "graphName"
\ No newline at end of file
+private const val GRAPH_RESOURCE_NAME = "graphName"
diff --git a/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt b/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt
index cbbcf25..3d6625b 100644
--- a/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt
+++ b/navigation/navigation-dynamic-features-runtime/src/androidTest/java/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilderTest.kt
@@ -172,4 +172,4 @@
public fun DynamicNavGraphBuilder.navDestination(
route: String,
builder: NavDestinationBuilder<NavDestination>.() -> Unit
-): Unit = destination(NavDestinationBuilder(provider[NoOpNavigator::class], route).apply(builder))
\ No newline at end of file
+): Unit = destination(NavDestinationBuilder(provider[NoOpNavigator::class], route).apply(builder))
diff --git a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/MultiNavHostFragmentTest.kt b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/MultiNavHostFragmentTest.kt
index eb54237..c715a81 100644
--- a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/MultiNavHostFragmentTest.kt
+++ b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/MultiNavHostFragmentTest.kt
@@ -146,4 +146,4 @@
super.onDestroyView()
destroyViewCountDownLatch.countDown()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavHostFragmentTest.kt b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavHostFragmentTest.kt
index 7640097..2ea9ec0 100644
--- a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavHostFragmentTest.kt
+++ b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/NavHostFragmentTest.kt
@@ -166,4 +166,4 @@
assertThat(savedStateHandle)
.isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt
index a4de7e6..b660a329 100644
--- a/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt
+++ b/navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/test/NavigationActivity.kt
@@ -37,4 +37,4 @@
super.finish()
finishCountDownLatch.countDown()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/AbstractListDetailFragment.kt b/navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/AbstractListDetailFragment.kt
index 44692c6..38f685a 100644
--- a/navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/AbstractListDetailFragment.kt
+++ b/navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/AbstractListDetailFragment.kt
@@ -253,4 +253,4 @@
outState.putInt(NavHostFragment.KEY_GRAPH_ID, graphId)
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavInflater.kt b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavInflater.kt
index 7722bba..23fa625 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavInflater.kt
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavInflater.kt
@@ -348,4 +348,4 @@
return navType ?: expectedNavType
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/CodeFile.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/CodeFile.kt
index d73ab42..5d4dbae 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/CodeFile.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/CodeFile.kt
@@ -21,4 +21,4 @@
interface CodeFile {
fun writeTo(directory: File)
fun fileName(): String
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt
index 2fe9aed..41847ea 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Context.kt
@@ -34,4 +34,4 @@
fun createStubIncludedDestination() = IncludedDestination(createStubId())
private fun next() = nextId++
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavLogger.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavLogger.kt
index 0cfeab2..d3c9ed9 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavLogger.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavLogger.kt
@@ -24,4 +24,4 @@
}
fun allMessages(): List<ErrorMessage> = messages
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt
index 9db93e1..c363dae 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavParserErrors.kt
@@ -62,4 +62,4 @@
fun invalidNavReference(value: String) = "Failed to parse '$value' as a navigation reference." +
" Reference must be in format @[package:]navigation/resource_name"
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavWriter.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavWriter.kt
index 10d046e..2944947 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavWriter.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/NavWriter.kt
@@ -25,4 +25,4 @@
): T
fun generateArgsCodeFile(destination: Destination): T
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt
index 0c9e1eb..c52b8c3 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/Types.kt
@@ -175,4 +175,4 @@
object NullValue : WritableValue
-data class EnumValue(val type: ObjectType, val value: String) : WritableValue
\ No newline at end of file
+data class EnumValue(val type: ObjectType, val value: String) : WritableValue
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPosition.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPosition.kt
index bf92bae..d2f7fb5 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPosition.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPosition.kt
@@ -16,4 +16,4 @@
package androidx.navigation.safe.args.generator
-data class XmlPosition(val name: String, val line: Int, val column: Int)
\ No newline at end of file
+data class XmlPosition(val name: String, val line: Int, val column: Int)
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPositionParser.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPositionParser.kt
index d0e29bc..b76b43b 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPositionParser.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/XmlPositionParser.kt
@@ -81,4 +81,4 @@
}
internal fun mandatoryAttrMissingError(tag: String, attr: String) =
- "Mandatory attribute '$attr' for tag '$tag' is missing."
\ No newline at end of file
+ "Mandatory attribute '$attr' for tag '$tag' is missing."
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/ext/List_ext.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/ext/List_ext.kt
index 2c19c7f..39d1152 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/ext/List_ext.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/ext/List_ext.kt
@@ -26,4 +26,4 @@
0 -> throw IllegalArgumentException("invalid section size, cannot be zero")
1 -> this[0].toCamelCaseAsVar()
else -> get(0).toCamelCaseAsVar() + drop(1).joinToCamelCase()
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaCodeFile.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaCodeFile.kt
index 5d0ebd3..5f7a984 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaCodeFile.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaCodeFile.kt
@@ -33,4 +33,4 @@
override fun toString() = wrapped.toString()
}
-fun JavaFile.toCodeFile() = JavaCodeFile(this)
\ No newline at end of file
+fun JavaFile.toCodeFile() = JavaCodeFile(this)
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaTypes.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaTypes.kt
index 0ec5e48..d76fabd 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaTypes.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/java/JavaTypes.kt
@@ -300,4 +300,4 @@
internal fun ResReference?.accessor() = this?.let {
CodeBlock.of("$T.$N", ClassName.get(packageName, "R", resType), javaIdentifier)
-} ?: CodeBlock.of("0")
\ No newline at end of file
+} ?: CodeBlock.of("0")
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinCodeFile.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinCodeFile.kt
index 2bfe1f5..854d1ed 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinCodeFile.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinCodeFile.kt
@@ -33,4 +33,4 @@
override fun toString() = wrapped.toString()
}
-fun FileSpec.toCodeFile() = KotlinCodeFile(this)
\ No newline at end of file
+fun FileSpec.toCodeFile() = KotlinCodeFile(this)
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinNavWriter.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinNavWriter.kt
index de7bb7b..e2a61cc 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinNavWriter.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinNavWriter.kt
@@ -384,4 +384,4 @@
.addMember("%S", "CAST_NEVER_SUCCEEDS")
.build()
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinTypes.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinTypes.kt
index 4a3a9dd..5d74183 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinTypes.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/kotlin/KotlinTypes.kt
@@ -281,4 +281,4 @@
internal fun ResReference?.accessor() = this?.let {
CodeBlock.of("%T.%N", ClassName(packageName, "R", resType), javaIdentifier)
-} ?: CodeBlock.of("0")
\ No newline at end of file
+} ?: CodeBlock.of("0")
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt
index bde5a88..3bfb234 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/Destination.kt
@@ -44,4 +44,4 @@
else -> null
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt
index e28eb81..dface4e 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/IncludedDestination.kt
@@ -16,4 +16,4 @@
package androidx.navigation.safe.args.generator.models
-data class IncludedDestination(val id: ResReference, var actual: Destination? = null)
\ No newline at end of file
+data class IncludedDestination(val id: ResReference, var actual: Destination? = null)
diff --git a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/ResReference.kt b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/ResReference.kt
index 214a413..e298dee 100644
--- a/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/ResReference.kt
+++ b/navigation/navigation-safe-args-generator/src/main/kotlin/androidx/navigation/safe/args/generator/models/ResReference.kt
@@ -22,4 +22,4 @@
val javaIdentifier = name.replace("[.\\-]".toRegex(), "_")
fun isId() = resType == "id"
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/DestinationTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/DestinationTest.kt
index 7604be3..a8e795c 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/DestinationTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/DestinationTest.kt
@@ -71,4 +71,4 @@
}
}
-private fun id(name: String) = ResReference("foo.bar", "id", name)
\ No newline at end of file
+private fun id(name: String) = ResReference("foo.bar", "id", name)
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/JavaNavWriterTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/JavaNavWriterTest.kt
index 9723d49..3c79024 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/JavaNavWriterTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/JavaNavWriterTest.kt
@@ -393,4 +393,4 @@
return super.findClass(name)
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavArgumentResolverTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavArgumentResolverTest.kt
index 29c9fbf..a28cf39 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavArgumentResolverTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavArgumentResolverTest.kt
@@ -126,4 +126,4 @@
// expected error
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavGeneratorTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavGeneratorTest.kt
index cb2cb9f..6fae4bc 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavGeneratorTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavGeneratorTest.kt
@@ -187,4 +187,4 @@
@Parameterized.Parameters(name = "generateKotlin={0}")
fun data() = listOf(false, true)
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt
index e0c1609..a205ddf6 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/NavParserTest.kt
@@ -299,4 +299,4 @@
assertThat("nameWithHyphens")
.isEqualTo(Argument("name-with-hyphens", IntType).sanitizedName)
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/TestData.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/TestData.kt
index 8b94484c..4587646 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/TestData.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/TestData.kt
@@ -18,4 +18,4 @@
import java.io.File
-fun testData(path: String) = File("src/test/test-data/$path")
\ No newline at end of file
+fun testData(path: String) = File("src/test/test-data/$path")
diff --git a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/WritableValueTest.kt b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/WritableValueTest.kt
index 3f7d890..87fcdff 100644
--- a/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/WritableValueTest.kt
+++ b/navigation/navigation-safe-args-generator/src/test/kotlin/androidx/navigation/safe/args/generator/WritableValueTest.kt
@@ -45,4 +45,4 @@
`is`("foo.R.id.bla")
)
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-gradle-plugin/src/main/kotlin/androidx/navigation/safeargs/gradle/SafeArgsPlugin.kt b/navigation/navigation-safe-args-gradle-plugin/src/main/kotlin/androidx/navigation/safeargs/gradle/SafeArgsPlugin.kt
index 47edf23..26f46d6 100644
--- a/navigation/navigation-safe-args-gradle-plugin/src/main/kotlin/androidx/navigation/safeargs/gradle/SafeArgsPlugin.kt
+++ b/navigation/navigation-safe-args-gradle-plugin/src/main/kotlin/androidx/navigation/safeargs/gradle/SafeArgsPlugin.kt
@@ -177,4 +177,4 @@
) : SafeArgsPlugin(providerFactory) {
override val generateKotlin = true
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/IncrementalPluginTest.kt b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/IncrementalPluginTest.kt
index 5a32c9d..be2129c 100644
--- a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/IncrementalPluginTest.kt
+++ b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/IncrementalPluginTest.kt
@@ -184,4 +184,4 @@
@Parameterized.Parameters(name = "generateKotlin={0}")
fun data() = listOf(false) // , true) testing with kotlin is disabled b/165307851
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/JavaPluginTest.kt b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/JavaPluginTest.kt
index 4e81b7d..ea6e2bc 100644
--- a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/JavaPluginTest.kt
+++ b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/JavaPluginTest.kt
@@ -122,4 +122,4 @@
assertGenerated("foo/debug/$FOO_DYNAMIC_DIRECTIONS.java", "dynamic_feature/")
assertNotGenerated("notfoo/debug/$FOO_DYNAMIC_DIRECTIONS.java", "dynamic_feature/")
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/KotlinPluginTest.kt b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/KotlinPluginTest.kt
index 489c3d3..962f0e1 100644
--- a/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/KotlinPluginTest.kt
+++ b/navigation/navigation-safe-args-gradle-plugin/src/test/kotlin/androidx/navigation/safeargs/gradle/KotlinPluginTest.kt
@@ -77,4 +77,4 @@
assertGenerated("debug/$FOO_NEXT_ARGUMENTS.kt")
assertGenerated("debug/$FOO_MAIN_DIRECTIONS.kt")
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt b/navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
index f49daaa..8eb8877 100644
--- a/navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
+++ b/navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
@@ -417,4 +417,4 @@
wasCleared = true
}
}
-}
\ No newline at end of file
+}
diff --git a/navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUiSaveStateControl.kt b/navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUiSaveStateControl.kt
index 724eeb1..1063256 100644
--- a/navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUiSaveStateControl.kt
+++ b/navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUiSaveStateControl.kt
@@ -22,4 +22,4 @@
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
-public annotation class NavigationUiSaveStateControl
\ No newline at end of file
+public annotation class NavigationUiSaveStateControl
diff --git a/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt b/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
index e816c7c..68a89b0 100644
--- a/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
+++ b/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
@@ -161,4 +161,4 @@
private enum class RefreshState {
INITIAL, LOADING, DONE
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/Item.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/Item.kt
index fee8d36..925e550 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/Item.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/Item.kt
@@ -30,4 +30,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/StateItemAdapter.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/StateItemAdapter.kt
index 66f1dfc..3b921a8 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/StateItemAdapter.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/StateItemAdapter.kt
@@ -67,4 +67,4 @@
override fun onBindViewHolder(holder: LoadStateViewHolder, loadState: LoadState) =
holder.bind(loadState)
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt
index 787bf63..c85f3f3 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Activity.kt
@@ -88,4 +88,4 @@
button.isEnabled = loadStates.refresh !is Loading
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Adapter.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Adapter.kt
index ad2c82b..4eff329 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Adapter.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3/V3Adapter.kt
@@ -46,4 +46,4 @@
holder.itemView.setBackgroundColor(Color.TRANSPARENT)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RemoteMediator.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RemoteMediator.kt
index 490e234..1f3dac2 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RemoteMediator.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RemoteMediator.kt
@@ -108,4 +108,4 @@
networkSource = newNetworkSource
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomActivity.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomActivity.kt
index 8bad4dc..d248ea5 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomActivity.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomActivity.kt
@@ -49,4 +49,4 @@
val clearButton = findViewById<Button>(R.id.clearButton)
clearButton.setOnClickListener { viewModel.clearAllCustomers() }
}
-}
\ No newline at end of file
+}
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomAdapter.kt b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomAdapter.kt
index a1e2dfb..56ef134 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomAdapter.kt
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/v3room/V3RoomAdapter.kt
@@ -47,4 +47,4 @@
holder.itemView.setBackgroundColor(Color.TRANSPARENT)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/api/current.txt b/paging/paging-common/api/current.txt
index 9172836..dfd8bc1 100644
--- a/paging/paging-common/api/current.txt
+++ b/paging/paging-common/api/current.txt
@@ -144,9 +144,9 @@
enum_constant public static final androidx.paging.LoadType REFRESH;
}
- public interface Logger {
- method public boolean isLoggable(int level);
- method public void log(int level, String message, optional Throwable? tr);
+ @Deprecated public interface Logger {
+ method @Deprecated public boolean isLoggable(int level);
+ method @Deprecated public void log(int level, String message, optional Throwable? tr);
}
@Deprecated public abstract class PageKeyedDataSource<Key, Value> extends androidx.paging.DataSource<Key,Value> {
diff --git a/paging/paging-common/api/res-3.2.0-beta01.txt b/paging/paging-common/api/res-3.2.0-beta01.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/paging/paging-common/api/res-3.2.0-beta01.txt
diff --git a/paging/paging-common/api/res-current.txt b/paging/paging-common/api/res-current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/paging/paging-common/api/res-current.txt
diff --git a/paging/paging-common/api/restricted_current.txt b/paging/paging-common/api/restricted_current.txt
index 9172836..dfd8bc1 100644
--- a/paging/paging-common/api/restricted_current.txt
+++ b/paging/paging-common/api/restricted_current.txt
@@ -144,9 +144,9 @@
enum_constant public static final androidx.paging.LoadType REFRESH;
}
- public interface Logger {
- method public boolean isLoggable(int level);
- method public void log(int level, String message, optional Throwable? tr);
+ @Deprecated public interface Logger {
+ method @Deprecated public boolean isLoggable(int level);
+ method @Deprecated public void log(int level, String message, optional Throwable? tr);
}
@Deprecated public abstract class PageKeyedDataSource<Key, Value> extends androidx.paging.DataSource<Key,Value> {
diff --git a/paging/paging-common/build.gradle b/paging/paging-common/build.gradle
index b949eff..3368c0b 100644
--- a/paging/paging-common/build.gradle
+++ b/paging/paging-common/build.gradle
@@ -17,11 +17,11 @@
import androidx.build.KmpPlatformsKt
import androidx.build.PlatformIdentifier
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
-import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import androidx.build.Publish
plugins {
id("AndroidXPlugin")
+ id("com.android.library")
}
def enableNative = KmpPlatformsKt.enableNative(project)
@@ -31,6 +31,7 @@
mac()
linux()
ios()
+ android()
defaultPlatform(PlatformIdentifier.JVM)
@@ -46,30 +47,51 @@
}
}
- jvmMain {
+ commonJvmAndroidMain {
dependsOn(commonMain)
+
dependencies {
api("androidx.arch.core:core-common:2.2.0")
-
}
}
+ jvmMain {
+ dependsOn(commonJvmAndroidMain)
+ }
+
+ androidMain {
+ dependsOn(commonJvmAndroidMain)
+ }
+
commonTest {
dependencies {
implementation(libs.kotlinCoroutinesTest)
implementation(libs.kotlinTest)
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
+ implementation(project(":internal-testutils-paging"))
}
}
- jvmTest {
+ commonJvmAndroidTest {
+ dependsOn(commonTest)
dependencies {
implementation(libs.junit)
implementation(libs.mockitoCore4)
implementation(libs.mockitoKotlin4)
implementation(project(":internal-testutils-common"))
implementation(project(":internal-testutils-ktx"))
- implementation(project(":internal-testutils-paging"))
+ }
+ }
+
+ jvmTest {
+ dependsOn(commonJvmAndroidTest)
+ }
+
+ androidAndroidTest {
+ dependsOn(commonJvmAndroidTest)
+ dependencies {
+ implementation(libs.testRunner)
+ implementation(libs.mockitoAndroid)
}
}
@@ -82,12 +104,6 @@
}
}
- // use new memory model
- targets.withType(KotlinNativeTarget).configureEach {
- binaries.all {
- binaryOptions["memoryModel"] = "experimental"
- }
- }
targets.all { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
@@ -113,3 +129,7 @@
inceptionYear = "2017"
description = "Android Paging-Common"
}
+
+android {
+ namespace "androidx.paging.common"
+}
diff --git a/paging/paging-common/src/androidMain/kotlin/androidx/paging/PagingLogger.android.kt b/paging/paging-common/src/androidMain/kotlin/androidx/paging/PagingLogger.android.kt
new file mode 100644
index 0000000..1d5c6fc
--- /dev/null
+++ b/paging/paging-common/src/androidMain/kotlin/androidx/paging/PagingLogger.android.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.paging
+
+import android.util.Log
+import androidx.annotation.RestrictTo
+
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public actual object PagingLogger {
+ /**
+ * isLoggable returns true if Logging is enabled via adb shell command i.e.
+ * "adb shell setprop log.tag.Paging VERBOSE"
+ */
+ public actual fun isLoggable(level: Int): Boolean {
+ return Log.isLoggable(LOG_TAG, level)
+ }
+
+ public actual fun log(level: Int, message: String, tr: Throwable?) {
+ when (level) {
+ Log.DEBUG -> Log.d(LOG_TAG, message, tr)
+ Log.VERBOSE -> Log.v(LOG_TAG, message, tr)
+ else -> {
+ throw IllegalArgumentException(
+ "debug level $level is requested but Paging only supports " +
+ "default logging for level 2 (VERBOSE) or level 3 (DEBUG)"
+ )
+ }
+ }
+ }
+}
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/ContiguousPagedList.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/ContiguousPagedList.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/ContiguousPagedList.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/ContiguousPagedList.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/DataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/DataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/DataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/DataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/InitialDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/InitialDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/InitialDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/InitialDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/InitialPagedList.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/InitialPagedList.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/InitialPagedList.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/InitialPagedList.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/ItemKeyedDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/ItemKeyedDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/ItemKeyedDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/ItemKeyedDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/LegacyPageFetcher.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/LegacyPageFetcher.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/LegacyPageFetcher.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/LegacyPageFetcher.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/LegacyPagingSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/LegacyPagingSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/LegacyPagingSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/LegacyPagingSource.jvm.kt
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/Logger.kt
similarity index 68%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/Logger.kt
index 5d73136..0e8f6b6 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/Logger.kt
@@ -13,7 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+@file:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
package androidx.paging
-public expect annotation class MainThread()
+import androidx.annotation.RestrictTo
+
+@Deprecated("Logger interface is no longer supported.")
+public interface Logger {
+ public fun isLoggable(level: Int): Boolean
+ public fun log(level: Int, message: String, tr: Throwable? = null)
+}
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/MainThread.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/MainThread.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/MainThread.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/MainThread.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt
similarity index 99%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt
index 5c98360..e0d393bc 100644
--- a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt
+++ b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PageKeyedDataSource.jvm.kt
@@ -347,4 +347,4 @@
final override fun <ToValue : Any> map(
function: (Value) -> ToValue
): PageKeyedDataSource<Key, ToValue> = mapByPage(Function { list -> list.map(function) })
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedList.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedList.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedList.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedList.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedListConfig.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedListConfig.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedListConfig.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedListConfig.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedStorage.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedStorage.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagedStorage.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagedStorage.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt
similarity index 99%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt
index 0f3be5f..5184f3f 100644
--- a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt
+++ b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PagingDataTransforms.jvm.kt
@@ -187,4 +187,4 @@
generator(before, after)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PositionalDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PositionalDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/PositionalDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/PositionalDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/SnapshotPagedList.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/SnapshotPagedList.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/SnapshotPagedList.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/SnapshotPagedList.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperItemKeyedDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperItemKeyedDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperItemKeyedDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperItemKeyedDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperPageKeyedDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperPageKeyedDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperPageKeyedDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperPageKeyedDataSource.jvm.kt
diff --git a/paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperPositionalDataSource.jvm.kt b/paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperPositionalDataSource.jvm.kt
similarity index 100%
rename from paging/paging-common/src/jvmMain/kotlin/androidx/paging/WrapperPositionalDataSource.jvm.kt
rename to paging/paging-common/src/commonJvmAndroidMain/kotlin/androidx/paging/WrapperPositionalDataSource.jvm.kt
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt
similarity index 98%
rename from paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt
index 2bc3149..9509e2f 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt
+++ b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/CachedPageEventFlowLeakTest.kt
@@ -21,7 +21,6 @@
import kotlin.test.Test
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.cancel
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.Flow
@@ -33,7 +32,6 @@
/**
* reproduces b/203594733
*/
-@OptIn(ExperimentalCoroutinesApi::class)
public class CachedPageEventFlowLeakTest {
private val gcHelper = GarbageCollectionTestHelper()
@@ -133,7 +131,7 @@
doneInvalidating?.complete(Unit)
}
- @Ignore("b/206837348")
+ @Ignore // b/206837348
@Test
public fun dontLeakCachedPageEventFlows_finished() = runTest {
val scope = CoroutineScope(EmptyCoroutineContext)
@@ -218,4 +216,4 @@
)
collection.cancelAndJoin()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/ContiguousPagedListTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/ContiguousPagedListTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/ContiguousPagedListTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/ContiguousPagedListTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/DataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/DataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/DataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/DataSourceTest.kt
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt
similarity index 99%
rename from paging/paging-common/src/commonTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt
index f7ae9c3..940fd38 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt
+++ b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/GarbageCollectionTestHelper.kt
@@ -83,4 +83,4 @@
entry.key to entry.value.size
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/LegacyPageFetcherTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/LegacyPageFetcherTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/LegacyPageFetcherTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/LegacyPageFetcherTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/LegacyPagingSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/LegacyPagingSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/LegacyPagingSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/LegacyPagingSourceTest.kt
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
similarity index 99%
rename from paging/paging-common/src/commonTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
index 6f07f6e..3988d0c 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
+++ b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
@@ -17,7 +17,6 @@
package androidx.paging
import androidx.kruth.assertThat
-import androidx.paging.ContiguousPagedListTest.Companion.EXCEPTION
import androidx.paging.LoadState.Error
import androidx.paging.LoadState.Loading
import androidx.paging.LoadState.NotLoading
@@ -86,6 +85,8 @@
maxSize = 3
)
+ private val EXCEPTION = Exception()
+
@Test
fun loadStates_prependDone() = testScope.runTest {
val pageFetcher = PageFetcher(pagingSourceFactory, 1, config)
@@ -3911,4 +3912,4 @@
stopped.complete(Unit)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageFetcherTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageFetcherTest.kt
similarity index 100%
rename from paging/paging-common/src/commonTest/kotlin/androidx/paging/PageFetcherTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageFetcherTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PageKeyedDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListConfigBuilderTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListConfigBuilderTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListConfigBuilderTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListConfigBuilderTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListConfigTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListConfigTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListConfigTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListConfigTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedListTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedListTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedStorageTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedStorageTest.kt
similarity index 99%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedStorageTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedStorageTest.kt
index ea3f566..c278dad 100644
--- a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PagedStorageTest.kt
+++ b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PagedStorageTest.kt
@@ -342,4 +342,4 @@
override fun onPagesSwappedToPlaceholder(startOfDrops: Int, count: Int) {}
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/PositionalDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PositionalDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/PositionalDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/PositionalDataSourceTest.kt
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SingleRunnerTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/SingleRunnerTest.kt
similarity index 100%
rename from paging/paging-common/src/commonTest/kotlin/androidx/paging/SingleRunnerTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/SingleRunnerTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
diff --git a/paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt b/paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
similarity index 100%
rename from paging/paging-common/src/jvmTest/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
rename to paging/paging-common/src/commonJvmAndroidTest/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/CancelableChannelFlow.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/CancelableChannelFlow.kt
index 5c31c25..d84eea1 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/CancelableChannelFlow.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/CancelableChannelFlow.kt
@@ -32,4 +32,4 @@
}
this.block()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/CompatLegacyPagingSource.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/CompatLegacyPagingSource.kt
index 951049d..a655684 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/CompatLegacyPagingSource.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/CompatLegacyPagingSource.kt
@@ -27,4 +27,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun setPageSize(pageSize: Int)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/ConflatedEventBus.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/ConflatedEventBus.kt
index 442f451..f58215b 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/ConflatedEventBus.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/ConflatedEventBus.kt
@@ -32,4 +32,4 @@
fun send(data: T) {
state.value = Pair(state.value.first + 1, data)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/ExperimentalPagingApi.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/ExperimentalPagingApi.kt
index f431c33..9f2c625 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/ExperimentalPagingApi.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/ExperimentalPagingApi.kt
@@ -22,4 +22,4 @@
*/
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
-public annotation class ExperimentalPagingApi
\ No newline at end of file
+public annotation class ExperimentalPagingApi
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/FlowExt.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/FlowExt.kt
index bede1e6..beea20a6 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/FlowExt.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/FlowExt.kt
@@ -221,4 +221,4 @@
INITIAL,
RECEIVER,
OTHER,
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintHandler.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintHandler.kt
index 76f77a0..4d35dd4 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintHandler.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintHandler.kt
@@ -164,4 +164,4 @@
false
else -> true
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintReceiver.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintReceiver.kt
index 1b1aba7..22dabae 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintReceiver.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/HintReceiver.kt
@@ -21,4 +21,4 @@
*/
internal interface HintReceiver {
fun accessHint(viewportHint: ViewportHint)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidateCallbackTracker.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidateCallbackTracker.kt
index e23d525..fea2249 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidateCallbackTracker.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidateCallbackTracker.kt
@@ -86,4 +86,4 @@
callbacksToInvoke?.forEach(callbackInvoker)
return true
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidatingPagingSourceFactory.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidatingPagingSourceFactory.kt
index c288fb3..b8cf8c9 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidatingPagingSourceFactory.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/InvalidatingPagingSourceFactory.kt
@@ -56,4 +56,4 @@
pagingSources.removeAll { it.invalid }
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/LoadType.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/LoadType.kt
index 02f7e64..a1fc9e6 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/LoadType.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/LoadType.kt
@@ -41,4 +41,4 @@
* Load at the end of a [PagingData].
*/
APPEND
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/MainThread.kt
similarity index 91%
rename from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
rename to paging/paging-common/src/commonMain/kotlin/androidx/paging/MainThread.kt
index 5d73136..722c0b7 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/MainThread.kt
@@ -16,4 +16,6 @@
package androidx.paging
+@OptIn(ExperimentalMultiplatform::class)
+@OptionalExpectation
public expect annotation class MainThread()
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/MutableLoadStateCollection.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/MutableLoadStateCollection.kt
index c4eb9c5..f9884e4 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/MutableLoadStateCollection.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/MutableLoadStateCollection.kt
@@ -46,4 +46,4 @@
append = states.append
prepend = states.prepend
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/NullPaddedList.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/NullPaddedList.kt
index 2d0659f..63cc7e2f 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/NullPaddedList.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/NullPaddedList.kt
@@ -32,4 +32,4 @@
public val placeholdersAfter: Int
public val size: Int
public val storageCount: Int
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PageFetcherSnapshot.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PageFetcherSnapshot.kt
index 05d09ef..769adc3 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PageFetcherSnapshot.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PageFetcherSnapshot.kt
@@ -635,4 +635,4 @@
generationId < previous.generationId -> false
else -> hint.shouldPrioritizeOver(previous.hint, loadType)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Pager.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/Pager.kt
index 66679f7..f84e05a 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Pager.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/Pager.kt
@@ -16,6 +16,7 @@
package androidx.paging
+import kotlin.jvm.JvmOverloads
import kotlinx.coroutines.flow.Flow
/**
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingConfig.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingConfig.kt
index 5b091ac..6dcf0fe 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingConfig.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingConfig.kt
@@ -19,6 +19,8 @@
import androidx.annotation.IntRange
import androidx.paging.PagingConfig.Companion.MAX_SIZE_UNBOUNDED
import androidx.paging.PagingSource.LoadResult.Page.Companion.COUNT_UNDEFINED
+import kotlin.jvm.JvmField
+import kotlin.jvm.JvmOverloads
/**
* An object used to configure loading behavior within a [Pager], as it loads content from a
@@ -163,4 +165,4 @@
public const val MAX_SIZE_UNBOUNDED: Int = Int.MAX_VALUE
internal const val DEFAULT_INITIAL_PAGE_MULTIPLIER = 3
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingData.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingData.kt
index 8ff3d51..f4e3a15 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingData.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingData.kt
@@ -16,6 +16,8 @@
package androidx.paging
+import kotlin.jvm.JvmOverloads
+import kotlin.jvm.JvmStatic
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
@@ -165,4 +167,4 @@
}
internal fun cachedEvent(): PageEvent.Insert<T>? = cachedPageEvent()
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataDiffer.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataDiffer.kt
index c3c8408..3ecc556 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataDiffer.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataDiffer.kt
@@ -29,6 +29,7 @@
import androidx.paging.internal.appendMediatorStatesIfNotNull
import co.touchlab.stately.collections.ConcurrentMutableList
import kotlin.coroutines.CoroutineContext
+import kotlin.jvm.Volatile
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.BufferOverflow.DROP_OLDEST
import kotlinx.coroutines.flow.Flow
@@ -544,4 +545,4 @@
ITEM_TO_PLACEHOLDER,
PLACEHOLDER_TO_ITEM,
PLACEHOLDER_POSITION_CHANGE
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataTransforms.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataTransforms.kt
index 4ec32fa..9f2c851 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataTransforms.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingDataTransforms.kt
@@ -21,6 +21,10 @@
import androidx.annotation.CheckResult
import androidx.paging.TerminalSeparatorType.FULLY_COMPLETE
+import kotlin.jvm.JvmMultifileClass
+import kotlin.jvm.JvmName
+import kotlin.jvm.JvmOverloads
+import kotlin.jvm.JvmSynthetic
import kotlinx.coroutines.flow.map
internal inline fun <T : Any, R : Any> PagingData<T>.transform(
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Logger.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingLogger.kt
similarity index 72%
rename from paging/paging-common/src/commonMain/kotlin/androidx/paging/Logger.kt
rename to paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingLogger.kt
index fd5f074..8a2a59e 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Logger.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingLogger.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2022 The Android Open Source Project
+ * Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,45 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
@file:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
package androidx.paging
+
import androidx.annotation.IntRange
import androidx.annotation.RestrictTo
-/**
- * Stores an instance of the Logger interface implementation which is to be injected by
- * paging-runtime during runtime. This allows paging-common to add logs with
- * android.util.log as a non-android artifact
- */
-public var LOGGER: Logger? = null
-
public const val LOG_TAG: String = "Paging"
-/**
- */
-public interface Logger {
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public expect object PagingLogger {
public fun isLoggable(level: Int): Boolean
public fun log(level: Int, message: String, tr: Throwable? = null)
}
-/**
- */
public inline fun log(
@IntRange(from = VERBOSE.toLong(), to = DEBUG.toLong()) level: Int,
tr: Throwable? = null,
block: () -> String
) {
- val logger = LOGGER
- if (logger?.isLoggable(level) == true) {
+ val logger = PagingLogger
+ if (logger.isLoggable(level)) {
logger.log(level, block(), tr)
}
}
-/**
- */
public const val VERBOSE: Int = 2
-
-/**
- */
public const val DEBUG: Int = 3
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingSourceFactory.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingSourceFactory.kt
index 4ed3c7f..97be73e 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingSourceFactory.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingSourceFactory.kt
@@ -29,4 +29,4 @@
* This function can be invoked by calling pagingSourceFactory() or pagingSourceFactory::invoke.
*/
public override operator fun invoke(): PagingSource<Key, Value>
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingState.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingState.kt
index f599b9bf..2242b6b 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingState.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/PagingState.kt
@@ -148,4 +148,4 @@
return block(pageIndex, index)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/RemoteMediator.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/RemoteMediator.kt
index 492b88c..cb6f185 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/RemoteMediator.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/RemoteMediator.kt
@@ -22,6 +22,7 @@
import androidx.paging.PagingSource.LoadResult
import androidx.paging.RemoteMediator.InitializeAction.LAUNCH_INITIAL_REFRESH
import androidx.paging.RemoteMediator.InitializeAction.SKIP_INITIAL_REFRESH
+import kotlin.jvm.JvmName
/**
* Defines a set of callbacks used to incrementally load data from a remote source into a local
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Separators.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/Separators.kt
index a58c535..00f9e19 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/Separators.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/Separators.kt
@@ -604,4 +604,4 @@
generator(before, after)
}
return map { separatorState.onEvent(it) }
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/SimpleChannelFlow.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/SimpleChannelFlow.kt
index 1c8ae24..509cf455 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/SimpleChannelFlow.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/SimpleChannelFlow.kt
@@ -96,4 +96,4 @@
block()
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/SingleRunner.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/SingleRunner.kt
index 2428de1..e411de3 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/SingleRunner.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/SingleRunner.kt
@@ -75,7 +75,9 @@
* We use this special class so that we can still support regular cancelation coming from the
* `block` but don't cancel its coroutine just to cancel the block.
*/
- private class CancelIsolatedRunnerException(val runner: SingleRunner) : CancellationException()
+ private class CancelIsolatedRunnerException(
+ val runner: SingleRunner
+ ) : CancellationException("Cancelled isolated runner")
private class Holder(
private val singleRunner: SingleRunner,
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/Constants.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/Constants.kt
index 7875b70..d10d9db 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/Constants.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/Constants.kt
@@ -20,4 +20,4 @@
import androidx.annotation.RestrictTo
-internal const val BUGANIZER_URL = "https://issuetracker.google.com/issues/new?component=413106"
\ No newline at end of file
+internal const val BUGANIZER_URL = "https://issuetracker.google.com/issues/new?component=413106"
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/LogUtil.kt b/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/LogUtil.kt
index b567edd..9a37902 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/LogUtil.kt
+++ b/paging/paging-common/src/commonMain/kotlin/androidx/paging/internal/LogUtil.kt
@@ -29,4 +29,4 @@
newLog = newLog.plus("""| mediatorLoadStates: $mediatorStates${"\n"}""")
}
return newLog.plus("|)").trimMargin()
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowTest.kt
index ce6a0a8..40550f8 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachedPageEventFlowTest.kt
@@ -33,18 +33,19 @@
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
@OptIn(ExperimentalCoroutinesApi::class)
-@RunWith(Parameterized::class)
-class CachedPageEventFlowTest(
- private val terminationType: TerminationType
-) {
+class CachedPageEventFlowTest {
private val testScope = TestScope(UnconfinedTestDispatcher())
@Test
- fun slowFastCollectors() = testScope.runTest {
+ fun slowFastCollectors_CloseUpstream() = slowFastCollectors(TerminationType.CloseUpstream)
+
+ @Test
+ fun slowFastCollectors_CloseCachedEventFlow() =
+ slowFastCollectors(TerminationType.CloseCachedEventFlow)
+
+ private fun slowFastCollectors(terminationType: TerminationType) = testScope.runTest {
val upstream = Channel<PageEvent<String>>(Channel.UNLIMITED)
val subject = CachedPageEventFlow(
src = upstream.consumeAsFlow(),
@@ -114,8 +115,8 @@
)
upstream.send(finalAppendEvent)
when (terminationType) {
- TerminationType.CLOSE_UPSTREAM -> upstream.close()
- TerminationType.CLOSE_CACHED_EVENT_FLOW -> subject.close()
+ TerminationType.CloseUpstream -> upstream.close()
+ TerminationType.CloseCachedEventFlow -> subject.close()
}
val fullList = listOf(
refreshEvent,
@@ -144,7 +145,13 @@
}
@Test
- fun ensureSharing() = testScope.runTest {
+ fun ensureSharing_CloseUpstream() = ensureSharing(TerminationType.CloseUpstream)
+
+ @Test
+ fun ensureSharing_CloseCachedEventFlow() =
+ ensureSharing(TerminationType.CloseCachedEventFlow)
+
+ private fun ensureSharing(terminationType: TerminationType) = testScope.runTest {
val refreshEvent = localRefresh(
listOf(
TransformablePage(
@@ -229,8 +236,8 @@
assertThat(collector2.isActive()).isTrue()
assertThat(collector3.isActive()).isTrue()
when (terminationType) {
- TerminationType.CLOSE_UPSTREAM -> upstream.close()
- TerminationType.CLOSE_CACHED_EVENT_FLOW -> subject.close()
+ TerminationType.CloseUpstream -> upstream.close()
+ TerminationType.CloseCachedEventFlow -> subject.close()
}
runCurrent()
assertThat(collector1.isActive()).isFalse()
@@ -344,14 +351,8 @@
fun items() = items.toList()
}
- companion object {
- @JvmStatic
- @Parameterized.Parameters(name = "{0}")
- fun params() = TerminationType.values()
- }
-
enum class TerminationType {
- CLOSE_UPSTREAM,
- CLOSE_CACHED_EVENT_FLOW
+ CloseUpstream,
+ CloseCachedEventFlow,
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachingTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachingTest.kt
index 91f0b34..b739e28 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachingTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/CachingTest.kt
@@ -822,4 +822,4 @@
}
private class AbortCollectionException : Throwable()
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
index 180d74f..02bf478 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
@@ -537,4 +537,4 @@
)
}
-private val TEST_EXCEPTION = Exception()
\ No newline at end of file
+private val TEST_EXCEPTION = Exception()
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlowExtTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlowExtTest.kt
index ede582a..89c6e7f 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlowExtTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/FlowExtTest.kt
@@ -405,4 +405,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/HeaderFooterTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/HeaderFooterTest.kt
index 6728d7f..f05f7f8 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/HeaderFooterTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/HeaderFooterTest.kt
@@ -230,4 +230,4 @@
assertThat(actual).isEqualTo(expected)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/HintHandlerTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/HintHandlerTest.kt
index 6955f53..7e2df94 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/HintHandlerTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/HintHandlerTest.kt
@@ -298,4 +298,4 @@
originalPageOffsetFirst = originalPageOffsetFirst,
originalPageOffsetLast = originalPageOffsetLast
)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/ItemSnapshotListTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/ItemSnapshotListTest.kt
index 4688ad0..9161c9e 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/ItemSnapshotListTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/ItemSnapshotListTest.kt
@@ -37,4 +37,4 @@
assertFailsWith<IndexOutOfBoundsException> { snapshot[-1] }
assertFailsWith<IndexOutOfBoundsException> { snapshot[20] }
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageEventTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageEventTest.kt
index 1a5fc53..404cc90 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageEventTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PageEventTest.kt
@@ -20,7 +20,6 @@
import androidx.paging.LoadType.REFRESH
import androidx.paging.PageEvent.Drop
import kotlin.coroutines.EmptyCoroutineContext
-import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@@ -28,8 +27,6 @@
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
internal fun <T : Any> adjacentInsertEvent(
isPrepend: Boolean,
@@ -275,13 +272,8 @@
)
}
- @RunWith(Parameterized::class)
- class StaticPagingData(
- private val data: List<String>
- ) {
+ class StaticPagingData {
companion object {
- @JvmStatic
- @Parameterized.Parameters(name = "data = {0}")
fun initParameters() = listOf(
listOf("a", "b", "c"),
emptyList(),
@@ -289,19 +281,14 @@
}
private val differ = TestPagingDataDiffer<String>(EmptyCoroutineContext)
- private lateinit var pagingData: PagingData<String>
-
- @BeforeTest
- fun init() {
- pagingData = if (data.isNotEmpty()) {
- PagingData.from(data)
- } else {
- PagingData.empty()
- }
- }
@Test
- fun map() = runTest(UnconfinedTestDispatcher()) {
+ fun map_nonEmpty() = map(PagingData.from(listOf("a", "b", "c")))
+
+ @Test
+ fun map_empty() = map(PagingData.empty())
+
+ private fun map(pagingData: PagingData<String>) = runTest(UnconfinedTestDispatcher()) {
val transform = { it: String -> it + it }
differ.collectFrom(pagingData)
val originalItems = differ.snapshot().items
@@ -312,7 +299,12 @@
}
@Test
- fun flatMap() = runTest(UnconfinedTestDispatcher()) {
+ fun flatMap_nonEmpty() = flatMap(PagingData.from(listOf("a", "b", "c")))
+
+ @Test
+ fun flatMap_empty() = flatMap(PagingData.empty())
+
+ private fun flatMap(pagingData: PagingData<String>) = runTest(UnconfinedTestDispatcher()) {
val transform = { it: String -> listOf(it, it) }
differ.collectFrom(pagingData)
val originalItems = differ.snapshot().items
@@ -323,7 +315,12 @@
}
@Test
- fun filter() = runTest(UnconfinedTestDispatcher()) {
+ fun filter_nonEmpty() = filter(PagingData.from(listOf("a", "b", "c")))
+
+ @Test
+ fun filter_empty() = filter(PagingData.empty())
+
+ private fun filter(pagingData: PagingData<String>) = runTest(UnconfinedTestDispatcher()) {
val predicate = { it: String -> it != "b" }
differ.collectFrom(pagingData)
val originalItems = differ.snapshot().items
@@ -334,29 +331,35 @@
}
@Test
- fun insertSeparators() = runTest(UnconfinedTestDispatcher()) {
- val transform = { left: String?, right: String? ->
- if (left == null || right == null) null else "|"
- }
- differ.collectFrom(pagingData)
- val originalItems = differ.snapshot().items
- val expectedItems = originalItems.flatMapIndexed { index, s ->
- val result = mutableListOf<String>()
- if (index == 0) {
- transform(null, s)?.let(result::add)
+ fun insertSeparators_nonEmpty() = insertSeparators(PagingData.from(listOf("a", "b", "c")))
+
+ @Test
+ fun insertSeparators_empty() = insertSeparators(PagingData.empty())
+
+ private fun insertSeparators(pagingData: PagingData<String>) =
+ runTest(UnconfinedTestDispatcher()) {
+ val transform = { left: String?, right: String? ->
+ if (left == null || right == null) null else "|"
}
- result.add(s)
- transform(s, originalItems.getOrNull(index + 1))?.let(result::add)
- if (index == originalItems.lastIndex) {
- transform(s, null)?.let(result::add)
+ differ.collectFrom(pagingData)
+ val originalItems = differ.snapshot().items
+ val expectedItems = originalItems.flatMapIndexed { index, s ->
+ val result = mutableListOf<String>()
+ if (index == 0) {
+ transform(null, s)?.let(result::add)
+ }
+ result.add(s)
+ transform(s, originalItems.getOrNull(index + 1))?.let(result::add)
+ if (index == originalItems.lastIndex) {
+ transform(s, null)?.let(result::add)
+ }
+ result
}
- result
+ val transformedPagingData = pagingData.insertSeparators { left, right ->
+ transform(left, right)
+ }
+ differ.collectFrom(transformedPagingData)
+ assertEquals(expectedItems, differ.snapshot().items)
}
- val transformedPagingData = pagingData.insertSeparators { left, right ->
- transform(left, right)
- }
- differ.collectFrom(transformedPagingData)
- assertEquals(expectedItems, differ.snapshot().items)
- }
}
}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagePresenterTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagePresenterTest.kt
index cf535f0..e9d9556 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagePresenterTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagePresenterTest.kt
@@ -542,4 +542,4 @@
CombinedStateEvent(LoadStates.IDLE, null)
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagingDataDifferTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagingDataDifferTest.kt
index 0128918..d1d0fa1 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagingDataDifferTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/PagingDataDifferTest.kt
@@ -50,18 +50,13 @@
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
+/**
+ * run some tests with cached-in to ensure caching does not change behavior in the single
+ * consumer cases.
+ */
@OptIn(ExperimentalCoroutinesApi::class, ExperimentalPagingApi::class)
-@RunWith(Parameterized::class)
-class PagingDataDifferTest(
- /**
- * run some tests with cached-in to ensure caching does not change behavior in the single
- * consumer cases.
- */
- private val collectWithCachedIn: Boolean
-) {
+class PagingDataDifferTest {
private val testScope = TestScope(UnconfinedTestDispatcher())
@Test
@@ -246,7 +241,14 @@
}
@Test
- fun refreshOnLatestGenerationReceiver() = runTest { differ, _,
+ fun refreshOnLatestGenerationReceiver() = refreshOnLatestGenerationReceiver(false)
+
+ @Test
+ fun refreshOnLatestGenerationReceiver_collectWithCachedIn() =
+ refreshOnLatestGenerationReceiver(true)
+
+ private fun refreshOnLatestGenerationReceiver(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, _,
uiReceivers, hintReceivers ->
// first gen
advanceUntilIdle()
@@ -285,7 +287,14 @@
}
@Test
- fun retryOnLatestGenerationReceiver() = runTest { differ, pagingSources,
+ fun retryOnLatestGenerationReceiver() = retryOnLatestGenerationReceiver(false)
+
+ @Test
+ fun retryOnLatestGenerationReceiver_collectWithCachedIn() =
+ retryOnLatestGenerationReceiver(true)
+
+ private fun retryOnLatestGenerationReceiver(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, pagingSources,
uiReceivers, hintReceivers ->
// first gen
@@ -1447,7 +1456,13 @@
}
@Test
- fun refresh_loadStates() = runTest(initialKey = 50) { differ,
+ fun refresh_loadStates() = refresh_loadStates(false)
+
+ @Test
+ fun refresh_loadStates_collectWithCachedIn() = refresh_loadStates(true)
+
+ private fun refresh_loadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn, initialKey = 50) { differ,
pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -1477,7 +1492,14 @@
}
@Test
- fun refresh_loadStates_afterEndOfPagination() = runTest { differ, _, _, _ ->
+ fun refresh_loadStates_afterEndOfPagination() = refresh_loadStates_afterEndOfPagination(false)
+
+ @Test
+ fun refresh_loadStates_afterEndOfPagination_collectWithCachedIn() =
+ refresh_loadStates_afterEndOfPagination(true)
+
+ private fun refresh_loadStates_afterEndOfPagination(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, _, _, _ ->
val loadStateCallbacks = mutableListOf<CombinedLoadStates>()
differ.addLoadStateListener {
loadStateCallbacks.add(it)
@@ -1528,7 +1550,13 @@
// LoadStateUpdate event
@Test
- fun appendInvalid_loadStates() = runTest { differ, pagingSources, _, _ ->
+ fun appendInvalid_loadStates() = appendInvalid_loadStates(false)
+
+ @Test
+ fun appendInvalid_loadStates_collectWithCachedIn() = appendInvalid_loadStates(true)
+
+ private fun appendInvalid_loadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
// initial REFRESH
@@ -1589,7 +1617,13 @@
}
@Test
- fun prependInvalid_loadStates() = runTest(initialKey = 50) { differ,
+ fun prependInvalid_loadStates() = prependInvalid_loadStates(false)
+
+ @Test
+ fun prependInvalid_loadStates_collectWithCachedIn() = prependInvalid_loadStates(true)
+
+ private fun prependInvalid_loadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn, initialKey = 50) { differ,
pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -1643,7 +1677,13 @@
}
@Test
- fun refreshInvalid_loadStates() = runTest(initialKey = 50) { differ,
+ fun refreshInvalid_loadStates() = refreshInvalid_loadStates(false)
+
+ @Test
+ fun refreshInvalid_loadStates_collectWithCachedIn() = refreshInvalid_loadStates(true)
+
+ private fun refreshInvalid_loadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn, initialKey = 50) { differ,
pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -1674,7 +1714,13 @@
}
@Test
- fun appendError_retryLoadStates() = runTest { differ, pagingSources, _, _ ->
+ fun appendError_retryLoadStates() = appendError_retryLoadStates(false)
+
+ @Test
+ fun appendError_retryLoadStates_collectWithCachedIn() = appendError_retryLoadStates(true)
+
+ private fun appendError_retryLoadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
// initial REFRESH
@@ -1724,7 +1770,13 @@
}
@Test
- fun prependError_retryLoadStates() = runTest(initialKey = 50) { differ,
+ fun prependError_retryLoadStates() = prependError_retryLoadStates(false)
+
+ @Test
+ fun prependError_retryLoadStates_collectWithCachedIn() = prependError_retryLoadStates(true)
+
+ private fun prependError_retryLoadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn, initialKey = 50) { differ,
pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -1767,7 +1819,13 @@
}
@Test
- fun refreshError_retryLoadStates() = runTest { differ, pagingSources, _, _ ->
+ fun refreshError_retryLoadStates() = refreshError_retryLoadStates(false)
+
+ @Test
+ fun refreshError_retryLoadStates_collectWithCachedIn() = refreshError_retryLoadStates(true)
+
+ private fun refreshError_retryLoadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
// initial load returns LoadResult.Error
@@ -1799,7 +1857,13 @@
}
@Test
- fun prependError_refreshLoadStates() = runTest(initialKey = 50) { differ,
+ fun prependError_refreshLoadStates() = prependError_refreshLoadStates(false)
+
+ @Test
+ fun prependError_refreshLoadStates_collectWithCachedIn() = prependError_refreshLoadStates(true)
+
+ private fun prependError_refreshLoadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn, initialKey = 50) { differ,
pagingSources, _, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -1843,7 +1907,13 @@
}
@Test
- fun refreshError_refreshLoadStates() = runTest { differ, pagingSources,
+ fun refreshError_refreshLoadStates() = refreshError_refreshLoadStates(false)
+
+ @Test
+ fun refreshError_refreshLoadStates_collectWithCachedIn() = refreshError_refreshLoadStates(true)
+
+ private fun refreshError_refreshLoadStates(collectWithCachedIn: Boolean) =
+ runTest(collectWithCachedIn) { differ, pagingSources,
_, _ ->
val collectLoadStates = launch { differ.collectLoadStates() }
@@ -2167,6 +2237,7 @@
}
private fun runTest(
+ collectWithCachedIn: Boolean,
initialKey: Int? = null,
block: TestScope.(
differ: SimpleDiffer,
@@ -2218,12 +2289,6 @@
collection.cancel()
}
}
-
- companion object {
- @JvmStatic
- @Parameterized.Parameters(name = "useCachedIn_{0}")
- fun params() = arrayOf(true, false)
- }
}
private fun infinitelySuspendingPagingData(
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
index ab2437d..2731e76 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
@@ -382,4 +382,4 @@
placeholdersAfter = 0,
source = loadStates.source,
mediator = loadStates.mediator ?: loadStates()
-)
\ No newline at end of file
+)
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleChannelFlowTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleChannelFlowTest.kt
index e84e11d..156b6ec 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleChannelFlowTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleChannelFlowTest.kt
@@ -42,19 +42,19 @@
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runTest
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
-@RunWith(Parameterized::class)
@OptIn(ExperimentalCoroutinesApi::class)
-class SimpleChannelFlowTest(
- private val impl: Impl
-) {
+class SimpleChannelFlowTest {
val testScope = TestScope(UnconfinedTestDispatcher())
@Test
- fun basic() {
- val channelFlow = createFlow<Int> {
+ fun basic_ChannelFlow() = basic(Impl.ChannelFlow)
+
+ @Test
+ fun basic_SimpleChannelFlow() = basic(Impl.SimpleChannelFlow)
+
+ private fun basic(impl: Impl) {
+ val channelFlow = createFlow<Int>(impl) {
send(1)
send(2)
}
@@ -65,8 +65,13 @@
}
@Test
- fun emitWithLaunch() {
- val channelFlow = createFlow<Int> {
+ fun emitWithLaunch_ChannelFlow() = emitWithLaunch(Impl.ChannelFlow)
+
+ @Test
+ fun emitWithLaunch_SimpleChannelFlow() = emitWithLaunch(Impl.SimpleChannelFlow)
+
+ private fun emitWithLaunch(impl: Impl) {
+ val channelFlow = createFlow<Int>(impl) {
launch(coroutineContext, CoroutineStart.UNDISPATCHED) {
send(1)
delay(100)
@@ -81,9 +86,14 @@
}
@Test
- fun closedByCollector() {
+ fun closedByCollector_ChannelFlow() = closedByCollector(Impl.ChannelFlow)
+
+ @Test
+ fun closedByCollector_SimpleChannelFlow() = closedByCollector(Impl.SimpleChannelFlow)
+
+ private fun closedByCollector(impl: Impl) {
val emittedValues = mutableListOf<Int>()
- val channelFlow = createFlow<Int> {
+ val channelFlow = createFlow<Int>(impl) {
repeat(10) {
send(it)
emittedValues.add(it)
@@ -96,9 +106,15 @@
}
@Test
- fun closedByCollector_noBuffer() {
+ fun closedByCollector_noBuffer_ChannelFlow() = closedByCollector_noBuffer(Impl.ChannelFlow)
+
+ @Test
+ fun closedByCollector_noBuffer_SimpleChannelFlow() =
+ closedByCollector_noBuffer(Impl.SimpleChannelFlow)
+
+ private fun closedByCollector_noBuffer(impl: Impl) {
val emittedValues = mutableListOf<Int>()
- val channelFlow = createFlow<Int> {
+ val channelFlow = createFlow<Int>(impl) {
repeat(10) {
send(it)
emittedValues.add(it)
@@ -107,7 +123,7 @@
testScope.runTest {
assertThat(channelFlow.buffer(0).take(4).toList()).containsExactly(0, 1, 2, 3)
when (impl) {
- Impl.CHANNEL_FLOW -> {
+ Impl.ChannelFlow -> {
assertThat(emittedValues).containsExactly(0, 1, 2, 3)
}
else -> {
@@ -119,9 +135,14 @@
}
@Test
- fun awaitClose() {
+ fun awaitClose_ChannelFlow() = awaitClose(Impl.ChannelFlow)
+
+ @Test
+ fun awaitClose_SimpleChannelFlow() = awaitClose(Impl.SimpleChannelFlow)
+
+ private fun awaitClose(impl: Impl) {
val lastDispatched = CompletableDeferred<Int>()
- val channelFlow = createFlow<Int> {
+ val channelFlow = createFlow<Int>(impl) {
var dispatched = -1
launch {
repeat(10) {
@@ -142,10 +163,15 @@
}
@Test
- fun scopeGetsCancelled() {
+ fun scopeGetsCancelled_ChannelFlow() = scopeGetsCancelled(Impl.ChannelFlow)
+
+ @Test
+ fun scopeGetsCancelled_SimpleChannelFlow() = scopeGetsCancelled(Impl.SimpleChannelFlow)
+
+ private fun scopeGetsCancelled(impl: Impl) {
var producerException: Throwable? = null
val dispatched = mutableListOf<Int>()
- val channelFlow = createFlow<Int> {
+ val channelFlow = createFlow<Int>(impl) {
try {
repeat(20) {
send(it)
@@ -171,9 +197,14 @@
}
@Test
- fun collectorThrows() {
+ fun collectorThrows_ChannelFlow() = collectorThrows(Impl.ChannelFlow)
+
+ @Test
+ fun collectorThrows_SimpleChannelFlow() = collectorThrows(Impl.SimpleChannelFlow)
+
+ private fun collectorThrows(impl: Impl) {
var producerException: Throwable? = null
- val channelFlow = createFlow<Int> {
+ val channelFlow = createFlow<Int>(impl) {
try {
send(1)
delay(1000)
@@ -195,7 +226,12 @@
}
@Test
- fun upstreamThrows() {
+ fun upstreamThrows_ChannelFlow() = upstreamThrows(Impl.ChannelFlow)
+
+ @Test
+ fun upstreamThrows_SimpleChannelFlow() = upstreamThrows(Impl.SimpleChannelFlow)
+
+ private fun upstreamThrows(impl: Impl) {
var producerException: Throwable? = null
val upstream = flow<Int> {
emit(5)
@@ -203,7 +239,7 @@
emit(13)
}
val combinedFlow = upstream.flatMapLatest { upstreamValue ->
- createFlow<Int> {
+ createFlow<Int>(impl) {
try {
send(upstreamValue)
delay(2000)
@@ -228,8 +264,15 @@
}
@Test
- fun cancelingChannelClosesTheFlow() {
- val flow = createFlow<Int> {
+ fun cancelingChannelClosesTheFlow_ChannelFlow() =
+ cancelingChannelClosesTheFlow(Impl.ChannelFlow)
+
+ @Test
+ fun cancelingChannelClosesTheFlow_SimpleChannelFlow() =
+ cancelingChannelClosesTheFlow(Impl.SimpleChannelFlow)
+
+ private fun cancelingChannelClosesTheFlow(impl: Impl) {
+ val flow = createFlow<Int>(impl) {
send(1)
close()
awaitCancellation()
@@ -240,13 +283,14 @@
}
private fun <T> createFlow(
+ impl: Impl,
block: suspend TestProducerScope<T>.() -> Unit
): Flow<T> {
return when (impl) {
- Impl.CHANNEL_FLOW -> channelFlow {
+ Impl.ChannelFlow -> channelFlow {
ChannelFlowTestProducerScope(this).block()
}
- Impl.SIMPLE_CHANNEL_FLOW -> simpleChannelFlow {
+ Impl.SimpleChannelFlow -> simpleChannelFlow {
SimpleChannelFlowTestProducerScope(this).block()
}
}
@@ -274,14 +318,8 @@
}
}
- companion object {
- @Parameterized.Parameters(name = "impl={0}")
- @JvmStatic
- fun params() = Impl.values()
- }
-
enum class Impl {
- CHANNEL_FLOW,
- SIMPLE_CHANNEL_FLOW
+ ChannelFlow,
+ SimpleChannelFlow,
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleTransformLatestTest.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleTransformLatestTest.kt
index 3eb94d5..a1bf8a3 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleTransformLatestTest.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/SimpleTransformLatestTest.kt
@@ -29,22 +29,22 @@
import kotlinx.coroutines.flow.transformLatest
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
-import org.junit.runner.RunWith
-import org.junit.runners.Parameterized
-@RunWith(Parameterized::class)
@OptIn(ExperimentalCoroutinesApi::class)
-class SimpleTransformLatestTest(
- val impl: Impl
-) {
+class SimpleTransformLatestTest {
private val testScope = TestScope()
@Test
- fun delayed() = testScope.runTest {
+ fun delayed_TransformLatest() = delayed(Impl.TransformLatest)
+
+ @Test
+ fun delayed_SimpleTransformLatest() = delayed(Impl.SimpleTransformLatest)
+
+ private fun delayed(impl: Impl) = testScope.runTest {
assertThat(
flowOf(1, 2, 3)
.onEach { delay(100) }
- .testTransformLatest<Int, String> { value ->
+ .testTransformLatest<Int, String>(impl) { value ->
repeat(3) {
emit("$value - $it")
delay(75)
@@ -58,11 +58,16 @@
}
@Test
- fun allValues() = testScope.runTest {
+ fun allValues_TransformLatest() = allValues(Impl.TransformLatest)
+
+ @Test
+ fun allValues_SimpleTransformLatest() = allValues(Impl.SimpleTransformLatest)
+
+ private fun allValues(impl: Impl) = testScope.runTest {
assertThat(
flowOf(1, 2, 3)
.onEach { delay(1) }
- .testTransformLatest<Int, String> { value ->
+ .testTransformLatest<Int, String>(impl) { value ->
repeat(3) { emit("$value - $it") }
}.toList()
).containsExactly(
@@ -73,12 +78,18 @@
}
@Test
- fun reusePreviousCollector() = testScope.runTest {
+ fun reusePreviousCollector_TransformLatest() = reusePreviousCollector(Impl.TransformLatest)
+
+ @Test
+ fun reusePreviousCollector_SimpleTransformLatest() =
+ reusePreviousCollector(Impl.SimpleTransformLatest)
+
+ private fun reusePreviousCollector(impl: Impl) = testScope.runTest {
var prevCollector: FlowCollector<String>? = null
assertThat(
flowOf(1, 2, 3)
.onEach { delay(1) }
- .testTransformLatest<Int, String> { value ->
+ .testTransformLatest<Int, String>(impl) { value ->
if (prevCollector == null) {
prevCollector = this
awaitCancellation()
@@ -90,24 +101,19 @@
}
private fun <T, R> Flow<T>.testTransformLatest(
+ impl: Impl,
transform: suspend FlowCollector<R>.(value: T) -> Unit
): Flow<R> {
return when (impl) {
- Impl.TRANSFORM_LATEST ->
+ Impl.TransformLatest ->
this@testTransformLatest.transformLatest(transform)
- Impl.SIMPLE_TRANSFORM_LATEST ->
+ Impl.SimpleTransformLatest ->
this@testTransformLatest.simpleTransformLatest(transform)
}
}
- companion object {
- @Parameterized.Parameters(name = "impl={0}")
- @JvmStatic
- fun params() = Impl.values()
- }
-
enum class Impl {
- TRANSFORM_LATEST,
- SIMPLE_TRANSFORM_LATEST
+ TransformLatest,
+ SimpleTransformLatest,
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonTest/kotlin/androidx/paging/TestUtils.kt b/paging/paging-common/src/commonTest/kotlin/androidx/paging/TestUtils.kt
index 494297e23..32ddbdf 100644
--- a/paging/paging-common/src/commonTest/kotlin/androidx/paging/TestUtils.kt
+++ b/paging/paging-common/src/commonTest/kotlin/androidx/paging/TestUtils.kt
@@ -194,4 +194,4 @@
val data = toList()
repeat(data.size) { removeFirst() }
return data
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingLogger.jvm.kt
similarity index 63%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingLogger.jvm.kt
index 5d73136..01172be 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/paging/paging-common/src/jvmMain/kotlin/androidx/paging/PagingLogger.jvm.kt
@@ -16,4 +16,17 @@
package androidx.paging
-public expect annotation class MainThread()
+import androidx.annotation.RestrictTo
+
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public actual object PagingLogger {
+
+ public actual fun isLoggable(level: Int): Boolean {
+ return true
+ }
+
+ // consider using java.util.logging APIs instead
+ public actual fun log(level: Int, message: String, tr: Throwable?) {
+ print("\n$message")
+ }
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/paging/paging-common/src/nativeMain/kotlin/androidx/paging/PagingLogger.native.kt
similarity index 69%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to paging/paging-common/src/nativeMain/kotlin/androidx/paging/PagingLogger.native.kt
index 5d73136..c00cbbf 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/paging/paging-common/src/nativeMain/kotlin/androidx/paging/PagingLogger.native.kt
@@ -16,4 +16,12 @@
package androidx.paging
-public expect annotation class MainThread()
+import androidx.annotation.RestrictTo
+
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public actual object PagingLogger {
+ public actual fun isLoggable(level: Int): Boolean {
+ return false
+ }
+ public actual fun log(level: Int, message: String, tr: Throwable?) { }
+}
diff --git a/paging/paging-common/src/nativeMain/kotlin/androidx/paging/annotation.kt b/paging/paging-common/src/nativeMain/kotlin/androidx/paging/annotation.kt
deleted file mode 100644
index ce1d1a6..0000000
--- a/paging/paging-common/src/nativeMain/kotlin/androidx/paging/annotation.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.paging
-
-public actual annotation class MainThread()
diff --git a/paging/paging-compose/build.gradle b/paging/paging-compose/build.gradle
index b08c7ea..98319a3 100644
--- a/paging/paging-compose/build.gradle
+++ b/paging/paging-compose/build.gradle
@@ -21,24 +21,56 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
- id("org.jetbrains.kotlin.android")
- id("kotlin-android")
+}
+
+androidXMultiplatform {
+ android()
+
+ sourceSets {
+ commonMain {
+ dependencies {
+ implementation(libs.kotlinStdlib)
+ api("androidx.compose.foundation:foundation:1.5.0-beta03")
+ api(project(":paging:paging-common"))
+ api("androidx.compose.runtime:runtime:1.5.0-beta03")
+ }
+ }
+
+ jvmMain {
+ dependsOn(commonMain)
+ }
+
+ androidMain {
+ dependsOn(jvmMain)
+ }
+
+ commonTest {
+ dependencies {
+ implementation projectOrArtifact(":compose:ui:ui-tooling")
+ implementation(project(":compose:test-utils"))
+ implementation(projectOrArtifact(":internal-testutils-paging"))
+ }
+ }
+
+ jvmTest {
+ dependsOn(commonTest)
+ dependencies {
+ implementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
+ }
+ }
+
+ androidAndroidTest {
+ dependsOn(jvmTest)
+ dependencies {
+ implementation(libs.testRunner)
+ implementation(libs.junit)
+ implementation(libs.truth)
+ }
+ }
+ }
}
dependencies {
- implementation(libs.kotlinStdlib)
- api("androidx.compose.foundation:foundation:1.2.1")
- api(project(":paging:paging-common"))
- api("androidx.compose.runtime:runtime:1.2.1")
-
- androidTestImplementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
- androidTestImplementation projectOrArtifact(":compose:ui:ui-tooling")
- androidTestImplementation(project(":compose:test-utils"))
- androidTestImplementation(projectOrArtifact(":internal-testutils-paging"))
- androidTestImplementation(libs.testRunner)
- androidTestImplementation(libs.junit)
- androidTestImplementation(libs.truth)
-
samples(projectOrArtifact(":paging:paging-compose:paging-compose-samples"))
}
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/PagingFoundationDemos.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/PagingFoundationDemos.kt
index c63c4b7..1e3b9af 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/PagingFoundationDemos.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/PagingFoundationDemos.kt
@@ -31,4 +31,4 @@
ComposableDemo("Paging with LazyGrid") { PagingWithLazyGrid() },
ComposableDemo("Paging with LazyColumn") { PagingWithLazyList() },
)
-)
\ No newline at end of file
+)
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/AppDatabase.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/AppDatabase.kt
index 065b1f2..7fa6e40 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/AppDatabase.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/AppDatabase.kt
@@ -41,4 +41,4 @@
).fallbackToDestructiveMigration().build().also { Instance = it }
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
index 868b4b3..133aa41 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
@@ -143,4 +143,4 @@
"Olivia",
"Emma",
"Ava"
-)
\ No newline at end of file
+)
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/User.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/User.kt
index 9606388..cba31f6 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/User.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/User.kt
@@ -24,4 +24,4 @@
@PrimaryKey(autoGenerate = true)
val id: Int,
val name: String
-)
\ No newline at end of file
+)
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/UserDao.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/UserDao.kt
index c939918..5e46a88 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/UserDao.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/UserDao.kt
@@ -43,4 +43,4 @@
@Query("SELECT * FROM users ORDER BY RANDOM() LIMIT 1")
fun getRandomUser(): User?
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingFoundationSample.kt b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingFoundationSample.kt
index ed00f0f..407bb2e 100644
--- a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingFoundationSample.kt
+++ b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingFoundationSample.kt
@@ -154,4 +154,4 @@
Text(text = "placeholder", fontSize = 32.sp)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingPreviewSample.kt b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingPreviewSample.kt
index c05f075..1c6cb45 100644
--- a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingPreviewSample.kt
+++ b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingPreviewSample.kt
@@ -67,4 +67,4 @@
val fakeDataFlow = MutableStateFlow(pagingData)
// pass flow to composable
DisplayPaging(flow = fakeDataFlow)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingSample.kt b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingSample.kt
index 382badfc..596cade 100644
--- a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingSample.kt
+++ b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/PagingSample.kt
@@ -104,4 +104,4 @@
Text("Item at index $index is $item")
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/SampleUtils.kt b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/SampleUtils.kt
index 9b6efc64..d13cc3e 100644
--- a/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/SampleUtils.kt
+++ b/paging/paging-compose/samples/src/main/java/androidx/paging/compose/samples/SampleUtils.kt
@@ -85,4 +85,4 @@
?: state.closestPageToPosition(it)?.nextKey?.minus(1)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsPreviewTest.kt b/paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsPreviewTest.kt
similarity index 99%
rename from paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsPreviewTest.kt
rename to paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsPreviewTest.kt
index 7cfba6e..b6c324ce 100644
--- a/paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsPreviewTest.kt
+++ b/paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsPreviewTest.kt
@@ -101,4 +101,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt b/paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsTest.kt
similarity index 99%
rename from paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt
rename to paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsTest.kt
index f98b422..b0c4f3b 100644
--- a/paging/paging-compose/src/androidTest/java/androidx/paging/compose/LazyPagingItemsTest.kt
+++ b/paging/paging-compose/src/androidAndroidTest/kotlin/androidx/paging/compose/LazyPagingItemsTest.kt
@@ -52,12 +52,10 @@
import androidx.test.filters.LargeTest
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.isActive
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
-import org.junit.Assert.assertFalse
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -830,7 +828,6 @@
}
rule.runOnIdle {
- assertFalse(context.isActive)
// collection should not have started yet
assertThat(lazyPagingItems.itemSnapshotList).isEmpty()
}
diff --git a/paging/paging-compose/src/main/java/androidx/paging/compose/PagingPlaceholders.kt b/paging/paging-compose/src/androidMain/kotlin/androidx/paging/compose/PagingPlaceholderKey.android.kt
similarity index 88%
rename from paging/paging-compose/src/main/java/androidx/paging/compose/PagingPlaceholders.kt
rename to paging/paging-compose/src/androidMain/kotlin/androidx/paging/compose/PagingPlaceholderKey.android.kt
index 417f2e3..8b018cd 100644
--- a/paging/paging-compose/src/main/java/androidx/paging/compose/PagingPlaceholders.kt
+++ b/paging/paging-compose/src/androidMain/kotlin/androidx/paging/compose/PagingPlaceholderKey.android.kt
@@ -20,8 +20,10 @@
import android.os.Parcel
import android.os.Parcelable
+internal actual fun getPagingPlaceholderKey(index: Int): Any = PagingPlaceholderKey(index)
+
@SuppressLint("BanParcelableUsage")
-internal data class PagingPlaceholderKey(private val index: Int) : Parcelable {
+private data class PagingPlaceholderKey(private val index: Int) : Parcelable {
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeInt(index)
}
@@ -42,5 +44,3 @@
}
}
}
-
-internal object PagingPlaceholderContentType
diff --git a/paging/paging-compose/src/main/java/androidx/paging/compose/LazyFoundationExtensions.kt b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyFoundationExtensions.kt
similarity index 94%
rename from paging/paging-compose/src/main/java/androidx/paging/compose/LazyFoundationExtensions.kt
rename to paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyFoundationExtensions.kt
index bb24cb0..61b1c9e 100644
--- a/paging/paging-compose/src/main/java/androidx/paging/compose/LazyFoundationExtensions.kt
+++ b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyFoundationExtensions.kt
@@ -38,15 +38,16 @@
* based on the key, which means if you add/remove items before the current visible item the
* item with the given key will be kept as the first visible one.
*/
+@Suppress("PrimitiveInLambda")
public fun <T : Any> LazyPagingItems<T>.itemKey(
key: ((item: @JvmSuppressWildcards T) -> Any)? = null
): (index: Int) -> Any {
return { index ->
if (key == null) {
- PagingPlaceholderKey(index)
+ getPagingPlaceholderKey(index)
} else {
val item = peek(index)
- if (item == null) PagingPlaceholderKey(index) else key(item)
+ if (item == null) getPagingPlaceholderKey(index) else key(item)
}
}
}
@@ -68,6 +69,7 @@
* the same type could be reused more efficiently. Note that null is a valid type and items of
* such type will be considered compatible.
*/
+@Suppress("PrimitiveInLambda")
public fun <T : Any> LazyPagingItems<T>.itemContentType(
contentType: ((item: @JvmSuppressWildcards T) -> Any?)? = null
): (index: Int) -> Any? {
diff --git a/paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyPagingItems.kt
similarity index 85%
rename from paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt
rename to paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyPagingItems.kt
index bef33c6..a9a1c63 100644
--- a/paging/paging-compose/src/main/java/androidx/paging/compose/LazyPagingItems.kt
+++ b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/LazyPagingItems.kt
@@ -16,7 +16,6 @@
package androidx.paging.compose
-import android.util.Log
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -27,11 +26,8 @@
import androidx.paging.CombinedLoadStates
import androidx.paging.DifferCallback
import androidx.paging.ItemSnapshotList
-import androidx.paging.LOGGER
-import androidx.paging.LOG_TAG
import androidx.paging.LoadState
import androidx.paging.LoadStates
-import androidx.paging.Logger
import androidx.paging.NullPaddedList
import androidx.paging.PagingData
import androidx.paging.PagingDataDiffer
@@ -210,38 +206,6 @@
pagingDataDiffer.collectFrom(it)
}
}
-
- private companion object {
- init {
- /**
- * Implements the Logger interface from paging-common and injects it into the LOGGER
- * global var stored within Pager.
- *
- * Checks for null LOGGER because other runtime entry points to paging can also
- * inject a Logger
- */
- LOGGER = LOGGER ?: object : Logger {
- override fun isLoggable(level: Int): Boolean {
- return Log.isLoggable(LOG_TAG, level)
- }
-
- override fun log(level: Int, message: String, tr: Throwable?) {
- when {
- tr != null && level == Log.DEBUG -> Log.d(LOG_TAG, message, tr)
- tr != null && level == Log.VERBOSE -> Log.v(LOG_TAG, message, tr)
- level == Log.DEBUG -> Log.d(LOG_TAG, message)
- level == Log.VERBOSE -> Log.v(LOG_TAG, message)
- else -> {
- throw IllegalArgumentException(
- "debug level $level is requested but Paging only supports " +
- "default logging for level 2 (DEBUG) or level 3 (VERBOSE)"
- )
- }
- }
- }
- }
- }
- }
}
private val IncompleteLoadState = LoadState.NotLoading(false)
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/PagingPlaceholders.kt
similarity index 80%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/PagingPlaceholders.kt
index 5d73136..823d611 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/paging/paging-compose/src/commonMain/kotlin/androidx/paging/compose/PagingPlaceholders.kt
@@ -14,6 +14,8 @@
* limitations under the License.
*/
-package androidx.paging
+package androidx.paging.compose
-public expect annotation class MainThread()
+internal expect fun getPagingPlaceholderKey(index: Int): Any
+
+internal object PagingPlaceholderContentType
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt
index 9cfad87..5574de6 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/AsyncPagingDataDifferTest.kt
@@ -711,4 +711,4 @@
assertEquals(secondList, onRemovedSnapshot)
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCallbackFake.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCallbackFake.kt
index ff71697..7356f61 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCallbackFake.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCallbackFake.kt
@@ -72,4 +72,4 @@
data class OnRemovedEvent(val position: Int, val count: Int)
data class OnMovedEvent(val fromPosition: Int, val toPosition: Int)
data class OnChangedEvent(val position: Int, val count: Int, val payload: Any?)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCapture.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCapture.kt
index 2e7848c..4e96af0 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCapture.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/ListUpdateCapture.kt
@@ -44,4 +44,4 @@
lastEventsListIndex = events.lastIndex
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadFullListTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadFullListTest.kt
index 5bce270..be3aede 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadFullListTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadFullListTest.kt
@@ -177,4 +177,4 @@
initialLoadSize = 5
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadStateAdapterTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadStateAdapterTest.kt
index 93616f2..03e4797 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadStateAdapterTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/LoadStateAdapterTest.kt
@@ -172,4 +172,4 @@
adapter.loadState = NotLoading(endOfPaginationReached = true)
assertEquals(listOf(REMOVED), eventRecorder.getClearEvents())
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/NullPaddedListDiffWithRecyclerViewTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/NullPaddedListDiffWithRecyclerViewTest.kt
index edfa92a..445accd6 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/NullPaddedListDiffWithRecyclerViewTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/NullPaddedListDiffWithRecyclerViewTest.kt
@@ -923,4 +923,4 @@
// nothing to assert here, it can represent anything in the new list.
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/PagedListListenerFake.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/PagedListListenerFake.kt
index 82ec3d3..9bd09f5 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/PagedListListenerFake.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/PagedListListenerFake.kt
@@ -33,4 +33,4 @@
val previousList: PagedList<T>?,
val currentList: PagedList<T>?
)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/RecordingCallbackTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/RecordingCallbackTest.kt
index 193283a..4af368a 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/RecordingCallbackTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/RecordingCallbackTest.kt
@@ -74,4 +74,4 @@
// verify recording cleaned up
recordingCallback.dispatchRecordingTo(failCallback)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/RunnableFake.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/RunnableFake.kt
index 7378d36..085ce7d 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/RunnableFake.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/RunnableFake.kt
@@ -22,4 +22,4 @@
override fun run() {
runEvents.add(Unit)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/StateRestorationTest.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/StateRestorationTest.kt
index bfd61c7..11e54c5 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/StateRestorationTest.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/StateRestorationTest.kt
@@ -488,4 +488,4 @@
private const val RV_HEIGHT = 200
private const val RV_WIDTH = 100
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/androidTest/java/androidx/paging/StringPagedList.kt b/paging/paging-runtime/src/androidTest/java/androidx/paging/StringPagedList.kt
index 2f208b5..4f550ff 100644
--- a/paging/paging-runtime/src/androidTest/java/androidx/paging/StringPagedList.kt
+++ b/paging/paging-runtime/src/androidTest/java/androidx/paging/StringPagedList.kt
@@ -70,4 +70,4 @@
config = Config(1, prefetchDistance = 0),
key = null
)
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/main/java/androidx/paging/AsyncPagingDataDiffer.kt b/paging/paging-runtime/src/main/java/androidx/paging/AsyncPagingDataDiffer.kt
index 81bce0e..a169908 100644
--- a/paging/paging-runtime/src/main/java/androidx/paging/AsyncPagingDataDiffer.kt
+++ b/paging/paging-runtime/src/main/java/androidx/paging/AsyncPagingDataDiffer.kt
@@ -16,7 +16,6 @@
package androidx.paging
-import android.util.Log
import androidx.annotation.IntRange
import androidx.annotation.MainThread
import androidx.lifecycle.Lifecycle
@@ -418,34 +417,4 @@
fun removeLoadStateListener(listener: (CombinedLoadStates) -> Unit) {
differBase.removeLoadStateListener(listener)
}
-
- private companion object {
- init {
- /**
- * Implements the Logger interface from paging-common and injects it into the LOGGER
- * global var stored within Pager.
- *
- * Checks for null LOGGER because paging-compose can also inject a Logger
- * with the same implementation
- */
- LOGGER = LOGGER ?: object : Logger {
- override fun isLoggable(level: Int): Boolean {
- return Log.isLoggable(LOG_TAG, level)
- }
-
- override fun log(level: Int, message: String, tr: Throwable?) {
- when (level) {
- Log.DEBUG -> Log.d(LOG_TAG, message, tr)
- Log.VERBOSE -> Log.v(LOG_TAG, message, tr)
- else -> {
- throw IllegalArgumentException(
- "debug level $level is requested but Paging only supports " +
- "default logging for level 2 (DEBUG) or level 3 (VERBOSE)"
- )
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
+}
diff --git a/paging/paging-runtime/src/main/java/androidx/paging/RecordingCallback.kt b/paging/paging-runtime/src/main/java/androidx/paging/RecordingCallback.kt
index c559a72..b9489f5 100644
--- a/paging/paging-runtime/src/main/java/androidx/paging/RecordingCallback.kt
+++ b/paging/paging-runtime/src/main/java/androidx/paging/RecordingCallback.kt
@@ -54,4 +54,4 @@
private const val Inserted = 1
private const val Removed = 2
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxPagingSource.kt b/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxPagingSource.kt
index f79e825..89be36b 100644
--- a/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxPagingSource.kt
+++ b/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxPagingSource.kt
@@ -36,4 +36,4 @@
final override suspend fun load(params: LoadParams<Key>): LoadResult<Key, Value> {
return loadSingle(params).await()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxRemoteMediator.kt b/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxRemoteMediator.kt
index b6f6d3e..076d04d 100644
--- a/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxRemoteMediator.kt
+++ b/paging/paging-rxjava2/src/main/java/androidx/paging/rxjava2/RxRemoteMediator.kt
@@ -96,4 +96,4 @@
final override suspend fun initialize(): InitializeAction {
return initializeSingle().await()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava2/src/test/java/androidx/paging/RxPagingSourceTest.kt b/paging/paging-rxjava2/src/test/java/androidx/paging/RxPagingSourceTest.kt
index ca231a9..7ca476d 100644
--- a/paging/paging-rxjava2/src/test/java/androidx/paging/RxPagingSourceTest.kt
+++ b/paging/paging-rxjava2/src/test/java/androidx/paging/RxPagingSourceTest.kt
@@ -69,4 +69,4 @@
assertFailsWith<NullPointerException> { rxPagingSource.load(params) }
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxPagingSource.kt b/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxPagingSource.kt
index cb53bfc..1809ff1 100644
--- a/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxPagingSource.kt
+++ b/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxPagingSource.kt
@@ -36,4 +36,4 @@
final override suspend fun load(params: LoadParams<Key>): LoadResult<Key, Value> {
return loadSingle(params).await()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxRemoteMediator.kt b/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxRemoteMediator.kt
index 3d6301f..e359c6c 100644
--- a/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxRemoteMediator.kt
+++ b/paging/paging-rxjava3/src/main/java/androidx/paging/rxjava3/RxRemoteMediator.kt
@@ -95,4 +95,4 @@
final override suspend fun initialize(): InitializeAction {
return initializeSingle().await()
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-rxjava3/src/test/java/androidx/paging/RxPagingSourceTest.kt b/paging/paging-rxjava3/src/test/java/androidx/paging/RxPagingSourceTest.kt
index 9d40b9d..77be184 100644
--- a/paging/paging-rxjava3/src/test/java/androidx/paging/RxPagingSourceTest.kt
+++ b/paging/paging-rxjava3/src/test/java/androidx/paging/RxPagingSourceTest.kt
@@ -69,4 +69,4 @@
assertFailsWith<NullPointerException> { rxPagingSource.load(params) }
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/main/java/androidx/paging/testing/LoadErrorHandler.kt b/paging/paging-testing/src/main/java/androidx/paging/testing/LoadErrorHandler.kt
index 32c7b02..50c2149 100644
--- a/paging/paging-testing/src/main/java/androidx/paging/testing/LoadErrorHandler.kt
+++ b/paging/paging-testing/src/main/java/androidx/paging/testing/LoadErrorHandler.kt
@@ -68,4 +68,4 @@
* Returns a snapshot with any data that has been loaded up till the point of error.
*/
RETURN_CURRENT_SNAPSHOT,
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/main/java/androidx/paging/testing/PagerFlowSnapshot.kt b/paging/paging-testing/src/main/java/androidx/paging/testing/PagerFlowSnapshot.kt
index 0882b80..0e706ac 100644
--- a/paging/paging-testing/src/main/java/androidx/paging/testing/PagerFlowSnapshot.kt
+++ b/paging/paging-testing/src/main/java/androidx/paging/testing/PagerFlowSnapshot.kt
@@ -217,4 +217,4 @@
id = currGen.id + 1
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/main/java/androidx/paging/testing/SnapshotLoader.kt b/paging/paging-testing/src/main/java/androidx/paging/testing/SnapshotLoader.kt
index 040a7f1..1c3f042 100644
--- a/paging/paging-testing/src/main/java/androidx/paging/testing/SnapshotLoader.kt
+++ b/paging/paging-testing/src/main/java/androidx/paging/testing/SnapshotLoader.kt
@@ -469,4 +469,4 @@
ON_INSERTED,
ON_REMOVED,
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/main/java/androidx/paging/testing/StaticListPagingSource.kt b/paging/paging-testing/src/main/java/androidx/paging/testing/StaticListPagingSource.kt
index 89bca0e..36496ca 100644
--- a/paging/paging-testing/src/main/java/androidx/paging/testing/StaticListPagingSource.kt
+++ b/paging/paging-testing/src/main/java/androidx/paging/testing/StaticListPagingSource.kt
@@ -121,4 +121,4 @@
override val jumpingSupported: Boolean
get() = true
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/main/java/androidx/paging/testing/TestPager.kt b/paging/paging-testing/src/main/java/androidx/paging/testing/TestPager.kt
index bcecbead..35b14ad 100644
--- a/paging/paging-testing/src/main/java/androidx/paging/testing/TestPager.kt
+++ b/paging/paging-testing/src/main/java/androidx/paging/testing/TestPager.kt
@@ -389,4 +389,4 @@
itemsDropped += pageSize
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/PagerFlowSnapshotTest.kt b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/PagerFlowSnapshotTest.kt
index fd23a2b..b8fcf62 100644
--- a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/PagerFlowSnapshotTest.kt
+++ b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/PagerFlowSnapshotTest.kt
@@ -2445,4 +2445,4 @@
override fun getRefreshKey(state: PagingState<Int, Int>) = originalSource.getRefreshKey(state)
override val jumpingSupported: Boolean = originalSource.jumpingSupported
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceFactoryTest.kt b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceFactoryTest.kt
index c327ff5..b4cc8d1 100644
--- a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceFactoryTest.kt
+++ b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceFactoryTest.kt
@@ -270,4 +270,4 @@
listOf(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceTest.kt b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceTest.kt
index e93e9d9..dd4197f 100644
--- a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceTest.kt
+++ b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/StaticListPagingSourceTest.kt
@@ -294,4 +294,4 @@
itemsAfter = if (indexEnd == null) -1 else DATA.lastIndex - indexEnd
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/TestPagerTest.kt b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/TestPagerTest.kt
index 6caaea9..477450e 100644
--- a/paging/paging-testing/src/test/kotlin/androidx/paging/testing/TestPagerTest.kt
+++ b/paging/paging-testing/src/test/kotlin/androidx/paging/testing/TestPagerTest.kt
@@ -970,4 +970,4 @@
}
private val ITEM_COUNT = 100
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/BaseViewModel.kt b/paging/samples/src/main/java/androidx/paging/samples/BaseViewModel.kt
index 9de9423..9662758 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/BaseViewModel.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/BaseViewModel.kt
@@ -44,4 +44,4 @@
val pagingFlowable = pager.flowable.cachedIn(viewModelScope)
val pagingLiveData = pager.liveData.cachedIn(viewModelScope)
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt b/paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt
index 03fb4ee..742eadd 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/CachedInSample.kt
@@ -76,4 +76,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/ListenableFuturePagingSourceSample.kt b/paging/samples/src/main/java/androidx/paging/samples/ListenableFuturePagingSourceSample.kt
index ca2df59f..a13a3e6 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/ListenableFuturePagingSourceSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/ListenableFuturePagingSourceSample.kt
@@ -86,4 +86,4 @@
return state.anchorPosition?.let { state.closestItemToPosition(it)?.id }
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/LoadStateAdapterSample.kt b/paging/samples/src/main/java/androidx/paging/samples/LoadStateAdapterSample.kt
index ce32515..7c5e617 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/LoadStateAdapterSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/LoadStateAdapterSample.kt
@@ -73,4 +73,4 @@
override fun onBindViewHolder(holder: LoadStateViewHolder, loadState: LoadState) =
holder.bind(loadState)
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/PagingDataAdapterSample.kt b/paging/samples/src/main/java/androidx/paging/samples/PagingDataAdapterSample.kt
index 4a69f31..91fd531 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/PagingDataAdapterSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/PagingDataAdapterSample.kt
@@ -232,4 +232,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/PagingSourceSample.kt b/paging/samples/src/main/java/androidx/paging/samples/PagingSourceSample.kt
index efaee82..273996e 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/PagingSourceSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/PagingSourceSample.kt
@@ -181,4 +181,4 @@
nextKey = if (items.isNotEmpty()) pageNumber + 1 else null
)
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/RxPagingSourceSample.kt b/paging/samples/src/main/java/androidx/paging/samples/RxPagingSourceSample.kt
index 2e6ce22..6665998 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/RxPagingSourceSample.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/RxPagingSourceSample.kt
@@ -78,4 +78,4 @@
return state.anchorPosition?.let { state.closestItemToPosition(it)?.id }
}
}
-}
\ No newline at end of file
+}
diff --git a/paging/samples/src/main/java/androidx/paging/samples/shared/ExampleBackendService.kt b/paging/samples/src/main/java/androidx/paging/samples/shared/ExampleBackendService.kt
index 15fefb7..a4be314eb 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/shared/ExampleBackendService.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/shared/ExampleBackendService.kt
@@ -24,4 +24,4 @@
val users: List<User>,
val nextKey: String?,
val nextPageNumber: Int?,
-)
\ No newline at end of file
+)
diff --git a/paging/samples/src/main/java/androidx/paging/samples/shared/UserDao.kt b/paging/samples/src/main/java/androidx/paging/samples/shared/UserDao.kt
index a90bf2c..b5aca9f 100644
--- a/paging/samples/src/main/java/androidx/paging/samples/shared/UserDao.kt
+++ b/paging/samples/src/main/java/androidx/paging/samples/shared/UserDao.kt
@@ -43,4 +43,4 @@
fun lastUpdatedFuture(): ListenableFuture<Long>
fun lastUpdatedSingle(): Single<Long>
-}
\ No newline at end of file
+}
diff --git a/paging/settings.gradle b/paging/settings.gradle
index 5624eac..f7321cb 100644
--- a/paging/settings.gradle
+++ b/paging/settings.gradle
@@ -29,7 +29,7 @@
selectProjectsFromAndroidX({ name ->
if (name.startsWith(":paging")) return true
if (name == ":annotation:annotation-sampled") return true
- if (name == ":internal-testutils-kmp") return true
+ if (name == ":kruth:kruth") return true
if (name == ":internal-testutils-ktx") return true
if (name == ":internal-testutils-paging") return true
if (name == ":compose:integration-tests:demos:common") return true
diff --git a/preference/preference/lint-baseline.xml b/preference/preference/lint-baseline.xml
index 4b4ccf8..217ddcd 100644
--- a/preference/preference/lint-baseline.xml
+++ b/preference/preference/lint-baseline.xml
@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.1.0-alpha07" type="baseline" client="gradle" dependencies="false" name="AGP (8.0.0-beta03)" variant="all" version="8.1.0-alpha07">
-
- <issue
- id="BanHideAnnotation"
- message="@hide is not allowed in Javadoc"
- errorLine1=" public static PreferenceViewHolder createInstanceForTests(@NonNull View itemView) {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/preference/PreferenceViewHolder.java"/>
- </issue>
+<issues format="6" by="lint 8.1.0-beta05" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta05)" variant="all" version="8.1.0-beta05">
<issue
id="BanThreadSleep"
diff --git a/preference/preference/src/androidTest/java/androidx/preference/tests/PreferenceDialogFragmentCompatTest.kt b/preference/preference/src/androidTest/java/androidx/preference/tests/PreferenceDialogFragmentCompatTest.kt
index bb5e2be..b458e54 100644
--- a/preference/preference/src/androidTest/java/androidx/preference/tests/PreferenceDialogFragmentCompatTest.kt
+++ b/preference/preference/src/androidTest/java/androidx/preference/tests/PreferenceDialogFragmentCompatTest.kt
@@ -120,4 +120,4 @@
return inflater.inflate(R.layout.simple_layout, container, false)
}
override fun onDialogClosed(positiveResult: Boolean) {}
-}
\ No newline at end of file
+}
diff --git a/preference/preference/src/main/java/androidx/preference/PreferenceHeaderFragmentCompat.kt b/preference/preference/src/main/java/androidx/preference/PreferenceHeaderFragmentCompat.kt
index 86020ce..2207983 100644
--- a/preference/preference/src/main/java/androidx/preference/PreferenceHeaderFragmentCompat.kt
+++ b/preference/preference/src/main/java/androidx/preference/PreferenceHeaderFragmentCompat.kt
@@ -312,4 +312,4 @@
// TODO: Change to use WindowManager ActivityView API
startActivity(intent)
}
-}
\ No newline at end of file
+}
diff --git a/preference/preference/src/main/java/androidx/preference/PreferenceViewHolder.java b/preference/preference/src/main/java/androidx/preference/PreferenceViewHolder.java
index 95635c5..e3129a8 100644
--- a/preference/preference/src/main/java/androidx/preference/PreferenceViewHolder.java
+++ b/preference/preference/src/main/java/androidx/preference/PreferenceViewHolder.java
@@ -25,6 +25,7 @@
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.RecyclerView;
@@ -60,7 +61,7 @@
}
}
- /** @hide */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
@VisibleForTesting
@NonNull
public static PreferenceViewHolder createInstanceForTests(@NonNull View itemView) {
diff --git a/privacysandbox/ads/ads-adservices-java/build.gradle b/privacysandbox/ads/ads-adservices-java/build.gradle
index 57b63ad..9fd7517 100644
--- a/privacysandbox/ads/ads-adservices-java/build.gradle
+++ b/privacysandbox/ads/ads-adservices-java/build.gradle
@@ -24,7 +24,7 @@
dependencies {
api(libs.kotlinStdlib)
- api(libs.kotlinCoroutinesCore171)
+ api(libs.kotlinCoroutinesCore)
implementation("androidx.core:core-ktx:1.8.0")
api("androidx.annotation:annotation:1.2.0")
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFuturesTest.kt
index 590eff6..5f20ba7 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFuturesTest.kt
@@ -111,4 +111,4 @@
Assert.assertEquals(false, adId.isLimitAdTrackingEnabled)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFuturesTest.kt
index e0c2574..af4ef91 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFuturesTest.kt
@@ -233,4 +233,4 @@
Assert.assertEquals(expectedRequest.adSelectionConfig, request.adSelectionConfig)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFuturesTest.kt
index f94bc9d..a540f73 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFuturesTest.kt
@@ -122,4 +122,4 @@
Assert.assertEquals(AppSetId.SCOPE_APP, appSetId.scope)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFuturesTest.kt
index d2f5802..31b287d 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFuturesTest.kt
@@ -229,4 +229,4 @@
Truth.assertThat(expectedRequest == leaveCustomAudienceRequest).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/endtoend/TestUtil.java b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/endtoend/TestUtil.java
index 5d17da4..57e0e98 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/endtoend/TestUtil.java
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/endtoend/TestUtil.java
@@ -24,7 +24,6 @@
import android.os.Build;
import android.util.Log;
-import androidx.core.os.BuildCompat;
import androidx.test.core.app.ApplicationProvider;
import java.util.List;
@@ -228,7 +227,7 @@
.queryIntentServices(intent, PackageManager.MATCH_SYSTEM_ONLY);
// TODO: b/271866693 avoid hardcoding package names
- if (resolveInfos != null && BuildCompat.isAtLeastT()) {
+ if (resolveInfos != null && Build.VERSION.SDK_INT >= 33) {
resolveInfos = resolveInfos.stream()
.filter(info ->
!info.serviceInfo.packageName.contains(EXT_SERVICES_PACKAGE_NAME))
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFuturesTest.kt
index dbdb25e..6e1752b 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFuturesTest.kt
@@ -304,4 +304,4 @@
assertThat(HashSet(request.originUris) == HashSet(expectedRequest.originUris))
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFuturesTest.kt b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFuturesTest.kt
index c4c3be1..c44c32f 100644
--- a/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFuturesTest.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/androidTest/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFuturesTest.kt
@@ -189,4 +189,4 @@
Assert.assertEquals(2, topic2.taxonomyVersion)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFutures.kt
index 860cccf..96544ec 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adid/AdIdManagerFutures.kt
@@ -68,4 +68,4 @@
return AdIdManager.obtain(context)?.let { Api33Ext4JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures.kt
index 0dc0c4c..d5c4ed3 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures.kt
@@ -118,4 +118,4 @@
return obtain(context)?.let { Api33Ext4JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFutures.kt
index 5c003dd..775548f 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/appsetid/AppSetIdManagerFutures.kt
@@ -64,4 +64,4 @@
return AppSetIdManager.obtain(context)?.let { Api33Ext4JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFutures.kt
index f74372d..4aac7df 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/customaudience/CustomAudienceManagerFutures.kt
@@ -137,4 +137,4 @@
return obtain(context)?.let { Api33Ext4JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFutures.kt
index e748f1b..b04eb21 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/measurement/MeasurementManagerFutures.kt
@@ -183,4 +183,4 @@
return obtain(context)?.let { Api33Ext5JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFutures.kt b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFutures.kt
index 00fa709..db6542d 100644
--- a/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFutures.kt
+++ b/privacysandbox/ads/ads-adservices-java/src/main/java/androidx/privacysandbox/ads/adservices/java/topics/TopicsManagerFutures.kt
@@ -70,4 +70,4 @@
return obtain(context)?.let { Api33Ext4JavaImpl(it) }
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/build.gradle b/privacysandbox/ads/ads-adservices/build.gradle
index 3e50880..a954990 100644
--- a/privacysandbox/ads/ads-adservices/build.gradle
+++ b/privacysandbox/ads/ads-adservices/build.gradle
@@ -26,7 +26,7 @@
dependencies {
api(libs.kotlinStdlib)
- api(libs.kotlinCoroutinesCore171)
+ api(libs.kotlinCoroutinesCore)
implementation("androidx.core:core-ktx:1.8.0")
api("androidx.annotation:annotation:1.6.0")
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdManagerTest.kt
index 8d71955..197f46b 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdManagerTest.kt
@@ -113,4 +113,4 @@
Assert.assertEquals(false, adId.isLimitAdTrackingEnabled)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdTest.kt
index 516d3fe..86a8477 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adid/AdIdTest.kt
@@ -41,4 +41,4 @@
val adId3 = AdId("1234", true)
Truth.assertThat(adId1 == adId3).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfigTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfigTest.kt
index 61d15e4..c151692 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfigTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfigTest.kt
@@ -73,4 +73,4 @@
trustedScoringSignalsUri)
Truth.assertThat(adSelectionConfig == adSelectionConfig2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionManagerTest.kt
index 5c658d3..8d71ea2 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionManagerTest.kt
@@ -230,4 +230,4 @@
Assert.assertEquals(expectedRequest.adSelectionConfig, request.adSelectionConfig)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManagerTest.kt
index 863e9a7..f3f3e99 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManagerTest.kt
@@ -119,4 +119,4 @@
Assert.assertEquals(AppSetId.SCOPE_APP, appSetId.scope)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdTest.kt
index 49aa2db..d37494a 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdTest.kt
@@ -53,4 +53,4 @@
AppSetId("1234", 3 /* Invalid scope */)
}.hasMessageThat().contains("Scope undefined.")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdDataTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdDataTest.kt
index c548abb..cc86a64 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdDataTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdDataTest.kt
@@ -55,4 +55,4 @@
.setMetadata(metadata)
Truth.assertThat(builder.build()).isEqualTo(constructed)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdSelectionSignalsTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdSelectionSignalsTest.kt
index 21cdcd13..8d69dc3 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdSelectionSignalsTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdSelectionSignalsTest.kt
@@ -40,4 +40,4 @@
var id2 = AdSelectionSignals("signals")
Truth.assertThat(id1 == id2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdTechIdentifierTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdTechIdentifierTest.kt
index 229df56..4133dbd 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdTechIdentifierTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/common/AdTechIdentifierTest.kt
@@ -40,4 +40,4 @@
var id2 = AdTechIdentifier("ad-tech-identifier")
Truth.assertThat(id1 == id2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceManagerTest.kt
index 67037d3..a107e7d 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceManagerTest.kt
@@ -230,4 +230,4 @@
Truth.assertThat(expectedRequest == leaveCustomAudienceRequest).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceTest.kt
index fa5c6ce..7d5bed0 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/CustomAudienceTest.kt
@@ -78,4 +78,4 @@
customAudienceBuilder2.setName("newName")
Truth.assertThat(customAudience == customAudienceBuilder2.build()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/JoinCustomAudienceRequestTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/JoinCustomAudienceRequestTest.kt
index 7638a70..3ce38c7 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/JoinCustomAudienceRequestTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/JoinCustomAudienceRequestTest.kt
@@ -58,4 +58,4 @@
val joinCustomAudienceRequest = JoinCustomAudienceRequest(customAudience)
Truth.assertThat(joinCustomAudienceRequest.toString()).isEqualTo(result)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/LeaveCustomAudienceTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/LeaveCustomAudienceTest.kt
index dc39bcd..ab733ca 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/LeaveCustomAudienceTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/LeaveCustomAudienceTest.kt
@@ -34,4 +34,4 @@
val leaveCustomAudienceRequest = LeaveCustomAudienceRequest(adTechIdentifier, name)
Truth.assertThat(leaveCustomAudienceRequest.toString()).isEqualTo(result)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingDataTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingDataTest.kt
index d26ffe5..5b74ef1 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingDataTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingDataTest.kt
@@ -48,4 +48,4 @@
.setTrustedBiddingKeys(keys)
Truth.assertThat(builder.build()).isEqualTo(constructed)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequestTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequestTest.kt
index c8d6395..74e57812 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequestTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequestTest.kt
@@ -64,4 +64,4 @@
.build()
Truth.assertThat(deletionRequest1 == deletionRequest2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/MeasurementManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/MeasurementManagerTest.kt
index d489862..191e2d8 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/MeasurementManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/MeasurementManagerTest.kt
@@ -333,4 +333,4 @@
assertThat(HashSet(request.originUris) == HashSet(expectedRequest.originUris))
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParamsTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParamsTest.kt
index 4850355..c2e3e18 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParamsTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParamsTest.kt
@@ -45,4 +45,4 @@
Truth.assertThat(request1 == request2).isTrue()
Truth.assertThat(request1 == request3).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequestTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequestTest.kt
index a404850..cfb6a16 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequestTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequestTest.kt
@@ -76,4 +76,4 @@
Truth.assertThat(request1 == request2).isTrue()
Truth.assertThat(request1 != request3).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerParamsTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerParamsTest.kt
index 677e163..0862558 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerParamsTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerParamsTest.kt
@@ -45,4 +45,4 @@
Truth.assertThat(request1 == request2).isTrue()
Truth.assertThat(request1 == request3).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequestTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequestTest.kt
index 2f64489..ae2173b 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequestTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequestTest.kt
@@ -53,4 +53,4 @@
Truth.assertThat(request1 == request2).isTrue()
Truth.assertThat(request1 != request3).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequestTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequestTest.kt
index 297e54c..e76c23e 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequestTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequestTest.kt
@@ -41,4 +41,4 @@
// Verify equality.
Truth.assertThat(request == request2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponseTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponseTest.kt
index 1078022..25c0699 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponseTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponseTest.kt
@@ -45,4 +45,4 @@
val response2 = GetTopicsResponse(listOf(topic2, topic1))
Truth.assertThat(response1 == response2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicTest.kt
index baac9ff..3baf4c1 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicTest.kt
@@ -38,4 +38,4 @@
val topic2 = Topic(/* taxonomyVersion= */ 1, /* modelVersion= */ 10, /* topicId= */ 100)
Truth.assertThat(topic1 == topic2).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerTest.kt b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerTest.kt
index 20736fb..d79e94e 100644
--- a/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerTest.kt
+++ b/privacysandbox/ads/ads-adservices/src/androidTest/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerTest.kt
@@ -186,4 +186,4 @@
Assert.assertEquals(2, topic2.taxonomyVersion)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdId.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdId.kt
index ad9ba22..22a9271 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdId.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdId.kt
@@ -47,4 +47,4 @@
override fun toString(): String {
return "AdId: adId=$adId, isLimitAdTrackingEnabled=$isLimitAdTrackingEnabled"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdIdManager.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdIdManager.kt
index 129d17b..17431a8 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdIdManager.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adid/AdIdManager.kt
@@ -95,4 +95,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig.kt
index 839b734..c3630f1 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig.kt
@@ -84,4 +84,4 @@
"sellerSignals=$sellerSignals, perBuyerSignals=$perBuyerSignals, " +
"trustedScoringSignalsUri=$trustedScoringSignalsUri"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest.kt
index 3740b5d..836899d 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest.kt
@@ -49,4 +49,4 @@
return "ReportImpressionRequest: adSelectionId=$adSelectionId, " +
"adSelectionConfig=$adSelectionConfig"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetId.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetId.kt
index 516ba9e..508da63 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetId.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetId.kt
@@ -67,4 +67,4 @@
*/
public const val SCOPE_DEVELOPER = 2
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManager.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManager.kt
index 7c57149..d780956 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManager.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/appsetid/AppSetIdManager.kt
@@ -91,4 +91,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/common/AdData.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/common/AdData.kt
index 7685d0b..a274659 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/common/AdData.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/common/AdData.kt
@@ -87,4 +87,4 @@
return AdData(renderUri, metadata)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData.kt
index 86b4672..077c397 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/customaudience/TrustedBiddingData.kt
@@ -89,4 +89,4 @@
return TrustedBiddingData(trustedBiddingUri, trustedBiddingKeys)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/internal/AdServicesInfo.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/internal/AdServicesInfo.kt
index 5f8544d..91ec283 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/internal/AdServicesInfo.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/internal/AdServicesInfo.kt
@@ -43,4 +43,4 @@
fun getAdServicesVersion() =
SdkExtensions.getExtensionVersion(SdkExtensions.AD_SERVICES)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.kt
index 8529c36..957e1bf 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/DeletionRequest.kt
@@ -210,4 +210,4 @@
originUris)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParams.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParams.kt
index b37465a..5ad22a2 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParams.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceParams.kt
@@ -51,4 +51,4 @@
return "WebSourceParams { RegistrationUri=$registrationUri, " +
"DebugKeyAllowed=$debugKeyAllowed }"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequest.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequest.kt
index c85be19..e058ae8 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequest.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebSourceRegistrationRequest.kt
@@ -159,4 +159,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequest.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequest.kt
index 6cbd612..4ed18c0 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequest.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/measurement/WebTriggerRegistrationRequest.kt
@@ -48,4 +48,4 @@
return "WebTriggerRegistrationRequest { WebTriggerParams=$webTriggerParams, " +
"Destination=$destination"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest.kt
index af07f77..d8f4a81 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest.kt
@@ -84,4 +84,4 @@
return GetTopicsRequest(adsSdkName, shouldRecordObservation)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse.kt
index 78e871b..f6f828a 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse.kt
@@ -34,4 +34,4 @@
override fun toString(): String {
return "Topics=$topics"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/Topic.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/Topic.kt
index 69ab3ec..30958de 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/Topic.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/Topic.kt
@@ -50,4 +50,4 @@
hash = 31 * hash + topicId.hashCode()
return hash
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManager.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManager.kt
index 4bccf85..828fdf9 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManager.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManager.kt
@@ -59,4 +59,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerImplCommon.kt b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerImplCommon.kt
index 5632655..7dc5752 100644
--- a/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerImplCommon.kt
+++ b/privacysandbox/ads/ads-adservices/src/main/java/androidx/privacysandbox/ads/adservices/topics/TopicsManagerImplCommon.kt
@@ -51,4 +51,4 @@
}
return GetTopicsResponse(topics)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/AidlExecutableInputs.kt b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/AidlExecutableInputs.kt
index b7ce1a6..851177f 100644
--- a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/AidlExecutableInputs.kt
+++ b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/AidlExecutableInputs.kt
@@ -42,4 +42,4 @@
"aidl_compiler_path=$aidlExecutablePath"
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/FrameworkAidlInputs.kt b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/FrameworkAidlInputs.kt
index 4f9dfbf..bb41498 100644
--- a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/FrameworkAidlInputs.kt
+++ b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/FrameworkAidlInputs.kt
@@ -39,4 +39,4 @@
}
return listOf("framework_aidl_path=$frameworkAidlPath")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPlugin.kt b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPlugin.kt
index a7ecb4f..ea94188 100644
--- a/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPlugin.kt
+++ b/privacysandbox/plugins/plugins-privacysandbox-library/src/main/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPlugin.kt
@@ -116,4 +116,4 @@
// From build.gradle
const val pluginId = "androidx.privacysandbox.plugins.privacysandbox-library"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/plugins/plugins-privacysandbox-library/src/test/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPluginTest.kt b/privacysandbox/plugins/plugins-privacysandbox-library/src/test/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPluginTest.kt
index fe72161..b616b20 100644
--- a/privacysandbox/plugins/plugins-privacysandbox-library/src/test/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPluginTest.kt
+++ b/privacysandbox/plugins/plugins-privacysandbox-library/src/test/java/androidx/privacysandboxlibraryplugin/PrivacySandboxLibraryPluginTest.kt
@@ -98,4 +98,4 @@
val build = File(projectSetup.rootDir, "build")
assertTrue(File(build, "generated/ksp/debug").exists())
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/EmptyActivity.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/EmptyActivity.kt
index f7d19b4..1dfed64 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/EmptyActivity.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/EmptyActivity.kt
@@ -23,4 +23,4 @@
* [androidx.privacysandbox.sdkruntime.client.activity.SdkActivity] can't be used for most tests as
* it will be moved to finished state during creation when no valid token provided.
*/
-class EmptyActivity : ComponentActivity()
\ No newline at end of file
+class EmptyActivity : ComponentActivity()
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerAppOwnedInterfacesTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerAppOwnedInterfacesTest.kt
index bac6861..30d5c07 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerAppOwnedInterfacesTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerAppOwnedInterfacesTest.kt
@@ -186,4 +186,4 @@
private fun isAppOwnedInterfacesApiAvailable() =
AdServicesInfo.isDeveloperPreview()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatSandboxedTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatSandboxedTest.kt
index a56a801..af839829 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatSandboxedTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatSandboxedTest.kt
@@ -348,4 +348,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatTest.kt
index 8db037e..faec8df 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompatTest.kt
@@ -371,4 +371,4 @@
private fun isSandboxApiNotAvailable() =
!AdServicesInfo.isAtLeastV4()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/TestActivityHolder.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/TestActivityHolder.kt
index 66a8470..bfc47b7 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/TestActivityHolder.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/TestActivityHolder.kt
@@ -34,4 +34,4 @@
override val lifecycle: Lifecycle
get() = lifecycleRegistry
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParserTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParserTest.kt
index f7e20ea..42f370a 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParserTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParserTest.kt
@@ -250,4 +250,4 @@
return parse(inputStream, packageName, versionMajor)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolderTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolderTest.kt
index 21c0016..1f0ccf4 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolderTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolderTest.kt
@@ -68,4 +68,4 @@
assertThat(result).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParserTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParserTest.kt
index bc2c9d5..e8fe29b 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParserTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParserTest.kt
@@ -199,4 +199,4 @@
return parse(inputStream)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/LocalControllerTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/LocalControllerTest.kt
index 92b7a74..e7e0b13 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/LocalControllerTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/LocalControllerTest.kt
@@ -129,4 +129,4 @@
override fun getAppOwnedSdkSandboxInterfaces(): List<AppOwnedSdkSandboxInterfaceCompat> =
appOwnedSdks
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistryTest.kt
index 71563bc..8bbddbf 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistryTest.kt
@@ -91,4 +91,4 @@
val registeredInterfaces = sdkRegistry.getAppOwnedSdkSandboxInterfaces()
assertThat(registeredInterfaces).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistryTest.kt
index 23ed22f..819055d 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistryTest.kt
@@ -139,4 +139,4 @@
appOwnedInterfaces.forEach { unregisterMethod.invoke(sandboxManager, it.getName()) }
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactoryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactoryTest.kt
index 22d795b..32d2773a 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactoryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactoryTest.kt
@@ -142,4 +142,4 @@
return testStorage.dexFilesFor(testSdkConfig)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactoryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactoryTest.kt
index 1f3762f..c4d0ef1 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactoryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactoryTest.kt
@@ -113,4 +113,4 @@
.hasMessageThat()
.isEqualTo("Can't use InMemoryDexClassLoader")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactoryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactoryTest.kt
index 3da2c8b..b426788 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactoryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactoryTest.kt
@@ -111,4 +111,4 @@
assertThat(appResources.hasMoreElements()).isTrue()
assertThat(resources.hasMoreElements()).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProviderTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProviderTest.kt
index 6a42d95..4149ac0 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProviderTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProviderTest.kt
@@ -443,4 +443,4 @@
sdkActivityHandlers.values.remove(handlerCompat)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkTestUtils.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkTestUtils.kt
index 3b48bc8..ab7f918 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkTestUtils.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkTestUtils.kt
@@ -287,4 +287,4 @@
extractSdkProviderClassloader()
)
return versionsClass.getDeclaredField(versionFieldName).get(null) as Int
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SandboxedSdkContextCompatTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SandboxedSdkContextCompatTest.kt
index fea2d59..8a318c7 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SandboxedSdkContextCompatTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SandboxedSdkContextCompatTest.kt
@@ -481,4 +481,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoaderTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoaderTest.kt
index a473b05..09812407 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoaderTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoaderTest.kt
@@ -185,4 +185,4 @@
throw UnsupportedOperationException("NoOp")
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtilsTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtilsTest.kt
index 2972d47..50c1153 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtilsTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtilsTest.kt
@@ -168,4 +168,4 @@
assertThat(resultFile1.exists()).isTrue()
assertThat(resultFile2.exists()).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactoryTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactoryTest.kt
index 4aad685..70b4abe 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactoryTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactoryTest.kt
@@ -132,4 +132,4 @@
count++
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapperTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapperTest.kt
index a4622db..a9ead92 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapperTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapperTest.kt
@@ -66,4 +66,4 @@
result = activityHolder
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorageTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorageTest.kt
index 428c85f..3e5ba24 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorageTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorageTest.kt
@@ -189,4 +189,4 @@
val availableBlocks = stat.availableBlocks.toLong()
return availableBlocks * blockSize
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProviderTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProviderTest.kt
index a91734c..715f0bc 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProviderTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProviderTest.kt
@@ -185,4 +185,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/TestLocalSdkStorage.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/TestLocalSdkStorage.kt
index 22cf607..af73bcc 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/TestLocalSdkStorage.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/androidTest/java/androidx/privacysandbox/sdkruntime/client/loader/storage/TestLocalSdkStorage.kt
@@ -48,4 +48,4 @@
return LocalSdkDexFiles(fileList)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompat.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompat.kt
index 06b36066..8414411 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxManagerCompat.kt
@@ -21,14 +21,13 @@
import android.app.sdksandbox.SandboxedSdk
import android.app.sdksandbox.SdkSandboxManager
import android.content.Context
+import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.os.ext.SdkExtensions.AD_SERVICES
import androidx.annotation.DoNotInline
-import androidx.annotation.OptIn
import androidx.annotation.RequiresApi
import androidx.annotation.RequiresExtension
-import androidx.core.os.BuildCompat
import androidx.core.os.asOutcomeReceiver
import androidx.privacysandbox.sdkruntime.client.activity.LocalSdkActivityStarter
import androidx.privacysandbox.sdkruntime.client.config.LocalSdkConfigsHolder
@@ -477,9 +476,8 @@
private object PlatformApiFactory {
@SuppressLint("NewApi", "ClassVerificationFailure")
- @OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
fun create(context: Context): PlatformApi {
- return if (BuildCompat.isAtLeastU() || AdServicesInfo.isDeveloperPreview()) {
+ return if (Build.VERSION.SDK_INT >= 34 || AdServicesInfo.isDeveloperPreview()) {
ApiAdServicesUDCImpl(context)
} else if (AdServicesInfo.isAtLeastV5()) {
ApiAdServicesV5Impl(context)
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxProcessDeathCallbackCompat.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxProcessDeathCallbackCompat.kt
index 32c5b15..00a7771 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxProcessDeathCallbackCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/SdkSandboxProcessDeathCallbackCompat.kt
@@ -37,4 +37,4 @@
* @see [android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback.onSdkSandboxDied]
*/
fun onSdkSandboxDied()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/ComponentActivityHolder.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/ComponentActivityHolder.kt
index f47279e..0f54d4b 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/ComponentActivityHolder.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/ComponentActivityHolder.kt
@@ -35,4 +35,4 @@
override val lifecycle: Lifecycle
get() = activity.lifecycle
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityHandlerRegistry.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityHandlerRegistry.kt
index 2f9bf53..7b2b726 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityHandlerRegistry.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityHandlerRegistry.kt
@@ -80,4 +80,4 @@
?: throw IllegalStateException("There is no registered handler to notify")
handler.onActivityCreated(activityHolder)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityStarter.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityStarter.kt
index 64fc30a..2eca2e6 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityStarter.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/LocalSdkActivityStarter.kt
@@ -67,4 +67,4 @@
val params = intent.extras ?: return null
return BundleCompat.getBinder(params, EXTRA_ACTIVITY_TOKEN)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/SdkActivity.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/SdkActivity.kt
index 2689fee..6fa9dd0 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/SdkActivity.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/activity/SdkActivity.kt
@@ -67,4 +67,4 @@
private companion object {
private const val LOG_TAG = "SdkActivity"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfig.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfig.kt
index 1276a7e..2c87c2e 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfig.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfig.kt
@@ -31,4 +31,4 @@
internal data class ResourceRemappingConfig(
val rPackageClassName: String,
val packageId: Int
-)
\ No newline at end of file
+)
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParser.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParser.kt
index 5558336..097bf78 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParser.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigParser.kt
@@ -185,4 +185,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolder.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolder.kt
index 0db3714..c97df47 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolder.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/LocalSdkConfigsHolder.kt
@@ -71,4 +71,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParser.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParser.kt
index 6bea778..0b64d5a 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParser.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/config/SdkTableConfigParser.kt
@@ -157,4 +157,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/AppOwnedSdkRegistry.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/AppOwnedSdkRegistry.kt
index e89a059..269fbb7 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/AppOwnedSdkRegistry.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/AppOwnedSdkRegistry.kt
@@ -28,4 +28,4 @@
fun unregisterAppOwnedSdkSandboxInterface(sdkName: String)
fun getAppOwnedSdkSandboxInterfaces(): List<AppOwnedSdkSandboxInterfaceCompat>
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocalController.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocalController.kt
index c2ec13d..59cc703 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocalController.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocalController.kt
@@ -49,4 +49,4 @@
) {
LocalSdkActivityHandlerRegistry.unregister(handlerCompat)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocallyLoadedSdks.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocallyLoadedSdks.kt
index 1f2856d..73c3248 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocallyLoadedSdks.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/LocallyLoadedSdks.kt
@@ -53,4 +53,4 @@
val sdkProvider: LocalSdkProvider,
val sdk: SandboxedSdkCompat
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistry.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistry.kt
index 3322247..b497b70 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistry.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/LocalAppOwnedSdkRegistry.kt
@@ -46,4 +46,4 @@
synchronized(appOwnedInterfaces) {
return appOwnedInterfaces.values.toList()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistry.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistry.kt
index e2c7abf..1510a87 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistry.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/controller/impl/PlatformAppOwnedSdkRegistry.kt
@@ -82,4 +82,4 @@
val apiResult = getAppOwnedSdksMethod.invoke(sdkSandboxManager) as List<*>
return apiResult.map { converter.toCompat(it!!) }
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactory.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactory.kt
index e6d8eb6..54678be 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactory.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/FileClassLoaderFactory.kt
@@ -83,4 +83,4 @@
const val LOG_TAG =
"FileClassLoaderFactory"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactory.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactory.kt
index 28b5823..2d7ff1b 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactory.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/InMemorySdkClassLoaderFactory.kt
@@ -124,4 +124,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactory.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactory.kt
index b669af8..55da921 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactory.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/JavaResourcesLoadingClassLoaderFactory.kt
@@ -82,4 +82,4 @@
companion object {
const val ASSETS_DIR = "assets/"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProvider.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProvider.kt
index 56af6b0..08cfb5c 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProvider.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/LocalSdkProvider.kt
@@ -34,4 +34,4 @@
abstract fun onLoadSdk(params: Bundle): SandboxedSdkCompat
abstract fun beforeUnloadSdk()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemapping.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemapping.kt
index 711d7b1..d45305d 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemapping.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemapping.kt
@@ -45,4 +45,4 @@
field.setInt(null, remappingConfig.packageId)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoader.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoader.kt
index f8b08ed..596830e 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoader.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/SdkLoader.kt
@@ -137,4 +137,4 @@
return SdkLoader(classLoaderFactory, context, controller)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/VersionHandshake.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/VersionHandshake.kt
index 21a6a17..a233a52 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/VersionHandshake.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/VersionHandshake.kt
@@ -36,4 +36,4 @@
val handShakeMethod = versionsClass.getMethod("handShake", Int::class.javaPrimitiveType)
return handShakeMethod.invoke(null, Versions.API_VERSION) as Int
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtils.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtils.kt
index 6cd5caa..05cbea5 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtils.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/MigrationUtils.kt
@@ -102,4 +102,4 @@
fun copy(from: InputStream, to: OutputStream): Long =
FileUtils.copy(from, to)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxControllerInjector.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxControllerInjector.kt
index e22a12d..5ab475c 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxControllerInjector.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxControllerInjector.kt
@@ -225,4 +225,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxedSdkContextCompat.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxedSdkContextCompat.kt
index e054674..e08530e 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxedSdkContextCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SandboxedSdkContextCompat.kt
@@ -312,4 +312,4 @@
private const val SDK_ROOT_FOLDER = "RuntimeEnabledSdksData"
private const val SDK_SHARED_PREFERENCES_PREFIX = "RuntimeEnabledSdk"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SdkProviderV1.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SdkProviderV1.kt
index 4a6d959..2860872 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SdkProviderV1.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/SdkProviderV1.kt
@@ -191,4 +191,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactory.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactory.kt
index ed9d37e..9c027b7 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactory.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/ActivityHolderProxyFactory.kt
@@ -104,4 +104,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/AppOwnedSdkInterfaceProxyFactory.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/AppOwnedSdkInterfaceProxyFactory.kt
index 113b176..56028dc 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/AppOwnedSdkInterfaceProxyFactory.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/AppOwnedSdkInterfaceProxyFactory.kt
@@ -57,4 +57,4 @@
return AppOwnedSdkInterfaceProxyFactory(appOwnedSdkSandboxInterfaceCompatConstructor)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapper.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapper.kt
index d9549f9..cdc7fb3 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapper.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/impl/injector/SdkActivityHandlerWrapper.kt
@@ -72,4 +72,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorage.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorage.kt
index 82251fc..6ed726b 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorage.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/CachedLocalSdkStorage.kt
@@ -145,4 +145,4 @@
return CachedLocalSdkStorage(context, localSdkFolderProvider, lowSpaceThreshold)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProvider.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProvider.kt
index 2b9e08e..7057870 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProvider.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkFolderProvider.kt
@@ -146,4 +146,4 @@
PackageManager.PackageInfoFlags.of(0)
).lastUpdateTime
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkStorage.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkStorage.kt
index 66fdab7..371c6bb 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkStorage.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/main/java/androidx/privacysandbox/sdkruntime/client/loader/storage/LocalSdkStorage.kt
@@ -29,4 +29,4 @@
* @return [LocalSdkDexFiles] if DEX files available or null if not.
*/
fun dexFilesFor(sdkConfig: LocalSdkConfig): LocalSdkDexFiles?
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-client/src/test/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemappingTest.kt b/privacysandbox/sdkruntime/sdkruntime-client/src/test/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemappingTest.kt
index cb17a81..87e152f 100644
--- a/privacysandbox/sdkruntime/sdkruntime-client/src/test/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemappingTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-client/src/test/java/androidx/privacysandbox/sdkruntime/client/loader/ResourceRemappingTest.kt
@@ -146,4 +146,4 @@
/* parent = */ null
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompatTest.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompatTest.kt
index 22d69b5..968a3c4 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompatTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompatTest.kt
@@ -49,4 +49,4 @@
assertThat(convertedCompatObj.getVersion()).isEqualTo(compatObj.getVersion())
assertThat(convertedCompatObj.getInterface()).isEqualTo(compatObj.getInterface())
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatExceptionTest.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatExceptionTest.kt
index 1386c41..ca2302d 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatExceptionTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatExceptionTest.kt
@@ -75,4 +75,4 @@
private fun isSandboxApiAvailable() =
AdServicesInfo.isAtLeastV4()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapterTest.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapterTest.kt
index 1cda2cb..cc2e07c 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapterTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapterTest.kt
@@ -257,4 +257,4 @@
private fun isSandboxApiAvailable() =
AdServicesInfo.isAtLeastV4()
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompatLocalTest.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompatLocalTest.kt
index a37f3f2..7cbf999 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompatLocalTest.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/androidTest/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompatLocalTest.kt
@@ -210,4 +210,4 @@
token = null
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AdServicesInfo.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AdServicesInfo.kt
index 3cc4ee9..4a5d739 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AdServicesInfo.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AdServicesInfo.kt
@@ -56,4 +56,4 @@
fun isAtLeastV5() =
SdkExtensions.getExtensionVersion(SdkExtensions.AD_SERVICES) >= 5
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedInterfaceConverter.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedInterfaceConverter.kt
index b28e5e3..667f0cb 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedInterfaceConverter.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedInterfaceConverter.kt
@@ -63,4 +63,4 @@
compatObject.getInterface()
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompat.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompat.kt
index 8a4b4cd..5de206f 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/AppOwnedSdkSandboxInterfaceCompat.kt
@@ -62,4 +62,4 @@
* the agreed upon interface before using it.
*/
fun getInterface(): IBinder = binder
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatException.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatException.kt
index 2222ada..9f4640e 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatException.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/LoadSdkCompatException.kt
@@ -221,4 +221,4 @@
return ApiAdServicesV4Impl.toLoadCompatSdkException(ex)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkInfo.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkInfo.kt
index b2caca8..656ced2 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkInfo.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkInfo.kt
@@ -50,4 +50,4 @@
result = 31 * result + version.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapter.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapter.kt
index 7ece46d..8dfde4a 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapter.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderAdapter.kt
@@ -91,4 +91,4 @@
private const val COMPAT_SDK_PROVIDER_CLASS_ASSET_NAME =
"SandboxedSdkProviderCompatClassName.txt"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat.kt
index 8882d6f..4c27e96 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/SandboxedSdkProviderCompat.kt
@@ -103,4 +103,4 @@
width: Int,
height: Int
): View
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/Versions.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/Versions.kt
index e124d2e3..b8818b2 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/Versions.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/Versions.kt
@@ -47,4 +47,4 @@
fun resetClientVersion() {
CLIENT_VERSION = null
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder.kt
index 8832f0e..e438f75 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/ActivityHolder.kt
@@ -39,4 +39,4 @@
* The [OnBackPressedDispatcher] for the created [Activity].
*/
fun getOnBackPressedDispatcher(): OnBackPressedDispatcher
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/SdkSandboxActivityHandlerCompat.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/SdkSandboxActivityHandlerCompat.kt
index b41250a..87b2448 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/SdkSandboxActivityHandlerCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/activity/SdkSandboxActivityHandlerCompat.kt
@@ -49,4 +49,4 @@
* @see SdkSandboxActivityHandler.onActivityCreated
*/
fun onActivityCreated(activityHolder: ActivityHolder)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompat.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompat.kt
index 31494d2..bcc649f 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompat.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/SdkSandboxControllerCompat.kt
@@ -18,12 +18,11 @@
import android.app.sdksandbox.sdkprovider.SdkSandboxController
import android.content.Context
+import android.os.Build
import android.os.IBinder
import androidx.annotation.Keep
-import androidx.annotation.OptIn
import androidx.annotation.RestrictTo
import androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP
-import androidx.core.os.BuildCompat
import androidx.privacysandbox.sdkruntime.core.AdServicesInfo
import androidx.privacysandbox.sdkruntime.core.AppOwnedSdkSandboxInterfaceCompat
import androidx.privacysandbox.sdkruntime.core.SandboxedSdkCompat
@@ -164,10 +163,9 @@
}
private object PlatformImplFactory {
- @OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
fun create(context: Context): SandboxControllerImpl {
if (AdServicesInfo.isAtLeastV5()) {
- if (BuildCompat.isAtLeastU() || AdServicesInfo.isDeveloperPreview()) {
+ if (Build.VERSION.SDK_INT >= 34 || AdServicesInfo.isDeveloperPreview()) {
return PlatformUDCImpl.from(context)
}
return PlatformImpl.from(context)
@@ -175,4 +173,4 @@
return NoOpImpl()
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/AppOwnedSdkProvider.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/AppOwnedSdkProvider.kt
index bef25e8..313db26 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/AppOwnedSdkProvider.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/AppOwnedSdkProvider.kt
@@ -76,4 +76,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/LocalImpl.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/LocalImpl.kt
index f90237c2..2c8beda 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/LocalImpl.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/LocalImpl.kt
@@ -63,4 +63,4 @@
}
implFromClient.unregisterSdkSandboxActivityHandler(handlerCompat)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/NoOpImpl.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/NoOpImpl.kt
index cbe53ec..ab53064 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/NoOpImpl.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/NoOpImpl.kt
@@ -43,4 +43,4 @@
) {
throw UnsupportedOperationException("Not supported")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/PlatformUDCImpl.kt b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/PlatformUDCImpl.kt
index fcae673..1ccf8de5 100644
--- a/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/PlatformUDCImpl.kt
+++ b/privacysandbox/sdkruntime/sdkruntime-core/src/main/java/androidx/privacysandbox/sdkruntime/core/controller/impl/PlatformUDCImpl.kt
@@ -134,4 +134,4 @@
return PlatformUDCImpl(sdkSandboxController)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompiler.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompiler.kt
index 99e696c..f9d560c 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompiler.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompiler.kt
@@ -91,4 +91,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/AbstractSdkProviderGenerator.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/AbstractSdkProviderGenerator.kt
index 96d33b9..540f146 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/AbstractSdkProviderGenerator.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/AbstractSdkProviderGenerator.kt
@@ -81,4 +81,4 @@
.returns(service.type.poetTypeName())
.build()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/Api33SdkProviderGenerator.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/Api33SdkProviderGenerator.kt
index e4dd4bd..5639123 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/Api33SdkProviderGenerator.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/Api33SdkProviderGenerator.kt
@@ -62,4 +62,4 @@
api.getOnlyService().stubDelegateNameSpec(),
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/CompatSdkProviderGenerator.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/CompatSdkProviderGenerator.kt
index 5c2e0ed..5053460 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/CompatSdkProviderGenerator.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/CompatSdkProviderGenerator.kt
@@ -62,4 +62,4 @@
api.getOnlyService().stubDelegateNameSpec(),
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/SdkCodeGenerator.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/SdkCodeGenerator.kt
index d3332ac..0892dbb 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/SdkCodeGenerator.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/generator/SdkCodeGenerator.kt
@@ -165,4 +165,4 @@
}
private fun basePackageName() = api.getOnlyService().type.packageName
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ApiParser.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ApiParser.kt
index 5782e08..67ac55f 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ApiParser.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ApiParser.kt
@@ -102,4 +102,4 @@
logger.error(error)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParser.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParser.kt
index f1c766a..080e840 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParser.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParser.kt
@@ -149,4 +149,4 @@
type = typeParser.parseFromTypeReference(parameter.type, name),
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/TypeParser.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/TypeParser.kt
index 6b2387a..156094a 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/TypeParser.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/TypeParser.kt
@@ -51,4 +51,4 @@
isNullable = resolvedType.isMarkedNullable,
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParser.kt b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParser.kt
index 64f9c6b..ff37a6d 100644
--- a/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParser.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/main/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParser.kt
@@ -76,4 +76,4 @@
type = typeParser.parseFromTypeReference(property.type, name),
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/AbstractApiCompilerDiffTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/AbstractApiCompilerDiffTest.kt
index cd0f1b0..0086931 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/AbstractApiCompilerDiffTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/AbstractApiCompilerDiffTest.kt
@@ -47,4 +47,4 @@
}
return sources
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/FullFeaturedSdkApiCompilerDiffTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/FullFeaturedSdkApiCompilerDiffTest.kt
index 75b6cd0..88c2b52 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/FullFeaturedSdkApiCompilerDiffTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/FullFeaturedSdkApiCompilerDiffTest.kt
@@ -53,4 +53,4 @@
"com/mysdk/ParcelableInnerValue.java",
"com/mysdk/PrivacySandboxThrowableParcel.java",
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompilerTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompilerTest.kt
index 0eccb02..6f4b716 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompilerTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/PrivacySandboxKspCompilerTest.kt
@@ -84,4 +84,4 @@
)
assertThat(compileWithPrivacySandboxKspCompiler(listOf(source))).fails()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/SdkWithPackagesApiCompilerDiffTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/SdkWithPackagesApiCompilerDiffTest.kt
index d9558f0..2102122 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/SdkWithPackagesApiCompilerDiffTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/SdkWithPackagesApiCompilerDiffTest.kt
@@ -40,4 +40,4 @@
"com/mysdk/IMyMainPackageInterface.java",
"com/mysdk/PrivacySandboxThrowableParcel.java"
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/WithoutRuntimeLibrarySdkApiCompilerDiffTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/WithoutRuntimeLibrarySdkApiCompilerDiffTest.kt
index 8fcee4c..3cceb9a 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/WithoutRuntimeLibrarySdkApiCompilerDiffTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/WithoutRuntimeLibrarySdkApiCompilerDiffTest.kt
@@ -30,4 +30,4 @@
"com/mysdk/ParcelableStackFrame.java",
"com/mysdk/PrivacySandboxThrowableParcel.java",
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParserTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParserTest.kt
index 4648597..548b00b 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParserTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/InterfaceParserTest.kt
@@ -563,4 +563,4 @@
}
"""
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParserTest.kt b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParserTest.kt
index ce1d8f2..4b8f7a9 100644
--- a/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParserTest.kt
+++ b/privacysandbox/tools/tools-apicompiler/src/test/java/androidx/privacysandbox/tools/apicompiler/parser/ValueParserTest.kt
@@ -184,4 +184,4 @@
$declaration
"""
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/InterfaceFileGenerator.kt b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/InterfaceFileGenerator.kt
index 19d9baf..3c43900 100644
--- a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/InterfaceFileGenerator.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/InterfaceFileGenerator.kt
@@ -52,4 +52,4 @@
addParameters(method.parameters.map { it.poetSpec() })
returns(method.returnType.poetTypeName())
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/PrivacySandboxApiGenerator.kt b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/PrivacySandboxApiGenerator.kt
index 49a34e2..096aed8 100644
--- a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/PrivacySandboxApiGenerator.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/PrivacySandboxApiGenerator.kt
@@ -254,4 +254,4 @@
PrivacySandboxExceptionFileGenerator(basePackageName).generate().writeTo(output)
PrivacySandboxCancellationExceptionFileGenerator(basePackageName).generate().writeTo(output)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/parser/AnnotatedClassReader.kt b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/parser/AnnotatedClassReader.kt
index d655f8d..ef6c9994 100644
--- a/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/parser/AnnotatedClassReader.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/main/java/androidx/privacysandbox/tools/apigenerator/parser/AnnotatedClassReader.kt
@@ -132,4 +132,4 @@
}
return attributes
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/AbstractApiGeneratorDiffTest.kt b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/AbstractApiGeneratorDiffTest.kt
index feb81d0..415aa55 100644
--- a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/AbstractApiGeneratorDiffTest.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/AbstractApiGeneratorDiffTest.kt
@@ -51,4 +51,4 @@
fun generatedSourcesCompile() {
assertCompiles(generatedSources)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/CallbacksApiGeneratorDiffTest.kt b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/CallbacksApiGeneratorDiffTest.kt
index 81ec136..7907500 100644
--- a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/CallbacksApiGeneratorDiffTest.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/CallbacksApiGeneratorDiffTest.kt
@@ -30,4 +30,4 @@
"com/sdkwithcallbacks/IMyUiInterface.java",
"com/sdkwithcallbacks/IMyUiInterfaceCoreLibInfoAndBinderWrapper.java"
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/InterfaceApiGeneratorDiffTest.kt b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/InterfaceApiGeneratorDiffTest.kt
index e77fda56..7558126 100644
--- a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/InterfaceApiGeneratorDiffTest.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/InterfaceApiGeneratorDiffTest.kt
@@ -34,4 +34,4 @@
"com/sdk/ParcelableStackFrame.java",
"com/sdk/PrivacySandboxThrowableParcel.java",
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/PrimitivesApiGeneratorDiffTest.kt b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/PrimitivesApiGeneratorDiffTest.kt
index bf87924..832baa1 100644
--- a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/PrimitivesApiGeneratorDiffTest.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/PrimitivesApiGeneratorDiffTest.kt
@@ -38,4 +38,4 @@
"com/mysdk/ParcelableStackFrame.java",
"com/mysdk/PrivacySandboxThrowableParcel.java",
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/VersionCompatibilityCheckTest.kt b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/VersionCompatibilityCheckTest.kt
index 9d04ca2..ffed244 100644
--- a/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/VersionCompatibilityCheckTest.kt
+++ b/privacysandbox/tools/tools-apigenerator/src/test/java/androidx/privacysandbox/tools/apigenerator/VersionCompatibilityCheckTest.kt
@@ -101,4 +101,4 @@
val outputDir = Files.createTempDirectory("output").also { it.toFile().deleteOnExit() }
generator.generate(descriptors, aidlCompilerPath, frameworkAidlPath, outputDir)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/Metadata.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/Metadata.kt
index 75f5057..3fd042f 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/Metadata.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/Metadata.kt
@@ -29,4 +29,4 @@
/** Relative path to metadata file in SDK API descriptor jar. */
val filePath = Path("META-INF/privacysandbox/tool-metadata.pb")
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/AidlCompiler.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/AidlCompiler.kt
index 36dbb1b..a4f989d 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/AidlCompiler.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/AidlCompiler.kt
@@ -79,4 +79,4 @@
return "Error when printing output of command: ${e.message}"
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/BinderCodeConverter.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/BinderCodeConverter.kt
index fbcc1f1..fd91bd1 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/BinderCodeConverter.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/BinderCodeConverter.kt
@@ -243,4 +243,4 @@
else -> ClassName("kotlin", "Array")
.parameterizedBy(convertToBinderType(type))
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverter.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverter.kt
index 414d1cd..e95204a 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverter.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverter.kt
@@ -115,4 +115,4 @@
MemberName(activityLauncherConverterClass, "getLocalOrProxyLauncher"),
expression,
)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientProxyTypeGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientProxyTypeGenerator.kt
index e82bafb..ec4f236 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientProxyTypeGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ClientProxyTypeGenerator.kt
@@ -232,4 +232,4 @@
get() {
return returnType.qualifiedName == Unit::class.qualifiedName
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/CoreLibInfoAndBinderWrapperConverterGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/CoreLibInfoAndBinderWrapperConverterGenerator.kt
index 7bc2df7..7473dc3 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/CoreLibInfoAndBinderWrapperConverterGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/CoreLibInfoAndBinderWrapperConverterGenerator.kt
@@ -47,4 +47,4 @@
addStatement("return parcelable")
})
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/KotlinPoetSpecs.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/KotlinPoetSpecs.kt
index 123a0f6..f5a716d 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/KotlinPoetSpecs.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/KotlinPoetSpecs.kt
@@ -172,4 +172,4 @@
// Privacy Sandbox UI
val toCoreLibInfoMethod = MemberName("androidx.privacysandbox.ui.provider", "toCoreLibInfo")
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxCancellationExceptionFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxCancellationExceptionFileGenerator.kt
index fe8888f..dadcb7d5 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxCancellationExceptionFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxCancellationExceptionFileGenerator.kt
@@ -53,4 +53,4 @@
addType(classSpec)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxExceptionFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxExceptionFileGenerator.kt
index f587725..fdb9242 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxExceptionFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/PrivacySandboxExceptionFileGenerator.kt
@@ -53,4 +53,4 @@
addType(classSpec)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverter.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverter.kt
index 27eb1e3..f31c8ab 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverter.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverter.kt
@@ -116,4 +116,4 @@
override fun convertToActivityLauncherModelCode(expression: String): CodeBlock =
CodeBlock.of("%T(%L)", activityLauncherWrapperClass, expression)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServiceFactoryFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServiceFactoryFileGenerator.kt
index 99979ab..7b569a2 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServiceFactoryFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ServiceFactoryFileGenerator.kt
@@ -60,4 +60,4 @@
}
private fun factoryName(service: AnnotatedInterface) = "${service.type.simpleName}Factory"
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ThrowableParcelConverterFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ThrowableParcelConverterFileGenerator.kt
index 647ca84..ab32014 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ThrowableParcelConverterFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ThrowableParcelConverterFileGenerator.kt
@@ -135,4 +135,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/TransportCancellationGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/TransportCancellationGenerator.kt
index 4167b4d..8920889 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/TransportCancellationGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/TransportCancellationGenerator.kt
@@ -65,4 +65,4 @@
return FileSpec.builder(packageName, className).addType(classSpec).build()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueConverterFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueConverterFileGenerator.kt
index e2d5768..0b487b4 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueConverterFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueConverterFileGenerator.kt
@@ -112,4 +112,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueFileGenerator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueFileGenerator.kt
index 79055e7..4eac9ed 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueFileGenerator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/ValueFileGenerator.kt
@@ -41,4 +41,4 @@
.build()
})
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlFileSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlFileSpec.kt
index 19ea909..ed51fbb 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlFileSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlFileSpec.kt
@@ -36,4 +36,4 @@
add(innerContent)
}.joinToString(separator = "\n\n")
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlInterfaceSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlInterfaceSpec.kt
index b166ba3..133c51a 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlInterfaceSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlInterfaceSpec.kt
@@ -73,4 +73,4 @@
fun build() = AidlInterfaceSpec(type, methods)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlMethodSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlMethodSpec.kt
index edac2d2..5dc0dda 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlMethodSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlMethodSpec.kt
@@ -85,4 +85,4 @@
// This method must remain backwards-compatible to ensure SDK compatibility.
private fun AidlTypeSpec.signature(): String =
- innerType.qualifiedName + (if (isList) "[]" else "")
\ No newline at end of file
+ innerType.qualifiedName + (if (isList) "[]" else "")
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParameterSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParameterSpec.kt
index 39fb6a6..c550772 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParameterSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParameterSpec.kt
@@ -23,4 +23,4 @@
) {
override fun toString() = "${if (isIn) "in " else ""}$type $name"
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParcelableSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParcelableSpec.kt
index 94906d5..3fff06c 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParcelableSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlParcelableSpec.kt
@@ -62,4 +62,4 @@
fun build() = AidlParcelableSpec(type, properties)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlPropertySpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlPropertySpec.kt
index b78ad94..cf999dd 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlPropertySpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlPropertySpec.kt
@@ -22,4 +22,4 @@
val isNullable: Boolean = false,
) {
override fun toString() = "${if (isNullable) "@nullable(heap=true) " else ""}$type $name;"
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlTypeSpec.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlTypeSpec.kt
index 4aeb180..25c4c15 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlTypeSpec.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/generator/poet/AidlTypeSpec.kt
@@ -42,4 +42,4 @@
val requiresImport = kind != AidlTypeKind.PRIMITIVE
val isParcelable = kind == AidlTypeKind.PARCELABLE
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/AnnotatedInterface.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/AnnotatedInterface.kt
index dc289c6..b88e754 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/AnnotatedInterface.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/AnnotatedInterface.kt
@@ -28,4 +28,4 @@
val methods: List<Method> = emptyList(),
) {
val inheritsSandboxedUiAdapter = superTypes.contains(Types.sandboxedUiAdapter)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Method.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Method.kt
index f53bdd7..7c41509 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Method.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Method.kt
@@ -21,4 +21,4 @@
val parameters: List<Parameter>,
val returnType: Type,
val isSuspend: Boolean,
-)
\ No newline at end of file
+)
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Models.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Models.kt
index 15d0e4b..afc79843 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Models.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Models.kt
@@ -85,4 +85,4 @@
return copy(isNullable = false)
return this
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Parameter.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Parameter.kt
index 0d52aa9..625d41c 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Parameter.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Parameter.kt
@@ -19,4 +19,4 @@
data class Parameter(
val name: String,
val type: Type,
-)
\ No newline at end of file
+)
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Type.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Type.kt
index 843127b..70bf1b0 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Type.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/model/Type.kt
@@ -29,4 +29,4 @@
}
return "$packageName.$simpleName"
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/validator/ModelValidator.kt b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/validator/ModelValidator.kt
index 2d75370..86a0127 100644
--- a/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/validator/ModelValidator.kt
+++ b/privacysandbox/tools/tools-core/src/main/java/androidx/privacysandbox/tools/core/validator/ModelValidator.kt
@@ -188,4 +188,4 @@
data class ValidationResult(val errors: List<String>) {
val isSuccess = errors.isEmpty()
val isFailure = !isSuccess
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlCallbackGeneratorTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlCallbackGeneratorTest.kt
index 60fdadb..c371493 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlCallbackGeneratorTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlCallbackGeneratorTest.kt
@@ -81,4 +81,4 @@
Truth.assertThat(aidlGeneratedSources.map { it.relativePath to it.content })
.containsExactlyElementsIn(expectedSources)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlInterfaceGeneratorTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlInterfaceGeneratorTest.kt
index a536da8..e3d1714 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlInterfaceGeneratorTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlInterfaceGeneratorTest.kt
@@ -103,4 +103,4 @@
assertThat(aidlGeneratedSources.map { it.relativePath to it.content })
.containsExactlyElementsIn(expectedSources)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlServiceGeneratorTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlServiceGeneratorTest.kt
index 32fd000..b437088 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlServiceGeneratorTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlServiceGeneratorTest.kt
@@ -100,4 +100,4 @@
assertThat(aidlGeneratedSources.map { it.relativePath to it.content })
.containsExactlyElementsIn(expectedSources)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlTestHelper.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlTestHelper.kt
index e3aa546..6c47c92 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlTestHelper.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/AidlTestHelper.kt
@@ -58,4 +58,4 @@
data class AidlGenerationOutput(
val aidlSources: List<AidlSource>,
val javaSources: List<GeneratedSource>,
-)
\ No newline at end of file
+)
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverterTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverterTest.kt
index 6838c85..8215aae 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverterTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ClientBinderCodeConverterTest.kt
@@ -75,4 +75,4 @@
).toString()
).isEqualTo("com.mysdk.CallbackClientProxy(callback, context)")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/FrameworkAidlFallbackTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/FrameworkAidlFallbackTest.kt
index d544d519..15f4570 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/FrameworkAidlFallbackTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/FrameworkAidlFallbackTest.kt
@@ -41,4 +41,4 @@
AidlServiceGeneratorTest().generate()
AidlValueGeneratorTest().generate()
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverterTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverterTest.kt
index 233528d..e0cdf51 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverterTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/generator/ServerBinderCodeConverterTest.kt
@@ -75,4 +75,4 @@
).toString()
).isEqualTo("com.mysdk.CallbackStubDelegate(callback)")
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/validator/ModelValidatorTest.kt b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/validator/ModelValidatorTest.kt
index 4c7181a..55c23cc 100644
--- a/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/validator/ModelValidatorTest.kt
+++ b/privacysandbox/tools/tools-core/src/test/java/androidx/privacysandbox/tools/core/validator/ModelValidatorTest.kt
@@ -396,4 +396,4 @@
"parameter types."
)
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/AbstractDiffTest.kt b/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/AbstractDiffTest.kt
index 6f1a95d..7c71899 100644
--- a/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/AbstractDiffTest.kt
+++ b/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/AbstractDiffTest.kt
@@ -87,4 +87,4 @@
"test_output_dir not set for diff test."
}.let { Path(it).resolve(subdirectoryName) }
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/TestEnvironment.kt b/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/TestEnvironment.kt
index 2a65ddd..6fc122f 100644
--- a/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/TestEnvironment.kt
+++ b/privacysandbox/tools/tools-testing/src/main/java/androidx/privacysandbox/tools/testing/TestEnvironment.kt
@@ -26,4 +26,4 @@
val frameworkAidlPath = requireNotNull(System.getProperty("framework_aidl_path")) {
"framework_aidl_path flag not set."
}.let(::Path)
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxCallback.kt b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxCallback.kt
index ea4c5e2..606914e 100644
--- a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxCallback.kt
+++ b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxCallback.kt
@@ -38,4 +38,4 @@
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
-public annotation class PrivacySandboxCallback
\ No newline at end of file
+public annotation class PrivacySandboxCallback
diff --git a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxInterface.kt b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxInterface.kt
index 1971378..618796a 100644
--- a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxInterface.kt
+++ b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxInterface.kt
@@ -57,4 +57,4 @@
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
-public annotation class PrivacySandboxInterface
\ No newline at end of file
+public annotation class PrivacySandboxInterface
diff --git a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxService.kt b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxService.kt
index 02a9792..c458af4 100644
--- a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxService.kt
+++ b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/PrivacySandboxService.kt
@@ -54,4 +54,4 @@
*/
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
-public annotation class PrivacySandboxService
\ No newline at end of file
+public annotation class PrivacySandboxService
diff --git a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/internal/GeneratedPublicApi.kt b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/internal/GeneratedPublicApi.kt
index 71e15e1..98f8cf8 100644
--- a/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/internal/GeneratedPublicApi.kt
+++ b/privacysandbox/tools/tools/src/main/java/androidx/privacysandbox/tools/internal/GeneratedPublicApi.kt
@@ -31,4 +31,4 @@
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-public annotation class GeneratedPublicApi
\ No newline at end of file
+public annotation class GeneratedPublicApi
diff --git a/privacysandbox/ui/integration-tests/testaidl/src/main/aidl/androidx/privacysandbox/ui/integration/testaidl/ISdkApi.aidl b/privacysandbox/ui/integration-tests/testaidl/src/main/aidl/androidx/privacysandbox/ui/integration/testaidl/ISdkApi.aidl
index 8290cd0..b1bec88 100644
--- a/privacysandbox/ui/integration-tests/testaidl/src/main/aidl/androidx/privacysandbox/ui/integration/testaidl/ISdkApi.aidl
+++ b/privacysandbox/ui/integration-tests/testaidl/src/main/aidl/androidx/privacysandbox/ui/integration/testaidl/ISdkApi.aidl
@@ -19,5 +19,5 @@
import android.os.Bundle;
interface ISdkApi {
- Bundle loadAd(boolean isWebView);
+ Bundle loadAd(boolean isWebView, String text);
}
diff --git a/privacysandbox/ui/integration-tests/testapp/src/main/java/androidx/privacysandbox/ui/integration/testapp/MainActivity.kt b/privacysandbox/ui/integration-tests/testapp/src/main/java/androidx/privacysandbox/ui/integration/testapp/MainActivity.kt
index 2598fc9..b719f23 100644
--- a/privacysandbox/ui/integration-tests/testapp/src/main/java/androidx/privacysandbox/ui/integration/testapp/MainActivity.kt
+++ b/privacysandbox/ui/integration-tests/testapp/src/main/java/androidx/privacysandbox/ui/integration/testapp/MainActivity.kt
@@ -20,6 +20,7 @@
import android.os.ext.SdkExtensions
import android.util.Log
import android.view.ViewGroup
+import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.RequiresExtension
@@ -43,6 +44,8 @@
private lateinit var mSandboxedSdkView1: SandboxedSdkView
private lateinit var mSandboxedSdkView2: SandboxedSdkView
+ private lateinit var mSandboxedSdkView3: SandboxedSdkView
+ private lateinit var mNewAdButton: Button
// TODO(b/257429573): Remove this line once fixed.
@RequiresExtension(extension = SdkExtensions.AD_SERVICES, version = 5)
@@ -73,7 +76,7 @@
mSandboxedSdkView1 = findViewById(R.id.rendered_view)
mSandboxedSdkView1.addStateChangedListener(StateChangeListener(mSandboxedSdkView1))
mSandboxedSdkView1.setAdapter(SandboxedUiAdapterFactory.createFromCoreLibInfo(
- sdkApi.loadAd(/*isWebView=*/ true)
+ sdkApi.loadAd(/*isWebView=*/ true, "")
))
mSandboxedSdkView2 = SandboxedSdkView(this@MainActivity)
@@ -83,8 +86,19 @@
findViewById<LinearLayout>(R.id.ad_layout).addView(mSandboxedSdkView2)
}
mSandboxedSdkView2.setAdapter(SandboxedUiAdapterFactory.createFromCoreLibInfo(
- sdkApi.loadAd(/*isWebView=*/ false)
+ sdkApi.loadAd(/*isWebView=*/ false, "Hey!")
))
+
+ mSandboxedSdkView3 = findViewById(R.id.new_ad_view)
+ mSandboxedSdkView3.addStateChangedListener(StateChangeListener(mSandboxedSdkView3))
+
+ mNewAdButton = findViewById(R.id.new_ad_button)
+ var count = 1
+ mNewAdButton.setOnClickListener {
+ mSandboxedSdkView3.setAdapter(SandboxedUiAdapterFactory.createFromCoreLibInfo(
+ sdkApi.loadAd(/*isWebView=*/ false, "Hey #$count")))
+ count++
+ }
}
private inner class StateChangeListener(val view: SandboxedSdkView) :
diff --git a/privacysandbox/ui/integration-tests/testapp/src/main/res/layout/activity_main.xml b/privacysandbox/ui/integration-tests/testapp/src/main/res/layout/activity_main.xml
index 26e56df..f071c2a 100644
--- a/privacysandbox/ui/integration-tests/testapp/src/main/res/layout/activity_main.xml
+++ b/privacysandbox/ui/integration-tests/testapp/src/main/res/layout/activity_main.xml
@@ -46,5 +46,31 @@
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:layout_height="400dp" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <androidx.privacysandbox.ui.client.view.SandboxedSdkView
+ android:id="@+id/new_ad_view"
+ android:layout_width="150dp"
+ android:layout_height="150dp"
+ android:layout_marginBottom="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="16dp"
+ android:background="#FFFF00" />
+
+ <Button
+ android:id="@+id/new_ad_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="new_ad"
+ android:textAllCaps="false" />
+ />
+ </LinearLayout>
+
+
+
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/privacysandbox/ui/integration-tests/testsdkprovider/src/main/java/androidx/privacysandbox/ui/integration/testsdkprovider/SdkApi.kt b/privacysandbox/ui/integration-tests/testsdkprovider/src/main/java/androidx/privacysandbox/ui/integration/testsdkprovider/SdkApi.kt
index 2287d4a..c855ee2 100644
--- a/privacysandbox/ui/integration-tests/testsdkprovider/src/main/java/androidx/privacysandbox/ui/integration/testsdkprovider/SdkApi.kt
+++ b/privacysandbox/ui/integration-tests/testsdkprovider/src/main/java/androidx/privacysandbox/ui/integration/testsdkprovider/SdkApi.kt
@@ -41,8 +41,8 @@
mContext = sdkContext
}
- override fun loadAd(isWebView: Boolean): Bundle {
- return BannerAd(isWebView).toCoreLibInfo(mContext!!)
+ override fun loadAd(isWebView: Boolean, text: String): Bundle {
+ return BannerAd(isWebView, text).toCoreLibInfo(mContext!!)
}
private fun isAirplaneModeOn(): Boolean {
@@ -50,7 +50,8 @@
mContext?.contentResolver, Settings.Global.AIRPLANE_MODE_ON, 0) != 0
}
- private inner class BannerAd(private val isWebView: Boolean) : SandboxedUiAdapter {
+ private inner class BannerAd(private val isWebView: Boolean, private val text: String) :
+ SandboxedUiAdapter {
override fun openSession(
context: Context,
initialWidth: Int,
@@ -76,7 +77,7 @@
)
adView = webView
} else {
- adView = TestView(context)
+ adView = TestView(context, text)
}
clientExecutor.execute {
client.onSessionOpened(BannerAdSession(adView))
@@ -106,7 +107,8 @@
}
}
- private inner class TestView(context: Context) : View(context) {
+ private inner class TestView(context: Context, private val text: String) : View(context) {
+
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
@@ -115,7 +117,8 @@
canvas.drawColor(
Color.rgb((0..255).random(), (0..255).random(), (0..255).random())
)
- canvas.drawText("Hey", 75F, 75F, paint)
+
+ canvas.drawText(text, 75F, 75F, paint)
setOnClickListener {
Log.i(TAG, "Click on ad detected")
diff --git a/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/CreateSdkActivityLauncherTest.kt b/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/CreateSdkActivityLauncherTest.kt
index 3b50998..55c5a54 100644
--- a/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/CreateSdkActivityLauncherTest.kt
+++ b/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/CreateSdkActivityLauncherTest.kt
@@ -128,4 +128,4 @@
assertThat(result).isFalse()
intended(sdkSandboxActivityMatcher, times(0))
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/SdkActivityLaunchers.kt b/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/SdkActivityLaunchers.kt
index 2d4e082..d8a6f94 100644
--- a/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/SdkActivityLaunchers.kt
+++ b/privacysandbox/ui/ui-client/src/main/java/androidx/privacysandbox/ui/client/SdkActivityLaunchers.kt
@@ -160,4 +160,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/ProtocolConstants.kt b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/ProtocolConstants.kt
index 5bff1c9..f46c1a2 100644
--- a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/ProtocolConstants.kt
+++ b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/ProtocolConstants.kt
@@ -28,4 +28,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
object ProtocolConstants {
const val sdkActivityLauncherBinderKey = "sdkActivityLauncherBinderKey"
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkActivityLauncher.kt b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkActivityLauncher.kt
index edd3008..9134f7e 100644
--- a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkActivityLauncher.kt
+++ b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkActivityLauncher.kt
@@ -42,4 +42,4 @@
* reason.
*/
suspend fun launchSdkActivity(sdkActivityHandlerToken: IBinder): Boolean
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkRuntimeUiLibVersions.kt b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkRuntimeUiLibVersions.kt
index 0a68ce9..be664d5 100644
--- a/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkRuntimeUiLibVersions.kt
+++ b/privacysandbox/ui/ui-core/src/main/java/androidx/privacysandbox/ui/core/SdkRuntimeUiLibVersions.kt
@@ -24,4 +24,4 @@
set
const val apiVersion: Int = 1
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/BinderAdapterDelegate.kt b/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/BinderAdapterDelegate.kt
index 4f7d04e..9163257 100644
--- a/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/BinderAdapterDelegate.kt
+++ b/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/BinderAdapterDelegate.kt
@@ -146,9 +146,12 @@
}
override fun close() {
- session.close()
- surfaceControlViewHost.release()
+ val mHandler = Handler(Looper.getMainLooper())
+ mHandler.post {
+ session.close()
+ surfaceControlViewHost.release()
+ }
}
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/SdkActivityLauncherFactory.kt b/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/SdkActivityLauncherFactory.kt
index 9d73f49..5e72d7a 100644
--- a/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/SdkActivityLauncherFactory.kt
+++ b/privacysandbox/ui/ui-provider/src/main/java/androidx/privacysandbox/ui/provider/SdkActivityLauncherFactory.kt
@@ -67,4 +67,4 @@
})
}
}
-}
\ No newline at end of file
+}
diff --git a/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/activity/SdkActivityLauncherBundlingTest.kt b/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/activity/SdkActivityLauncherBundlingTest.kt
index 6971f7c..66fdcdf 100644
--- a/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/activity/SdkActivityLauncherBundlingTest.kt
+++ b/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/activity/SdkActivityLauncherBundlingTest.kt
@@ -70,4 +70,4 @@
return allowActivityLaunches
}
}
-}
\ No newline at end of file
+}
diff --git a/profileinstaller/integration-tests/init-macrobenchmark/src/main/java/androidx/profileinstaller/integration/macrobenchmark/ProfileinstallerStartupBenchmark.kt b/profileinstaller/integration-tests/init-macrobenchmark/src/main/java/androidx/profileinstaller/integration/macrobenchmark/ProfileinstallerStartupBenchmark.kt
index 83d0a926..67edd72 100644
--- a/profileinstaller/integration-tests/init-macrobenchmark/src/main/java/androidx/profileinstaller/integration/macrobenchmark/ProfileinstallerStartupBenchmark.kt
+++ b/profileinstaller/integration-tests/init-macrobenchmark/src/main/java/androidx/profileinstaller/integration/macrobenchmark/ProfileinstallerStartupBenchmark.kt
@@ -50,4 +50,4 @@
@JvmStatic
fun parameters() = createStartupCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/ProfileVerificationOnUnsupportedApiVersions.kt b/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/ProfileVerificationOnUnsupportedApiVersions.kt
index 6e3fae7..817d4a4 100644
--- a/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/ProfileVerificationOnUnsupportedApiVersions.kt
+++ b/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/ProfileVerificationOnUnsupportedApiVersions.kt
@@ -66,4 +66,4 @@
hasCurrentProfile(false)
}
}
-}
\ No newline at end of file
+}
diff --git a/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/TestManager.kt b/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/TestManager.kt
index 8757017..211f83e 100644
--- a/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/TestManager.kt
+++ b/profileinstaller/integration-tests/profile-verification/src/androidTest/java/androidx/profileinstaller/integration/profileverification/TestManager.kt
@@ -321,4 +321,4 @@
const val APK_WITH_INITIALIZER_V3 = "profile-verification-sample-v3-release.apk"
const val APK_WITHOUT_INITIALIZER_V1 = "profile-verification-sample-no-initializer-v1-release.apk"
const val APK_WITHOUT_INITIALIZER_V2 = "profile-verification-sample-no-initializer-v2-release.apk"
-const val APK_WITHOUT_INITIALIZER_V3 = "profile-verification-sample-no-initializer-v3-release.apk"
\ No newline at end of file
+const val APK_WITHOUT_INITIALIZER_V3 = "profile-verification-sample-no-initializer-v3-release.apk"
diff --git a/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/DeviceProfileWriter.java b/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/DeviceProfileWriter.java
index 8b47bcd..69702a7 100644
--- a/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/DeviceProfileWriter.java
+++ b/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/DeviceProfileWriter.java
@@ -35,7 +35,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
import java.util.concurrent.Executor;
/**
@@ -342,7 +343,6 @@
* Write the transcoded profile generated by transcodeIfNeeded()
*
* This method will always clear the profile, and may only be called once.
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public boolean write() {
@@ -353,9 +353,17 @@
assertDeviceAllowsProfileInstallerAotWritesCalled();
try (
InputStream bis = new ByteArrayInputStream(transcodedProfile);
- OutputStream os = new FileOutputStream(mCurProfile)
+ FileOutputStream os = new FileOutputStream(mCurProfile);
+ FileChannel channel = os.getChannel();
+ // Acquire a lock to avoid racing with the Android Runtime
+ // when saving the contents of the profile.
+
+ // The documentation suggests that these locks are VM wide, however, the underlying
+ // implementation in libcore (https://cs.android.com/android/platform/superproject/+/main:libcore/ojluni/src/main/native/FileDispatcherImpl.c;l=217;drc=e9cc931d70205df4e7dcc601729707bc7367c081)
+ // ensures that this is OS wide.
+ FileLock lock = channel.tryLock()
) {
- Encoding.writeAll(bis, os);
+ Encoding.writeAll(bis, os, lock);
result(ProfileInstaller.RESULT_INSTALL_SUCCESS, null);
return true;
} catch (FileNotFoundException e) {
diff --git a/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/Encoding.java b/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/Encoding.java
index 91d47bb..24b1814 100644
--- a/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/Encoding.java
+++ b/profileinstaller/profileinstaller/src/main/java/androidx/profileinstaller/Encoding.java
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.channels.FileLock;
import java.nio.charset.StandardCharsets;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
@@ -184,7 +185,14 @@
return out.toByteArray();
}
- static void writeAll(@NonNull InputStream is, @NonNull OutputStream os) throws IOException {
+ static void writeAll(@NonNull InputStream is,
+ @NonNull OutputStream os,
+ @Nullable FileLock lock) throws IOException {
+
+ boolean isValid = lock != null && lock.isValid();
+ if (!isValid) {
+ throw new IOException("Unable to acquire a lock on the underlying file channel.");
+ }
byte[] buf = new byte[512];
int length;
while ((length = is.read(buf)) > 0) {
diff --git a/recyclerview/recyclerview-benchmark/src/androidTest/java/androidx/recyclerview/benchmark/DiffBenchmark.kt b/recyclerview/recyclerview-benchmark/src/androidTest/java/androidx/recyclerview/benchmark/DiffBenchmark.kt
index 1f997a5..ebec416 100644
--- a/recyclerview/recyclerview-benchmark/src/androidTest/java/androidx/recyclerview/benchmark/DiffBenchmark.kt
+++ b/recyclerview/recyclerview-benchmark/src/androidTest/java/androidx/recyclerview/benchmark/DiffBenchmark.kt
@@ -140,4 +140,4 @@
"_detectMoves_$detectMoves" +
"_size_[${before.size}_${after.size}]"
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/StableIdKeyProvider.java b/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/StableIdKeyProvider.java
index f1a2af7..3d6bdb3 100644
--- a/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/StableIdKeyProvider.java
+++ b/recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/StableIdKeyProvider.java
@@ -151,7 +151,7 @@
* A wrapper interface for RecyclerView allowing for easy unit testing.
*/
interface ViewHost {
- /** Registers View{Holder} lifecycle event listener. **/
+ /** Registers View{Holder} lifecycle event listener. */
void registerLifecycleListener(@NonNull LifecycleListener listener);
/**
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/test/TestRunner.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/test/TestRunner.kt
index 05f598a..7cd0f62 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/test/TestRunner.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/test/TestRunner.kt
@@ -30,4 +30,4 @@
RecyclerView.setDebugAssertionsEnabled(false)
super.onDestroy()
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseSnapHelperCenterTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseSnapHelperCenterTest.kt
index eac39fc..4b246eb 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseSnapHelperCenterTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/BaseSnapHelperCenterTest.kt
@@ -181,4 +181,4 @@
override fun getItemCount() = itemCount
}
-private class TestViewHolder constructor(itemView: View) : RecyclerView.ViewHolder(itemView)
\ No newline at end of file
+private class TestViewHolder constructor(itemView: View) : RecyclerView.ViewHolder(itemView)
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterSubject.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterSubject.kt
index e18b094..014e3e9 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterSubject.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterSubject.kt
@@ -153,4 +153,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterTest.kt
index 89330ac..2f1a212 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/ConcatAdapterTest.kt
@@ -1782,4 +1782,4 @@
bindingAdapterPosition = viewHolder.bindingAdapterPosition
)
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerTest.java
index efca5df..1200b29 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerTest.java
@@ -19,8 +19,6 @@
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_ACCESSIBILITY_FOCUS;
-import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_IN_DIRECTION;
import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_TO_POSITION;
import static androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL;
import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
@@ -35,25 +33,20 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import android.accessibilityservice.AccessibilityServiceInfo;
-import android.app.UiAutomation;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.Bundle;
-import android.util.Pair;
import android.util.SparseIntArray;
import android.util.StateSet;
import android.view.View;
import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.GridView;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.annotation.RequiresApi;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.test.annotation.UiThreadTest;
@@ -69,7 +62,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
@LargeTest
@@ -78,8 +70,6 @@
private static final int[] SPAN_SIZES = new int[]{1, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2};
- private static final int DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS = 5000;
-
private final GridLayoutManager.SpanSizeLookup mSpanSizeLookupForSpanIndexTest =
new GridLayoutManager.SpanSizeLookup() {
@Override
@@ -1162,883 +1152,6 @@
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_IN_DIRECTION);
}
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_withoutSpecifyingDirection()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- final boolean[] returnValue = {false};
- mActivityRule.runOnUiThread(
- () -> {
- returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
- ACTION_SCROLL_IN_DIRECTION.getId(), null);
- });
- assertThat(returnValue[0]).isFalse();
- assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(-1);
- assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(-1);
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_withInvalidDirection()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndFail(-1, Pair.create(-1, -1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_withoutSettingAccessibilityFocus()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- // Return value of this call is not used.
- setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
- runScrollInDirectionAndFail(View.FOCUS_RIGHT, Pair.create(-1, -1));
-
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_vertical_scrollTargetOnTheSameRow()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (3)",
- Pair.create(0, 2));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_vertical_scrollTargetOnTheNextRow()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4 5
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)",
- Pair.create(1, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_vertical_traversingThroughASpan()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- mRecyclerView = setupBasic(new Config(4, 4));
- mGlm.setOrientation(VERTICAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 1) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 2 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (2)" ,
- Pair.create(0, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (3)" ,
- Pair.create(0, 3));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_vertical_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4 5
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
- runScrollInDirectionAndFail(View.FOCUS_RIGHT, Pair.create(1, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_horizontal_scrollTargetOnTheSameRow()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)" ,
- Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_horizontal_traversingThroughASpan()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 4) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 4 6
- 2 5 7
- 3 5 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (5)" ,
- Pair.create(2, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (8)" ,
- Pair.create(2, 2));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_horizontal_withWrapAround()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 0) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 3 6
- 1 4 7
- 2 5 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (1)" ,
- Pair.create(1, 0));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)" ,
- Pair.create(1, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusRight_horizontal_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndFail(View.FOCUS_RIGHT);
- assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(2);
- assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(0);
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_vertical_scrollTargetOnTheSameRow()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (1)",
- Pair.create(0, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_vertical_scrollTargetOnAPreviousRow()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4 5
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (3)",
- Pair.create(0, 2));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_vertical_traversingThroughASpan()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(4, VERTICAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 1) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 2 2
- 3 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (2)",
- Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_vertical_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4 5
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndFail(View.FOCUS_LEFT, Pair.create(0, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_horizontal_scrollTargetOnTheSameRow()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (2)" ,
- Pair.create(1, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_horizontal_traversingThroughASpan()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 4) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 4 6
- 2 5 7
- 3 5 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(7));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (5)" ,
- Pair.create(2, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (3)" ,
- Pair.create(2, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_horizontal_withWrapAround()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 6) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 4 7
- 2 5 7
- 3 6 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (7)" ,
- Pair.create(1, 2));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (5)" ,
- Pair.create(1, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusLeft_horizontal_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndFail(View.FOCUS_LEFT, Pair.create(0, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_vertical_scrollTargetOnTheSameColumn()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (1)",
- Pair.create(0, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_vertical_traversingThroughASpan()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- mRecyclerView = setupBasic(new Config(3, 8));
- mGlm.setOrientation(VERTICAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 3) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 2 3
- 4 4 5
- 6 7 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (4)" ,
- Pair.create(1, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (2)" ,
- Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_vertical_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndFail(View.FOCUS_UP, Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_horizontal_scrollTargetOnTheSameColumn()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (1)" ,
- Pair.create(0, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_horizontal_traversingThroughASpan()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- mRecyclerView = setupBasic(new Config(4, 9));
- mGlm.setOrientation(HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 5) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 5 8
- 2 6 9
- 3 6
- 4 7
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (6)" ,
- Pair.create(2, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (5)" ,
- Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusUp_horizontal_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndFail(View.FOCUS_UP, Pair.create(0, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_vertical_scrollTargetOnTheSameColumn()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (4)", Pair.create(1,
- 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_vertical_traversingThroughASpan()
- throws Throwable {
-
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- mRecyclerView = setupBasic(new Config(3, 8));
- mGlm.setOrientation(VERTICAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 3) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 2 3
- 4 4 5
- 6 7 8
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (4)" ,
- Pair.create(1, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (7)" ,
- Pair.create(2, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_vertical_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android version.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
- /*
- This generates the following grid:
- 1 2 3
- 4
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(0, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
- runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(1, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_horizontal_scrollTargetOnTheSameColumn()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (3)" ,
- Pair.create(2, 0));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_horizontal_traversingThroughASpan()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- mRecyclerView = setupBasic(new Config(4, 9));
- mGlm.setOrientation(HORIZONTAL);
- mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
- @Override
- public int getSpanSize(int position) {
- if (position == 5) {
- return 2;
- }
- return 1;
- }
- });
- waitForFirstLayout(mRecyclerView);
- /*
- This generates the following grid:
- 1 5 8
- 2 6 9
- 3 6
- 4 7
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (6)" ,
- Pair.create(1, 1));
-
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
- runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (7)" ,
- Pair.create(3, 1));
- }
-
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- public void performActionScrollInDirection_focusDown_horizontal_withoutAvailableTarget()
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
- /*
- This generates the following grid:
- 1 4
- 2 5
- 3
- */
- setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
- runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(2, 0));
- }
-
- /**
- * Verifies that a scroll successfully occurs in the specified {@code direction}.
- *
- * @param uiAutomation UiAutomation instance.
- * @param direction The direction of the scroll.
- * @param scrollTargetText The text of the view targeted by the scroll.
- * @throws TimeoutException Exception thrown when an action times out.
- */
- @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- private void runScrollInDirectionAndSucceed(UiAutomation uiAutomation, int direction,
- String scrollTargetText)
- throws TimeoutException {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final boolean[] returnValue = {false};
- AccessibilityEvent awaitedEvent = uiAutomation.executeAndWaitForEvent(
- () -> mActivityRule.runOnUiThread(() -> {
- returnValue[0] =
- mRecyclerView.getLayoutManager().performAccessibilityAction(
- ACTION_SCROLL_IN_DIRECTION.getId(),
- bundleWithDirectionArg(direction));
- }),
- event -> event.getEventType() == AccessibilityEvent.TYPE_VIEW_TARGETED_BY_SCROLL,
- DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS);
-
- assertThat(scrollTargetText).isEqualTo(awaitedEvent.getSource().getText());
- assertThat(returnValue[0]).isTrue();
- }
-
- /**
- * Verifies that a scroll successfully occurs in the specified {@code direction} and that the
- * values of {@code mRowIndexForAccessibility} and {@code mColumnIndexForAccessibility} are
- * currectly set.
- *
- * @param uiAutomation UiAutomation instance.
- * @param direction The direction of the scroll.
- * @param scrollTargetText The text of the view targeted by the scroll.
- * @param rowColumn The values for the row and column with accessibility focus.
- *
- * @throws TimeoutException Exception thrown when an action times out.
- */
- @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- private void runScrollInDirectionAndSucceed(UiAutomation uiAutomation, int direction,
- String scrollTargetText, Pair<Integer, Integer> rowColumn)
- throws TimeoutException {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- runScrollInDirectionAndSucceed(uiAutomation, direction, scrollTargetText);
- assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(rowColumn.first);
- assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(rowColumn.second);
- }
-
- /**
- * Verifies that a scroll does not occur in the specified {@code direction}.
- *
- * @param direction The direction of the scroll.
- */
- @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- private void runScrollInDirectionAndFail(int direction) {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final boolean[] returnValue = {false};
-
- mActivityRule.runOnUiThread(
- () -> {
- returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
- ACTION_SCROLL_IN_DIRECTION.getId(), bundleWithDirectionArg(direction));
- });
-
- assertThat(returnValue[0]).isFalse();
- }
-
- /**
- * Verifies that a scroll does not occur in the specified {@code direction}.
- *
- * @param direction The direction of the scroll.
- * @param rowColumn The values for the row and column with accessibility focus.
- */
- @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- private void runScrollInDirectionAndFail(int direction, Pair<Integer, Integer> rowColumn) {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final boolean[] returnValue = {false};
-
- mActivityRule.runOnUiThread(
- () -> {
- returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
- ACTION_SCROLL_IN_DIRECTION.getId(), bundleWithDirectionArg(direction));
- });
-
- assertThat(returnValue[0]).isFalse();
- assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(rowColumn.first);
- assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(rowColumn.second);
- }
-
- @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
- @NonNull
- private UiAutomation setUpGridLayoutManagerAccessibilityTest(int itemCount, int orientation)
- throws Throwable {
- // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
- // earlier android versions.
-
- final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
- setUpRecyclerViewAndGridLayoutManager(itemCount, orientation);
- waitForFirstLayout(mRecyclerView);
- return uiAutomation;
- }
-
- private Bundle bundleWithDirectionArg(int direction) {
- Bundle bundle = new Bundle();
- bundle.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_DIRECTION_INT, direction);
- return bundle;
- }
-
- @NonNull
- @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
- private UiAutomation setUpAndReturnUiAutomation() {
- UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
- final AccessibilityServiceInfo info = uiAutomation.getServiceInfo();
- info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE;
- uiAutomation.setServiceInfo(info);
- return uiAutomation;
- }
-
- private void setAccessibilityFocus(UiAutomation uiAutomation, View source)
- throws TimeoutException {
- AccessibilityEvent awaitedEvent = null;
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- awaitedEvent = uiAutomation.executeAndWaitForEvent(
- () -> {
- try {
- mActivityRule.runOnUiThread(() -> source.performAccessibilityAction(
- ACTION_ACCESSIBILITY_FOCUS.getId(), null));
- } catch (Throwable throwable) {
- throwable.printStackTrace();
- }
- },
- event -> event.getEventType()
- == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED,
- DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS);
- assertThat(awaitedEvent.getSource().isAccessibilityFocused()).isTrue();
- }
- }
-
- private void setUpRecyclerViewAndGridLayoutManager(int itemCount, int orientation)
- throws Throwable {
- mRecyclerView = setupBasic(new Config(3, itemCount));
- mGlm.setOrientation(orientation);
- }
-
public GridLayoutManager.LayoutParams ensureGridLp(View view) {
ViewGroup.LayoutParams lp = view.getLayoutParams();
GridLayoutManager.LayoutParams glp;
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerUiAutomationTests.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerUiAutomationTests.java
new file mode 100644
index 0000000..9349121
--- /dev/null
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/GridLayoutManagerUiAutomationTests.java
@@ -0,0 +1,927 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.recyclerview.widget;
+
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_ACCESSIBILITY_FOCUS;
+import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_IN_DIRECTION;
+import static androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL;
+import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.UiAutomation;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Pair;
+import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SdkSuppress;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.TimeoutException;
+
+@LargeTest
+@RunWith(AndroidJUnit4.class)
+@SdkSuppress(minSdkVersion = 18)
+public class GridLayoutManagerUiAutomationTests extends BaseGridLayoutManagerTest {
+
+ private static final int DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS = 5000;
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_withoutSpecifyingDirection()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ final boolean[] returnValue = {false};
+ mActivityRule.runOnUiThread(
+ () -> {
+ returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
+ ACTION_SCROLL_IN_DIRECTION.getId(), null);
+ });
+ assertThat(returnValue[0]).isFalse();
+ assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(-1);
+ assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(-1);
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_withInvalidDirection()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndFail(-1, Pair.create(-1, -1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_withoutSettingAccessibilityFocus()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ // Return value of this call is not used.
+ setUpGridLayoutManagerAccessibilityTest(6, HORIZONTAL);
+ runScrollInDirectionAndFail(View.FOCUS_RIGHT, Pair.create(-1, -1));
+
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_vertical_scrollTargetOnTheSameRow()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (3)",
+ Pair.create(0, 2));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_vertical_scrollTargetOnTheNextRow()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 5
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)",
+ Pair.create(1, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_vertical_traversingThroughASpan()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ mRecyclerView = setupBasic(new Config(4, 4));
+ mGlm.setOrientation(VERTICAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 1) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 2 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (2)" ,
+ Pair.create(0, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (3)" ,
+ Pair.create(0, 3));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_vertical_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 5
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
+ runScrollInDirectionAndFail(View.FOCUS_RIGHT, Pair.create(1, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_horizontal_scrollTargetOnTheSameRow()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)" ,
+ Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_horizontal_traversingThroughASpan()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 4) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 4 6
+ 2 5 7
+ 3 5 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (5)" ,
+ Pair.create(2, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (8)" ,
+ Pair.create(2, 2));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_horizontal_withWrapAround()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 0) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 3 6
+ 1 4 7
+ 2 5 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (1)" ,
+ Pair.create(1, 0));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_RIGHT, "Item (4)" ,
+ Pair.create(1, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusRight_horizontal_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndFail(View.FOCUS_RIGHT);
+ assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(2);
+ assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(0);
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_vertical_scrollTargetOnTheSameRow()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (1)",
+ Pair.create(0, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_vertical_scrollTargetOnAPreviousRow()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 5
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (3)",
+ Pair.create(0, 2));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_vertical_traversingThroughASpan()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(4, VERTICAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 1) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 2 2
+ 3 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (2)",
+ Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_vertical_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 5
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndFail(View.FOCUS_LEFT, Pair.create(0, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_horizontal_scrollTargetOnTheSameRow()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (2)" ,
+ Pair.create(1, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_horizontal_traversingThroughASpan()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 4) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 4 6
+ 2 5 7
+ 3 5 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(7));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (5)" ,
+ Pair.create(2, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (3)" ,
+ Pair.create(2, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_horizontal_withWrapAround()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(8, HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 6) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 4 7
+ 2 5 7
+ 3 6 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (7)" ,
+ Pair.create(1, 2));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_LEFT, "Item (5)" ,
+ Pair.create(1, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusLeft_horizontal_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndFail(View.FOCUS_LEFT, Pair.create(0, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_vertical_scrollTargetOnTheSameColumn()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (1)",
+ Pair.create(0, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_vertical_traversingThroughASpan()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ mRecyclerView = setupBasic(new Config(3, 8));
+ mGlm.setOrientation(VERTICAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 3) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 4 5
+ 6 7 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (4)" ,
+ Pair.create(1, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (2)" ,
+ Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_vertical_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndFail(View.FOCUS_UP, Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_horizontal_scrollTargetOnTheSameColumn()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (1)" ,
+ Pair.create(0, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_horizontal_traversingThroughASpan()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ mRecyclerView = setupBasic(new Config(4, 9));
+ mGlm.setOrientation(HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 5) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 5 8
+ 2 6 9
+ 3 6
+ 4 7
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(6));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (6)" ,
+ Pair.create(2, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_UP, "Item (5)" ,
+ Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusUp_horizontal_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndFail(View.FOCUS_UP, Pair.create(0, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_vertical_scrollTargetOnTheSameColumn()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(0));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (4)", Pair.create(1,
+ 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_vertical_traversingThroughASpan()
+ throws Throwable {
+
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ mRecyclerView = setupBasic(new Config(3, 8));
+ mGlm.setOrientation(VERTICAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 3) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4 4 5
+ 6 7 8
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (4)" ,
+ Pair.create(1, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (7)" ,
+ Pair.create(2, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_vertical_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android version.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(4, VERTICAL);
+ /*
+ This generates the following grid:
+ 1 2 3
+ 4
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(0, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(3));
+ runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(1, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_horizontal_scrollTargetOnTheSameColumn()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(1));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (3)" ,
+ Pair.create(2, 0));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_horizontal_traversingThroughASpan()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ mRecyclerView = setupBasic(new Config(4, 9));
+ mGlm.setOrientation(HORIZONTAL);
+ mGlm.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
+ @Override
+ public int getSpanSize(int position) {
+ if (position == 5) {
+ return 2;
+ }
+ return 1;
+ }
+ });
+ waitForFirstLayout(mRecyclerView);
+ /*
+ This generates the following grid:
+ 1 5 8
+ 2 6 9
+ 3 6
+ 4 7
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(4));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (6)" ,
+ Pair.create(1, 1));
+
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(5));
+ runScrollInDirectionAndSucceed(uiAutomation, View.FOCUS_DOWN, "Item (7)" ,
+ Pair.create(3, 1));
+ }
+
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public void performActionScrollInDirection_focusDown_horizontal_withoutAvailableTarget()
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpGridLayoutManagerAccessibilityTest(5, HORIZONTAL);
+ /*
+ This generates the following grid:
+ 1 4
+ 2 5
+ 3
+ */
+ setAccessibilityFocus(uiAutomation, mGlm.getChildAt(2));
+ runScrollInDirectionAndFail(View.FOCUS_DOWN, Pair.create(2, 0));
+ }
+
+ /**
+ * Verifies that a scroll successfully occurs in the specified {@code direction}.
+ *
+ * @param uiAutomation UiAutomation instance.
+ * @param direction The direction of the scroll.
+ * @param scrollTargetText The text of the view targeted by the scroll.
+ * @throws TimeoutException Exception thrown when an action times out.
+ */
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ private void runScrollInDirectionAndSucceed(UiAutomation uiAutomation, int direction,
+ String scrollTargetText)
+ throws TimeoutException {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final boolean[] returnValue = {false};
+ AccessibilityEvent awaitedEvent = uiAutomation.executeAndWaitForEvent(
+ () -> mActivityRule.runOnUiThread(() -> {
+ returnValue[0] =
+ mRecyclerView.getLayoutManager().performAccessibilityAction(
+ ACTION_SCROLL_IN_DIRECTION.getId(),
+ bundleWithDirectionArg(direction));
+ }),
+ event -> event.getEventType() == AccessibilityEvent.TYPE_VIEW_TARGETED_BY_SCROLL,
+ DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS);
+
+ assertThat(scrollTargetText).isEqualTo(awaitedEvent.getSource().getText());
+ assertThat(returnValue[0]).isTrue();
+ }
+
+ /**
+ * Verifies that a scroll successfully occurs in the specified {@code direction} and that the
+ * values of {@code mRowIndexForAccessibility} and {@code mColumnIndexForAccessibility} are
+ * currectly set.
+ *
+ * @param uiAutomation UiAutomation instance.
+ * @param direction The direction of the scroll.
+ * @param scrollTargetText The text of the view targeted by the scroll.
+ * @param rowColumn The values for the row and column with accessibility focus.
+ *
+ * @throws TimeoutException Exception thrown when an action times out.
+ */
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ private void runScrollInDirectionAndSucceed(UiAutomation uiAutomation, int direction,
+ String scrollTargetText, Pair<Integer, Integer> rowColumn)
+ throws TimeoutException {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ runScrollInDirectionAndSucceed(uiAutomation, direction, scrollTargetText);
+ assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(rowColumn.first);
+ assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(rowColumn.second);
+ }
+
+ /**
+ * Verifies that a scroll does not occur in the specified {@code direction}.
+ *
+ * @param direction The direction of the scroll.
+ */
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ private void runScrollInDirectionAndFail(int direction) {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final boolean[] returnValue = {false};
+
+ mActivityRule.runOnUiThread(
+ () -> {
+ returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
+ ACTION_SCROLL_IN_DIRECTION.getId(), bundleWithDirectionArg(direction));
+ });
+
+ assertThat(returnValue[0]).isFalse();
+ }
+
+ /**
+ * Verifies that a scroll does not occur in the specified {@code direction}.
+ *
+ * @param direction The direction of the scroll.
+ * @param rowColumn The values for the row and column with accessibility focus.
+ */
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ private void runScrollInDirectionAndFail(int direction, Pair<Integer, Integer> rowColumn) {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final boolean[] returnValue = {false};
+
+ mActivityRule.runOnUiThread(
+ () -> {
+ returnValue[0] = mRecyclerView.getLayoutManager().performAccessibilityAction(
+ ACTION_SCROLL_IN_DIRECTION.getId(), bundleWithDirectionArg(direction));
+ });
+
+ assertThat(returnValue[0]).isFalse();
+ assertThat(mGlm.mRowWithAccessibilityFocus).isEqualTo(rowColumn.first);
+ assertThat(mGlm.mColumnWithAccessibilityFocus).isEqualTo(rowColumn.second);
+ }
+
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ @NonNull
+ private UiAutomation setUpGridLayoutManagerAccessibilityTest(int itemCount, int orientation)
+ throws Throwable {
+ // TODO(b/267511848): suppress to LOLLIPOP once U constants are finalized and available in
+ // earlier android versions.
+
+ final UiAutomation uiAutomation = setUpAndReturnUiAutomation();
+ setUpRecyclerViewAndGridLayoutManager(itemCount, orientation);
+ waitForFirstLayout(mRecyclerView);
+ return uiAutomation;
+ }
+
+ private Bundle bundleWithDirectionArg(int direction) {
+ Bundle bundle = new Bundle();
+ bundle.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_DIRECTION_INT, direction);
+ return bundle;
+ }
+
+ @NonNull
+ @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ private UiAutomation setUpAndReturnUiAutomation() {
+ UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
+ final AccessibilityServiceInfo info = uiAutomation.getServiceInfo();
+ info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE;
+ uiAutomation.setServiceInfo(info);
+ return uiAutomation;
+ }
+
+ private void setAccessibilityFocus(UiAutomation uiAutomation, View source)
+ throws TimeoutException {
+ AccessibilityEvent awaitedEvent = null;
+ awaitedEvent = uiAutomation.executeAndWaitForEvent(
+ () -> {
+ try {
+ mActivityRule.runOnUiThread(() -> source.performAccessibilityAction(
+ ACTION_ACCESSIBILITY_FOCUS.getId(), null));
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ },
+ event -> event.getEventType()
+ == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED,
+ DEFAULT_ACCESSIBILITY_EVENT_TIMEOUT_MILLIS);
+ assertThat(awaitedEvent.getSource().isAccessibilityFocused()).isTrue();
+ }
+
+ private void setUpRecyclerViewAndGridLayoutManager(int itemCount, int orientation)
+ throws Throwable {
+ mRecyclerView = setupBasic(new Config(3, itemCount));
+ mGlm.setOrientation(orientation);
+ }
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LazyStateRestorationTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LazyStateRestorationTest.kt
index 841555c..d00e110 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LazyStateRestorationTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LazyStateRestorationTest.kt
@@ -319,4 +319,4 @@
}
return items
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LinearSnapHelperCenterTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LinearSnapHelperCenterTest.kt
index e05e6c00..a81f9d1 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LinearSnapHelperCenterTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/LinearSnapHelperCenterTest.kt
@@ -38,4 +38,4 @@
clipToPadding
) {
override val snapHelper = LinearSnapHelper()
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/PagerSnapHelperCenterTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/PagerSnapHelperCenterTest.kt
index 1d62973..3c3002c 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/PagerSnapHelperCenterTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/PagerSnapHelperCenterTest.kt
@@ -35,4 +35,4 @@
clipToPadding: Boolean
) : BaseSnapHelperCenterTest(vertical, startPadded, endPadded, clipToPadding) {
override val snapHelper = PagerSnapHelper()
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecycledViewPoolInstrumentedTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecycledViewPoolInstrumentedTest.kt
index 04758c1..5d38966 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecycledViewPoolInstrumentedTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecycledViewPoolInstrumentedTest.kt
@@ -219,4 +219,4 @@
private val RecyclerView.attachCount: Int
get() = this.recycledViewPool.mAttachedAdaptersForPoolingContainer.size
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewKeyEventTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewKeyEventTest.kt
index 45cc5f8..45848e9 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewKeyEventTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewKeyEventTest.kt
@@ -280,4 +280,4 @@
MatcherAssert.assertThat(layoutManager.findFirstCompletelyVisibleItemPosition(),
CoreMatchers.`is`(0))
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewMeasureTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewMeasureTest.kt
index 473da05..dc636f5 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewMeasureTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewMeasureTest.kt
@@ -344,4 +344,4 @@
}
internal class MockViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!)
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewOnItemTouchListenerTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewOnItemTouchListenerTest.kt
index 1fc175c..dc68f07 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewOnItemTouchListenerTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewOnItemTouchListenerTest.kt
@@ -291,4 +291,4 @@
super.onInterceptTouchEvent(ev)
return ev!!.toMotionEventItem() == motionEventItemToStartIntecepting
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewPrefetchTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewPrefetchTest.kt
index 626cb53..4b22f28 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewPrefetchTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewPrefetchTest.kt
@@ -107,4 +107,4 @@
assertThat(cachedViews()[0].absoluteAdapterPosition, `is`(6))
}
}
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewSmoothScrollToPositionTest.kt b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewSmoothScrollToPositionTest.kt
index fcfce45..c3cab50 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewSmoothScrollToPositionTest.kt
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/RecyclerViewSmoothScrollToPositionTest.kt
@@ -218,4 +218,4 @@
}
override fun getItemCount() = numItems
-}
\ No newline at end of file
+}
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StretchEdgeEffectTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StretchEdgeEffectTest.java
index 6a46c9e..7614bf0 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StretchEdgeEffectTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StretchEdgeEffectTest.java
@@ -24,23 +24,29 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
+import android.graphics.Color;
import android.os.Build;
import android.os.SystemClock;
import android.view.MotionEvent;
+import android.view.View;
import android.view.ViewGroup;
import android.widget.EdgeEffect;
+import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.os.BuildCompat;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.MotionEventCompat;
import androidx.core.widget.EdgeEffectCompat;
+import androidx.core.widget.NestedScrollView;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.MediumTest;
import androidx.test.filters.SdkSuppress;
+import androidx.testutils.AnimationDurationScaleRule;
+import androidx.testutils.PollingCheck;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -59,6 +65,10 @@
private TestEdgeEffectFactory mFactory;
private TestAdapter mAdapter;
+ @Rule
+ public final AnimationDurationScaleRule mEnableAnimations =
+ AnimationDurationScaleRule.createForAllTests(1f);
+
@Before
public void setup() throws Throwable {
mLayoutManager = new LinearLayoutManager(getActivity());
@@ -613,56 +623,56 @@
@Test
public void stretchAndAddContentToBottom() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndAddContent(() -> mFactory.mBottom, true, true);
}
}
@Test
public void doubleStretchBottom() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndStretchMore(() -> mFactory.mBottom, true, true);
}
}
@Test
public void stretchAndAddContentToTop() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndAddContent(() -> mFactory.mTop, false, true);
}
}
@Test
public void doubleStretchTop() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndStretchMore(() -> mFactory.mTop, false, true);
}
}
@Test
public void stretchAndAddContentToRight() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndAddContent(() -> mFactory.mRight, true, false);
}
}
@Test
public void doubleStretchRight() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndStretchMore(() -> mFactory.mRight, true, false);
}
}
@Test
public void stretchAndAddContentToLeft() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndAddContent(() -> mFactory.mLeft, false, false);
}
}
@Test
public void doubleStretchLeft() throws Throwable {
- if (BuildCompat.isAtLeastS()) {
+ if (Build.VERSION.SDK_INT >= 31) {
stretchAndStretchMore(() -> mFactory.mLeft, false, false);
}
}
@@ -715,6 +725,34 @@
assertEquals(Build.VERSION.SDK_INT >= 31, mFactory.mRight.mOnReleaseCalled);
}
+ @Test
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.S)
+ public void flingInNestedScroll() throws Throwable {
+ TestActivity activity = mActivityRule.getActivity();
+ NestedScrollView scrollView = new NestedScrollView(activity);
+ // Give the RecyclerView a parent that can scroll
+ mActivityRule.runOnUiThread(() -> {
+ ViewGroup parent = (ViewGroup) mRecyclerView.getParent();
+ int height = parent.getHeight();
+ int width = parent.getWidth();
+ parent.removeView(mRecyclerView);
+ LinearLayout linearLayout = new LinearLayout(activity);
+ linearLayout.setOrientation(LinearLayout.VERTICAL);
+ View view = new View(activity);
+ view.setBackgroundColor(Color.BLUE);
+ linearLayout.addView(view, width, height / 2);
+ linearLayout.addView(mRecyclerView, width, height);
+ scrollView.addView(linearLayout);
+ parent.addView(scrollView);
+ mRecyclerView.setEdgeEffectFactory(new RecyclerView.EdgeEffectFactory());
+ });
+ mActivityRule.runOnUiThread(() -> scrollView.scrollTo(0, scrollView.getHeight() / 2));
+ mActivityRule.runOnUiThread(() -> mRecyclerView.fling(0, 10000));
+ PollingCheck.waitFor(() -> !mRecyclerView.canScrollVertically(1));
+ mActivityRule.runOnUiThread(() -> mRecyclerView.fling(0, -10000));
+ PollingCheck.waitFor(() -> scrollView.getScrollY() == 0);
+ }
+
/**
* When stretching and new items are added, the stretch should be released and
* a drag from the user should scroll instead of changing the stretch.
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSnapHelper.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSnapHelper.java
index 6481b87..09603f2 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSnapHelper.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearSnapHelper.java
@@ -195,7 +195,7 @@
+ (helper.getDecoratedMeasurement(child) / 2);
int absDistance = Math.abs(childCenter - center);
- /** if child center is closer than previous closest, set it as closest **/
+ /** if child center is closer than previous closest, set it as closest */
if (absDistance < absClosest) {
absClosest = absDistance;
closestChild = child;
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
index 8c5c4ea..e0d8f30 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java
@@ -2883,6 +2883,7 @@
if (flingX != 0 || flingY != 0) {
flingX = Math.max(-mMaxFlingVelocity, Math.min(flingX, mMaxFlingVelocity));
flingY = Math.max(-mMaxFlingVelocity, Math.min(flingY, mMaxFlingVelocity));
+ startNestedScrollForType(TYPE_NON_TOUCH);
mViewFlinger.fling(flingX, flingY);
}
if (velocityX == 0 && velocityY == 0) {
@@ -2898,15 +2899,7 @@
}
if (canScroll) {
- int nestedScrollAxis = ViewCompat.SCROLL_AXIS_NONE;
- if (canScrollHorizontal) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_HORIZONTAL;
- }
- if (canScrollVertical) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_VERTICAL;
- }
- startNestedScroll(nestedScrollAxis, TYPE_NON_TOUCH);
-
+ startNestedScrollForType(TYPE_NON_TOUCH);
velocityX = Math.max(-mMaxFlingVelocity, Math.min(velocityX, mMaxFlingVelocity));
velocityY = Math.max(-mMaxFlingVelocity, Math.min(velocityY, mMaxFlingVelocity));
mViewFlinger.fling(velocityX, velocityY);
@@ -2916,6 +2909,19 @@
return false;
}
+ private void startNestedScrollForType(int type) {
+ final boolean canScrollHorizontal = mLayout.canScrollHorizontally();
+ final boolean canScrollVertical = mLayout.canScrollVertically();
+ int nestedScrollAxis = ViewCompat.SCROLL_AXIS_NONE;
+ if (canScrollHorizontal) {
+ nestedScrollAxis |= ViewCompat.SCROLL_AXIS_HORIZONTAL;
+ }
+ if (canScrollVertical) {
+ nestedScrollAxis |= ViewCompat.SCROLL_AXIS_VERTICAL;
+ }
+ startNestedScroll(nestedScrollAxis, type);
+ }
+
/**
* Returns true if edgeEffect should call onAbsorb() with veclocity or false if it should
* animate with a fling. It will animate with a fling if the velocity will remove the
@@ -3730,14 +3736,7 @@
// Clear the nested offsets
mNestedOffsets[0] = mNestedOffsets[1] = 0;
- int nestedScrollAxis = ViewCompat.SCROLL_AXIS_NONE;
- if (canScrollHorizontally) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_HORIZONTAL;
- }
- if (canScrollVertically) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_VERTICAL;
- }
- startNestedScroll(nestedScrollAxis, TYPE_TOUCH);
+ startNestedScrollForType(TYPE_TOUCH);
break;
case MotionEvent.ACTION_POINTER_DOWN:
@@ -3876,14 +3875,7 @@
mInitialTouchX = mLastTouchX = (int) (e.getX() + 0.5f);
mInitialTouchY = mLastTouchY = (int) (e.getY() + 0.5f);
- int nestedScrollAxis = ViewCompat.SCROLL_AXIS_NONE;
- if (canScrollHorizontally) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_HORIZONTAL;
- }
- if (canScrollVertically) {
- nestedScrollAxis |= ViewCompat.SCROLL_AXIS_VERTICAL;
- }
- startNestedScroll(nestedScrollAxis, TYPE_TOUCH);
+ startNestedScrollForType(TYPE_TOUCH);
}
break;
diff --git a/recyclerview/recyclerview/src/test/java/androidx/recyclerview/widget/DiffUtilTest.kt b/recyclerview/recyclerview/src/test/java/androidx/recyclerview/widget/DiffUtilTest.kt
index 7146b50..0e67ac0 100644
--- a/recyclerview/recyclerview/src/test/java/androidx/recyclerview/widget/DiffUtilTest.kt
+++ b/recyclerview/recyclerview/src/test/java/androidx/recyclerview/widget/DiffUtilTest.kt
@@ -734,4 +734,4 @@
companion object {
private val sRand = Random(System.nanoTime())
}
-}
\ No newline at end of file
+}
diff --git a/remotecallback/remotecallback/src/main/AndroidManifest.xml b/remotecallback/remotecallback/src/main/AndroidManifest.xml
index ca8cdb4..5f6ceed 100644
--- a/remotecallback/remotecallback/src/main/AndroidManifest.xml
+++ b/remotecallback/remotecallback/src/main/AndroidManifest.xml
@@ -16,6 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
- <receiver android:name=".ProviderRelayReceiver" />
+ <receiver android:name=".ProviderRelayReceiver" android:exported="false" />
</application>
</manifest>
diff --git a/resourceinspection/resourceinspection-processor/src/main/kotlin/androidx/resourceinspection/processor/InspectionCompanionGeneration.kt b/resourceinspection/resourceinspection-processor/src/main/kotlin/androidx/resourceinspection/processor/InspectionCompanionGeneration.kt
index 40f8dd5..a7bef96 100644
--- a/resourceinspection/resourceinspection-processor/src/main/kotlin/androidx/resourceinspection/processor/InspectionCompanionGeneration.kt
+++ b/resourceinspection/resourceinspection-processor/src/main/kotlin/androidx/resourceinspection/processor/InspectionCompanionGeneration.kt
@@ -243,4 +243,4 @@
"\$T.LIBRARY",
ClassName.get("androidx.annotation", "RestrictTo", "Scope")
)
- .build()
\ No newline at end of file
+ .build()
diff --git a/room/benchmark/src/androidTest/java/androidx/room/benchmark/AmbiguousColumnResolverBenchmark.kt b/room/benchmark/src/androidTest/java/androidx/room/benchmark/AmbiguousColumnResolverBenchmark.kt
index 55c79da..a60af6b 100644
--- a/room/benchmark/src/androidTest/java/androidx/room/benchmark/AmbiguousColumnResolverBenchmark.kt
+++ b/room/benchmark/src/androidTest/java/androidx/room/benchmark/AmbiguousColumnResolverBenchmark.kt
@@ -112,4 +112,4 @@
listOf(2, 4)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/benchmark/src/androidTest/java/androidx/room/benchmark/RelationBenchmark.kt b/room/benchmark/src/androidTest/java/androidx/room/benchmark/RelationBenchmark.kt
index 55b193e..53c9fe0 100644
--- a/room/benchmark/src/androidTest/java/androidx/room/benchmark/RelationBenchmark.kt
+++ b/room/benchmark/src/androidTest/java/androidx/room/benchmark/RelationBenchmark.kt
@@ -127,4 +127,4 @@
@Query("SELECT * FROM User")
fun getUserWithItems(): List<UserWithItems>
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/build.gradle b/room/integration-tests/kotlintestapp/build.gradle
index 1e0b08c..c7a32db 100644
--- a/room/integration-tests/kotlintestapp/build.gradle
+++ b/room/integration-tests/kotlintestapp/build.gradle
@@ -103,7 +103,7 @@
exclude group: "com.android.support", module: "support-annotations"
exclude module: "hamcrest-core"
})
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.kotlinTest)
androidTestImplementation(project(":room:room-guava"))
androidTestImplementation(project(":room:room-testing"))
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/NewThreadDispatcher.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/NewThreadDispatcher.kt
index e61991e..24eb650 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/NewThreadDispatcher.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/NewThreadDispatcher.kt
@@ -42,4 +42,4 @@
block.run()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/RoomTestConfig.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/RoomTestConfig.kt
index fb04b08..a40f9f4 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/RoomTestConfig.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/RoomTestConfig.kt
@@ -38,4 +38,4 @@
if (!RoomTestConfig.isKsp) {
throw AssumptionViolatedException("test is supported only in KSP")
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/AbstractDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/AbstractDao.kt
index 37b9011..26a6418 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/AbstractDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/AbstractDao.kt
@@ -40,4 +40,4 @@
addBooks(book)
addAuthors(author)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BaseDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BaseDao.kt
index 3419b5b..7574064 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BaseDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BaseDao.kt
@@ -57,4 +57,4 @@
@RawQuery
suspend fun rawQuery(query: SupportSQLiteQuery): List<T>
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/CounterDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/CounterDao.kt
index b4d769c..6bbc4ec 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/CounterDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/CounterDao.kt
@@ -28,4 +28,4 @@
@Query("SELECT * FROM Counter WHERE id = :id")
suspend fun getCounter(id: Long): Counter
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/MusicDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/MusicDao.kt
index 4a8fea8..a7ef64d 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/MusicDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/MusicDao.kt
@@ -355,4 +355,4 @@
@MapInfo(keyColumn = "mImageYear", valueColumn = "mTitle")
@RewriteQueriesToDropUnusedColumns
fun getNestedMapWithMapInfoKeyAndValue(): Map<Long, Map<Artist, Map<Album, List<String>>>>
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/PetDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/PetDao.kt
index c45bc5b..3d091dd 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/PetDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/PetDao.kt
@@ -79,4 +79,4 @@
}
insertOrReplace(newPet)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/RobotsDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/RobotsDao.kt
index 183ca2d..9449716 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/RobotsDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/RobotsDao.kt
@@ -43,4 +43,4 @@
@Query("SELECT * FROM Robot")
@Transaction
fun robotsWithHivemind(): List<RobotAndHivemind>
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/ToyDao.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/ToyDao.kt
index fbbd6c5..d67ea92 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/ToyDao.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/ToyDao.kt
@@ -42,4 +42,4 @@
@Update(onConflict = OnConflictStrategy.IGNORE)
fun updateOrIgnore(toy: Toy): Int
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationDb.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationDb.kt
index e5df42c..6494139 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationDb.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationDb.kt
@@ -580,4 +580,4 @@
companion object {
const val LATEST_VERSION = 3
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationTest.kt
index cb76b27..186154a 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/AutoMigrationTest.kt
@@ -110,4 +110,4 @@
companion object {
private const val TEST_DB = "auto-migration-test"
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/EmbeddedAutoMigrationDb.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/EmbeddedAutoMigrationDb.kt
index cd17c62..2367464 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/EmbeddedAutoMigrationDb.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/EmbeddedAutoMigrationDb.kt
@@ -90,4 +90,4 @@
companion object {
const val LATEST_VERSION = 2
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/ProvidedAutoMigrationSpecTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/ProvidedAutoMigrationSpecTest.kt
index d67604a..3d8dc4b 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/ProvidedAutoMigrationSpecTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/ProvidedAutoMigrationSpecTest.kt
@@ -174,4 +174,4 @@
companion object {
private const val TEST_DB = "auto-migration-test"
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AlteredTableColumnOrderTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AlteredTableColumnOrderTest.kt
index 0cccf07..771826d 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AlteredTableColumnOrderTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AlteredTableColumnOrderTest.kt
@@ -121,4 +121,4 @@
@Query("SELECT * FROM Foo LIMIT 1")
fun getOneFoo(): Foo
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AmbiguousColumnResolverTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AmbiguousColumnResolverTest.kt
index 93a76b0..3647b62 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AmbiguousColumnResolverTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/AmbiguousColumnResolverTest.kt
@@ -281,4 +281,4 @@
@ColumnInfo(name = "comment_id") val commentId: Int,
@ColumnInfo(name = "text") val text: String,
)
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BoxedNonNullTypesTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BoxedNonNullTypesTest.kt
index 9679239..5f9a4cf 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BoxedNonNullTypesTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BoxedNonNullTypesTest.kt
@@ -265,4 +265,4 @@
@Insert
fun insert(vararg entities: MyNullableEntity)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoBoxedPrimitiveDelegateTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoBoxedPrimitiveDelegateTest.kt
index 5fe6257..457b874 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoBoxedPrimitiveDelegateTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoBoxedPrimitiveDelegateTest.kt
@@ -168,4 +168,4 @@
db.byteArrayFooDao().insert(foo)
assertThat(db.byteArrayFooDao().getByteArray()).isEqualTo(ByteArray(16))
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoConflictStrategyTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoConflictStrategyTest.kt
index ea4619d..83898b3 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoConflictStrategyTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoConflictStrategyTest.kt
@@ -100,4 +100,4 @@
assertThat(output).isNotNull()
assertThat(output!!.mName).isEqualTo(newToy.mName)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoNameConflictTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoNameConflictTest.kt
index 21e7ca9..4907803 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoNameConflictTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DaoNameConflictTest.kt
@@ -121,4 +121,4 @@
abstract fun item1Dao(): Item1.Store
abstract fun item2Dao(): Item2.Store
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DeferredBooksDaoTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DeferredBooksDaoTest.kt
index 24ddfac..6485f92 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DeferredBooksDaoTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/DeferredBooksDaoTest.kt
@@ -229,4 +229,4 @@
val rowid = booksDao.insertPublisherFuture("ph3", "publisher 3").get()
assertThat(booksDao.getPublisher(rowid), notNullValue())
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
index 6653b7f..4a23ca5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
@@ -318,4 +318,4 @@
job.cancelAndJoin()
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
index 7c0345f..f399023 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
@@ -330,4 +330,4 @@
channel.cancel()
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ItemWithNullableConstructor.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ItemWithNullableConstructor.kt
index 30a25fa..cc2472f 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ItemWithNullableConstructor.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ItemWithNullableConstructor.kt
@@ -82,4 +82,4 @@
abstract class Db : RoomDatabase() {
abstract fun getDao(): TestDao
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/JvmNameInDaoTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/JvmNameInDaoTest.kt
index 315ecf6..be4878cf 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/JvmNameInDaoTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/JvmNameInDaoTest.kt
@@ -124,4 +124,4 @@
@JvmName("jvmDao")
abstract fun getDao(): JvmNameDao
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultimapQueryTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultimapQueryTest.kt
index 75797da..c44486f 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultimapQueryTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultimapQueryTest.kt
@@ -1384,4 +1384,4 @@
)
assertThat(artistToSongsMap[mAcDc]).containsExactly(mAcdcSong1)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/NullableCollectionQueryParamTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/NullableCollectionQueryParamTest.kt
index 80e204b..0c25ba7 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/NullableCollectionQueryParamTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/NullableCollectionQueryParamTest.kt
@@ -140,4 +140,4 @@
abstract class TestDatabase : RoomDatabase() {
abstract fun getDao(): SongDao
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ProvidedTypeConverterTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ProvidedTypeConverterTest.kt
index df85ab8..fbd1286 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ProvidedTypeConverterTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/ProvidedTypeConverterTest.kt
@@ -258,4 +258,4 @@
return input.lastName + "-" + input.name
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SneakyThrowTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SneakyThrowTest.kt
index 977ba54..3f92348 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SneakyThrowTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SneakyThrowTest.kt
@@ -43,4 +43,4 @@
// no-op on purpose
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt
index 10770bc..fb08a64 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt
@@ -58,4 +58,4 @@
assertThat(executeCount.get(), `is`(1))
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingTransactionCancellationTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingTransactionCancellationTest.kt
index f92825f..793f147 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingTransactionCancellationTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingTransactionCancellationTest.kt
@@ -174,4 +174,4 @@
booksDao.getBookSuspend(TestUtil.BOOK_1.bookId)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SyncTriggersConcurrencyTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SyncTriggersConcurrencyTest.kt
index 6f4b575..f56e7c7 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SyncTriggersConcurrencyTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SyncTriggersConcurrencyTest.kt
@@ -174,4 +174,4 @@
private const val CONCURRENCY = 4
private const val CHECK_ITERATIONS = 200
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/TestObserver.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/TestObserver.kt
index 9bb6653..a73aff3 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/TestObserver.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/TestObserver.kt
@@ -47,4 +47,4 @@
@Throws(TimeoutException::class, InterruptedException::class)
protected abstract fun drain()
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UsersDaoTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UsersDaoTest.kt
index b6b9c9e..31fd3b2 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UsersDaoTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UsersDaoTest.kt
@@ -45,4 +45,4 @@
assertThat(database.usersDao().getUsers()).containsExactlyElementsIn(expectedList)
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UuidColumnTypeAdapterTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UuidColumnTypeAdapterTest.kt
index 4bd0c4f..ea7bfa0 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UuidColumnTypeAdapterTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/UuidColumnTypeAdapterTest.kt
@@ -332,4 +332,4 @@
return text.replaceFirst('8', '5')
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/testutil/TestObserver.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/testutil/TestObserver.kt
index e437951..00842d5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/testutil/TestObserver.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/testutil/TestObserver.kt
@@ -43,4 +43,4 @@
}
protected abstract fun drain()
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Album.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Album.kt
index 412e855..26bd5d9 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Album.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Album.kt
@@ -25,4 +25,4 @@
val mAlbumArtist: String?,
val mAlbumReleaseYear: Int,
val mFeaturedArtist: String?
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumNameAndBandName.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumNameAndBandName.kt
index 492913c..d9b76a1 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumNameAndBandName.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumNameAndBandName.kt
@@ -15,4 +15,4 @@
*/
package androidx.room.integration.kotlintestapp.vo
-data class AlbumNameAndBandName(val mAlbumName: String?, val mBandName: String?)
\ No newline at end of file
+data class AlbumNameAndBandName(val mAlbumName: String?, val mBandName: String?)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumWithSongs.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumWithSongs.kt
index 713fb9a..506db0c 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumWithSongs.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AlbumWithSongs.kt
@@ -21,4 +21,4 @@
class AlbumWithSongs(
@field:Embedded val album: Album,
@field:Relation(parentColumn = "mAlbumName", entityColumn = "mAlbum") val songs: List<Song>
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AnswerConverter.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AnswerConverter.kt
index 2fd788d..9d33711 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AnswerConverter.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/AnswerConverter.kt
@@ -30,4 +30,4 @@
@TypeConverter
fun fromAnswer(value: Answer?) = value?.name
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Artist.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Artist.kt
index b8e0922..c0152a5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Artist.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Artist.kt
@@ -23,4 +23,4 @@
@field:PrimaryKey val mArtistId: Int,
val mArtistName: String?,
val mIsActive: Boolean
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/BookWithJavaEntity.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/BookWithJavaEntity.kt
index 5870b84..e92a138 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/BookWithJavaEntity.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/BookWithJavaEntity.kt
@@ -25,4 +25,4 @@
var book: Book? = null
@Relation(parentColumn = "bookId", entityColumn = "bookId", entity = JavaEntity::class)
var javaEntities: List<JavaEntity>? = null
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Cluster.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Cluster.kt
index d9350c0..12b2767 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Cluster.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Cluster.kt
@@ -25,4 +25,4 @@
entity = Robot::class,
entityColumn = "mHiveId"
) val mRobotList: List<Robot>
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Counter.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Counter.kt
index a47bfc1..d574dbf 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Counter.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Counter.kt
@@ -23,4 +23,4 @@
data class Counter(
@PrimaryKey val id: Long,
val value: Int
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Day.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Day.kt
index d71dcc5..20596c6 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Day.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Day.kt
@@ -17,4 +17,4 @@
enum class Day {
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Experiment.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Experiment.kt
index 99a7600..c73a71f 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Experiment.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Experiment.kt
@@ -24,4 +24,4 @@
data class Experiment(val isCatAlive: String)
-data class CatStatus(val isCatAlive: String)
\ No newline at end of file
+data class CatStatus(val isCatAlive: String)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Hivemind.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Hivemind.kt
index ef44469..f1ac708 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Hivemind.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Hivemind.kt
@@ -20,4 +20,4 @@
import java.util.UUID
@Entity
-class Hivemind(@field:PrimaryKey val mId: UUID)
\ No newline at end of file
+class Hivemind(@field:PrimaryKey val mId: UUID)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Image.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Image.kt
index d4cf95c..3979e14 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Image.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Image.kt
@@ -48,4 +48,4 @@
result = 31 * result + mArtistInImage.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ImageFormat.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ImageFormat.kt
index 9fcdb1c..e580dca 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ImageFormat.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ImageFormat.kt
@@ -17,4 +17,4 @@
enum class ImageFormat {
JPG, GIF, MPEG
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/JavaPojoConverter.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/JavaPojoConverter.kt
index 0d1d3b3..ee46ea5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/JavaPojoConverter.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/JavaPojoConverter.kt
@@ -45,4 +45,4 @@
fun toString(pojoList: List<JavaPojo>?): String {
return ""
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Lang.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Lang.kt
index 473f566..75c77f9 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Lang.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Lang.kt
@@ -43,4 +43,4 @@
}.toSet()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/MiniBook.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/MiniBook.kt
index 42d013a..aab7f2b 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/MiniBook.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/MiniBook.kt
@@ -22,4 +22,4 @@
@PrimaryKey val bookId: String,
val title: String,
val bookPublisherId: String
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/NoArgClass.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/NoArgClass.kt
index 335de5b..bf031c5 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/NoArgClass.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/NoArgClass.kt
@@ -23,4 +23,4 @@
* just here to ensure that we handle no-arg constructors fine from kotlin.
*/
@Entity
-data class NoArgClass(@PrimaryKey var id: Long = 0, var class_name: String = "")
\ No newline at end of file
+data class NoArgClass(@PrimaryKey var id: Long = 0, var class_name: String = "")
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Pet.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Pet.kt
index 1f4836885..dc35e67 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Pet.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Pet.kt
@@ -57,4 +57,4 @@
", mAdoptionDate=" + mAdoptionDate +
'}')
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetAndOwner.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetAndOwner.kt
index 566ad1d..f35f493 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetAndOwner.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetAndOwner.kt
@@ -24,4 +24,4 @@
parentColumn = "mUserId",
entityColumn = "mId"
) val mUser: PetUser
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetUser.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetUser.kt
index d0e5261..773428c 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetUser.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetUser.kt
@@ -89,4 +89,4 @@
", mWorkDays=" + mWorkDays +
'}')
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithToyIds.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithToyIds.kt
index f78770c..45942b7 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithToyIds.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithToyIds.kt
@@ -62,4 +62,4 @@
", toyIds=" + mToyIds +
'}')
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithUser.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithUser.kt
index 91c347e..d73d961 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithUser.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PetWithUser.kt
@@ -26,4 +26,4 @@
var mPet: Pet,
@Embedded
var mUser: PetUser
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Playlist.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Playlist.kt
index 4ab5cfd..0070de9 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Playlist.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Playlist.kt
@@ -19,4 +19,4 @@
import androidx.room.PrimaryKey
@Entity
-data class Playlist(@field:PrimaryKey val mPlaylistId: Int)
\ No newline at end of file
+data class Playlist(@field:PrimaryKey val mPlaylistId: Int)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistMultiSongXRefView.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistMultiSongXRefView.kt
index 770db72..dc4e122 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistMultiSongXRefView.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistMultiSongXRefView.kt
@@ -22,4 +22,4 @@
"SELECT * FROM PlaylistSongXRef WHERE mPlaylistId IN (SELECT mPlaylistId FROM" +
" PlaylistSongXRef GROUP BY mPlaylistId HAVING COUNT(mSongId) > 1)"
)
-class PlaylistMultiSongXRefView(val mPlaylistId: Int, val mSongId: Int)
\ No newline at end of file
+class PlaylistMultiSongXRefView(val mPlaylistId: Int, val mSongId: Int)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistSongXRef.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistSongXRef.kt
index 64f939a..eeeaa54 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistSongXRef.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistSongXRef.kt
@@ -34,4 +34,4 @@
)],
indices = [Index("mPlaylistId"), Index("mSongId")]
)
-data class PlaylistSongXRef(val mPlaylistId: Int, val mSongId: Int)
\ No newline at end of file
+data class PlaylistSongXRef(val mPlaylistId: Int, val mSongId: Int)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongTitles.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongTitles.kt
index a0194e2..878f11e 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongTitles.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongTitles.kt
@@ -32,4 +32,4 @@
projection = ["mTitle"]
)
var titles: List<String>
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongs.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongs.kt
index ee43929..5c417cf 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongs.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PlaylistWithSongs.kt
@@ -32,4 +32,4 @@
)
)
var songs: List<Song>
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PublisherWithBookSales.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PublisherWithBookSales.kt
index 55e50b2..600f26f 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PublisherWithBookSales.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/PublisherWithBookSales.kt
@@ -29,4 +29,4 @@
projection = ["salesCnt"]
)
var sales: List<Int>? = emptyList()
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ReleasedAlbum.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ReleasedAlbum.kt
index 0642cf6..02a2e6a 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ReleasedAlbum.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/ReleasedAlbum.kt
@@ -15,4 +15,4 @@
*/
package androidx.room.integration.kotlintestapp.vo
-data class ReleasedAlbum(val mReleaseYear: Int, val mAlbumName: String?)
\ No newline at end of file
+data class ReleasedAlbum(val mReleaseYear: Int, val mAlbumName: String?)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Robot.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Robot.kt
index ba8d353e..7595a88 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Robot.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Robot.kt
@@ -20,4 +20,4 @@
import java.util.UUID
@Entity
-class Robot(@field:PrimaryKey val mId: UUID, val mHiveId: UUID)
\ No newline at end of file
+class Robot(@field:PrimaryKey val mId: UUID, val mHiveId: UUID)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/RobotAndHivemind.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/RobotAndHivemind.kt
index 91bc351..28e5e1e 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/RobotAndHivemind.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/RobotAndHivemind.kt
@@ -24,4 +24,4 @@
parentColumn = "mHiveId",
entityColumn = "mId"
) val mHivemind: Hivemind
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Song.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Song.kt
index 2b6cd04..48eaa11 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Song.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Song.kt
@@ -26,4 +26,4 @@
val mAlbum: String?, // in seconds
val mLength: Int,
val mReleasedYear: Int
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Toy.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Toy.kt
index 56cf4b7..10cec7f 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Toy.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/vo/Toy.kt
@@ -53,4 +53,4 @@
result = 31 * result + mPetId
return result
}
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/DataClassFromDependency.kt b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/DataClassFromDependency.kt
index 14fc63f..e5702ec 100644
--- a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/DataClassFromDependency.kt
+++ b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/DataClassFromDependency.kt
@@ -27,4 +27,4 @@
@PrimaryKey(autoGenerate = true)
val id: Int,
val name: String
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/EmbeddedFromDependency.kt b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/EmbeddedFromDependency.kt
index f373d4b..9bd0bfa 100644
--- a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/EmbeddedFromDependency.kt
+++ b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/EmbeddedFromDependency.kt
@@ -20,4 +20,4 @@
data class EmbeddedFromDependency(
@Embedded
val data: DataClassFromDependency
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/PojoFromDependency.kt b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/PojoFromDependency.kt
index aa4c3b8..4165f11 100644
--- a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/PojoFromDependency.kt
+++ b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/PojoFromDependency.kt
@@ -18,4 +18,4 @@
data class PojoFromDependency(
val id: Int,
val name: String
-)
\ No newline at end of file
+)
diff --git a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/RelationFromDependency.kt b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/RelationFromDependency.kt
index 7d3a0d0..90d6be4 100644
--- a/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/RelationFromDependency.kt
+++ b/room/integration-tests/kotlintestapp/src/main/java/androidx/room/integration/kotlintestapp/vo/RelationFromDependency.kt
@@ -23,4 +23,4 @@
entityColumn = "name"
)
lateinit var dataItems: List<DataClassFromDependency>
-}
\ No newline at end of file
+}
diff --git a/room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/BoxedPrimitivesTest.java b/room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/BoxedPrimitivesTest.java
index ad3024c..d8ca0a2 100644
--- a/room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/BoxedPrimitivesTest.java
+++ b/room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/BoxedPrimitivesTest.java
@@ -96,7 +96,7 @@
/**
* assert the case where row was inserted via entity hence we should've read the default values
* already.
- **/
+ */
private void testInsertedAsEntity(BaseDao<? extends BaseBoxed> dao, long rowId) {
BaseBoxed read = dao.find(rowId);
// default getter value
diff --git a/room/room-common/build.gradle b/room/room-common/build.gradle
index bd514ec..52b0a1b6 100644
--- a/room/room-common/build.gradle
+++ b/room/room-common/build.gradle
@@ -28,7 +28,7 @@
testImplementation(libs.junit)
testImplementation(libs.mockitoCore4)
testImplementation(libs.guava)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
}
androidx {
diff --git a/room/room-common/src/main/java/androidx/room/AmbiguousColumnResolver.kt b/room/room-common/src/main/java/androidx/room/AmbiguousColumnResolver.kt
index 11448f6..ed818bf 100644
--- a/room/room-common/src/main/java/androidx/room/AmbiguousColumnResolver.kt
+++ b/room/room-common/src/main/java/androidx/room/AmbiguousColumnResolver.kt
@@ -249,4 +249,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-common/src/main/java/androidx/room/ColumnInfo.kt b/room/room-common/src/main/java/androidx/room/ColumnInfo.kt
index 9134c14..0c4561f 100644
--- a/room/room-common/src/main/java/androidx/room/ColumnInfo.kt
+++ b/room/room-common/src/main/java/androidx/room/ColumnInfo.kt
@@ -213,4 +213,4 @@
*/
public const val VALUE_UNSPECIFIED: String = "[value-unspecified]"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-common/src/test/java/androidx/room/AmbiguousColumnResolverTest.kt b/room/room-common/src/test/java/androidx/room/AmbiguousColumnResolverTest.kt
index 65dc715..403b226 100644
--- a/room/room-common/src/test/java/androidx/room/AmbiguousColumnResolverTest.kt
+++ b/room/room-common/src/test/java/androidx/room/AmbiguousColumnResolverTest.kt
@@ -436,4 +436,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-common/src/test/java/androidx/room/AnnotationRetentionPolicyTest.kt b/room/room-common/src/test/java/androidx/room/AnnotationRetentionPolicyTest.kt
index 025fe3b..598169e 100644
--- a/room/room-common/src/test/java/androidx/room/AnnotationRetentionPolicyTest.kt
+++ b/room/room-common/src/test/java/androidx/room/AnnotationRetentionPolicyTest.kt
@@ -40,4 +40,4 @@
assertThat(retentionPolicy).isEqualTo(RetentionPolicy.CLASS)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/build.gradle b/room/room-compiler-processing-testing/build.gradle
index 3940eef..506df13 100644
--- a/room/room-compiler-processing-testing/build.gradle
+++ b/room/room-compiler-processing-testing/build.gradle
@@ -29,7 +29,7 @@
implementation(libs.kotlinStdlibJdk8) // KSP defines older version as dependency, force update.
implementation(libs.ksp)
implementation(libs.googleCompileTesting)
- implementation(project(":internal-testutils-kmp"))
+ implementation(project(":kruth:kruth"))
// specify these to match the kotlin compiler version in AndroidX rather than what KSP or KCT
// uses
implementation(libs.kotlinCompilerEmbeddable)
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/SyntheticJavacProcessor.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/SyntheticJavacProcessor.kt
index 50847b3..bd8d38c 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/SyntheticJavacProcessor.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/SyntheticJavacProcessor.kt
@@ -44,4 +44,4 @@
}
override fun getSupportedSourceVersion() = SourceVersion.latest()
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/XProcessingEnvironmentTestConfigProvider.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/XProcessingEnvironmentTestConfigProvider.kt
index fa0b02c..7d455e6 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/XProcessingEnvironmentTestConfigProvider.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/XProcessingEnvironmentTestConfigProvider.kt
@@ -49,4 +49,4 @@
return instance?.configure(options) ?: XProcessingEnvConfig.DEFAULT
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt
index ce2cf62..e38371a 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt
@@ -519,4 +519,4 @@
it.toString()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationTestCapabilities.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationTestCapabilities.kt
index ba27129..4d431ee 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationTestCapabilities.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationTestCapabilities.kt
@@ -88,4 +88,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessage.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessage.kt
index 438396e..7eded8f 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessage.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessage.kt
@@ -35,4 +35,4 @@
data class DiagnosticLocation(
val source: Source?,
val line: Int,
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessagesSubject.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessagesSubject.kt
index 6aee6db..de1f737 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessagesSubject.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/DiagnosticMessagesSubject.kt
@@ -110,4 +110,4 @@
): DiagnosticMessagesSubject =
assertAbout(::DiagnosticMessagesSubject).that(diagnosticMessages)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/ProcessorTestExt.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/ProcessorTestExt.kt
index a352c22..bcef38b 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/ProcessorTestExt.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/ProcessorTestExt.kt
@@ -560,4 +560,4 @@
} finally {
tmpDir.deleteRecursively()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/TestUilts.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/TestUilts.kt
index e912ce9..300c4cd 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/TestUilts.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/TestUilts.kt
@@ -64,4 +64,4 @@
location = location,
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/XTestInvocation.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/XTestInvocation.kt
index a38b04b1..959e75e 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/XTestInvocation.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/XTestInvocation.kt
@@ -104,4 +104,4 @@
.that(disposed)
.isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DelegatingTestRegistrar.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DelegatingTestRegistrar.kt
index 2cc1938..735ca3c 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DelegatingTestRegistrar.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DelegatingTestRegistrar.kt
@@ -107,4 +107,4 @@
pluginClasspaths = (pluginClasspaths ?: arrayOf()) + resourcePathForSelfClassLoader
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DiagnosticsMessageCollector.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DiagnosticsMessageCollector.kt
index 2ea0c14..0728758 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DiagnosticsMessageCollector.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/DiagnosticsMessageCollector.kt
@@ -198,4 +198,4 @@
private const val KSP_ADDITIONAL_ERROR_MESSAGE =
"Error occurred in KSP, check log for detail"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/KotlinCliRunner.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/KotlinCliRunner.kt
index 5b591f0f..b4428a5 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/KotlinCliRunner.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/KotlinCliRunner.kt
@@ -177,4 +177,4 @@
}
return classpaths.map { File(it) }.filter { it.exists() }
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/SourceSet.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/SourceSet.kt
index 39a87cd..6f0f335 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/SourceSet.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/SourceSet.kt
@@ -19,6 +19,9 @@
import androidx.room.compiler.processing.util.Source
import java.io.File
+private val BY_ROUNDS_PATH_PATTERN =
+ "(byRounds${File.separator}[0-9]+${File.separator})?(.*)".toPattern()
+
/**
* Represents sources that are positioned in the [root] folder.
* see: [fromExistingFiles]
@@ -59,7 +62,8 @@
}
/**
- * Finds the source file matching the given relative path (from root)
+ * Finds the source file matching the given relative path (from root). This will ignore
+ * "byRounds/<round number>" directories added by KSP.
*/
fun findSourceFile(
path: String
@@ -68,7 +72,14 @@
if (!file.path.startsWith(root.path)) {
return null
}
- val relativePath = path.substringAfter(root.canonicalPath + File.separator)
+ val relativePath = path.substringAfter(root.canonicalPath + File.separator).let {
+ val matcher = BY_ROUNDS_PATH_PATTERN.matcher(it)
+ if (matcher.find()) {
+ matcher.group(2)
+ } else {
+ it
+ }
+ }
return sources.firstOrNull {
it.relativePath == relativePath
}
@@ -116,4 +127,4 @@
SourceSet.fromExistingFiles(this)
} else {
null
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKapt3Registrar.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKapt3Registrar.kt
index 8dca55a..c815d4b 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKapt3Registrar.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKapt3Registrar.kt
@@ -128,4 +128,4 @@
container.useInstance(KaptAnonymousTypeTransformer(analysisExtension))
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKotlinCompiler.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKotlinCompiler.kt
index 8287cfd..37746b0 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKotlinCompiler.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/TestKotlinCompiler.kt
@@ -231,4 +231,4 @@
"failed to create working directory ($this)"
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/JavaSourceCompilationStep.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/JavaSourceCompilationStep.kt
index 57185d2..951a56e 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/JavaSourceCompilationStep.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/JavaSourceCompilationStep.kt
@@ -93,4 +93,4 @@
}
private const val GEN_CLASS_OUT = "classOut"
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KaptCompilationStep.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KaptCompilationStep.kt
index 2b8bc91..2665543 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KaptCompilationStep.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KaptCompilationStep.kt
@@ -141,4 +141,4 @@
return filteredOptionsMap
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KotlinSourceCompilationStep.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KotlinSourceCompilationStep.kt
index 940b4e6..a90900f9 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KotlinSourceCompilationStep.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KotlinSourceCompilationStep.kt
@@ -62,4 +62,4 @@
}
private const val CLASS_OUT_FOLDER_NAME = "class-out"
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KspCompilationStep.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KspCompilationStep.kt
index 5a9069a..745df00 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KspCompilationStep.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/compiler/steps/KspCompilationStep.kt
@@ -94,4 +94,4 @@
private const val KOTLIN_OUT_DIR = "generatedKotlin"
private const val CLASS_OUT_FOLDER_NAME = "class-out"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/JavacCompilationTestRunner.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/JavacCompilationTestRunner.kt
index ecdfd66..d025f34 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/JavacCompilationTestRunner.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/JavacCompilationTestRunner.kt
@@ -97,4 +97,4 @@
generatedSources = generatedSources.values.toList()
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KaptCompilationTestRunner.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KaptCompilationTestRunner.kt
index 7f8bc31..917c724 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KaptCompilationTestRunner.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KaptCompilationTestRunner.kt
@@ -56,4 +56,4 @@
delegate = result
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KspCompilationTestRunner.kt b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KspCompilationTestRunner.kt
index 1042367..2e7bc22 100644
--- a/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KspCompilationTestRunner.kt
+++ b/room/room-compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/runner/KspCompilationTestRunner.kt
@@ -68,4 +68,4 @@
delegate = result
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticMessageCollectorTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticMessageCollectorTest.kt
index e27cc44..1c5c650 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticMessageCollectorTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticMessageCollectorTest.kt
@@ -202,4 +202,4 @@
),
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticsTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticsTest.kt
index 99d6e15..d211727 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticsTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/DiagnosticsTest.kt
@@ -275,4 +275,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/LoadFromDefaultEnvironmentConfigurationProviderTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/LoadFromDefaultEnvironmentConfigurationProviderTest.kt
index 4e577796..773c6cd 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/LoadFromDefaultEnvironmentConfigurationProviderTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/LoadFromDefaultEnvironmentConfigurationProviderTest.kt
@@ -29,4 +29,4 @@
assertThat(TestDefaultEnvironmentConfigProvider.invoked)
.isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/MultiRoundProcessingTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/MultiRoundProcessingTest.kt
index cfee829e..f05bf87 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/MultiRoundProcessingTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/MultiRoundProcessingTest.kt
@@ -197,4 +197,4 @@
result.exceptionOrNull()?.cause
).hasMessageThat().contains("i failed")
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/SourceSetTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/SourceSetTest.kt
new file mode 100644
index 0000000..203f195
--- /dev/null
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/SourceSetTest.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.room.compiler.processing.util
+
+import androidx.kruth.assertThat
+import androidx.room.compiler.processing.util.compiler.SourceSet
+import org.jetbrains.kotlin.konan.file.File
+import org.junit.Rule
+import org.junit.Test
+import org.junit.rules.TemporaryFolder
+
+class SourceSetTest {
+ @Rule
+ @JvmField
+ val tempFolder = TemporaryFolder()
+
+ private val BY_ROUNDS_DIR = "byRounds"
+ val SOURCE_DIR = "test"
+ val SOURCE_CLASS = "A"
+ val SOURCE_FILE = "$SOURCE_CLASS.java"
+
+ @Test
+ fun testFindSourceFile() {
+ tempFolder.newFolder(SOURCE_DIR)
+ val sourceFile = tempFolder.newFile(SOURCE_DIR + File.separator + SOURCE_FILE)
+ sourceFile.writeText("public class A {}")
+ val sourceSet = SourceSet.fromExistingFiles(tempFolder.root)
+ val path = tempFolder.root.path + File.separator + SOURCE_DIR + File.separator + SOURCE_FILE
+
+ val f = sourceSet.findSourceFile(path)
+ assertThat(f).isNotNull()
+ assertThat(f!!.relativePath).isEqualTo(SOURCE_DIR + File.separator + SOURCE_FILE)
+ }
+
+ @Test
+ fun testFindSourceFileShouldIgnoreRoundsDir() {
+ for (i in 0..100) {
+ val round = i.toString()
+
+ tempFolder.newFolder(BY_ROUNDS_DIR, round, SOURCE_DIR)
+ tempFolder.newFile(BY_ROUNDS_DIR + File.separator + round + File.separator +
+ SOURCE_DIR + File.separator + SOURCE_FILE)
+ val sourceSet = SourceSet(tempFolder.root, listOf(
+ Source.java("$SOURCE_DIR.$SOURCE_CLASS", "public class A {}")))
+ val path = tempFolder.root.path + File.separator + BY_ROUNDS_DIR + File.separator +
+ round + File.separator + SOURCE_DIR + File.separator + SOURCE_FILE
+
+ val f = sourceSet.findSourceFile(path)
+ assertThat(f).isNotNull()
+ assertThat(f!!.relativePath).isEqualTo(SOURCE_DIR + File.separator + SOURCE_FILE)
+ }
+ }
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestConfigTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestConfigTest.kt
index 86a6951..cde233d 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestConfigTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestConfigTest.kt
@@ -61,4 +61,4 @@
).canEnableKsp()
).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestDefaultEnvironmentConfigProvider.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestDefaultEnvironmentConfigProvider.kt
index fb42b59..6920a15 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestDefaultEnvironmentConfigProvider.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestDefaultEnvironmentConfigProvider.kt
@@ -38,4 +38,4 @@
internal var invoked: Boolean = false
private set
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestRunnerTest.kt b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestRunnerTest.kt
index 4d057ca..10cf032 100644
--- a/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestRunnerTest.kt
+++ b/room/room-compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/TestRunnerTest.kt
@@ -560,4 +560,4 @@
assertThat(javacStep.rounds).isEqualTo(3) // 2 rounds + final
assertThat(kspStep.rounds).isEqualTo(3) // 2 rounds + final
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/build.gradle b/room/room-compiler-processing/build.gradle
index 2e7af1d..0e71dd2 100644
--- a/room/room-compiler-processing/build.gradle
+++ b/room/room-compiler-processing/build.gradle
@@ -86,7 +86,7 @@
testImplementation(libs.kotlinMetadataJvm)
testImplementation(project(":room:room-compiler-processing-testing"))
testImplementation(project(":internal-testutils-common"))
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
}
tasks.withType(KotlinCompile).configureEach {
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/CodeLanguage.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/CodeLanguage.kt
index e3d3836..122ef32 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/CodeLanguage.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/CodeLanguage.kt
@@ -22,4 +22,4 @@
enum class CodeLanguage {
JAVA, KOTLIN
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/VisibilityModifier.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/VisibilityModifier.kt
index c391c42..ec44eb4 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/VisibilityModifier.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/VisibilityModifier.kt
@@ -21,4 +21,4 @@
PROTECTED,
INTERNAL,
PRIVATE
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XAnnotationSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XAnnotationSpec.kt
index cafc0f0..17518ce 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XAnnotationSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XAnnotationSpec.kt
@@ -50,4 +50,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XCodeBlock.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XCodeBlock.kt
index 28bb824..a731401 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XCodeBlock.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XCodeBlock.kt
@@ -213,4 +213,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XFunSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XFunSpec.kt
index 3a1a2ec..07f4ef1 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XFunSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XFunSpec.kt
@@ -167,4 +167,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XMemberName.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XMemberName.kt
index 8573ba6..aeb09f8 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XMemberName.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XMemberName.kt
@@ -68,4 +68,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XPropertySpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XPropertySpec.kt
index 50ecd53..520f3cd 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XPropertySpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XPropertySpec.kt
@@ -90,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
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 522d97d..f4a145b 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
@@ -440,4 +440,4 @@
fun XTypeName.unbox() = XTypeName(java.unbox(), kotlin.copy(nullable = false), XNullability.NONNULL)
fun XTypeName.toJavaPoet(): JTypeName = this.java
-fun XClassName.toJavaPoet(): JClassName = this.java
\ No newline at end of file
+fun XClassName.toJavaPoet(): JClassName = this.java
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeSpec.kt
index 344481a..e21247f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeSpec.kt
@@ -162,4 +162,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/ClassNames.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/ClassNames.kt
index b4637ca..7366225 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/ClassNames.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/ClassNames.kt
@@ -19,4 +19,4 @@
import com.squareup.javapoet.ClassName
internal val NULLABLE_ANNOTATION = ClassName.get("androidx.annotation", "Nullable")
-internal val NONNULL_ANNOTATION = ClassName.get("androidx.annotation", "NonNull")
\ No newline at end of file
+internal val NONNULL_ANNOTATION = ClassName.get("androidx.annotation", "NonNull")
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaAnnotationSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaAnnotationSpec.kt
index 2a3e25f..ed81957 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaAnnotationSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaAnnotationSpec.kt
@@ -37,4 +37,4 @@
return JavaAnnotationSpec(actual.build())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaFunSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaFunSpec.kt
index 453ad85..8d03934 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaFunSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaFunSpec.kt
@@ -109,4 +109,4 @@
VisibilityModifier.PROTECTED -> Modifier.PROTECTED
VisibilityModifier.INTERNAL -> Modifier.PUBLIC
VisibilityModifier.PRIVATE -> Modifier.PRIVATE
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaLang.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaLang.kt
index 7ec00c3..adf21a5 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaLang.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaLang.kt
@@ -21,4 +21,4 @@
internal abstract class JavaLang : TargetLanguage {
override val language = CodeLanguage.JAVA
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaPropertySpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaPropertySpec.kt
index 9b2a707..e0490e0 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaPropertySpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaPropertySpec.kt
@@ -45,4 +45,4 @@
return JavaPropertySpec(name, actual.build())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaTypeSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaTypeSpec.kt
index 37d576c..b0fb822 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaTypeSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/java/JavaTypeSpec.kt
@@ -85,4 +85,4 @@
actual.addModifiers(Modifier.ABSTRACT)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinAnnotationSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinAnnotationSpec.kt
index 50222ca..b1eb63f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinAnnotationSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinAnnotationSpec.kt
@@ -38,4 +38,4 @@
return KotlinAnnotationSpec(actual.build())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinFunSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinFunSpec.kt
index 1a3c0c4..d1feaa5 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinFunSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinFunSpec.kt
@@ -84,4 +84,4 @@
VisibilityModifier.PROTECTED -> KModifier.PROTECTED
VisibilityModifier.INTERNAL -> KModifier.INTERNAL
VisibilityModifier.PRIVATE -> KModifier.PRIVATE
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinLang.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinLang.kt
index eeed52d..8c3bd99 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinLang.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinLang.kt
@@ -21,4 +21,4 @@
internal abstract class KotlinLang : TargetLanguage {
override val language = CodeLanguage.KOTLIN
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinPropertySpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinPropertySpec.kt
index 66348a5..59d4c51 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinPropertySpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinPropertySpec.kt
@@ -45,4 +45,4 @@
return KotlinPropertySpec(name, actual.build())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinTypeSpec.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinTypeSpec.kt
index a819dd9..c0c888e 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinTypeSpec.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/kotlin/KotlinTypeSpec.kt
@@ -91,4 +91,4 @@
return KotlinTypeSpec(className, actual.build())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ExperimentalProcessingApi.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ExperimentalProcessingApi.kt
index 00a7604..c341ea4 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ExperimentalProcessingApi.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ExperimentalProcessingApi.kt
@@ -23,4 +23,4 @@
*/
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalProcessingApi
\ No newline at end of file
+annotation class ExperimentalProcessingApi
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotated.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotated.kt
index c671acc..8f8ae9f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotated.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotated.kt
@@ -70,4 +70,4 @@
annotation: KClass<out Annotation>,
containerAnnotation: KClass<out Annotation>? = annotation.containerAnnotation
): Boolean
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotation.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotation.kt
index 40d6a093..55ff7b7 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotation.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotation.kt
@@ -70,4 +70,4 @@
// above code will throw.
null
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotationValue.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotationValue.kt
index 12c6f0e..9e16ff7 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotationValue.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/InternalXAnnotationValue.kt
@@ -136,4 +136,4 @@
val CLASS: TypeName = TypeName.get(Class::class.java)
val KCLASS: TypeName = TypeName.get(kotlin.reflect.KClass::class.java)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XAnnotationValue.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XAnnotationValue.kt
index 8ca6c46..5faaa08 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XAnnotationValue.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XAnnotationValue.kt
@@ -197,4 +197,4 @@
/**Returns the value a list of [XAnnotationValue]. */
@Suppress("UNCHECKED_CAST") // Values in a list are always wrapped in XAnnotationValue
fun asAnnotationValueList(): List<XAnnotationValue> = value as List<XAnnotationValue>
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XArrayType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XArrayType.kt
index e46da1a..39a3f2f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XArrayType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XArrayType.kt
@@ -26,4 +26,4 @@
* The type of elements in the Array
*/
val componentType: XType
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XBasicAnnotationProcessor.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XBasicAnnotationProcessor.kt
index bb7e7dc..00178f7 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XBasicAnnotationProcessor.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XBasicAnnotationProcessor.kt
@@ -225,4 +225,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XConstructorType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XConstructorType.kt
index 3c8332d..2e444fb 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XConstructorType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XConstructorType.kt
@@ -21,4 +21,4 @@
*
* It is not an XType as it does not represent a class or primitive.
*/
-interface XConstructorType : XExecutableType
\ No newline at end of file
+interface XConstructorType : XExecutableType
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XEnumEntry.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XEnumEntry.kt
index a0503db..5a14828 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XEnumEntry.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XEnumEntry.kt
@@ -42,4 +42,4 @@
returns(true) implies (this@isEnumEntry is XEnumEntry)
}
return this is XEnumEntry
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XExecutableType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XExecutableType.kt
index 32a61dd..a41f658 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XExecutableType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XExecutableType.kt
@@ -35,4 +35,4 @@
* TODO: decide on how we want to handle nullability here.
*/
fun isSameType(other: XExecutableType): Boolean
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XParameterizable.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XParameterizable.kt
index 06d653f..07bdf41 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XParameterizable.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XParameterizable.kt
@@ -23,4 +23,4 @@
interface XParameterizable {
/** The type parameters of this element. */
val typeParameters: List<XTypeParameterElement>
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingConfig.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingConfig.kt
index 25fed28..8ceb61c 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingConfig.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingConfig.kt
@@ -29,4 +29,4 @@
}
private const val PROP_PREFIX = "androidx.room.compiler.processing"
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingEnvConfig.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingEnvConfig.kt
index e6b21cb..97639d5 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingEnvConfig.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XProcessingEnvConfig.kt
@@ -91,4 +91,4 @@
*/
val DEFAULT = Builder().build()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XRawType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XRawType.kt
index 38f719c..d2340f3 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XRawType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XRawType.kt
@@ -54,4 +54,4 @@
* Returns `true` if this raw type can be assigned from [other].
*/
fun isAssignableFrom(other: XType) = isAssignableFrom(other.rawType)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XSuspendMethodType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XSuspendMethodType.kt
index 028c724..47e8418 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XSuspendMethodType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XSuspendMethodType.kt
@@ -21,4 +21,4 @@
* Returns the real suspend function return type as seen by Kotlin.
*/
fun getSuspendFunctionReturnType(): XType
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeParameterElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeParameterElement.kt
index e6bc9ca..ae36c30 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeParameterElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeParameterElement.kt
@@ -35,4 +35,4 @@
// TODO(b/259091615): Migrate to XTypeName
/** Returns the [TypeVariableName] for this type parameter) */
val typeVariableName: TypeVariableName
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeVariableType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeVariableType.kt
index d061e3f..98c3c7f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeVariableType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XTypeVariableType.kt
@@ -33,4 +33,4 @@
* type exists rather than representing the intersection type as a unique type in the model.
*/
val upperBounds: List<XType>
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XVariableElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XVariableElement.kt
index 018fdd3..de438d4 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XVariableElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/XVariableElement.kt
@@ -31,4 +31,4 @@
* specified in [other]. (e.g. Bar<T> vs Foo : Bar<String>)
*/
fun asMemberOf(other: XType): XType
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/DefaultJavacType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/DefaultJavacType.kt
index 1427653..f829a4b 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/DefaultJavacType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/DefaultJavacType.kt
@@ -84,4 +84,4 @@
nullability = nullability
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/ElementExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/ElementExt.kt
index cdc6107d..c836753 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/ElementExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/ElementExt.kt
@@ -148,4 +148,4 @@
}
}
return true
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotation.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotation.kt
index 05e031a..a1cd205 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotation.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotation.kt
@@ -59,4 +59,4 @@
override fun <T : Annotation> asAnnotationBox(annotationClass: Class<T>): XAnnotationBox<T> {
return mirror.box(env, annotationClass)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationBox.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationBox.kt
index d739910..9fcb636 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationBox.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationBox.kt
@@ -446,4 +446,4 @@
.invoke(null, value!!.simpleName.toString()) as T
}
}.visit(this)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationValue.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationValue.kt
index 9e58a58..c4eb412 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationValue.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacAnnotationValue.kt
@@ -96,4 +96,4 @@
JavacAnnotationValue(data.env, data.method, it, valueType) { it.accept(this, data) }
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacArrayType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacArrayType.kt
index 5d0ba49..e48dd79 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacArrayType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacArrayType.kt
@@ -112,4 +112,4 @@
kotlinType = kotlinType
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcessor.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcessor.kt
index 715e356..99a3d95 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcessor.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcessor.kt
@@ -77,4 +77,4 @@
return false
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacEnumEntry.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacEnumEntry.kt
index 47da07e..aebeee9 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacEnumEntry.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacEnumEntry.kt
@@ -35,4 +35,4 @@
override val closestMemberContainer: XEnumTypeElement
get() = enclosingElement
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFieldElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFieldElement.kt
index 7ca7ecb..1588b54 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFieldElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFieldElement.kt
@@ -16,6 +16,7 @@
package androidx.room.compiler.processing.javac
+import androidx.room.compiler.processing.XAnnotation
import androidx.room.compiler.processing.XFieldElement
import androidx.room.compiler.processing.javac.kotlin.KmPropertyContainer
import androidx.room.compiler.processing.javac.kotlin.KmTypeContainer
@@ -26,11 +27,35 @@
env: JavacProcessingEnv,
element: VariableElement
) : JavacVariableElement(env, element), XFieldElement {
+ override fun getAllAnnotations(): List<XAnnotation> {
+ return buildList {
+ addAll(super.getAllAnnotations())
+ // For kotlin sources, annotations placed on properties will appear on synthetic
+ // "$annotations" methods in the KAPT stub rather than on the field so we append these
+ // annotations to match KSP. Note that the synthetic "$annotations" method isn't
+ // accessible on precompiled classes in KAPT due to
+ // https://youtrack.jetbrains.com/issue/KT-34684, so they will still be missing in that
+ // case, but there's nothing we can really do about that.
+ syntheticMethodForAnnotations?.let { methodForAnnotations ->
+ addAll(
+ methodForAnnotations.getAllAnnotations()
+ .filter { it.qualifiedName != "java.lang.Deprecated" }
+ .toList()
+ )
+ }
+ }
+ }
override val kotlinMetadata: KmPropertyContainer? by lazy {
(enclosingElement as? JavacTypeElement)?.kotlinMetadata?.getPropertyMetadata(name)
}
+ private val syntheticMethodForAnnotations: JavacMethodElement? by lazy {
+ (enclosingElement as? JavacTypeElement)
+ ?.getSyntheticMethodsForAnnotations()
+ ?.singleOrNull { it.name == kotlinMetadata?.syntheticMethodForAnnotations?.name }
+ }
+
override val kotlinType: KmTypeContainer?
get() = kotlinMetadata?.type
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnvMessager.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnvMessager.kt
index 8021645..ea25003 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnvMessager.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnvMessager.kt
@@ -90,4 +90,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacRawType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacRawType.kt
index 88f31cc..eeab7cc 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacRawType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacRawType.kt
@@ -57,4 +57,4 @@
override fun toString(): String {
return xTypeName.java.toString()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeElement.kt
index 3aa3852..5d3d6e4 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeElement.kt
@@ -196,9 +196,17 @@
}
override fun getDeclaredMethods(): List<JavacMethodElement> {
+ // TODO(b/290800523): Remove the synthetic annotations method from the list
+ // of declared methods so that KAPT matches KSP.
return _declaredMethods
}
+ fun getSyntheticMethodsForAnnotations(): List<JavacMethodElement> {
+ return _declaredMethods.filter {
+ it.kotlinMetadata?.isSyntheticMethodForAnnotations() == true
+ }
+ }
+
override fun getConstructors(): List<JavacConstructorElement> {
return ElementFilter.constructorsIn(element.enclosedElements).map {
JavacConstructorElement(
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeParameterElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeParameterElement.kt
index ad42e32..b7842bb 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeParameterElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeParameterElement.kt
@@ -50,4 +50,4 @@
override val closestMemberContainer: XMemberContainer
get() = enclosingElement.closestMemberContainer
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeVariableType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeVariableType.kt
index f8c3f78..98a3703 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeVariableType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacTypeVariableType.kt
@@ -100,4 +100,4 @@
nullability = nullability
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/XTypeElementStore.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/XTypeElementStore.kt
index a93e43f..b464019 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/XTypeElementStore.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/XTypeElementStore.kt
@@ -63,4 +63,4 @@
internal fun clear() {
typeCache.clear()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmAbi.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmAbi.kt
index e2b766f..3b11c47 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmAbi.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmAbi.kt
@@ -47,6 +47,10 @@
}
}
+ fun computeSyntheticMethodForAnnotationsName(propertyName: String): String {
+ return "${computeGetterName(propertyName)}\$annotations"
+ }
+
private fun String.startsWithIsPrefix(): Boolean {
if (!startsWith(IS_PREFIX)) return false
if (length == IS_PREFIX.length) return false
@@ -63,4 +67,4 @@
this
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtils.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtils.kt
index 4453eb7..f7dae3e 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtils.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtils.kt
@@ -177,4 +177,4 @@
is QualifiedNameable -> qualifiedName.toString().replace('.', '/')
else -> simpleName.toString()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/KotlinClassMetadataUtils.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/KotlinClassMetadataUtils.kt
index f9629b6..7d93ec0 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/KotlinClassMetadataUtils.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/javac/kotlin/KotlinClassMetadataUtils.kt
@@ -45,6 +45,7 @@
import kotlinx.metadata.jvm.getterSignature
import kotlinx.metadata.jvm.setterSignature
import kotlinx.metadata.jvm.signature
+import kotlinx.metadata.jvm.syntheticMethodForAnnotations
internal interface KmFlags {
val flags: Flags
@@ -115,23 +116,17 @@
check(method.kind == ElementKind.METHOD) {
"must pass an element type of method"
}
- val methodSignature = method.descriptor()
- functionList.firstOrNull { it.descriptor == methodSignature }?.let {
- return it
- }
- // might be a property getter or setter
- return propertyList.firstNotNullOfOrNull { property ->
- when {
- property.getter?.descriptor == methodSignature -> {
- property.getter
- }
+ return functionByDescriptor[method.descriptor()]
+ }
- property.setter?.descriptor == methodSignature -> {
- property.setter
- }
-
- else -> {
- null
+ private val functionByDescriptor: Map<String, KmFunctionContainer> by lazy {
+ buildMap {
+ functionList.forEach { put(it.descriptor, it) }
+ propertyList.forEach { property ->
+ property.getter?.descriptor?.let { put(it, property.getter) }
+ property.setter?.descriptor?.let { put(it, property.setter) }
+ property.syntheticMethodForAnnotations?.descriptor?.let {
+ put(it, property.syntheticMethodForAnnotations)
}
}
}
@@ -206,19 +201,21 @@
}
internal interface KmFunctionContainer : KmFlags {
- /** Name of the function in source code **/
+ /** Name of the function in source code */
val name: String
- /** Name of the function in byte code **/
+ /** Name of the function in byte code */
val jvmName: String
val descriptor: String
val typeParameters: List<KmTypeParameterContainer>
val parameters: List<KmValueParameterContainer>
val returnType: KmTypeContainer
- fun isPropertyFunction(): Boolean = this is KmPropertyFunctionContainerImpl
+ fun isSyntheticMethodForAnnotations() =
+ (this as? KmPropertyFunctionContainerImpl)?.syntheticMethodForAnnotations == true
+ fun isPropertyFunction() = this is KmPropertyFunctionContainerImpl
fun isSuspend() = Flag.Function.IS_SUSPEND(flags)
fun isExtension() =
- this is KmFunctionContainerImpl && this.kmFunction.receiverParameterType != null
+ (this as? KmFunctionContainerImpl)?.kmFunction?.receiverParameterType != null
}
private class KmFunctionContainerImpl(
@@ -239,20 +236,21 @@
get() = kmFunction.valueParameters.map { it.asContainer() }
}
-private class KmPropertyFunctionContainerImpl(
+private open class KmPropertyFunctionContainerImpl(
override val flags: Flags,
override val name: String,
override val jvmName: String,
override val descriptor: String,
override val parameters: List<KmValueParameterContainer>,
override val returnType: KmTypeContainer,
+ val syntheticMethodForAnnotations: Boolean = false
) : KmFunctionContainer {
override val typeParameters: List<KmTypeParameterContainer> = emptyList()
}
internal class KmConstructorContainer(
private val kmConstructor: KmConstructor,
- override val returnType: KmTypeContainer
+ override val returnType: KmTypeContainer,
) : KmFunctionContainer {
override val flags: Flags
get() = kmConstructor.flags
@@ -271,7 +269,8 @@
private val kmProperty: KmProperty,
val type: KmTypeContainer,
val getter: KmFunctionContainer?,
- val setter: KmFunctionContainer?
+ val setter: KmFunctionContainer?,
+ val syntheticMethodForAnnotations: KmFunctionContainer?,
) : KmFlags {
override val flags: Flags
get() = kmProperty.flags
@@ -437,6 +436,18 @@
returnType = returnType.asContainer(),
)
},
+ syntheticMethodForAnnotations = syntheticMethodForAnnotations?.let {
+ val returnType = KmType(0).apply { classifier = KmClassifier.Class("Unit") }
+ KmPropertyFunctionContainerImpl(
+ flags = 0,
+ name = JvmAbi.computeSyntheticMethodForAnnotationsName(this.name),
+ jvmName = it.name,
+ descriptor = it.asString(),
+ parameters = emptyList(),
+ returnType = returnType.asContainer(),
+ syntheticMethodForAnnotations = true,
+ )
+ },
)
private fun KmType.asContainer(): KmTypeContainer =
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/DefaultKspType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/DefaultKspType.kt
index a24eeb0..5c1bbaf 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/DefaultKspType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/DefaultKspType.kt
@@ -17,6 +17,7 @@
package androidx.room.compiler.processing.ksp
import androidx.room.compiler.processing.tryBox
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.KTypeName
@@ -24,9 +25,10 @@
internal class DefaultKspType(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
-) : KspType(env, ksType, scope, typeAlias) {
+) : KspType(env, ksType, originalKSAnnotations, scope, typeAlias) {
override fun resolveJTypeName(): JTypeName {
// always box these. For primitives, typeName might return the primitive type but if we
@@ -45,7 +47,8 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
- ) = DefaultKspType(env, ksType, scope, typeAlias)
-}
\ No newline at end of file
+ ) = DefaultKspType(env, ksType, originalKSAnnotations, scope, typeAlias)
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
index 83e3f36..9cce0e0 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
@@ -202,4 +202,4 @@
}
val parent = parent ?: return false
return parent.hasSuppressWildcardsAnnotationInHierarchy()
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
index 70a827c..442930d 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
@@ -230,4 +230,4 @@
): JTypeVariableName = typeVarNameConstructor.newInstance(
name,
bounds
-) as JTypeVariableName
\ No newline at end of file
+) as JTypeVariableName
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeReferenceExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeReferenceExt.kt
index 2ce3985..3cb9473 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeReferenceExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeReferenceExt.kt
@@ -73,4 +73,4 @@
}
override fun resolve(): KSType = resolved
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotated.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotated.kt
index 4039290..994ab5f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotated.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotated.kt
@@ -19,6 +19,7 @@
import androidx.room.compiler.processing.InternalXAnnotated
import androidx.room.compiler.processing.XAnnotation
import androidx.room.compiler.processing.XAnnotationBox
+import androidx.room.compiler.processing.ksp.KspAnnotated.UseSiteFilter.Companion.getDeclaredTargets
import androidx.room.compiler.processing.unwrapRepeatedAnnotationsFromContainer
import com.google.devtools.ksp.symbol.AnnotationUseSiteTarget
import com.google.devtools.ksp.symbol.KSAnnotated
@@ -113,8 +114,8 @@
fun accept(env: KspProcessingEnv, annotation: KSAnnotation): Boolean
private class Impl(
- val acceptedSiteTarget: AnnotationUseSiteTarget,
- val acceptedTarget: AnnotationTarget,
+ val acceptedSiteTarget: AnnotationUseSiteTarget? = null,
+ val acceptedTargets: Set<AnnotationTarget>,
private val acceptNoTarget: Boolean = true,
) : UseSiteFilter {
override fun accept(env: KspProcessingEnv, annotation: KSAnnotation): Boolean {
@@ -123,7 +124,7 @@
return if (useSiteTarget != null) {
acceptedSiteTarget == useSiteTarget
} else if (annotationTargets.isNotEmpty()) {
- annotationTargets.contains(acceptedTarget)
+ annotationTargets.any { acceptedTargets.contains(it) }
} else {
acceptNoTarget
}
@@ -136,33 +137,39 @@
return annotation.useSiteTarget == null
}
}
+ val NO_USE_SITE_OR_CONSTRUCTOR: UseSiteFilter = Impl(
+ acceptedTargets = setOf(AnnotationTarget.CONSTRUCTOR)
+ )
+ val NO_USE_SITE_OR_METHOD: UseSiteFilter = Impl(
+ acceptedTargets = setOf(AnnotationTarget.FUNCTION)
+ )
val NO_USE_SITE_OR_FIELD: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.FIELD,
- acceptedTarget = AnnotationTarget.FIELD
+ acceptedTargets = setOf(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY)
)
val NO_USE_SITE_OR_METHOD_PARAMETER: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.PARAM,
- acceptedTarget = AnnotationTarget.VALUE_PARAMETER
+ acceptedTargets = setOf(AnnotationTarget.VALUE_PARAMETER)
)
val NO_USE_SITE_OR_GETTER: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.GET,
- acceptedTarget = AnnotationTarget.PROPERTY_GETTER
+ acceptedTargets = setOf(AnnotationTarget.PROPERTY_GETTER)
)
val NO_USE_SITE_OR_SETTER: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.SET,
- acceptedTarget = AnnotationTarget.PROPERTY_SETTER
+ acceptedTargets = setOf(AnnotationTarget.PROPERTY_SETTER)
)
val NO_USE_SITE_OR_SET_PARAM: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.SETPARAM,
- acceptedTarget = AnnotationTarget.PROPERTY_SETTER
+ acceptedTargets = setOf(AnnotationTarget.PROPERTY_SETTER)
)
val FILE: UseSiteFilter = Impl(
acceptedSiteTarget = AnnotationUseSiteTarget.FILE,
- acceptedTarget = AnnotationTarget.FILE,
+ acceptedTargets = setOf(AnnotationTarget.FILE),
acceptNoTarget = false
)
- private fun KSAnnotation.getDeclaredTargets(
+ internal fun KSAnnotation.getDeclaredTargets(
env: KspProcessingEnv
): Set<AnnotationTarget> {
val annotationDeclaration = this.annotationType.resolve().declaration
@@ -220,4 +227,4 @@
return qualifiedName == annotationClass.qualifiedName
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotationBox.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotationBox.kt
index db2a069..d997e57 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotationBox.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspAnnotationBox.kt
@@ -201,4 +201,4 @@
@Suppress("UNCHECKED_CAST", "BanUncheckedReflection")
return enumClass.getDeclaredMethod("valueOf", String::class.java)
.invoke(null, enumValue) as R?
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspArrayType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspArrayType.kt
index 74a142a..db7d512 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspArrayType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspArrayType.kt
@@ -20,6 +20,7 @@
import androidx.room.compiler.processing.XArrayType
import androidx.room.compiler.processing.XNullability
import androidx.room.compiler.processing.XType
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.google.devtools.ksp.symbol.Variance
import com.squareup.kotlinpoet.javapoet.JTypeName
@@ -28,9 +29,10 @@
internal sealed class KspArrayType(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
-) : KspType(env, ksType, scope, typeAlias), XArrayType {
+) : KspType(env, ksType, originalKSAnnotations, scope, typeAlias), XArrayType {
abstract override val componentType: KspType
@@ -53,9 +55,10 @@
private class BoxedArray(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
- ) : KspArrayType(env, ksType, scope, typeAlias) {
+ ) : KspArrayType(env, ksType, originalKSAnnotations, scope, typeAlias) {
override fun resolveJTypeName(): JTypeName {
return JArrayTypeName.of(componentType.asTypeName().java.box())
}
@@ -77,9 +80,10 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
- ) = BoxedArray(env, ksType, scope, typeAlias)
+ ) = BoxedArray(env, ksType, originalKSAnnotations, scope, typeAlias)
}
/**
@@ -88,10 +92,11 @@
private class PrimitiveArray(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
override val componentType: KspType,
- ) : KspArrayType(env, ksType, scope, typeAlias) {
+ ) : KspArrayType(env, ksType, originalKSAnnotations, scope, typeAlias) {
override fun resolveJTypeName(): JTypeName {
return JArrayTypeName.of(componentType.asTypeName().java.unbox())
}
@@ -103,9 +108,10 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
- ) = PrimitiveArray(env, ksType, scope, typeAlias, componentType)
+ ) = PrimitiveArray(env, ksType, originalKSAnnotations, scope, typeAlias, componentType)
}
/**
@@ -182,4 +188,4 @@
companion object {
const val KOTLIN_ARRAY_Q_NAME = "kotlin.Array"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspBasicAnnotationProcessor.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspBasicAnnotationProcessor.kt
index dd842c2..c625ec1 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspBasicAnnotationProcessor.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspBasicAnnotationProcessor.kt
@@ -93,4 +93,4 @@
delegate.exception(e)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspConstructorElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspConstructorElement.kt
index a452ced..4a0275a 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspConstructorElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspConstructorElement.kt
@@ -16,6 +16,7 @@
package androidx.room.compiler.processing.ksp
+import androidx.room.compiler.processing.XAnnotated
import androidx.room.compiler.processing.XConstructorElement
import androidx.room.compiler.processing.XConstructorType
import androidx.room.compiler.processing.XExecutableParameterElement
@@ -25,7 +26,13 @@
internal class KspConstructorElement(
env: KspProcessingEnv,
declaration: KSFunctionDeclaration
-) : KspExecutableElement(env, declaration), XConstructorElement {
+) : KspExecutableElement(env, declaration),
+ XAnnotated by KspAnnotated.create(
+ env = env,
+ delegate = declaration,
+ filter = KspAnnotated.UseSiteFilter.NO_USE_SITE_OR_CONSTRUCTOR
+ ),
+ XConstructorElement {
override val name: String
get() = "<init>"
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspElement.kt
index 077063f..d04c89c 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspElement.kt
@@ -64,4 +64,4 @@
override fun validate(): Boolean {
return declaration.validate()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspEnumEntry.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspEnumEntry.kt
index 1ba62df..4552925 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspEnumEntry.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspEnumEntry.kt
@@ -65,4 +65,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspExecutableElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspExecutableElement.kt
index 17a4ee4..ee283c1a 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspExecutableElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspExecutableElement.kt
@@ -16,13 +16,11 @@
package androidx.room.compiler.processing.ksp
-import androidx.room.compiler.processing.XAnnotated
import androidx.room.compiler.processing.XExecutableElement
import androidx.room.compiler.processing.XHasModifiers
import androidx.room.compiler.processing.XMemberContainer
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.XTypeParameterElement
-import androidx.room.compiler.processing.ksp.KspAnnotated.UseSiteFilter.Companion.NO_USE_SITE
import androidx.room.compiler.processing.util.ISSUE_TRACKER_LINK
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.isConstructor
@@ -33,12 +31,7 @@
override val declaration: KSFunctionDeclaration
) : KspElement(env, declaration),
XExecutableElement,
- XHasModifiers by KspHasModifiers.create(declaration),
- XAnnotated by KspAnnotated.create(
- env = env,
- delegate = declaration,
- filter = NO_USE_SITE
- ) {
+ XHasModifiers by KspHasModifiers.create(declaration) {
override val jvmDescriptor: String
get() = this.jvmDescriptor()
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFileMemberContainer.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFileMemberContainer.kt
index 370d338..58171da 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFileMemberContainer.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFileMemberContainer.kt
@@ -103,4 +103,4 @@
}?.value?.toString() ?: fileName.replace(".kt", "Kt")
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMemberContainer.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMemberContainer.kt
index a6d0a79..15605fa 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMemberContainer.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMemberContainer.kt
@@ -22,4 +22,4 @@
internal interface KspMemberContainer : XMemberContainer {
override val type: KspType?
val declaration: KSDeclaration?
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMethodElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMethodElement.kt
index 763054c..472435f 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMethodElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspMethodElement.kt
@@ -16,6 +16,7 @@
package androidx.room.compiler.processing.ksp
+import androidx.room.compiler.processing.XAnnotated
import androidx.room.compiler.processing.XExecutableParameterElement
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XMethodType
@@ -33,7 +34,13 @@
env: KspProcessingEnv,
declaration: KSFunctionDeclaration,
val isSyntheticStatic: Boolean
-) : KspExecutableElement(env, declaration), XMethodElement {
+) : KspExecutableElement(env, declaration),
+ XAnnotated by KspAnnotated.create(
+ env = env,
+ delegate = declaration,
+ filter = KspAnnotated.UseSiteFilter.NO_USE_SITE_OR_METHOD
+ ),
+ XMethodElement {
override val name: String
get() = declaration.simpleName.asString()
@@ -190,4 +197,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspPrimitiveType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspPrimitiveType.kt
index 2035e3a..21d3589 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspPrimitiveType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspPrimitiveType.kt
@@ -17,6 +17,7 @@
package androidx.room.compiler.processing.ksp
import androidx.room.compiler.processing.tryUnbox
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.KTypeName
@@ -31,8 +32,9 @@
internal class KspPrimitiveType(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
typeAlias: KSType? = null,
-) : KspType(env, ksType, null, typeAlias) {
+) : KspType(env, ksType, originalKSAnnotations, null, typeAlias) {
override fun resolveJTypeName(): JTypeName {
return ksType.asJTypeName(env.resolver).tryUnbox()
}
@@ -51,7 +53,8 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
- ) = KspPrimitiveType(env, ksType, typeAlias)
+ ) = KspPrimitiveType(env, ksType, originalKSAnnotations, typeAlias)
}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
index 00bff9c..e17e57f3 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
@@ -31,6 +31,7 @@
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.symbol.ClassKind
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.KSFile
import com.google.devtools.ksp.symbol.KSType
@@ -199,6 +200,7 @@
ksType: KSType
): KspType {
return wrap(
+ originalAnnotations = originatingReference.annotations,
ksType = ksType,
allowPrimitives = !originatingReference.isTypeParameterReference()
)
@@ -220,11 +222,16 @@
val declaration = typeRef.resolve().declaration
// inline classes can't be non-invariant.
if (declaration.isValueClass()) {
- return KspValueClassArgumentType(env = this, typeArg = ksTypeArgument)
+ return KspValueClassArgumentType(
+ env = this,
+ typeArg = ksTypeArgument,
+ originalKSAnnotations = ksTypeArgument.annotations
+ )
}
// fully resolved type argument, return regular type.
return wrap(
+ ksTypeArgument.annotations,
ksType = typeRef.resolve(),
allowPrimitives = false
)
@@ -244,29 +251,39 @@
* decision.
*/
fun wrap(ksType: KSType, allowPrimitives: Boolean): KspType {
+ return wrap(ksType.annotations, ksType, allowPrimitives)
+ }
+
+ fun wrap(
+ originalAnnotations: Sequence<KSAnnotation>,
+ ksType: KSType,
+ allowPrimitives: Boolean
+ ): KspType {
val declaration = ksType.declaration
if (declaration is KSTypeAlias) {
return wrap(
+ originalAnnotations = originalAnnotations,
ksType = ksType.replaceTypeAliases(resolver),
allowPrimitives = allowPrimitives && ksType.nullability == Nullability.NOT_NULL
).copyWithTypeAlias(ksType)
}
val qName = ksType.declaration.qualifiedName?.asString()
if (declaration is KSTypeParameter) {
- return KspTypeVariableType(this, ksType)
+ return KspTypeVariableType(this, ksType, originalAnnotations)
}
if (allowPrimitives && qName != null && ksType.nullability == Nullability.NOT_NULL) {
// check for primitives
val javaPrimitive = KspTypeMapper.getPrimitiveJavaTypeName(qName)
if (javaPrimitive != null) {
- return KspPrimitiveType(this, ksType)
+ return KspPrimitiveType(this, ksType, originalAnnotations)
}
// special case for void
if (qName == "kotlin.Unit") {
return voidType
}
}
- return arrayTypeFactory.createIfArray(ksType) ?: DefaultKspType(this, ksType)
+ return arrayTypeFactory.createIfArray(ksType)
+ ?: DefaultKspType(this, ksType, originalAnnotations)
}
fun wrapClassDeclaration(declaration: KSClassDeclaration): KspTypeElement {
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBox.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBox.kt
index d07a36e..3984598 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBox.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBox.kt
@@ -119,4 +119,4 @@
}.toTypedArray()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
index eeec74e..7333f7d 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
@@ -49,6 +49,8 @@
internal abstract class KspType(
env: KspProcessingEnv,
val ksType: KSType,
+ // This is needed as a workaround until https://github.com/google/ksp/issues/1376 is fixed.
+ val originalKSAnnotations: Sequence<KSAnnotation>,
/** Type resolver to convert KSType into its JVM representation. */
val scope: KSTypeVarianceResolverScope?,
/** The `typealias` that was resolved to get the [ksType], or null if none exists. */
@@ -219,7 +221,7 @@
}
}
- override fun annotations(): Sequence<KSAnnotation> = ksType.annotations
+ override fun annotations(): Sequence<KSAnnotation> = originalKSAnnotations
override fun isNone(): Boolean {
// even void is converted to Unit so we don't have none type in KSP
@@ -274,17 +276,21 @@
abstract fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?,
): KspType
- fun copyWithScope(scope: KSTypeVarianceResolverScope) = copy(env, ksType, scope, typeAlias)
+ fun copyWithScope(scope: KSTypeVarianceResolverScope) =
+ copy(env, ksType, originalKSAnnotations, scope, typeAlias)
- fun copyWithTypeAlias(typeAlias: KSType) = copy(env, ksType, scope, typeAlias)
+ fun copyWithTypeAlias(typeAlias: KSType) =
+ copy(env, ksType, originalKSAnnotations, scope, typeAlias)
private fun copyWithNullability(nullability: XNullability): KspType = boxed().copy(
env = env,
ksType = ksType.withNullability(nullability),
+ originalKSAnnotations = originalKSAnnotations,
scope = scope,
typeAlias = typeAlias,
)
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
index bd262c6..4ad76ad 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
@@ -17,6 +17,7 @@
package androidx.room.compiler.processing.ksp
import androidx.room.compiler.processing.XType
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.google.devtools.ksp.symbol.KSTypeArgument
import com.google.devtools.ksp.symbol.KSTypeParameter
@@ -32,11 +33,13 @@
internal class KspTypeArgumentType(
env: KspProcessingEnv,
val typeArg: KSTypeArgument,
+ originalKSAnnotations: Sequence<KSAnnotation> = typeArg.annotations,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
) : KspType(
env = env,
ksType = typeArg.requireType(),
+ originalKSAnnotations = originalKSAnnotations,
scope = scope,
typeAlias = typeAlias,
) {
@@ -77,11 +80,13 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
) = KspTypeArgumentType(
env = env,
typeArg = DelegatingTypeArg(typeArg, type = ksType.createTypeReference()),
+ originalKSAnnotations,
scope = scope,
typeAlias = typeAlias
)
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeElement.kt
index 3352b8b..63b4238 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeElement.kt
@@ -99,31 +99,18 @@
null
} else {
declaration.superTypes
- .map { it.resolve() }
.singleOrNull {
- (it.declaration as? KSClassDeclaration)?.classKind == ClassKind.CLASS
- }?.let {
- env.wrap(
- ksType = it,
- allowPrimitives = false
- )
- } ?: env.commonTypes.anyType
+ (it.resolve().declaration as? KSClassDeclaration)?.classKind == ClassKind.CLASS
+ }?.let { env.wrap(it) }
+ ?: env.commonTypes.anyType
}
}
override val superInterfaces by lazy {
- declaration.superTypes.asSequence().map {
- it.resolve()
- }
- .filter {
- it.declaration is KSClassDeclaration &&
- (it.declaration as KSClassDeclaration).classKind == ClassKind.INTERFACE
- }.mapTo(mutableListOf()) {
- env.wrap(
- ksType = it,
- allowPrimitives = false
- )
- }
+ declaration.superTypes.asSequence()
+ .filter {
+ (it.resolve().declaration as? KSClassDeclaration)?.classKind == ClassKind.INTERFACE
+ }.mapTo(mutableListOf()) { env.wrap(it) }
}
@Deprecated(
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeParameterElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeParameterElement.kt
index fe3f77e..64e518b 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeParameterElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeParameterElement.kt
@@ -53,4 +53,4 @@
override val closestMemberContainer: XMemberContainer
get() = enclosingElement.closestMemberContainer
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeVariableType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeVariableType.kt
index 43d1d17..04ea9f7 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeVariableType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeVariableType.kt
@@ -18,6 +18,7 @@
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.XTypeVariableType
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.google.devtools.ksp.symbol.KSTypeParameter
import com.squareup.kotlinpoet.javapoet.JTypeName
@@ -26,8 +27,9 @@
internal class KspTypeVariableType(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
scope: KSTypeVarianceResolverScope? = null,
-) : KspType(env, ksType, scope, null), XTypeVariableType {
+) : KspType(env, ksType, originalKSAnnotations, scope, null), XTypeVariableType {
private val typeVariable: KSTypeParameter by lazy {
// Note: This is a workaround for a bug in KSP where we may get ERROR_TYPE in the bounds
// (https://github.com/google/ksp/issues/1250). To work around it we get the matching
@@ -54,7 +56,8 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
- ) = KspTypeVariableType(env, ksType, scope)
-}
\ No newline at end of file
+ ) = KspTypeVariableType(env, ksType, originalKSAnnotations, scope)
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspValueClassArgumentType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspValueClassArgumentType.kt
index 465ee0f..6bb0472 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspValueClassArgumentType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspValueClassArgumentType.kt
@@ -16,6 +16,7 @@
package androidx.room.compiler.processing.ksp
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.google.devtools.ksp.symbol.KSTypeArgument
import com.google.devtools.ksp.symbol.KSTypeReference
@@ -32,11 +33,13 @@
env: KspProcessingEnv,
// Using KSTypeArgument rather than resolved type to indicate do not inline in type name.
val typeArg: KSTypeArgument,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
) : KspType(
env = env,
ksType = typeArg.requireType(),
+ originalKSAnnotations = originalKSAnnotations,
scope = scope,
typeAlias = typeAlias,
) {
@@ -55,11 +58,13 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?
) = KspValueClassArgumentType(
env = env,
typeArg = DelegatingTypeArg(typeArg, type = ksType.createTypeReference()),
+ originalKSAnnotations = originalKSAnnotations,
scope = scope,
typeAlias = typeAlias
)
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspVoidType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspVoidType.kt
index 9af6ba0..864fad6 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspVoidType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspVoidType.kt
@@ -17,6 +17,7 @@
package androidx.room.compiler.processing.ksp
import androidx.room.compiler.processing.XNullability
+import com.google.devtools.ksp.symbol.KSAnnotation
import com.google.devtools.ksp.symbol.KSType
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.KTypeName
@@ -31,10 +32,11 @@
internal class KspVoidType(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation> = ksType.annotations,
val boxed: Boolean,
scope: KSTypeVarianceResolverScope? = null,
typeAlias: KSType? = null,
-) : KspType(env, ksType, scope, typeAlias) {
+) : KspType(env, ksType, originalKSAnnotations, scope, typeAlias) {
override fun resolveJTypeName(): JTypeName {
return if (boxed || nullability == XNullability.NULLABLE) {
JTypeName.VOID.box()
@@ -64,7 +66,8 @@
override fun copy(
env: KspProcessingEnv,
ksType: KSType,
+ originalKSAnnotations: Sequence<KSAnnotation>,
scope: KSTypeVarianceResolverScope?,
typeAlias: KSType?,
- ) = KspVoidType(env, ksType, boxed, scope, typeAlias)
+ ) = KspVoidType(env, ksType, originalKSAnnotations, boxed, scope, typeAlias)
}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/OriginatingElementWrappers.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/OriginatingElementWrappers.kt
index 30aaa85..c0aac20 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/OriginatingElementWrappers.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/OriginatingElementWrappers.kt
@@ -97,4 +97,4 @@
return str == cs.toString()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainer.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainer.kt
index d584266..2f47522 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainer.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainer.kt
@@ -118,4 +118,4 @@
override fun hasAnnotationWithPackage(pkg: String): Boolean {
return false
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticNoArgConstructorElement.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticNoArgConstructorElement.kt
index bcdca26..037953e 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticNoArgConstructorElement.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticNoArgConstructorElement.kt
@@ -16,10 +16,12 @@
package androidx.room.compiler.processing.ksp.synthetic
+import androidx.room.compiler.processing.XAnnotated
import androidx.room.compiler.processing.XConstructorElement
import androidx.room.compiler.processing.XConstructorType
import androidx.room.compiler.processing.XExecutableParameterElement
import androidx.room.compiler.processing.XType
+import androidx.room.compiler.processing.ksp.KspAnnotated
import androidx.room.compiler.processing.ksp.KspConstructorType
import androidx.room.compiler.processing.ksp.KspExecutableElement
import androidx.room.compiler.processing.ksp.KspProcessingEnv
@@ -35,7 +37,13 @@
internal class KspSyntheticNoArgConstructorElement(
env: KspProcessingEnv,
declaration: KSFunctionDeclaration
-) : KspExecutableElement(env, declaration), XConstructorElement {
+) : KspExecutableElement(env, declaration),
+ XAnnotated by KspAnnotated.create(
+ env = env,
+ delegate = declaration,
+ filter = KspAnnotated.UseSiteFilter.NO_USE_SITE_OR_CONSTRUCTOR
+ ),
+ XConstructorElement {
override val enclosingElement: KspTypeElement by lazy {
declaration.requireEnclosingMemberContainer(env) as? KspTypeElement
@@ -64,4 +72,4 @@
containing = other
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticPropertyMethodType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticPropertyMethodType.kt
index d1bd312..7341b8a 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticPropertyMethodType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticPropertyMethodType.kt
@@ -118,4 +118,4 @@
// setters always return Unit, no need to get it as type of
get() = origin.returnType
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/ErrorMessages.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/ErrorMessages.kt
index 1386a08..6393e6c 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/ErrorMessages.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/ErrorMessages.kt
@@ -19,4 +19,4 @@
/**
* Link to the issue tracker to report bugs.
*/
-internal val ISSUE_TRACKER_LINK = "https://issuetracker.google.com/issues/new?component=413107"
\ No newline at end of file
+internal val ISSUE_TRACKER_LINK = "https://issuetracker.google.com/issues/new?component=413107"
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/NamingUtils.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/NamingUtils.kt
index dff43f4..0c4f87d 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/NamingUtils.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/util/NamingUtils.kt
@@ -33,4 +33,4 @@
/**
* Returns true if the given name can be used in generated java sources.
*/
-internal fun String.isValidJavaSourceName() = SourceVersion.isName(this)
\ No newline at end of file
+internal fun String.isValidJavaSourceName() = SourceVersion.isName(this)
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/codegen/XTypeNameTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/codegen/XTypeNameTest.kt
index b505fd7..e93dfd6 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/codegen/XTypeNameTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/codegen/XTypeNameTest.kt
@@ -176,4 +176,4 @@
assertThat(XTypeName.getProducerExtendsName(typeName).kotlin)
.isEqualTo(XTypeName.UNAVAILABLE_KTYPE_NAME)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/FallbackLocationInformationTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/FallbackLocationInformationTest.kt
index c27bf96..fd831e9 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/FallbackLocationInformationTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/FallbackLocationInformationTest.kt
@@ -179,4 +179,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/InternalModifierTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/InternalModifierTest.kt
index 37045ee..7a380e5 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/InternalModifierTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/InternalModifierTest.kt
@@ -167,4 +167,4 @@
val ksp: List<String>,
val kapt: List<String>
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/KspClassFileUtilityTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/KspClassFileUtilityTest.kt
index edabcf3..88e08ca 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/KspClassFileUtilityTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/KspClassFileUtilityTest.kt
@@ -208,4 +208,4 @@
@Parameterized.Parameters(name = "preCompile_{0}")
fun params() = arrayOf(false, true)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/MemoizedSequenceTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/MemoizedSequenceTest.kt
index 00698c5..704fd1d 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/MemoizedSequenceTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/MemoizedSequenceTest.kt
@@ -91,4 +91,4 @@
assertThat(result.exceptionOrNull()).isInstanceOf<NoSuchElementException>()
assertThat(collected).containsExactly(1, 2, 3)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/OriginatingElementsTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/OriginatingElementsTest.kt
index 37e581f..0d4d22f 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/OriginatingElementsTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/OriginatingElementsTest.kt
@@ -179,4 +179,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TopLevelMembersTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TopLevelMembersTest.kt
index e38cfbf2..754142b 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TopLevelMembersTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TopLevelMembersTest.kt
@@ -94,4 +94,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
index 9fb3c69..9639527 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
@@ -100,4 +100,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
index e478234..79977bf 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
@@ -803,4 +803,4 @@
invocation.assertReturnType("methodReturnT2", "Foo<Bar<? extends Baz>>")
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XAnnotationTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XAnnotationTest.kt
index f6d83c7..a66e60f 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XAnnotationTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XAnnotationTest.kt
@@ -1133,8 +1133,20 @@
.getAllAnnotations()
.map(XAnnotation::typeElement)
}
- assertThat(getDeclaredFieldAnnotationElements("valField")).doesNotContain(myAnnotation)
- assertThat(getDeclaredFieldAnnotationElements("varField")).doesNotContain(myAnnotation)
+ if (!invocation.isKsp && preCompiled) {
+ // KAPT places property annotations without targets on the property, which
+ // then get put onto the synthetic $annotations method in the KAPT stub.
+ // Unfortunately, synthetic methods can only be read when processing the
+ // source so it's missing on precompiled class files:
+ // https://youtrack.jetbrains.com/issue/KT-34684
+ assertThat(getDeclaredFieldAnnotationElements("valField"))
+ .doesNotContain(myAnnotation)
+ assertThat(getDeclaredFieldAnnotationElements("varField"))
+ .doesNotContain(myAnnotation)
+ } else {
+ assertThat(getDeclaredFieldAnnotationElements("valField")).contains(myAnnotation)
+ assertThat(getDeclaredFieldAnnotationElements("varField")).contains(myAnnotation)
+ }
}
}
@@ -1152,14 +1164,16 @@
@Target(AnnotationTarget.TYPE)
annotation class A
@Target(
+ AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.FIELD,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.VALUE_PARAMETER,
- AnnotationTarget.TYPE
+ AnnotationTarget.TYPE,
)
annotation class B
@Target(
+ AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.FIELD,
AnnotationTarget.CONSTRUCTOR,
@@ -1168,6 +1182,7 @@
annotation class C
annotation class D
+ @B @C @D
class Subject @B @C @D constructor(
@B @C @D param: @A @B Foo<@A @B Bar>
) : @A @B FooImpl<@A @B Bar>(), @A @B Foo<@A @B Bar> {
@@ -1190,7 +1205,7 @@
class FooImpl<T> {}
class Bar {}
- @Target(ElementType.TYPE_USE)
+ @Target({ElementType.TYPE_USE})
@interface A {}
@Target({
ElementType.METHOD,
@@ -1205,10 +1220,12 @@
ElementType.FIELD,
ElementType.CONSTRUCTOR,
ElementType.PARAMETER,
+ ElementType.TYPE,
})
@interface C {}
@interface D {}
+ @B @C @D
class Subject extends @A @B FooImpl<@A @B Bar> implements @A @B Foo<@A @B Bar> {
@A @B @C @D Foo<@A @B Bar> field;
@B @C @D Subject(@A @B @C @D Foo<@A @B Bar> param) {}
@@ -1240,36 +1257,59 @@
val c = invocation.processingEnv.requireTypeElement("foo.bar.C")
val d = invocation.processingEnv.requireTypeElement("foo.bar.D")
+ // Check that the synthetic annotations method does not appear in the list of
+ // declared methods.
+ if (source == javaSource) {
+ assertThat(subject.getDeclaredMethods().map { it.name })
+ .containsExactly("method")
+ } else {
+ if (invocation.isKsp || preCompiled) {
+ assertThat(subject.getDeclaredMethods().map { it.name })
+ .containsExactly("getField", "method")
+ .inOrder()
+ } else {
+ // TODO(b/290800523): Remove the synthetic annotations method from the list
+ // of declared methods so that KAPT matches KSP.
+ assertThat(subject.getDeclaredMethods().map { it.name })
+ .containsExactly("getField", "getField\$annotations", "method")
+ .inOrder()
+ }
+ }
+
// Check the annotations on the elements
- if (!invocation.isKsp && source == kotlinSource) {
- // KAPT places property annotations without targets on the property, which then
- // get put onto the synthetic $annotations method in the KAPT stub.
- // Unfortunately, synthetic methods can only be read when processing the source
- // so it's missing on precompiled class files:
- // https://youtrack.jetbrains.com/issue/KT-34684
- // TODO(b/288415136): The following should be fixed for non-precompiled sources
- // where we can get the annotation from the $annotations method in KAPT.
- assertThat(field.getAllAnnotationTypeElements()).containsExactly(b, c)
- } else {
- assertThat(field.getAllAnnotationTypeElements()).containsExactly(b, c, d)
+ mapOf(
+ "class" to subject,
+ "field" to field,
+ "method" to method,
+ "methodParameter" to method.parameters.single(),
+ "constructor" to constructor,
+ "constructorParameter" to constructor.parameters.single(),
+ ).forEach { (desc, element) ->
+ if (element == field &&
+ !invocation.isKsp && source == kotlinSource && preCompiled) {
+ // KAPT places property annotations without targets on the property, which
+ // then get put onto the synthetic $annotations method in the KAPT stub.
+ // Unfortunately, synthetic methods can only be read when processing the
+ // source so it's missing on precompiled class files:
+ // https://youtrack.jetbrains.com/issue/KT-34684
+ assertWithMessage("$desc element: $element")
+ .that(element.getAllAnnotationTypeElements())
+ .containsExactly(b, c)
+ } else {
+ assertWithMessage("$desc element: $element")
+ .that(
+ // TODO(bcorso): Consider automatically removing kotlin.Metadata
+ // annotation so that KAPT and KSP agree, and exposing the metadata
+ // explicitly via a property of the type/element.
+ // Filter out kotlin.Metadata.
+ element.getAllAnnotationTypeElements()
+ .filterNot { it.qualifiedName == "kotlin.Metadata" }
+ )
+ .containsExactly(b, c, d)
+ }
}
- if (invocation.isKsp && source == javaSource && !preCompiled) {
- // TODO(b/288413750): The following cases should be fixed in KAPT to match KSP.
- // In particular, type-only annotation, A, should not show up on elements.
- assertThat(method.getAllAnnotationTypeElements()).containsExactly(a, b, c, d)
- } else {
- assertThat(method.getAllAnnotationTypeElements()).containsExactly(b, c, d)
- }
- assertThat(method.parameters.single().getAllAnnotationTypeElements())
- .containsExactly(b, c, d)
- assertThat(constructor.getAllAnnotationTypeElements()).containsExactly(b, c, d)
- assertThat(constructor.parameters.single().getAllAnnotationTypeElements())
- .containsExactly(b, c, d)
- val isKsp = invocation.isKsp
- val isJavaSource = source == javaSource
-
- // Check the annotations on the types
+ // Check the annotations on the types and type arguments
mapOf(
"superClass" to superClass,
"superInterface" to superInterface,
@@ -1278,55 +1318,20 @@
"methodParameter" to method.parameters.single().type,
"constructorParameter" to constructor.parameters.single().type,
).forEach { (desc, type) ->
- // We can't see type annotations from precompiled Java classes in JAVAC.
- // https://github.com/google/ksp/issues/1296
- if ((!isKsp && source == javaSource && preCompiled) ||
- // TODO(b/288415954): The following cases should be fixed in KSP to match
- // KAPT by working around https://github.com/google/ksp/issues/1325.
- (isKsp && isJavaSource && preCompiled && desc == "superClass") ||
- (isKsp && isJavaSource && preCompiled && desc == "superInterface") ||
- (isKsp && isJavaSource && preCompiled && desc == "field") ||
- (isKsp && isJavaSource && preCompiled && desc == "methodReturnType") ||
- (isKsp && isJavaSource && preCompiled && desc == "methodParameter") ||
- (isKsp && isJavaSource && preCompiled && desc == "constructorParameter") ||
- (isKsp && !preCompiled && desc == "methodReturnType") ||
- (isKsp && !preCompiled && desc == "methodParameter") ||
- (isKsp && !preCompiled && desc == "field") ||
- (isKsp && !preCompiled && desc == "constructorParameter")
- ) {
+ if (!invocation.isKsp && source == javaSource && preCompiled) {
+ // We can't see type annotations from precompiled Java classes in JAVAC.
+ // https://github.com/google/ksp/issues/1296
assertWithMessage("$desc type: $type")
.that(type.getAllAnnotationTypeElements())
.isEmpty()
+ assertWithMessage("$desc type-argument: ${type.typeArguments[0]}")
+ .that(type.getAllAnnotationTypeElements())
+ .isEmpty()
} else {
assertWithMessage("$desc type: $type")
.that(type.getAllAnnotationTypeElements())
.containsExactly(a, b)
- }
- }
-
- // Check the annotations on the type arguments
- mapOf(
- "superClass" to superClass.typeArguments.single(),
- "superInterface" to superInterface.typeArguments.single(),
- "field" to field.type.typeArguments.single(),
- "methodReturnType" to method.returnType.typeArguments.single(),
- "methodParameter" to method.parameters.single().type.typeArguments.single(),
- "constructorParameter" to
- constructor.parameters.single().type.typeArguments.single(),
- ).forEach { (desc, type) ->
- // We can't see type annotations from precompiled Java classes in JAVAC.
- // https://github.com/google/ksp/issues/1296
- if ((!isKsp && isJavaSource && preCompiled) ||
- // TODO(b/288415954): The following cases should be fixed in KSP to match
- // KAPT by working around https://github.com/google/ksp/issues/1325.
- (isKsp && !preCompiled) ||
- (isKsp && isJavaSource && preCompiled)
- ) {
- assertWithMessage("$desc type-argument: $type")
- .that(type.getAllAnnotationTypeElements())
- .isEmpty()
- } else {
- assertWithMessage("$desc type-argument: $type")
+ assertWithMessage("$desc type-argument: ${type.typeArguments[0]}")
.that(type.getAllAnnotationTypeElements())
.containsExactly(a, b)
}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XElementTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XElementTest.kt
index 94b96f8..69ce06b 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XElementTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XElementTest.kt
@@ -807,8 +807,25 @@
// classpath.
@Test
fun enclosingElementKotlinCompanion() {
- runProcessorTestHelper(listOf(enclosingElementKotlinSourceCompanion)) {
- invocation, precompiled ->
+ runProcessorTestHelper(listOf(Source.kotlin(
+ "Test.kt",
+ """
+ package foo.bar
+ class KotlinClass(val property: String) {
+ companion object {
+ val companionObjectProperty: String = "hello"
+ @JvmStatic
+ val companionObjectPropertyJvmStatic: String = "hello"
+ @JvmField val companionObjectPropertyJvmField: String = "hello"
+ lateinit var companionObjectPropertyLateinit: String
+ const val companionObjectPropertyConst: String = "hello"
+ fun companionObjectFunction(companionFunctionParam: String) {}
+ @JvmStatic
+ fun companionObjectFunctionJvmStatic(companionFunctionParam: String) {}
+ }
+ }
+ """.trimIndent()
+ ))) { invocation, precompiled ->
val enclosingElement =
invocation.processingEnv.requireTypeElement("foo.bar.KotlinClass")
val companionObj = enclosingElement.getEnclosedTypeElements().first {
@@ -880,37 +897,27 @@
methods.forEach {
assertThat(it.enclosingElement).isEqualTo(companionObj)
}
-
- if (invocation.isKsp) {
+ if (invocation.isKsp || precompiled) {
assertThat(methods.map { it.name }).containsExactly(
"getCompanionObjectProperty",
"getCompanionObjectPropertyJvmStatic",
"getCompanionObjectPropertyLateinit",
"setCompanionObjectPropertyLateinit",
"companionObjectFunction",
- "companionObjectFunctionJvmStatic",
- )
+ "companionObjectFunctionJvmStatic"
+ ).inOrder()
} else {
- if (precompiled) {
- assertThat(methods.map { it.name }).containsExactly(
- "getCompanionObjectProperty",
- "getCompanionObjectPropertyJvmStatic",
- "getCompanionObjectPropertyLateinit",
- "setCompanionObjectPropertyLateinit",
- "companionObjectFunction",
- "companionObjectFunctionJvmStatic"
- )
- } else {
- assertThat(methods.map { it.name }).containsExactly(
- "getCompanionObjectProperty",
- "getCompanionObjectPropertyJvmStatic",
- "getCompanionObjectPropertyJvmStatic\$annotations",
- "getCompanionObjectPropertyLateinit",
- "setCompanionObjectPropertyLateinit",
- "companionObjectFunction",
- "companionObjectFunctionJvmStatic"
- )
- }
+ // TODO(b/290800523): Remove the synthetic annotations method from the list
+ // of declared methods so that KAPT matches KSP.
+ assertThat(methods.map { it.name }).containsExactly(
+ "getCompanionObjectProperty",
+ "getCompanionObjectPropertyJvmStatic",
+ "getCompanionObjectPropertyJvmStatic\$annotations",
+ "getCompanionObjectPropertyLateinit",
+ "setCompanionObjectPropertyLateinit",
+ "companionObjectFunction",
+ "companionObjectFunctionJvmStatic"
+ ).inOrder()
}
}
}
@@ -1098,26 +1105,6 @@
""".trimIndent()
)
- private val enclosingElementKotlinSourceCompanion = Source.kotlin(
- "Test.kt",
- """
- package foo.bar
- class KotlinClass(val property: String) {
- companion object {
- val companionObjectProperty: String = "hello"
- @JvmStatic
- val companionObjectPropertyJvmStatic: String = "hello"
- @JvmField val companionObjectPropertyJvmField: String = "hello"
- lateinit var companionObjectPropertyLateinit: String
- const val companionObjectPropertyConst: String = "hello"
- fun companionObjectFunction(companionFunctionParam: String) {}
- @JvmStatic
- fun companionObjectFunctionJvmStatic(companionFunctionParam: String) {}
- }
- }
- """.trimIndent()
- )
-
private val enclosingElementKotlinSourceTopLevel = Source.kotlin(
"Test.kt",
"""
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XFilerTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XFilerTest.kt
index 42194fb..8029095 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XFilerTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XFilerTest.kt
@@ -56,4 +56,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingEnvConfigTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingEnvConfigTest.kt
index 17db4a1..65972b9 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingEnvConfigTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingEnvConfigTest.kt
@@ -60,4 +60,4 @@
).isTrue()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingStepTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingStepTest.kt
index 412b8a0..d956499 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingStepTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XProcessingStepTest.kt
@@ -1533,4 +1533,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRawTypeTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRawTypeTest.kt
index b10e555..f507ee8 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRawTypeTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRawTypeTest.kt
@@ -112,4 +112,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRoundEnvTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRoundEnvTest.kt
index c031a1f..ac2658a 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRoundEnvTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XRoundEnvTest.kt
@@ -23,8 +23,6 @@
import androidx.room.compiler.processing.testcode.OtherAnnotation
import androidx.room.compiler.processing.util.Source
import androidx.room.compiler.processing.util.getDeclaredMethodByJvmName
-import androidx.room.compiler.processing.util.getField
-import androidx.room.compiler.processing.util.getMethodByJvmName
import androidx.room.compiler.processing.util.runKspTest
import androidx.room.compiler.processing.util.runProcessorTest
import com.squareup.kotlinpoet.INT
@@ -54,27 +52,24 @@
val annotatedElementsByClass = testInvocation.roundEnv.getElementsAnnotatedWith(
OtherAnnotation::class
)
-
val annotatedElementsByName = testInvocation.roundEnv.getElementsAnnotatedWith(
OtherAnnotation::class.qualifiedName!!
)
-
- val targetElement = testInvocation.processingEnv.requireTypeElement("Baz")
-
- assertThat(
- annotatedElementsByClass
- ).apply {
- containsExactlyElementsIn(annotatedElementsByName)
- hasSize(3)
- contains(targetElement)
- contains(targetElement.getMethodByJvmName("myFunction"))
-
- if (testInvocation.isKsp) {
- contains(targetElement.getField("myProperty"))
- } else {
- // Javac sees a property annotation on the synthetic function
- contains(targetElement.getDeclaredMethodByJvmName("getMyProperty\$annotations"))
- }
+ assertThat(annotatedElementsByClass).containsExactlyElementsIn(annotatedElementsByName)
+ if (testInvocation.isKsp) {
+ assertThat(annotatedElementsByClass.map { it.name }).containsExactly(
+ "Baz",
+ "myProperty",
+ "myFunction",
+ )
+ } else {
+ assertThat(annotatedElementsByClass.map { it.name }).containsExactly(
+ "Baz",
+ // TODO(b/290234031): Fix XRoundEnv to return the property rather than the
+ // synthetic "$annotations" method in KAPT
+ "getMyProperty\$annotations",
+ "myFunction",
+ )
}
}
}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/compat/XConvertersTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/compat/XConvertersTest.kt
index 3c7a35c..d229610 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/compat/XConvertersTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/compat/XConvertersTest.kt
@@ -714,4 +714,4 @@
private fun XTestInvocation.getKspTypeElement(fqn: String) =
(this.processingEnv as KspProcessingEnv).resolver.getClassDeclarationByName(
KSNameImpl.getCached(fqn))!!
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtilsTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtilsTest.kt
index 0a926be..86d3822 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtilsTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/JvmDescriptorUtilsTest.kt
@@ -440,4 +440,4 @@
}
}).compilesWithoutError()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/KotlinMetadataElementTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/KotlinMetadataElementTest.kt
index 465c89b..eb676b6 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/KotlinMetadataElementTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/javac/kotlin/KotlinMetadataElementTest.kt
@@ -941,4 +941,4 @@
@Parameterized.Parameters(name = "preCompiled_{0}")
fun params() = arrayOf(false, true)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
index 6579008..3053d5e 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
@@ -171,4 +171,4 @@
val kspSignaturesMap: Map<String, List<String>>,
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspJvmDescriptorUtilsTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspJvmDescriptorUtilsTest.kt
index 3334403..a0781bf 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspJvmDescriptorUtilsTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspJvmDescriptorUtilsTest.kt
@@ -560,4 +560,4 @@
return listOf(arrayOf(false), arrayOf(true))
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBoxTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBoxTest.kt
index 236565a..c4e1e87 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBoxTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspReflectiveAnnotationBoxTest.kt
@@ -86,4 +86,4 @@
it is TestAnnotation
} as T
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
index 2e4ada9..f421d26 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
@@ -1125,4 +1125,4 @@
subjects = subjects + other.subjects
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeTest.kt
index a62a731..1808bb1 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeTest.kt
@@ -620,4 +620,4 @@
assertParamType(asMember.parameterTypes.first())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainerTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainerTest.kt
index 9a98a35..134aed5 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainerTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/synthetic/KspSyntheticFileMemberContainerTest.kt
@@ -153,4 +153,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/GetMethodsScenarioTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/GetMethodsScenarioTest.kt
index ec1b072..09ef22f 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/GetMethodsScenarioTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/GetMethodsScenarioTest.kt
@@ -126,4 +126,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/ProfileRule.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/ProfileRule.kt
index b14ba17..7c66f69 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/ProfileRule.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/ProfileRule.kt
@@ -142,4 +142,4 @@
System.getenv("ANDROIDX_ROOM_ENABLE_PROFILE_TESTS") != null
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/RawTypeCreationScenarioTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/RawTypeCreationScenarioTest.kt
index 83dabc8..2016f60 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/RawTypeCreationScenarioTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/profiling/RawTypeCreationScenarioTest.kt
@@ -55,4 +55,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/util/XTestInvocationExt.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/util/XTestInvocationExt.kt
index b98e232..c4ecf62 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/util/XTestInvocationExt.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/util/XTestInvocationExt.kt
@@ -32,4 +32,4 @@
get() = (processingEnv as JavacProcessingEnv).elementUtils
val XTestInvocation.javaTypeUtils: Types
- get() = (processingEnv as JavacProcessingEnv).typeUtils
\ No newline at end of file
+ get() = (processingEnv as JavacProcessingEnv).typeUtils
diff --git a/room/room-compiler/build.gradle b/room/room-compiler/build.gradle
index 0a16b6a..6d06fe8 100644
--- a/room/room-compiler/build.gradle
+++ b/room/room-compiler/build.gradle
@@ -103,7 +103,7 @@
implementation(libs.apacheCommonsCodec)
implementation(libs.intellijAnnotations)
testImplementation(libs.truth)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation(libs.testParameterInjector)
testImplementation(libs.autoValue) // to access the processor in tests
testImplementation(libs.autoServiceAnnotations)
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 62a4e01..fc37117 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt
@@ -188,4 +188,4 @@
excludeMethodsWithInvalidJvmSourceNames = !GENERATE_KOTLIN.getValue(options)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/RoomKspProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/RoomKspProcessor.kt
index e2f9e3f..f6cf1fa 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/RoomKspProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/RoomKspProcessor.kt
@@ -67,4 +67,4 @@
return RoomKspProcessor(environment)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/ext/xpoet_ext.kt b/room/room-compiler/src/main/kotlin/androidx/room/ext/xpoet_ext.kt
index 0312a38..e79616a 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/ext/xpoet_ext.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/ext/xpoet_ext.kt
@@ -553,4 +553,4 @@
CodeLanguage.KOTLIN -> "%L.keys" // kotlin.collections.Map.keys
},
varName
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/parser/ParsedQuery.kt b/room/room-compiler/src/main/kotlin/androidx/room/parser/ParsedQuery.kt
index 7aac0ef..feb772b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/parser/ParsedQuery.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/parser/ParsedQuery.kt
@@ -150,4 +150,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/parser/SingleQuerySqlParser.kt b/room/room-compiler/src/main/kotlin/androidx/room/parser/SingleQuerySqlParser.kt
index 18457bb..8b4a8be 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/parser/SingleQuerySqlParser.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/parser/SingleQuerySqlParser.kt
@@ -66,4 +66,4 @@
return fallback(syntaxErrors)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/parser/expansion/ExpandableSqlParser.kt b/room/room-compiler/src/main/kotlin/androidx/room/parser/expansion/ExpandableSqlParser.kt
index 25dc722..19c9d87 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/parser/expansion/ExpandableSqlParser.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/parser/expansion/ExpandableSqlParser.kt
@@ -227,4 +227,4 @@
}
)
}
-}
\ No newline at end of file
+}
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 52e5e67..cd1602c 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
@@ -306,4 +306,4 @@
return@firstOrNull true
}?.let { matchingMethod -> KotlinBoxedPrimitiveMethodDelegate(unannotated, matchingMethod) }
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
index 752a356..bb0f3c3 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
@@ -114,4 +114,4 @@
} else {
TableEntityProcessor(context, element, referenceStack)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
index 787cacf..ef45d53c 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/FtsTableEntityProcessor.kt
@@ -286,4 +286,4 @@
)
return LanguageId(languageIdField.element, languageIdField)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/PojoMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/PojoMethodProcessor.kt
index cec9a9d..ea0beac 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/PojoMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/PojoMethodProcessor.kt
@@ -35,4 +35,4 @@
resolvedType = asMember
)
}
-}
\ No newline at end of file
+}
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 bb1e0bd..86990ae 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
@@ -1168,4 +1168,4 @@
"option `room.schemaLocation`, please remove the configuration of the option and " +
"configure the schema location via the plugin project extension: " +
"`room { schemaDirectory(...) }`."
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryRewriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryRewriter.kt
index 7ca2a47..6fd3ac9 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryRewriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryRewriter.kt
@@ -34,4 +34,4 @@
override fun rewrite(query: ParsedQuery, resultAdapter: QueryResultAdapter) = query
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
index 6682188..f51988f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
@@ -169,4 +169,4 @@
context.logger.e(executableElement, ProcessorErrors.RAW_QUERY_BAD_PARAMS)
return null
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt
index 4b4a363..eabff2f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertionMethodProcessor.kt
@@ -92,4 +92,4 @@
methodBinder = methodBinder
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
index 35b8dcd..f275eff 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
@@ -117,4 +117,4 @@
return "$pkg${if (pkg.isEmpty()) "" else "."}AutoValue_$name"
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt
index 3318d56..75dd0cc 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt
@@ -65,4 +65,4 @@
addStatement(format, *params.toTypedArray())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt
index f4787ca..5642c1d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt
@@ -59,4 +59,4 @@
addStatement(format, *params.toTypedArray())
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/NullAwareTypeConverterStore.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/NullAwareTypeConverterStore.kt
index 0aac808..fbddfd2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/NullAwareTypeConverterStore.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/NullAwareTypeConverterStore.kt
@@ -488,4 +488,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/ObservableQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/ObservableQueryResultBinderProvider.kt
index 5dacce9..0f70775 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/ObservableQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/ObservableQueryResultBinderProvider.kt
@@ -61,4 +61,4 @@
}
data class OriginalTypeArg(val original: XType)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/QueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/QueryResultBinderProvider.kt
index cd5bc03..985ffc7 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/QueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/QueryResultBinderProvider.kt
@@ -28,4 +28,4 @@
): QueryResultBinder
fun matches(declared: XType): Boolean
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/RxTypes.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/RxTypes.kt
index 176238e..468cadc 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/RxTypes.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/RxTypes.kt
@@ -96,4 +96,4 @@
emptyResultExceptionClassName = RoomRxJava3TypeNames.RX_EMPTY_RESULT_SET_EXCEPTION,
missingArtifactMessage = ProcessorErrors.MISSING_ROOM_RXJAVA3_ARTIFACT
);
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterExtras.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterExtras.kt
index c485ff5..8e30735 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterExtras.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterExtras.kt
@@ -32,4 +32,4 @@
fun <T : Any> putData(key: KClass<T>, value: T) {
data[key] = value
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStore.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStore.kt
index 0b7d0af..e710f72 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStore.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStore.kt
@@ -101,4 +101,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStoreImpl.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStoreImpl.kt
index 848addf..4d508958 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStoreImpl.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeConverterStoreImpl.kt
@@ -149,4 +149,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
index 862511c..ddd7285 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CoroutineFlowResultBinderProvider.kt
@@ -80,4 +80,4 @@
}
return typeName == KotlinTypeNames.FLOW
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CursorQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CursorQueryResultBinderProvider.kt
index cf1fdb7..1db2f0d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CursorQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/CursorQueryResultBinderProvider.kt
@@ -36,4 +36,4 @@
override fun matches(declared: XType): Boolean =
declared.typeArguments.isEmpty() && declared.asTypeName() == AndroidTypeNames.CURSOR
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/InstantQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/InstantQueryResultBinderProvider.kt
index f799fd3..08d63d9 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/InstantQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/InstantQueryResultBinderProvider.kt
@@ -36,4 +36,4 @@
}
override fun matches(declared: XType): Boolean = true
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
index 3bd2cda..5607b05 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/LiveDataQueryResultBinderProvider.kt
@@ -55,4 +55,4 @@
}
return declared.rawType.isAssignableFrom(liveDataType!!)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/MultiTypedPagingSourceQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/MultiTypedPagingSourceQueryResultBinderProvider.kt
index 27b8783..7da8bda 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/MultiTypedPagingSourceQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/MultiTypedPagingSourceQueryResultBinderProvider.kt
@@ -88,4 +88,4 @@
return true
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/QueryResultBinderProviderWithRequiredArtifact.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/QueryResultBinderProviderWithRequiredArtifact.kt
index b21cda3..6a3682f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/QueryResultBinderProviderWithRequiredArtifact.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/QueryResultBinderProviderWithRequiredArtifact.kt
@@ -62,4 +62,4 @@
}
return result
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava2PagingSourceQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava2PagingSourceQueryResultBinderProvider.kt
index 4a8dd7aa..d1802c4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava2PagingSourceQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava2PagingSourceQueryResultBinderProvider.kt
@@ -36,4 +36,4 @@
requiredType = rxjava2PagingSource,
missingArtifactErrorMsg = MISSING_ROOM_PAGING_RXJAVA2_ARTIFACT
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava3PagingSourceQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava3PagingSourceQueryResultBinderProvider.kt
index f17c20d..de3582d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava3PagingSourceQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxJava3PagingSourceQueryResultBinderProvider.kt
@@ -36,4 +36,4 @@
requiredType = rxjava3PagingSource,
missingArtifactErrorMsg = MISSING_ROOM_PAGING_RXJAVA3_ARTIFACT
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
index 359d81e..94aed66 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/binderprovider/RxQueryResultBinderProvider.kt
@@ -72,4 +72,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/CallablePreparedQueryResultBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/CallablePreparedQueryResultBinder.kt
index dc4c4c6..0a06709 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/CallablePreparedQueryResultBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/CallablePreparedQueryResultBinder.kt
@@ -72,4 +72,4 @@
addStmntBlock(callableImpl, dbProperty)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt
index 41b29f0..7cf78d5 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt
@@ -42,4 +42,4 @@
scope = scope
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/PreparedQueryResultBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/PreparedQueryResultBinder.kt
index 73b521a..0f32876 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/PreparedQueryResultBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binder/PreparedQueryResultBinder.kt
@@ -38,4 +38,4 @@
dbProperty: XPropertySpec,
scope: CodeGenScope
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
index e6d78cd..1b54b55 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/GuavaListenableFuturePreparedQueryResultBinderProvider.kt
@@ -60,4 +60,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/InstantPreparedQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/InstantPreparedQueryResultBinderProvider.kt
index 190f99b..e2b156a 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/InstantPreparedQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/InstantPreparedQueryResultBinderProvider.kt
@@ -33,4 +33,4 @@
) = InstantPreparedQueryResultBinder(
context.typeAdapterStore.findPreparedQueryResultAdapter(declared, query)
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/PreparedQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/PreparedQueryResultBinderProvider.kt
index f3756d7..86e97d0 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/PreparedQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/PreparedQueryResultBinderProvider.kt
@@ -35,4 +35,4 @@
* Provides a [PreparedQueryResultBinder]
*/
fun provide(declared: XType, query: ParsedQuery): PreparedQueryResultBinder
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
index 24ab2bb..466e5b9 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/binderprovider/RxPreparedQueryResultBinderProvider.kt
@@ -101,4 +101,4 @@
*/
override fun extractTypeArg(declared: XType): XType =
declared.typeArguments.first().makeNullable()
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/result/PreparedQueryResultAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/result/PreparedQueryResultAdapter.kt
index 18406e2..89be9b7 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/result/PreparedQueryResultAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/prepared/result/PreparedQueryResultAdapter.kt
@@ -109,4 +109,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineFlowResultBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineFlowResultBinder.kt
index 1d42950..fc5e066 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineFlowResultBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineFlowResultBinder.kt
@@ -76,4 +76,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt
index 8c8fd83..4838434 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt
@@ -135,4 +135,4 @@
endControlFlow()
transactionWrapper?.endTransactionWithControlFlow()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt
index e517dc6..3872ac8 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt
@@ -136,4 +136,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableListQueryResultAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableListQueryResultAdapter.kt
index 053a5d5..765a991 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableListQueryResultAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableListQueryResultAdapter.kt
@@ -67,4 +67,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt
index dd58f92..45b6b8b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt
@@ -49,4 +49,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/IndexAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/IndexAdapter.kt
index 09d9dda..5e51fc5 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/IndexAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/IndexAdapter.kt
@@ -33,4 +33,4 @@
fun onCursorReady(cursorVarName: String, scope: CodeGenScope)
fun getIndexVars(): List<ColumnIndexVar>
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/PojoIndexAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/PojoIndexAdapter.kt
index 0e695f3..e868677 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/PojoIndexAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/PojoIndexAdapter.kt
@@ -88,4 +88,4 @@
}
override fun getIndexVars() = columnIndexVars
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/QueryMappedRowAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/QueryMappedRowAdapter.kt
index e43f629..234af49 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/QueryMappedRowAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/QueryMappedRowAdapter.kt
@@ -30,4 +30,4 @@
abstract class Mapping {
abstract val usedColumns: List<String>
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableDeleteOrUpdateMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableDeleteOrUpdateMethodBinder.kt
index b9ab806..7d3af7d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableDeleteOrUpdateMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableDeleteOrUpdateMethodBinder.kt
@@ -70,4 +70,4 @@
addStmntBlock(callableImpl, dbProperty)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableInsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableInsertMethodBinder.kt
index fc1a242..8152905 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableInsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableInsertMethodBinder.kt
@@ -74,4 +74,4 @@
addStmntBlock(callableImpl, dbProperty)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableUpsertMethodBinder.kt
index 60f2654..ae0acfd 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CallableUpsertMethodBinder.kt
@@ -77,4 +77,4 @@
addStmntBlock(callableImpl, dbProperty)
}
}
-}
\ No newline at end of file
+}
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/DeleteOrUpdateMethodBinder.kt
index 2fcce7c..b1e85c7 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/DeleteOrUpdateMethodBinder.kt
@@ -59,4 +59,4 @@
dbProperty: XPropertySpec,
scope: CodeGenScope
)
-}
\ No newline at end of file
+}
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/InsertOrUpsertMethodBinder.kt
index a112e27..addc576 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/InsertOrUpsertMethodBinder.kt
@@ -54,4 +54,4 @@
dbProperty: XPropertySpec,
scope: CodeGenScope
)
-}
\ No newline at end of file
+}
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/InstantDeleteOrUpdateMethodBinder.kt
index 7c74c77..7b6580d 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/InstantDeleteOrUpdateMethodBinder.kt
@@ -45,4 +45,4 @@
scope = scope
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
index d0109cf..28d8e63 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
@@ -43,4 +43,4 @@
scope = scope
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantUpsertMethodBinder.kt
index 2fad367..46a42f8 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantUpsertMethodBinder.kt
@@ -43,4 +43,4 @@
scope = scope
)
}
-}
\ No newline at end of file
+}
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/DeleteOrUpdateMethodBinderProvider.kt
index fe35054..42c1a8d 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/DeleteOrUpdateMethodBinderProvider.kt
@@ -34,4 +34,4 @@
* Provider of [DeleteOrUpdateMethodAdapter], based on the [XType]
*/
fun provide(declared: XType): DeleteOrUpdateMethodBinder
-}
\ No newline at end of file
+}
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/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
index aaeb354..cb0a21f 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/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
@@ -62,4 +62,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
index 767a163..5a03387 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertMethodBinderProvider.kt
@@ -66,4 +66,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureUpsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureUpsertMethodBinderProvider.kt
index 660010c..2b807da 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureUpsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureUpsertMethodBinderProvider.kt
@@ -66,4 +66,4 @@
)
}
}
-}
\ No newline at end of file
+}
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/InsertOrUpsertMethodBinderProvider.kt
index e9ab381..a5cbbcb 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/InsertOrUpsertMethodBinderProvider.kt
@@ -34,4 +34,4 @@
* Provider of [InsertOrUpsertMethodBinder], based on the [XType] and the list of parameters
*/
fun provide(declared: XType, params: List<ShortcutQueryParameter>): InsertOrUpsertMethodBinder
-}
\ No newline at end of file
+}
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/InstantDeleteOrUpdateMethodBinderProvider.kt
index 139589d..e9afb06 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/InstantDeleteOrUpdateMethodBinderProvider.kt
@@ -34,4 +34,4 @@
val adapter = context.typeAdapterStore.findDeleteOrUpdateAdapter(declared)
return InstantDeleteOrUpdateMethodBinder(adapter)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
index 37e14d9..517a136 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
@@ -38,4 +38,4 @@
context.typeAdapterStore.findInsertAdapter(declared, params)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantUpsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantUpsertMethodBinderProvider.kt
index 6f4e8c9..d4e819d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantUpsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantUpsertMethodBinderProvider.kt
@@ -38,4 +38,4 @@
context.typeAdapterStore.findUpsertAdapter(declared, params)
)
}
-}
\ No newline at end of file
+}
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/DeleteOrUpdateMethodAdapter.kt
index e754baa..69fc2c3 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/DeleteOrUpdateMethodAdapter.kt
@@ -106,4 +106,4 @@
returnType.isNotVoidObject() &&
returnType.isNotKotlinUnit()
}
-}
\ No newline at end of file
+}
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/InsertOrUpsertMethodAdapter.kt
index e5a111b..4c5f47e 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/InsertOrUpsertMethodAdapter.kt
@@ -287,4 +287,4 @@
CommonTypeNames.LIST.parametrizedBy(XTypeName.BOXED_LONG)
), // return List<Long>
}
-}
\ No newline at end of file
+}
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/CoroutineTransactionMethodBinder.kt
index 46c348e..e5a376a 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/CoroutineTransactionMethodBinder.kt
@@ -128,4 +128,4 @@
endControlFlow()
}
}
-}
\ No newline at end of file
+}
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/InstantTransactionMethodBinder.kt
index 4a8cae4..20c32d6 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/InstantTransactionMethodBinder.kt
@@ -80,4 +80,4 @@
endControlFlow()
}
}
-}
\ No newline at end of file
+}
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/TransactionMethodBinder.kt
index 7b32d8c..6d34c4d 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/TransactionMethodBinder.kt
@@ -43,4 +43,4 @@
dbProperty: XPropertySpec,
scope: CodeGenScope
)
-}
\ No newline at end of file
+}
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/TransactionMethodAdapter.kt
index 9c21f73..7384632 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/TransactionMethodAdapter.kt
@@ -115,4 +115,4 @@
"super@%T.%N(",
daoImplName, methodName
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/NullAwareTypeConverters.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/NullAwareTypeConverters.kt
index 4bf5397..7d2196e 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/NullAwareTypeConverters.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/NullAwareTypeConverters.kt
@@ -111,4 +111,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/SingleStatementTypeConverter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/SingleStatementTypeConverter.kt
index 6efbe4b..cf2e960 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/SingleStatementTypeConverter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/SingleStatementTypeConverter.kt
@@ -52,4 +52,4 @@
inputVarName: String,
scope: CodeGenScope
): XCodeBlock
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UpCastTypeConverter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UpCastTypeConverter.kt
index e478031..edc1d8c 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UpCastTypeConverter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UpCastTypeConverter.kt
@@ -46,4 +46,4 @@
inputVarName
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UuidColumnTypeAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UuidColumnTypeAdapter.kt
index adc3525..93c587c 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UuidColumnTypeAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/types/UuidColumnTypeAdapter.kt
@@ -85,4 +85,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/util/SchemaFileResolver.kt b/room/room-compiler/src/main/kotlin/androidx/room/util/SchemaFileResolver.kt
index 6cd884e..2fabfd0 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/util/SchemaFileResolver.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/util/SchemaFileResolver.kt
@@ -51,4 +51,4 @@
override fun getFile(path: Path) = path.toFile()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/util/SimpleJavaVersion.kt b/room/room-compiler/src/main/kotlin/androidx/room/util/SimpleJavaVersion.kt
index 5655d9b..5ea67e2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/util/SimpleJavaVersion.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/util/SimpleJavaVersion.kt
@@ -122,4 +122,4 @@
?: throw IllegalArgumentException("Unable to parse Java version $version")
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/BuiltInConverterFlags.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/BuiltInConverterFlags.kt
index 3bbeaab..a345d57 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/BuiltInConverterFlags.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/BuiltInConverterFlags.kt
@@ -52,4 +52,4 @@
BuiltInTypeConverters.State.INHERITED -> this
else -> other
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/ColumnIndexVar.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/ColumnIndexVar.kt
index c1b780f..d3a4341 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/ColumnIndexVar.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/ColumnIndexVar.kt
@@ -20,4 +20,4 @@
* A value object that associates a column with a generated local variable containing the result
* index.
*/
-data class ColumnIndexVar(val column: String?, val indexVar: String)
\ No newline at end of file
+data class ColumnIndexVar(val column: String?, val indexVar: String)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt
index 7295095..5a8a9a9 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsEntity.kt
@@ -137,4 +137,4 @@
ftsOptions.toBundle(),
contentSyncTriggerCreateQueries
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsOptions.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsOptions.kt
index 5f9f48f..8f43cb4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsOptions.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/FtsOptions.kt
@@ -105,4 +105,4 @@
androidx.room.FtsOptions.TOKENIZER_UNICODE61
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/HasFields.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/HasFields.kt
index cfa129d..ca3d387 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/HasFields.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/HasFields.kt
@@ -31,4 +31,4 @@
get() = fields.columnNames
fun HasFields.findFieldByColumnName(columnName: String) =
- fields.find { it.columnName == columnName }
\ No newline at end of file
+ fields.find { it.columnName == columnName }
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt
index b4ae888..bebb8c5 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt
@@ -28,4 +28,4 @@
val returnType: XType,
val parameters: List<ShortcutQueryParameter>,
val methodBinder: InsertOrUpsertMethodBinder?
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/Junction.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/Junction.kt
index d07bc1d..a2ecdaf 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/Junction.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/Junction.kt
@@ -23,4 +23,4 @@
val entity: EntityOrView,
val parentField: Field,
val entityField: Field
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt
index 46ba1a3..0a7ed24 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt
@@ -26,4 +26,4 @@
data class KotlinBoxedPrimitiveMethodDelegate(
val element: XMethodElement,
val concreteMethod: XMethodElement
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt
index 7432c9e..8d2dd20 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt
@@ -25,4 +25,4 @@
data class KotlinDefaultMethodDelegate(
// the original element, not the stub that is generated for DefaultImpls
val element: XMethodElement
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/LanguageId.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/LanguageId.kt
index 8007dfa..f67f1ef 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/LanguageId.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/LanguageId.kt
@@ -26,4 +26,4 @@
companion object {
val MISSING = LanguageId(null, null)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/MapInfo.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/MapInfo.kt
index abf4d49..611b65a 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/MapInfo.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/MapInfo.kt
@@ -20,4 +20,4 @@
* Represents the @MapInfo input of a @Query or @RawQuery method that has a return type of map or
* multimap.
*/
-data class MapInfo(val keyColumnName: String, val valueColumnName: String)
\ No newline at end of file
+data class MapInfo(val keyColumnName: String, val valueColumnName: String)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/PojoMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/PojoMethod.kt
index 6fcf320..b0372d3 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/PojoMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/PojoMethod.kt
@@ -25,4 +25,4 @@
class PojoMethod(
val element: XMethodElement,
val resolvedType: XMethodType,
-)
\ No newline at end of file
+)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt
index 81d260c..cfc5138 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt
@@ -72,4 +72,4 @@
returnType: XType,
parameters: List<QueryParameter>,
val preparedQueryResultBinder: PreparedQueryResultBinder
-) : QueryMethod(element, query, returnType, parameters)
\ No newline at end of file
+) : QueryMethod(element, query, returnType, parameters)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/SchemaIdentityKey.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/SchemaIdentityKey.kt
index 75e5117..016c7ad 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/SchemaIdentityKey.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/SchemaIdentityKey.kt
@@ -49,4 +49,4 @@
fun append(identity: String) {
sb.append(identity).append(SEPARATOR)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutEntity.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutEntity.kt
index b2610f6..4405081 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutEntity.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutEntity.kt
@@ -38,4 +38,4 @@
}
val pojo = partialEntity ?: entity
val isPartialEntity = partialEntity != null
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
index 7fcdd72..4ba44f3 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertionMethod.kt
@@ -26,4 +26,4 @@
returnType: XType,
parameters: List<ShortcutQueryParameter>,
methodBinder: InsertOrUpsertMethodBinder
- ) : InsertOrUpsertShortcutMethod(element, entities, returnType, parameters, methodBinder)
\ No newline at end of file
+ ) : InsertOrUpsertShortcutMethod(element, entities, returnType, parameters, methodBinder)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/EntityUpsertionAdapterWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/EntityUpsertionAdapterWriter.kt
index 7098ed2..d650a63 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/EntityUpsertionAdapterWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/EntityUpsertionAdapterWriter.kt
@@ -52,4 +52,4 @@
args = arrayOf(insertionHelper, updateHelper)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/FtsTableInfoValidationWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/FtsTableInfoValidationWriter.kt
index 1c0dbbd..368920b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/FtsTableInfoValidationWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/FtsTableInfoValidationWriter.kt
@@ -84,4 +84,4 @@
endControlFlow()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/ValidationWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/ValidationWriter.kt
index cede6be..76b0bed 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/ValidationWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/ValidationWriter.kt
@@ -90,4 +90,4 @@
return this
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/RoomTestEnvConfigProvider.kt b/room/room-compiler/src/test/kotlin/androidx/room/RoomTestEnvConfigProvider.kt
index 761159f..bd9a858 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/RoomTestEnvConfigProvider.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/RoomTestEnvConfigProvider.kt
@@ -23,4 +23,4 @@
override fun configure(options: Map<String, String>): XProcessingEnvConfig {
return DatabaseProcessingStep.getEnvConfig(options)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/ext/ElementExtTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/ext/ElementExtTest.kt
index 131fe7e..1c19e7f 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/ext/ElementExtTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/ext/ElementExtTest.kt
@@ -249,4 +249,4 @@
@Parameterized.Parameters(name = "preCompile_{0}")
fun params() = arrayOf(false, true)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/log/RLogTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/log/RLogTest.kt
index a45785d..4fc56cb 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/log/RLogTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/log/RLogTest.kt
@@ -47,4 +47,4 @@
// IllegalFormatConversionException
logger.w(Warning.ALL, "bad query: 'SELECT strftime('%d', mAge) as mDay, mName FROM'")
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/parser/SQLTypeAffinityTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/parser/SQLTypeAffinityTest.kt
index 7c4a6fb..0db9225 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/parser/SQLTypeAffinityTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/parser/SQLTypeAffinityTest.kt
@@ -117,4 +117,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/parser/SqlParserTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/parser/SqlParserTest.kt
index 0e006ff..b3e20de 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/parser/SqlParserTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/parser/SqlParserTest.kt
@@ -372,4 +372,4 @@
fun assertSections(query: String, vararg sections: Section) {
assertThat(SqlParser.parse(query).sections, `is`(sections.toList()))
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseFtsEntityParserTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseFtsEntityParserTest.kt
index af7987d..228e52f 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseFtsEntityParserTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseFtsEntityParserTest.kt
@@ -84,4 +84,4 @@
}
abstract fun getFtsVersion(): Int
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts3TableEntityProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts3TableEntityProcessorTest.kt
index e959e20..71633cf 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts3TableEntityProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts3TableEntityProcessorTest.kt
@@ -206,4 +206,4 @@
assertThat(entity.ftsOptions.tokenizer, `is`("customICU"))
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts4TableEntityProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts4TableEntityProcessorTest.kt
index 178c2938..5d08752 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts4TableEntityProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/Fts4TableEntityProcessorTest.kt
@@ -469,4 +469,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTargetMethodTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTargetMethodTest.kt
index 0a35d47..cc63a43 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTargetMethodTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTargetMethodTest.kt
@@ -519,4 +519,4 @@
} else {
"method"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
index 4661a0633..ec56bef 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
@@ -2246,4 +2246,4 @@
}
"""
)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt
index b8d94b3..e943139 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt
@@ -723,4 +723,4 @@
"""
private const val DAO_SUFFIX = "}"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/RemoveUnusedColumnsTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/RemoveUnusedColumnsTest.kt
index a4bac2c..3c39305 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/RemoveUnusedColumnsTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/RemoveUnusedColumnsTest.kt
@@ -186,4 +186,4 @@
return listOf(pojo, dao, db)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/BuiltInConverterFlagsTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/BuiltInConverterFlagsTest.kt
index 93a15df..c48870e 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/BuiltInConverterFlagsTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/BuiltInConverterFlagsTest.kt
@@ -254,4 +254,4 @@
")"
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/NullabilityAwareTypeConverterStoreTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/NullabilityAwareTypeConverterStoreTest.kt
index fe3433a..997f6d3 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/NullabilityAwareTypeConverterStoreTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/NullabilityAwareTypeConverterStoreTest.kt
@@ -906,4 +906,4 @@
.joinToString("\n")
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/Signatures.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/Signatures.kt
index 6132610..38ec1a3 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/Signatures.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/Signatures.kt
@@ -50,4 +50,4 @@
"(${from.toSignature()} as ${to.toSignature()})"
else -> "${from.toSignature()} -> ${to.toSignature()}"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAssignmentTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAssignmentTest.kt
index 22f6c5c..e6928c1 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAssignmentTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAssignmentTest.kt
@@ -113,4 +113,4 @@
it.apply { handler() }
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterCostTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterCostTest.kt
index a6c87f3..7029a46 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterCostTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterCostTest.kt
@@ -97,4 +97,4 @@
Cost(requireNotNull = 1, converters = 1, nullSafeWrapper = 1, upCasts = 1)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterStoreTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterStoreTest.kt
index a66f61b..d2fc717 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterStoreTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeConverterStoreTest.kt
@@ -141,4 +141,4 @@
to.asTypeName().toString(CodeLanguage.JAVA)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/testing/XProcessingStepExt.kt b/room/room-compiler/src/test/kotlin/androidx/room/testing/XProcessingStepExt.kt
index 3f71c5d..a8f237a 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/testing/XProcessingStepExt.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/testing/XProcessingStepExt.kt
@@ -36,4 +36,4 @@
false
)
delegate(invocation)
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/testing/XTestInvocationExt.kt b/room/room-compiler/src/test/kotlin/androidx/room/testing/XTestInvocationExt.kt
index 62e386a..b8fa0c1 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/testing/XTestInvocationExt.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/testing/XTestInvocationExt.kt
@@ -22,4 +22,4 @@
val XTestInvocation.context
get() = getOrPutUserData(Context::class) {
Context(processingEnv)
- }
\ No newline at end of file
+ }
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
index a876e49..5c766ef 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/util/SchemaDifferTest.kt
@@ -1567,4 +1567,4 @@
)
//endregion
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/util/SimpleJavaVersionTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/util/SimpleJavaVersionTest.kt
index 8e1b5f96..7c76004 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/util/SimpleJavaVersionTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/util/SimpleJavaVersionTest.kt
@@ -82,4 +82,4 @@
assertThat(SimpleJavaVersion(8, 1, 0)).isGreaterThan(SimpleJavaVersion(8, 1, null))
assertThat(SimpleJavaVersion(8, 1, null)).isLessThan(SimpleJavaVersion(8, 1, 0))
}
-}
\ No newline at end of file
+}
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 f9c70b1..6370004 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
@@ -76,4 +76,4 @@
)
assertEquals(expectedLegacyHash, database.legacyIdentityHash)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/vo/FtsEntityTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/vo/FtsEntityTest.kt
index c589003..93e3904 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/vo/FtsEntityTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/vo/FtsEntityTest.kt
@@ -260,4 +260,4 @@
columnName = name
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/BaseDaoKotlinCodeGenTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/BaseDaoKotlinCodeGenTest.kt
index 602825b..ed93a9c 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/BaseDaoKotlinCodeGenTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/BaseDaoKotlinCodeGenTest.kt
@@ -61,4 +61,4 @@
handler.invoke(it)
}
}
-}
\ No newline at end of file
+}
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 a3af92e..9c2d88c 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
@@ -2387,4 +2387,4 @@
expectedFilePath = getTestGoldenPath(testName)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoRelationshipKotlinCodeGenTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoRelationshipKotlinCodeGenTest.kt
index 6e12f2c..be78225 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoRelationshipKotlinCodeGenTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoRelationshipKotlinCodeGenTest.kt
@@ -457,4 +457,4 @@
expectedFilePath = getTestGoldenPath(testName)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseKotlinCodeGenTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseKotlinCodeGenTest.kt
index d47aeb6..a9a2180 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseKotlinCodeGenTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseKotlinCodeGenTest.kt
@@ -188,4 +188,4 @@
handler.invoke(it)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/DefaultsInDaoTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/DefaultsInDaoTest.kt
index aebbe74..3ee50134 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/DefaultsInDaoTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/DefaultsInDaoTest.kt
@@ -216,4 +216,4 @@
JvmDefaultMode.DISABLE,
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-gradle-plugin/build.gradle b/room/room-gradle-plugin/build.gradle
index 7622ad9..9a73d9a 100644
--- a/room/room-gradle-plugin/build.gradle
+++ b/room/room-gradle-plugin/build.gradle
@@ -41,7 +41,7 @@
testImplementation(project(":internal-testutils-gradle-plugin"))
testImplementation(gradleTestKit())
testImplementation(libs.junit)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation(libs.testParameterInjector)
testPlugin("com.android.tools.build:gradle:7.3.0")
diff --git a/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomExtension.kt b/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomExtension.kt
index dc10b3c..f497272 100644
--- a/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomExtension.kt
+++ b/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomExtension.kt
@@ -19,19 +19,22 @@
import javax.inject.Inject
import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
+import org.gradle.api.tasks.TaskProvider
open class RoomExtension @Inject constructor(private val providers: ProviderFactory) {
- internal var schemaDirectory: Provider<String>? = null
-
- // TODO(b/279748243): Consider adding overload that takes `org.gradle.api.file.Director`.
+ // TODO(b/279748243): Consider adding overloads that takes `org.gradle.api.file.Directory`.
+ // User provided variant match pattern to schema location
+ internal val schemaDirectories = mutableMapOf<VariantMatchName, Provider<String>>()
+ // Used variant match pattern to its copy task. Multiple variant compile tasks can be finalized
+ // by the same copy task.
+ internal val copyTasks =
+ mutableMapOf<VariantMatchName, TaskProvider<RoomGradlePlugin.RoomSchemaCopyTask>>()
/**
* Sets the schema location where Room will output exported schema files.
*
- * The location specified will be used as the base directory for schema files that will be
- * generated per build variant. i.e. for a 'debug' build of the product flavor 'free' then a
- * schema will be generated in
- * `<schemaDirectory>/freeDebug/<database-package>/<database-version>.json`.
+ * The location specified will be used for all variants if per-variant schema locations are
+ * needed use the overloaded version of this function that takes in a `variantMatchName`.
*
* See [Export Schemas Documentation](https://developer.android.com/training/data-storage/room/migrating-db-versions#export-schemas)
*/
@@ -42,14 +45,89 @@
/**
* Sets the schema location where Room will output exported schema files.
*
- * The location specified will be used as the base directory for schema files that will be
- * generated per build variant. i.e. for a 'debug' build of the product flavor 'free' then a
- * schema will be generated in
- * `<schemaDirectory>/freeDebug/<database-package>/<database-version>.json`.
+ * The location specified will be used for all variants if per-variant schema locations are
+ * needed use the overloaded version of this function that takes in a `variantMatchName`.
*
* See [Export Schemas Documentation](https://developer.android.com/training/data-storage/room/migrating-db-versions#export-schemas)
*/
open fun schemaDirectory(path: Provider<String>) {
- schemaDirectory = path
+ schemaDirectories[ALL_VARIANTS] = path
}
-}
\ No newline at end of file
+
+ /**
+ * Sets the schema location for a variant, flavor or build type where Room will output exported
+ * schema files.
+ *
+ * The location specified will be used for a matching variants based on the provided
+ * [variantMatchName] where it can either be a full variant name, a product flavor name or a
+ * build type name.
+ *
+ * For example, assuming two build flavors: ‘demo’ and ‘full’ and the two default build types
+ * ‘debug’ and ‘release’, then the following are valid configurations:
+ * ```
+ * room {
+ * // Applies 'demoDebug' only
+ * schemaLocation("demoDebug", ("$projectDir/schemas/demoDebug")
+ *
+ * // Applies to 'demoDebug' and 'demoRelease'
+ * schemaLocation("demo", ("$projectDir/schemas/demo")
+ *
+ * // Applies to 'demoDebug' and 'fullDebug'
+ * schemaLocation("debug", ("$projectDir/schemas/debug")
+ * }
+ * ```
+ *
+ * If per-variant schema locations are not necessary due to all variants containing the same
+ * schema, then use the overloaded version of this function that does not take in a
+ * `variantMatchName`.
+ *
+ * See [Export Schemas Documentation](https://developer.android.com/training/data-storage/room/migrating-db-versions#export-schemas)
+ */
+ open fun schemaDirectory(variantMatchName: String, path: String) {
+ schemaDirectory(variantMatchName, providers.provider { path })
+ }
+
+ /**
+ * Sets the schema location for a variant, flavor or build type where Room will output exported
+ * schema files.
+ *
+ * The location specified will be used for a matching variants based on the provided
+ * [variantMatchName] where it can either be a full variant name, a product flavor name or a
+ * build type name.
+ *
+ * For example, assuming two build flavors: ‘demo’ and ‘full’ and the two default build types
+ * ‘debug’ and ‘release’, then the following are valid configurations:
+ * ```
+ * room {
+ * // Applies 'demoDebug' only
+ * schemaLocation("demoDebug", ("$projectDir/schemas/demoDebug")
+ *
+ * // Applies to 'demoDebug' and 'demoRelease'
+ * schemaLocation("demo", ("$projectDir/schemas/demo")
+ *
+ * // Applies to 'demoDebug' and 'fullDebug'
+ * schemaLocation("debug", ("$projectDir/schemas/debug")
+ * }
+ * ```
+ *
+ * If per-variant schema locations are not necessary due to all variants containing the same
+ * schema, then use the overloaded version of this function that does not take in a
+ * `variantMatchName`.
+ *
+ * See [Export Schemas Documentation](https://developer.android.com/training/data-storage/room/migrating-db-versions#export-schemas)
+ */
+ open fun schemaDirectory(variantMatchName: String, path: Provider<String>) {
+ check(variantMatchName.isNotEmpty()) { "variantMatchName must not be empty." }
+ schemaDirectories[VariantMatchName(variantMatchName)] = path
+ }
+
+ /**
+ * Represent a full variant name (demoDebug), flavor name (demo) or build type name (debug).
+ */
+ @JvmInline
+ internal value class VariantMatchName(val actual: String)
+
+ companion object {
+ internal val ALL_VARIANTS = VariantMatchName("")
+ }
+}
diff --git a/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomGradlePlugin.kt b/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomGradlePlugin.kt
index 9dacb6d..9b30a3e 100644
--- a/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomGradlePlugin.kt
+++ b/room/room-gradle-plugin/src/main/java/androidx/room/gradle/RoomGradlePlugin.kt
@@ -16,17 +16,22 @@
package androidx.room.gradle
+import androidx.room.gradle.RoomExtension.VariantMatchName
import com.android.build.api.AndroidPluginVersion
import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.api.variant.ComponentIdentity
-import com.android.build.api.variant.Variant
+import com.android.build.api.variant.HasAndroidTest
import com.android.build.gradle.api.AndroidBasePlugin
import com.google.devtools.ksp.gradle.KspTaskJvm
+import java.io.File
+import java.security.MessageDigest
import java.util.Locale
import javax.inject.Inject
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
import kotlin.io.path.Path
+import kotlin.io.path.copyTo
+import kotlin.io.path.createDirectories
import kotlin.io.path.notExists
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
@@ -48,9 +53,7 @@
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.SkipWhenEmpty
import org.gradle.api.tasks.TaskAction
-import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.compile.JavaCompile
-import org.gradle.configurationcache.extensions.capitalized
import org.gradle.process.CommandLineArgumentProvider
import org.gradle.work.DisableCachingByDefault
import org.jetbrains.kotlin.gradle.internal.KaptTask
@@ -78,7 +81,7 @@
project.extensions.create("room", RoomExtension::class.java)
val componentsExtension =
project.extensions.findByType(AndroidComponentsExtension::class.java)
- project.check(componentsExtension != null) {
+ project.check(componentsExtension != null, isFatal = true) {
"Could not find the Android Gradle Plugin (AGP) extension, the Room Gradle plugin " +
"should be only applied to an Android projects."
}
@@ -87,43 +90,61 @@
"version 7.3.0 or higher (found ${componentsExtension.pluginVersion})."
}
componentsExtension.onVariants { variant ->
- val locationProvider = roomExtension.schemaDirectory
- project.check(locationProvider != null) {
- "The Room Gradle plugin was applied but not schema location was specified. " +
+ project.check(roomExtension.schemaDirectories.isNotEmpty(), isFatal = true) {
+ "The Room Gradle plugin was applied but no schema location was specified. " +
"Use the `room { schemaDirectory(...) }` DSL to specify one."
}
- val schemaDirectory = locationProvider.get()
- project.check(schemaDirectory.isNotEmpty()) {
- "The schemaDirectory path must not be empty."
+ configureVariant(project, roomExtension, variant)
+ variant.unitTest?.let { configureVariant(project, roomExtension, it) }
+ if (variant is HasAndroidTest) {
+ variant.androidTest?.let { configureVariant(project, roomExtension, it) }
}
- configureVariant(project, schemaDirectory, variant)
}
}
private fun configureVariant(
project: Project,
- schemaDirectory: String,
- variant: Variant
+ roomExtension: RoomExtension,
+ variant: ComponentIdentity
) {
- val androidVariantTaskNames = AndroidVariantsTaskNames(variant.name, variant)
val configureTask: (Task, ComponentIdentity) -> RoomSchemaDirectoryArgumentProvider = {
task, variantIdentity ->
- val schemaDirectoryPath = Path(schemaDirectory, variantIdentity.name)
+ // Find schema location for variant from user declared location with priority:
+ // * Full variant name specified, e.g. `schemaLocation("demoDebug", "...")`
+ // * Flavor name, e.g. `schemaLocation("demo", "...")`
+ // * Build type name, e.g. `schemaLocation("debug", "...")`
+ // * All variants location, e.g. `schemaLocation("...")`
+ val schemaDirectories = roomExtension.schemaDirectories
+ fun <V> Map<VariantMatchName, V>.findPair(key: String) =
+ VariantMatchName(key).let { if (containsKey(it)) it to getValue(it) else null }
+ val matchedPair = schemaDirectories.findPair(variantIdentity.name)
+ ?: variantIdentity.flavorName?.let { schemaDirectories.findPair(it) }
+ ?: variantIdentity.buildType?.let { schemaDirectories.findPair(it) }
+ ?: schemaDirectories.findPair(RoomExtension.ALL_VARIANTS.actual)
+ project.check(matchedPair != null, isFatal = true) {
+ "No matching schema directory for variant '${variantIdentity.name}'."
+ }
+ val (matchedName, schemaDirectoryProvider) = matchedPair
+ val schemaDirectory = schemaDirectoryProvider.get()
+ project.check(schemaDirectory.isNotEmpty()) {
+ "The schema directory path for variant '${variantIdentity.name}' must not be empty."
+ }
+ val schemaDirectoryPath = Path(schemaDirectory)
if (schemaDirectoryPath.notExists()) {
project.check(schemaDirectoryPath.toFile().mkdirs()) {
"Unable to create directory: $schemaDirectoryPath"
}
}
+
val schemaInputDir = objectFactory.directoryProperty().apply {
set(project.file(schemaDirectoryPath))
}
-
val schemaOutputDir =
projectLayout.buildDirectory.dir("intermediates/room/schemas/${task.name}")
- val copyTask = androidVariantTaskNames.copyTasks.getOrPut(variant.name) {
+ val copyTask = roomExtension.copyTasks.getOrPut(matchedName) {
project.tasks.register(
- "copyRoomSchemas${variantIdentity.name.capitalize()}",
+ "copyRoomSchemas${matchedName.actual.capitalize()}",
RoomSchemaCopyTask::class.java
) {
it.schemaDirectory.set(schemaInputDir)
@@ -139,6 +160,7 @@
)
}
+ val androidVariantTaskNames = AndroidVariantsTaskNames(variant.name, variant)
configureJavaTasks(project, androidVariantTaskNames, configureTask)
configureKaptTasks(project, androidVariantTaskNames, configureTask)
configureKspTasks(project, androidVariantTaskNames, configureTask)
@@ -198,19 +220,16 @@
private val variantName: String,
private val variantIdentity: ComponentIdentity
) {
- // Variant name to copy task
- val copyTasks = mutableMapOf<String, TaskProvider<RoomSchemaCopyTask>>()
-
private val javaCompileName by lazy {
- "compile${variantName.capitalized()}JavaWithJavac"
+ "compile${variantName.capitalize()}JavaWithJavac"
}
private val kaptTaskName by lazy {
- "kapt${variantName.capitalized()}Kotlin"
+ "kapt${variantName.capitalize()}Kotlin"
}
private val kspTaskJvm by lazy {
- "ksp${variantName.capitalized()}Kotlin"
+ "ksp${variantName.capitalize()}Kotlin"
}
fun withJavaCompile(taskName: String) =
@@ -236,14 +255,48 @@
@TaskAction
fun copySchemas() {
+ // Map of relative path to its source file hash.
+ val copiedHashes = mutableMapOf<String, MutableMap<String, String>>()
variantSchemaOutputDirectories.files
.filter { it.exists() }
- .forEach {
- // TODO(b/278266663): Error when two same relative path schemas are found in out
- // dirs and their content is different an indicator of an inconsistency between
- // the compile tasks of the same variant.
- it.copyRecursively(schemaDirectory.get().asFile, overwrite = true)
+ .forEach { outputDir ->
+ outputDir.walkTopDown().filter { it.isFile }.forEach { schemaFile ->
+ val schemaPath = schemaFile.toPath()
+ val basePath = outputDir.toPath().relativize(schemaPath)
+ schemaPath.copyTo(
+ target = schemaDirectory.get().asFile.toPath().resolve(basePath)
+ .apply { parent?.createDirectories() },
+ overwrite = true
+ )
+ copiedHashes.getOrPut(basePath.toString()) { mutableMapOf() }
+ .put(schemaFile.sha256(), schemaPath.toString())
+ }
}
+ // Validate that if multiple schema files for the same database and version are copied
+ // to the same schema directory that they are the same in content (via checksum), as
+ // otherwise it would indicate pre-variant schemas and thus requiring pre-variant
+ // schema directories.
+ copiedHashes.filterValues { it.size > 1 }.forEach { (schemaDir, hashes) ->
+ val errorMsg = buildString {
+ appendLine(
+ "Inconsistency detected exporting schema files (checksum - source):"
+ )
+ hashes.entries.forEach {
+ appendLine(" ${it.key} - ${it.value}")
+ }
+ appendLine(
+ "The listed files differ in content but were copied into the same " +
+ "schema directory '$schemaDir'. A possible indicator that " +
+ "per-variant schema locations must be provided."
+ )
+ }
+ throw GradleException(errorMsg)
+ }
+ }
+
+ private fun File.sha256(): String {
+ return MessageDigest.getInstance("SHA-256").digest(this.readBytes())
+ .joinToString("") { "%02x".format(it) }
}
}
@@ -276,11 +329,15 @@
}
@OptIn(ExperimentalContracts::class)
- internal fun Project.check(value: Boolean, lazyMessage: () -> String) {
+ internal fun Project.check(
+ value: Boolean,
+ isFatal: Boolean = false,
+ lazyMessage: () -> String
+ ) {
contract {
returns() implies value
}
- if (isGradleSyncRunning()) return
+ if (isGradleSyncRunning() && !isFatal) return
if (!value) {
throw GradleException(lazyMessage())
}
@@ -298,4 +355,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-gradle-plugin/src/test/java/androidx/room/gradle/RoomGradlePluginTest.kt b/room/room-gradle-plugin/src/test/java/androidx/room/gradle/RoomGradlePluginTest.kt
index 42c16d8..b250054 100644
--- a/room/room-gradle-plugin/src/test/java/androidx/room/gradle/RoomGradlePluginTest.kt
+++ b/room/room-gradle-plugin/src/test/java/androidx/room/gradle/RoomGradlePluginTest.kt
@@ -28,10 +28,9 @@
import org.junit.Test
import org.junit.runner.RunWith
+@Suppress("JUnitMalformedDeclaration") // Using TestParameterInjector in test functions.
@RunWith(TestParameterInjector::class)
-class RoomGradlePluginTest(
- @TestParameter val backend: ProcessingBackend
-) {
+class RoomGradlePluginTest {
@get:Rule
val projectSetup = ProjectSetupRule()
@@ -39,7 +38,12 @@
projectSetup.getLibraryLatestVersionInLocalRepo("androidx/room/room-compiler")
}
- private fun setup(projectName: String, projectRoot: File = projectSetup.rootDir) {
+ private fun setup(
+ projectName: String,
+ backend: ProcessingBackend = ProcessingBackend.JAVAC,
+ projectRoot: File = projectSetup.rootDir,
+ schemaDslLines: List<String> = listOf("schemaDirectory(\"\$projectDir/schemas\")")
+ ) {
// copy test project
File("src/test/test-data/$projectName").copyRecursively(projectRoot)
@@ -60,14 +64,14 @@
""
ProcessingBackend.KAPT ->
"""
- id('kotlin-android')
- id('kotlin-kapt')
- """
+ | id('kotlin-android')
+ | id('kotlin-kapt')
+ """.trimMargin()
ProcessingBackend.KSP ->
"""
- id('kotlin-android')
- id('com.google.devtools.ksp')
- """
+ | id('kotlin-android')
+ | id('com.google.devtools.ksp')
+ """.trimMargin()
}
val repositoriesBlock = buildString {
@@ -101,48 +105,44 @@
// set up build file
File(projectRoot, "build.gradle").writeText(
"""
- plugins {
- id('com.android.application')
- id('androidx.room')
- $additionalPluginsBlock
- }
-
- $repositoriesBlock
-
- %s
-
- dependencies {
- // Uses latest Room built from tip of tree
- implementation "androidx.room:room-runtime:$roomVersion"
- $processorConfig "androidx.room:room-compiler:$roomVersion"
- }
-
- android {
- namespace "room.testapp"
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
- }
-
- $kotlinJvmTargetBlock
-
- room {
- schemaDirectory("${'$'}projectDir/schemas")
- }
-
- """
- .trimMargin()
- // doing format instead of "$projectSetup.androidProject" on purpose,
- // because otherwise trimIndent will mess with formatting
- .format(projectSetup.androidProject)
+ |plugins {
+ | id('com.android.application')
+ | id('androidx.room')
+ | $additionalPluginsBlock
+ |}
+ |
+ |$repositoriesBlock
+ |
+ |${projectSetup.androidProject}
+ |
+ |dependencies {
+ | // Uses latest Room built from tip of tree
+ | implementation "androidx.room:room-runtime:$roomVersion"
+ | $processorConfig "androidx.room:room-compiler:$roomVersion"
+ |}
+ |
+ |android {
+ | namespace "room.testapp"
+ | compileOptions {
+ | sourceCompatibility = JavaVersion.VERSION_1_8
+ | targetCompatibility = JavaVersion.VERSION_1_8
+ | }
+ |}
+ |
+ |$kotlinJvmTargetBlock
+ |
+ |room {
+ |${schemaDslLines.joinToString(separator = "\n")}
+ |}
+ |
+ """.trimMargin()
)
}
@Test
- fun testWorkflow() {
- setup("simple-project")
+ fun testWorkflow(@TestParameter backend: ProcessingBackend) {
+ setup("simple-project", backend = backend)
// First clean build, all tasks need to run
runGradleTasks(CLEAN_TASK, COMPILE_TASK).let { result ->
@@ -152,7 +152,7 @@
// Schema file at version 1 is created
var schemaOneTimestamp: Long
- projectSetup.rootDir.resolve("schemas/debug/room.testapp.MyDatabase/1.json").let {
+ projectSetup.rootDir.resolve("schemas/room.testapp.MyDatabase/1.json").let {
assertThat(it.exists()).isTrue()
schemaOneTimestamp = it.lastModified()
}
@@ -184,7 +184,7 @@
}
// Check schema file at version 1 is updated
- projectSetup.rootDir.resolve("schemas/debug/room.testapp.MyDatabase/1.json").let {
+ projectSetup.rootDir.resolve("schemas/room.testapp.MyDatabase/1.json").let {
assertThat(it.exists()).isTrue()
assertThat(schemaOneTimestamp).isNotEqualTo(it.lastModified())
schemaOneTimestamp = it.lastModified()
@@ -239,20 +239,27 @@
}
// Check schema file at version 1 is still present and unchanged.
- projectSetup.rootDir.resolve("schemas/debug/room.testapp.MyDatabase/1.json").let {
+ projectSetup.rootDir.resolve("schemas/room.testapp.MyDatabase/1.json").let {
assertThat(it.exists()).isTrue()
assertThat(schemaOneTimestamp).isEqualTo(it.lastModified())
}
// Check schema file at version 2 is created and copied.
- projectSetup.rootDir.resolve("schemas/debug/room.testapp.MyDatabase/2.json").let {
+ projectSetup.rootDir.resolve("schemas/room.testapp.MyDatabase/2.json").let {
assertThat(it.exists()).isTrue()
}
}
@Test
- fun testFlavoredProject() {
- setup("flavored-project")
+ fun testFlavoredProject(@TestParameter backend: ProcessingBackend) {
+ setup(
+ projectName = "flavored-project",
+ backend = backend,
+ schemaDslLines = listOf(
+ "schemaDirectory(\"flavorOne\", \"\$projectDir/schemas/flavorOne\")",
+ "schemaDirectory(\"flavorTwo\", \"\$projectDir/schemas/flavorTwo\")"
+ )
+ )
File(projectSetup.rootDir, "build.gradle").appendText(
"""
@@ -277,15 +284,15 @@
).let { result ->
result.assertTaskOutcome(":compileFlavorOneDebugJavaWithJavac", TaskOutcome.SUCCESS)
result.assertTaskOutcome(":compileFlavorTwoDebugJavaWithJavac", TaskOutcome.SUCCESS)
- result.assertTaskOutcome(":copyRoomSchemasFlavorOneDebug", TaskOutcome.SUCCESS)
- result.assertTaskOutcome(":copyRoomSchemasFlavorTwoDebug", TaskOutcome.SUCCESS)
+ result.assertTaskOutcome(":copyRoomSchemasFlavorOne", TaskOutcome.SUCCESS)
+ result.assertTaskOutcome(":copyRoomSchemasFlavorTwo", TaskOutcome.SUCCESS)
}
// Check schema files are generated for both flavor, each in its own folder.
val flavorOneSchema = projectSetup.rootDir.resolve(
- "schemas/flavorOneDebug/room.testapp.MyDatabase/1.json"
+ "schemas/flavorOne/room.testapp.MyDatabase/1.json"
)
val flavorTwoSchema = projectSetup.rootDir.resolve(
- "schemas/flavorTwoDebug/room.testapp.MyDatabase/1.json"
+ "schemas/flavorTwo/room.testapp.MyDatabase/1.json"
)
assertThat(flavorOneSchema.exists()).isTrue()
assertThat(flavorTwoSchema.exists()).isTrue()
@@ -294,8 +301,15 @@
}
@Test
- fun testMoreBuildTypesProject() {
- setup("simple-project")
+ fun testMoreBuildTypesProject(@TestParameter backend: ProcessingBackend) {
+ setup(
+ projectName = "simple-project",
+ backend = backend,
+ schemaDslLines = listOf(
+ "schemaDirectory(\"\$projectDir/schemas\")",
+ "schemaDirectory(\"staging\", \"\$projectDir/schemas/staging\")"
+ )
+ )
File(projectSetup.rootDir, "build.gradle").appendText(
"""
@@ -310,7 +324,7 @@
""".trimIndent()
)
- runGradleTasks(CLEAN_TASK, "compileStagingJavaWithJavac",).let { result ->
+ runGradleTasks(CLEAN_TASK, "compileStagingJavaWithJavac").let { result ->
result.assertTaskOutcome(":compileStagingJavaWithJavac", TaskOutcome.SUCCESS)
result.assertTaskOutcome(":copyRoomSchemasStaging", TaskOutcome.SUCCESS)
}
@@ -320,16 +334,129 @@
assertThat(schemeFile.exists()).isTrue()
}
+ @Test
+ fun testMissingConfigProject() {
+ setup(
+ projectName = "simple-project",
+ schemaDslLines = listOf()
+ )
+
+ runGradleTasks(CLEAN_TASK, COMPILE_TASK, expectFailure = true).let { result ->
+ assertThat(result.output).contains(
+ "The Room Gradle plugin was applied but no schema location was specified."
+ )
+ }
+ }
+
+ @Test
+ fun testEmptyDirConfigProject() {
+ setup(
+ projectName = "simple-project",
+ schemaDslLines = listOf("schemaDirectory(\"\")")
+ )
+
+ runGradleTasks(CLEAN_TASK, COMPILE_TASK, expectFailure = true).let { result ->
+ assertThat(result.output).contains(
+ "The schema directory path for variant 'debug' must not be empty."
+ )
+ }
+ }
+
+ @Test
+ fun testMissingConfigFlavoredProject() {
+ setup(
+ projectName = "flavored-project",
+ schemaDslLines = listOf(
+ "schemaDirectory(\"flavorOne\", \"\$projectDir/schemas/flavorOne\")",
+ )
+ )
+
+ File(projectSetup.rootDir, "build.gradle").appendText(
+ """
+ android {
+ flavorDimensions "mode"
+ productFlavors {
+ flavorOne {
+ dimension "mode"
+ }
+ flavorTwo {
+ dimension "mode"
+ }
+ }
+ }
+ """.trimIndent()
+ )
+
+ runGradleTasks(
+ CLEAN_TASK,
+ "compileFlavorOneDebugJavaWithJavac",
+ "compileFlavorTwoDebugJavaWithJavac",
+ expectFailure = true
+ ).let { result ->
+ assertThat(result.output).contains(
+ "No matching schema directory for variant 'flavorTwoDebug'."
+ )
+ }
+ }
+
+ @Test
+ fun testCopyInconsistencyFlavoredProject(@TestParameter backend: ProcessingBackend) {
+ setup(
+ projectName = "flavored-project",
+ backend = backend,
+ schemaDslLines = listOf(
+ "schemaDirectory(\"\$projectDir/schemas\")",
+ )
+ )
+
+ File(projectSetup.rootDir, "build.gradle").appendText(
+ """
+ android {
+ flavorDimensions "mode"
+ productFlavors {
+ flavorOne {
+ dimension "mode"
+ }
+ flavorTwo {
+ dimension "mode"
+ }
+ }
+ }
+ """.trimIndent()
+ )
+
+ runGradleTasks(
+ CLEAN_TASK,
+ "compileFlavorOneDebugJavaWithJavac",
+ "compileFlavorTwoDebugJavaWithJavac",
+ expectFailure = true
+ ).let { result ->
+ result.assertTaskOutcome(":compileFlavorOneDebugJavaWithJavac", TaskOutcome.SUCCESS)
+ result.assertTaskOutcome(":compileFlavorTwoDebugJavaWithJavac", TaskOutcome.SUCCESS)
+ result.assertTaskOutcome(":copyRoomSchemas", TaskOutcome.FAILED)
+
+ assertThat(result.output).contains(
+ "Inconsistency detected exporting schema files"
+ )
+ }
+ }
+
private fun runGradleTasks(
vararg args: String,
- projectDir: File = projectSetup.rootDir
+ projectDir: File = projectSetup.rootDir,
+ expectFailure: Boolean = false
): BuildResult {
- return GradleRunner.create()
+ val runner = GradleRunner.create()
.withProjectDir(projectDir)
.withPluginClasspath()
+ .withDebug(true)
// workaround for b/231154556
.withArguments("-Dorg.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m", *args)
- .build()
+ return if (expectFailure) {
+ runner.buildAndFail()
+ } else {
+ runner.build()
+ }
}
private fun BuildResult.assertTaskOutcome(taskPath: String, outcome: TaskOutcome) {
@@ -351,6 +478,6 @@
companion object {
private const val CLEAN_TASK = ":clean"
private const val COMPILE_TASK = ":compileDebugJavaWithJavac"
- private const val COPY_TASK = ":copyRoomSchemasDebug"
+ private const val COPY_TASK = ":copyRoomSchemas"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-ktx/build.gradle b/room/room-ktx/build.gradle
index 3dfa666..cd1022e 100644
--- a/room/room-ktx/build.gradle
+++ b/room/room-ktx/build.gradle
@@ -30,12 +30,12 @@
api(libs.kotlinCoroutinesAndroid)
testImplementation(libs.junit)
testImplementation(libs.mockitoCore4)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation("androidx.lifecycle:lifecycle-livedata-core:2.0.0")
testImplementation(libs.testRunner)
testImplementation(libs.kotlinCoroutinesTest)
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.kotlinCoroutinesTest)
}
diff --git a/room/room-ktx/src/test/java/androidx/room/MigrationTest.kt b/room/room-ktx/src/test/java/androidx/room/MigrationTest.kt
index bf24923..8c5b257 100644
--- a/room/room-ktx/src/test/java/androidx/room/MigrationTest.kt
+++ b/room/room-ktx/src/test/java/androidx/room/MigrationTest.kt
@@ -198,4 +198,4 @@
override val isDatabaseIntegrityOk: Boolean
get() { throw UnsupportedOperationException() }
-}
\ No newline at end of file
+}
diff --git a/room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt b/room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt
index 8e7dc50..330ab3f 100644
--- a/room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt
+++ b/room/room-migration/src/main/java/androidx/room/migration/bundle/BundleUtil.kt
@@ -41,4 +41,4 @@
public fun replaceViewName(contents: String, viewName: String): String {
return contents.replace(VIEW_NAME_PLACEHOLDER, viewName)
-}
\ No newline at end of file
+}
diff --git a/room/room-paging-guava/build.gradle b/room/room-paging-guava/build.gradle
index 6acea55..cef29b1 100644
--- a/room/room-paging-guava/build.gradle
+++ b/room/room-paging-guava/build.gradle
@@ -31,7 +31,7 @@
implementation(project(":room:room-guava"))
api("androidx.paging:paging-guava:3.1.1")
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.testExtJunitKtx)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.kotlinTestJunit)
diff --git a/room/room-paging-guava/src/main/java/androidx/room/paging/guava/LimitOffsetListenableFuturePagingSource.kt b/room/room-paging-guava/src/main/java/androidx/room/paging/guava/LimitOffsetListenableFuturePagingSource.kt
index 6e2839d..57dfd91 100644
--- a/room/room-paging-guava/src/main/java/androidx/room/paging/guava/LimitOffsetListenableFuturePagingSource.kt
+++ b/room/room-paging-guava/src/main/java/androidx/room/paging/guava/LimitOffsetListenableFuturePagingSource.kt
@@ -155,4 +155,4 @@
override fun getRefreshKey(state: PagingState<Int, Value>): Int? {
return state.getClippedRefreshKey()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-paging-rxjava2/build.gradle b/room/room-paging-rxjava2/build.gradle
index 13bcc9c..3ce8b42 100644
--- a/room/room-paging-rxjava2/build.gradle
+++ b/room/room-paging-rxjava2/build.gradle
@@ -31,7 +31,7 @@
implementation(project(":room:room-paging"))
implementation(project(":room:room-rxjava2"))
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.testExtJunitKtx)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.kotlinTestJunit) //
diff --git a/room/room-paging-rxjava3/build.gradle b/room/room-paging-rxjava3/build.gradle
index 5bb0a41..a92810e 100644
--- a/room/room-paging-rxjava3/build.gradle
+++ b/room/room-paging-rxjava3/build.gradle
@@ -31,7 +31,7 @@
implementation(project(":room:room-paging"))
implementation(project(":room:room-rxjava3"))
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.testExtJunitKtx)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.kotlinCoroutinesRx3)
diff --git a/room/room-paging/build.gradle b/room/room-paging/build.gradle
index c04bcff..27b2d09 100644
--- a/room/room-paging/build.gradle
+++ b/room/room-paging/build.gradle
@@ -49,7 +49,7 @@
kspAndroidTest(
project(path: ":room:room-compiler", configuration: "shadowAndImplementation")
)
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation("androidx.arch.core:core-testing:2.2.0")
androidTestImplementation(project(":internal-testutils-common"))
androidTestImplementation(projectOrArtifact(":paging:paging-testing"))
diff --git a/room/room-paging/src/androidTest/kotlin/androidx/room/InvalidationTrackerExtRoomPaging.kt b/room/room-paging/src/androidTest/kotlin/androidx/room/InvalidationTrackerExtRoomPaging.kt
index fe1df3e6..f97ed38 100644
--- a/room/room-paging/src/androidTest/kotlin/androidx/room/InvalidationTrackerExtRoomPaging.kt
+++ b/room/room-paging/src/androidTest/kotlin/androidx/room/InvalidationTrackerExtRoomPaging.kt
@@ -35,4 +35,4 @@
delay(50)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
index fe817aa..f818b98 100644
--- a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
+++ b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
@@ -833,4 +833,4 @@
id = it + startId,
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetTestDb.kt b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetTestDb.kt
index d50f446..8d31c44 100644
--- a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetTestDb.kt
+++ b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/LimitOffsetTestDb.kt
@@ -22,4 +22,4 @@
@Database(entities = [TestItem::class], version = 1, exportSchema = false)
abstract class LimitOffsetTestDb : RoomDatabase() {
abstract val dao: TestItemDao
-}
\ No newline at end of file
+}
diff --git a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItem.kt b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItem.kt
index a1faf47..ed9aceb 100644
--- a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItem.kt
+++ b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItem.kt
@@ -23,4 +23,4 @@
data class TestItem(
@PrimaryKey val id: Int,
val value: String = "item $id"
-)
\ No newline at end of file
+)
diff --git a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItemDao.kt b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItemDao.kt
index 8863f6f..bb937a9 100644
--- a/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItemDao.kt
+++ b/room/room-paging/src/androidTest/kotlin/androidx/room/paging/TestItemDao.kt
@@ -34,4 +34,4 @@
@Query("DELETE FROM TestItem WHERE id >= :start AND id <= :end")
fun deleteTestItems(start: Int, end: Int): Int
-}
\ No newline at end of file
+}
diff --git a/room/room-paging/src/main/java/androidx/room/paging/util/ThreadSafeInvalidationObserver.kt b/room/room-paging/src/main/java/androidx/room/paging/util/ThreadSafeInvalidationObserver.kt
index 86c7a76..6cff091 100644
--- a/room/room-paging/src/main/java/androidx/room/paging/util/ThreadSafeInvalidationObserver.kt
+++ b/room/room-paging/src/main/java/androidx/room/paging/util/ThreadSafeInvalidationObserver.kt
@@ -37,4 +37,4 @@
db.invalidationTracker.addWeakObserver(this)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime-lint/src/main/java/androidx/room/lint/CursorKotlinUseIssueDetector.kt b/room/room-runtime-lint/src/main/java/androidx/room/lint/CursorKotlinUseIssueDetector.kt
index 149b5f5..eb40c4b 100644
--- a/room/room-runtime-lint/src/main/java/androidx/room/lint/CursorKotlinUseIssueDetector.kt
+++ b/room/room-runtime-lint/src/main/java/androidx/room/lint/CursorKotlinUseIssueDetector.kt
@@ -73,4 +73,4 @@
constraint = minSdkLessThan(16)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime-lint/src/main/java/androidx/room/lint/RoomIssueRegistry.kt b/room/room-runtime-lint/src/main/java/androidx/room/lint/RoomIssueRegistry.kt
index daedba0..8210e01 100644
--- a/room/room-runtime-lint/src/main/java/androidx/room/lint/RoomIssueRegistry.kt
+++ b/room/room-runtime-lint/src/main/java/androidx/room/lint/RoomIssueRegistry.kt
@@ -32,4 +32,4 @@
identifier = "androidx.room",
vendorName = "Android Open Source Project",
)
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime-lint/src/test/java/androidx/room/lint/CursorKotlinUseIssueDetectorTest.kt b/room/room-runtime-lint/src/test/java/androidx/room/lint/CursorKotlinUseIssueDetectorTest.kt
index c9edd9d..4cc25c5 100644
--- a/room/room-runtime-lint/src/test/java/androidx/room/lint/CursorKotlinUseIssueDetectorTest.kt
+++ b/room/room-runtime-lint/src/test/java/androidx/room/lint/CursorKotlinUseIssueDetectorTest.kt
@@ -111,4 +111,4 @@
.run()
.expectClean()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/build.gradle b/room/room-runtime/build.gradle
index d099c3e..c6067b0 100644
--- a/room/room-runtime/build.gradle
+++ b/room/room-runtime/build.gradle
@@ -56,7 +56,7 @@
testImplementation("androidx.lifecycle:lifecycle-livedata-core:2.0.0")
testImplementation(libs.kotlinStdlib)
testImplementation(libs.kotlinTest)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation(libs.testRunner) // Needed for @FlakyTest and @Ignore
androidTestImplementation(libs.junit)
@@ -68,7 +68,7 @@
androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(project(":internal-testutils-truth")) // for assertThrows
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation("androidx.arch.core:core-testing:2.2.0")
}
diff --git a/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperFactoryTest.kt b/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperFactoryTest.kt
index 2efa582..db6a259 100644
--- a/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperFactoryTest.kt
+++ b/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperFactoryTest.kt
@@ -148,4 +148,4 @@
val db = autoClosingRoomOpenHelper.writableDatabase
assertTrue(db.isOpen)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperTest.kt b/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperTest.kt
index dae040f..c8d60c9 100644
--- a/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperTest.kt
+++ b/room/room-runtime/src/androidTest/java/androidx/room/AutoClosingRoomOpenHelperTest.kt
@@ -288,4 +288,4 @@
this.close()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/AutoCloser.kt b/room/room-runtime/src/main/java/androidx/room/AutoCloser.kt
index 456d2a9..885f035 100644
--- a/room/room-runtime/src/main/java/androidx/room/AutoCloser.kt
+++ b/room/room-runtime/src/main/java/androidx/room/AutoCloser.kt
@@ -224,4 +224,4 @@
const val autoCloseBug = "https://issuetracker.google.com/issues/new?component=" +
"413107&template=1096568"
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.kt b/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.kt
index 5c5b923..387fd5c 100644
--- a/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.kt
+++ b/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelper.kt
@@ -567,4 +567,4 @@
binds.clear()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelperFactory.kt b/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelperFactory.kt
index b48a25d..59ee286 100644
--- a/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelperFactory.kt
+++ b/room/room-runtime/src/main/java/androidx/room/AutoClosingRoomOpenHelperFactory.kt
@@ -32,4 +32,4 @@
): AutoClosingRoomOpenHelper {
return AutoClosingRoomOpenHelper(delegate.create(configuration), autoCloser)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/DatabaseConfiguration.kt b/room/room-runtime/src/main/java/androidx/room/DatabaseConfiguration.kt
index 7a2fc43..239c47f 100644
--- a/room/room-runtime/src/main/java/androidx/room/DatabaseConfiguration.kt
+++ b/room/room-runtime/src/main/java/androidx/room/DatabaseConfiguration.kt
@@ -686,4 +686,4 @@
!migrationNotRequiredFrom.contains(fromVersion))
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/DelegatingOpenHelper.kt b/room/room-runtime/src/main/java/androidx/room/DelegatingOpenHelper.kt
index 5aa0c3d..b3eac5e 100644
--- a/room/room-runtime/src/main/java/androidx/room/DelegatingOpenHelper.kt
+++ b/room/room-runtime/src/main/java/androidx/room/DelegatingOpenHelper.kt
@@ -28,4 +28,4 @@
* configurations on specific instances can be applied.
*/
val delegate: SupportSQLiteOpenHelper
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/EntityDeletionOrUpdateAdapter.kt b/room/room-runtime/src/main/java/androidx/room/EntityDeletionOrUpdateAdapter.kt
index d140a3e..4773a8d 100644
--- a/room/room-runtime/src/main/java/androidx/room/EntityDeletionOrUpdateAdapter.kt
+++ b/room/room-runtime/src/main/java/androidx/room/EntityDeletionOrUpdateAdapter.kt
@@ -104,4 +104,4 @@
release(stmt)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/EntityInsertionAdapter.kt b/room/room-runtime/src/main/java/androidx/room/EntityInsertionAdapter.kt
index 0e2473a..f83a77e 100644
--- a/room/room-runtime/src/main/java/androidx/room/EntityInsertionAdapter.kt
+++ b/room/room-runtime/src/main/java/androidx/room/EntityInsertionAdapter.kt
@@ -226,4 +226,4 @@
release(stmt)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/ExperimentalRoomApi.kt b/room/room-runtime/src/main/java/androidx/room/ExperimentalRoomApi.kt
index 965bdde..20ed03b 100644
--- a/room/room-runtime/src/main/java/androidx/room/ExperimentalRoomApi.kt
+++ b/room/room-runtime/src/main/java/androidx/room/ExperimentalRoomApi.kt
@@ -27,4 +27,4 @@
@Suppress("UnsafeOptInUsageError")
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalRoomApi
\ No newline at end of file
+annotation class ExperimentalRoomApi
diff --git a/room/room-runtime/src/main/java/androidx/room/InvalidationTracker.kt b/room/room-runtime/src/main/java/androidx/room/InvalidationTracker.kt
index 91b934a..38067b7 100644
--- a/room/room-runtime/src/main/java/androidx/room/InvalidationTracker.kt
+++ b/room/room-runtime/src/main/java/androidx/room/InvalidationTracker.kt
@@ -836,4 +836,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationClient.kt b/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationClient.kt
index bbf6f8e..fce2ec7 100644
--- a/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationClient.kt
+++ b/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationClient.kt
@@ -126,4 +126,4 @@
appContext.unbindService(serviceConnection)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationService.kt b/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationService.kt
index 06ecd35..3bac1ea 100644
--- a/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationService.kt
+++ b/room/room-runtime/src/main/java/androidx/room/MultiInstanceInvalidationService.kt
@@ -119,4 +119,4 @@
override fun onBind(intent: Intent): IBinder {
return binder
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/Room.kt b/room/room-runtime/src/main/java/androidx/room/Room.kt
index 3aa15d5..d0cb585 100644
--- a/room/room-runtime/src/main/java/androidx/room/Room.kt
+++ b/room/room-runtime/src/main/java/androidx/room/Room.kt
@@ -113,4 +113,4 @@
}
return RoomDatabase.Builder(context, klass, name)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.kt b/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.kt
index 44f7f15..879f98d 100644
--- a/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.kt
+++ b/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.kt
@@ -241,4 +241,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/RoomSQLiteQuery.kt b/room/room-runtime/src/main/java/androidx/room/RoomSQLiteQuery.kt
index f04d520..9a2e832b 100644
--- a/room/room-runtime/src/main/java/androidx/room/RoomSQLiteQuery.kt
+++ b/room/room-runtime/src/main/java/androidx/room/RoomSQLiteQuery.kt
@@ -230,4 +230,4 @@
private const val STRING = 4
private const val BLOB = 5
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/RoomTrackingLiveData.kt b/room/room-runtime/src/main/java/androidx/room/RoomTrackingLiveData.kt
index d4f19ab..171b57d 100644
--- a/room/room-runtime/src/main/java/androidx/room/RoomTrackingLiveData.kt
+++ b/room/room-runtime/src/main/java/androidx/room/RoomTrackingLiveData.kt
@@ -123,4 +123,4 @@
} else {
database.queryExecutor
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelper.kt b/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelper.kt
index 37d3ebd..3672ab0 100644
--- a/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelper.kt
+++ b/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelper.kt
@@ -239,4 +239,4 @@
.build()
return factory.create(configuration)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelperFactory.kt b/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelperFactory.kt
index 1c695f5..9ecb35b 100644
--- a/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelperFactory.kt
+++ b/room/room-runtime/src/main/java/androidx/room/SQLiteCopyOpenHelperFactory.kt
@@ -42,4 +42,4 @@
mDelegate.create(configuration)
)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/SharedSQLiteStatement.kt b/room/room-runtime/src/main/java/androidx/room/SharedSQLiteStatement.kt
index 9f3ef6e..db68fc5 100644
--- a/room/room-runtime/src/main/java/androidx/room/SharedSQLiteStatement.kt
+++ b/room/room-runtime/src/main/java/androidx/room/SharedSQLiteStatement.kt
@@ -85,4 +85,4 @@
lock.set(false)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/TransactionExecutor.kt b/room/room-runtime/src/main/java/androidx/room/TransactionExecutor.kt
index 965fdad..93ba86d 100644
--- a/room/room-runtime/src/main/java/androidx/room/TransactionExecutor.kt
+++ b/room/room-runtime/src/main/java/androidx/room/TransactionExecutor.kt
@@ -51,4 +51,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/migration/AutoMigrationSpec.kt b/room/room-runtime/src/main/java/androidx/room/migration/AutoMigrationSpec.kt
index 7b163c0..99b2ea0 100644
--- a/room/room-runtime/src/main/java/androidx/room/migration/AutoMigrationSpec.kt
+++ b/room/room-runtime/src/main/java/androidx/room/migration/AutoMigrationSpec.kt
@@ -32,4 +32,4 @@
* @param db The SQLite database.
*/
fun onPostMigrate(db: SupportSQLiteDatabase) {}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/migration/Migration.kt b/room/room-runtime/src/main/java/androidx/room/migration/Migration.kt
index 6250702..63b20d2 100644
--- a/room/room-runtime/src/main/java/androidx/room/migration/Migration.kt
+++ b/room/room-runtime/src/main/java/androidx/room/migration/Migration.kt
@@ -51,4 +51,4 @@
* @param db The database instance
*/
abstract fun migrate(db: SupportSQLiteDatabase)
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/CursorUtil.kt b/room/room-runtime/src/main/java/androidx/room/util/CursorUtil.kt
index dc4d7be..6e94283 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/CursorUtil.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/CursorUtil.kt
@@ -180,4 +180,4 @@
return super.getColumnIndex(columnName)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/DBUtil.kt b/room/room-runtime/src/main/java/androidx/room/util/DBUtil.kt
index bc82786..99a5d96 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/DBUtil.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/DBUtil.kt
@@ -210,4 +210,4 @@
append(key).append("\n")
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/FileUtil.kt b/room/room-runtime/src/main/java/androidx/room/util/FileUtil.kt
index 0d0c550..c1f843b 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/FileUtil.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/FileUtil.kt
@@ -55,4 +55,4 @@
input.close()
output.close()
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/FtsTableInfo.kt b/room/room-runtime/src/main/java/androidx/room/util/FtsTableInfo.kt
index e439ee5..5590d3b 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/FtsTableInfo.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/FtsTableInfo.kt
@@ -180,4 +180,4 @@
return options
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/StringUtil.kt b/room/room-runtime/src/main/java/androidx/room/util/StringUtil.kt
index 18424f9..f8565fa 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/StringUtil.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/StringUtil.kt
@@ -82,4 +82,4 @@
*/
fun joinIntoString(input: List<Int>?): String? {
return input?.joinToString(",")
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/TableInfo.kt b/room/room-runtime/src/main/java/androidx/room/util/TableInfo.kt
index 246dfdc..2b6ed45 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/TableInfo.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/TableInfo.kt
@@ -644,4 +644,4 @@
val orders = ordersMap.values.toList()
TableInfo.Index(name, unique, columns, orders)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/UUIDUtil.kt b/room/room-runtime/src/main/java/androidx/room/util/UUIDUtil.kt
index 4d7810c..cc51865 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/UUIDUtil.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/UUIDUtil.kt
@@ -52,4 +52,4 @@
buffer.putLong(uuid.mostSignificantBits)
buffer.putLong(uuid.leastSignificantBits)
return buffer.array()
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/main/java/androidx/room/util/ViewInfo.kt b/room/room-runtime/src/main/java/androidx/room/util/ViewInfo.kt
index 6c664ce..f07a80a 100644
--- a/room/room-runtime/src/main/java/androidx/room/util/ViewInfo.kt
+++ b/room/room-runtime/src/main/java/androidx/room/util/ViewInfo.kt
@@ -79,4 +79,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/BuilderTest_TestDatabase_Impl.kt b/room/room-runtime/src/test/java/androidx/room/BuilderTest_TestDatabase_Impl.kt
index 482b0fa..23f511e 100644
--- a/room/room-runtime/src/test/java/androidx/room/BuilderTest_TestDatabase_Impl.kt
+++ b/room/room-runtime/src/test/java/androidx/room/BuilderTest_TestDatabase_Impl.kt
@@ -43,4 +43,4 @@
): List<Migration> {
return mAutoMigrations
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/InvalidationLiveDataContainerTest.kt b/room/room-runtime/src/test/java/androidx/room/InvalidationLiveDataContainerTest.kt
index b63bfa0..73d7ca9b 100644
--- a/room/room-runtime/src/test/java/androidx/room/InvalidationLiveDataContainerTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/InvalidationLiveDataContainerTest.kt
@@ -107,4 +107,4 @@
private fun <T> createComputeFunction(): Callable<T> {
return Callable<T> { null }
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/InvalidationTrackerTest.kt b/room/room-runtime/src/test/java/androidx/room/InvalidationTrackerTest.kt
index 6c95435..483589a3d 100644
--- a/room/room-runtime/src/test/java/androidx/room/InvalidationTrackerTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/InvalidationTrackerTest.kt
@@ -513,4 +513,4 @@
result.clear()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/ObservedTableTrackerTest.kt b/room/room-runtime/src/test/java/androidx/room/ObservedTableTrackerTest.kt
index 0b7c29f..098d1b4 100644
--- a/room/room-runtime/src/test/java/androidx/room/ObservedTableTrackerTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/ObservedTableTrackerTest.kt
@@ -121,4 +121,4 @@
return result
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/RoomSQLiteQueryTest.kt b/room/room-runtime/src/test/java/androidx/room/RoomSQLiteQueryTest.kt
index 44c455f..99e8bd1 100644
--- a/room/room-runtime/src/test/java/androidx/room/RoomSQLiteQueryTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/RoomSQLiteQueryTest.kt
@@ -143,4 +143,4 @@
assertThat(itr.next().capacity).isEqualTo(i)
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/SQLiteCopyOpenHelperTest.kt b/room/room-runtime/src/test/java/androidx/room/SQLiteCopyOpenHelperTest.kt
index be50aa4..c3ad6a2 100644
--- a/room/room-runtime/src/test/java/androidx/room/SQLiteCopyOpenHelperTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/SQLiteCopyOpenHelperTest.kt
@@ -285,4 +285,4 @@
openHelper.writableDatabase
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/SharedSQLiteStatementTest.kt b/room/room-runtime/src/test/java/androidx/room/SharedSQLiteStatementTest.kt
index 705f7a1..eee59cb 100644
--- a/room/room-runtime/src/test/java/androidx/room/SharedSQLiteStatementTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/SharedSQLiteStatementTest.kt
@@ -96,4 +96,4 @@
assertThat(stmt1).isNotNull()
assertThat(stmt1).isEqualTo(stmt2)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/TransactionExecutorTest.kt b/room/room-runtime/src/test/java/androidx/room/TransactionExecutorTest.kt
index df061cc..8d6b455 100644
--- a/room/room-runtime/src/test/java/androidx/room/TransactionExecutorTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/TransactionExecutorTest.kt
@@ -84,4 +84,4 @@
latch.countDown()
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/util/CursorUtilTest.kt b/room/room-runtime/src/test/java/androidx/room/util/CursorUtilTest.kt
index 3b5c269..91be749 100644
--- a/room/room-runtime/src/test/java/androidx/room/util/CursorUtilTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/util/CursorUtilTest.kt
@@ -68,4 +68,4 @@
)
).isEqualTo(-1)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-runtime/src/test/java/androidx/room/util/UUIDUtilTest.kt b/room/room-runtime/src/test/java/androidx/room/util/UUIDUtilTest.kt
index 7c5105d..ff0120b 100644
--- a/room/room-runtime/src/test/java/androidx/room/util/UUIDUtilTest.kt
+++ b/room/room-runtime/src/test/java/androidx/room/util/UUIDUtilTest.kt
@@ -52,4 +52,4 @@
assertThat(result).isEqualTo(expected)
}
-}
\ No newline at end of file
+}
diff --git a/room/room-rxjava2/build.gradle b/room/room-rxjava2/build.gradle
index 0425945..950ade3 100644
--- a/room/room-rxjava2/build.gradle
+++ b/room/room-rxjava2/build.gradle
@@ -30,7 +30,7 @@
implementation("androidx.arch.core:core-runtime:2.2.0")
implementation(libs.kotlinStdlib)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation(libs.kotlinTest)
testImplementation(libs.mockitoCore4)
testImplementation(libs.mockitoKotlin4)
diff --git a/room/room-rxjava2/src/test/java/androidx/room/RxRoomTest.kt b/room/room-rxjava2/src/test/java/androidx/room/RxRoomTest.kt
index 1aa1aec..5d4177c 100644
--- a/room/room-rxjava2/src/test/java/androidx/room/RxRoomTest.kt
+++ b/room/room-rxjava2/src/test/java/androidx/room/RxRoomTest.kt
@@ -248,4 +248,4 @@
mCount++
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-rxjava3/build.gradle b/room/room-rxjava3/build.gradle
index b83c5b0..54c852e 100644
--- a/room/room-rxjava3/build.gradle
+++ b/room/room-rxjava3/build.gradle
@@ -31,7 +31,7 @@
implementation("androidx.arch.core:core-runtime:2.2.0")
implementation(libs.kotlinStdlib)
- testImplementation(project(":internal-testutils-kmp"))
+ testImplementation(project(":kruth:kruth"))
testImplementation(libs.kotlinTest)
testImplementation(libs.mockitoCore4)
testImplementation(libs.mockitoKotlin4)
diff --git a/room/room-rxjava3/src/test/java/androidx/room/rxjava3/RxRoomTest.kt b/room/room-rxjava3/src/test/java/androidx/room/rxjava3/RxRoomTest.kt
index 447d37a..9101245fc 100644
--- a/room/room-rxjava3/src/test/java/androidx/room/rxjava3/RxRoomTest.kt
+++ b/room/room-rxjava3/src/test/java/androidx/room/rxjava3/RxRoomTest.kt
@@ -262,4 +262,4 @@
mCount++
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-testing/build.gradle b/room/room-testing/build.gradle
index 67f56fd..a682c88 100644
--- a/room/room-testing/build.gradle
+++ b/room/room-testing/build.gradle
@@ -39,7 +39,7 @@
api(libs.junit)
implementation("androidx.arch.core:core-runtime:2.2.0")
androidTestImplementation(libs.truth) // Kruth currently lacks StringSubject#containsMatch
- androidTestImplementation(project(":internal-testutils-kmp"))
+ androidTestImplementation(project(":kruth:kruth"))
androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.testCore)
diff --git a/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/AutoMigrationAndMigrationTest.kt b/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/AutoMigrationAndMigrationTest.kt
index 6b8e988..b0231ab 100644
--- a/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/AutoMigrationAndMigrationTest.kt
+++ b/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/AutoMigrationAndMigrationTest.kt
@@ -97,4 +97,4 @@
override fun migrate(db: SupportSQLiteDatabase) {}
}
}
-}
\ No newline at end of file
+}
diff --git a/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/SimpleAutoMigrationDb.kt b/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/SimpleAutoMigrationDb.kt
index 7580b90..da1c645 100644
--- a/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/SimpleAutoMigrationDb.kt
+++ b/room/room-testing/src/androidTest/java/androidx/room/testing/kotlintestapp/migration/SimpleAutoMigrationDb.kt
@@ -94,4 +94,4 @@
companion object {
const val LATEST_VERSION = 1
}
-}
\ No newline at end of file
+}
diff --git a/room/room-testing/src/main/java/androidx/room/testing/MigrationTestHelper.kt b/room/room-testing/src/main/java/androidx/room/testing/MigrationTestHelper.kt
index 1627a03..689fa7b 100644
--- a/room/room-testing/src/main/java/androidx/room/testing/MigrationTestHelper.kt
+++ b/room/room-testing/src/main/java/androidx/room/testing/MigrationTestHelper.kt
@@ -676,4 +676,4 @@
} + 1 // Shift by 1 to get primary key position
}
}
-}
\ No newline at end of file
+}
diff --git a/room/settings.gradle b/room/settings.gradle
index b253b61..a3602ac 100644
--- a/room/settings.gradle
+++ b/room/settings.gradle
@@ -33,7 +33,7 @@
if (name == ":annotation:annotation-experimental-lint") return true
if (name == ":annotation:annotation-experimental-lint-integration-tests") return true
if (name == ":internal-testutils-truth") return true
- if (name == ":internal-testutils-kmp") return true
+ if (name == ":kruth:kruth") return true
return false
})
}
diff --git a/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/NestedScrollViewCoordinatorLayoutAppBarActivity.kt b/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/NestedScrollViewCoordinatorLayoutAppBarActivity.kt
index d9608bc..5c6283c 100644
--- a/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/NestedScrollViewCoordinatorLayoutAppBarActivity.kt
+++ b/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/NestedScrollViewCoordinatorLayoutAppBarActivity.kt
@@ -32,4 +32,4 @@
}
findViewById<TextView>(R.id.appbarlayout_tv).text = sb.toString()
}
-}
\ No newline at end of file
+}
diff --git a/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/RecyclerViewCoordinatorLayoutAppBarActivity.kt b/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/RecyclerViewCoordinatorLayoutAppBarActivity.kt
index ce8e561..a3c4693 100644
--- a/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/RecyclerViewCoordinatorLayoutAppBarActivity.kt
+++ b/samples/AndroidXDemos/src/main/java/com/example/androidx/widget/RecyclerViewCoordinatorLayoutAppBarActivity.kt
@@ -58,4 +58,4 @@
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val nameTextView: TextView = itemView.findViewById<TextView>(R.id.recyclerview_item_label)
}
-}
\ No newline at end of file
+}
diff --git a/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/RoutesManager.java b/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/RoutesManager.java
index f4d1b6f..1c4ecff 100644
--- a/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/RoutesManager.java
+++ b/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/RoutesManager.java
@@ -29,8 +29,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
-import androidx.core.os.BuildCompat;
import androidx.mediarouter.media.MediaRouter;
import androidx.mediarouter.media.MediaRouterParams;
import androidx.mediarouter.media.RouteListingPreference;
@@ -145,7 +143,6 @@
*
* <p>Does not affect the system's state if called on a device running API 33 or older.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void setRouteListingPreferenceEnabled(boolean routeListingPreferenceEnabled) {
mRouteListingPreferenceEnabled = routeListingPreferenceEnabled;
onRouteListingPreferenceChanged();
@@ -165,7 +162,6 @@
*
* <p>Does not affect the system's state if called on a device running API 33 or older.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void setRouteListingSystemOrderingPreferred(
boolean routeListingSystemOrderringPreferred) {
mRouteListingSystemOrderingPreferred = routeListingSystemOrderringPreferred;
@@ -188,7 +184,6 @@
*
* @see #setRouteListingPreferenceEnabled
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
public void setRouteListingPreferenceItems(
@NonNull List<RouteListingPreferenceItemHolder> preference) {
mRouteListingPreferenceItems =
diff --git a/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/activities/RouteListingPreferenceActivity.java b/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/activities/RouteListingPreferenceActivity.java
index 308d3c8..5848b18 100644
--- a/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/activities/RouteListingPreferenceActivity.java
+++ b/samples/MediaRoutingDemo/src/main/java/com/example/androidx/mediarouting/activities/RouteListingPreferenceActivity.java
@@ -35,10 +35,8 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.os.BuildCompat;
import androidx.mediarouter.media.MediaRouter;
import androidx.mediarouter.media.RouteListingPreference;
import androidx.recyclerview.widget.ItemTouchHelper;
@@ -62,13 +60,11 @@
private RoutesManager mRoutesManager;
private RecyclerView mRouteListingPreferenceRecyclerView;
-
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
Toast.makeText(
/* context= */ this,
"Route Listing Preference requires Android U+",
diff --git a/samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt b/samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt
index 67fee43..b188b7b 100644
--- a/samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt
+++ b/samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt
@@ -558,4 +558,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/samples/SupportPreferenceDemos/src/main/java/com/example/androidx/preference/TwoPanePreferences.kt b/samples/SupportPreferenceDemos/src/main/java/com/example/androidx/preference/TwoPanePreferences.kt
index 44b8e46..2d93c61 100644
--- a/samples/SupportPreferenceDemos/src/main/java/com/example/androidx/preference/TwoPanePreferences.kt
+++ b/samples/SupportPreferenceDemos/src/main/java/com/example/androidx/preference/TwoPanePreferences.kt
@@ -80,4 +80,4 @@
super.onCreate(savedInstanceState)
setContentView(R.layout.two_pane_preferences)
}
-}
\ No newline at end of file
+}
diff --git a/savedstate/savedstate/src/main/java/androidx/savedstate/Recreator.kt b/savedstate/savedstate/src/main/java/androidx/savedstate/Recreator.kt
index cc14d2d..3f335e1 100644
--- a/savedstate/savedstate/src/main/java/androidx/savedstate/Recreator.kt
+++ b/savedstate/savedstate/src/main/java/androidx/savedstate/Recreator.kt
@@ -94,4 +94,4 @@
const val CLASSES_KEY = "classes_to_restore"
const val COMPONENT_KEY = "androidx.savedstate.Restarter"
}
-}
\ No newline at end of file
+}
diff --git a/settings.gradle b/settings.gradle
index 3338b43..9d36f45 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -603,6 +603,7 @@
includeProject(":compose:material:material-icons-extended-sharp", [BuildType.COMPOSE])
includeProject(":compose:material:material-icons-extended-twotone", [BuildType.COMPOSE])
includeProject(":compose:material:material-ripple", [BuildType.COMPOSE])
+includeProject(":compose:material:material-ripple:material-ripple-benchmark", "compose/material/material-ripple/benchmark", [BuildType.COMPOSE])
includeProject(":compose:material:material:icons:generator", [BuildType.COMPOSE])
includeProject(":compose:material:material:integration-tests:material-demos", [BuildType.COMPOSE])
includeProject(":compose:material:material:integration-tests:material-catalog", [BuildType.COMPOSE])
@@ -1155,13 +1156,13 @@
includeProject(":internal-testutils-fonts", "testutils/testutils-fonts", [BuildType.MAIN, BuildType.GLANCE, BuildType.MEDIA, BuildType.FLAN, BuildType.COMPOSE])
includeProject(":internal-testutils-truth", "testutils/testutils-truth")
includeProject(":internal-testutils-ktx", "testutils/testutils-ktx")
-includeProject(":internal-testutils-kmp", "testutils/testutils-kmp", [BuildType.MAIN, BuildType.INFRAROGUE, BuildType.KMP, BuildType.COMPOSE])
includeProject(":internal-testutils-macrobenchmark", "testutils/testutils-macrobenchmark", [BuildType.MAIN, BuildType.COMPOSE])
includeProject(":internal-testutils-navigation", "testutils/testutils-navigation", [BuildType.MAIN, BuildType.COMPOSE, BuildType.FLAN])
includeProject(":internal-testutils-paging", "testutils/testutils-paging", [BuildType.MAIN, BuildType.COMPOSE])
includeProject(":internal-testutils-paparazzi", "testutils/testutils-paparazzi", [BuildType.COMPOSE])
includeProject(":internal-testutils-gradle-plugin", "testutils/testutils-gradle-plugin", [BuildType.MAIN, BuildType.FLAN, BuildType.COMPOSE, BuildType.TOOLS])
includeProject(":internal-testutils-mockito", "testutils/testutils-mockito", [BuildType.MAIN, BuildType.MEDIA, BuildType.FLAN, BuildType.COMPOSE])
+includeProject(":kruth:kruth", [BuildType.MAIN, BuildType.INFRAROGUE, BuildType.KMP, BuildType.COMPOSE])
/////////////////////////////
//
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
index 500fe4a..3fe86c3 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
@@ -153,4 +153,4 @@
assertThat(findViewX(R.id.list_pane)).isLessThan(findViewX(R.id.detail_pane))
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldingFeatureObserverTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldingFeatureObserverTest.kt
index 43bb949..7137970 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldingFeatureObserverTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldingFeatureObserverTest.kt
@@ -108,4 +108,4 @@
assertEquals(expected, features.first())
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/LockModeTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/LockModeTest.kt
index fe2cdae..65d241c2 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/LockModeTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/LockModeTest.kt
@@ -199,4 +199,4 @@
assertThat(panelSlideCountDownLatch.await(2, TimeUnit.SECONDS)).isFalse()
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/PanelSlideListenerTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/PanelSlideListenerTest.kt
index a98a7d9..cba32e9 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/PanelSlideListenerTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/PanelSlideListenerTest.kt
@@ -127,4 +127,4 @@
.isFalse()
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlideableStateListenerTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlideableStateListenerTest.kt
index 490a911..15a6aa1 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlideableStateListenerTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlideableStateListenerTest.kt
@@ -104,4 +104,4 @@
.isNull()
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlidingPaneLayoutTest.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlidingPaneLayoutTest.kt
index 5eaa47f..82b0b8f 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlidingPaneLayoutTest.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/SlidingPaneLayoutTest.kt
@@ -205,4 +205,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/ActivityScenario.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/ActivityScenario.kt
index 8d7f3a8..3413f7f 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/ActivityScenario.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/ActivityScenario.kt
@@ -91,4 +91,4 @@
})
}
return latch
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/Espresso.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/Espresso.kt
index 90baa0d..ece868a 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/Espresso.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/Espresso.kt
@@ -82,4 +82,4 @@
return !(item as SlidingPaneLayout).isSlideable
}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/TestActivity.kt b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/TestActivity.kt
index 0e4d8ef..812f45e 100644
--- a/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/TestActivity.kt
+++ b/slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/helpers/TestActivity.kt
@@ -41,4 +41,4 @@
public companion object {
public var onActivityCreated: ((TestActivity) -> Unit) = {}
}
-}
\ No newline at end of file
+}
diff --git a/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/FoldingFeatureObserver.kt b/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/FoldingFeatureObserver.kt
index d4ae2e7..61aaae7 100644
--- a/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/FoldingFeatureObserver.kt
+++ b/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/FoldingFeatureObserver.kt
@@ -88,4 +88,4 @@
return windowLayoutInfo.displayFeatures
.firstOrNull { feature -> feature is FoldingFeature } as? FoldingFeature
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/integration-tests/inspection-sqldelight-testapp/src/androidTest/java/androidx/sqlite/inspection/SqlDelightInvalidationTest.kt b/sqlite/integration-tests/inspection-sqldelight-testapp/src/androidTest/java/androidx/sqlite/inspection/SqlDelightInvalidationTest.kt
index 7770c1d..6ef97f2 100644
--- a/sqlite/integration-tests/inspection-sqldelight-testapp/src/androidTest/java/androidx/sqlite/inspection/SqlDelightInvalidationTest.kt
+++ b/sqlite/integration-tests/inspection-sqldelight-testapp/src/androidTest/java/androidx/sqlite/inspection/SqlDelightInvalidationTest.kt
@@ -166,4 +166,4 @@
) {
// no-op
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkOpenHelperTest.kt b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkOpenHelperTest.kt
index bc5555a..63444f5 100644
--- a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkOpenHelperTest.kt
+++ b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkOpenHelperTest.kt
@@ -62,4 +62,4 @@
assertThat(firstRef).isEqualTo(secondRef)
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabaseTest.kt b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabaseTest.kt
index 66d82ae..a5bade8 100644
--- a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabaseTest.kt
+++ b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabaseTest.kt
@@ -159,4 +159,4 @@
allowDataLossOnRecovery = false
).writableDatabase.close()
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/OpenHelperRecoveryTest.kt b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/OpenHelperRecoveryTest.kt
index bd32a62..d307b12 100644
--- a/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/OpenHelperRecoveryTest.kt
+++ b/sqlite/sqlite-framework/src/androidTest/java/androidx/sqlite/db/framework/OpenHelperRecoveryTest.kt
@@ -267,4 +267,4 @@
override fun onCorruption(db: SupportSQLiteDatabase) {
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.kt
index b9aeb34..886f90b 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteDatabase.kt
@@ -332,4 +332,4 @@
)
private val EMPTY_STRING_ARRAY = arrayOfNulls<String>(0)
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.kt
index 65adc7e..21ea6a0 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelper.kt
@@ -338,4 +338,4 @@
* constructor.
*/
private class DBRefHolder(var db: FrameworkSQLiteDatabase?)
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelperFactory.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelperFactory.kt
index a549b04..19e1677 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelperFactory.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteOpenHelperFactory.kt
@@ -33,4 +33,4 @@
configuration.allowDataLossOnRecovery
)
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteProgram.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteProgram.kt
index 3707078..e84d133 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteProgram.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteProgram.kt
@@ -51,4 +51,4 @@
override fun close() {
delegate.close()
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteStatement.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteStatement.kt
index 51f726e..866bdaf 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteStatement.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/db/framework/FrameworkSQLiteStatement.kt
@@ -49,4 +49,4 @@
override fun simpleQueryForString(): String? {
return delegate.simpleQueryForString()
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt
index dc07eb9..1d176e5 100644
--- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt
+++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt
@@ -101,4 +101,4 @@
return threadLocksMap.getOrPut(key) { ReentrantLock() }
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/CancellationQueryTest.kt b/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/CancellationQueryTest.kt
index 642fa58..e662a57 100644
--- a/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/CancellationQueryTest.kt
+++ b/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/CancellationQueryTest.kt
@@ -113,4 +113,4 @@
FROM m2 GROUP BY cy
)
SELECT * FROM a;
-"""
\ No newline at end of file
+"""
diff --git a/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/DatabaseLockingTest.kt b/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/DatabaseLockingTest.kt
index 492b7b2..c876b09 100644
--- a/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/DatabaseLockingTest.kt
+++ b/sqlite/sqlite-inspection/src/androidTest/java/androidx/sqlite/inspection/test/DatabaseLockingTest.kt
@@ -371,4 +371,4 @@
private fun insertValue(instance: SQLiteDatabase, value: Int) =
instance.execSQL("insert into ${table.name} values ($value)")
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/DatabaseRegistry.java b/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/DatabaseRegistry.java
index 2ff137d..0a80c05 100644
--- a/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/DatabaseRegistry.java
+++ b/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/DatabaseRegistry.java
@@ -371,7 +371,7 @@
* This should only be called after removing the object from
* {@link DatabaseRegistry#mKeepOpenReferences}. Otherwise, the object will get in its
* own way or releasing its references.
- **/
+ */
private void releaseAllReferences() {
synchronized (mLock) {
for (; mAcquiredReferenceCount > 0; mAcquiredReferenceCount--) {
diff --git a/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/SqliteInspector.java b/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/SqliteInspector.java
index 19e5564..b1776de 100644
--- a/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/SqliteInspector.java
+++ b/sqlite/sqlite-inspection/src/main/java/androidx/sqlite/inspection/SqliteInspector.java
@@ -438,7 +438,7 @@
private void registerInvalidationHooks(EntryExitMatchingHookRegistry hookRegistry) {
/**
* Schedules a task using {@link mScheduledExecutor} and executes it on {@link mIOExecutor}.
- **/
+ */
final RequestCollapsingThrottler.DeferredExecutor deferredExecutor =
new RequestCollapsingThrottler.DeferredExecutor() {
@Override
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SimpleSQLiteQuery.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SimpleSQLiteQuery.kt
index e3245e2..a19ce02 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SimpleSQLiteQuery.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SimpleSQLiteQuery.kt
@@ -109,4 +109,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.kt
index ad7e945..36c2f87 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteCompat.kt
@@ -292,4 +292,4 @@
return cursor.notificationUris!!
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteDatabase.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteDatabase.kt
index d4c24aa..d2fa862 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteDatabase.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteDatabase.kt
@@ -595,4 +595,4 @@
* false otherwise.
*/
val isDatabaseIntegrityOk: Boolean
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt
index a2ca95f..070dd70 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteOpenHelper.kt
@@ -422,4 +422,4 @@
*/
fun create(configuration: Configuration): SupportSQLiteOpenHelper
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteProgram.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteProgram.kt
index 2397f94..12a68e7 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteProgram.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteProgram.kt
@@ -69,4 +69,4 @@
* Clears all existing bindings. Unset bindings are treated as NULL.
*/
fun clearBindings()
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQuery.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQuery.kt
index 8108f2d..6e9a598 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQuery.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQuery.kt
@@ -38,4 +38,4 @@
* in the query string. See: https://www.sqlite.org/c3ref/bind_blob.html for details.
*/
val argCount: Int
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQueryBuilder.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQueryBuilder.kt
index a7afd1d..3ed9087 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQueryBuilder.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteQueryBuilder.kt
@@ -183,4 +183,4 @@
return SupportSQLiteQueryBuilder(tableName)
}
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteStatement.kt b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteStatement.kt
index 097ffb5..32fc2fe 100644
--- a/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteStatement.kt
+++ b/sqlite/sqlite/src/main/java/androidx/sqlite/db/SupportSQLiteStatement.kt
@@ -68,4 +68,4 @@
* @throws [android.database.sqlite.SQLiteDoneException] if the query returns zero rows
*/
fun simpleQueryForString(): String?
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/test/java/androidx/sqlite/db/SimpleSQLiteQueryTest.kt b/sqlite/sqlite/src/test/java/androidx/sqlite/db/SimpleSQLiteQueryTest.kt
index bf6edb4..f505a63 100644
--- a/sqlite/sqlite/src/test/java/androidx/sqlite/db/SimpleSQLiteQueryTest.kt
+++ b/sqlite/sqlite/src/test/java/androidx/sqlite/db/SimpleSQLiteQueryTest.kt
@@ -63,4 +63,4 @@
val query = SimpleSQLiteQuery("foo", emptyArray())
assertThat(query.argCount, `is`(0))
}
-}
\ No newline at end of file
+}
diff --git a/sqlite/sqlite/src/test/java/androidx/sqlite/db/SupportSQLiteQueryBuilderTest.kt b/sqlite/sqlite/src/test/java/androidx/sqlite/db/SupportSQLiteQueryBuilderTest.kt
index 27d5773..cded7e6 100644
--- a/sqlite/sqlite/src/test/java/androidx/sqlite/db/SupportSQLiteQueryBuilderTest.kt
+++ b/sqlite/sqlite/src/test/java/androidx/sqlite/db/SupportSQLiteQueryBuilderTest.kt
@@ -74,4 +74,4 @@
"SELECT country_published FROM Books WHERE country_published=USA"
)
}
-}
\ No newline at end of file
+}
diff --git a/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/StableAidlVariantExtension.kt b/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/StableAidlVariantExtension.kt
index c251087..b1fa5ce 100644
--- a/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/StableAidlVariantExtension.kt
+++ b/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/StableAidlVariantExtension.kt
@@ -24,4 +24,4 @@
*/
interface StableAidlVariantExtension : VariantExtension {
val version: Property<Int>
-}
\ No newline at end of file
+}
diff --git a/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/tasks/StableAidlProcessor.kt b/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/tasks/StableAidlProcessor.kt
index 02b6bedb..d2bc042 100644
--- a/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/tasks/StableAidlProcessor.kt
+++ b/stableaidl/stableaidl-gradle-plugin/src/main/java/androidx/stableaidl/tasks/StableAidlProcessor.kt
@@ -122,4 +122,4 @@
}
}
FileUtils.delete(depFile)
-}
\ No newline at end of file
+}
diff --git a/stableaidl/stableaidl-gradle-plugin/src/test/java/androidx/stableaidl/internal/fixtures/FakeNoOpWorkAction.kt b/stableaidl/stableaidl-gradle-plugin/src/test/java/androidx/stableaidl/internal/fixtures/FakeNoOpWorkAction.kt
index 543e2dd..a7ba1e2 100644
--- a/stableaidl/stableaidl-gradle-plugin/src/test/java/androidx/stableaidl/internal/fixtures/FakeNoOpWorkAction.kt
+++ b/stableaidl/stableaidl-gradle-plugin/src/test/java/androidx/stableaidl/internal/fixtures/FakeNoOpWorkAction.kt
@@ -24,4 +24,4 @@
abstract val execOperations: ExecOperations
abstract class Parameters : WorkParameters
-}
\ No newline at end of file
+}
diff --git a/startup/integration-tests/test-app/src/main/java/androidx/startup/testapp/SecondaryProvider.kt b/startup/integration-tests/test-app/src/main/java/androidx/startup/testapp/SecondaryProvider.kt
index 6059758..050fcaa 100644
--- a/startup/integration-tests/test-app/src/main/java/androidx/startup/testapp/SecondaryProvider.kt
+++ b/startup/integration-tests/test-app/src/main/java/androidx/startup/testapp/SecondaryProvider.kt
@@ -18,4 +18,4 @@
import androidx.startup.InitializationProvider
-class SecondaryProvider : InitializationProvider()
\ No newline at end of file
+class SecondaryProvider : InitializationProvider()
diff --git a/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/GtestRunner.kt b/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/GtestRunner.kt
index 8856467..2540943 100644
--- a/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/GtestRunner.kt
+++ b/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/GtestRunner.kt
@@ -82,4 +82,4 @@
private external fun initialize(className: String, description: Description)
private external fun addTest(testName: String)
private external fun run(className: String, notifier: RunNotifier): Boolean
-}
\ No newline at end of file
+}
diff --git a/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/TargetLibrary.kt b/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/TargetLibrary.kt
index db82d8c..85d2abd 100644
--- a/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/TargetLibrary.kt
+++ b/test/ext/junit-gtest/src/main/java/androidx/test/ext/junitgtest/TargetLibrary.kt
@@ -24,4 +24,4 @@
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Inherited
-annotation class TargetLibrary(val libraryName: String)
\ No newline at end of file
+annotation class TargetLibrary(val libraryName: String)
diff --git a/test/integration-tests/junit-gtest-test/src/androidTest/java/androidx/test/ext/junitgtesttest/GtestRunnerTest.kt b/test/integration-tests/junit-gtest-test/src/androidTest/java/androidx/test/ext/junitgtesttest/GtestRunnerTest.kt
index 2d694aa..4a53723 100644
--- a/test/integration-tests/junit-gtest-test/src/androidTest/java/androidx/test/ext/junitgtesttest/GtestRunnerTest.kt
+++ b/test/integration-tests/junit-gtest-test/src/androidTest/java/androidx/test/ext/junitgtesttest/GtestRunnerTest.kt
@@ -100,4 +100,4 @@
@RunWith(GtestRunner::class)
@TargetLibrary(libraryName = "apptest")
class NativeTests
-}
\ No newline at end of file
+}
diff --git a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/MSSIMMatcherTest.kt b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/MSSIMMatcherTest.kt
index ff613a4..586e0e8 100644
--- a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/MSSIMMatcherTest.kt
+++ b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/MSSIMMatcherTest.kt
@@ -125,4 +125,4 @@
assertThat(result).isWithin(0.001).of(0.921)
}
-}
\ No newline at end of file
+}
diff --git a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/PixelPerfectMatcherTest.kt b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/PixelPerfectMatcherTest.kt
index e333c5e..0dd2e11 100644
--- a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/PixelPerfectMatcherTest.kt
+++ b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/PixelPerfectMatcherTest.kt
@@ -55,4 +55,4 @@
assertThat(result.matches).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/ScreenshotTestRuleTest.kt b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/ScreenshotTestRuleTest.kt
index 3dc6acb..5f34b54 100644
--- a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/ScreenshotTestRuleTest.kt
+++ b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/ScreenshotTestRuleTest.kt
@@ -163,4 +163,4 @@
throw AssertionError("No AssertionError thrown!")
}
-}
\ No newline at end of file
+}
diff --git a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/utils/BitmapUtils.kt b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/utils/BitmapUtils.kt
index 5c72dd5..b52d54e 100644
--- a/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/utils/BitmapUtils.kt
+++ b/test/screenshot/screenshot/src/androidTest/java/androidx/test/screenshot/utils/BitmapUtils.kt
@@ -25,4 +25,4 @@
context.assets.open("$imageName.png").use {
return BitmapFactory.decodeStream(it)
}
-}
\ No newline at end of file
+}
diff --git a/test/screenshot/screenshot/src/main/java/androidx/test/screenshot/matchers/PixelPerfectMatcher.kt b/test/screenshot/screenshot/src/main/java/androidx/test/screenshot/matchers/PixelPerfectMatcher.kt
index c76ac48..e9c9e1e 100644
--- a/test/screenshot/screenshot/src/main/java/androidx/test/screenshot/matchers/PixelPerfectMatcher.kt
+++ b/test/screenshot/screenshot/src/main/java/androidx/test/screenshot/matchers/PixelPerfectMatcher.kt
@@ -73,4 +73,4 @@
Color.TRANSPARENT
}
}
-}
\ No newline at end of file
+}
diff --git a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/MultiDisplayTest.java b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/MultiDisplayTest.java
index 484dd9f..8d9ef75 100644
--- a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/MultiDisplayTest.java
+++ b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/MultiDisplayTest.java
@@ -17,6 +17,7 @@
package androidx.test.uiautomator.testapp;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -31,21 +32,21 @@
import androidx.test.core.app.ApplicationProvider;
import androidx.test.filters.SdkSuppress;
import androidx.test.uiautomator.By;
+import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
import java.util.Arrays;
+import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@SdkSuppress(minSdkVersion = 30)
public class MultiDisplayTest extends BaseTest {
- private static final int MULTI_DISPLAY_FLAGS =
- Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
-
@Before
public void assumeMultiDisplay() {
// Tests need to run with multiple displays.
@@ -53,20 +54,85 @@
}
@Test
- public void testMultiDisplay_click() {
- int selectedDisplayId = getSecondaryDisplayId();
- launchTestActivityOnDisplay(ClickTestActivity.class, selectedDisplayId);
+ public void testMultiDisplay_selector() {
+ int secondaryDisplayId = getSecondaryDisplayId();
+ launchTestActivity(MainActivity.class);
+ launchTestActivityOnDisplay(IsFocusedTestActivity.class, secondaryDisplayId);
- UiObject2 button = mDevice.findObject(By.res(TEST_APP, "button1"));
+ // Found when display ID not specified.
+ assertEquals(2, mDevice.findObjects(By.res(TEST_APP, "button")).size());
+
+ // Not found with wrong display ID.
+ assertFalse(mDevice.hasObject(
+ By.res(TEST_APP, "nested_elements").displayId(secondaryDisplayId)));
+ assertFalse(
+ mDevice.hasObject(By.res(TEST_APP, "focusable_text_view").displayId(
+ Display.DEFAULT_DISPLAY)));
+
+ // Found with correct display ID.
+ assertTrue(
+ mDevice.hasObject(
+ By.res(TEST_APP, "nested_elements").displayId(Display.DEFAULT_DISPLAY)));
+ assertTrue(mDevice.hasObject(
+ By.res(TEST_APP, "focusable_text_view").displayId(secondaryDisplayId)));
+ }
+
+ @Test
+ public void testMultiDisplay_click() {
+ int secondaryDisplayId = getSecondaryDisplayId();
+ launchTestActivityOnDisplay(ClickTestActivity.class, secondaryDisplayId);
+
+ UiObject2 button = mDevice.findObject(
+ By.res(TEST_APP, "button1").displayId(secondaryDisplayId));
button.click();
- assertEquals(selectedDisplayId, button.getDisplayId());
+ assertEquals(secondaryDisplayId, button.getDisplayId());
assertTrue(button.wait(Until.textEquals("text1_clicked"), TIMEOUT_MS));
}
+ @Test
+ public void testMultiDisplay_treeRelationship() {
+ int secondaryDisplayId = getSecondaryDisplayId();
+ launchTestActivityOnDisplay(ParentChildTestActivity.class, secondaryDisplayId);
+
+ // Different display IDs between parent and child.
+ BySelector invalidChildSelector = By.res(TEST_APP, "tree_N3").displayId(
+ Display.DEFAULT_DISPLAY);
+ List<UiObject2> invalidParent =
+ mDevice.findObjects(
+ By.hasChild(invalidChildSelector).displayId(secondaryDisplayId));
+ assertEquals(0, invalidParent.size());
+
+ // Same display ID between ancestor and descendant.
+ BySelector validAncestorSelector =
+ By.res(TEST_APP, "tree_N1").displayId(secondaryDisplayId);
+ UiObject2 validDescendant =
+ mDevice.findObject(By.hasAncestor(validAncestorSelector).displayId(
+ secondaryDisplayId).textContains("4"));
+ assertEquals("tree_N4", validDescendant.getText());
+ }
+
+ @Test
+ public void testMultiDisplay_displayMetrics() throws IOException {
+ int secondaryDisplayId = getSecondaryDisplayId();
+
+ try {
+ int width = 800;
+ int height = 400;
+ mDevice.executeShellCommand(
+ String.format("wm size %dx%d -d %d", width, height, secondaryDisplayId));
+
+ assertEquals(width, mDevice.getDisplayWidth(secondaryDisplayId));
+ assertEquals(height, mDevice.getDisplayHeight(secondaryDisplayId));
+ } finally {
+ mDevice.executeShellCommand(
+ String.format("wm size reset -d %d", secondaryDisplayId));
+ }
+ }
+
// Helper to launch an activity on a specific display.
private void launchTestActivityOnDisplay(@NonNull Class<? extends Activity> activity,
int displayId) {
- launchTestActivity(activity, new Intent().setFlags(MULTI_DISPLAY_FLAGS),
+ launchTestActivity(activity, new Intent().setFlags(DEFAULT_FLAGS),
ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle());
}
@@ -80,13 +146,7 @@
// Helper to get the ID of the first non-default display.
private static int getSecondaryDisplayId() {
- int selectedDisplayId = 0;
- for (int displayId : getDisplayIds()) {
- if (displayId != Display.DEFAULT_DISPLAY) {
- selectedDisplayId = displayId;
- break;
- }
- }
- return selectedDisplayId;
+ return getDisplayIds().stream().filter(
+ id -> id != Display.DEFAULT_DISPLAY).findFirst().orElse(-1);
}
}
diff --git a/test/uiautomator/uiautomator/api/current.txt b/test/uiautomator/uiautomator/api/current.txt
index 4d2748d..8f7bdde 100644
--- a/test/uiautomator/uiautomator/api/current.txt
+++ b/test/uiautomator/uiautomator/api/current.txt
@@ -16,6 +16,7 @@
method public static androidx.test.uiautomator.BySelector descContains(String);
method public static androidx.test.uiautomator.BySelector descEndsWith(String);
method public static androidx.test.uiautomator.BySelector descStartsWith(String);
+ method @RequiresApi(30) public static androidx.test.uiautomator.BySelector displayId(int);
method public static androidx.test.uiautomator.BySelector enabled(boolean);
method public static androidx.test.uiautomator.BySelector focusable(boolean);
method public static androidx.test.uiautomator.BySelector focused(boolean);
@@ -60,6 +61,7 @@
method public androidx.test.uiautomator.BySelector descContains(String);
method public androidx.test.uiautomator.BySelector descEndsWith(String);
method public androidx.test.uiautomator.BySelector descStartsWith(String);
+ method @RequiresApi(30) public androidx.test.uiautomator.BySelector displayId(int);
method public androidx.test.uiautomator.BySelector enabled(boolean);
method public androidx.test.uiautomator.BySelector focusable(boolean);
method public androidx.test.uiautomator.BySelector focused(boolean);
@@ -167,16 +169,19 @@
method public void dumpWindowHierarchy(java.io.File) throws java.io.IOException;
method public void dumpWindowHierarchy(java.io.OutputStream) throws java.io.IOException;
method @Deprecated public void dumpWindowHierarchy(String);
+ method @Discouraged(message="Can be useful for simple commands, but lacks support for proper error handling, input data, or complex commands (quotes, pipes) that can be obtained from UiAutomation#executeShellCommandRwe or similar utilities.") @RequiresApi(21) public String executeShellCommand(String) throws java.io.IOException;
method public androidx.test.uiautomator.UiObject2! findObject(androidx.test.uiautomator.BySelector);
method public androidx.test.uiautomator.UiObject findObject(androidx.test.uiautomator.UiSelector);
method public java.util.List<androidx.test.uiautomator.UiObject2!> findObjects(androidx.test.uiautomator.BySelector);
method public void freezeRotation() throws android.os.RemoteException;
method @Deprecated public String! getCurrentActivityName();
method public String! getCurrentPackageName();
- method public int getDisplayHeight();
+ method @Px public int getDisplayHeight();
+ method @Px public int getDisplayHeight(int);
method public int getDisplayRotation();
method public android.graphics.Point getDisplaySizeDp();
- method public int getDisplayWidth();
+ method @Px public int getDisplayWidth();
+ method @Px public int getDisplayWidth(int);
method @Deprecated public static androidx.test.uiautomator.UiDevice getInstance();
method public static androidx.test.uiautomator.UiDevice getInstance(android.app.Instrumentation);
method public String! getLastTraversedText();
diff --git a/test/uiautomator/uiautomator/api/restricted_current.txt b/test/uiautomator/uiautomator/api/restricted_current.txt
index 4d2748d..8f7bdde 100644
--- a/test/uiautomator/uiautomator/api/restricted_current.txt
+++ b/test/uiautomator/uiautomator/api/restricted_current.txt
@@ -16,6 +16,7 @@
method public static androidx.test.uiautomator.BySelector descContains(String);
method public static androidx.test.uiautomator.BySelector descEndsWith(String);
method public static androidx.test.uiautomator.BySelector descStartsWith(String);
+ method @RequiresApi(30) public static androidx.test.uiautomator.BySelector displayId(int);
method public static androidx.test.uiautomator.BySelector enabled(boolean);
method public static androidx.test.uiautomator.BySelector focusable(boolean);
method public static androidx.test.uiautomator.BySelector focused(boolean);
@@ -60,6 +61,7 @@
method public androidx.test.uiautomator.BySelector descContains(String);
method public androidx.test.uiautomator.BySelector descEndsWith(String);
method public androidx.test.uiautomator.BySelector descStartsWith(String);
+ method @RequiresApi(30) public androidx.test.uiautomator.BySelector displayId(int);
method public androidx.test.uiautomator.BySelector enabled(boolean);
method public androidx.test.uiautomator.BySelector focusable(boolean);
method public androidx.test.uiautomator.BySelector focused(boolean);
@@ -167,16 +169,19 @@
method public void dumpWindowHierarchy(java.io.File) throws java.io.IOException;
method public void dumpWindowHierarchy(java.io.OutputStream) throws java.io.IOException;
method @Deprecated public void dumpWindowHierarchy(String);
+ method @Discouraged(message="Can be useful for simple commands, but lacks support for proper error handling, input data, or complex commands (quotes, pipes) that can be obtained from UiAutomation#executeShellCommandRwe or similar utilities.") @RequiresApi(21) public String executeShellCommand(String) throws java.io.IOException;
method public androidx.test.uiautomator.UiObject2! findObject(androidx.test.uiautomator.BySelector);
method public androidx.test.uiautomator.UiObject findObject(androidx.test.uiautomator.UiSelector);
method public java.util.List<androidx.test.uiautomator.UiObject2!> findObjects(androidx.test.uiautomator.BySelector);
method public void freezeRotation() throws android.os.RemoteException;
method @Deprecated public String! getCurrentActivityName();
method public String! getCurrentPackageName();
- method public int getDisplayHeight();
+ method @Px public int getDisplayHeight();
+ method @Px public int getDisplayHeight(int);
method public int getDisplayRotation();
method public android.graphics.Point getDisplaySizeDp();
- method public int getDisplayWidth();
+ method @Px public int getDisplayWidth();
+ method @Px public int getDisplayWidth(int);
method @Deprecated public static androidx.test.uiautomator.UiDevice getInstance();
method public static androidx.test.uiautomator.UiDevice getInstance(android.app.Instrumentation);
method public String! getLastTraversedText();
diff --git a/test/uiautomator/uiautomator/lint-baseline.xml b/test/uiautomator/uiautomator/lint-baseline.xml
index a62bf81..6476f95 100644
--- a/test/uiautomator/uiautomator/lint-baseline.xml
+++ b/test/uiautomator/uiautomator/lint-baseline.xml
@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.1.0-beta02" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta02)" variant="all" version="8.1.0-beta02">
-
- <issue
- id="BanHideAnnotation"
- message="@hide is not allowed in Javadoc"
- errorLine1=" public String executeShellCommand(@NonNull String cmd) throws IOException {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/test/uiautomator/UiDevice.java"/>
- </issue>
+<issues format="6" by="lint 8.1.0-beta05" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.0-beta05)" variant="all" version="8.1.0-beta05">
<issue
id="BanUncheckedReflection"
diff --git a/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/BySelectorTest.java b/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/BySelectorTest.java
index adc78fa..9c169a1 100644
--- a/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/BySelectorTest.java
+++ b/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/BySelectorTest.java
@@ -170,6 +170,13 @@
By.depth(-1);
}
+ @Test
+ @SdkSuppress(minSdkVersion = 30)
+ public void testDisplayId_alreadyDefined() {
+ assertThrows(IllegalStateException.class,
+ () -> By.displayId(0).displayId(1));
+ }
+
@Test(expected = NullPointerException.class)
public void testHasParent_nullValue() {
By.hasParent(null);
diff --git a/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/UiDeviceTest.java b/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/UiDeviceTest.java
index 451fc66..2eb7ffa 100644
--- a/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/UiDeviceTest.java
+++ b/test/uiautomator/uiautomator/src/androidTest/java/androidx/test/uiautomator/UiDeviceTest.java
@@ -30,14 +30,12 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.ContentResolver;
-import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.Point;
import android.os.Build;
import android.provider.Settings;
import android.util.DisplayMetrics;
-import android.view.Display;
-import android.view.WindowManager;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.filters.SdkSuppress;
@@ -51,6 +49,8 @@
import java.io.File;
import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class UiDeviceTest {
@@ -81,13 +81,30 @@
}
@Test
- public void testGetDisplaySizeDp() {
- DisplayMetrics dm = new DisplayMetrics();
- WindowManager wm = (WindowManager) mDevice.getUiContext(Display.DEFAULT_DISPLAY)
- .getSystemService(Context.WINDOW_SERVICE);
- wm.getDefaultDisplay().getRealMetrics(dm);
- assertEquals(Math.round(dm.widthPixels / dm.density), mDevice.getDisplaySizeDp().x);
- assertEquals(Math.round(dm.heightPixels / dm.density), mDevice.getDisplaySizeDp().y);
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.LOLLIPOP)
+ public void testGetDisplayMetrics() throws IOException {
+ String densityCmdOutput = mDevice.executeShellCommand("wm density");
+ Pattern densityPattern = Pattern.compile("^Physical\\sdensity:\\s(\\d+)\\D+.*");
+ Matcher densityMatcher = densityPattern.matcher(densityCmdOutput);
+ assertTrue(densityMatcher.find());
+ String densityDpi = densityMatcher.group(1);
+ assertNotNull(densityDpi);
+ float density = Float.parseFloat(densityDpi) / DisplayMetrics.DENSITY_DEFAULT;
+
+ try {
+ int width = 800;
+ int height = 400;
+ mDevice.executeShellCommand(String.format("wm size %dx%d", width, height));
+
+ Point expectedSizeDp = new Point(Math.round(width / density),
+ Math.round(height / density));
+
+ assertEquals(width, mDevice.getDisplayWidth());
+ assertEquals(height, mDevice.getDisplayHeight());
+ assertEquals(expectedSizeDp, mDevice.getDisplaySizeDp());
+ } finally {
+ mDevice.executeShellCommand("wm size reset");
+ }
}
@Test
@@ -96,24 +113,6 @@
}
@Test
- public void testGetDisplayWidth() {
- DisplayMetrics dm = new DisplayMetrics();
- WindowManager wm = (WindowManager) mDevice.getUiContext(Display.DEFAULT_DISPLAY)
- .getSystemService(Context.WINDOW_SERVICE);
- wm.getDefaultDisplay().getRealMetrics(dm);
- assertEquals(dm.widthPixels, mDevice.getDisplayWidth());
- }
-
- @Test
- public void testGetDisplayHeight() {
- DisplayMetrics dm = new DisplayMetrics();
- WindowManager wm = (WindowManager) mDevice.getUiContext(Display.DEFAULT_DISPLAY)
- .getSystemService(Context.WINDOW_SERVICE);
- wm.getDefaultDisplay().getRealMetrics(dm);
- assertEquals(dm.heightPixels, mDevice.getDisplayHeight());
- }
-
- @Test
public void testRegisterAndRunUiWatcher_conditionMet() {
// The watcher will return true when its watching condition is met.
UiWatcher watcher = () -> true;
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
index 525e1a6..b7b61c0 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/AccessibilityNodeInfoDumper.java
@@ -88,6 +88,10 @@
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
serializer.attribute("", "hint", safeCharSeqToString(Api26Impl.getHintText(node)));
}
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ serializer.attribute("", "display-id",
+ Integer.toString(Api30Impl.getDisplayId(node)));
+ }
int count = node.getChildCount();
for (int i = 0; i < count; i++) {
AccessibilityNodeInfo child = node.getChild(i);
@@ -212,4 +216,15 @@
return chars != null ? chars.toString() : null;
}
}
+
+ @RequiresApi(30)
+ static class Api30Impl {
+ private Api30Impl() {
+ }
+
+ @DoNotInline
+ static int getDisplayId(AccessibilityNodeInfo accessibilityNodeInfo) {
+ return accessibilityNodeInfo.getWindow().getDisplayId();
+ }
+ }
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/By.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/By.java
index d09a771..96e145d 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/By.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/By.java
@@ -356,6 +356,16 @@
}
/**
+ * Constructs a new {@link BySelector} and sets the display ID criteria.
+ *
+ * @see BySelector#displayId(int)
+ */
+ @RequiresApi(30)
+ public static @NonNull BySelector displayId(int displayId) {
+ return new BySelector().displayId(displayId);
+ }
+
+ /**
* Constructs a new {@link BySelector} and adds a parent selector criteria.
*
* @see BySelector#hasParent(BySelector)
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/ByMatcher.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/ByMatcher.java
index d2ff604..ba5cf89 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/ByMatcher.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/ByMatcher.java
@@ -110,6 +110,9 @@
/** Searches the hierarchy under the root for nodes that match the selector. */
private List<AccessibilityNodeInfo> findMatches(AccessibilityNodeInfo root) {
+ if (!matchesDisplayId(root)) {
+ return new ArrayList<>();
+ }
List<AccessibilityNodeInfo> ret = findMatches(root, 0, new PartialMatchList());
if (ret.isEmpty()) {
// No matches found, run watchers and retry.
@@ -131,7 +134,7 @@
PartialMatchList partialMatches) {
List<AccessibilityNodeInfo> ret = new ArrayList<>();
- // Don't bother searching the subtree if it is not visible
+ // Don't bother searching the subtree if it is not visible.
if (!node.isVisibleToUser()) {
return ret;
}
@@ -184,6 +187,32 @@
return ret;
}
+ /** Returns true if the display ID criteria is null or equal to that of the node. */
+ private boolean matchesDisplayId(AccessibilityNodeInfo node) {
+ Set<Integer> displayIds = getDisplayIds(mRootSelector);
+ if (displayIds.size() == 0) {
+ // No display ID specified in the selector tree.
+ return true;
+ } else if (displayIds.size() > 1) {
+ // A selector tree with multiple display IDs is invalid.
+ return false;
+ }
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
+ && displayIds.contains(Api30Impl.getDisplayId(node));
+ }
+
+ /** Returns all the specified display IDs in the selector tree. */
+ private Set<Integer> getDisplayIds(BySelector selector) {
+ Set<Integer> displayIds = new HashSet<>();
+ if (selector.mDisplayId != null) {
+ displayIds.add(selector.mDisplayId);
+ }
+ for (BySelector childSelector : selector.mChildSelectors) {
+ displayIds.addAll(getDisplayIds(childSelector));
+ }
+ return displayIds;
+ }
+
/**
* Represents a potential match with a {@link BySelector}. The attributes of the selector were
* matched, but its child selectors may not have been matched.
@@ -390,4 +419,15 @@
}
}
}
+
+ @RequiresApi(30)
+ static class Api30Impl {
+ private Api30Impl() {
+ }
+
+ @DoNotInline
+ static int getDisplayId(AccessibilityNodeInfo accessibilityNodeInfo) {
+ return accessibilityNodeInfo.getWindow().getDisplayId();
+ }
+ }
}
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/BySelector.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/BySelector.java
index ed4f64b..59c3159 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/BySelector.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/BySelector.java
@@ -55,6 +55,9 @@
Integer mMinDepth;
Integer mMaxDepth;
+ // Display ID
+ Integer mDisplayId;
+
// Ancestor selector
BySelector mAncestorSelector;
Integer mMaxAncestorDistance;
@@ -92,6 +95,8 @@
mMinDepth = original.mMinDepth;
mMaxDepth = original.mMaxDepth;
+ mDisplayId = original.mDisplayId;
+
mAncestorSelector = original.mAncestorSelector == null ? null :
new BySelector(original.mAncestorSelector);
mMaxAncestorDistance = original.mMaxAncestorDistance;
@@ -638,6 +643,23 @@
}
/**
+ * Adds a display ID selector criteria for matching. A UI element will be considered a match
+ * if it is within the display with the ID of {@code displayId} and all other criteria for
+ * this selector are met.
+ *
+ * @param displayId The display ID to match. Use {@link Display#getDisplayId()} to get the ID.
+ * @return A reference to this {@link BySelector}.
+ */
+ @RequiresApi(30)
+ public @NonNull BySelector displayId(int displayId) {
+ if (mDisplayId != null) {
+ throw new IllegalStateException("Display ID selector is already defined");
+ }
+ mDisplayId = displayId;
+ return this;
+ }
+
+ /**
* Adds a parent selector criteria for matching. A UI element will be considered a match if it
* has a parent element (direct ancestor) which matches the {@code parentSelector} and all
* other criteria for this selector are met.
@@ -791,6 +813,9 @@
if (mSelected != null) {
builder.append("SELECTED='").append(mSelected).append("', ");
}
+ if (mDisplayId != null) {
+ builder.append("DISPLAY_ID='").append(mDisplayId).append("', ");
+ }
if (mAncestorSelector != null) {
builder.append("ANCESTOR='")
.append(mAncestorSelector.toString().substring(11))
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/GestureController.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/GestureController.java
index 03fbd29..005aa1c 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/GestureController.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/GestureController.java
@@ -16,9 +16,7 @@
package androidx.test.uiautomator;
-import android.app.Service;
import android.graphics.Point;
-import android.hardware.display.DisplayManager;
import android.os.SystemClock;
import android.util.Log;
import android.view.Display;
@@ -62,8 +60,6 @@
private final UiDevice mDevice;
- private final DisplayManager mDisplayManager;
-
/** Comparator for sorting PointerGestures by start times. */
private static final Comparator<PointerGesture> START_TIME_COMPARATOR =
(o1, o2) -> Long.compare(o1.delay(), o2.delay());
@@ -76,8 +72,6 @@
// Private constructor.
private GestureController(UiDevice device) {
mDevice = device;
- mDisplayManager = (DisplayManager) mDevice.getInstrumentation().getContext()
- .getSystemService(Service.DISPLAY_SERVICE);
}
/** Returns the {@link GestureController} instance for the given {@link UiDevice}. */
@@ -137,7 +131,7 @@
long injectionDelay = MOTION_EVENT_INJECTION_DELAY_MILLIS;
try {
int displayId = pending.peek().displayId();
- Display display = mDisplayManager.getDisplay(displayId);
+ Display display = mDevice.getDisplayById(displayId);
float displayRefreshRate = display.getRefreshRate();
injectionDelay = (long) (500 / displayRefreshRate);
} catch (Exception e) {
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiDevice.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiDevice.java
index dc72558..8d9dfd1 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiDevice.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiDevice.java
@@ -44,9 +44,11 @@
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityWindowInfo;
+import androidx.annotation.Discouraged;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import androidx.test.uiautomator.util.Traces;
import androidx.test.uiautomator.util.Traces.Section;
@@ -291,25 +293,20 @@
}
/**
- * Returns the display size in dp (device-independent pixel)
+ * Returns the default display size in dp (device-independent pixel).
+ * <p>The returned display size is adjusted per screen rotation. Also this will return the
+ * actual size of the screen, rather than adjusted per system decorations (like status bar).
*
- * The returned display size is adjusted per screen rotation. Also this will return the actual
- * size of the screen, rather than adjusted per system decorations (like status bar).
- *
+ * @see DisplayMetrics#density
* @return a Point containing the display size in dp
*/
@NonNull
public Point getDisplaySizeDp() {
- Display display = getDefaultDisplay();
- Point p = new Point();
- display.getRealSize(p);
- DisplayMetrics metrics = new DisplayMetrics();
- display.getRealMetrics(metrics);
- float dpx = p.x / metrics.density;
- float dpy = p.y / metrics.density;
- p.x = Math.round(dpx);
- p.y = Math.round(dpy);
- return p;
+ Point p = getDisplaySize(Display.DEFAULT_DISPLAY);
+ Context context = getUiContext(Display.DEFAULT_DISPLAY);
+ int densityDpi = context.getResources().getConfiguration().densityDpi;
+ float density = (float) densityDpi / DisplayMetrics.DENSITY_DEFAULT;
+ return new Point(Math.round(p.x / density), Math.round(p.y / density));
}
/**
@@ -547,27 +544,45 @@
}
/**
- * Gets the width of the display, in pixels. The width and height details
- * are reported based on the current orientation of the display.
- * @return width in pixels or zero on failure
+ * Gets the width of the default display, in pixels. The size is adjusted based on the
+ * current orientation of the display.
+ *
+ * @return width in pixels
*/
- public int getDisplayWidth() {
- Display display = getDefaultDisplay();
- Point p = new Point();
- display.getRealSize(p);
- return p.x;
+ public @Px int getDisplayWidth() {
+ return getDisplayWidth(Display.DEFAULT_DISPLAY);
}
/**
- * Gets the height of the display, in pixels. The size is adjusted based
- * on the current orientation of the display.
- * @return height in pixels or zero on failure
+ * Gets the width of the display with {@code displayId}, in pixels. The size is adjusted
+ * based on the current orientation of the display.
+ *
+ * @param displayId the display ID. Use {@link Display#getDisplayId()} to get the ID.
+ * @return width in pixels
*/
- public int getDisplayHeight() {
- Display display = getDefaultDisplay();
- Point p = new Point();
- display.getRealSize(p);
- return p.y;
+ public @Px int getDisplayWidth(int displayId) {
+ return getDisplaySize(displayId).x;
+ }
+
+ /**
+ * Gets the height of the default display, in pixels. The size is adjusted based on the
+ * current orientation of the display.
+ *
+ * @return height in pixels
+ */
+ public @Px int getDisplayHeight() {
+ return getDisplayHeight(Display.DEFAULT_DISPLAY);
+ }
+
+ /**
+ * Gets the height of the display with {@code displayId}, in pixels. The size is adjusted
+ * based on the current orientation of the display.
+ *
+ * @param displayId the display ID. Use {@link Display#getDisplayId()} to get the ID.
+ * @return height in pixels
+ */
+ public @Px int getDisplayHeight(int displayId) {
+ return getDisplaySize(displayId).y;
}
/**
@@ -795,7 +810,7 @@
*/
public int getDisplayRotation() {
waitForIdle();
- return getDefaultDisplay().getRotation();
+ return getDisplayById(Display.DEFAULT_DISPLAY).getRotation();
}
/**
@@ -1111,12 +1126,14 @@
* <p>
* Calling function with large amount of output will have memory impacts, and the function call
* will block if the command executed is blocking.
- * <p>Note: calling this function requires API level 21 or above
+ *
* @param cmd the command to run
* @return the standard output of the command
- * @throws IOException
- * @hide legacy hidden method, kept for compatibility with existing tests.
+ * @throws IOException if an I/O error occurs while reading output
*/
+ @Discouraged(message = "Can be useful for simple commands, but lacks support for proper error"
+ + " handling, input data, or complex commands (quotes, pipes) that can be obtained "
+ + "from UiAutomation#executeShellCommandRwe or similar utilities.")
@RequiresApi(21)
@NonNull
public String executeShellCommand(@NonNull String cmd) throws IOException {
@@ -1133,8 +1150,21 @@
}
}
- private Display getDefaultDisplay() {
- return mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
+ Display getDisplayById(int displayId) {
+ return mDisplayManager.getDisplay(displayId);
+ }
+
+ /**
+ * Gets the size of the display with {@code displayId}, in pixels. The size is adjusted based
+ * on the current orientation of the display.
+ *
+ * @see Display#getRealSize(Point)
+ */
+ Point getDisplaySize(int displayId) {
+ Point p = new Point();
+ Display display = getDisplayById(displayId);
+ display.getRealSize(p);
+ return p;
}
@RequiresApi(21)
@@ -1188,7 +1218,7 @@
Context context = mUiContexts.get(displayId);
if (context == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
- final Display display = mDisplayManager.getDisplay(displayId);
+ final Display display = getDisplayById(displayId);
if (display != null) {
context = Api31Impl.createWindowContext(mInstrumentation.getContext(), display);
} else {
diff --git a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObject2.java b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObject2.java
index ebe32d6..65b2411 100644
--- a/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObject2.java
+++ b/test/uiautomator/uiautomator/src/main/java/androidx/test/uiautomator/UiObject2.java
@@ -17,11 +17,9 @@
package androidx.test.uiautomator;
import android.annotation.SuppressLint;
-import android.app.Service;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
-import android.hardware.display.DisplayManager;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
@@ -331,23 +329,8 @@
/** Returns the visible bounds of a {@code node}. */
private Rect getVisibleBounds(AccessibilityNodeInfo node) {
- Rect screen = new Rect();
- final int displayId = getDisplayId();
- if (displayId == Display.DEFAULT_DISPLAY) {
- screen = new Rect(0, 0, getDevice().getDisplayWidth(), getDevice().getDisplayHeight());
- } else {
- final DisplayManager dm =
- (DisplayManager) mDevice.getInstrumentation().getContext().getSystemService(
- Service.DISPLAY_SERVICE);
- final Display display = dm.getDisplay(getDisplayId());
- if (display != null) {
- final Point size = new Point();
- display.getRealSize(size);
- screen = new Rect(0, 0, size.x, size.y);
- } else {
- Log.d(TAG, String.format("Unable to get the display with id %d.", displayId));
- }
- }
+ Point displaySize = getDevice().getDisplaySize(getDisplayId());
+ Rect screen = new Rect(0, 0, displaySize.x, displaySize.y);
return AccessibilityNodeInfoHelper.getVisibleBoundsInScreen(node, screen, true);
}
diff --git a/testutils/testutils-common/src/main/java/androidx/testutils/ParameterizedHelper.kt b/testutils/testutils-common/src/main/java/androidx/testutils/ParameterizedHelper.kt
index 270b30c..236b362 100644
--- a/testutils/testutils-common/src/main/java/androidx/testutils/ParameterizedHelper.kt
+++ b/testutils/testutils-common/src/main/java/androidx/testutils/ParameterizedHelper.kt
@@ -71,4 +71,4 @@
internal fun List<Int>.product() = this.fold(1) { acc, elem -> acc * elem }
-internal data class RadixDigit(val radix: Int, val digit: Int)
\ No newline at end of file
+internal data class RadixDigit(val radix: Int, val digit: Int)
diff --git a/testutils/testutils-datastore/build.gradle b/testutils/testutils-datastore/build.gradle
index 3b3e7ef..3bb4fcf 100644
--- a/testutils/testutils-datastore/build.gradle
+++ b/testutils/testutils-datastore/build.gradle
@@ -45,6 +45,18 @@
api(libs.kotlinTest)
}
}
+ commonTest {
+ dependencies {
+ implementation(project(":kruth:kruth"))
+ implementation(libs.kotlinTest)
+ }
+ }
+ jvmTest {
+ dependsOn(commonTest)
+ dependencies {
+ implementation(libs.kotlinTest)
+ }
+ }
}
}
diff --git a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/OkioTestIO.kt b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/OkioTestIO.kt
index 84705fc..0581147 100644
--- a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/OkioTestIO.kt
+++ b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/OkioTestIO.kt
@@ -19,73 +19,29 @@
import androidx.datastore.core.InterProcessCoordinator
import androidx.datastore.core.Storage
import androidx.datastore.core.okio.OkioStorage
-import kotlin.random.Random
import kotlin.reflect.KClass
import okio.FileSystem
import okio.IOException
import okio.Path
-import okio.Path.Companion.toPath
-open class OkioTestIO(dirName: String = "test-dir") : TestIO<OkioPath, IOException>(dirName) {
+open class OkioTestIO(
private val fileSystem: FileSystem = FileSystem.SYSTEM
+) : TestIO<OkioPath, IOException>(
+ getTmpDir = {
+ OkioPath(fileSystem = fileSystem, path = FileSystem.SYSTEM_TEMPORARY_DIRECTORY)
+ }
+) {
override fun getStorage(
serializerConfig: TestingSerializerConfig,
coordinatorProducer: () -> InterProcessCoordinator,
- futureFile: () -> TestFile
+ futureFile: () -> OkioPath
): Storage<Byte> {
return OkioStorage(
fileSystem = fileSystem,
serializer = TestingOkioSerializer(serializerConfig),
coordinatorProducer = { _, _ -> coordinatorProducer() }
) {
- futureFile().getAbsolutePath().toPath()
- }
- }
-
- override fun tempDir(
- directoryPath: String?,
- makeDirs: Boolean,
- parentDir: OkioPath?
- ): OkioPath {
- return if (parentDir != null) {
- if (directoryPath != null) {
- val newPath = if (directoryPath.startsWith("/"))
- directoryPath.substring(1) else directoryPath
- val dir = parentDir.path / newPath
- if (makeDirs) {
- fileSystem.createDirectories(dir)
- }
- OkioPath(fileSystem, dir)
- } else {
- OkioPath(fileSystem, parentDir.path / randomFileName(dirName))
- }
- } else {
- if (directoryPath != null) {
- val newPath = if (directoryPath.startsWith("/"))
- directoryPath.substring(1) else directoryPath
- val dir = FileSystem.SYSTEM_TEMPORARY_DIRECTORY / randomFileName(dirName) / newPath
- if (makeDirs) {
- fileSystem.createDirectories(dir)
- }
- OkioPath(fileSystem, dir)
- } else {
- OkioPath(
- fileSystem, FileSystem.SYSTEM_TEMPORARY_DIRECTORY /
- randomFileName(dirName)
- )
- }
- }
- }
-
- override fun newTempFile(tempFolder: OkioPath): OkioPath {
- return OkioPath(fileSystem, tempFolder.path / randomFileName(dirName))
- }
-
- private fun randomFileName( // LAME :)
- prefix: String = "test-file"
- ): String {
- return prefix + (0 until 15).joinToString(separator = "") {
- ('a' + Random.nextInt(from = 0, until = 26)).toString()
+ futureFile().path
}
}
@@ -95,18 +51,9 @@
override fun ioExceptionClass(): KClass<IOException> =
IOException::class
-
- override fun isDirectory(file: OkioPath): Boolean {
- return fileSystem.metadata(file.path).isDirectory
- }
}
-class OkioPath(private val fileSystem: FileSystem, val path: Path) : TestFile() {
-
- override fun getAbsolutePath(): String {
- return path.toString()
- }
-
+class OkioPath(private val fileSystem: FileSystem, val path: Path) : TestFile<OkioPath>() {
override fun delete(): Boolean {
if (!fileSystem.exists(path)) {
// to be consistent with the TestFile API.
@@ -120,10 +67,49 @@
return fileSystem.exists(path)
}
- override fun createIfNotExists(): Boolean {
- if (exists()) return false
- path.parent?.let { fileSystem.createDirectories(it) }
- fileSystem.write(path, mustCreate = true) { "" }
- return true
+ override fun mkdirs(mustCreate: Boolean) {
+ if (exists()) {
+ check(fileSystem.metadataOrNull(path)?.isDirectory == true) {
+ "$path already exists but it is not a directory"
+ }
+ check(!mustCreate) {
+ "Directory $path already exists"
+ }
+ }
+ fileSystem.createDirectories(
+ path,
+ mustCreate = mustCreate
+ )
}
-}
\ No newline at end of file
+
+ override fun isRegularFile(): Boolean {
+ return fileSystem.metadataOrNull(path)?.isRegularFile == true
+ }
+
+ override fun isDirectory(): Boolean {
+ return fileSystem.metadataOrNull(path)?.isDirectory == true
+ }
+
+ override fun protectedResolve(relative: String): OkioPath {
+ return OkioPath(fileSystem, path / relative)
+ }
+
+ override fun parentFile(): OkioPath? {
+ return path.parent?.let {
+ OkioPath(fileSystem = fileSystem, path = it)
+ }
+ }
+
+ override fun protectedWrite(body: ByteArray) {
+ fileSystem.write(path) {
+ write(body)
+ flush()
+ }
+ }
+
+ override fun protectedReadBytes(): ByteArray {
+ return fileSystem.read(path) {
+ readByteArray()
+ }
+ }
+}
diff --git a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestIO.kt b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestIO.kt
index 021e629..f40abff 100644
--- a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestIO.kt
+++ b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestIO.kt
@@ -20,20 +20,29 @@
import androidx.datastore.core.DataStoreFactory.create
import androidx.datastore.core.InterProcessCoordinator
import androidx.datastore.core.Storage
+import kotlin.random.Random
import kotlin.reflect.KClass
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-@OptIn(ExperimentalCoroutinesApi::class)
-abstract class TestIO<F : TestFile, IOE : Throwable>(
- protected val dirName: String = "datastore-test-dir"
+abstract class TestIO<F : TestFile<F>, IOE : Throwable>(
+ getTmpDir: () -> F
) {
+ private val testRoot: F = getTmpDir().let {
+ createNewRandomChild(
+ parent = it,
+ namePrefix = "datastore-testio-"
+ )
+ }
+
+ init {
+ testRoot.mkdirs(mustCreate = true)
+ }
fun getStore(
serializerConfig: TestingSerializerConfig,
scope: CoroutineScope,
coordinatorProducer: () -> InterProcessCoordinator,
- futureFile: () -> TestFile
+ futureFile: () -> F
): DataStore<Byte> {
return create(getStorage(serializerConfig, coordinatorProducer, futureFile), scope = scope)
}
@@ -41,26 +50,52 @@
abstract fun getStorage(
serializerConfig: TestingSerializerConfig,
coordinatorProducer: () -> InterProcessCoordinator,
- futureFile: () -> TestFile = { newTempFile() }
+ futureFile: () -> F = { newTempFile() }
): Storage<Byte>
- abstract fun tempDir(
- directoryPath: String? = null,
- makeDirs: Boolean = true,
- parentDir: F? = null
- ): F
+ private fun randomName(
+ prefix: String
+ ): String {
+ return prefix + (0 until 15).joinToString(separator = "") {
+ ('a' + Random.nextInt(from = 0, until = 26)).toString()
+ }
+ }
- abstract fun newTempFile(tempFolder: F = tempDir()): F
+ protected fun createNewRandomChild(
+ parent: F,
+ namePrefix: String = "test-file-",
+ ): F {
+ while (true) {
+ val child = parent.resolve(randomName(namePrefix))
+ if (!child.exists()) {
+ return child
+ }
+ }
+ }
+
+ /**
+ * Returns a new file instance without creating it or its parents.
+ */
+ fun newTempFile(
+ parentFile: F? = null,
+ relativePath: String? = null
+ ): F {
+ val parent = parentFile ?: testRoot
+ return if (relativePath == null) {
+ createNewRandomChild(
+ parent = parent
+ )
+ } else {
+ parent.resolve(relativePath)
+ }
+ }
abstract fun ioException(message: String): IOE
abstract fun ioExceptionClass(): KClass<IOE>
- abstract fun isDirectory(file: F): Boolean
}
-abstract class TestFile {
- abstract fun getAbsolutePath(): String
-
+abstract class TestFile<T : TestFile<T>> {
/**
* Deletes the file if it exists.
* Will return `false` if the file does not exist or cannot be deleted. (similar to File.delete)
@@ -73,14 +108,91 @@
abstract fun exists(): Boolean
/**
- * Creates the file if it doesn't exist.
- * @return `true` if file didn't exist and gets created and false otherwise.
+ * Creates a directory from the file.
+ *
+ * If it is a regular file, will throw.
+ * If [mustCreate] is `true` and directory already exists, will throw.
*/
- abstract fun createIfNotExists(): Boolean
+ abstract fun mkdirs(mustCreate: Boolean = false)
- fun deleteIfExists() {
- if (exists()) {
- delete()
+ /**
+ * Returns `true` if this exists and a regular file on the filesystem.
+ */
+ abstract fun isRegularFile(): Boolean
+
+ /**
+ * Returns `true` if this exists and is a directory on the filesystem.
+ */
+ abstract fun isDirectory(): Boolean
+
+ /**
+ * Resolves the given [relative] relative to `this`.
+ * (similar to File.resolve in kotlin stdlib).
+ *
+ * Note that this path is sanitized to ensure it is not a root path
+ * (e.g. does not start with `/`)
+ */
+ fun resolve(relative: String): T {
+ return if (relative.startsWith("/")) {
+ protectedResolve(relative.substring(startIndex = 1))
+ } else {
+ protectedResolve(relative)
}
}
-}
\ No newline at end of file
+
+ /**
+ * Implemented by the subclasses to resolve child from sanitized name.
+ */
+ abstract fun protectedResolve(relative: String): T
+
+ /**
+ * Returns the parent file or null if this has no parent.
+ */
+ abstract fun parentFile(): T?
+
+ /**
+ * Writes the given [body] test into the file using the default encoding
+ * (kotlin stdlib's String.encodeToByteArray)
+ */
+ fun write(body: String) {
+ write(body.encodeToByteArray())
+ }
+ /**
+ * Overrides the file with the given contents.
+ * If parent directories do not exist, they'll be created.
+ */
+ fun write(body: ByteArray) {
+ if (isDirectory()) {
+ error("Cannot write to a directory")
+ }
+ parentFile()?.mkdirs(mustCreate = false)
+ parentFile()?.mkdirs()
+ protectedWrite(body)
+ }
+
+ /**
+ * Reads the byte contents of the file.
+ */
+ fun readBytes(): ByteArray {
+ check(exists()) {
+ "File does not exist"
+ }
+ return protectedReadBytes()
+ }
+
+ fun readText() = readBytes().decodeToString()
+
+ /**
+ * Writes the given [body] into the file. This is called after
+ * necessary checks are done so implementers should only focus on
+ * writing the contents.
+ */
+ abstract fun protectedWrite(body: ByteArray)
+
+ /**
+ * Reads the byte contents of the file. This is called after necessary
+ * checks are done so implementers should only focus on reading the
+ * bytes.
+ */
+ abstract fun protectedReadBytes(): ByteArray
+}
diff --git a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingOkioSerializer.kt b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingOkioSerializer.kt
index a9565b9..61fa156 100644
--- a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingOkioSerializer.kt
+++ b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingOkioSerializer.kt
@@ -61,4 +61,4 @@
override val defaultValue: Byte
get() = config.defaultValue
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingSerializerConfig.kt b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingSerializerConfig.kt
index cb4a264..8186ad9 100644
--- a/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingSerializerConfig.kt
+++ b/testutils/testutils-datastore/src/commonMain/kotlin/androidx/datastore/TestingSerializerConfig.kt
@@ -27,4 +27,4 @@
// TestSerializer uses the values from this list in sequence first before it always uses the
// value of failReadWithCorruptionException.
@Volatile var listOfFailReadWithCorruptionException: List<Boolean> = listOf(),
-)
\ No newline at end of file
+)
diff --git a/testutils/testutils-datastore/src/commonTest/kotlin/androidx/datastore/TestIOTestBase.kt b/testutils/testutils-datastore/src/commonTest/kotlin/androidx/datastore/TestIOTestBase.kt
new file mode 100644
index 0000000..e9a524a
--- /dev/null
+++ b/testutils/testutils-datastore/src/commonTest/kotlin/androidx/datastore/TestIOTestBase.kt
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.datastore
+
+import androidx.kruth.assertThat
+import androidx.kruth.assertThrows
+import kotlin.test.Test
+
+class OkioTestIOTest : TestIOTestBase(OkioTestIO())
+
+abstract class TestIOTestBase(
+ private val testIO: TestIO<*, *>
+) {
+ @Test
+ fun writeNewFile() {
+ val file = testIO.newTempFile()
+ assertThat(file.exists()).isFalse()
+ file.write("body")
+ assertThat(file.exists()).isTrue()
+ assertThat(file.isDirectory()).isFalse()
+ assertThat(file.isRegularFile()).isTrue()
+ }
+
+ @Test
+ fun createDirectory() {
+ val file = testIO.newTempFile(relativePath = "some/sub/directory")
+ assertThat(file.exists()).isFalse()
+ file.mkdirs(mustCreate = true)
+ assertThat(file.isDirectory()).isTrue()
+
+ // try to re-create over it, should fail
+ assertThrows<Throwable> {
+ file.mkdirs(mustCreate = true)
+ }
+ // don't need to create so should be fine
+ file.mkdirs(mustCreate = false)
+ }
+
+ @Test
+ fun createDirectory_overFile() {
+ val file = testIO.newTempFile(relativePath = "some/sub/file")
+ file.write("test")
+ assertThrows<Throwable> {
+ file.mkdirs(mustCreate = false)
+ }
+ assertThrows<Throwable> {
+ file.mkdirs(mustCreate = true)
+ }
+ }
+
+ @Test
+ fun writeToDirectory() {
+ val file = testIO.newTempFile(relativePath = "some/dir")
+ file.mkdirs()
+ assertThrows<Throwable> {
+ file.write("some text")
+ }
+ }
+
+ @Test
+ fun resolve() {
+ val file = testIO.newTempFile(relativePath = "dir1/dir2/file")
+ file.write("test")
+ val file2 = testIO.newTempFile(relativePath = "dir1/dir2/file")
+ assertThat(file2.readText()).isEqualTo("test")
+ val parent = testIO.newTempFile(relativePath = "dir1")
+ assertThat(
+ parent.resolve("dir2/file").readText()
+ ).isEqualTo("test")
+ }
+
+ @Test
+ fun delete_regularFile() {
+ val file = testIO.newTempFile(relativePath = "foo")
+ file.write("foo")
+ assertThat(file.isRegularFile()).isTrue()
+ file.delete()
+ assertThat(file.exists()).isFalse()
+ }
+
+ @Test
+ fun delete_directory() {
+ val file = testIO.newTempFile(relativePath = "foo/bar")
+ file.mkdirs()
+ assertThat(file.isDirectory()).isTrue()
+ file.delete()
+ assertThat(file.exists()).isFalse()
+ }
+
+ @Test
+ fun readBytes() {
+ val file = testIO.newTempFile()
+ // cannot read non-existing file
+ assertThrows<Throwable> {
+ file.readBytes()
+ }
+ file.mkdirs()
+ // cannot read a directory
+ assertThrows<Throwable> {
+ file.readBytes()
+ }
+ }
+}
diff --git a/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/FileTestIO.kt b/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/FileTestIO.kt
index 8345eee..f18290f 100644
--- a/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/FileTestIO.kt
+++ b/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/FileTestIO.kt
@@ -22,76 +22,23 @@
import androidx.datastore.core.TestingSerializer
import java.io.File
import java.io.IOException
-import java.util.UUID
import kotlin.reflect.KClass
-class FileTestIO(dirName: String = "test-dir") : TestIO<JavaIOFile, IOException>(dirName) {
-
- override fun tempDir(
- directoryPath: String?,
- makeDirs: Boolean,
- parentDir: JavaIOFile?
- ): JavaIOFile {
- return if (parentDir != null) {
- if (directoryPath != null) {
- val tempPath = File(parentDir.file, directoryPath)
- if (makeDirs) {
- tempPath.mkdirs()
- }
- tempPath.toJavaFile()
- } else {
- val tempPath = File(parentDir.file, "tempPath")
- if (makeDirs) {
- tempPath.mkdirs()
- }
- tempPath.toJavaFile()
- }
- } else {
- if (directoryPath != null) {
- val tempRoot = File.createTempFile("placeholder", "placeholder").parentFile
- val tempPath = File(tempRoot, directoryPath)
- if (makeDirs) {
- tempPath.mkdirs()
- }
- tempPath.toJavaFile()
- } else {
- File.createTempFile("temp", "tmp").parentFile!!.toJavaFile()
- }
- }
+class FileTestIO : TestIO<JavaIOFile, IOException>(
+ getTmpDir = {
+ File(System.getProperty("java.io.tmpdir")).toJavaFile()
}
-
- override fun newTempFile(tempFolder: JavaIOFile): JavaIOFile {
- /**
- * We need to create a new temp file without creating it so we use a UUID to decide the
- * file name but also try 100 times in case a collision happens.
- */
- // TODO use a consistent naming scheme (e.g. incrementing counter) when b/276983736 is
- // fixed. We'll need these TestIO classes to do proper cleanup after themselves to be able
- // do that.
- repeat(100) {
- val randName = UUID.randomUUID().toString().take(10)
- val tmpFile = File(tempFolder.file, "temp-$randName-temp")
- if (!tmpFile.exists()) {
- return tmpFile.toJavaFile()
- }
- }
- error("Unable to create temp file in $tempFolder")
- }
-
+) {
override fun getStorage(
serializerConfig: TestingSerializerConfig,
coordinatorProducer: () -> InterProcessCoordinator,
- futureFile: () -> TestFile
+ futureFile: () -> JavaIOFile
): Storage<Byte> {
return FileStorage(TestingSerializer(serializerConfig), { coordinatorProducer() }) {
- (futureFile() as JavaIOFile).file
+ futureFile().file
}
}
- override fun isDirectory(file: JavaIOFile): Boolean {
- return file.file.isDirectory
- }
-
override fun ioException(message: String): IOException {
return IOException(message)
}
@@ -100,11 +47,7 @@
IOException::class
}
-class JavaIOFile(val file: File) : TestFile() {
- override fun getAbsolutePath(): String {
- return file.absolutePath
- }
-
+class JavaIOFile(val file: File) : TestFile<JavaIOFile>() {
override fun delete(): Boolean {
return file.delete()
}
@@ -113,13 +56,43 @@
return file.exists()
}
- override fun createIfNotExists(): Boolean {
- if (exists()) return false
- file.createNewFile()
- return true
+ override fun mkdirs(mustCreate: Boolean) {
+ if (file.exists()) {
+ check(!mustCreate) {
+ "file $file already exists"
+ }
+ }
+ file.mkdirs()
+ check(file.isDirectory) {
+ "Failed to create directories for $file"
+ }
+ }
+
+ override fun isRegularFile(): Boolean {
+ return file.isFile
+ }
+
+ override fun isDirectory(): Boolean {
+ return file.isDirectory
+ }
+
+ override fun protectedResolve(relative: String): JavaIOFile {
+ return file.resolve(relative).toJavaFile()
+ }
+
+ override fun parentFile(): JavaIOFile? {
+ return file.parentFile?.toJavaFile()
+ }
+
+ override fun protectedWrite(body: ByteArray) {
+ file.writeBytes(body)
+ }
+
+ override fun protectedReadBytes(): ByteArray {
+ return file.readBytes()
}
}
fun File.toJavaFile(): JavaIOFile {
return JavaIOFile(this)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/TestingSerializer.kt b/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/TestingSerializer.kt
index ab60f1f..007d973 100644
--- a/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/TestingSerializer.kt
+++ b/testutils/testutils-datastore/src/jvmMain/kotlin/androidx/datastore/TestingSerializer.kt
@@ -59,4 +59,4 @@
override val defaultValue: Byte
get() = config.defaultValue
-}
\ No newline at end of file
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/testutils/testutils-datastore/src/jvmTest/kotlin/androidx/datastore/FileIOTest.kt
similarity index 87%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to testutils/testutils-datastore/src/jvmTest/kotlin/androidx/datastore/FileIOTest.kt
index 5d73136..c526e8f 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/testutils/testutils-datastore/src/jvmTest/kotlin/androidx/datastore/FileIOTest.kt
@@ -14,6 +14,8 @@
* limitations under the License.
*/
-package androidx.paging
+package androidx.datastore
-public expect annotation class MainThread()
+class FileIOTest : TestIOTestBase(
+ FileTestIO()
+)
diff --git a/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.kt b/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.kt
index c842f46..74ad455 100644
--- a/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.kt
+++ b/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.kt
@@ -37,4 +37,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/VerifyWithPolling.kt b/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/VerifyWithPolling.kt
index 258a218..52beb96 100644
--- a/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/VerifyWithPolling.kt
+++ b/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/VerifyWithPolling.kt
@@ -36,4 +36,4 @@
}
}
return totalDurationMs
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-macrobenchmark/src/main/java/androidx/testutils/MacrobenchUtils.kt b/testutils/testutils-macrobenchmark/src/main/java/androidx/testutils/MacrobenchUtils.kt
index 5af1c28..0bc25f4 100644
--- a/testutils/testutils-macrobenchmark/src/main/java/androidx/testutils/MacrobenchUtils.kt
+++ b/testutils/testutils-macrobenchmark/src/main/java/androidx/testutils/MacrobenchUtils.kt
@@ -142,4 +142,4 @@
add(arrayOf(compilationMode))
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-mockito/src/main/java/androidx/testutils/mockito/MockitoUtils.kt b/testutils/testutils-mockito/src/main/java/androidx/testutils/mockito/MockitoUtils.kt
index cf2edd5..648f6f8 100644
--- a/testutils/testutils-mockito/src/main/java/androidx/testutils/mockito/MockitoUtils.kt
+++ b/testutils/testutils-mockito/src/main/java/androidx/testutils/mockito/MockitoUtils.kt
@@ -86,4 +86,4 @@
* [Mockito.mock] equivalent of [spyThrowOnUnmocked] which doesn't spy an existing instance.
*/
inline fun <reified T> mockThrowOnUnmocked(block: T.() -> Unit = {}) =
- spyThrowOnUnmocked(null, block)
\ No newline at end of file
+ spyThrowOnUnmocked(null, block)
diff --git a/testutils/testutils-paging/build.gradle b/testutils/testutils-paging/build.gradle
index 91046d5..a0ed808 100644
--- a/testutils/testutils-paging/build.gradle
+++ b/testutils/testutils-paging/build.gradle
@@ -14,18 +14,27 @@
* limitations under the License.
*/
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import androidx.build.LibraryType
plugins {
id("AndroidXPlugin")
- id("kotlin")
}
-dependencies {
- api(libs.kotlinStdlib)
- implementation(project(":paging:paging-common"))
- implementation(libs.kotlinTest)
+androidXMultiplatform {
+ jvm()
+ mac()
+ linux()
+ ios()
+
+ sourceSets {
+ commonMain {
+ dependencies {
+ api(libs.kotlinStdlib)
+ implementation(project(":paging:paging-common"))
+ implementation(libs.kotlinTest)
+ }
+ }
+ }
}
androidx {
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/CombinedLoadStatesCapture.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/CombinedLoadStatesCapture.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/CombinedLoadStatesCapture.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/CombinedLoadStatesCapture.kt
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/LoadStateUtils.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/LoadStateUtils.kt
similarity index 99%
rename from testutils/testutils-paging/src/main/java/androidx/paging/LoadStateUtils.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/LoadStateUtils.kt
index 5f0c73c..22b4383 100644
--- a/testutils/testutils-paging/src/main/java/androidx/paging/LoadStateUtils.kt
+++ b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/LoadStateUtils.kt
@@ -79,4 +79,4 @@
refresh = refresh,
prepend = prepend,
append = append,
-)
\ No newline at end of file
+)
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/PageEventUtils.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/PageEventUtils.kt
similarity index 97%
rename from testutils/testutils-paging/src/main/java/androidx/paging/PageEventUtils.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/PageEventUtils.kt
index 006e366..58bfd7b 100644
--- a/testutils/testutils-paging/src/main/java/androidx/paging/PageEventUtils.kt
+++ b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/PageEventUtils.kt
@@ -22,7 +22,7 @@
try {
assertEquals(expected, actual)
} catch (e: Throwable) {
- val msg = e.localizedMessage
+ val msg = e.message!!
.replace("),", "),\n")
.replace("<[", "<[\n ")
.replace("actual", "\nactual")
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/RemoteMediatorMock.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/RemoteMediatorMock.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/RemoteMediatorMock.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/RemoteMediatorMock.kt
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/TestPagingDataDiffer.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/TestPagingDataDiffer.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/TestPagingDataDiffer.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/TestPagingDataDiffer.kt
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/TestPagingSource.kt b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/TestPagingSource.kt
similarity index 99%
rename from testutils/testutils-paging/src/main/java/androidx/paging/TestPagingSource.kt
rename to testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/TestPagingSource.kt
index 809fef2..22cb6274 100644
--- a/testutils/testutils-paging/src/main/java/androidx/paging/TestPagingSource.kt
+++ b/testutils/testutils-paging/src/commonMain/kotlin/androidx/paging/TestPagingSource.kt
@@ -103,4 +103,4 @@
val ITEMS = List(100) { it }
val LOAD_ERROR = Exception("Exception from TestPagingSource.errorNextLoad")
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/LoadStateCapture.kt b/testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/LoadStateCapture.kt
similarity index 99%
rename from testutils/testutils-paging/src/main/java/androidx/paging/LoadStateCapture.kt
rename to testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/LoadStateCapture.kt
index e893eaa4..b44d0bc 100644
--- a/testutils/testutils-paging/src/main/java/androidx/paging/LoadStateCapture.kt
+++ b/testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/LoadStateCapture.kt
@@ -35,4 +35,4 @@
data class LoadStateEvent(
val loadType: LoadType,
val loadState: LoadState,
-)
\ No newline at end of file
+)
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/TestItemKeyedDataSource.kt b/testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestItemKeyedDataSource.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/TestItemKeyedDataSource.kt
rename to testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestItemKeyedDataSource.kt
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/TestPageKeyedDataSource.kt b/testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestPageKeyedDataSource.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/TestPageKeyedDataSource.kt
rename to testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestPageKeyedDataSource.kt
diff --git a/testutils/testutils-paging/src/main/java/androidx/paging/TestPositionalDataSource.kt b/testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestPositionalDataSource.kt
similarity index 100%
rename from testutils/testutils-paging/src/main/java/androidx/paging/TestPositionalDataSource.kt
rename to testutils/testutils-paging/src/jvmMain/kotlin/androidx/paging/TestPositionalDataSource.kt
diff --git a/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/AndroidXPaparazzi.kt b/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/AndroidXPaparazzi.kt
index 80325ec..510b7f2 100644
--- a/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/AndroidXPaparazzi.kt
+++ b/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/AndroidXPaparazzi.kt
@@ -76,4 +76,4 @@
} else {
"Paparazzi system properties not set. Please ensure $PLUGIN_NAME is applied to your build."
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/GoldenVerifier.kt b/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/GoldenVerifier.kt
index 32589d1..8282bd9d 100644
--- a/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/GoldenVerifier.kt
+++ b/testutils/testutils-paparazzi/src/main/kotlin/androidx/testutils/paparazzi/GoldenVerifier.kt
@@ -265,4 +265,4 @@
/** Get a file name with special characters removed from a snapshot. */
fun Snapshot.toFileName() = testName.toQualifiedName().replace(Regex("\\W+"), "_")
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/GoldenVerifierTest.kt b/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/GoldenVerifierTest.kt
index 0a99763..aee8a81 100644
--- a/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/GoldenVerifierTest.kt
+++ b/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/GoldenVerifierTest.kt
@@ -324,4 +324,4 @@
/** Load a test image from resources. */
private fun loadTestImage(name: String) =
ImageIO.read(javaClass.getResourceAsStream("$name.png")!!)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/ImageDifferTest.kt b/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/ImageDifferTest.kt
index 2678c0a..8b67607 100644
--- a/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/ImageDifferTest.kt
+++ b/testutils/testutils-paparazzi/src/test/kotlin/androidx/testutils/paparazzi/ImageDifferTest.kt
@@ -51,4 +51,4 @@
private fun loadTestImage(name: String) =
ImageIO.read(javaClass.getResourceAsStream("$name.png")!!)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/ActivityScenarioRulePersist.kt b/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/ActivityScenarioRulePersist.kt
index 35727fc..5f98691 100644
--- a/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/ActivityScenarioRulePersist.kt
+++ b/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/ActivityScenarioRulePersist.kt
@@ -156,4 +156,4 @@
text.text = "$index"
}
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/TestActivity.kt b/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/TestActivity.kt
index 81334f8..0283a98 100644
--- a/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/TestActivity.kt
+++ b/testutils/testutils-runtime/src/androidTest/java/androidx/testutils/TestActivity.kt
@@ -56,4 +56,4 @@
companion object {
var resumes = 0
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenario.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenario.kt
index 7a7b6ef..8dc2fca 100644
--- a/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenario.kt
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenario.kt
@@ -55,4 +55,4 @@
closeable.use {
block(it)
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenarioResetRule.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenarioResetRule.kt
index ac423d0..853af45 100644
--- a/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenarioResetRule.kt
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/ActivityScenarioResetRule.kt
@@ -77,4 +77,4 @@
// to be left up, dialog left open, etc., so we can validate that hasn't happened here.
super.after()
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/AndroidFontScaleHelper.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/AndroidFontScaleHelper.kt
new file mode 100644
index 0000000..d57f2f6
--- /dev/null
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/AndroidFontScaleHelper.kt
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.testutils
+
+import android.app.Activity
+import android.os.Build
+import android.provider.Settings
+import androidx.annotation.DoNotInline
+import androidx.annotation.RequiresApi
+import androidx.test.core.app.ActivityScenario
+import androidx.test.platform.app.InstrumentationRegistry
+import java.util.concurrent.atomic.AtomicBoolean
+import org.junit.Assume.assumeTrue
+
+/**
+ * Helper utils to change the system font scale.
+ */
+object AndroidFontScaleHelper {
+ /**
+ * Returns the current global font scale for all apps via the system Settings
+ */
+ fun getSystemFontScale(): Float {
+ return Settings.System.getFloat(
+ InstrumentationRegistry.getInstrumentation().context.contentResolver,
+ Settings.System.FONT_SCALE,
+ /* Must default to 1 because when a test is first spun up it's not initialized. */
+ /* def= */ 1f
+ )
+ }
+
+ /**
+ * Sets the global font scale for all apps via the system Settings.
+ *
+ * Note this only works on [Build.VERSION_CODES.Q]+. Earlier versions will force the test to be
+ * skipped.
+ *
+ * @param fontScale the desired font scale
+ * @param activityScenario scenario that provides an Activity under test. The activity will be
+ * continually polled until the font scale changes in that Activity's configuration. (Usually
+ * you will pass in <code>rule.activityRule.scenario</code>).
+ */
+ fun <A : Activity> setSystemFontScale(
+ fontScale: Float,
+ activityScenario: ActivityScenario<A>
+ ) {
+ if (Build.VERSION.SDK_INT >= 29) {
+ Api29Impl.setSystemFontScale(fontScale, activityScenario)
+ } else {
+ assumeTrue("SDK must be >= Q to setSystemFontScale()", false)
+ }
+ }
+
+ /**
+ * Resets the global font scale for all apps to the default via the system Settings
+ *
+ * {@see #setSystemFontScale}
+ */
+ fun <A : Activity> resetSystemFontScale(
+ activityScenario: ActivityScenario<A>
+ ) {
+ // TODO(b/279083734): would use Settings.System.resetToDefaults() if it existed
+ setSystemFontScale(1f, activityScenario)
+ }
+
+ @RequiresApi(Build.VERSION_CODES.Q)
+ private object Api29Impl {
+ @JvmStatic
+ @DoNotInline
+ fun <A : Activity> setSystemFontScale(
+ fontScale: Float,
+ activityScenario: ActivityScenario<A>
+ ) {
+ val instrumentationContext = InstrumentationRegistry.getInstrumentation().context
+
+ invokeWithShellPermissions {
+ Settings.System.putFloat(
+ instrumentationContext.contentResolver,
+ Settings.System.FONT_SCALE,
+ fontScale
+ )
+ }
+
+ PollingCheck.waitFor(/* timeout= */ 5000) {
+ val isActivityAtCorrectScale = AtomicBoolean(false)
+ activityScenario.onActivity { activity ->
+ isActivityAtCorrectScale.set(
+ activity.resources.configuration.fontScale == fontScale
+ )
+ }
+ isActivityAtCorrectScale.get() &&
+ // For some reason we need both these checks otherwise other tests get messed up
+ // since the scale doesn't get reset in teardown.
+ getSystemFontScale() == fontScale
+ }
+ }
+
+ /**
+ * Runs the given function as root, with all shell permissions granted.
+ */
+ @JvmStatic
+ @DoNotInline
+ private fun invokeWithShellPermissions(runnable: () -> Unit) {
+ val uiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation
+ try {
+ uiAutomation.adoptShellPermissionIdentity()
+ runnable()
+ } finally {
+ uiAutomation.dropShellPermissionIdentity()
+ }
+ }
+ }
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/AnimationDurationScaleRule.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/AnimationDurationScaleRule.kt
index 6934b76..650354c 100644
--- a/testutils/testutils-runtime/src/main/java/androidx/testutils/AnimationDurationScaleRule.kt
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/AnimationDurationScaleRule.kt
@@ -117,4 +117,4 @@
override fun finished(description: Description) {
resetAnimationDuration()
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/LocaleTestUtils.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/LocaleTestUtils.kt
index 7c03079..0e5bc52 100644
--- a/testutils/testutils-runtime/src/main/java/androidx/testutils/LocaleTestUtils.kt
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/LocaleTestUtils.kt
@@ -210,4 +210,4 @@
resources.updateConfiguration(newConfig, resources.displayMetrics)
return savedLocales
}
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-runtime/src/main/java/androidx/testutils/ResettableActivityScenarioRule.kt b/testutils/testutils-runtime/src/main/java/androidx/testutils/ResettableActivityScenarioRule.kt
index 59a2282..99f517a 100644
--- a/testutils/testutils-runtime/src/main/java/androidx/testutils/ResettableActivityScenarioRule.kt
+++ b/testutils/testutils-runtime/src/main/java/androidx/testutils/ResettableActivityScenarioRule.kt
@@ -127,4 +127,4 @@
initialTouchMode: Boolean = false
): ResettableActivityScenarioRule<A> where A : Activity, A : Resettable {
return ResettableActivityScenarioRule(A::class.java, initialTouchMode)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-truth/src/main/java/androidx/testutils/assertions.kt b/testutils/testutils-truth/src/main/java/androidx/testutils/assertions.kt
index 1dfc738..cd1a9da 100644
--- a/testutils/testutils-truth/src/main/java/androidx/testutils/assertions.kt
+++ b/testutils/testutils-truth/src/main/java/androidx/testutils/assertions.kt
@@ -64,4 +64,4 @@
throw AssertionError(
"Body completed successfully. Expected ${expectedType.simpleName}"
)
-}
\ No newline at end of file
+}
diff --git a/testutils/testutils-truth/src/test/java/androidx/testutils/AssertionsTest.kt b/testutils/testutils-truth/src/test/java/androidx/testutils/AssertionsTest.kt
index f517604..edfa36a 100644
--- a/testutils/testutils-truth/src/test/java/androidx/testutils/AssertionsTest.kt
+++ b/testutils/testutils-truth/src/test/java/androidx/testutils/AssertionsTest.kt
@@ -52,4 +52,4 @@
throw IOException("test123")
}.hasMessageThat().contains("test123")
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/BoringLayoutFactoryTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/BoringLayoutFactoryTest.kt
index cfae5f2..ace46c6 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/BoringLayoutFactoryTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/BoringLayoutFactoryTest.kt
@@ -243,4 +243,4 @@
// EllipsisCount should be 0 indicating ellipsize is null.
assertThat(boringLayout.getEllipsisCount(0)).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/FontPaddingWithCustomFallbackTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/FontPaddingWithCustomFallbackTest.kt
index edef78c..791c20e 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/FontPaddingWithCustomFallbackTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/FontPaddingWithCustomFallbackTest.kt
@@ -207,4 +207,4 @@
alignment = alignment
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutCompatTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutCompatTest.kt
index 21af3cf..12de37f 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutCompatTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutCompatTest.kt
@@ -135,4 +135,4 @@
.isEqualTo(i + 1)
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalMultiLineTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalMultiLineTest.kt
index 212c5e4..8cfbc5d 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalMultiLineTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalMultiLineTest.kt
@@ -278,4 +278,4 @@
secondaryDownstream = value
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalTest.kt
index 4108cbf..f9f7351 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutGetHorizontalTest.kt
@@ -976,4 +976,4 @@
// If insert RX to second line, it will be |RX L3 L4 SP R4 R3| (SP)
assertThat(layout.getDownstreamSecondaryHorizontalPosition(offset)).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutHelperParagraphTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutHelperParagraphTest.kt
index 4c53a41..97c63dd2 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutHelperParagraphTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutHelperParagraphTest.kt
@@ -157,4 +157,4 @@
assertThat(layoutHelper.isRtlParagraph(1)).isFalse()
assertThat(layoutHelper.isRtlParagraph(2)).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutIntrinsicsTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutIntrinsicsTest.kt
index 3e47f8f..d39f2c0 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutIntrinsicsTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/LayoutIntrinsicsTest.kt
@@ -74,4 +74,4 @@
).boringMetrics
).isNull()
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/PaintBoundsTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/PaintBoundsTest.kt
index f6cc407..95480d7 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/PaintBoundsTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/PaintBoundsTest.kt
@@ -236,4 +236,4 @@
assertThat(bounds.width()).isEqualTo((12 * fontSize).toInt())
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/SegmentBreakerTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/SegmentBreakerTest.kt
index ae9f92f..24c302f 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/SegmentBreakerTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/SegmentBreakerTest.kt
@@ -127,4 +127,4 @@
assertThat(it).isEqualTo(listOf(0, 2, 4))
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/StaticLayoutFactoryTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/StaticLayoutFactoryTest.kt
index 6324d42..cc2fca4 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/StaticLayoutFactoryTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/StaticLayoutFactoryTest.kt
@@ -606,4 +606,4 @@
textSize = width
typeface = sampleFont
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextAndroidCanvasTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextAndroidCanvasTest.kt
index fb80db9..6fecaa9 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextAndroidCanvasTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextAndroidCanvasTest.kt
@@ -37,4 +37,4 @@
assertThat(textCanvas.getClipBounds(rect)).isTrue()
assertThat(rect.height()).isEqualTo(Int.MAX_VALUE)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutFillBoundingBoxesTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutFillBoundingBoxesTest.kt
index 0af5ddc..3bfbf14 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutFillBoundingBoxesTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutFillBoundingBoxesTest.kt
@@ -380,4 +380,4 @@
alignment = alignment
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIntrinsicWidthTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIntrinsicWidthTest.kt
index 009740b..8c7f0d7 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIntrinsicWidthTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIntrinsicWidthTest.kt
@@ -176,4 +176,4 @@
)
setSpan(span, start, end)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIsLineEllipsizedTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIsLineEllipsizedTest.kt
index 26f1373..19ae69d 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIsLineEllipsizedTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutIsLineEllipsizedTest.kt
@@ -123,4 +123,4 @@
maxLines = maxLines
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutSpanTest.kt
index 9945d9a..91dc01a 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutSpanTest.kt
@@ -243,4 +243,4 @@
}
return textPaint
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutTest.kt
index 945d772..fa226c1 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/TextLayoutTest.kt
@@ -447,4 +447,4 @@
this.textSize = fontSize
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/animation/SegmentBreakerBreakSegmentTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/animation/SegmentBreakerBreakSegmentTest.kt
index 9c9b2ad..7ff2ae8 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/animation/SegmentBreakerBreakSegmentTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/animation/SegmentBreakerBreakSegmentTest.kt
@@ -1581,4 +1581,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordBoundaryTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordBoundaryTest.kt
index a7794c2..07c72d9 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordBoundaryTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordBoundaryTest.kt
@@ -257,4 +257,4 @@
assertThat(wordBoundary.getWordEnd(text.indexOf('d'))).isEqualTo(text.length)
assertThat(wordBoundary.getWordEnd(text.length)).isEqualTo(text.length)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordIteratorTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordIteratorTest.kt
index c18022b..cd76c68 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordIteratorTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/selection/WordIteratorTest.kt
@@ -585,4 +585,4 @@
.isEqualTo(BreakIterator.DONE)
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/FontFeatureSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/FontFeatureSpanTest.kt
index 03d1202..9b26a45 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/FontFeatureSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/FontFeatureSpanTest.kt
@@ -48,4 +48,4 @@
span.updateDrawState(textPaint)
Truth.assertThat(textPaint.fontFeatureSettings).isEqualTo(fontFeatureSettings)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEmTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEmTest.kt
index 5cfe34d..29f660e 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEmTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEmTest.kt
@@ -44,4 +44,4 @@
span.updateMeasureState(paint)
Truth.assertThat(paint.letterSpacing).isEqualTo(letterSpacing)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPxTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPxTest.kt
index bd98830..88f3c6e 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPxTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPxTest.kt
@@ -103,4 +103,4 @@
verify(textPaint, never()).letterSpacing = any()
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LineHeightStyleSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LineHeightStyleSpanTest.kt
index 3509ecd..5a853d4 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LineHeightStyleSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/LineHeightStyleSpanTest.kt
@@ -975,4 +975,4 @@
lineHeight = 0,
fontMetricsInt = fontMetricsInt
)
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/PlaceholderSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/PlaceholderSpanTest.kt
index 9069271..a85cb18 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/PlaceholderSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/PlaceholderSpanTest.kt
@@ -549,4 +549,4 @@
)
placeholderSpan.heightPx
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/ShadowSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/ShadowSpanTest.kt
index 8b3e1b6..97a9006 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/ShadowSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/ShadowSpanTest.kt
@@ -39,4 +39,4 @@
Mockito.verify(textPaint, Mockito.times(1))
.setShadowLayer(radius, offsetX, offsetY, color)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/SkewXSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/SkewXSpanTest.kt
index 3d8eb63..2eeeb1e 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/SkewXSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/SkewXSpanTest.kt
@@ -45,4 +45,4 @@
span.updateDrawState(paint)
Truth.assertThat(paint.textSkewX).isEqualTo(skewX)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/TypefaceSpanTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/TypefaceSpanTest.kt
index ce39620..50d794c 100644
--- a/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/TypefaceSpanTest.kt
+++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/style/TypefaceSpanTest.kt
@@ -46,4 +46,4 @@
span.updateMeasureState(paint)
Truth.assertThat(paint.typeface).isSameInstanceAs(typeface)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/BoringLayoutFactory.kt b/text/text/src/main/java/androidx/compose/ui/text/android/BoringLayoutFactory.kt
index 0e0c05b..ab4afe3 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/BoringLayoutFactory.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/BoringLayoutFactory.kt
@@ -25,7 +25,6 @@
import android.text.TextUtils.TruncateAt
import androidx.annotation.DoNotInline
import androidx.annotation.RequiresApi
-import androidx.core.os.BuildCompat
/**
* Factory Class for BoringLayout
@@ -41,7 +40,6 @@
* @return null if not boring; the width, ascent, and descent in a BoringLayout.Metrics
* object.
*/
- @androidx.annotation.OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
fun measure(
text: CharSequence,
paint: TextPaint,
@@ -73,8 +71,7 @@
*
* @see BoringLayout.isFallbackLineSpacingEnabled
* @see StaticLayout.Builder.setUseLineSpacingFromFallbacks
- **/
- @androidx.annotation.OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
+ */
fun create(
text: CharSequence,
paint: TextPaint,
@@ -122,7 +119,6 @@
/**
* Returns whether fallbackLineSpacing is enabled for the given layout.
*/
- @androidx.annotation.OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
fun isFallbackLineSpacingEnabled(layout: BoringLayout): Boolean {
return if (Build.VERSION.SDK_INT >= 33) {
BoringLayoutFactory33.isFallbackLineSpacingEnabled(layout)
@@ -221,4 +217,4 @@
ellipsizedWidth
)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt b/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt
index 942c5fd..a46277c 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt
@@ -179,4 +179,4 @@
throw InternalError()
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/InternalPlatformTextApi.kt b/text/text/src/main/java/androidx/compose/ui/text/android/InternalPlatformTextApi.kt
index 5f975123..a544798 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/InternalPlatformTextApi.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/InternalPlatformTextApi.kt
@@ -26,4 +26,4 @@
AnnotationTarget.PROPERTY
)
@Retention(AnnotationRetention.BINARY)
-annotation class InternalPlatformTextApi
\ No newline at end of file
+annotation class InternalPlatformTextApi
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutCompat.kt b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutCompat.kt
index fc177b9..af1f1e6 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutCompat.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutCompat.kt
@@ -191,4 +191,4 @@
} else { // lineEnd == offset
if (upstream) downstreamLineNo else downstreamLineNo + 1
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutHelper.kt b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutHelper.kt
index 4deeab9..1a1e7c0 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutHelper.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutHelper.kt
@@ -399,4 +399,4 @@
@Suppress("ConvertTwoComparisonsToRangeCheck")
fun isLineEndSpace(c: Char) = c == ' ' || c == '\n' || c == '\u1680' ||
(c >= '\u2000' && c <= '\u200A' && c != '\u2007') || c == '\u205F' || c == '\u3000'
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutIntrinsics.kt b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutIntrinsics.kt
index c26ca204..6fcea24 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/LayoutIntrinsics.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/LayoutIntrinsics.kt
@@ -168,4 +168,4 @@
charSequence.hasSpan(LetterSpacingSpanPx::class.java) ||
charSequence.hasSpan(LetterSpacingSpanEm::class.java)
) || textPaint.letterSpacing != 0f)
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/PaintExtensions.kt b/text/text/src/main/java/androidx/compose/ui/text/android/PaintExtensions.kt
index b9b6058..3f06de6 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/PaintExtensions.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/PaintExtensions.kt
@@ -107,4 +107,4 @@
fun getTextBounds(paint: Paint, text: CharSequence, start: Int, end: Int, rect: Rect) {
paint.getTextBounds(text, start, end, rect)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/SpannedExtensions.kt b/text/text/src/main/java/androidx/compose/ui/text/android/SpannedExtensions.kt
index ef96909..563aec5 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/SpannedExtensions.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/SpannedExtensions.kt
@@ -24,4 +24,4 @@
internal fun Spanned.hasSpan(clazz: Class<*>, startInclusive: Int, endExclusive: Int): Boolean {
return nextSpanTransition(startInclusive - 1, endExclusive /* limit */, clazz) != endExclusive
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/StaticLayoutFactory.kt b/text/text/src/main/java/androidx/compose/ui/text/android/StaticLayoutFactory.kt
index 62ccdd9..2c7c8d0 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/StaticLayoutFactory.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/StaticLayoutFactory.kt
@@ -33,7 +33,6 @@
import androidx.compose.ui.text.android.LayoutCompat.JustificationMode
import androidx.compose.ui.text.android.LayoutCompat.LineBreakStyle
import androidx.compose.ui.text.android.LayoutCompat.LineBreakWordStyle
-import androidx.core.os.BuildCompat
import java.lang.reflect.Constructor
import java.lang.reflect.InvocationTargetException
@@ -206,7 +205,6 @@
}.build()
}
- @androidx.annotation.OptIn(markerClass = [BuildCompat.PrereleaseSdkCheck::class])
override fun isFallbackLineSpacingEnabled(
layout: StaticLayout,
useFallbackLineSpacing: Boolean
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/TextAndroidCanvas.kt b/text/text/src/main/java/androidx/compose/ui/text/android/TextAndroidCanvas.kt
index 3221ae7..6b770d3 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/TextAndroidCanvas.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/TextAndroidCanvas.kt
@@ -735,4 +735,4 @@
override fun drawRenderNode(renderNode: RenderNode) {
nativeCanvas.drawRenderNode(renderNode)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentBreaker.kt b/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentBreaker.kt
index 4d24152..95fe44e 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentBreaker.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentBreaker.kt
@@ -309,4 +309,4 @@
}
return res
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentType.kt b/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentType.kt
index eac7729..afad1e9 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentType.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/animation/SegmentType.kt
@@ -52,4 +52,4 @@
* Break text with character (grapheme) boundary.
*/
Character
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordBoundary.kt b/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordBoundary.kt
index 877adc2..4ebf2b4 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordBoundary.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordBoundary.kt
@@ -86,4 +86,4 @@
offset
} else retOffset
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordIterator.kt b/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordIterator.kt
index ba93cec..d0c7471 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordIterator.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/selection/WordIterator.kt
@@ -299,4 +299,4 @@
type == Character.START_PUNCTUATION.toInt()
}
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/IndentationFixSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/IndentationFixSpan.kt
index e90ec5b..e8441ad 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/IndentationFixSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/IndentationFixSpan.kt
@@ -131,4 +131,4 @@
return 0f
}
-private const val EllipsisChar = "\u2026"
\ No newline at end of file
+private const val EllipsisChar = "\u2026"
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEm.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEm.kt
index 9e149f3..20c10b4 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEm.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanEm.kt
@@ -33,4 +33,4 @@
override fun updateMeasureState(textPaint: TextPaint) {
textPaint.letterSpacing = letterSpacing
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPx.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPx.kt
index 8c074a2..6637b34 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPx.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/LetterSpacingSpanPx.kt
@@ -28,4 +28,4 @@
override fun updateMeasureState(textPaint: TextPaint) {
textPaint.updatePaint()
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightSpan.kt
index 9e0c6e7..76ed455 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightSpan.kt
@@ -53,4 +53,4 @@
fontMetricsInt.descent = ceil(fontMetricsInt.descent * ratio.toDouble()).toInt()
fontMetricsInt.ascent = fontMetricsInt.descent - ceiledLineHeight
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightStyleSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightStyleSpan.kt
index 9f61a01..5cb33c1 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightStyleSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/LineHeightStyleSpan.kt
@@ -142,4 +142,4 @@
)
}
-internal fun FontMetricsInt.lineHeight(): Int = this.descent - this.ascent
\ No newline at end of file
+internal fun FontMetricsInt.lineHeight(): Int = this.descent - this.ascent
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/ShadowSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/ShadowSpan.kt
index c29e527..79ca207 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/ShadowSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/ShadowSpan.kt
@@ -34,4 +34,4 @@
override fun updateDrawState(tp: TextPaint) {
tp.setShadowLayer(radius, offsetX, offsetY, color)
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/SkewXSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/SkewXSpan.kt
index 983b4c7..108d90f 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/SkewXSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/SkewXSpan.kt
@@ -34,4 +34,4 @@
override fun updateMeasureState(textPaint: TextPaint) {
textPaint.textSkewX = skewX + textPaint.textSkewX
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt
index aadc1a1..528bece7 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt
@@ -36,4 +36,4 @@
textPaint.isUnderlineText = isUnderlineText
textPaint.isStrikeThruText = isStrikethroughText
}
-}
\ No newline at end of file
+}
diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/style/TypefaceSpan.kt b/text/text/src/main/java/androidx/compose/ui/text/android/style/TypefaceSpan.kt
index 05002a6..7e7398d 100644
--- a/text/text/src/main/java/androidx/compose/ui/text/android/style/TypefaceSpan.kt
+++ b/text/text/src/main/java/androidx/compose/ui/text/android/style/TypefaceSpan.kt
@@ -44,4 +44,4 @@
private fun updateTypeface(paint: Paint) {
paint.typeface = typeface
}
-}
\ No newline at end of file
+}
diff --git a/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkHandshake.kt b/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkHandshake.kt
index e37e2c3..9923495 100644
--- a/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkHandshake.kt
+++ b/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkHandshake.kt
@@ -245,7 +245,7 @@
* Provides means to sideload Perfetto SDK native binaries with a library AAR used as
* a source
*
- * @param aarFile either an AAR or an APK containing `libtracing_perfetto.so`
+ * @param aarFile an AAR file containing `libtracing_perfetto.so`
* @param tempDirectory a directory directly accessible to the caller process (used for
* extraction of the binaries from the zip)
* @param moveLibFileFromTmpDirToAppDir a function capable of moving the binary file
@@ -264,7 +264,7 @@
* Provides means to sideload Perfetto SDK native binaries with an APK containing
* the library used as a source
*
- * @param apkFile either an AAR or an APK containing `libtracing_perfetto.so`
+ * @param apkFile an APK file containing `libtracing_perfetto.so`
* @param tempDirectory a directory directly accessible to the caller process (used for
* extraction of the binaries from the zip)
* @param moveLibFileFromTmpDirToAppDir a function capable of moving the binary file
diff --git a/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkSideloader.kt b/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkSideloader.kt
index df50de5..c6d9dd6 100644
--- a/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkSideloader.kt
+++ b/tracing/tracing-perfetto-handshake/src/main/java/androidx/tracing/perfetto/handshake/PerfettoSdkSideloader.kt
@@ -110,4 +110,4 @@
internal typealias FileMover = (srcFile: File, dstFile: File) -> Unit
-internal typealias ShellCommandExecutor = (command: String) -> String
\ No newline at end of file
+internal typealias ShellCommandExecutor = (command: String) -> String
diff --git a/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/StartupTracingConfig.kt b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/StartupTracingConfig.kt
index 448ba1b..e83611c 100644
--- a/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/StartupTracingConfig.kt
+++ b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/StartupTracingConfig.kt
@@ -74,4 +74,4 @@
fun clear(packageName: String) {
startupConfigFileForPackageName(packageName).delete()
}
-}
\ No newline at end of file
+}
diff --git a/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/security/SafeLibLoader.kt b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/security/SafeLibLoader.kt
index 9307d91..dd18fde 100644
--- a/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/security/SafeLibLoader.kt
+++ b/tracing/tracing-perfetto/src/main/java/androidx/tracing/perfetto/security/SafeLibLoader.kt
@@ -99,4 +99,4 @@
}
internal class MissingChecksumException(message: String) : NoSuchElementException(message)
-internal class IncorrectChecksumException(message: String) : SecurityException(message)
\ No newline at end of file
+internal class IncorrectChecksumException(message: String) : SecurityException(message)
diff --git a/tracing/tracing-perfetto/src/test/java/androidx/tracing/perfetto/ChecksumTest.kt b/tracing/tracing-perfetto/src/test/java/androidx/tracing/perfetto/ChecksumTest.kt
index e88236b..ec6ea23 100644
--- a/tracing/tracing-perfetto/src/test/java/androidx/tracing/perfetto/ChecksumTest.kt
+++ b/tracing/tracing-perfetto/src/test/java/androidx/tracing/perfetto/ChecksumTest.kt
@@ -73,4 +73,4 @@
.digest()
.joinToString(separator = "") { "%02x".format(it) }
.also { assertThat(it).matches("[0-9a-f]{64}") }
-}
\ No newline at end of file
+}
diff --git a/transition/transition/src/androidTest/java/androidx/transition/AlwaysTransition.kt b/transition/transition/src/androidTest/java/androidx/transition/AlwaysTransition.kt
index 0ac5f03..ab024fb 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/AlwaysTransition.kt
+++ b/transition/transition/src/androidTest/java/androidx/transition/AlwaysTransition.kt
@@ -43,4 +43,4 @@
private const val Key = "alwaysChanging"
private var AlwaysChangingValue = 0
}
-}
\ No newline at end of file
+}
diff --git a/transition/transition/src/androidTest/java/androidx/transition/ChangeBoundsTest.java b/transition/transition/src/androidTest/java/androidx/transition/ChangeBoundsTest.java
index 3206c710..3c27a70 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/ChangeBoundsTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/ChangeBoundsTest.java
@@ -33,7 +33,6 @@
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
-import androidx.core.os.BuildCompat;
import androidx.test.annotation.UiThreadTest;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -123,12 +122,9 @@
suppressLayout.ensureExpectedValueApplied();
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void seekingChangeBoundsNoClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -222,12 +218,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void seekingChangeBoundsWithClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -335,12 +328,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void interruptedBeforeStartNoClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -396,12 +386,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void interruptedBeforeStartWithClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -462,12 +449,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void interruptedAfterEndNoClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -526,12 +510,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void interruptedAfterEndWithClip() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -595,13 +576,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void startTransitionAfterSeeking() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
-
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -651,13 +628,9 @@
});
}
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @SdkSuppress(minSdkVersion = 34)
@Test
public void seekNoChange() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
- return; // only supported on U+
- }
-
final TransitionActivity activity = rule.getActivity();
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
diff --git a/transition/transition/src/androidTest/java/androidx/transition/ChangeClipBoundsTest.java b/transition/transition/src/androidTest/java/androidx/transition/ChangeClipBoundsTest.java
index f255f62..5ba6b75 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/ChangeClipBoundsTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/ChangeClipBoundsTest.java
@@ -32,7 +32,6 @@
import android.view.View;
import android.view.ViewGroup;
-import androidx.core.os.BuildCompat;
import androidx.core.view.ViewCompat;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -113,7 +112,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingClipToNull() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -191,7 +190,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingClipFromNull() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -268,7 +267,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingClips() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -346,7 +345,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void changeClipBeforeStart() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -399,7 +398,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void testSeekInterruption() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // supported on U+
}
final View view = new View(rule.getActivity());
@@ -472,7 +471,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void testSeekNoChange() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // supported on U+
}
final View view = new View(rule.getActivity());
diff --git a/transition/transition/src/androidTest/java/androidx/transition/ChangeImageTransformTest.java b/transition/transition/src/androidTest/java/androidx/transition/ChangeImageTransformTest.java
index ebff1c4..70ba3a6 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/ChangeImageTransformTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/ChangeImageTransformTest.java
@@ -40,7 +40,6 @@
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
-import androidx.core.os.BuildCompat;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -158,7 +157,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void testSeekInterruption() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final ImageView imageView = enterImageViewScene(ImageView.ScaleType.FIT_START,
diff --git a/transition/transition/src/androidTest/java/androidx/transition/ChangeScrollTest.java b/transition/transition/src/androidTest/java/androidx/transition/ChangeScrollTest.java
index 68414e5..61c4063 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/ChangeScrollTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/ChangeScrollTest.java
@@ -31,7 +31,6 @@
import android.view.ViewGroup;
import android.widget.TextView;
-import androidx.core.os.BuildCompat;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -85,7 +84,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingScroll() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -150,7 +149,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingScrollBeforeStart() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -202,7 +201,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void testSeekInterruption() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final View view = new View(rule.getActivity());
diff --git a/transition/transition/src/androidTest/java/androidx/transition/EpicenterTest.kt b/transition/transition/src/androidTest/java/androidx/transition/EpicenterTest.kt
index 6e48dbf..4f76f11 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/EpicenterTest.kt
+++ b/transition/transition/src/androidTest/java/androidx/transition/EpicenterTest.kt
@@ -104,4 +104,4 @@
}
return view
}
-}
\ No newline at end of file
+}
diff --git a/transition/transition/src/androidTest/java/androidx/transition/ExplodeTest.java b/transition/transition/src/androidTest/java/androidx/transition/ExplodeTest.java
index 7a9fc71..2009c6c 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/ExplodeTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/ExplodeTest.java
@@ -33,7 +33,6 @@
import android.widget.FrameLayout;
import android.widget.LinearLayout;
-import androidx.core.os.BuildCompat;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -186,7 +185,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingExplode() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -259,7 +258,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingImplode() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -341,7 +340,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingImplodeBeforeStart() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
@@ -388,7 +387,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekWithTranslation() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
diff --git a/transition/transition/src/androidTest/java/androidx/transition/FadeTest.java b/transition/transition/src/androidTest/java/androidx/transition/FadeTest.java
index 1256564..7aab444 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/FadeTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/FadeTest.java
@@ -42,7 +42,6 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.os.BuildCompat;
import androidx.test.annotation.UiThreadTest;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -268,7 +267,7 @@
@Test
public void seekingFadeIn() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -334,7 +333,7 @@
@Test
public void seekingFadeOut() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -409,7 +408,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingFadeInBeforeStart() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
TransitionSeekController[] seekControllerArr = new TransitionSeekController[1];
diff --git a/transition/transition/src/androidTest/java/androidx/transition/SeekTransitionTest.kt b/transition/transition/src/androidTest/java/androidx/transition/SeekTransitionTest.kt
index 36f41b2..1700300 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/SeekTransitionTest.kt
+++ b/transition/transition/src/androidTest/java/androidx/transition/SeekTransitionTest.kt
@@ -21,7 +21,6 @@
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.LinearLayout
-import androidx.core.os.BuildCompat
import androidx.core.util.Consumer
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.MediumTest
@@ -70,7 +69,7 @@
@Test(expected = IllegalArgumentException::class)
@UiThreadTest
fun onlySeekingTransitions() {
- if (!BuildCompat.isAtLeastU()) throw IllegalArgumentException()
+ if (Build.VERSION.SDK_INT < 34) throw IllegalArgumentException()
transition = object : Visibility() {}
TransitionManager.controlDelayedTransition(root, transition)
fail("Expected IllegalArgumentException")
@@ -78,7 +77,7 @@
@Test
fun waitForReady() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
@Suppress("UNCHECKED_CAST")
@@ -100,7 +99,7 @@
@Test
fun waitForReadyNoChange() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
@Suppress("UNCHECKED_CAST")
@@ -121,7 +120,7 @@
@Test
fun addListenerAfterReady() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
@Suppress("UNCHECKED_CAST")
@@ -149,7 +148,7 @@
@Test
fun seekTransition() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val listener = spy(TransitionListenerAdapter())
@@ -189,7 +188,7 @@
@Test
fun animationDoesNotTakeOverSeek() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val stateListener1 = spy(TransitionListenerAdapter())
@@ -232,7 +231,7 @@
@Test
fun seekCannotTakeOverAnimation() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val stateListener1 = spy(TransitionListenerAdapter())
@@ -272,7 +271,7 @@
@Test
fun seekCannotTakeOverSeek() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController1: TransitionSeekController
val stateListener1 = spy(TransitionListenerAdapter())
@@ -318,7 +317,7 @@
@Test
fun seekReplacesSeek() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController1: TransitionSeekController
val stateListener1 = spy(TransitionListenerAdapter())
@@ -361,7 +360,7 @@
@Test
fun animateToEnd() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val listener = spy(TransitionListenerAdapter())
@@ -388,7 +387,7 @@
@Test
fun animateToStart() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val listener = spy(TransitionListenerAdapter())
@@ -429,7 +428,7 @@
@Test
fun animateToStartAfterAnimateToEnd() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val listener = spy(TransitionListenerAdapter())
@@ -459,7 +458,7 @@
@Test
fun animateToEndAfterAnimateToStart() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
lateinit var seekController: TransitionSeekController
val listener = spy(TransitionListenerAdapter())
@@ -489,7 +488,7 @@
@Test(expected = IllegalStateException::class)
fun seekAfterAnimate() {
- if (!BuildCompat.isAtLeastU()) throw IllegalStateException("Not supported before U")
+ if (Build.VERSION.SDK_INT < 34) throw IllegalStateException("Not supported before U")
lateinit var seekController: TransitionSeekController
transition.duration = 5000
@@ -510,7 +509,7 @@
@Test
fun seekTransitionSet() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
transition = TransitionSet().also {
it.addTransition(Fade(Fade.MODE_OUT))
.addTransition(Fade(Fade.MODE_IN))
@@ -580,7 +579,7 @@
@Test
fun animateToEndTransitionSet() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
transition = TransitionSet().also {
it.addTransition(Fade(Fade.MODE_OUT))
.addTransition(Fade(Fade.MODE_IN))
@@ -630,7 +629,7 @@
@Test
fun animateToStartTransitionSet() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
transition = TransitionSet().also {
it.addTransition(Fade(Fade.MODE_OUT))
.addTransition(Fade(Fade.MODE_IN))
@@ -696,7 +695,7 @@
@Test
fun cancelPartOfTransitionSet() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
transition = TransitionSet().also {
it.addTransition(Fade(Fade.MODE_OUT))
.addTransition(Fade(Fade.MODE_IN))
@@ -764,7 +763,7 @@
@Test
fun onTransitionCallsForwardAndReversed() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
val listener = spy(TransitionListenerAdapter())
transition = Fade()
transition.addListener(listener)
@@ -793,7 +792,7 @@
@Test
fun onTransitionCallsForwardAndReversedTransitionSet() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
val fadeOut = Fade(Fade.MODE_OUT)
val outListener = spy(TransitionListenerAdapter())
fadeOut.addListener(outListener)
@@ -882,7 +881,7 @@
@Test
fun pauseResumeOnSeek() {
- if (!BuildCompat.isAtLeastU()) return
+ if (Build.VERSION.SDK_INT < 34) return
var pauseCount = 0
var resumeCount = 0
var setPauseCount = 0
diff --git a/transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java b/transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java
index e0af8b2..0d7a373 100644
--- a/transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java
+++ b/transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java
@@ -38,7 +38,6 @@
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
-import androidx.core.os.BuildCompat;
import androidx.core.util.Pair;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
@@ -222,7 +221,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingSlideOut() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -302,7 +301,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekingSlideIn() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
@@ -388,7 +387,7 @@
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.TIRAMISU)
@Test
public void seekWithTranslation() throws Throwable {
- if (!BuildCompat.isAtLeastU()) {
+ if (Build.VERSION.SDK_INT < 34) {
return; // only supported on U+
}
final TransitionActivity activity = rule.getActivity();
diff --git a/transition/transition/src/main/java/androidx/transition/Transition.java b/transition/transition/src/main/java/androidx/transition/Transition.java
index 3726fb2..c2c0986 100644
--- a/transition/transition/src/main/java/androidx/transition/Transition.java
+++ b/transition/transition/src/main/java/androidx/transition/Transition.java
@@ -48,13 +48,11 @@
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.collection.ArrayMap;
import androidx.collection.LongSparseArray;
import androidx.core.content.res.TypedArrayUtils;
-import androidx.core.os.BuildCompat;
import androidx.core.util.Consumer;
import androidx.core.view.ViewCompat;
@@ -744,7 +742,6 @@
* TransitionSet subclass overrides this method and delegates it to
* each of its children in succession.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
void createAnimators(@NonNull ViewGroup sceneRoot, @NonNull TransitionValuesMaps startValues,
@NonNull TransitionValuesMaps endValues,
@NonNull ArrayList<TransitionValues> startValuesList,
@@ -1863,7 +1860,6 @@
* createAnimators() to set things up and create all of the animations and then
* runAnimations() to actually start the animations.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
void playTransition(@NonNull ViewGroup sceneRoot) {
mStartValuesList = new ArrayList<>();
mEndValuesList = new ArrayList<>();
@@ -1922,7 +1918,7 @@
createAnimators(sceneRoot, mStartValues, mEndValues, mStartValuesList, mEndValuesList);
if (mSeekController == null) {
runAnimators();
- } else if (BuildCompat.isAtLeastU()) {
+ } else if (Build.VERSION.SDK_INT >= 34) {
prepareAnimatorsForSeeking();
mSeekController.setCurrentPlayTimeMillis(0);
mSeekController.ready();
diff --git a/transition/transition/src/main/java/androidx/transition/TransitionManager.java b/transition/transition/src/main/java/androidx/transition/TransitionManager.java
index ea86ef7..62ee14c 100644
--- a/transition/transition/src/main/java/androidx/transition/TransitionManager.java
+++ b/transition/transition/src/main/java/androidx/transition/TransitionManager.java
@@ -17,6 +17,7 @@
package androidx.transition;
import android.content.Context;
+import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -24,10 +25,8 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.OptIn;
import androidx.annotation.VisibleForTesting;
import androidx.collection.ArrayMap;
-import androidx.core.os.BuildCompat;
import androidx.core.view.ViewCompat;
import java.lang.ref.WeakReference;
@@ -442,20 +441,19 @@
* @param transition The transition to use for this change.
* @return a {@link TransitionSeekController} that can be used control the animation to the
* destination scene. {@code null} is returned when seeking is not supported on the scene,
- * either because it is running on {@link android.os.Build.VERSION_CODES.TIRAMISU} or earlier,
+ * either because it is running on {@link android.os.Build.VERSION_CODES#TIRAMISU} or earlier,
* another Transition is being captured for {@code sceneRoot}, or {@code sceneRoot} hasn't
* had a layout yet.
* @throws IllegalArgumentException if {@code transition} returns {@code false} from
* {@link Transition#isSeekingSupported()}.
*/
- @OptIn(markerClass = BuildCompat.PrereleaseSdkCheck.class)
@Nullable
public static TransitionSeekController controlDelayedTransition(
@NonNull final ViewGroup sceneRoot,
@NonNull Transition transition
) {
if (sPendingTransitions.contains(sceneRoot) || !ViewCompat.isLaidOut(sceneRoot)
- || !BuildCompat.isAtLeastU()) {
+ || Build.VERSION.SDK_INT < 34) {
return null;
}
if (!transition.isSeekingSupported()) {
diff --git a/tv/integration-tests/macrobenchmark/src/main/java/androidx/tv/integration/macrobenchmark/ExampleStartupBenchmark.kt b/tv/integration-tests/macrobenchmark/src/main/java/androidx/tv/integration/macrobenchmark/ExampleStartupBenchmark.kt
index e67d91d..821b725 100644
--- a/tv/integration-tests/macrobenchmark/src/main/java/androidx/tv/integration/macrobenchmark/ExampleStartupBenchmark.kt
+++ b/tv/integration-tests/macrobenchmark/src/main/java/androidx/tv/integration/macrobenchmark/ExampleStartupBenchmark.kt
@@ -35,4 +35,4 @@
pressHome()
startActivityAndWait()
}
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/Card.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/Card.kt
index 332cf06..1e4581d 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/Card.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/Card.kt
@@ -39,4 +39,4 @@
.drawBorderOnFocus()
.clickable { }
)
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/FeaturedCarousel.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/FeaturedCarousel.kt
index 69c9d80..c8953f1 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/FeaturedCarousel.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/FeaturedCarousel.kt
@@ -249,4 +249,4 @@
val focusRequester = remember { FocusRequester() }
return focusRequester(focusRequester)
.onFirstGainingVisibility { focusRequester.requestFocus() }
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/MainActivity.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/MainActivity.kt
index 1c8fc89..7a24ee4 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/MainActivity.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/MainActivity.kt
@@ -27,4 +27,4 @@
App()
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/StickyHeader.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/StickyHeader.kt
index f1af42e..8d38af4 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/StickyHeader.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/StickyHeader.kt
@@ -144,4 +144,4 @@
private fun buildActivities(
count: Int = 10,
buildActivity: (index: Int) -> String = { "Activity $it" }
-): List<String> = (0..count).map(buildActivity)
\ No newline at end of file
+): List<String> = (0..count).map(buildActivity)
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TextField.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TextField.kt
index d359b88..03ae1e9 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TextField.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TextField.kt
@@ -104,4 +104,4 @@
.drawBorderOnFocus()
.focusable()
)
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TopNavigation.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TopNavigation.kt
index 6e69a24..d4b97c2 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TopNavigation.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/TopNavigation.kt
@@ -127,9 +127,10 @@
TabRow(
selectedTabIndex = selectedTabIndex,
separator = { Spacer(modifier = Modifier.width(12.dp)) },
- indicator = { tabPositions ->
+ indicator = { tabPositions, isActivated ->
TabRowDefaults.UnderlinedIndicator(
- currentTabPosition = tabPositions[selectedTabIndex]
+ currentTabPosition = tabPositions[selectedTabIndex],
+ isActivated = isActivated,
)
},
modifier = Modifier
diff --git a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/ifElse.kt b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/ifElse.kt
index eaeee61..775f512 100644
--- a/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/ifElse.kt
+++ b/tv/integration-tests/playground/src/main/java/androidx/tv/integration/playground/ifElse.kt
@@ -31,4 +31,4 @@
condition: Boolean,
ifTrueModifier: Modifier,
ifFalseModifier: Modifier = Modifier
-): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier)
\ No newline at end of file
+): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier)
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppLazyRow.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppLazyRow.kt
index 163dd14..902258f 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppLazyRow.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppLazyRow.kt
@@ -71,4 +71,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppTabRow.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppTabRow.kt
index a571a11..ea59506 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppTabRow.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/AppTabRow.kt
@@ -63,7 +63,7 @@
selected = selectedTabIndex == index,
onFocus = { onSelectedTabIndexChange(index) },
colors = TabDefaults.pillIndicatorTabColors(
- contentColor = LocalContentColor.current,
+ inactiveContentColor = LocalContentColor.current,
// selectedContentColor = Color(0xFF313033),
),
modifier = Modifier
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/BringIntoViewIfChildrenAreFocused.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/BringIntoViewIfChildrenAreFocused.kt
index 2ad15c7..f445bff 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/BringIntoViewIfChildrenAreFocused.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/BringIntoViewIfChildrenAreFocused.kt
@@ -52,4 +52,4 @@
}
)
}
-)
\ No newline at end of file
+)
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ExternalLibs.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ExternalLibs.kt
index 4a497f2..f8228db 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ExternalLibs.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ExternalLibs.kt
@@ -49,4 +49,4 @@
// modifier = modifier,
// contentDescription = contentDescription
// )
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/MainActivity.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/MainActivity.kt
index 83c3ad1..3e47b32 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/MainActivity.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/MainActivity.kt
@@ -34,4 +34,4 @@
App()
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ifElse.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ifElse.kt
index 4a29855..b268c3d 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ifElse.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/ifElse.kt
@@ -31,4 +31,4 @@
condition: Boolean,
ifTrueModifier: Modifier,
ifFalseModifier: Modifier = Modifier
-): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier)
\ No newline at end of file
+): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier)
diff --git a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/readAssetsFile.kt b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/readAssetsFile.kt
index 18708dd..3fa6028 100644
--- a/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/readAssetsFile.kt
+++ b/tv/integration-tests/presentation/src/main/java/androidx/tv/integration/presentation/readAssetsFile.kt
@@ -19,4 +19,4 @@
import android.content.res.AssetManager
fun AssetManager.readAssetsFile(fileName: String): String =
- open(fileName).bufferedReader().use { it.readText() }
\ No newline at end of file
+ open(fileName).bufferedReader().use { it.readText() }
diff --git a/tv/samples/src/main/java/androidx/tv/samples/CardSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/CardSamples.kt
index ae8440b..6cf206a 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/CardSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/CardSamples.kt
@@ -121,4 +121,4 @@
contentPadding = PaddingValues(8.dp),
onClick = { }
)
-}
\ No newline at end of file
+}
diff --git a/tv/samples/src/main/java/androidx/tv/samples/CheckboxSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/CheckboxSamples.kt
index f6af570..7c85e6e 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/CheckboxSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/CheckboxSamples.kt
@@ -27,4 +27,4 @@
@Composable
fun CheckboxSample() {
Checkbox(checked = true, onCheckedChange = { })
-}
\ No newline at end of file
+}
diff --git a/tv/samples/src/main/java/androidx/tv/samples/ImmersiveListSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/ImmersiveListSamples.kt
index 9654fd7..fdbb7ae 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/ImmersiveListSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/ImmersiveListSamples.kt
@@ -85,4 +85,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/samples/src/main/java/androidx/tv/samples/RadioButtonSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/RadioButtonSamples.kt
index e9896b5..1e7c58a 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/RadioButtonSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/RadioButtonSamples.kt
@@ -27,4 +27,4 @@
@Composable
fun RadioButtonSample() {
RadioButton(selected = true, onClick = {})
-}
\ No newline at end of file
+}
diff --git a/tv/samples/src/main/java/androidx/tv/samples/SwitchSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/SwitchSamples.kt
index 2e6b5da..58598bb 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/SwitchSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/SwitchSamples.kt
@@ -27,4 +27,4 @@
@Composable
fun SwitchSample() {
Switch(checked = true, onCheckedChange = { })
-}
\ No newline at end of file
+}
diff --git a/tv/samples/src/main/java/androidx/tv/samples/TabRowSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/TabRowSamples.kt
index 96c9535..bf47504 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/TabRowSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/TabRowSamples.kt
@@ -90,9 +90,10 @@
TabRow(
selectedTabIndex = selectedTabIndex,
separator = { Spacer(modifier = Modifier.width(12.dp)) },
- indicator = { tabPositions ->
+ indicator = { tabPositions, isActivated ->
TabRowDefaults.UnderlinedIndicator(
- currentTabPosition = tabPositions[selectedTabIndex]
+ currentTabPosition = tabPositions[selectedTabIndex],
+ isActivated = isActivated,
)
},
modifier = Modifier.focusRestorer()
@@ -180,17 +181,19 @@
) {
TabRow(
selectedTabIndex = focusedTabIndex,
- indicator = { tabPositions ->
+ indicator = { tabPositions, isActivated ->
// FocusedTab's indicator
TabRowDefaults.PillIndicator(
currentTabPosition = tabPositions[focusedTabIndex],
activeColor = Color.Blue.copy(alpha = 0.4f),
inactiveColor = Color.Transparent,
+ isActivated = isActivated,
)
// SelectedTab's indicator
TabRowDefaults.PillIndicator(
- currentTabPosition = tabPositions[activeTabIndex]
+ currentTabPosition = tabPositions[activeTabIndex],
+ isActivated = isActivated,
)
},
modifier = Modifier.focusRestorer()
diff --git a/tv/samples/src/main/java/androidx/tv/samples/WideButtonSamples.kt b/tv/samples/src/main/java/androidx/tv/samples/WideButtonSamples.kt
index 46e2f94..3adf9e3 100644
--- a/tv/samples/src/main/java/androidx/tv/samples/WideButtonSamples.kt
+++ b/tv/samples/src/main/java/androidx/tv/samples/WideButtonSamples.kt
@@ -74,4 +74,4 @@
)
}
)
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/AutoTestFrameClock.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/AutoTestFrameClock.kt
index ced2983..11dec8c 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/AutoTestFrameClock.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/AutoTestFrameClock.kt
@@ -25,4 +25,4 @@
override suspend fun <R> withFrameNanos(onFrame: (frameTimeNanos: Long) -> R): R {
return onFrame(time.getAndAdd(16_000_000))
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
index 8c90559..c059498 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/BaseLazyGridTestWithOrientation.kt
@@ -244,4 +244,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSpanTest.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSpanTest.kt
index 94d404a..27a357f 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSpanTest.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridSpanTest.kt
@@ -298,4 +298,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridTest.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridTest.kt
index e320788..618df1e 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridTest.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/grid/LazyGridTest.kt
@@ -1101,4 +1101,4 @@
repeat(numberOfPresses) {
InstrumentationRegistry.getInstrumentation().sendKeyDownUpSync(keyCode)
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/BaseLazyListTestWithOrientation.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
index 146be7a..63321b9 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/BaseLazyListTestWithOrientation.kt
@@ -228,4 +228,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyColumnTest.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyColumnTest.kt
index f26d36e..89932b7 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyColumnTest.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyColumnTest.kt
@@ -483,4 +483,4 @@
Offset(-inflate, -inflate),
Size(size.width + inflate * 2, size.height + inflate * 2)
)
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyCustomKeysTest.kt b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyCustomKeysTest.kt
index b3c8a3b..8f2d1ac 100644
--- a/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyCustomKeysTest.kt
+++ b/tv/tv-foundation/src/androidTest/java/androidx/tv/foundation/lazy/list/LazyCustomKeysTest.kt
@@ -488,4 +488,4 @@
private class MyClass(val id: Int)
}
-val TvLazyListState.visibleKeys: List<Any> get() = layoutInfo.visibleItemsInfo.map { it.key }
\ No newline at end of file
+val TvLazyListState.visibleKeys: List<Any> get() = layoutInfo.visibleItemsInfo.map { it.key }
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
index c310814..8e23cfe 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
@@ -96,4 +96,4 @@
/**
* The minimum amount of items near the current first visible item we want to have mapping for.
*/
-private const val NearestItemsExtraItemCount = 200
\ No newline at end of file
+private const val NearestItemsExtraItemCount = 200
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridMeasure.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridMeasure.kt
index d3863fd..35556ec 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridMeasure.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridMeasure.kt
@@ -442,4 +442,4 @@
layoutHeight = layoutHeight,
row = 0,
column = 0
- )
\ No newline at end of file
+ )
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
index 4840bcf..bbe289a 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
@@ -243,4 +243,4 @@
override var maxCurrentLineSpan = 0
override var maxLineSpan = 0
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredItemProvider.kt
index 1329963..7ebe5e7 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredItemProvider.kt
@@ -62,7 +62,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyToIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyToIndexMap
}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredLineProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredLineProvider.kt
index 6b68329..50cb0d3 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredLineProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyMeasuredLineProvider.kt
@@ -93,7 +93,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyToIndexMap: LazyLayoutKeyIndexMap get() = measuredItemProvider.keyToIndexMap
}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridItemScope.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridItemScope.kt
index 5fae2451..7d277d1 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridItemScope.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridItemScope.kt
@@ -48,4 +48,4 @@
visibilityThreshold = IntOffset.VisibilityThreshold
)
): Modifier
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridScopeImpl.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridScopeImpl.kt
index fb5c3d4..06e746f 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridScopeImpl.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridScopeImpl.kt
@@ -84,4 +84,4 @@
val span: TvLazyGridItemSpanScope.(Int) -> TvGridItemSpan,
override val type: ((index: Int) -> Any?),
val item: @Composable TvLazyGridItemScope.(Int) -> Unit
-) : LazyLayoutIntervalContent.Interval
\ No newline at end of file
+) : LazyLayoutIntervalContent.Interval
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyAnimateScroll.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyAnimateScroll.kt
index aa12e0a..7cbfbbe 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyAnimateScroll.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyAnimateScroll.kt
@@ -45,7 +45,7 @@
/**
* Abstraction over animated scroll for using [animateScrollToItem] in different layouts.
* todo(b/243786897): revisit this API and make it public
- **/
+ */
internal interface LazyAnimateScrollScope {
val density: Density
@@ -261,4 +261,4 @@
snapToItem(index = index, scrollOffset = scrollOffset)
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
index b46e090..4e92dc5 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
@@ -150,4 +150,4 @@
val start = maxOf(slidingWindowStart - extraItemCount, 0)
val end = slidingWindowStart + slidingWindowSize + extraItemCount
return start until end
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutSemanticState.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutSemanticState.kt
index fad4aa6..90374c3 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutSemanticState.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/layout/LazyLayoutSemanticState.kt
@@ -44,4 +44,4 @@
} else {
CollectionInfo(rowCount = 1, columnCount = -1)
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListAnimateScrollScope.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListAnimateScrollScope.kt
index 1bdb3c2..7544e90 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListAnimateScrollScope.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListAnimateScrollScope.kt
@@ -62,4 +62,4 @@
override suspend fun scroll(block: suspend ScrollScope.() -> Unit) {
state.scroll(block = block)
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
index d50cd62..613ce8f 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
@@ -100,4 +100,4 @@
/**
* The minimum amount of items near the current first visible item we want to have mapping for.
*/
-private const val NearestItemsExtraItemCount = 100
\ No newline at end of file
+private const val NearestItemsExtraItemCount = 100
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyMeasuredItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyMeasuredItemProvider.kt
index a291b8a..ce25e61 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyMeasuredItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyMeasuredItemProvider.kt
@@ -53,7 +53,7 @@
/**
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
- **/
+ */
val keyToIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyToIndexMap
}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazySemantics.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazySemantics.kt
index fb8cb87..1e54faf 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazySemantics.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazySemantics.kt
@@ -32,4 +32,4 @@
return remember(state, isVertical) {
LazyLayoutSemanticState(state = state, isVertical = isVertical)
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/TvLazyListScopeMarker.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/TvLazyListScopeMarker.kt
index 4931977..3ef6074 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/TvLazyListScopeMarker.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/TvLazyListScopeMarker.kt
@@ -20,4 +20,4 @@
* DSL marker used to distinguish between lazy layout scope and the item scope.
*/
@DslMarker
-annotation class TvLazyListScopeMarker
\ No newline at end of file
+annotation class TvLazyListScopeMarker
diff --git a/tv/tv-material/api/current.txt b/tv/tv-material/api/current.txt
index ddd94d5..c43bb60 100644
--- a/tv/tv-material/api/current.txt
+++ b/tv/tv-material/api/current.txt
@@ -434,11 +434,13 @@
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.tv.material3.ListItemBorder border(optional androidx.tv.material3.Border border, optional androidx.tv.material3.Border focusedBorder, optional androidx.tv.material3.Border pressedBorder, optional androidx.tv.material3.Border selectedBorder, optional androidx.tv.material3.Border disabledBorder, optional androidx.tv.material3.Border focusedSelectedBorder, optional androidx.tv.material3.Border focusedDisabledBorder, optional androidx.tv.material3.Border pressedSelectedBorder);
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.tv.material3.ListItemColors colors(optional long containerColor, optional long contentColor, optional long focusedContainerColor, optional long focusedContentColor, optional long pressedContainerColor, optional long pressedContentColor, optional long selectedContainerColor, optional long selectedContentColor, optional long disabledContainerColor, optional long disabledContentColor, optional long focusedSelectedContainerColor, optional long focusedSelectedContentColor, optional long pressedSelectedContainerColor, optional long pressedSelectedContentColor);
method public float getIconSize();
+ method public float getIconSizeDense();
method public float getListItemElevation();
method public androidx.tv.material3.ListItemGlow glow(optional androidx.tv.material3.Glow glow, optional androidx.tv.material3.Glow focusedGlow, optional androidx.tv.material3.Glow pressedGlow, optional androidx.tv.material3.Glow selectedGlow, optional androidx.tv.material3.Glow focusedSelectedGlow, optional androidx.tv.material3.Glow pressedSelectedGlow);
method public androidx.tv.material3.ListItemScale scale(optional @FloatRange(from=0.0) float scale, optional @FloatRange(from=0.0) float focusedScale, optional @FloatRange(from=0.0) float pressedScale, optional @FloatRange(from=0.0) float selectedScale, optional @FloatRange(from=0.0) float disabledScale, optional @FloatRange(from=0.0) float focusedSelectedScale, optional @FloatRange(from=0.0) float focusedDisabledScale, optional @FloatRange(from=0.0) float pressedSelectedScale);
method public androidx.tv.material3.ListItemShape shape(optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.ui.graphics.Shape focusedShape, optional androidx.compose.ui.graphics.Shape pressedShape, optional androidx.compose.ui.graphics.Shape selectedShape, optional androidx.compose.ui.graphics.Shape disabledShape, optional androidx.compose.ui.graphics.Shape focusedSelectedShape, optional androidx.compose.ui.graphics.Shape focusedDisabledShape, optional androidx.compose.ui.graphics.Shape pressedSelectedShape);
property public final float IconSize;
+ property public final float IconSizeDense;
property public final float ListItemElevation;
field public static final androidx.tv.material3.ListItemDefaults INSTANCE;
}
@@ -447,6 +449,7 @@
}
public final class ListItemKt {
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void DenseListItem(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, kotlin.jvm.functions.Function0<kotlin.Unit> headlineContent, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onLongClick, optional kotlin.jvm.functions.Function0<kotlin.Unit>? overlineContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? supportingContent, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? leadingContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? trailingContent, optional float tonalElevation, optional androidx.tv.material3.ListItemShape shape, optional androidx.tv.material3.ListItemColors colors, optional androidx.tv.material3.ListItemScale scale, optional androidx.tv.material3.ListItemBorder border, optional androidx.tv.material3.ListItemGlow glow, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource);
method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void ListItem(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, kotlin.jvm.functions.Function0<kotlin.Unit> headlineContent, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onLongClick, optional kotlin.jvm.functions.Function0<kotlin.Unit>? overlineContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? supportingContent, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? leadingContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? trailingContent, optional float tonalElevation, optional androidx.tv.material3.ListItemShape shape, optional androidx.tv.material3.ListItemColors colors, optional androidx.tv.material3.ListItemScale scale, optional androidx.tv.material3.ListItemBorder border, optional androidx.tv.material3.ListItemGlow glow, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource);
}
@@ -635,19 +638,19 @@
}
@SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public final class TabDefaults {
- method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors pillIndicatorTabColors(optional long activeContentColor, optional long contentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledActiveContentColor, optional long disabledContentColor, optional long disabledSelectedContentColor);
- method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors underlinedIndicatorTabColors(optional long activeContentColor, optional long contentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledActiveContentColor, optional long disabledContentColor, optional long disabledSelectedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors pillIndicatorTabColors(optional long contentColor, optional long inactiveContentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledContentColor, optional long disabledInactiveContentColor, optional long disabledSelectedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors underlinedIndicatorTabColors(optional long contentColor, optional long inactiveContentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledContentColor, optional long disabledInactiveContentColor, optional long disabledSelectedContentColor);
field public static final androidx.tv.material3.TabDefaults INSTANCE;
}
public final class TabKt {
- method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void Tab(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onFocus, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional boolean enabled, optional androidx.tv.material3.TabColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void Tab(androidx.tv.material3.TabRowScope, boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onFocus, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional boolean enabled, optional androidx.tv.material3.TabColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
}
@SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public final class TabRowDefaults {
- method @androidx.compose.runtime.Composable public void PillIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
+ method @androidx.compose.runtime.Composable public void PillIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, boolean isActivated, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
method @androidx.compose.runtime.Composable public void TabSeparator();
- method @androidx.compose.runtime.Composable public void UnderlinedIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
+ method @androidx.compose.runtime.Composable public void UnderlinedIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, boolean isActivated, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
method @androidx.compose.runtime.Composable public long contentColor();
method public long getContainerColor();
property public final long ContainerColor;
@@ -655,7 +658,12 @@
}
public final class TabRowKt {
- method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void TabRow(int selectedTabIndex, optional androidx.compose.ui.Modifier modifier, optional long containerColor, optional long contentColor, optional kotlin.jvm.functions.Function0<kotlin.Unit> separator, optional kotlin.jvm.functions.Function1<? super java.util.List<androidx.compose.ui.unit.DpRect>,kotlin.Unit> indicator, kotlin.jvm.functions.Function0<kotlin.Unit> tabs);
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void TabRow(int selectedTabIndex, optional androidx.compose.ui.Modifier modifier, optional long containerColor, optional long contentColor, optional kotlin.jvm.functions.Function0<kotlin.Unit> separator, optional kotlin.jvm.functions.Function2<? super java.util.List<androidx.compose.ui.unit.DpRect>,? super java.lang.Boolean,kotlin.Unit> indicator, kotlin.jvm.functions.Function1<? super androidx.tv.material3.TabRowScope,kotlin.Unit> tabs);
+ }
+
+ @SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public interface TabRowScope {
+ method public boolean isActivated();
+ property public abstract boolean isActivated;
}
public final class TextKt {
diff --git a/tv/tv-material/api/restricted_current.txt b/tv/tv-material/api/restricted_current.txt
index ddd94d5..c43bb60 100644
--- a/tv/tv-material/api/restricted_current.txt
+++ b/tv/tv-material/api/restricted_current.txt
@@ -434,11 +434,13 @@
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.tv.material3.ListItemBorder border(optional androidx.tv.material3.Border border, optional androidx.tv.material3.Border focusedBorder, optional androidx.tv.material3.Border pressedBorder, optional androidx.tv.material3.Border selectedBorder, optional androidx.tv.material3.Border disabledBorder, optional androidx.tv.material3.Border focusedSelectedBorder, optional androidx.tv.material3.Border focusedDisabledBorder, optional androidx.tv.material3.Border pressedSelectedBorder);
method @androidx.compose.runtime.Composable @androidx.compose.runtime.ReadOnlyComposable public androidx.tv.material3.ListItemColors colors(optional long containerColor, optional long contentColor, optional long focusedContainerColor, optional long focusedContentColor, optional long pressedContainerColor, optional long pressedContentColor, optional long selectedContainerColor, optional long selectedContentColor, optional long disabledContainerColor, optional long disabledContentColor, optional long focusedSelectedContainerColor, optional long focusedSelectedContentColor, optional long pressedSelectedContainerColor, optional long pressedSelectedContentColor);
method public float getIconSize();
+ method public float getIconSizeDense();
method public float getListItemElevation();
method public androidx.tv.material3.ListItemGlow glow(optional androidx.tv.material3.Glow glow, optional androidx.tv.material3.Glow focusedGlow, optional androidx.tv.material3.Glow pressedGlow, optional androidx.tv.material3.Glow selectedGlow, optional androidx.tv.material3.Glow focusedSelectedGlow, optional androidx.tv.material3.Glow pressedSelectedGlow);
method public androidx.tv.material3.ListItemScale scale(optional @FloatRange(from=0.0) float scale, optional @FloatRange(from=0.0) float focusedScale, optional @FloatRange(from=0.0) float pressedScale, optional @FloatRange(from=0.0) float selectedScale, optional @FloatRange(from=0.0) float disabledScale, optional @FloatRange(from=0.0) float focusedSelectedScale, optional @FloatRange(from=0.0) float focusedDisabledScale, optional @FloatRange(from=0.0) float pressedSelectedScale);
method public androidx.tv.material3.ListItemShape shape(optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.ui.graphics.Shape focusedShape, optional androidx.compose.ui.graphics.Shape pressedShape, optional androidx.compose.ui.graphics.Shape selectedShape, optional androidx.compose.ui.graphics.Shape disabledShape, optional androidx.compose.ui.graphics.Shape focusedSelectedShape, optional androidx.compose.ui.graphics.Shape focusedDisabledShape, optional androidx.compose.ui.graphics.Shape pressedSelectedShape);
property public final float IconSize;
+ property public final float IconSizeDense;
property public final float ListItemElevation;
field public static final androidx.tv.material3.ListItemDefaults INSTANCE;
}
@@ -447,6 +449,7 @@
}
public final class ListItemKt {
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void DenseListItem(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, kotlin.jvm.functions.Function0<kotlin.Unit> headlineContent, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onLongClick, optional kotlin.jvm.functions.Function0<kotlin.Unit>? overlineContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? supportingContent, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? leadingContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? trailingContent, optional float tonalElevation, optional androidx.tv.material3.ListItemShape shape, optional androidx.tv.material3.ListItemColors colors, optional androidx.tv.material3.ListItemScale scale, optional androidx.tv.material3.ListItemBorder border, optional androidx.tv.material3.ListItemGlow glow, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource);
method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void ListItem(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, kotlin.jvm.functions.Function0<kotlin.Unit> headlineContent, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional kotlin.jvm.functions.Function0<kotlin.Unit>? onLongClick, optional kotlin.jvm.functions.Function0<kotlin.Unit>? overlineContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? supportingContent, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? leadingContent, optional kotlin.jvm.functions.Function0<kotlin.Unit>? trailingContent, optional float tonalElevation, optional androidx.tv.material3.ListItemShape shape, optional androidx.tv.material3.ListItemColors colors, optional androidx.tv.material3.ListItemScale scale, optional androidx.tv.material3.ListItemBorder border, optional androidx.tv.material3.ListItemGlow glow, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource);
}
@@ -635,19 +638,19 @@
}
@SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public final class TabDefaults {
- method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors pillIndicatorTabColors(optional long activeContentColor, optional long contentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledActiveContentColor, optional long disabledContentColor, optional long disabledSelectedContentColor);
- method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors underlinedIndicatorTabColors(optional long activeContentColor, optional long contentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledActiveContentColor, optional long disabledContentColor, optional long disabledSelectedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors pillIndicatorTabColors(optional long contentColor, optional long inactiveContentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledContentColor, optional long disabledInactiveContentColor, optional long disabledSelectedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.tv.material3.TabColors underlinedIndicatorTabColors(optional long contentColor, optional long inactiveContentColor, optional long selectedContentColor, optional long focusedContentColor, optional long focusedSelectedContentColor, optional long disabledContentColor, optional long disabledInactiveContentColor, optional long disabledSelectedContentColor);
field public static final androidx.tv.material3.TabDefaults INSTANCE;
}
public final class TabKt {
- method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void Tab(boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onFocus, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional boolean enabled, optional androidx.tv.material3.TabColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void Tab(androidx.tv.material3.TabRowScope, boolean selected, kotlin.jvm.functions.Function0<kotlin.Unit> onFocus, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional boolean enabled, optional androidx.tv.material3.TabColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.RowScope,kotlin.Unit> content);
}
@SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public final class TabRowDefaults {
- method @androidx.compose.runtime.Composable public void PillIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
+ method @androidx.compose.runtime.Composable public void PillIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, boolean isActivated, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
method @androidx.compose.runtime.Composable public void TabSeparator();
- method @androidx.compose.runtime.Composable public void UnderlinedIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
+ method @androidx.compose.runtime.Composable public void UnderlinedIndicator(androidx.compose.ui.unit.DpRect currentTabPosition, boolean isActivated, optional androidx.compose.ui.Modifier modifier, optional long activeColor, optional long inactiveColor);
method @androidx.compose.runtime.Composable public long contentColor();
method public long getContainerColor();
property public final long ContainerColor;
@@ -655,7 +658,12 @@
}
public final class TabRowKt {
- method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void TabRow(int selectedTabIndex, optional androidx.compose.ui.Modifier modifier, optional long containerColor, optional long contentColor, optional kotlin.jvm.functions.Function0<kotlin.Unit> separator, optional kotlin.jvm.functions.Function1<? super java.util.List<androidx.compose.ui.unit.DpRect>,kotlin.Unit> indicator, kotlin.jvm.functions.Function0<kotlin.Unit> tabs);
+ method @SuppressCompatibility @androidx.compose.runtime.Composable @androidx.tv.material3.ExperimentalTvMaterial3Api public static void TabRow(int selectedTabIndex, optional androidx.compose.ui.Modifier modifier, optional long containerColor, optional long contentColor, optional kotlin.jvm.functions.Function0<kotlin.Unit> separator, optional kotlin.jvm.functions.Function2<? super java.util.List<androidx.compose.ui.unit.DpRect>,? super java.lang.Boolean,kotlin.Unit> indicator, kotlin.jvm.functions.Function1<? super androidx.tv.material3.TabRowScope,kotlin.Unit> tabs);
+ }
+
+ @SuppressCompatibility @androidx.tv.material3.ExperimentalTvMaterial3Api public interface TabRowScope {
+ method public boolean isActivated();
+ property public abstract boolean isActivated;
}
public final class TextKt {
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutScreenshotTest.kt
index 4b6c210..91f5f73 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutScreenshotTest.kt
@@ -272,4 +272,4 @@
}
}
-private const val CardLayoutWrapperTag = "card_layout_wrapper"
\ No newline at end of file
+private const val CardLayoutWrapperTag = "card_layout_wrapper"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutTest.kt
index 9002b60..af861d3 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardLayoutTest.kt
@@ -196,4 +196,4 @@
private const val StandardCardLayoutTag = "standard-card-layout"
private const val WideCardLayoutTag = "wide-card-layout"
-private const val SampleImageTag = "sample-image"
\ No newline at end of file
+private const val SampleImageTag = "sample-image"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardScreenshotTest.kt
index 1a7245c..f9976bb 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardScreenshotTest.kt
@@ -389,4 +389,4 @@
}
}
-private const val CardWrapperTag = "card_wrapper"
\ No newline at end of file
+private const val CardWrapperTag = "card_wrapper"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardTest.kt
index 426cba7..c6ad231 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CardTest.kt
@@ -695,4 +695,4 @@
private const val ClassicCardTag = "classic-card"
private const val WideClassicCardTag = "wide-classic-card"
-private const val SampleImageTag = "sample-image"
\ No newline at end of file
+private const val SampleImageTag = "sample-image"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CheckboxTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CheckboxTest.kt
index d83784a..e3f46b6 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/CheckboxTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/CheckboxTest.kt
@@ -161,4 +161,4 @@
.assertHasNoClickAction()
.assert(isFocusable()) // Check merged into parent
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/DenseListItemScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/DenseListItemScreenshotTest.kt
new file mode 100644
index 0000000..cb55ab8
--- /dev/null
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/DenseListItemScreenshotTest.kt
@@ -0,0 +1,414 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.tv.material3
+
+import android.os.Build
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Favorite
+import androidx.compose.material.icons.filled.KeyboardArrowRight
+import androidx.compose.testutils.assertAgainstGolden
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.semantics.SemanticsActions
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onChild
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performSemanticsAction
+import androidx.compose.ui.unit.dp
+import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
+import androidx.test.screenshot.AndroidXScreenshotTestRule
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+@LargeTest
+@RunWith(Parameterized::class)
+@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+@OptIn(ExperimentalTvMaterial3Api::class)
+class DenseListItemScreenshotTest(private val scheme: ColorSchemeWrapper) {
+ @get:Rule
+ val rule = createComposeRule()
+
+ @get:Rule
+ val screenshotRule = AndroidXScreenshotTestRule(TV_GOLDEN_MATERIAL3)
+
+ val wrapperModifier = Modifier
+ .testTag(DenseListItemWrapperTag)
+ .background(scheme.colorScheme.surface)
+ .padding(20.dp)
+
+ @Test
+ fun denseListItem_customColor() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ },
+ colors = ListItemDefaults.colors(containerColor = Color.Red)
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_customColor")
+ }
+
+ @Test
+ fun denseListItem_oneLine() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("One line dense list item") }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine")
+ }
+
+ @Test
+ fun denseListItem_oneLine_withIcon() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("One line dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_withIcon")
+ }
+
+ @Test
+ fun denseListItem_twoLine() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Column(
+ modifier = wrapperModifier,
+ verticalArrangement = Arrangement.spacedBy(20.dp)
+ ) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Two line dense list item") },
+ supportingContent = { Text("Secondary text") }
+ )
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Two line dense list item") },
+ overlineContent = { Text("OVERLINE") }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_twoLine")
+ }
+
+ @Test
+ fun denseListItem_twoLine_withIcon() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Column(
+ modifier = wrapperModifier,
+ verticalArrangement = Arrangement.spacedBy(20.dp)
+ ) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Two line dense list item") },
+ supportingContent = { Text("Secondary text") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Two line dense list item") },
+ overlineContent = { Text("OVERLINE") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_twoLine_withIcon")
+ }
+
+ @Test
+ fun denseListItem_threeLine() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Three line dense list item") },
+ overlineContent = { Text("OVERLINE") },
+ supportingContent = { Text("Secondary text") }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_threeLine")
+ }
+
+ @Test
+ fun denseListItem_threeLine_withIcon() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Three line dense list item") },
+ overlineContent = { Text("OVERLINE") },
+ supportingContent = { Text("Secondary text") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_threeLine_withIcon")
+ }
+
+ @Test
+ fun denseListItem_oneLine_focused() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ rule.onNodeWithTag(DenseListItemWrapperTag)
+ .onChild()
+ .performSemanticsAction(SemanticsActions.RequestFocus)
+ rule.waitForIdle()
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_focused")
+ }
+
+ @Test
+ fun denseListItem_oneLine_disabled() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ enabled = false,
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_disabled")
+ }
+
+ @Test
+ fun denseListItem_oneLine_focusedDisabled() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ enabled = false,
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ rule.onNodeWithTag(DenseListItemWrapperTag)
+ .onChild()
+ .performSemanticsAction(SemanticsActions.RequestFocus)
+ rule.waitForIdle()
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_focusedDisabled")
+ }
+
+ @Test
+ fun denseListItem_oneLine_selected() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = true,
+ onClick = {},
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_selected")
+ }
+
+ @Test
+ fun denseListItem_oneLine_focusedSelected() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = true,
+ onClick = {},
+ headlineContent = { Text("Dense list item") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ rule.onNodeWithTag(DenseListItemWrapperTag)
+ .onChild()
+ .performSemanticsAction(SemanticsActions.RequestFocus)
+ rule.waitForIdle()
+
+ assertAgainstGolden("denseListItem_${scheme.name}_oneLine_focusedSelected")
+ }
+
+ @Test
+ fun denseListItem_threeLine_withTrailingContent() {
+ rule.setMaterialContent(scheme.colorScheme) {
+ Box(modifier = wrapperModifier) {
+ DenseListItem(
+ selected = false,
+ onClick = {},
+ headlineContent = { Text("Three line dense list item") },
+ overlineContent = { Text("OVERLINE") },
+ supportingContent = { Text("Secondary text") },
+ leadingContent = {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ },
+ trailingContent = {
+ Icon(
+ imageVector = Icons.Filled.KeyboardArrowRight,
+ contentDescription = null,
+ modifier = Modifier.size(ListItemDefaults.IconSizeDense)
+ )
+ }
+ )
+ }
+ }
+
+ assertAgainstGolden("denseListItem_${scheme.name}_threeLine_withTrailingContent")
+ }
+
+ private fun assertAgainstGolden(goldenName: String) {
+ rule.onNodeWithTag(DenseListItemWrapperTag)
+ .captureToImage()
+ .assertAgainstGolden(screenshotRule, goldenName)
+ }
+
+ // Provide the ColorScheme and their name parameter in a ColorSchemeWrapper.
+ // This makes sure that the default method name and the initial Scuba image generated
+ // name is as expected.
+ companion object {
+ @OptIn(ExperimentalTvMaterial3Api::class)
+ @Parameterized.Parameters(name = "{0}")
+ @JvmStatic
+ fun parameters() = arrayOf(
+ ColorSchemeWrapper("lightTheme", lightColorScheme()),
+ ColorSchemeWrapper("darkTheme", darkColorScheme()),
+ )
+ }
+
+ @OptIn(ExperimentalTvMaterial3Api::class)
+ class ColorSchemeWrapper constructor(val name: String, val colorScheme: ColorScheme) {
+ override fun toString(): String {
+ return name
+ }
+ }
+}
+
+private const val DenseListItemWrapperTag = "denseListItem_wrapper"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/GoldenCommon.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/GoldenCommon.kt
index 49b8130..ebb26c0 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/GoldenCommon.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/GoldenCommon.kt
@@ -16,4 +16,4 @@
package androidx.tv.material3
-internal const val TV_GOLDEN_MATERIAL3 = "tv/compose/material3"
\ No newline at end of file
+internal const val TV_GOLDEN_MATERIAL3 = "tv/compose/material3"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemScreenshotTest.kt
index a9a8160..78de274 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemScreenshotTest.kt
@@ -420,4 +420,4 @@
}
}
-private const val ListItemWrapperTag = "listItem_wrapper"
\ No newline at end of file
+private const val ListItemWrapperTag = "listItem_wrapper"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemTest.kt
index 4646a03..9905170 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/ListItemTest.kt
@@ -51,7 +51,7 @@
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.width
import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.MediumTest
+import androidx.test.filters.LargeTest
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
@@ -61,7 +61,7 @@
ExperimentalTestApi::class,
ExperimentalTvMaterial3Api::class
)
-@MediumTest
+@LargeTest
@RunWith(AndroidJUnit4::class)
class ListItemTest {
@get:Rule
@@ -257,7 +257,7 @@
}
@Test
- fun listItem_iconPadding() {
+ fun listItem_leadingContentPadding() {
val testIconTag = "IconTag"
rule.setContent {
@@ -315,7 +315,7 @@
rule.setContent {
ListItem(
- leadingContent = {
+ trailingContent = {
Box(
modifier = Modifier
.size(ListItemDefaults.IconSize)
@@ -353,14 +353,14 @@
"padding between the bottom of the trailing content and the bottom of the list item."
)
- (trailingContentBounds.left - itemBounds.left).assertIsEqualTo(
+ (itemBounds.right - trailingContentBounds.right).assertIsEqualTo(
16.dp,
- "padding between the start of the trailing content and the start of the list item."
+ "padding between the end of the trailing content and the end of the list item."
)
- (textBounds.left - trailingContentBounds.right).assertIsEqualTo(
+ (trailingContentBounds.left - textBounds.right).assertIsEqualTo(
8.dp,
- "padding between the end of the trailing content and the start of the text."
+ "padding between the start of the trailing content and the end of the text."
)
}
@@ -488,7 +488,214 @@
rule.onNodeWithTag(ListItemTag)
.assertWidthIsEqualTo(rule.onRoot().getUnclippedBoundsInRoot().width)
}
+
+ @Test
+ fun denseListItem_contentPaddingHorizontal() {
+ rule.setContent {
+ DenseListItem(
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = {
+ Text(
+ text = "Test Text",
+ modifier = Modifier
+ .fillMaxWidth()
+ .testTag(DenseListItemTextTag)
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ onClick = {},
+ selected = false
+ )
+ }
+
+ val itemBounds = rule.onNodeWithTag(DenseListItemTag).getUnclippedBoundsInRoot()
+ val textBounds = rule.onNodeWithTag(DenseListItemTextTag).getUnclippedBoundsInRoot()
+
+ (textBounds.left - itemBounds.left).assertIsEqualTo(
+ 12.dp,
+ "padding between the start of the list item and the start of the text."
+ )
+
+ (itemBounds.right - textBounds.right).assertIsEqualTo(
+ 12.dp,
+ "padding between the end of the text and the end of the list item."
+ )
+ }
+
+ @Test
+ fun denseListItem_contentPaddingVertical() {
+ rule.setContent {
+ ListItem(
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = {
+ Text(
+ text = "Test Text",
+ modifier = Modifier
+ .fillMaxHeight()
+ .testTag(DenseListItemTextTag)
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ onClick = {},
+ selected = false
+ )
+ }
+
+ val itemBounds = rule.onNodeWithTag(DenseListItemTag).getUnclippedBoundsInRoot()
+ val textBounds = rule.onNodeWithTag(DenseListItemTextTag).getUnclippedBoundsInRoot()
+
+ (textBounds.top - itemBounds.top).assertIsEqualTo(
+ 12.dp,
+ "padding between the top of the list item and the top of the text."
+ )
+
+ (itemBounds.bottom - textBounds.bottom).assertIsEqualTo(
+ 12.dp,
+ "padding between the bottom of the text and the bottom of the list item."
+ )
+ }
+
+ @Test
+ fun denseListItem_leadingContentPadding() {
+ val testIconTag = "IconTag"
+
+ rule.setContent {
+ DenseListItem(
+ leadingContent = {
+ Box(
+ modifier = Modifier
+ .size(ListItemDefaults.IconSizeDense)
+ .testTag(testIconTag)
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = {
+ Text(
+ text = "Test Text",
+ modifier = Modifier
+ .testTag(DenseListItemTextTag)
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ onClick = {},
+ selected = false
+ )
+ }
+
+ val itemBounds = rule.onNodeWithTag(DenseListItemTag).getUnclippedBoundsInRoot()
+ val textBounds = rule.onNodeWithTag(DenseListItemTextTag).getUnclippedBoundsInRoot()
+ val iconBounds = rule.onNodeWithTag(testIconTag).getUnclippedBoundsInRoot()
+
+ (iconBounds.top - itemBounds.top).assertIsEqualTo(
+ 10.dp,
+ "padding between the top of the list item and the top of the icon."
+ )
+
+ (itemBounds.bottom - iconBounds.bottom).assertIsEqualTo(
+ 10.dp,
+ "padding between the bottom of the icon and the bottom of the list item."
+ )
+
+ (iconBounds.left - itemBounds.left).assertIsEqualTo(
+ 12.dp,
+ "padding between the start of the icon and the start of the list item."
+ )
+
+ (textBounds.left - iconBounds.right).assertIsEqualTo(
+ 8.dp,
+ "padding between the end of the icon and the start of the text."
+ )
+ }
+
+ @Test
+ fun denseListItem_trailingContentPadding() {
+ val testTrailingContentTag = "TrailingIconTag"
+
+ rule.setContent {
+ DenseListItem(
+ trailingContent = {
+ Box(
+ modifier = Modifier
+ .size(ListItemDefaults.IconSizeDense)
+ .testTag(testTrailingContentTag)
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = {
+ Text(
+ text = "Test Text",
+ modifier = Modifier
+ .testTag(DenseListItemTextTag)
+ .fillMaxWidth()
+ .semantics(mergeDescendants = true) {}
+ )
+ },
+ onClick = {},
+ selected = false
+ )
+ }
+
+ val itemBounds = rule.onNodeWithTag(DenseListItemTag).getUnclippedBoundsInRoot()
+ val textBounds = rule.onNodeWithTag(DenseListItemTextTag).getUnclippedBoundsInRoot()
+ val trailingContentBounds =
+ rule.onNodeWithTag(testTrailingContentTag).getUnclippedBoundsInRoot()
+
+ (trailingContentBounds.top - itemBounds.top).assertIsEqualTo(
+ 10.dp,
+ "padding between the top of the list item and the top of the trailing content."
+ )
+
+ (itemBounds.bottom - trailingContentBounds.bottom).assertIsEqualTo(
+ 10.dp,
+ "padding between the bottom of the trailing content and the bottom of the list item."
+ )
+
+ (itemBounds.right - trailingContentBounds.right).assertIsEqualTo(
+ 12.dp,
+ "padding between the end of the trailing content and the end of the list item."
+ )
+
+ (trailingContentBounds.left - textBounds.right).assertIsEqualTo(
+ 8.dp,
+ "padding between the start of the trailing content and the end of the text."
+ )
+ }
+
+ @Test
+ fun denseListItem_oneLineHeight() {
+ val expectedHeightNoIcon = 40.dp
+
+ rule.setContent {
+ DenseListItem(
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = { Text(text = "text") },
+ onClick = {},
+ selected = false
+ )
+ }
+
+ rule.onNodeWithTag(DenseListItemTag).assertHeightIsEqualTo(expectedHeightNoIcon)
+ }
+
+ @Test
+ fun denseListItem_width() {
+ rule.setContent {
+ DenseListItem(
+ modifier = Modifier.testTag(DenseListItemTag),
+ headlineContent = { Text(text = "text") },
+ onClick = {},
+ selected = false
+ )
+ }
+ rule.onNodeWithTag(DenseListItemTag)
+ .assertWidthIsEqualTo(rule.onRoot().getUnclippedBoundsInRoot().width)
+ }
}
private const val ListItemTag = "ListItem"
private const val ListItemTextTag = "ListItemText"
+
+private const val DenseListItemTag = "DenseListItem"
+private const val DenseListItemTextTag = "DenseListItemText"
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/NonInteractiveSurfaceScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/NonInteractiveSurfaceScreenshotTest.kt
index f317957..439bb98 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/NonInteractiveSurfaceScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/NonInteractiveSurfaceScreenshotTest.kt
@@ -176,4 +176,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonScreenshotTest.kt
index 1ee4b70..38ed4eb 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonScreenshotTest.kt
@@ -159,4 +159,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonTest.kt
index 75cd25b..9a8ab6a 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonTest.kt
@@ -215,4 +215,4 @@
rule.onNodeWithTag(itemTwo)
.assertHasUnSelectedSemantics()
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SurfaceTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SurfaceTest.kt
index 6e2c2de..a39c580 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SurfaceTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SurfaceTest.kt
@@ -34,6 +34,7 @@
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -49,6 +50,7 @@
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.toPixelMap
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.nativeKeyCode
import androidx.compose.ui.platform.LocalFocusManager
@@ -1162,6 +1164,65 @@
// blue border shouldn't be visible
rootEl.captureToImage().assertDoesNotContainColor(Color.Blue)
}
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+ @Test
+ fun surfaceBorderShapeShouldDefaultToElementShape() {
+ val containerTag = "container"
+ val surfaceTag = "surface"
+
+ rule.setContent {
+ val border = Border(
+ border = BorderStroke(
+ width = 5.dp,
+ color = Color.Red,
+ )
+ )
+
+ Box(modifier = Modifier.background(Color.White).testTag(containerTag)) {
+ Surface(
+ onClick = { },
+ modifier = Modifier
+ .size(200.dp, 100.dp)
+ .testTag(surfaceTag),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = Color.Blue,
+ focusedContainerColor = Color.Blue,
+ ),
+ shape = ClickableSurfaceDefaults.shape(
+ shape = RoundedCornerShape(50),
+ focusedShape = RectangleShape,
+ ),
+ scale = ClickableSurfaceScale.None,
+ border = ClickableSurfaceDefaults.border(
+ border = border,
+ focusedBorder = border,
+ )
+ ) {}
+ }
+ }
+
+ // The shape is rounded so the border should not be there on the top left corner
+ assert(
+ rule
+ .onNodeWithTag(containerTag)
+ .captureToImage()
+ .toPixelMap(0, 0, 1, 1)
+ .get(0, 0) == Color.White
+ )
+
+ rule.onNodeWithTag(surfaceTag).requestFocus()
+ rule.waitForIdle()
+
+ // The shape is rectangle so the border should be there on the top left corner
+ assert(
+ rule
+ .onNodeWithTag(containerTag)
+ .captureToImage()
+ .toPixelMap(0, 0, 1, 1)
+ .get(0, 0) == Color.Red
+ )
+ }
}
internal fun SemanticsNodeInteraction.performLongKeyPress(
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchScreenshotTest.kt
index dfa1fcf..2abf5d6 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchScreenshotTest.kt
@@ -270,4 +270,4 @@
return name
}
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchTest.kt
index 8d2efaa..ce7b471 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchTest.kt
@@ -316,4 +316,4 @@
rule.onNodeWithTag("1").assertIsOn()
rule.onNodeWithTag("2").assertIsOff()
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowScreenshotTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowScreenshotTest.kt
index ff289b8..ab61794 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowScreenshotTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowScreenshotTest.kt
@@ -203,9 +203,10 @@
TabRow(
selectedTabIndex = selectedTabIndex,
separator = { Spacer(modifier = Modifier.width(12.dp)) },
- indicator = { tabPositions ->
+ indicator = { tabPositions, isisActivated ->
TabRowDefaults.UnderlinedIndicator(
- currentTabPosition = tabPositions[selectedTabIndex]
+ currentTabPosition = tabPositions[selectedTabIndex],
+ isActivated = isisActivated,
)
}
) {
@@ -246,9 +247,10 @@
TabRow(
selectedTabIndex = selectedTabIndex,
separator = { Spacer(modifier = Modifier.width(12.dp)) },
- indicator = { tabPositions ->
+ indicator = { tabPositions, isActivated ->
TabRowDefaults.UnderlinedIndicator(
- currentTabPosition = tabPositions[selectedTabIndex]
+ currentTabPosition = tabPositions[selectedTabIndex],
+ isActivated = isActivated,
)
}
) {
@@ -295,9 +297,10 @@
TabRow(
selectedTabIndex = selectedTabIndex,
separator = { Spacer(modifier = Modifier.width(12.dp)) },
- indicator = { tabPositions ->
+ indicator = { tabPositions, isActivated ->
TabRowDefaults.UnderlinedIndicator(
- currentTabPosition = tabPositions[selectedTabIndex]
+ currentTabPosition = tabPositions[selectedTabIndex],
+ isActivated = isActivated,
)
},
) {
diff --git a/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowTest.kt b/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowTest.kt
index 1758853..f1ca6d3 100644
--- a/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowTest.kt
+++ b/tv/tv-material/src/androidTest/java/androidx/tv/material3/TabRowTest.kt
@@ -169,17 +169,19 @@
buildTabPanel = @Composable { index, _ ->
BasicText(text = "Panel ${index + 1}")
},
- indicator = @Composable { tabPositions ->
+ indicator = @Composable { tabPositions, isActivated ->
// FocusedTab's indicator
TabRowDefaults.PillIndicator(
currentTabPosition = tabPositions[focusedTabIndex],
+ isActivated = isActivated,
activeColor = Color.Blue.copy(alpha = 0.4f),
inactiveColor = Color.Transparent,
)
// SelectedTab's indicator
TabRowDefaults.PillIndicator(
- currentTabPosition = tabPositions[activeTabIndex]
+ currentTabPosition = tabPositions[activeTabIndex],
+ isActivated = isActivated,
)
}
)
@@ -203,6 +205,7 @@
rule.onNodeWithText(secondPanel).assertIsDisplayed()
}
+ @OptIn(ExperimentalTvMaterial3Api::class)
private fun setContent(
tabs: List<String>,
contentBuilder: @Composable () -> Unit = {
@@ -235,15 +238,16 @@
modifier: Modifier = Modifier,
onFocus: (index: Int) -> Unit = {},
onClick: (index: Int) -> Unit = onFocus,
- buildTab: @Composable ((index: Int, tab: String) -> Unit) = @Composable { index, tab ->
- TabSample(
- selected = selectedTabIndex == index,
- onFocus = { onFocus(index) },
- onClick = { onClick(index) },
- modifier = Modifier.testTag(tab),
- )
- },
- indicator: @Composable ((tabPositions: List<DpRect>) -> Unit)? = null,
+ buildTab: @Composable (TabRowScope.(index: Int, tab: String) -> Unit) =
+ @Composable { index, tab ->
+ TabSample(
+ selected = selectedTabIndex == index,
+ onFocus = { onFocus(index) },
+ onClick = { onClick(index) },
+ modifier = Modifier.testTag(tab),
+ )
+ },
+ indicator: @Composable ((tabPositions: List<DpRect>, isTabRowActive: Boolean) -> Unit)? = null,
buildTabPanel: @Composable ((index: Int, tab: String) -> Unit) = @Composable { _, tab ->
BasicText(text = tab)
},
@@ -294,7 +298,7 @@
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
-private fun TabSample(
+private fun TabRowScope.TabSample(
selected: Boolean,
modifier: Modifier = Modifier,
onFocus: () -> Unit = {},
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/Border.kt b/tv/tv-material/src/main/java/androidx/tv/material3/Border.kt
index 4b43641..cec521e 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/Border.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/Border.kt
@@ -23,6 +23,7 @@
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
+import androidx.tv.material3.tokens.ShapeTokens
/**
* Defines the border for a TV component.
@@ -35,7 +36,7 @@
class Border(
val border: BorderStroke,
val inset: Dp = 0.dp,
- val shape: Shape = ShapeDefaults.Medium
+ val shape: Shape = ShapeTokens.BorderDefaultShape
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -82,4 +83,4 @@
shape = RectangleShape
)
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/BringIntoViewIfChildrenAreFocused.kt b/tv/tv-material/src/main/java/androidx/tv/material3/BringIntoViewIfChildrenAreFocused.kt
index b973bb7..b34a3a9 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/BringIntoViewIfChildrenAreFocused.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/BringIntoViewIfChildrenAreFocused.kt
@@ -52,4 +52,4 @@
}
)
}
-)
\ No newline at end of file
+)
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/ExperimentalTvMaterial3Api.kt b/tv/tv-material/src/main/java/androidx/tv/material3/ExperimentalTvMaterial3Api.kt
index 006ab10..858d485 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/ExperimentalTvMaterial3Api.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/ExperimentalTvMaterial3Api.kt
@@ -20,4 +20,4 @@
"This tv-material API is experimental and likely to change or be removed in the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalTvMaterial3Api
\ No newline at end of file
+annotation class ExperimentalTvMaterial3Api
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/KeyEventUtils.kt b/tv/tv-material/src/main/java/androidx/tv/material3/KeyEventUtils.kt
index d13b221..ab5958b 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/KeyEventUtils.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/KeyEventUtils.kt
@@ -30,4 +30,4 @@
/**
* Checks if the keyEventType is `KeyDown`
*/
-internal fun KeyEvent.isTypeKeyDown() = type == KeyDown
\ No newline at end of file
+internal fun KeyEvent.isTypeKeyDown() = type == KeyDown
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt b/tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt
index 5ba1481..6e1a4a1 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt
@@ -34,6 +34,7 @@
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
/**
@@ -114,6 +115,107 @@
scale = scale,
border = border,
glow = glow,
+ minHeight = listItemMinHeight(
+ hasLeadingContent = leadingContent != null,
+ hasSupportingContent = supportingContent != null,
+ hasOverlineContent = overlineContent != null
+ ),
+ minIconSize = ListItemDefaults.IconSize,
+ headlineTextStyle = MaterialTheme.typography.titleMedium,
+ trailingTextStyle = MaterialTheme.typography.labelLarge,
+ interactionSource = interactionSource
+ )
+}
+
+/**
+ * Lists are continuous, vertical indexes of text or images.
+ *
+ * [DenseListItem] is a smaller/denser version of the Material [ListItem].
+ *
+ * This component can be used to achieve the list item templates existing in the spec. One-line list
+ * items have a singular line of headline content. Two-line list items additionally have either
+ * supporting or overline content. Three-line list items have either both supporting and overline
+ * content, or extended (two-line) supporting text.
+ *
+ * This ListItem handles click events, calling its [onClick] lambda. It also support selected state
+ * which can be toggled using the [selected] param.
+ *
+ * @param selected defines whether this ListItem is selected or not
+ * @param onClick called when this ListItem is clicked
+ * @param headlineContent the [Composable] headline content of the list item
+ * @param modifier [Modifier] to be applied to the list item
+ * @param enabled controls the enabled state of this list item. When `false`, this component will
+ * not respond to user input, and it will appear visually disabled and disabled to accessibility
+ * services.
+ * @param onLongClick called when this ListItem is long clicked (long-pressed).
+ * @param leadingContent the [Composable] leading content of the list item
+ * @param overlineContent the [Composable] content displayed above the headline content
+ * @param supportingContent the [Composable] content displayed below the headline content
+ * @param trailingContent the [Composable] trailing meta text, icon, switch or checkbox
+ * @param tonalElevation the tonal elevation of this list item
+ * @param shape [ListItemShape] defines the shape of ListItem's container in different interaction
+ * states. See [ListItemDefaults.shape].
+ * @param colors [ListItemColors] defines the background and content colors used in the list item
+ * for different interaction states. See [ListItemDefaults.colors]
+ * @param scale [ListItemScale] defines the size of the list item relative to its original size in
+ * different interaction states. See [ListItemDefaults.scale]
+ * @param border [ListItemBorder] defines a border around the list item in different interaction
+ * states. See [ListItemDefaults.border]
+ * @param glow [ListItemGlow] defines a shadow to be shown behind the list item for different
+ * interaction states. See [ListItemDefaults.glow]
+ * @param interactionSource the [MutableInteractionSource] representing the stream of
+ * [Interaction]s for this component. You can create and pass in your own [remember]ed instance
+ * to observe [Interaction]s and customize the appearance / behavior of this list item in different
+ * states.
+ */
+@ExperimentalTvMaterial3Api
+@Composable
+fun DenseListItem(
+ selected: Boolean,
+ onClick: () -> Unit,
+ headlineContent: @Composable () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ onLongClick: (() -> Unit)? = null,
+ overlineContent: (@Composable () -> Unit)? = null,
+ supportingContent: (@Composable () -> Unit)? = null,
+ leadingContent: (@Composable BoxScope.() -> Unit)? = null,
+ trailingContent: (@Composable () -> Unit)? = null,
+ tonalElevation: Dp = ListItemDefaults.ListItemElevation,
+ shape: ListItemShape = ListItemDefaults.shape(),
+ colors: ListItemColors = ListItemDefaults.colors(),
+ scale: ListItemScale = ListItemDefaults.scale(),
+ border: ListItemBorder = ListItemDefaults.border(),
+ glow: ListItemGlow = ListItemDefaults.glow(),
+ interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
+) {
+ BaseListItem(
+ selected = selected,
+ onClick = onClick,
+ headlineContent = headlineContent,
+ contentPadding = ListItemDefaults.ContentPaddingDense,
+ modifier = modifier,
+ enabled = enabled,
+ onLongClick = onLongClick,
+ leadingContent = leadingContent,
+ overlineContent = overlineContent,
+ supportingContent = supportingContent,
+ trailingContent = trailingContent,
+ tonalElevation = tonalElevation,
+ shape = shape,
+ colors = colors,
+ scale = scale,
+ border = border,
+ glow = glow,
+ minHeight = listItemMinHeight(
+ hasLeadingContent = leadingContent != null,
+ hasSupportingContent = supportingContent != null,
+ hasOverlineContent = overlineContent != null,
+ dense = true
+ ),
+ minIconSize = ListItemDefaults.IconSizeDense,
+ headlineTextStyle = MaterialTheme.typography.titleSmall,
+ trailingTextStyle = MaterialTheme.typography.labelSmall,
interactionSource = interactionSource
)
}
@@ -145,6 +247,10 @@
* states.
* @param glow [ListItemGlow] defines a shadow to be shown behind the list item for different
* interaction states.
+ * @param minHeight defines the minimum height [Dp] for the ListItem.
+ * @param minIconSize defines the minimum icon size [Dp] to be used in leading content.
+ * @param headlineTextStyle defines the [TextStyle] for the headline content.
+ * @param trailingTextStyle defines the [TextStyle] for the trailing content.
* @param interactionSource the [MutableInteractionSource] representing the stream of
* [Interaction]s for this component. You can create and pass in your own [remember]ed instance
* to observe [Interaction]s and customize the appearance / behavior of this list item in different
@@ -170,6 +276,10 @@
scale: ListItemScale,
border: ListItemBorder,
glow: ListItemGlow,
+ minHeight: Dp,
+ minIconSize: Dp,
+ headlineTextStyle: TextStyle,
+ trailingTextStyle: TextStyle,
interactionSource: MutableInteractionSource
) {
val semanticModifier = Modifier
@@ -177,6 +287,7 @@
this.selected = selected
}
.then(modifier)
+
Surface(
checked = selected,
onCheckedChange = { onClick.invoke() },
@@ -193,13 +304,7 @@
) {
Row(
modifier = Modifier
- .defaultMinSize(
- minHeight = listItemMinHeight(
- hasLeadingContent = leadingContent != null,
- hasSupportingContent = supportingContent != null,
- hasOverlineContent = overlineContent != null
- )
- )
+ .defaultMinSize(minHeight = minHeight)
.padding(contentPadding),
verticalAlignment = Alignment.CenterVertically
) {
@@ -207,8 +312,8 @@
Box(
modifier = Modifier
.defaultMinSize(
- minWidth = ListItemDefaults.IconSize,
- minHeight = ListItemDefaults.IconSize
+ minWidth = minIconSize,
+ minHeight = minIconSize
)
.graphicsLayer {
alpha = ListItemDefaults.LeadingContentOpacity
@@ -241,7 +346,7 @@
}
ProvideTextStyle(
- value = MaterialTheme.typography.titleMedium,
+ value = headlineTextStyle,
content = headlineContent
)
@@ -269,7 +374,7 @@
LocalContentColor provides LocalContentColor.current
) {
ProvideTextStyle(
- value = MaterialTheme.typography.labelLarge,
+ value = trailingTextStyle,
content = it
)
}
@@ -286,6 +391,7 @@
* @param hasLeadingContent if the leading supporting visual of the list item exists.
* @param hasSupportingContent if the supporting text composable of the list item exists.
* @param hasOverlineContent if the text composable displayed above the headline text exists.
+ * @param dense whether the current list item is dense or not.
*
* @return The minimum container height for the given list item (to be used with
* [Modifier.defaultMinSize]).
@@ -294,16 +400,29 @@
private fun listItemMinHeight(
hasLeadingContent: Boolean,
hasSupportingContent: Boolean,
- hasOverlineContent: Boolean
+ hasOverlineContent: Boolean,
+ dense: Boolean = false
): Dp {
return when {
- hasSupportingContent && hasOverlineContent -> ListItemDefaults.MinContainerHeightThreeLine
+ hasSupportingContent && hasOverlineContent -> {
+ if (dense) ListItemDefaults.MinDenseContainerHeightThreeLine
+ else ListItemDefaults.MinContainerHeightThreeLine
+ }
- hasSupportingContent || hasOverlineContent -> ListItemDefaults.MinContainerHeightTwoLine
+ hasSupportingContent || hasOverlineContent -> {
+ if (dense) ListItemDefaults.MinDenseContainerHeightTwoLine
+ else ListItemDefaults.MinContainerHeightTwoLine
+ }
- hasLeadingContent -> ListItemDefaults.MinContainerHeightLeadingContent
+ hasLeadingContent -> {
+ if (dense) ListItemDefaults.MinDenseContainerHeightLeadingContent
+ else ListItemDefaults.MinContainerHeightLeadingContent
+ }
- else -> ListItemDefaults.MinContainerHeight
+ else -> {
+ if (dense) ListItemDefaults.MinDenseContainerHeight
+ else ListItemDefaults.MinContainerHeight
+ }
}
}
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/ListItemDefaults.kt b/tv/tv-material/src/main/java/androidx/tv/material3/ListItemDefaults.kt
index e05e944..922a83a 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/ListItemDefaults.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/ListItemDefaults.kt
@@ -39,6 +39,11 @@
val IconSize = 32.dp
/**
+ * The Icon size used by [DenseListItem].
+ */
+ val IconSizeDense = 20.dp
+
+ /**
* The default elevation used by [ListItem].
*/
val ListItemElevation = Elevation.Level0
@@ -51,6 +56,13 @@
vertical = 12.dp
)
+ /**
+ * The default content padding [PaddingValues] used by [DenseListItem]
+ */
+ internal val ContentPaddingDense = PaddingValues(
+ horizontal = 12.dp,
+ vertical = 10.dp
+ )
internal const val LeadingContentOpacity = 0.8f
internal const val OverlineContentOpacity = 0.6f
internal const val SupportingContentOpacity = 0.8f
@@ -63,6 +75,11 @@
internal val MinContainerHeightTwoLine = 64.dp
internal val MinContainerHeightThreeLine = 80.dp
+ internal val MinDenseContainerHeight = 40.dp
+ internal val MinDenseContainerHeightLeadingContent = 40.dp
+ internal val MinDenseContainerHeightTwoLine = 56.dp
+ internal val MinDenseContainerHeightThreeLine = 72.dp
+
private val ListItemShape = RoundedCornerShape(8.dp)
private val DefaultBorder
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt b/tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt
index 0538858..e5897fb 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt
@@ -57,6 +57,7 @@
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.tv.material3.tokens.Elevation
+import androidx.tv.material3.tokens.ShapeTokens
import kotlinx.coroutines.launch
/**
@@ -386,7 +387,12 @@
if (border != Border.None) {
Modifier.indication(
interactionSource = interactionSource,
- indication = remember(border) { BorderIndication(border = border) }
+ indication = remember(border, shape) {
+ val borderShape =
+ if (border.shape == ShapeTokens.BorderDefaultShape) shape
+ else border.shape
+ BorderIndication(border = border.copy(shape = borderShape))
+ }
)
} else Modifier
)
@@ -477,12 +483,12 @@
onLongClick: (() -> Unit)?,
interactionSource: MutableInteractionSource,
) = handleDPadEnter(
- enabled = enabled,
- interactionSource = interactionSource,
- checked = checked,
- onCheckedChanged = onCheckedChange,
- onLongClick = onLongClick
- )
+ enabled = enabled,
+ interactionSource = interactionSource,
+ checked = checked,
+ onCheckedChanged = onCheckedChange,
+ onLongClick = onLongClick
+)
// We are not using "toggleable" modifier here because if we set "enabled" to false
// then the Surface won't be focusable as well. But, in TV use case, a disabled surface
// should be focusable
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/SurfaceStyles.kt b/tv/tv-material/src/main/java/androidx/tv/material3/SurfaceStyles.kt
index e915cd0..9b4a343 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/SurfaceStyles.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/SurfaceStyles.kt
@@ -634,4 +634,4 @@
return "NonInteractiveSurfaceColors(containerColor=$containerColor, " +
"contentColor=$contentColor)"
}
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt b/tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt
index 52c353d..c791d57 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt
@@ -56,9 +56,9 @@
* and customize the appearance / behavior of this tab in different states.
* @param content content of the [Tab]
*/
-@ExperimentalTvMaterial3Api // TODO (b/263353219): Remove this before launching beta
+@ExperimentalTvMaterial3Api
@Composable
-fun Tab(
+fun TabRowScope.Tab(
selected: Boolean,
onFocus: () -> Unit,
modifier: Modifier = Modifier,
@@ -68,7 +68,6 @@
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable RowScope.() -> Unit
) {
- val isTabRowActive = LocalTabRowHasFocus.current
Surface(
checked = selected,
onCheckedChange = { onClick() },
@@ -83,7 +82,7 @@
this.role = Role.Tab
},
colors = colors.toToggleableSurfaceColors(
- isTabRowActive = isTabRowActive,
+ isActivated = isActivated,
enabled = enabled,
),
enabled = enabled,
@@ -110,39 +109,39 @@
@ExperimentalTvMaterial3Api // TODO (b/263353219): Remove this before launching beta
class TabColors
internal constructor(
- internal val activeContentColor: Color,
- internal val contentColor: Color = activeContentColor.copy(alpha = 0.4f),
+ internal val contentColor: Color,
+ internal val inactiveContentColor: Color = contentColor.copy(alpha = 0.4f),
internal val selectedContentColor: Color,
internal val focusedContentColor: Color,
internal val focusedSelectedContentColor: Color,
- internal val disabledActiveContentColor: Color,
- internal val disabledContentColor: Color = disabledActiveContentColor.copy(alpha = 0.4f),
+ internal val disabledContentColor: Color,
+ internal val disabledInactiveContentColor: Color = disabledContentColor.copy(alpha = 0.4f),
internal val disabledSelectedContentColor: Color,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || other !is TabColors) return false
- if (activeContentColor != other.activeContentColor) return false
if (contentColor != other.contentColor) return false
+ if (inactiveContentColor != other.inactiveContentColor) return false
if (selectedContentColor != other.selectedContentColor) return false
if (focusedContentColor != other.focusedContentColor) return false
if (focusedSelectedContentColor != other.focusedSelectedContentColor) return false
- if (disabledActiveContentColor != other.disabledActiveContentColor) return false
if (disabledContentColor != other.disabledContentColor) return false
+ if (disabledInactiveContentColor != other.disabledInactiveContentColor) return false
if (disabledSelectedContentColor != other.disabledSelectedContentColor) return false
return true
}
override fun hashCode(): Int {
- var result = activeContentColor.hashCode()
- result = 31 * result + contentColor.hashCode()
+ var result = contentColor.hashCode()
+ result = 31 * result + inactiveContentColor.hashCode()
result = 31 * result + selectedContentColor.hashCode()
result = 31 * result + focusedContentColor.hashCode()
result = 31 * result + focusedSelectedContentColor.hashCode()
- result = 31 * result + disabledActiveContentColor.hashCode()
result = 31 * result + disabledContentColor.hashCode()
+ result = 31 * result + disabledInactiveContentColor.hashCode()
result = 31 * result + disabledSelectedContentColor.hashCode()
return result
}
@@ -153,74 +152,74 @@
/**
* [Tab]'s content colors to in conjunction with underlined indicator
*
- * @param activeContentColor applied when the any of the other tabs is focused
- * @param contentColor the default color of the tab's content when none of the tabs are focused
+ * @param contentColor applied when the any of the other tabs is focused
+ * @param inactiveContentColor the default color of the tab's content when none of the tabs are focused
* @param selectedContentColor applied when the current tab is selected
* @param focusedContentColor applied when the current tab is focused
* @param focusedSelectedContentColor applied when the current tab is both focused and selected
- * @param disabledActiveContentColor applied when any of the other tabs is focused and the
+ * @param disabledContentColor applied when any of the other tabs is focused and the
* current tab is disabled
- * @param disabledContentColor applied when the current tab is disabled and none of the tabs are
+ * @param disabledInactiveContentColor applied when the current tab is disabled and none of the tabs are
* focused
* @param disabledSelectedContentColor applied when the current tab is disabled and selected
*/
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
fun underlinedIndicatorTabColors(
- activeContentColor: Color = LocalContentColor.current,
- contentColor: Color = activeContentColor.copy(alpha = 0.4f),
+ contentColor: Color = LocalContentColor.current,
+ inactiveContentColor: Color = contentColor.copy(alpha = 0.4f),
selectedContentColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
focusedContentColor: Color = MaterialTheme.colorScheme.primary,
focusedSelectedContentColor: Color = focusedContentColor,
- disabledActiveContentColor: Color = activeContentColor,
- disabledContentColor: Color = disabledActiveContentColor.copy(alpha = 0.4f),
+ disabledContentColor: Color = contentColor,
+ disabledInactiveContentColor: Color = disabledContentColor.copy(alpha = 0.4f),
disabledSelectedContentColor: Color = selectedContentColor,
): TabColors =
TabColors(
- activeContentColor = activeContentColor,
contentColor = contentColor,
+ inactiveContentColor = inactiveContentColor,
selectedContentColor = selectedContentColor,
focusedContentColor = focusedContentColor,
focusedSelectedContentColor = focusedSelectedContentColor,
- disabledActiveContentColor = disabledActiveContentColor,
disabledContentColor = disabledContentColor,
+ disabledInactiveContentColor = disabledInactiveContentColor,
disabledSelectedContentColor = disabledSelectedContentColor,
)
/**
* [Tab]'s content colors to in conjunction with pill indicator
*
- * @param activeContentColor applied when the any of the other tabs is focused
- * @param contentColor the default color of the tab's content when none of the tabs are focused
+ * @param contentColor applied when the any of the other tabs is focused
+ * @param inactiveContentColor the default color of the tab's content when none of the tabs are focused
* @param selectedContentColor applied when the current tab is selected
* @param focusedContentColor applied when the current tab is focused
* @param focusedSelectedContentColor applied when the current tab is both focused and selected
- * @param disabledActiveContentColor applied when any of the other tabs is focused and the
+ * @param disabledContentColor applied when any of the other tabs is focused and the
* current tab is disabled
- * @param disabledContentColor applied when the current tab is disabled and none of the tabs are
+ * @param disabledInactiveContentColor applied when the current tab is disabled and none of the tabs are
* focused
* @param disabledSelectedContentColor applied when the current tab is disabled and selected
*/
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
fun pillIndicatorTabColors(
- activeContentColor: Color = LocalContentColor.current,
- contentColor: Color = activeContentColor.copy(alpha = 0.4f),
+ contentColor: Color = LocalContentColor.current,
+ inactiveContentColor: Color = contentColor.copy(alpha = 0.4f),
selectedContentColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
focusedContentColor: Color = MaterialTheme.colorScheme.surfaceVariant,
focusedSelectedContentColor: Color = focusedContentColor,
- disabledActiveContentColor: Color = activeContentColor,
- disabledContentColor: Color = disabledActiveContentColor.copy(alpha = 0.4f),
+ disabledContentColor: Color = contentColor,
+ disabledInactiveContentColor: Color = disabledContentColor.copy(alpha = 0.4f),
disabledSelectedContentColor: Color = selectedContentColor,
): TabColors =
TabColors(
- activeContentColor = activeContentColor,
contentColor = contentColor,
+ inactiveContentColor = inactiveContentColor,
selectedContentColor = selectedContentColor,
focusedContentColor = focusedContentColor,
focusedSelectedContentColor = focusedSelectedContentColor,
- disabledActiveContentColor = disabledActiveContentColor,
disabledContentColor = disabledContentColor,
+ disabledInactiveContentColor = disabledInactiveContentColor,
disabledSelectedContentColor = disabledSelectedContentColor,
)
}
@@ -228,16 +227,16 @@
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
internal fun TabColors.toToggleableSurfaceColors(
- isTabRowActive: Boolean,
+ isActivated: Boolean,
enabled: Boolean,
) =
ToggleableSurfaceDefaults.colors(
- contentColor = if (isTabRowActive) activeContentColor else contentColor,
+ contentColor = if (isActivated) contentColor else inactiveContentColor,
selectedContentColor = if (enabled) selectedContentColor else disabledSelectedContentColor,
focusedContentColor = focusedContentColor,
focusedSelectedContentColor = focusedSelectedContentColor,
disabledContentColor =
- if (isTabRowActive) disabledActiveContentColor else disabledContentColor,
+ if (isActivated) disabledContentColor else disabledInactiveContentColor,
containerColor = Color.Transparent,
focusedContainerColor = Color.Transparent,
pressedContainerColor = Color.Transparent,
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/TabRow.kt b/tv/tv-material/src/main/java/androidx/tv/material3/TabRow.kt
index 902a974..7fb80c5 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/TabRow.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/TabRow.kt
@@ -32,7 +32,6 @@
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
-import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -86,32 +85,37 @@
containerColor: Color = TabRowDefaults.ContainerColor,
contentColor: Color = TabRowDefaults.contentColor(),
separator: @Composable () -> Unit = { TabRowDefaults.TabSeparator() },
- indicator: @Composable (tabPositions: List<DpRect>) -> Unit =
- @Composable { tabPositions ->
- tabPositions.getOrNull(selectedTabIndex)?.let {
- TabRowDefaults.PillIndicator(currentTabPosition = it)
+ indicator: @Composable (tabPositions: List<DpRect>, isActivated: Boolean) -> Unit =
+ @Composable { tabPositions, isActivated ->
+ tabPositions.getOrNull(selectedTabIndex)?.let { currentTabPosition ->
+ TabRowDefaults.PillIndicator(
+ currentTabPosition = currentTabPosition,
+ isActivated = isActivated
+ )
}
},
- tabs: @Composable () -> Unit
+ tabs: @Composable TabRowScope.() -> Unit
) {
val scrollState = rememberScrollState()
- var isAnyTabFocused by remember { mutableStateOf(false) }
+ var isActivated by remember { mutableStateOf(false) }
- CompositionLocalProvider(
- LocalTabRowHasFocus provides isAnyTabFocused,
- LocalContentColor provides contentColor
- ) {
+ CompositionLocalProvider(LocalContentColor provides contentColor) {
+
SubcomposeLayout(
modifier =
modifier
.background(containerColor)
.clipToBounds()
.horizontalScroll(scrollState)
- .onFocusChanged { isAnyTabFocused = it.hasFocus }
+ .onFocusChanged { isActivated = it.hasFocus }
.selectableGroup()
) { constraints ->
// Tab measurables
- val tabMeasurables = subcompose(TabRowSlots.Tabs, tabs)
+ val tabMeasurables = subcompose(TabRowSlots.Tabs) {
+ TabRowScopeImpl(isActivated).apply {
+ tabs()
+ }
+ }
// Tab placeables
val tabPlaceables =
@@ -165,7 +169,9 @@
}
// Place the indicator
- subcompose(TabRowSlots.Indicator) { indicator(tabPositions) }
+ subcompose(TabRowSlots.Indicator) {
+ indicator(tabPositions, isActivated)
+ }
.forEach {
it.measure(Constraints.fixed(layoutWidth, layoutHeight)).placeRelative(0, 0)
}
@@ -193,6 +199,7 @@
* Adds a pill indicator behind the tab
*
* @param currentTabPosition position of the current selected tab
+ * @param isActivated whether any tab in TabRow is focused
* @param modifier modifier to be applied to the indicator
* @param activeColor color of indicator when [TabRow] is active
* @param inactiveColor color of indicator when [TabRow] is inactive
@@ -200,11 +207,11 @@
@Composable
fun PillIndicator(
currentTabPosition: DpRect,
+ isActivated: Boolean,
modifier: Modifier = Modifier,
activeColor: Color = MaterialTheme.colorScheme.onSurface,
inactiveColor: Color = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.4f)
) {
- val anyTabFocused = LocalTabRowHasFocus.current
val width by animateDpAsState(
targetValue = currentTabPosition.width,
label = "PillIndicator.width",
@@ -218,7 +225,7 @@
val pillColor by
animateColorAsState(
- targetValue = if (anyTabFocused) activeColor else inactiveColor,
+ targetValue = if (isActivated) activeColor else inactiveColor,
label = "PillIndicator.pillColor"
)
@@ -238,6 +245,7 @@
* Adds an underlined indicator below the tab
*
* @param currentTabPosition position of the current selected tab
+ * @param isActivated whether any tab in TabRow is focused
* @param modifier modifier to be applied to the indicator
* @param activeColor color of indicator when [TabRow] is active
* @param inactiveColor color of indicator when [TabRow] is inactive
@@ -245,22 +253,26 @@
@Composable
fun UnderlinedIndicator(
currentTabPosition: DpRect,
+ isActivated: Boolean,
modifier: Modifier = Modifier,
activeColor: Color = MaterialTheme.colorScheme.primary,
inactiveColor: Color = MaterialTheme.colorScheme.secondary,
) {
- val anyTabFocused = LocalTabRowHasFocus.current
val unfocusedUnderlineWidth = 10.dp
val indicatorHeight = 2.dp
val width by
animateDpAsState(
- targetValue = if (anyTabFocused) currentTabPosition.width else unfocusedUnderlineWidth,
+ targetValue =
+ if (isActivated)
+ currentTabPosition.width
+ else
+ unfocusedUnderlineWidth,
label = "UnderlinedIndicator.width",
)
val leftOffset by
animateDpAsState(
targetValue =
- if (anyTabFocused) {
+ if (isActivated) {
currentTabPosition.left
} else {
val tabCenter = currentTabPosition.left + currentTabPosition.width / 2
@@ -271,7 +283,7 @@
val underlineColor by
animateColorAsState(
- targetValue = if (anyTabFocused) activeColor else inactiveColor,
+ targetValue = if (isActivated) activeColor else inactiveColor,
label = "UnderlinedIndicator.underlineColor",
)
@@ -287,9 +299,6 @@
}
}
-/** A provider to store whether any [Tab] is focused inside the [TabRow] */
-internal val LocalTabRowHasFocus = compositionLocalOf { false }
-
/** Slots for [TabRow]'s content */
private enum class TabRowSlots {
Tabs,
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/TabRowScope.kt b/tv/tv-material/src/main/java/androidx/tv/material3/TabRowScope.kt
new file mode 100644
index 0000000..9db88b3
--- /dev/null
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/TabRowScope.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.tv.material3
+
+/**
+ * [TabRowScope] is used to provide the isActivated state to the [Tab] composable
+ */
+@ExperimentalTvMaterial3Api // TODO (b/263353219): Remove this before launching beta
+interface TabRowScope {
+ /**
+ * Whether any tab within the [TabRow] is focused
+ */
+ val isActivated: Boolean
+}
+
+@OptIn(ExperimentalTvMaterial3Api::class)
+internal class TabRowScopeImpl internal constructor(
+ override val isActivated: Boolean
+) : TabRowScope
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/RadioButtonTokens.kt b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/RadioButtonTokens.kt
index fab1c59..462dc33 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/RadioButtonTokens.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/RadioButtonTokens.kt
@@ -35,4 +35,4 @@
val UnselectedHoverIconColor = ColorSchemeKeyTokens.OnSurface
val UnselectedIconColor = ColorSchemeKeyTokens.OnSurfaceVariant
val UnselectedPressedIconColor = ColorSchemeKeyTokens.OnSurface
-}
\ No newline at end of file
+}
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/ShapeTokens.kt b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/ShapeTokens.kt
index c027d0b..5434a55a 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/ShapeTokens.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/ShapeTokens.kt
@@ -18,11 +18,17 @@
package androidx.tv.material3.tokens
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.GenericShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.unit.dp
internal object ShapeTokens {
+ /**
+ * BorderDefaultShape indicates that the default shape of the element will be used for the
+ * border
+ */
+ val BorderDefaultShape = GenericShape { _, _ -> close() }
val CornerExtraLarge = RoundedCornerShape(28.0.dp)
val CornerExtraLargeTop =
RoundedCornerShape(
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/SwitchTokens.kt b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/SwitchTokens.kt
index bb29efd..f3875bb 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/tokens/SwitchTokens.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/tokens/SwitchTokens.kt
@@ -78,4 +78,4 @@
val UnselectedTrackOutlineColor = ColorSchemeKeyTokens.Border
val IconHandleHeight = 18.0.dp
val IconHandleWidth = 18.0.dp
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/PreviewPagesTest.kt b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/PreviewPagesTest.kt
index 8d6e988..b76de97 100644
--- a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/PreviewPagesTest.kt
+++ b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/PreviewPagesTest.kt
@@ -78,4 +78,4 @@
)
)
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/AnimationVerifier.kt b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/AnimationVerifier.kt
index 6884e9e..04267f3 100644
--- a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/AnimationVerifier.kt
+++ b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/AnimationVerifier.kt
@@ -111,4 +111,4 @@
private fun isOne(f: Float): Boolean {
return isZero(f - 1)
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/ViewPagerIdleWatcher.kt b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/ViewPagerIdleWatcher.kt
index 84c70cb..37a7cc8c 100644
--- a/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/ViewPagerIdleWatcher.kt
+++ b/viewpager2/integration-tests/testapp/src/androidTest/java/androidx/viewpager2/integration/testapp/test/util/ViewPagerIdleWatcher.kt
@@ -76,4 +76,4 @@
viewPager.unregisterOnPageChangeCallback(this)
IdlingRegistry.getInstance().unregister(counter)
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/FakeDragActivity.kt b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/FakeDragActivity.kt
index b86e323..3024898 100644
--- a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/FakeDragActivity.kt
+++ b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/FakeDragActivity.kt
@@ -85,4 +85,4 @@
}
return true
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt
index 819ffb4..0032567 100644
--- a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt
+++ b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/NestedScrollableHost.kt
@@ -109,4 +109,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/OrientationController.kt b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/OrientationController.kt
index 89d9a1e..cc724a5 100644
--- a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/OrientationController.kt
+++ b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/OrientationController.kt
@@ -75,4 +75,4 @@
private const val HORIZONTAL = "horizontal"
private const val VERTICAL = "vertical"
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/UserInputController.kt b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/UserInputController.kt
index eacc30f..d17509d 100644
--- a/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/UserInputController.kt
+++ b/viewpager2/integration-tests/testapp/src/main/java/androidx/viewpager2/integration/testapp/UserInputController.kt
@@ -26,4 +26,4 @@
viewPager.isUserInputEnabled = !isDisabled
}
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/TouchConsumingTextView.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/TouchConsumingTextView.kt
index 3372525..86b9f34 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/TouchConsumingTextView.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/test/ui/TouchConsumingTextView.kt
@@ -32,4 +32,4 @@
override fun onTouchEvent(event: MotionEvent?): Boolean {
return consumeTouches || super.onTouchEvent(event)
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/CanScrollTest.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/CanScrollTest.kt
index f4df49a..2dfbb83 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/CanScrollTest.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/CanScrollTest.kt
@@ -182,4 +182,4 @@
assertThat(viewPager.canScrollVertically(1), equalTo(expectScrollDown))
assertThat(viewPager.canScrollVertically(-1), equalTo(expectScrollUp))
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/PageSwiperFakeDrag.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/PageSwiperFakeDrag.kt
index 9196a17..6c3ccb8 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/PageSwiperFakeDrag.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/PageSwiperFakeDrag.kt
@@ -153,4 +153,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/SelfChecking.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/SelfChecking.kt
index 59b4da7..60a013d 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/SelfChecking.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/SelfChecking.kt
@@ -19,4 +19,4 @@
/** Interface for test elements that have internal validation logic */
interface SelfChecking {
fun selfCheck()
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TranslatedCoordinatesProvider.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TranslatedCoordinatesProvider.kt
index 4a83239..472b8a1 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TranslatedCoordinatesProvider.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/TranslatedCoordinatesProvider.kt
@@ -30,4 +30,4 @@
coords[1] += dy
return coords
}
-}
\ No newline at end of file
+}
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/WaitForInjectMotionEventsAction.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/WaitForInjectMotionEventsAction.kt
index e3f0ed6..0551452 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/WaitForInjectMotionEventsAction.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/swipe/WaitForInjectMotionEventsAction.kt
@@ -80,4 +80,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/StartActivity.kt b/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/StartActivity.kt
index d6e4c18..76e2113 100644
--- a/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/StartActivity.kt
+++ b/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/StartActivity.kt
@@ -28,4 +28,4 @@
val txt = findViewById<TextView>(R.id.text)
txt.setText("Wear Macrobenchmark Target")
}
-}
\ No newline at end of file
+}
diff --git a/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/SwipeActivity.kt b/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/SwipeActivity.kt
index 5aa5b3d..d7cdecf 100644
--- a/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/SwipeActivity.kt
+++ b/wear/benchmark/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/target/SwipeActivity.kt
@@ -24,4 +24,4 @@
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_swipe)
}
-}
\ No newline at end of file
+}
diff --git a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/ScrollBenchmark.kt b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/ScrollBenchmark.kt
index b63c5ee..d9160d2 100644
--- a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/ScrollBenchmark.kt
+++ b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/ScrollBenchmark.kt
@@ -81,4 +81,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/StartupBenchmark.kt b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/StartupBenchmark.kt
index 87063f6..bfe4a69 100644
--- a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/StartupBenchmark.kt
+++ b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/StartupBenchmark.kt
@@ -50,4 +50,4 @@
@JvmStatic
fun parameters() = createStartupCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/SwipeBenchmark.kt b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/SwipeBenchmark.kt
index 542700e..df1706c 100644
--- a/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/SwipeBenchmark.kt
+++ b/wear/benchmark/integration-tests/macrobenchmark/src/main/java/androidx/wear/benchmark/integration/macrobenchmark/SwipeBenchmark.kt
@@ -80,4 +80,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/api/current.txt b/wear/compose/compose-foundation/api/current.txt
index 2283ff7..2730513d 100644
--- a/wear/compose/compose-foundation/api/current.txt
+++ b/wear/compose/compose-foundation/api/current.txt
@@ -194,6 +194,7 @@
method public static void expandableItem(androidx.wear.compose.foundation.lazy.ScalingLazyListScope, androidx.wear.compose.foundation.ExpandableState state, optional Object? key, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> content);
method public static void expandableItems(androidx.wear.compose.foundation.lazy.ScalingLazyListScope, androidx.wear.compose.foundation.ExpandableState state, int count, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?>? key, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super java.lang.Integer,kotlin.Unit> itemContent);
method @androidx.compose.runtime.Composable public static androidx.wear.compose.foundation.ExpandableState rememberExpandableState(optional boolean initiallyExpanded, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> expandAnimationSpec, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> collapseAnimationSpec);
+ method @androidx.compose.runtime.Composable public static <T> androidx.wear.compose.foundation.ExpandableStateMapping<T> rememberExpandableStateMapping(optional kotlin.jvm.functions.Function1<? super T,java.lang.Boolean> initiallyExpanded, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> expandAnimationSpec, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> collapseAnimationSpec);
}
public final class ExpandableState {
@@ -204,6 +205,10 @@
property public final boolean expanded;
}
+ public final class ExpandableStateMapping<T> {
+ method public androidx.wear.compose.foundation.ExpandableState getOrPutNew(T key);
+ }
+
@SuppressCompatibility @kotlin.RequiresOptIn(message="This Wear Foundation API is experimental and is likely to change or to be removed in" + " the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalWearFoundationApi {
}
diff --git a/wear/compose/compose-foundation/api/restricted_current.txt b/wear/compose/compose-foundation/api/restricted_current.txt
index 2283ff7..2730513d 100644
--- a/wear/compose/compose-foundation/api/restricted_current.txt
+++ b/wear/compose/compose-foundation/api/restricted_current.txt
@@ -194,6 +194,7 @@
method public static void expandableItem(androidx.wear.compose.foundation.lazy.ScalingLazyListScope, androidx.wear.compose.foundation.ExpandableState state, optional Object? key, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> content);
method public static void expandableItems(androidx.wear.compose.foundation.lazy.ScalingLazyListScope, androidx.wear.compose.foundation.ExpandableState state, int count, optional kotlin.jvm.functions.Function1<? super java.lang.Integer,?>? key, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super java.lang.Integer,kotlin.Unit> itemContent);
method @androidx.compose.runtime.Composable public static androidx.wear.compose.foundation.ExpandableState rememberExpandableState(optional boolean initiallyExpanded, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> expandAnimationSpec, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> collapseAnimationSpec);
+ method @androidx.compose.runtime.Composable public static <T> androidx.wear.compose.foundation.ExpandableStateMapping<T> rememberExpandableStateMapping(optional kotlin.jvm.functions.Function1<? super T,java.lang.Boolean> initiallyExpanded, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> expandAnimationSpec, optional androidx.compose.animation.core.AnimationSpec<java.lang.Float> collapseAnimationSpec);
}
public final class ExpandableState {
@@ -204,6 +205,10 @@
property public final boolean expanded;
}
+ public final class ExpandableStateMapping<T> {
+ method public androidx.wear.compose.foundation.ExpandableState getOrPutNew(T key);
+ }
+
@SuppressCompatibility @kotlin.RequiresOptIn(message="This Wear Foundation API is experimental and is likely to change or to be removed in" + " the future.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface ExperimentalWearFoundationApi {
}
diff --git a/wear/compose/compose-foundation/benchmark/src/androidTest/java/androidx/wear/compose/foundation/benchmark/ScalingLazyColumnBenchmark.kt b/wear/compose/compose-foundation/benchmark/src/androidTest/java/androidx/wear/compose/foundation/benchmark/ScalingLazyColumnBenchmark.kt
index c7fc419..a9ec433 100644
--- a/wear/compose/compose-foundation/benchmark/src/androidTest/java/androidx/wear/compose/foundation/benchmark/ScalingLazyColumnBenchmark.kt
+++ b/wear/compose/compose-foundation/benchmark/src/androidTest/java/androidx/wear/compose/foundation/benchmark/ScalingLazyColumnBenchmark.kt
@@ -230,4 +230,4 @@
Assert.assertTrue(!isComposed)
isComposed = true
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/CurvedWorldSample.kt b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/CurvedWorldSample.kt
index 7123f98..ef16532 100644
--- a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/CurvedWorldSample.kt
+++ b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/CurvedWorldSample.kt
@@ -381,4 +381,4 @@
Box(Modifier.size(80.dp, 30.dp).background(Color.White))
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/ExpandableSample.kt b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/ExpandableSample.kt
index 034b977..2551474 100644
--- a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/ExpandableSample.kt
+++ b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/ExpandableSample.kt
@@ -114,4 +114,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/SwipeToRevealSample.kt b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/SwipeToRevealSample.kt
index 1212135..3668886 100644
--- a/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/SwipeToRevealSample.kt
+++ b/wear/compose/compose-foundation/samples/src/main/java/androidx/wear/compose/foundation/samples/SwipeToRevealSample.kt
@@ -221,4 +221,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedBoxTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedBoxTest.kt
index 49af1da..55ac19f 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedBoxTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedBoxTest.kt
@@ -21,6 +21,7 @@
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
+import androidx.compose.testutils.assertDoesNotContainColor
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.LayoutCoordinates
@@ -247,4 +248,4 @@
checker(bigBoxDimensions, smallBoxDimensions)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedScreenshotTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedScreenshotTest.kt
index 170be37..1c56a44 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedScreenshotTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedScreenshotTest.kt
@@ -270,4 +270,4 @@
}
}
-internal const val SCREENSHOT_GOLDEN_PATH = "wear/compose/foundation"
\ No newline at end of file
+internal const val SCREENSHOT_GOLDEN_PATH = "wear/compose/foundation"
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedWeightTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedWeightTest.kt
index 672e59f..a7a1ac2 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedWeightTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/CurvedWeightTest.kt
@@ -123,4 +123,4 @@
capturedInfo.checkParentDimensions(expectedAngleDegrees = 10f)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/ExpandableTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/ExpandableTest.kt
new file mode 100644
index 0000000..b79b17d
--- /dev/null
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/ExpandableTest.kt
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.foundation
+
+import android.os.Build
+import androidx.annotation.RequiresApi
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.size
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.ImageBitmap
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.junit4.ComposeTestRule
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performClick
+import androidx.compose.ui.unit.dp
+import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
+import androidx.wear.compose.foundation.lazy.ScalingLazyColumnDefaults
+import androidx.wear.compose.foundation.lazy.ScalingLazyListState
+import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
+import org.junit.Assert.assertEquals
+import org.junit.Rule
+import org.junit.Test
+
+class ExpandableTest {
+ @get:Rule
+ val rule = createComposeRule()
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun initially_collapsed() =
+ verifyExpandable(
+ setupState = { rememberExpandableState(initiallyExpanded = false) },
+ bitmapAssert = {
+ assertDoesContainColor(COLLAPSED_COLOR)
+ }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun initially_expanded() =
+ verifyExpandable(
+ setupState = { rememberExpandableState(initiallyExpanded = true) },
+ bitmapAssert = {
+ assertDoesContainColor(EXPANDED_COLOR)
+ }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun expand() =
+ verifyExpandable(
+ setupState = { rememberExpandableState(initiallyExpanded = false) },
+ bitmapAssert = {
+ assertDoesContainColor(EXPANDED_COLOR)
+ }
+ ) { state ->
+ state.expanded = true
+ waitForIdle()
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun collapse() =
+ verifyExpandable(
+ setupState = { rememberExpandableState(initiallyExpanded = true) },
+ bitmapAssert = {
+ assertDoesContainColor(COLLAPSED_COLOR)
+ }
+ ) { state ->
+ state.expanded = false
+ waitForIdle()
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun collapsed_click() = verifyClick(false)
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun expanded_click() = verifyClick(true)
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun verifyClick(initiallyExpanded: Boolean) {
+ val clicked = mutableListOf<Boolean>()
+ verifyExpandable(
+ setupState = { rememberExpandableState(initiallyExpanded = initiallyExpanded) },
+ bitmapAssert = {
+ assertEquals(listOf(initiallyExpanded), clicked)
+ },
+ expandableContent = { expanded ->
+ Box(modifier = Modifier.fillMaxSize().clickable {
+ clicked.add(expanded)
+ })
+ }
+ ) { _ ->
+ onNodeWithTag(TEST_TAG).performClick()
+ waitForIdle()
+ }
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun verifyExpandable(
+ setupState: @Composable () -> ExpandableState,
+ bitmapAssert: ImageBitmap.() -> Unit,
+ expandableContent: @Composable (Boolean) -> Unit = { },
+ act: ComposeTestRule.(ExpandableState) -> Unit = { }
+ ) {
+ // Arrange - set up the content for the test including expandable content
+ var slcState: ScalingLazyListState? = null
+ var state: ExpandableState? = null
+ rule.setContent {
+ state = setupState()
+ Box(
+ Modifier
+ .testTag(TEST_TAG)
+ .size(100.dp)) {
+ ScalingLazyColumn(
+ state = rememberScalingLazyListState().also { slcState = it },
+ // We can only test expandableItem inside a ScalingLazyColumn, but we can make
+ // it behave mostly as it wasn't there.
+ scalingParams = ScalingLazyColumnDefaults
+ .scalingParams(edgeScale = 1f, edgeAlpha = 1f),
+ autoCentering = null,
+ verticalArrangement = Arrangement.spacedBy(space = 0.dp),
+ ) {
+ expandableItem(state!!) { expanded ->
+ Box(
+ Modifier
+ .fillMaxWidth()
+ .height(100.dp)
+ .background(
+ if (expanded) EXPANDED_COLOR else COLLAPSED_COLOR
+ )
+ ) {
+ expandableContent(expanded)
+ }
+ }
+ }
+ }
+ }
+ rule.waitUntil { slcState?.initialized?.value ?: false }
+
+ // Act - exercise the expandable if required for the test.
+ with(rule) {
+ act(state!!)
+ }
+
+ // Assert - verify the object under test worked correctly
+ rule.onNodeWithTag(TEST_TAG)
+ .captureToImage()
+ .apply { bitmapAssert() }
+ }
+
+ private val EXPANDED_COLOR = Color.Red
+ private val COLLAPSED_COLOR = Color.Green
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/FoundationTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/FoundationTest.kt
index 0da21e5..f781f3a 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/FoundationTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/FoundationTest.kt
@@ -35,12 +35,25 @@
/**
* Checks whether [expectedColor] does not exist in current [ImageBitmap]
- */
+ *
fun ImageBitmap.assertDoesNotContainColor(expectedColor: Color) {
val histogram = histogram()
if (histogram.containsKey(expectedColor)) {
throw AssertionError("Expected color $expectedColor exists in current bitmap")
}
+}*/
+
+/**
+ * Checks whether [expectedColor] exist in current [ImageBitmap], covering at least the given ratio
+ * of the image
+ */
+fun ImageBitmap.assertDoesContainColor(expectedColor: Color, expectedRatio: Float = 0.75f) {
+ val histogram = histogram()
+ val ratio = (histogram.getOrDefault(expectedColor, 0L)).toFloat() / (width * height)
+ if (ratio < expectedRatio) {
+ throw AssertionError("Expected color $expectedColor with ratio $expectedRatio." +
+ " Actual ratio = $ratio")
+ }
}
private fun ImageBitmap.histogram(): MutableMap<Color, Long> {
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/HierarchicalFocusCoordinatorTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/HierarchicalFocusCoordinatorTest.kt
index fb3b6b5..53be515 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/HierarchicalFocusCoordinatorTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/HierarchicalFocusCoordinatorTest.kt
@@ -276,4 +276,4 @@
val focusedSet = actualFocused.indices.filter { actualFocused[it] }.toSet()
Assert.assertEquals(setOf(expectedSelected), focusedSet)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/SwipeToRevealTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/SwipeToRevealTest.kt
index 9f901e2..ff69146 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/SwipeToRevealTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/SwipeToRevealTest.kt
@@ -182,4 +182,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfoTest.kt b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfoTest.kt
index 693c194..a04f924 100644
--- a/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfoTest.kt
+++ b/wear/compose/compose-foundation/src/androidTest/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfoTest.kt
@@ -1244,4 +1244,4 @@
}
@Stable
-public class StableRef<T>(var value: T)
\ No newline at end of file
+public class StableRef<T>(var value: T)
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedAlignment.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedAlignment.kt
index a440de9..0ef9315 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedAlignment.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedAlignment.kt
@@ -84,4 +84,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedLayout.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedLayout.kt
index de25e17..cbeebfa 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedLayout.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/CurvedLayout.kt
@@ -415,4 +415,4 @@
internal fun Float.toDegrees() = this * 180f / PI.toFloat()
internal fun <T> Iterable<T>.sumOf(selector: (T) -> Float): Float = map(selector).sum()
internal fun offsetFromDistanceAndAngle(distance: Float, angle: Float) =
- Offset(distance * cos(angle), distance * sin(angle))
\ No newline at end of file
+ Offset(distance * cos(angle), distance * sin(angle))
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/Expandable.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/Expandable.kt
index 8e8f89a..20ebcae 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/Expandable.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/Expandable.kt
@@ -22,6 +22,7 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
@@ -59,6 +60,29 @@
}
/**
+ * Create and [remember] a mapping from keys to [ExpandableState]s
+ * [ExpandableState]s can be requested by key, and we will created with the parameters given here
+ * when a mapping didn't exist before.
+ * This is mainly useful when you want to have a variable number of expandables, that can change at
+ * runtime (for example, elements on a ScalingLazyColumn)
+ *
+ * @param initiallyExpanded A function to compute the initial state given the key.
+ * @param expandAnimationSpec The [AnimationSpec] to use when showing the extra information.
+ * @param collapseAnimationSpec The [AnimationSpec] to use when hiding the extra information.
+ */
+@Composable
+public fun <T> rememberExpandableStateMapping(
+ initiallyExpanded: (key: T) -> Boolean = { false },
+ expandAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.expandAnimationSpec,
+ collapseAnimationSpec: AnimationSpec<Float> = ExpandableItemsDefaults.collapseAnimationSpec,
+): ExpandableStateMapping<T> {
+ val scope = rememberCoroutineScope()
+ return remember {
+ ExpandableStateMapping(initiallyExpanded, scope, expandAnimationSpec, collapseAnimationSpec)
+ }
+}
+
+/**
* Adds a series of items, that will be expanded/collapsed according to the [ExpandableState]
*
* Example of an expandable list:
@@ -175,8 +199,14 @@
val off1 = (width - placeables[1].width) / 2
layout(width, height) {
- placeables[0].placeWithLayer(off0, 0) { alpha = 1 - progress }
- placeables[1].placeWithLayer(off1, 0) { alpha = progress }
+ if (progress < 1f) {
+ placeables[0].placeWithLayer(off0, 0, zIndex = 1 - progress) {
+ alpha = 1 - progress
+ }
+ }
+ if (progress > 0f) {
+ placeables[1].placeWithLayer(off1, 0, zIndex = progress) { alpha = progress }
+ }
}
}
}
@@ -192,7 +222,7 @@
initiallyExpanded: Boolean,
private val coroutineScope: CoroutineScope,
private val expandAnimationSpec: AnimationSpec<Float>,
- private val collapseAnimationSpec: AnimationSpec<Float>,
+ private val collapseAnimationSpec: AnimationSpec<Float>
) {
private val _expandProgress = Animatable(if (initiallyExpanded) 1f else 0f)
@@ -229,6 +259,31 @@
}
/**
+ * A class that maps from keys of the given type to [ExpandableState].
+ * An instance can be created and remembered with [rememberExpandableStateMapping]
+ */
+public class ExpandableStateMapping<T> internal constructor(
+ private val initiallyExpanded: (key: T) -> Boolean,
+ private val coroutineScope: CoroutineScope,
+ private val expandAnimationSpec: AnimationSpec<Float>,
+ private val collapseAnimationSpec: AnimationSpec<Float>
+) {
+
+ private val states = mutableStateMapOf<T, ExpandableState>()
+
+ /**
+ * Returns the [ExpandableState] for the given key if the value is present and not null.
+ * Otherwise, creates a new one, puts it into the map under the given key and returns it.
+ * The parameters used to create the new [ExpandableState] are the ones passed to
+ * [rememberExpandableStateMapping]
+ */
+ public fun getOrPutNew(key: T) = states.getOrPut(key) {
+ ExpandableState(initiallyExpanded(key), coroutineScope,
+ expandAnimationSpec, collapseAnimationSpec)
+ }
+}
+
+/**
* Contains the default values used by Expandable components.
*/
public object ExpandableItemsDefaults {
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/ExperimentalWearFoundationApi.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/ExperimentalWearFoundationApi.kt
index e8458d2..b97e542 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/ExperimentalWearFoundationApi.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/ExperimentalWearFoundationApi.kt
@@ -21,4 +21,4 @@
" the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalWearFoundationApi
\ No newline at end of file
+annotation class ExperimentalWearFoundationApi
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/InternalMutatorMutex.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/InternalMutatorMutex.kt
index 45b6f7f..e5717fc 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/InternalMutatorMutex.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/InternalMutatorMutex.kt
@@ -161,4 +161,4 @@
}
return didLock
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeToReveal.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeToReveal.kt
index a386e82..da7d674 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeToReveal.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeToReveal.kt
@@ -294,7 +294,7 @@
) { value, layoutSize ->
val swipeableWidth = layoutSize.width.toFloat()
// Update the total width which will be used to calculate the anchors
- revealScope.width.value = swipeableWidth
+ revealScope.width.floatValue = swipeableWidth
// Multiply the anchor with -1f to get the actual swipeable anchor
-state.swipeAnchors[value]!! * swipeableWidth
}
@@ -400,7 +400,7 @@
val width = mutableFloatStateOf(0.0f)
override val revealOffset: Float
- get() = width.value * (revealState.swipeAnchors[RevealValue.Revealing] ?: 0.0f)
+ get() = width.floatValue * (revealState.swipeAnchors[RevealValue.Revealing] ?: 0.0f)
}
/**
@@ -434,4 +434,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeableV2.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeableV2.kt
index f6e888d..15a2dde 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeableV2.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/SwipeableV2.kt
@@ -736,4 +736,4 @@
}
private fun <T> Map<T, Float>.minOrNull() = minOfOrNull { (_, offset) -> offset }
-private fun <T> Map<T, Float>.maxOrNull() = maxOfOrNull { (_, offset) -> offset }
\ No newline at end of file
+private fun <T> Map<T, Float>.maxOrNull() = maxOfOrNull { (_, offset) -> offset }
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnMeasure.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnMeasure.kt
index 00d1260..9f65cce 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnMeasure.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnMeasure.kt
@@ -564,4 +564,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun inverseLerp(start: Float, stop: Float, value: Float): Float {
return ((value - start) / (stop - start)).coerceIn(0f, 1f)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnSnapFlingBehavior.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnSnapFlingBehavior.kt
index 31de3b4..8b20123 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnSnapFlingBehavior.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyColumnSnapFlingBehavior.kt
@@ -141,4 +141,4 @@
// Maximum duration for the final snap after the fling, in seconds, used when the speed is
// SNAP_SPEED_THRESHOLD
private val FINAL_SNAP_DURATION_MAX = .35f
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfo.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfo.kt
index dc2ccd6..ade5095 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfo.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/ScalingLazyListLayoutInfo.kt
@@ -102,4 +102,4 @@
* How to anchor list items to the center-line of the viewport
*/
val anchorType: ScalingLazyListAnchorType
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/IconTest.kt b/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/IconTest.kt
index 1c76ba7..7f9826e 100644
--- a/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/IconTest.kt
+++ b/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/IconTest.kt
@@ -320,4 +320,4 @@
tint = tint,
modifier = modifier
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/RepeatableClickable.kt b/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/RepeatableClickable.kt
new file mode 100644
index 0000000..545a576
--- /dev/null
+++ b/wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/RepeatableClickable.kt
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.materialcore
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.junit4.ComposeContentTestRule
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performTouchInput
+import org.junit.Assert.assertEquals
+import org.junit.Rule
+import org.junit.Test
+
+public class RepeatableClickable {
+ @get:Rule
+ public val rule = createComposeRule()
+
+ @Test
+ fun touch_hold_shorter_than_threshold() {
+ var clickCounter = 0
+
+ boxWithRepeatableClickable(rule, 300) {
+ clickCounter++
+ }
+
+ assertEquals(0, clickCounter)
+ }
+
+ @Test
+ fun touch_hold_equals_to_threshold() {
+ var clickCounter = 0
+
+ boxWithRepeatableClickable(rule, 500) {
+ clickCounter++
+ }
+
+ assertEquals(1, clickCounter)
+ }
+
+ @Test
+ fun touch_hold_longer_than_threshold() {
+ var clickCounter = 0
+
+ boxWithRepeatableClickable(rule, 620) {
+ clickCounter++
+ }
+
+ assertEquals(3, clickCounter)
+ }
+
+ @Test
+ fun touch_hold_disabled() {
+ var clickCounter = 0
+
+ boxWithRepeatableClickable(rule, 500, false) {
+ clickCounter++
+ }
+
+ assertEquals(0, clickCounter)
+ }
+
+ private fun boxWithRepeatableClickable(
+ rule: ComposeContentTestRule,
+ holdDelay: Long,
+ enabled: Boolean = true,
+ initialDelay: Long = 500L,
+ incrementalDelay: Long = 60L,
+ onClick: () -> Unit
+ ) {
+
+ rule.setContent {
+ Box(
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .repeatableClickable(
+ enabled = enabled,
+ initialDelay = initialDelay,
+ incrementalDelay = incrementalDelay
+ ) {
+ onClick()
+ }
+ ) {}
+ }
+
+ rule.onNodeWithTag(TEST_TAG).performTouchInput {
+ down(center)
+ advanceEventTime(holdDelay)
+ up()
+ }
+ }
+}
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ImageWithScrimPainter.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ImageWithScrimPainter.kt
index 921c196..f7372b7 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ImageWithScrimPainter.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ImageWithScrimPainter.kt
@@ -85,4 +85,4 @@
* Size of the combined painter, return Unspecified to allow us to fill the available space
*/
override val intrinsicSize: Size = imagePainter.intrinsicSize
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/RepeatableClickable.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/RepeatableClickable.kt
new file mode 100644
index 0000000..da01843
--- /dev/null
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/RepeatableClickable.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.materialcore
+
+import androidx.annotation.RestrictTo
+import androidx.compose.foundation.gestures.awaitEachGesture
+import androidx.compose.foundation.gestures.awaitFirstDown
+import androidx.compose.foundation.gestures.waitForUpOrCancellation
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.rememberUpdatedState
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.composed
+import androidx.compose.ui.input.pointer.pointerInput
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+
+/**
+ * This modifier provides functionality to increment or decrement values repeatedly
+ * by holding down the composable
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public fun Modifier.repeatableClickable(
+ enabled: Boolean,
+ initialDelay: Long = 500L,
+ incrementalDelay: Long = 60L,
+ onClick: () -> Unit
+): Modifier = composed {
+
+ val currentOnClick by rememberUpdatedState(onClick)
+
+ pointerInput(enabled) {
+ coroutineScope {
+ awaitEachGesture {
+ awaitFirstDown()
+ val repeatingJob = launch {
+ delay(initialDelay)
+ while (enabled) {
+ currentOnClick()
+ delay(incrementalDelay)
+ }
+ }
+ waitForUpOrCancellation()
+ repeatingJob.cancel()
+ }
+ }
+ }
+}
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt
index 5042b3b..065d3d0 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt
@@ -54,6 +54,7 @@
interactionSource = remember { MutableInteractionSource() },
indication = LocalIndication.current,
)
+ .repeatableClickable(enabled = enabled, onClick = onClick)
.then(modifier),
contentAlignment = contentAlignment
) {
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Stepper.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Stepper.kt
index a82c450..d1a25d0 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Stepper.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Stepper.kt
@@ -159,6 +159,7 @@
.clickable(
interactionSource, null, onClick = onClick, enabled = enabled, role = Role.Button
)
+ .repeatableClickable(enabled = enabled, onClick = onClick)
.wrapContentWidth()
.indication(interactionSource, rememberRipple(bounded = false))
.padding(paddingValues),
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Text.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Text.kt
index 2b96e52..40c3fc1 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Text.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Text.kt
@@ -120,4 +120,4 @@
minLines = minLines,
inlineContent = inlineContent
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt
new file mode 100644
index 0000000..0047502
--- /dev/null
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.materialcore
+
+import androidx.annotation.RestrictTo
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.interaction.Interaction
+import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.selection.toggleable
+import androidx.compose.material.ripple.rememberRipple
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.State
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.Dp
+
+/**
+ * Wear Material [ToggleButton] that offers a single slot to take any content
+ * (text, icon or image).
+ *
+ * [ToggleButton]s can be enabled or disabled. A disabled toggle button will not respond to click
+ * events.
+ *
+ * For more information, see the
+ * [Buttons](https://developer.android.com/training/wearables/components/buttons#toggle-button)
+ * guide.
+ *
+ * @param checked Boolean flag indicating whether this toggle button is currently checked.
+ * @param onCheckedChange Callback to be invoked when this toggle button is clicked.
+ * @param modifier Modifier to be applied to the toggle button.
+ * @param enabled Controls the enabled state of the toggle button. When `false`,
+ * this toggle button will not be clickable.
+ * @param backgroundColor Resolves the background for this toggle button in different states.
+ * @param border Resolves the border for this toggle button in different states.
+ * @param toggleButtonSize The default size of the toggle button unless overridden by
+ * [Modifier.size].
+ * @param interactionSource The [MutableInteractionSource] representing the stream of
+ * [Interaction]s for this toggle button. You can create and pass in your own remembered
+ * [MutableInteractionSource] if you want to observe [Interaction]s and customize the
+ * appearance / behavior of this ToggleButton in different [Interaction]s.
+ * @param shape Defines the shape for this toggle button. It is strongly recommended to use the
+ * default as this shape is a key characteristic of the Wear Material Theme.
+ * @param content The icon, image or text to be drawn inside the toggle button.
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@Composable
+fun ToggleButton(
+ checked: Boolean,
+ onCheckedChange: (Boolean) -> Unit,
+ modifier: Modifier,
+ enabled: Boolean,
+ backgroundColor: @Composable (enabled: Boolean, checked: Boolean) -> State<Color>,
+ border: @Composable (enabled: Boolean, checked: Boolean) -> State<BorderStroke?>?,
+ toggleButtonSize: Dp,
+ interactionSource: MutableInteractionSource,
+ shape: Shape,
+ content: @Composable BoxScope.() -> Unit,
+) {
+ val borderStroke = border(enabled, checked)?.value
+ Box(
+ contentAlignment = Alignment.Center,
+ modifier = Modifier
+ .clip(shape) // Clip for the touch area (e.g. for Ripple).
+ .toggleable(
+ value = checked,
+ onValueChange = onCheckedChange,
+ enabled = enabled,
+ role = null, // // Provide the role via Modifier.semantics
+ interactionSource = interactionSource,
+ indication = rememberRipple()
+ )
+ .then(
+ // Make sure modifier ordering is clip > toggleable > padding > size,
+ // so that the ripple applies to the entire button shape and size.
+ modifier.semantics { role = Role.Checkbox }
+ )
+ .size(toggleButtonSize)
+ .clip(shape) // Clip for the painted background area after size has been applied.
+ .then(
+ if (borderStroke != null) Modifier.border(border = borderStroke, shape = shape)
+ else Modifier
+ )
+ .background(
+ color = backgroundColor(enabled, checked).value,
+ shape = shape
+ ),
+ content = content
+ )
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ButtonBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ButtonBenchmark.kt
index 88a3eaa..49b256d 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ButtonBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ButtonBenchmark.kt
@@ -90,4 +90,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/CardBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/CardBenchmark.kt
index d785e90..5549072 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/CardBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/CardBenchmark.kt
@@ -100,4 +100,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ChipBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ChipBenchmark.kt
index 048c9de..e93b1f9 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ChipBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ChipBenchmark.kt
@@ -101,4 +101,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/PickerGroupBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/PickerGroupBenchmark.kt
index 4251c32..39c595f 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/PickerGroupBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/PickerGroupBenchmark.kt
@@ -98,4 +98,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/SLCBasedBenchmarkHelper.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/SLCBasedBenchmarkHelper.kt
index 5f6eae7..ecb0592 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/SLCBasedBenchmarkHelper.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/SLCBasedBenchmarkHelper.kt
@@ -131,4 +131,4 @@
Assert.assertTrue(!isComposed)
isComposed = true
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/TimeTextBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/TimeTextBenchmark.kt
index 23f3156..9150911 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/TimeTextBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/TimeTextBenchmark.kt
@@ -119,4 +119,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleButtonBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleButtonBenchmark.kt
index d062d2c..bbea161 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleButtonBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleButtonBenchmark.kt
@@ -90,4 +90,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleChipBenchmark.kt b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleChipBenchmark.kt
index 0800506..642c441 100644
--- a/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleChipBenchmark.kt
+++ b/wear/compose/compose-material/benchmark/src/androidTest/java/androidx/wear/compose/material/benchmark/ToggleChipBenchmark.kt
@@ -104,4 +104,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/CurvedTextSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/CurvedTextSample.kt
index aff1014..90c50f8 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/CurvedTextSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/CurvedTextSample.kt
@@ -96,4 +96,4 @@
curvedText("Green On White")
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/HorizontalPageIndicatorSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/HorizontalPageIndicatorSample.kt
index eb1bad7..0068f90 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/HorizontalPageIndicatorSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/HorizontalPageIndicatorSample.kt
@@ -72,4 +72,4 @@
pageIndicatorState = pageIndicatorState
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/MaterialThemeSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/MaterialThemeSample.kt
index 36e1be0..bff431d 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/MaterialThemeSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/MaterialThemeSample.kt
@@ -39,4 +39,4 @@
color = MaterialTheme.colors.onBackground,
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerGroupSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerGroupSample.kt
index 3278a4d..0171773 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerGroupSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerGroupSample.kt
@@ -107,4 +107,4 @@
autoCenter = true
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerSample.kt
index 4e0485a..12452a9 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PickerSample.kt
@@ -177,4 +177,4 @@
option = { minute: Int -> Option(1, "%02d".format(minute)) }
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PlaceholderSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PlaceholderSample.kt
index 5f301ed..656db1b 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PlaceholderSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PlaceholderSample.kt
@@ -274,4 +274,4 @@
chipPlaceholderState.startPlaceholderAnimation()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PreviewSample.kt b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PreviewSample.kt
index ab01a42..7f79087 100644
--- a/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PreviewSample.kt
+++ b/wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/PreviewSample.kt
@@ -96,4 +96,4 @@
.wrapContentSize(align = Alignment.Center),
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/CurvedTextTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/CurvedTextTest.kt
index 83d68ee..82cc7da 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/CurvedTextTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/CurvedTextTest.kt
@@ -103,4 +103,4 @@
rule.onNodeWithContentDescription(testText).captureToImage()
.assertContainsColor(Color.Yellow)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/HorizontalPageIndicatorScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/HorizontalPageIndicatorScreenshotTest.kt
index 83e18eb9..1edda83 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/HorizontalPageIndicatorScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/HorizontalPageIndicatorScreenshotTest.kt
@@ -133,4 +133,4 @@
indicatorSize = 15.dp
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/IconTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/IconTest.kt
index 50d241b..a073f25 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/IconTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/IconTest.kt
@@ -270,4 +270,4 @@
}
return image
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/InlineSliderTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/InlineSliderTest.kt
index 41c1ec5..7628477 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/InlineSliderTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/InlineSliderTest.kt
@@ -701,4 +701,4 @@
onValueChange = onValueChange,
valueProgression = valueProgression,
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ListHeaderTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ListHeaderTest.kt
index 92524ec..33f74ad 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ListHeaderTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ListHeaderTest.kt
@@ -74,4 +74,4 @@
}
Assert.assertEquals(expectedTextStyle, actualTextStyle)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialTest.kt
index 052e68a..3cd42b0 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialTest.kt
@@ -343,4 +343,4 @@
return file
}
-class StableRef<T>(var value: T)
\ No newline at end of file
+class StableRef<T>(var value: T)
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialThemeTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialThemeTest.kt
index ae19301..4ca03f4 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialThemeTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/MaterialThemeTest.kt
@@ -462,4 +462,4 @@
rule.onNodeWithTag("button").performClick()
assertTextTypographyEquals(overrideTextStyle, rule.textStyleOf("Test"))
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupScreenshotTest.kt
index 7c9684a..7a81b06 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupScreenshotTest.kt
@@ -134,4 +134,4 @@
option = { optionIndex, _ -> Text("%02d".format(optionIndex)) }
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupTest.kt
index a58162b..e7aefd6 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PickerGroupTest.kt
@@ -151,4 +151,4 @@
private val TEST_TAG_1 = "random string 1"
private val TEST_TAG_2 = "random string 2"
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PlaceholderTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PlaceholderTest.kt
index 913b5b1..c816e7a 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PlaceholderTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PlaceholderTest.kt
@@ -508,4 +508,4 @@
rule.waitForIdle()
assertThat(placeholderStage).isEqualTo(expectedPlaceholderStage)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorScreenshotTest.kt
index c2fbee9..31ab009 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorScreenshotTest.kt
@@ -130,4 +130,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, goldenIdentifier)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorTest.kt
index 586cb58..32383aa 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/PositionIndicatorTest.kt
@@ -1059,4 +1059,4 @@
(visibleItemsInfo.last().offset + (visibleItemsInfo.last().size / 2))
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ProgressIndicatorScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ProgressIndicatorScreenshotTest.kt
index 6faf248..7b5e0ae 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ProgressIndicatorScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ProgressIndicatorScreenshotTest.kt
@@ -137,4 +137,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, testName.methodName)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
index 7a88093..75181cf 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
@@ -1241,4 +1241,4 @@
previousEndOffset = startOffset + it.size
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/Screenshot.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/Screenshot.kt
index 3efcc24..53370ef 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/Screenshot.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/Screenshot.kt
@@ -16,4 +16,4 @@
package androidx.wear.compose.material
-internal const val SCREENSHOT_GOLDEN_PATH = "wear/compose/material"
\ No newline at end of file
+internal const val SCREENSHOT_GOLDEN_PATH = "wear/compose/material"
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScrollAwayTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScrollAwayTest.kt
index edbe7fc..3a237cc 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScrollAwayTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ScrollAwayTest.kt
@@ -305,4 +305,4 @@
}
private const val SCROLL_TAG = "ScrollTag"
-private const val TIME_TEXT_TAG = "TimeTextTag"
\ No newline at end of file
+private const val TIME_TEXT_TAG = "TimeTextTag"
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SliderScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SliderScreenshotTest.kt
index a8287b0..8736b21 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SliderScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SliderScreenshotTest.kt
@@ -209,4 +209,4 @@
.captureToImage()
.assertAgainstGolden(screenshotRule, testName.methodName)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/StepperTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/StepperTest.kt
index d8a4b41..5359636 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/StepperTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/StepperTest.kt
@@ -661,4 +661,4 @@
}
private val INCREASE = "increase"
-private val DECREASE = "decrease"
\ No newline at end of file
+private val DECREASE = "decrease"
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SwipeToDismissBoxScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SwipeToDismissBoxScreenshotTest.kt
index cc0f06d..6dba8e0 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SwipeToDismissBoxScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/SwipeToDismissBoxScreenshotTest.kt
@@ -157,4 +157,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
index 59ece90..2422922 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TextTest.kt
@@ -289,4 +289,4 @@
assertThat(letterSpacing).isEqualTo(expectedLetterSpacing)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TimeTextTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TimeTextTest.kt
index ae16c7b..2c400ae 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TimeTextTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/TimeTextTest.kt
@@ -584,4 +584,4 @@
private const val LINEAR_ITEM_TAG = "LINEAR_ITEM_TAG"
private const val CURVED_ITEM_TAG = "CURVED_ITEM_TAG"
private const val LINEAR_SEPARATOR_ITEM_TAG = "LINEAR_SEPARATOR_ITEM_TAG"
-private const val CURVED_SEPARATOR_ITEM_TAG = "CURVED_SEPARATOR_ITEM_TAG"
\ No newline at end of file
+private const val CURVED_SEPARATOR_ITEM_TAG = "CURVED_SEPARATOR_ITEM_TAG"
diff --git a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ToggleControlScreenshotTest.kt b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ToggleControlScreenshotTest.kt
index 9e694ec..cdb3ebe 100644
--- a/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ToggleControlScreenshotTest.kt
+++ b/wear/compose/compose-material/src/androidTest/kotlin/androidx/wear/compose/material/ToggleControlScreenshotTest.kt
@@ -138,4 +138,4 @@
MaterialTheme.colors.primary.copy(alpha = 0.5f)
.compositeOver(MaterialTheme.colors.surface)
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/CurvedText.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/CurvedText.kt
index 1c0b94c..d39ed2c 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/CurvedText.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/CurvedText.kt
@@ -189,4 +189,4 @@
background = background
)
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ExperimentalWearMaterialApi.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ExperimentalWearMaterialApi.kt
index 028dd52..d8f8939 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ExperimentalWearMaterialApi.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ExperimentalWearMaterialApi.kt
@@ -21,4 +21,4 @@
" the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalWearMaterialApi
\ No newline at end of file
+annotation class ExperimentalWearMaterialApi
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/HorizontalPageIndicator.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/HorizontalPageIndicator.kt
index 08dd5cc..abbc1e5 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/HorizontalPageIndicator.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/HorizontalPageIndicator.kt
@@ -82,7 +82,7 @@
* @param spacing The spacing between indicator items in [Dp]
* @param indicatorShape The shape of each [HorizontalPageIndicator] item.
* Defaults to [CircleShape]
- **/
+ */
@Composable
public fun HorizontalPageIndicator(
pageIndicatorState: PageIndicatorState,
@@ -428,4 +428,4 @@
visibleDotIndex = if (scrolledToTheLeft) 1
else selectedPage - hiddenPagesToTheLeft
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ImageWithScrimPainter.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ImageWithScrimPainter.kt
index a25bf34..e585061 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ImageWithScrimPainter.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ImageWithScrimPainter.kt
@@ -81,4 +81,4 @@
* Size of the combined painter, return Unspecified to allow us to fill the available space
*/
override val intrinsicSize: Size = imagePainter.intrinsicSize
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ListHeader.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ListHeader.kt
index 8e6d114..994e12c 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ListHeader.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ListHeader.kt
@@ -54,7 +54,7 @@
.wrapContentSize()
.background(backgroundColor)
.padding(horizontal = 14.dp)
- .semantics { heading() }
+ .semantics(mergeDescendants = true) { heading() }
) {
CompositionLocalProvider(
LocalContentColor provides contentColor,
@@ -63,4 +63,4 @@
content()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ProgressIndicator.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ProgressIndicator.kt
index 9a1ffd1..ddfd0c9 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ProgressIndicator.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ProgressIndicator.kt
@@ -333,4 +333,4 @@
}
private operator fun Size.minus(offset: Float): Size =
- Size(this.width - offset, this.height - offset)
\ No newline at end of file
+ Size(this.width - offset, this.height - offset)
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Resources.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Resources.kt
index 286b29a..c34fe83 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Resources.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Resources.kt
@@ -73,4 +73,4 @@
internal fun screenHeightDp() = LocalContext.current.resources.configuration.screenHeightDp
@Composable
-internal fun screenWidthDp() = LocalContext.current.resources.configuration.screenWidthDp
\ No newline at end of file
+internal fun screenWidthDp() = LocalContext.current.resources.configuration.screenWidthDp
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyColumnSnapFlingBehavior.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyColumnSnapFlingBehavior.kt
index 145804d..36268aa9 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyColumnSnapFlingBehavior.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyColumnSnapFlingBehavior.kt
@@ -140,4 +140,4 @@
// Maximum duration for the final snap after the fling, in seconds, used when the speed is
// SNAP_SPEED_THRESHOLD
private val FINAL_SNAP_DURATION_MAX = .35f
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyListLayoutInfo.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyListLayoutInfo.kt
index 04e1adf..7db894a 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyListLayoutInfo.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ScalingLazyListLayoutInfo.kt
@@ -100,4 +100,4 @@
* reverseLayout set to false.
*/
val afterAutoCenteringPadding: Int
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/TouchExplorationStateProvider.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/TouchExplorationStateProvider.kt
index 564b2df..335fdcd 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/TouchExplorationStateProvider.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/TouchExplorationStateProvider.kt
@@ -122,4 +122,4 @@
am.removeAccessibilityStateChangeListener(this)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/dialog/Dialog.android.kt b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/dialog/Dialog.android.kt
index 0965d74..95487bd 100644
--- a/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/dialog/Dialog.android.kt
+++ b/wear/compose/compose-material/src/main/java/androidx/wear/compose/material/dialog/Dialog.android.kt
@@ -323,4 +323,4 @@
private enum class DialogVisibility {
Hide, Display;
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/api/current.txt b/wear/compose/compose-material3/api/current.txt
index 0657516..ca9505e 100644
--- a/wear/compose/compose-material3/api/current.txt
+++ b/wear/compose/compose-material3/api/current.txt
@@ -205,6 +205,7 @@
method public float getSmallIconSize();
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.IconButtonColors iconButtonColors(optional long containerColor, optional long contentColor, optional long disabledContainerColor, optional long disabledContentColor);
method public float iconSizeFor(float size);
+ method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.ToggleButtonColors iconToggleButtonColors(optional long checkedContainerColor, optional long checkedContentColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor);
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.IconButtonColors outlinedIconButtonColors(optional long contentColor);
property public final float DefaultButtonSize;
property public final float DefaultIconSize;
@@ -221,6 +222,7 @@
method @androidx.compose.runtime.Composable public static void FilledIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void FilledTonalIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void IconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void IconToggleButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.wear.compose.material3.ToggleButtonColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.foundation.BorderStroke? border, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void OutlinedIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
}
@@ -305,38 +307,30 @@
public final class ShapeDefaults {
method public androidx.compose.foundation.shape.RoundedCornerShape getExtraLarge();
method public androidx.compose.foundation.shape.RoundedCornerShape getExtraSmall();
- method public androidx.compose.foundation.shape.RoundedCornerShape getFull();
method public androidx.compose.foundation.shape.RoundedCornerShape getLarge();
method public androidx.compose.foundation.shape.RoundedCornerShape getMedium();
- method public androidx.compose.ui.graphics.Shape getNone();
method public androidx.compose.foundation.shape.RoundedCornerShape getSmall();
property public final androidx.compose.foundation.shape.RoundedCornerShape ExtraLarge;
property public final androidx.compose.foundation.shape.RoundedCornerShape ExtraSmall;
- property public final androidx.compose.foundation.shape.RoundedCornerShape Full;
property public final androidx.compose.foundation.shape.RoundedCornerShape Large;
property public final androidx.compose.foundation.shape.RoundedCornerShape Medium;
- property public final androidx.compose.ui.graphics.Shape None;
property public final androidx.compose.foundation.shape.RoundedCornerShape Small;
field public static final androidx.wear.compose.material3.ShapeDefaults INSTANCE;
}
@androidx.compose.runtime.Immutable public final class Shapes {
- ctor public Shapes(optional androidx.compose.ui.graphics.Shape none, optional androidx.compose.ui.graphics.Shape extraSmall, optional androidx.compose.ui.graphics.Shape small, optional androidx.compose.ui.graphics.Shape medium, optional androidx.compose.ui.graphics.Shape large, optional androidx.compose.ui.graphics.Shape extraLarge, optional androidx.compose.ui.graphics.Shape full);
- method public androidx.wear.compose.material3.Shapes copy(optional androidx.compose.ui.graphics.Shape none, optional androidx.compose.ui.graphics.Shape extraSmall, optional androidx.compose.ui.graphics.Shape small, optional androidx.compose.ui.graphics.Shape medium, optional androidx.compose.ui.graphics.Shape large, optional androidx.compose.ui.graphics.Shape extraLarge, optional androidx.compose.ui.graphics.Shape full);
- method public androidx.compose.ui.graphics.Shape getExtraLarge();
- method public androidx.compose.ui.graphics.Shape getExtraSmall();
- method public androidx.compose.ui.graphics.Shape getFull();
- method public androidx.compose.ui.graphics.Shape getLarge();
- method public androidx.compose.ui.graphics.Shape getMedium();
- method public androidx.compose.ui.graphics.Shape getNone();
- method public androidx.compose.ui.graphics.Shape getSmall();
- property public final androidx.compose.ui.graphics.Shape extraLarge;
- property public final androidx.compose.ui.graphics.Shape extraSmall;
- property public final androidx.compose.ui.graphics.Shape full;
- property public final androidx.compose.ui.graphics.Shape large;
- property public final androidx.compose.ui.graphics.Shape medium;
- property public final androidx.compose.ui.graphics.Shape none;
- property public final androidx.compose.ui.graphics.Shape small;
+ ctor public Shapes(optional androidx.compose.foundation.shape.CornerBasedShape extraSmall, optional androidx.compose.foundation.shape.CornerBasedShape small, optional androidx.compose.foundation.shape.CornerBasedShape medium, optional androidx.compose.foundation.shape.CornerBasedShape large, optional androidx.compose.foundation.shape.CornerBasedShape extraLarge);
+ method public androidx.wear.compose.material3.Shapes copy(optional androidx.compose.foundation.shape.CornerBasedShape extraSmall, optional androidx.compose.foundation.shape.CornerBasedShape small, optional androidx.compose.foundation.shape.CornerBasedShape medium, optional androidx.compose.foundation.shape.CornerBasedShape large, optional androidx.compose.foundation.shape.CornerBasedShape extraLarge);
+ method public androidx.compose.foundation.shape.CornerBasedShape getExtraLarge();
+ method public androidx.compose.foundation.shape.CornerBasedShape getExtraSmall();
+ method public androidx.compose.foundation.shape.CornerBasedShape getLarge();
+ method public androidx.compose.foundation.shape.CornerBasedShape getMedium();
+ method public androidx.compose.foundation.shape.CornerBasedShape getSmall();
+ property public final androidx.compose.foundation.shape.CornerBasedShape extraLarge;
+ property public final androidx.compose.foundation.shape.CornerBasedShape extraSmall;
+ property public final androidx.compose.foundation.shape.CornerBasedShape large;
+ property public final androidx.compose.foundation.shape.CornerBasedShape medium;
+ property public final androidx.compose.foundation.shape.CornerBasedShape small;
}
public final class SliderKt {
@@ -384,6 +378,7 @@
method public float getSmallButtonSize();
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.TextButtonColors outlinedTextButtonColors(optional long contentColor);
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.TextButtonColors textButtonColors(optional long containerColor, optional long contentColor, optional long disabledContainerColor, optional long disabledContentColor);
+ method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.ToggleButtonColors textToggleButtonColors(optional long checkedContainerColor, optional long checkedContentColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor);
property public final float DefaultButtonSize;
property public final float ExtraSmallButtonSize;
property public final float LargeButtonSize;
@@ -394,6 +389,7 @@
public final class TextButtonKt {
method @androidx.compose.runtime.Composable public static void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.TextButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void TextToggleButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.wear.compose.material3.ToggleButtonColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.foundation.BorderStroke? border, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
}
public final class TextKt {
@@ -404,6 +400,28 @@
property public static final androidx.compose.runtime.ProvidableCompositionLocal<androidx.compose.ui.text.TextStyle> LocalTextStyle;
}
+ @androidx.compose.runtime.Immutable public final class ToggleButtonColors {
+ ctor public ToggleButtonColors(long checkedContainerColor, long checkedContentColor, long uncheckedContainerColor, long uncheckedContentColor, long disabledCheckedContainerColor, long disabledCheckedContentColor, long disabledUncheckedContainerColor, long disabledUncheckedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.compose.runtime.State<androidx.compose.ui.graphics.Color> containerColor(boolean enabled, boolean checked);
+ method @androidx.compose.runtime.Composable public androidx.compose.runtime.State<androidx.compose.ui.graphics.Color> contentColor(boolean enabled, boolean checked);
+ method public long getCheckedContainerColor();
+ method public long getCheckedContentColor();
+ method public long getDisabledCheckedContainerColor();
+ method public long getDisabledCheckedContentColor();
+ method public long getDisabledUncheckedContainerColor();
+ method public long getDisabledUncheckedContentColor();
+ method public long getUncheckedContainerColor();
+ method public long getUncheckedContentColor();
+ property public final long checkedContainerColor;
+ property public final long checkedContentColor;
+ property public final long disabledCheckedContainerColor;
+ property public final long disabledCheckedContentColor;
+ property public final long disabledUncheckedContainerColor;
+ property public final long disabledUncheckedContentColor;
+ property public final long uncheckedContainerColor;
+ property public final long uncheckedContentColor;
+ }
+
public final class TouchTargetAwareSizeKt {
method public static androidx.compose.ui.Modifier touchTargetAwareSize(androidx.compose.ui.Modifier, float size);
}
diff --git a/wear/compose/compose-material3/api/restricted_current.txt b/wear/compose/compose-material3/api/restricted_current.txt
index 0657516..ca9505e 100644
--- a/wear/compose/compose-material3/api/restricted_current.txt
+++ b/wear/compose/compose-material3/api/restricted_current.txt
@@ -205,6 +205,7 @@
method public float getSmallIconSize();
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.IconButtonColors iconButtonColors(optional long containerColor, optional long contentColor, optional long disabledContainerColor, optional long disabledContentColor);
method public float iconSizeFor(float size);
+ method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.ToggleButtonColors iconToggleButtonColors(optional long checkedContainerColor, optional long checkedContentColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor);
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.IconButtonColors outlinedIconButtonColors(optional long contentColor);
property public final float DefaultButtonSize;
property public final float DefaultIconSize;
@@ -221,6 +222,7 @@
method @androidx.compose.runtime.Composable public static void FilledIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void FilledTonalIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void IconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void IconToggleButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.wear.compose.material3.ToggleButtonColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.foundation.BorderStroke? border, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
method @androidx.compose.runtime.Composable public static void OutlinedIconButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.IconButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
}
@@ -305,38 +307,30 @@
public final class ShapeDefaults {
method public androidx.compose.foundation.shape.RoundedCornerShape getExtraLarge();
method public androidx.compose.foundation.shape.RoundedCornerShape getExtraSmall();
- method public androidx.compose.foundation.shape.RoundedCornerShape getFull();
method public androidx.compose.foundation.shape.RoundedCornerShape getLarge();
method public androidx.compose.foundation.shape.RoundedCornerShape getMedium();
- method public androidx.compose.ui.graphics.Shape getNone();
method public androidx.compose.foundation.shape.RoundedCornerShape getSmall();
property public final androidx.compose.foundation.shape.RoundedCornerShape ExtraLarge;
property public final androidx.compose.foundation.shape.RoundedCornerShape ExtraSmall;
- property public final androidx.compose.foundation.shape.RoundedCornerShape Full;
property public final androidx.compose.foundation.shape.RoundedCornerShape Large;
property public final androidx.compose.foundation.shape.RoundedCornerShape Medium;
- property public final androidx.compose.ui.graphics.Shape None;
property public final androidx.compose.foundation.shape.RoundedCornerShape Small;
field public static final androidx.wear.compose.material3.ShapeDefaults INSTANCE;
}
@androidx.compose.runtime.Immutable public final class Shapes {
- ctor public Shapes(optional androidx.compose.ui.graphics.Shape none, optional androidx.compose.ui.graphics.Shape extraSmall, optional androidx.compose.ui.graphics.Shape small, optional androidx.compose.ui.graphics.Shape medium, optional androidx.compose.ui.graphics.Shape large, optional androidx.compose.ui.graphics.Shape extraLarge, optional androidx.compose.ui.graphics.Shape full);
- method public androidx.wear.compose.material3.Shapes copy(optional androidx.compose.ui.graphics.Shape none, optional androidx.compose.ui.graphics.Shape extraSmall, optional androidx.compose.ui.graphics.Shape small, optional androidx.compose.ui.graphics.Shape medium, optional androidx.compose.ui.graphics.Shape large, optional androidx.compose.ui.graphics.Shape extraLarge, optional androidx.compose.ui.graphics.Shape full);
- method public androidx.compose.ui.graphics.Shape getExtraLarge();
- method public androidx.compose.ui.graphics.Shape getExtraSmall();
- method public androidx.compose.ui.graphics.Shape getFull();
- method public androidx.compose.ui.graphics.Shape getLarge();
- method public androidx.compose.ui.graphics.Shape getMedium();
- method public androidx.compose.ui.graphics.Shape getNone();
- method public androidx.compose.ui.graphics.Shape getSmall();
- property public final androidx.compose.ui.graphics.Shape extraLarge;
- property public final androidx.compose.ui.graphics.Shape extraSmall;
- property public final androidx.compose.ui.graphics.Shape full;
- property public final androidx.compose.ui.graphics.Shape large;
- property public final androidx.compose.ui.graphics.Shape medium;
- property public final androidx.compose.ui.graphics.Shape none;
- property public final androidx.compose.ui.graphics.Shape small;
+ ctor public Shapes(optional androidx.compose.foundation.shape.CornerBasedShape extraSmall, optional androidx.compose.foundation.shape.CornerBasedShape small, optional androidx.compose.foundation.shape.CornerBasedShape medium, optional androidx.compose.foundation.shape.CornerBasedShape large, optional androidx.compose.foundation.shape.CornerBasedShape extraLarge);
+ method public androidx.wear.compose.material3.Shapes copy(optional androidx.compose.foundation.shape.CornerBasedShape extraSmall, optional androidx.compose.foundation.shape.CornerBasedShape small, optional androidx.compose.foundation.shape.CornerBasedShape medium, optional androidx.compose.foundation.shape.CornerBasedShape large, optional androidx.compose.foundation.shape.CornerBasedShape extraLarge);
+ method public androidx.compose.foundation.shape.CornerBasedShape getExtraLarge();
+ method public androidx.compose.foundation.shape.CornerBasedShape getExtraSmall();
+ method public androidx.compose.foundation.shape.CornerBasedShape getLarge();
+ method public androidx.compose.foundation.shape.CornerBasedShape getMedium();
+ method public androidx.compose.foundation.shape.CornerBasedShape getSmall();
+ property public final androidx.compose.foundation.shape.CornerBasedShape extraLarge;
+ property public final androidx.compose.foundation.shape.CornerBasedShape extraSmall;
+ property public final androidx.compose.foundation.shape.CornerBasedShape large;
+ property public final androidx.compose.foundation.shape.CornerBasedShape medium;
+ property public final androidx.compose.foundation.shape.CornerBasedShape small;
}
public final class SliderKt {
@@ -384,6 +378,7 @@
method public float getSmallButtonSize();
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.TextButtonColors outlinedTextButtonColors(optional long contentColor);
method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.TextButtonColors textButtonColors(optional long containerColor, optional long contentColor, optional long disabledContainerColor, optional long disabledContentColor);
+ method @androidx.compose.runtime.Composable public androidx.wear.compose.material3.ToggleButtonColors textToggleButtonColors(optional long checkedContainerColor, optional long checkedContentColor, optional long uncheckedContainerColor, optional long uncheckedContentColor, optional long disabledCheckedContainerColor, optional long disabledCheckedContentColor, optional long disabledUncheckedContainerColor, optional long disabledUncheckedContentColor);
property public final float DefaultButtonSize;
property public final float ExtraSmallButtonSize;
property public final float LargeButtonSize;
@@ -394,6 +389,7 @@
public final class TextButtonKt {
method @androidx.compose.runtime.Composable public static void TextButton(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.compose.ui.graphics.Shape shape, optional androidx.wear.compose.material3.TextButtonColors colors, optional androidx.compose.foundation.BorderStroke? border, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void TextToggleButton(boolean checked, kotlin.jvm.functions.Function1<? super java.lang.Boolean,kotlin.Unit> onCheckedChange, optional androidx.compose.ui.Modifier modifier, optional boolean enabled, optional androidx.wear.compose.material3.ToggleButtonColors colors, optional androidx.compose.foundation.interaction.MutableInteractionSource interactionSource, optional androidx.compose.ui.graphics.Shape shape, optional androidx.compose.foundation.BorderStroke? border, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
}
public final class TextKt {
@@ -404,6 +400,28 @@
property public static final androidx.compose.runtime.ProvidableCompositionLocal<androidx.compose.ui.text.TextStyle> LocalTextStyle;
}
+ @androidx.compose.runtime.Immutable public final class ToggleButtonColors {
+ ctor public ToggleButtonColors(long checkedContainerColor, long checkedContentColor, long uncheckedContainerColor, long uncheckedContentColor, long disabledCheckedContainerColor, long disabledCheckedContentColor, long disabledUncheckedContainerColor, long disabledUncheckedContentColor);
+ method @androidx.compose.runtime.Composable public androidx.compose.runtime.State<androidx.compose.ui.graphics.Color> containerColor(boolean enabled, boolean checked);
+ method @androidx.compose.runtime.Composable public androidx.compose.runtime.State<androidx.compose.ui.graphics.Color> contentColor(boolean enabled, boolean checked);
+ method public long getCheckedContainerColor();
+ method public long getCheckedContentColor();
+ method public long getDisabledCheckedContainerColor();
+ method public long getDisabledCheckedContentColor();
+ method public long getDisabledUncheckedContainerColor();
+ method public long getDisabledUncheckedContentColor();
+ method public long getUncheckedContainerColor();
+ method public long getUncheckedContentColor();
+ property public final long checkedContainerColor;
+ property public final long checkedContentColor;
+ property public final long disabledCheckedContainerColor;
+ property public final long disabledCheckedContentColor;
+ property public final long disabledUncheckedContainerColor;
+ property public final long disabledUncheckedContentColor;
+ property public final long uncheckedContainerColor;
+ property public final long uncheckedContentColor;
+ }
+
public final class TouchTargetAwareSizeKt {
method public static androidx.compose.ui.Modifier touchTargetAwareSize(androidx.compose.ui.Modifier, float size);
}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
index d546a2e..76cddf8 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
@@ -386,4 +386,4 @@
contentDescription = "Account",
modifier = Modifier.size(ButtonDefaults.LargeIconSize)
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconButtonDemo.kt
index dbd1fff..57c962e 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconButtonDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconButtonDemo.kt
@@ -19,18 +19,22 @@
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
+import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.FilledIconButton
import androidx.wear.compose.material3.FilledTonalIconButton
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.IconButton
+import androidx.wear.compose.material3.IconButtonDefaults
import androidx.wear.compose.material3.ListHeader
import androidx.wear.compose.material3.OutlinedIconButton
import androidx.wear.compose.material3.Text
@@ -38,6 +42,7 @@
import androidx.wear.compose.material3.samples.FilledTonalIconButtonSample
import androidx.wear.compose.material3.samples.IconButtonSample
import androidx.wear.compose.material3.samples.OutlinedIconButtonSample
+import androidx.wear.compose.material3.touchTargetAwareSize
@Composable
fun IconButtonDemo() {
@@ -58,16 +63,13 @@
onClick = { },
enabled = false
) {
- Icon(
- imageVector = Icons.Filled.Favorite,
- contentDescription = "Favorite icon"
- )
+ StandardIcon()
}
}
}
item {
ListHeader {
- Text("FilledTonalIconButton")
+ Text("Filled Tonal")
}
}
item {
@@ -78,16 +80,13 @@
onClick = { },
enabled = false
) {
- Icon(
- imageVector = Icons.Filled.Favorite,
- contentDescription = "Favorite icon"
- )
+ StandardIcon()
}
}
}
item {
ListHeader {
- Text("FilledIconButton")
+ Text("Filled")
}
}
item {
@@ -98,16 +97,13 @@
onClick = { },
enabled = false
) {
- Icon(
- imageVector = Icons.Filled.Favorite,
- contentDescription = "Favorite icon"
- )
+ StandardIcon()
}
}
}
item {
ListHeader {
- Text("OutlinedIconButton")
+ Text("Outlined")
}
}
item {
@@ -118,12 +114,60 @@
onClick = { },
enabled = false
) {
- Icon(
- imageVector = Icons.Filled.Favorite,
- contentDescription = "Favorite icon"
- )
+ StandardIcon()
}
}
}
+ item {
+ ListHeader {
+ Text("Sizes")
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.LargeButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconButtonWithSize(IconButtonDefaults.LargeButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.DefaultButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconButtonWithSize(IconButtonDefaults.DefaultButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.SmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconButtonWithSize(IconButtonDefaults.SmallButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.ExtraSmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconButtonWithSize(IconButtonDefaults.ExtraSmallButtonSize)
+ }
+ }
}
-}
\ No newline at end of file
+}
+
+@Composable
+private fun StandardIcon(iconSize: Dp = ButtonDefaults.IconSize) {
+ Icon(
+ Icons.Filled.Favorite,
+ contentDescription = "Favorite icon",
+ modifier = Modifier.requiredSize(iconSize)
+ )
+}
+
+@Composable
+private fun IconButtonWithSize(size: Dp) {
+ FilledTonalIconButton(
+ modifier = Modifier.touchTargetAwareSize(size),
+ onClick = { /* Do something */ }) {
+ StandardIcon(IconButtonDefaults.iconSizeFor(size))
+ }
+}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconToggleButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconToggleButtonDemo.kt
new file mode 100644
index 0000000..18affc7
--- /dev/null
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/IconToggleButtonDemo.kt
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.demos
+
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.width
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Favorite
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.IconButtonDefaults
+import androidx.wear.compose.material3.IconToggleButton
+import androidx.wear.compose.material3.ListHeader
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.samples.IconToggleButtonSample
+import androidx.wear.compose.material3.touchTargetAwareSize
+
+@Composable
+fun IconToggleButtonDemo() {
+ ScalingLazyColumn(
+ modifier = Modifier.fillMaxSize(),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ item {
+ ListHeader {
+ Text("Icon Toggle Button")
+ }
+ }
+ item {
+ Row {
+ IconToggleButtonSample() // Enabled
+ Spacer(modifier = Modifier.width(5.dp))
+ IconToggleButtonsDemo(enabled = true, checked = false) // Unchecked and enabled
+ }
+ }
+ item {
+ Row {
+ IconToggleButtonsDemo(enabled = false, checked = true) // Checked and disabled
+ Spacer(modifier = Modifier.width(5.dp))
+ IconToggleButtonsDemo(enabled = false, checked = false) // Unchecked and disabled
+ }
+ }
+ item {
+ ListHeader {
+ Text("Sizes")
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.LargeButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = IconButtonDefaults.LargeButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.DefaultButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = IconButtonDefaults.DefaultButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.SmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = IconButtonDefaults.SmallButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${IconButtonDefaults.ExtraSmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ IconToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = IconButtonDefaults.ExtraSmallButtonSize
+ )
+ }
+ }
+ }
+}
+
+@Composable
+private fun IconToggleButtonsDemo(
+ enabled: Boolean,
+ checked: Boolean,
+ size: Dp = IconButtonDefaults.DefaultButtonSize
+) {
+ IconToggleButton(
+ checked = checked,
+ enabled = enabled,
+ modifier = Modifier.touchTargetAwareSize(size),
+ onCheckedChange = {} // Do not update the state
+ ) {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = "Flight Mode"
+ )
+ }
+}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ListHeaderDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ListHeaderDemo.kt
index 0b88f4a..f5094c4 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ListHeaderDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ListHeaderDemo.kt
@@ -39,4 +39,4 @@
ListSubheaderWithIconSample()
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextButtonDemo.kt
index 3ba251d..de378c5 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextButtonDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextButtonDemo.kt
@@ -23,6 +23,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.material3.ButtonDefaults
@@ -34,6 +35,7 @@
import androidx.wear.compose.material3.samples.FilledTonalTextButtonSample
import androidx.wear.compose.material3.samples.OutlinedTextButtonSample
import androidx.wear.compose.material3.samples.TextButtonSample
+import androidx.wear.compose.material3.touchTargetAwareSize
@Composable
fun TextButtonDemo() {
@@ -57,7 +59,7 @@
}
item {
ListHeader {
- Text("FilledTonalTextButton")
+ Text("Filled Tonal")
}
}
item {
@@ -75,7 +77,7 @@
}
item {
ListHeader {
- Text("FilledTextButton")
+ Text("Filled")
}
}
item {
@@ -93,7 +95,7 @@
}
item {
ListHeader {
- Text("OutlinedTextButton")
+ Text("Outlined")
}
}
item {
@@ -110,5 +112,50 @@
}
}
}
+ item {
+ ListHeader {
+ Text("Sizes")
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.LargeButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextButtonWithSize(TextButtonDefaults.LargeButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.DefaultButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextButtonWithSize(TextButtonDefaults.DefaultButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.SmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextButtonWithSize(TextButtonDefaults.SmallButtonSize)
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.ExtraSmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextButtonWithSize(TextButtonDefaults.ExtraSmallButtonSize)
+ }
+ }
}
-}
\ No newline at end of file
+}
+
+@Composable
+private fun TextButtonWithSize(size: Dp) {
+ TextButton(
+ modifier = Modifier.touchTargetAwareSize(size),
+ onClick = { },
+ enabled = true,
+ colors = TextButtonDefaults.filledTonalTextButtonColors()
+ ) {
+ Text(text = "AB")
+ }
+}
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextToggleButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextToggleButtonDemo.kt
new file mode 100644
index 0000000..c1506db
--- /dev/null
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/TextToggleButtonDemo.kt
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.demos
+
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.width
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
+import androidx.wear.compose.material3.ListHeader
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.TextButtonDefaults
+import androidx.wear.compose.material3.TextToggleButton
+import androidx.wear.compose.material3.samples.TextToggleButtonSample
+import androidx.wear.compose.material3.touchTargetAwareSize
+
+@Composable
+fun TextToggleButtonDemo() {
+ ScalingLazyColumn(
+ modifier = Modifier.fillMaxSize(),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ item {
+ ListHeader {
+ Text("Text Toggle Button")
+ }
+ }
+ item {
+ Row {
+ TextToggleButtonSample() // Enabled
+ Spacer(modifier = Modifier.width(5.dp))
+ TextToggleButtonsDemo(enabled = true, checked = false) // Enabled and unchecked
+ }
+ }
+ item {
+ Row {
+ TextToggleButtonsDemo(enabled = false, checked = true) // Checked and disabled
+ Spacer(modifier = Modifier.width(5.dp))
+ TextToggleButtonsDemo(enabled = false, checked = false) // Unchecked and disabled
+ }
+ }
+ item {
+ ListHeader {
+ Text("Sizes")
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.LargeButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = TextButtonDefaults.LargeButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.DefaultButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = TextButtonDefaults.DefaultButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.SmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = TextButtonDefaults.SmallButtonSize
+ )
+ }
+ }
+ item {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text("${TextButtonDefaults.ExtraSmallButtonSize.value.toInt()}dp")
+ Spacer(Modifier.width(4.dp))
+ TextToggleButtonsDemo(
+ enabled = true,
+ checked = true,
+ size = TextButtonDefaults.ExtraSmallButtonSize
+ )
+ }
+ }
+ }
+}
+
+@Composable
+private fun TextToggleButtonsDemo(
+ enabled: Boolean,
+ checked: Boolean,
+ size: Dp = TextButtonDefaults.DefaultButtonSize
+) {
+ TextToggleButton(
+ checked = checked,
+ enabled = enabled,
+ modifier = Modifier.touchTargetAwareSize(size),
+ onCheckedChange = {} // Do not update the state,
+ ) {
+ Text(
+ text = if (checked) "On" else "Off"
+ )
+ }
+}
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 d4df8fc..2ed27cb 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
@@ -115,10 +115,16 @@
ListHeaderDemo()
}
},
+ ComposableDemo("Text Toggle Button") {
+ TextToggleButtonDemo()
+ },
+ ComposableDemo("Icon Toggle Button") {
+ IconToggleButtonDemo()
+ },
ComposableDemo(
title = "Fixed Font Size"
) {
Centralize { FixedFontSize() }
}
)
-)
\ No newline at end of file
+)
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconButtonSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconButtonSample.kt
index f2e7de6..14255f1 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconButtonSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconButtonSample.kt
@@ -68,4 +68,4 @@
contentDescription = "Favorite icon"
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconToggleButtonSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconToggleButtonSample.kt
new file mode 100644
index 0000000..8f01225
--- /dev/null
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/IconToggleButtonSample.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.samples
+
+import androidx.annotation.Sampled
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Favorite
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.wear.compose.material3.Icon
+import androidx.wear.compose.material3.IconToggleButton
+
+@Sampled
+@Composable
+fun IconToggleButtonSample() {
+ var checked by remember { mutableStateOf(true) }
+ IconToggleButton(
+ checked = checked,
+ onCheckedChange = { checked = !checked }
+ ) {
+ Icon(
+ imageVector = Icons.Filled.Favorite,
+ contentDescription = "Flight Mode"
+ )
+ }
+}
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/MaterialThemeSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/MaterialThemeSample.kt
index 71069fd..9d05440 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/MaterialThemeSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/MaterialThemeSample.kt
@@ -39,4 +39,4 @@
color = MaterialTheme.colorScheme.onBackground,
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextButtonSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextButtonSample.kt
index 6a1ebfed..98ccaac 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextButtonSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextButtonSample.kt
@@ -63,4 +63,4 @@
) {
Text(text = "ABC")
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextToggleButtonSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextToggleButtonSample.kt
new file mode 100644
index 0000000..c680a7c
--- /dev/null
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TextToggleButtonSample.kt
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3.samples
+
+import androidx.annotation.Sampled
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.wear.compose.material3.Text
+import androidx.wear.compose.material3.TextToggleButton
+
+@Sampled
+@Composable
+fun TextToggleButtonSample() {
+ var checked by remember { mutableStateOf(true) }
+ TextToggleButton(
+ checked = checked,
+ onCheckedChange = { checked = !checked }
+ ) {
+ Text(
+ text = if (checked) "On" else "Off"
+ )
+ }
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
index 7fe8d63..eb4b7c0 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
@@ -758,4 +758,4 @@
)
}
-val MinimumButtonTapSize = 48.dp
\ No newline at end of file
+val MinimumButtonTapSize = 48.dp
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/CurvedTextTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/CurvedTextTest.kt
index 2a7c118..ccb12db 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/CurvedTextTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/CurvedTextTest.kt
@@ -103,4 +103,4 @@
rule.onNodeWithContentDescription(testText).captureToImage()
.assertContainsColor(Color.Yellow)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconTest.kt
index 729aace..9088b8e 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconTest.kt
@@ -282,4 +282,4 @@
}
return image
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconToggleButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconToggleButtonTest.kt
new file mode 100644
index 0000000..25cdf7d
--- /dev/null
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconToggleButtonTest.kt
@@ -0,0 +1,761 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3
+
+import android.os.Build
+import androidx.annotation.RequiresApi
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.testutils.assertContainsColor
+import androidx.compose.testutils.assertShape
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.compositeOver
+import androidx.compose.ui.platform.LocalLayoutDirection
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.SemanticsProperties
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.test.SemanticsMatcher
+import androidx.compose.ui.test.assert
+import androidx.compose.ui.test.assertHasClickAction
+import androidx.compose.ui.test.assertHeightIsEqualTo
+import androidx.compose.ui.test.assertIsEnabled
+import androidx.compose.ui.test.assertIsNotEnabled
+import androidx.compose.ui.test.assertIsOff
+import androidx.compose.ui.test.assertIsOn
+import androidx.compose.ui.test.assertIsToggleable
+import androidx.compose.ui.test.assertWidthIsEqualTo
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.junit4.ComposeContentTestRule
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performClick
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.unit.dp
+import org.junit.Assert
+import org.junit.Rule
+import org.junit.Test
+
+class IconToggleButtonTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun supports_testTag() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertExists()
+ }
+
+ @Test
+ fun has_clickAction_when_enabled() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertHasClickAction()
+ }
+
+ @Test
+ fun has_clickAction_when_disabled() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ enabled = false,
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertHasClickAction()
+ }
+
+ @Test
+ fun is_toggleable() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsToggleable()
+ }
+
+ @Test
+ fun is_correctly_enabled() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsEnabled()
+ }
+
+ @Test
+ fun is_correctly_disabled() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ enabled = false,
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsNotEnabled()
+ }
+
+ @Test
+ fun is_on_when_checked() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ checked = true,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsOn()
+ }
+
+ @Test
+ fun is_off_when_unchecked() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsOff()
+ }
+
+ @Test
+ fun responds_to_toggle_on() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(false) }
+ IconToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOff()
+ .performClick()
+ .assertIsOn()
+ }
+
+ @Test
+ fun responds_to_toggle_off() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(true) }
+ IconToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOn()
+ .performClick()
+ .assertIsOff()
+ }
+
+ @Test
+ fun does_not_toggle_when_disabled() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(false) }
+ IconToggleButton(
+ enabled = false,
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOff()
+ .performClick()
+ .assertIsOff()
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun is_circular_under_ltr() =
+ rule.isShape(
+ shape = CircleShape,
+ layoutDirection = LayoutDirection.Ltr,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun is_circular_under_rtl() =
+ rule.isShape(
+ shape = CircleShape,
+ layoutDirection = LayoutDirection.Rtl,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_shape_overrides() =
+ rule.isShape(
+ shape = RectangleShape,
+ layoutDirection = LayoutDirection.Ltr,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ shape = RectangleShape,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @Test
+ fun gives_default_correct_tapSize() =
+ rule.verifyTapSize(52.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.DefaultButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_small_correct_tapSize() =
+ rule.verifyTapSize(48.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.SmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_extraSmall_correct_tapSize() =
+ rule.verifyTapSize(48.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.ExtraSmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_large_correct_tapSize() =
+ rule.verifyTapSize(60.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.LargeButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_default_correct_size() =
+ rule.verifyActualSize(52.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.DefaultButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_small_correct_size() =
+ rule.verifyActualSize(48.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.SmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_extraSmall_correct_size() =
+ rule.verifyActualSize(48.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.ExtraSmallButtonSize)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_large_correct_size() =
+ rule.verifyActualSize(60.dp) {
+ IconToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = it.touchTargetAwareSize(IconButtonDefaults.LargeButtonSize)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_checked_primary_colors() =
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = { IconButtonDefaults.iconToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_unchecked_surface_colors() =
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = { IconButtonDefaults.iconToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_disabled_unchecked_surface_colors_with_alpha() =
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = { IconButtonDefaults.iconToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_disabled_primary_checked_contrasting_content_color() =
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = { IconButtonDefaults.iconToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { MaterialTheme.colorScheme.onPrimary },
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_background_override() {
+ val overrideColor = Color.Yellow
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ checkedContainerColor = overrideColor
+ )
+ },
+ containerColor = { overrideColor },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_content_override() {
+ val overrideColor = Color.Green
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ checkedContentColor = overrideColor
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { overrideColor }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_background_override() {
+ val overrideColor = Color.Red
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ uncheckedContainerColor = overrideColor
+ )
+ },
+ containerColor = { overrideColor },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_content_override() {
+ val overrideColor = Color.Green
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ uncheckedContentColor = overrideColor
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { overrideColor }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_disabled_background_override() {
+ val overrideColor = Color.Yellow
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ checkedContainerColor = overrideColor
+ )
+ },
+ containerColor = { overrideColor },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_disabled_content_override() {
+ val overrideColor = Color.Green
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ checkedContentColor = overrideColor
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { overrideColor }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_disabled_background_override() {
+ val overrideColor = Color.Red
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ uncheckedContainerColor = overrideColor
+ )
+ },
+ containerColor = { overrideColor },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_disabled_content_override() {
+ val overrideColor = Color.Green
+
+ rule.verifyIconToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = {
+ IconButtonDefaults.iconToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ uncheckedContentColor = overrideColor
+ )
+ },
+ contentColor = { overrideColor },
+ containerColor = { MaterialTheme.colorScheme.surface }
+ )
+ }
+
+ @Test
+ fun default_role_checkbox() {
+ rule.setContentWithTheme {
+ IconToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ enabled = false,
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ Role.Checkbox
+ )
+ )
+ }
+
+ @Test
+ fun allows_custom_role() {
+ val overrideRole = Role.Button
+
+ rule.setContentWithTheme {
+ IconToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ enabled = false,
+ content = { TestImage() },
+ modifier = Modifier.testTag(TEST_TAG).semantics { role = overrideRole }
+ )
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ overrideRole
+ )
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.verifyIconToggleButtonColors(
+ status: Status,
+ checked: Boolean,
+ colors: @Composable () -> ToggleButtonColors,
+ containerColor: @Composable () -> Color,
+ contentColor: @Composable () -> Color,
+ ) {
+ verifyColors(
+ status = status,
+ expectedContainerColor = containerColor,
+ expectedContentColor = contentColor,
+ content = {
+ var actualContentColor = Color.Transparent
+ IconToggleButton(
+ onCheckedChange = { },
+ enabled = status.enabled(),
+ checked = checked,
+ colors = colors(),
+ modifier = Modifier.testTag(TEST_TAG),
+ ) {
+ actualContentColor = LocalContentColor.current
+ }
+ return@verifyColors actualContentColor
+ }
+ )
+ }
+
+ @Composable
+ private fun shapeColor(): Color {
+ return IconButtonDefaults.iconToggleButtonColors().containerColor(
+ enabled = true,
+ checked = true
+ ).value
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.isShape(
+ shape: Shape = CircleShape,
+ layoutDirection: LayoutDirection,
+ padding: Dp = 0.dp,
+ backgroundColor: Color = Color.Red,
+ shapeColorComposable: @Composable () -> Color,
+ content: @Composable () -> Unit
+ ) {
+ var shapeColor = Color.Transparent
+ setContentWithTheme {
+ shapeColor = shapeColorComposable.invoke()
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
+ Box(
+ Modifier
+ .padding(padding)
+ .background(backgroundColor)
+ ) {
+ content()
+ }
+ }
+ }
+
+ this.waitForIdle()
+ onNodeWithTag(TEST_TAG)
+ .captureToImage()
+ .assertShape(
+ density = density,
+ shape = shape,
+ horizontalPadding = padding,
+ verticalPadding = padding,
+ backgroundColor = backgroundColor,
+ shapeOverlapPixelCount = 2.0f,
+ shapeColor = shapeColor
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.verifyColors(
+ status: Status,
+ expectedContainerColor: @Composable () -> Color,
+ expectedContentColor: @Composable () -> Color,
+ applyAlphaForDisabled: Boolean = true,
+ content: @Composable () -> Color
+ ) {
+ val testBackgroundColor = Color.White
+ var finalExpectedContainerColor = Color.Transparent
+ var finalExpectedContent = Color.Transparent
+ var actualContentColor = Color.Transparent
+ setContentWithTheme {
+ finalExpectedContainerColor =
+ if (status.enabled() || !applyAlphaForDisabled) {
+ expectedContainerColor()
+ } else {
+ expectedContainerColor().copy(ContentAlpha.disabled)
+ }.compositeOver(testBackgroundColor)
+ finalExpectedContent =
+ if (status.enabled() || !applyAlphaForDisabled) {
+ expectedContentColor()
+ } else {
+ expectedContentColor().copy(ContentAlpha.disabled)
+ }
+ Box(
+ Modifier
+ .fillMaxSize()
+ .background(testBackgroundColor)
+ ) {
+ actualContentColor = content()
+ }
+ }
+ Assert.assertEquals(finalExpectedContent, actualContentColor)
+ onNodeWithTag(TEST_TAG)
+ .captureToImage()
+ .assertContainsColor(finalExpectedContainerColor)
+ }
+
+ private fun ComposeContentTestRule.verifyActualSize(
+ expectedSize: Dp,
+ content: @Composable (modifier: Modifier) -> Unit
+ ) {
+ setContentWithTheme {
+ content(Modifier.testTag(TEST_TAG))
+ }
+ waitForIdle()
+
+ onNodeWithTag(TEST_TAG)
+ .assertHeightIsEqualTo(expectedSize)
+ .assertWidthIsEqualTo(expectedSize)
+ }
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ListHeaderTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ListHeaderTest.kt
index 9ebc106..0eb56c3 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ListHeaderTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ListHeaderTest.kt
@@ -18,7 +18,10 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
-import androidx.compose.ui.test.isHeading
+import androidx.compose.ui.semantics.SemanticsProperties
+import androidx.compose.ui.test.SemanticsMatcher
+import androidx.compose.ui.test.assert
+import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.text.TextStyle
@@ -58,7 +61,7 @@
}
}
- rule.onNode(isHeading())
+ rule.assertNodeIsHeading(TEST_TAG)
}
@Test
@@ -71,7 +74,7 @@
}
}
- rule.onNode(isHeading())
+ rule.assertNodeIsHeading(TEST_TAG)
}
@Test
@@ -103,4 +106,13 @@
Assert.assertEquals(expectedTextStyle, actualTextStyle)
}
-}
\ No newline at end of file
+
+ private fun ComposeContentTestRule.assertNodeIsHeading(tag: String) {
+ onNodeWithTag(tag)
+ .assert(
+ SemanticsMatcher.keyIsDefined(
+ SemanticsProperties.Heading
+ )
+ )
+ }
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextTest.kt
index db9a5398..1323d67 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextTest.kt
@@ -288,4 +288,4 @@
assertThat(letterSpacing).isEqualTo(expectedLetterSpacing)
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextToggleButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextToggleButtonTest.kt
new file mode 100644
index 0000000..d4dd6db
--- /dev/null
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextToggleButtonTest.kt
@@ -0,0 +1,776 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3
+
+import android.os.Build
+import androidx.annotation.RequiresApi
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.testutils.assertContainsColor
+import androidx.compose.testutils.assertShape
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.compositeOver
+import androidx.compose.ui.platform.LocalLayoutDirection
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.SemanticsProperties
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.test.SemanticsMatcher
+import androidx.compose.ui.test.assert
+import androidx.compose.ui.test.assertHasClickAction
+import androidx.compose.ui.test.assertHeightIsEqualTo
+import androidx.compose.ui.test.assertIsEnabled
+import androidx.compose.ui.test.assertIsNotEnabled
+import androidx.compose.ui.test.assertIsOff
+import androidx.compose.ui.test.assertIsOn
+import androidx.compose.ui.test.assertIsToggleable
+import androidx.compose.ui.test.assertWidthIsEqualTo
+import androidx.compose.ui.test.captureToImage
+import androidx.compose.ui.test.junit4.ComposeContentTestRule
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performClick
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.unit.dp
+import org.junit.Assert
+import org.junit.Rule
+import org.junit.Test
+
+class TextToggleButtonTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun supports_testTag() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertExists()
+ }
+
+ @Test
+ fun has_clickAction_when_enabled() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertHasClickAction()
+ }
+
+ @Test
+ fun has_clickAction_when_disabled() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ enabled = false,
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertHasClickAction()
+ }
+
+ @Test
+ fun is_toggleable() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsToggleable()
+ }
+
+ @Test
+ fun is_correctly_enabled() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsEnabled()
+ }
+
+ @Test
+ fun is_correctly_disabled() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ enabled = false,
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsNotEnabled()
+ }
+
+ @Test
+ fun is_on_when_checked() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ checked = true,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsOn()
+ }
+
+ @Test
+ fun is_off_when_unchecked() {
+ rule.setContentWithTheme {
+ TextToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG).assertIsOff()
+ }
+
+ @Test
+ fun responds_to_toggle_on() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(false) }
+ TextToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOff()
+ .performClick()
+ .assertIsOn()
+ }
+
+ @Test
+ fun responds_to_toggle_off() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(true) }
+ TextToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOn()
+ .performClick()
+ .assertIsOff()
+ }
+
+ @Test
+ fun does_not_toggle_when_disabled() {
+ rule.setContentWithTheme {
+ val (checked, onCheckedChange) = remember { mutableStateOf(false) }
+ TextToggleButton(
+ enabled = false,
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+ rule.waitForIdle()
+
+ rule.onNodeWithTag(TEST_TAG)
+ .assertIsOff()
+ .performClick()
+ .assertIsOff()
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun is_circular_under_ltr() =
+ rule.isShape(
+ shape = CircleShape,
+ layoutDirection = LayoutDirection.Ltr,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun is_circular_under_rtl() =
+ rule.isShape(
+ shape = CircleShape,
+ layoutDirection = LayoutDirection.Rtl,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_shape_overrides() =
+ rule.isShape(
+ shape = RectangleShape,
+ layoutDirection = LayoutDirection.Ltr,
+ shapeColorComposable = { shapeColor() }
+ ) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ shape = RectangleShape,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ @Test
+ fun gives_default_correct_tapSize() =
+ rule.verifyTapSize(52.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.DefaultButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_small_correct_tapSize() =
+ rule.verifyTapSize(48.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.SmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_extraSmall_correct_tapSize() =
+ rule.verifyTapSize(48.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.ExtraSmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_large_correct_tapSize() =
+ rule.verifyTapSize(60.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.LargeButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_default_correct_size() =
+ rule.verifyActualSize(52.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.DefaultButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_small_correct_size() =
+ rule.verifyActualSize(48.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.SmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_extraSmall_correct_size() =
+ rule.verifyActualSize(48.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.ExtraSmallButtonSize)
+ )
+ }
+
+ @Test
+ fun gives_large_correct_size() =
+ rule.verifyActualSize(60.dp) {
+ TextToggleButton(
+ enabled = true,
+ checked = true,
+ onCheckedChange = { },
+ content = { },
+ modifier = Modifier
+ .testTag(TEST_TAG)
+ .touchTargetAwareSize(TextButtonDefaults.LargeButtonSize)
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_checked_primary_colors() =
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = { TextButtonDefaults.textToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_unchecked_surface_colors() =
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = { TextButtonDefaults.textToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_disabled_unchecked_surface_colors_with_alpha() =
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = { TextButtonDefaults.textToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun gives_disabled_primary_checked_contrasting_content_color() =
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = { TextButtonDefaults.textToggleButtonColors() },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { MaterialTheme.colorScheme.onPrimary },
+ )
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_background_override() {
+ val override = Color.Yellow
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ checkedContainerColor = override
+ )
+ },
+ containerColor = { override },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_content_override() {
+ val override = Color.Green
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = true,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ checkedContentColor = override
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { override }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_background_override() {
+ val override = Color.Red
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ uncheckedContainerColor = override
+ )
+ },
+ containerColor = { override },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_content_override() {
+ val override = Color.Green
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Enabled,
+ checked = false,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ uncheckedContentColor = override
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.surface },
+ contentColor = { override }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_disabled_background_override() {
+ val override = Color.Yellow
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ checkedContainerColor = override
+ )
+ },
+ containerColor = { override },
+ contentColor = { MaterialTheme.colorScheme.onPrimary }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_checked_disabled_content_override() {
+ val override = Color.Green
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = true,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ checkedContentColor = override
+ )
+ },
+ containerColor = { MaterialTheme.colorScheme.primary },
+ contentColor = { override }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_disabled_background_override() {
+ val override = Color.Red
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ uncheckedContainerColor = override
+ )
+ },
+ containerColor = { override },
+ contentColor = { MaterialTheme.colorScheme.onSurfaceVariant }
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ @Test
+ fun allows_custom_unchecked_disabled_content_override() {
+ val override = Color.Green
+
+ rule.verifyTextToggleButtonColors(
+ status = Status.Disabled,
+ checked = false,
+ colors = {
+ TextButtonDefaults.textToggleButtonColors(
+ // Apply the content color override for the content alpha to be applied
+ uncheckedContentColor = override
+ )
+ },
+ contentColor = { override },
+ containerColor = { MaterialTheme.colorScheme.surface }
+ )
+ }
+
+ @Test
+ fun default_role_checkbox() {
+
+ rule.setContentWithTheme {
+ TextToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ enabled = false,
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG)
+ )
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ Role.Checkbox
+ )
+ )
+ }
+
+ @Test
+ fun allows_custom_role() {
+ val overrideRole = Role.Button
+
+ rule.setContentWithTheme {
+ TextToggleButton(
+ checked = false,
+ onCheckedChange = {},
+ enabled = true,
+ content = { Text("ABC") },
+ modifier = Modifier.testTag(TEST_TAG).semantics { role = overrideRole }
+ )
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ overrideRole
+ )
+ )
+ }
+
+ @Composable
+ private fun shapeColor(): Color {
+ return TextButtonDefaults.textToggleButtonColors().containerColor(
+ enabled = true,
+ checked = true
+ ).value
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.verifyTextToggleButtonColors(
+ status: Status,
+ checked: Boolean,
+ colors: @Composable () -> ToggleButtonColors,
+ containerColor: @Composable () -> Color,
+ contentColor: @Composable () -> Color,
+ ) {
+ verifyColors(
+ status = status,
+ expectedContainerColor = containerColor,
+ expectedContentColor = contentColor,
+ content = {
+ var actualContentColor = Color.Transparent
+ TextToggleButton(
+ onCheckedChange = { },
+ enabled = status.enabled(),
+ checked = checked,
+ colors = colors(),
+ modifier = Modifier.testTag(TEST_TAG),
+ ) {
+ actualContentColor = LocalContentColor.current
+ }
+ return@verifyColors actualContentColor
+ }
+ )
+ }
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.isShape(
+ shape: Shape = CircleShape,
+ layoutDirection: LayoutDirection,
+ padding: Dp = 0.dp,
+ backgroundColor: Color = Color.Red,
+ shapeColorComposable: @Composable () -> Color,
+ content: @Composable () -> Unit
+ ) {
+ var shapeColor = Color.Transparent
+ setContentWithTheme {
+ shapeColor = shapeColorComposable.invoke()
+ CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
+ Box(
+ Modifier
+ .padding(padding)
+ .background(backgroundColor)
+ ) {
+ content()
+ }
+ }
+ }
+
+ this.waitForIdle()
+ onNodeWithTag(TEST_TAG)
+ .captureToImage()
+ .assertShape(
+ density = density,
+ shape = shape,
+ horizontalPadding = padding,
+ verticalPadding = padding,
+ backgroundColor = backgroundColor,
+ shapeOverlapPixelCount = 2.0f,
+ shapeColor = shapeColor
+ )
+ }
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ private fun ComposeContentTestRule.verifyColors(
+ status: Status,
+ expectedContainerColor: @Composable () -> Color,
+ expectedContentColor: @Composable () -> Color,
+ applyAlphaForDisabled: Boolean = true,
+ content: @Composable () -> Color
+ ) {
+ val testBackgroundColor = Color.White
+ var finalExpectedContainerColor = Color.Transparent
+ var finalExpectedContent = Color.Transparent
+ var actualContentColor = Color.Transparent
+ setContentWithTheme {
+ finalExpectedContainerColor =
+ if (status.enabled() || !applyAlphaForDisabled) {
+ expectedContainerColor()
+ } else {
+ expectedContainerColor().copy(ContentAlpha.disabled)
+ }.compositeOver(testBackgroundColor)
+ finalExpectedContent =
+ if (status.enabled() || !applyAlphaForDisabled) {
+ expectedContentColor()
+ } else {
+ expectedContentColor().copy(ContentAlpha.disabled)
+ }
+ Box(
+ Modifier
+ .fillMaxSize()
+ .background(testBackgroundColor)
+ ) {
+ actualContentColor = content()
+ }
+ }
+ Assert.assertEquals(finalExpectedContent, actualContentColor)
+ onNodeWithTag(TEST_TAG)
+ .captureToImage()
+ .assertContainsColor(finalExpectedContainerColor)
+ }
+
+ private fun ComposeContentTestRule.verifyActualSize(
+ expectedSize: Dp,
+ content: @Composable (modifier: Modifier) -> Unit
+ ) {
+ setContentWithTheme {
+ content(Modifier.testTag(TEST_TAG))
+ }
+ waitForIdle()
+
+ onNodeWithTag(TEST_TAG)
+ .assertHeightIsEqualTo(expectedSize)
+ .assertWidthIsEqualTo(expectedSize)
+ }
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
index b9545cf..e44ef5b 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
@@ -579,4 +579,4 @@
result = 31 * result + titleColor.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ColorScheme.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ColorScheme.kt
index 1ee0789..b0c3bbb 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ColorScheme.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ColorScheme.kt
@@ -24,6 +24,8 @@
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.takeOrElse
+import androidx.wear.compose.material3.tokens.ColorSchemeKeyTokens
+import androidx.wear.compose.material3.tokens.ColorTokens
/**
* A [ColorScheme] holds all the named color parameters for a [MaterialTheme].
@@ -77,32 +79,32 @@
* @property onError Color used for text and icons displayed on top of the error color.
*/@Stable
public class ColorScheme(
- primary: Color = Color(0xFFD3E3FD),
- primaryDim: Color = Color(0xFFA8C7FA),
- primaryContainer: Color = Color(0xFF04409F),
- onPrimary: Color = Color(0xFF001944),
- onPrimaryContainer: Color = Color(0xFFD3E3FD),
- secondary: Color = Color(0xFFC2E7FF),
- secondaryDim: Color = Color(0xFF7FCFFF),
- secondaryContainer: Color = Color(0xFF004A77),
- onSecondary: Color = Color(0xFF001D35),
- onSecondaryContainer: Color = Color(0xFFC2E7FF),
- tertiary: Color = Color(0xFFC3EDCF),
- tertiaryDim: Color = Color(0xFF73DC92),
- tertiaryContainer: Color = Color(0xFF0F5223),
- onTertiary: Color = Color(0xFF02210C),
- onTertiaryContainer: Color = Color(0xFFC3EDCF),
- surfaceDim: Color = Color(0xFF252626),
- surface: Color = Color(0xFF303030),
- surfaceBright: Color = Color(0xFF474747),
- onSurface: Color = Color(0xFFF2F2F2),
- onSurfaceVariant: Color = Color(0xFFC4C7C5),
- outline: Color = Color(0xFF8E918F),
- outlineVariant: Color = Color(0xFF5C5F5E),
- background: Color = Color.Black,
- onBackground: Color = Color(0xFFFFFFFF),
- error: Color = Color(0xFFFD7267),
- onError: Color = Color(0xFF410002),
+ primary: Color = ColorTokens.Primary,
+ primaryDim: Color = ColorTokens.PrimaryDim,
+ primaryContainer: Color = ColorTokens.PrimaryContainer,
+ onPrimary: Color = ColorTokens.OnPrimary,
+ onPrimaryContainer: Color = ColorTokens.OnPrimaryContainer,
+ secondary: Color = ColorTokens.Secondary,
+ secondaryDim: Color = ColorTokens.SecondaryDim,
+ secondaryContainer: Color = ColorTokens.SecondaryContainer,
+ onSecondary: Color = ColorTokens.OnSecondary,
+ onSecondaryContainer: Color = ColorTokens.OnSecondaryContainer,
+ tertiary: Color = ColorTokens.Tertiary,
+ tertiaryDim: Color = ColorTokens.TertiaryDim,
+ tertiaryContainer: Color = ColorTokens.TertiaryContainer,
+ onTertiary: Color = ColorTokens.OnTertiary,
+ onTertiaryContainer: Color = ColorTokens.OnTertiaryContainer,
+ surfaceDim: Color = ColorTokens.SurfaceDim,
+ surface: Color = ColorTokens.Surface,
+ surfaceBright: Color = ColorTokens.SurfaceBright,
+ onSurface: Color = ColorTokens.OnSurface,
+ onSurfaceVariant: Color = ColorTokens.OnSurfaceVariant,
+ outline: Color = ColorTokens.Outline,
+ outlineVariant: Color = ColorTokens.OutlineVariant,
+ background: Color = ColorTokens.Background,
+ onBackground: Color = ColorTokens.OnBackground,
+ error: Color = ColorTokens.Error,
+ onError: Color = ColorTokens.OnError,
) {
/**
* [primary] is the main color used across screens and components
@@ -414,11 +416,11 @@
/**
* Updates the internal values of the given [ColorScheme] with values from the [other] [ColorScheme]. This
* allows efficiently updating a subset of [ColorScheme], without recomposing every composable that
- * consumes values from [LocalColors].
+ * consumes values from [LocalColorScheme].
*
* Because [ColorScheme] is very wide-reaching, and used by many expensive composables in the
- * hierarchy, providing a new value to [LocalColors] causes every composable consuming
- * [LocalColors] to recompose, which is prohibitively expensive in cases such as animating one
+ * hierarchy, providing a new value to [LocalColorScheme] causes every composable consuming
+ * [LocalColorScheme] to recompose, which is prohibitively expensive in cases such as animating one
* color in the theme. Instead, [ColorScheme] is internally backed by [mutableStateOf], and this
* function mutates the internal state of [this] to match values in [other]. This means that any
* changes will mutate the internal state of [this], and only cause composables that are reading
@@ -453,7 +455,43 @@
onError = other.onError
}
-internal val LocalColors = staticCompositionLocalOf<ColorScheme> { ColorScheme() }
+/**
+ * Helper function for component color tokens. Here is an example on how to use component color
+ * tokens:
+ * ``MaterialTheme.colorScheme.fromToken(FilledButtonTokens.ContainerColor)``
+ */
+internal fun ColorScheme.fromToken(value: ColorSchemeKeyTokens): Color {
+ return when (value) {
+ ColorSchemeKeyTokens.Primary -> primary
+ ColorSchemeKeyTokens.PrimaryDim -> primaryDim
+ ColorSchemeKeyTokens.PrimaryContainer -> primaryContainer
+ ColorSchemeKeyTokens.OnPrimary -> onPrimary
+ ColorSchemeKeyTokens.OnPrimaryContainer -> onPrimaryContainer
+ ColorSchemeKeyTokens.Secondary -> secondary
+ ColorSchemeKeyTokens.SecondaryDim -> secondaryDim
+ ColorSchemeKeyTokens.SecondaryContainer -> secondaryContainer
+ ColorSchemeKeyTokens.OnSecondary -> onSecondary
+ ColorSchemeKeyTokens.OnSecondaryContainer -> onSecondaryContainer
+ ColorSchemeKeyTokens.Tertiary -> tertiary
+ ColorSchemeKeyTokens.TertiaryDim -> tertiaryDim
+ ColorSchemeKeyTokens.TertiaryContainer -> tertiaryContainer
+ ColorSchemeKeyTokens.OnTertiary -> onTertiary
+ ColorSchemeKeyTokens.OnTertiaryContainer -> onTertiaryContainer
+ ColorSchemeKeyTokens.SurfaceDim -> surfaceDim
+ ColorSchemeKeyTokens.Surface -> surface
+ ColorSchemeKeyTokens.SurfaceBright -> surfaceBright
+ ColorSchemeKeyTokens.OnSurface -> onSurface
+ ColorSchemeKeyTokens.OnSurfaceVariant -> onSurfaceVariant
+ ColorSchemeKeyTokens.Outline -> outline
+ ColorSchemeKeyTokens.OutlineVariant -> outlineVariant
+ ColorSchemeKeyTokens.Background -> background
+ ColorSchemeKeyTokens.OnBackground -> onBackground
+ ColorSchemeKeyTokens.Error -> error
+ ColorSchemeKeyTokens.OnError -> onError
+ }
+}
+
+internal val LocalColorScheme = staticCompositionLocalOf<ColorScheme> { ColorScheme() }
/**
* Convert given color to disabled color.
@@ -462,3 +500,10 @@
@Composable
internal fun Color.toDisabledColor(disabledAlpha: Float = ContentAlpha.disabled) =
this.copy(alpha = this.alpha * disabledAlpha)
+
+/** Converts a color token key to the local color scheme provided by the theme */
+@ReadOnlyComposable
+@Composable
+internal fun ColorSchemeKeyTokens.toColor(): Color {
+ return MaterialTheme.colorScheme.fromToken(this)
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/CurvedText.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/CurvedText.kt
index b4d0231..4ef124d 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/CurvedText.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/CurvedText.kt
@@ -117,4 +117,4 @@
background = background
)
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ExperimentalWearMaterial3Api.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ExperimentalWearMaterial3Api.kt
index 1d369e6..ae398ea 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ExperimentalWearMaterial3Api.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ExperimentalWearMaterial3Api.kt
@@ -21,4 +21,4 @@
" the future."
)
@Retention(AnnotationRetention.BINARY)
-annotation class ExperimentalWearMaterial3Api
\ No newline at end of file
+annotation class ExperimentalWearMaterial3Api
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Icon.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Icon.kt
index 2113a27..601354f 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Icon.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Icon.kt
@@ -109,4 +109,4 @@
tint = tint,
modifier = modifier
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
index 0195c9d..042f777 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
@@ -252,6 +252,76 @@
) = IconButton(onClick, modifier, enabled, shape, colors, border, interactionSource, content)
/**
+ * Wear Material [IconToggleButton] is a filled icon toggle button which switches between primary
+ * colors and tonal colors depending on [checked] value, and offers a single slot for
+ * icon or image.
+ *
+ * Set the size of the [IconToggleButton] with Modifier.[touchTargetAwareSize]
+ * to ensure that the background padding will correctly reach the edge of the minimum touch target.
+ * The recommended text button sizes are [IconButtonDefaults.DefaultButtonSize],
+ * [IconButtonDefaults.LargeButtonSize], [IconButtonDefaults.SmallButtonSize] and
+ * [IconButtonDefaults.ExtraSmallButtonSize].
+ *
+ * Use [IconButtonDefaults.iconSizeFor] to determine the icon size for a
+ * given [IconToggleButton] size, or refer to icon sizes
+ * [IconButtonDefaults.SmallIconSize], [IconButtonDefaults.DefaultIconSize],
+ * [IconButtonDefaults.LargeIconSize] directly.
+ *
+ * [IconToggleButton] can be enabled or disabled. A disabled button will not respond to
+ * click events. When enabled, the checked and unchecked events are propagated by [onCheckedChange].
+ *
+ * A simple icon toggle button using the default colors
+ * @sample androidx.wear.compose.material3.samples.IconToggleButtonSample
+ *
+ * @param checked Boolean flag indicating whether this toggle button is currently checked.
+ * @param onCheckedChange Callback to be invoked when this toggle button is clicked.
+ * @param modifier Modifier to be applied to the toggle button.
+ * @param enabled Controls the enabled state of the toggle button. When `false`,
+ * this toggle button will not be clickable.
+ * @param colors [ToggleButtonColors] that will be used to resolve the container and
+ * content color for this toggle button.
+ * @param interactionSource The [MutableInteractionSource] representing the stream of
+ * [Interaction]s for this toggle button. You can create and pass in your own remembered
+ * [MutableInteractionSource] if you want to observe [Interaction]s and customize the
+ * appearance / behavior of this ToggleButton in different [Interaction]s.
+ * @param shape Defines the shape for this toggle button. It is strongly recommended to use the
+ * default as this shape is a key characteristic of the Wear Material 3 Theme.
+ * @param border Optional [BorderStroke] for the [IconToggleButton].
+ * @param content The content to be drawn inside the toggle button.
+ */
+@Composable
+fun IconToggleButton(
+ checked: Boolean,
+ onCheckedChange: (Boolean) -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ colors: ToggleButtonColors = IconButtonDefaults.iconToggleButtonColors(),
+ interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
+ shape: Shape = CircleShape,
+ border: BorderStroke? = null,
+ content: @Composable BoxScope.() -> Unit,
+) {
+ androidx.wear.compose.materialcore.ToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ modifier = modifier.minimumInteractiveComponentSize(),
+ enabled = enabled,
+ backgroundColor = { isEnabled, isChecked ->
+ colors.containerColor(enabled = isEnabled, checked = isChecked)
+ },
+ border = { _, _ -> rememberUpdatedState(newValue = border) },
+ toggleButtonSize = IconButtonDefaults.DefaultButtonSize,
+ interactionSource = interactionSource,
+ shape = shape,
+ content = provideScopeContent(
+ colors.contentColor(enabled = enabled, checked = checked),
+ MaterialTheme.typography.buttonMedium,
+ content
+ )
+ )
+}
+
+/**
* Contains the default values used by [IconButton].
*/
object IconButtonDefaults {
@@ -357,6 +427,52 @@
)
/**
+ * Creates a [ToggleButtonColors] for a [IconToggleButton]
+ * - by default, a colored background with a contrasting content color.
+ * If the button is disabled, then the colors will have an alpha
+ * ([ContentAlpha.disabled]) value applied.
+ *
+ * @param checkedContainerColor The container color of this [IconToggleButton] when enabled
+ * and checked
+ * @param checkedContentColor The content color of this [IconToggleButton] when enabled and
+ * checked
+ * @param uncheckedContainerColor The container color of this [IconToggleButton] when enabled
+ * and unchecked
+ * @param uncheckedContentColor The content color of this [IconToggleButton] when enabled and
+ * unchecked
+ * @param disabledCheckedContainerColor The container color of this [IconToggleButton] when
+ * checked and not enabled
+ * @param disabledCheckedContentColor The content color of this [IconToggleButton] when checked
+ * and not enabled
+ * @param disabledUncheckedContainerColor The container color of this [IconToggleButton] when
+ * unchecked and not enabled
+ * @param disabledUncheckedContentColor The content color of this [IconToggleButton] when
+ * unchecked and not enabled
+ */
+ @Composable
+ fun iconToggleButtonColors(
+ checkedContainerColor: Color = MaterialTheme.colorScheme.primary,
+ checkedContentColor: Color = MaterialTheme.colorScheme.onPrimary,
+ uncheckedContainerColor: Color = MaterialTheme.colorScheme.surface,
+ uncheckedContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
+ disabledCheckedContainerColor: Color = checkedContainerColor.toDisabledColor(),
+ disabledCheckedContentColor: Color = checkedContentColor.toDisabledColor(),
+ disabledUncheckedContainerColor: Color = uncheckedContainerColor.toDisabledColor(),
+ disabledUncheckedContentColor: Color = uncheckedContentColor.toDisabledColor(),
+ ): ToggleButtonColors {
+ return ToggleButtonColors(
+ checkedContainerColor = checkedContainerColor,
+ checkedContentColor = checkedContentColor,
+ uncheckedContainerColor = uncheckedContainerColor,
+ uncheckedContentColor = uncheckedContentColor,
+ disabledCheckedContainerColor = disabledCheckedContainerColor,
+ disabledCheckedContentColor = disabledCheckedContentColor,
+ disabledUncheckedContainerColor = disabledUncheckedContainerColor,
+ disabledUncheckedContentColor = disabledUncheckedContentColor,
+ )
+ }
+
+ /**
* The recommended size of an icon when used inside an icon button with size
* [SmallButtonSize] or [ExtraSmallButtonSize].
* Use [iconSizeFor] to easily determine the icon size.
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ListHeader.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ListHeader.kt
index f680518..90c2caa 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ListHeader.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ListHeader.kt
@@ -54,7 +54,7 @@
* @param content Slot for [ListHeader] content, expected to be a single line of text.
*/
@Composable
-public fun ListHeader(
+fun ListHeader(
modifier: Modifier = Modifier,
backgroundColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -67,7 +67,7 @@
.wrapContentSize()
.background(backgroundColor)
.padding(contentPadding)
- .semantics { heading() }
+ .semantics(mergeDescendants = true) { heading() }
) {
CompositionLocalProvider(
LocalContentColor provides contentColor,
@@ -100,7 +100,7 @@
* @param label A slot for providing label to the [ListSubheader].
*/
@Composable
-public fun ListSubheader(
+fun ListSubheader(
modifier: Modifier = Modifier,
backgroundColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
@@ -115,7 +115,7 @@
.wrapContentSize()
.background(backgroundColor)
.padding(contentPadding)
- .semantics { heading() }
+ .semantics(mergeDescendants = true) { heading() }
) {
CompositionLocalProvider(
LocalContentColor provides contentColor,
@@ -152,4 +152,4 @@
HORIZONTAL_PADDING,
SUBHEADER_BOTTOM_PADDING
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/MaterialTheme.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/MaterialTheme.kt
index 4a3bdb1..cea4edb 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/MaterialTheme.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/MaterialTheme.kt
@@ -69,7 +69,7 @@
val rippleIndication = rememberRipple()
val selectionColors = rememberTextSelectionColors(rememberedColors)
CompositionLocalProvider(
- LocalColors provides rememberedColors,
+ LocalColorScheme provides rememberedColors,
LocalShapes provides shapes,
LocalTypography provides typography,
LocalContentAlpha provides ContentAlpha.high,
@@ -87,7 +87,7 @@
public val colorScheme: ColorScheme
@ReadOnlyComposable
@Composable
- get() = LocalColors.current
+ get() = LocalColorScheme.current
public val typography: Typography
@ReadOnlyComposable
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
index d318e17..f2d76f6 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Shapes.kt
@@ -15,13 +15,16 @@
*/
package androidx.wear.compose.material3
+import androidx.compose.foundation.shape.CornerBasedShape
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
+import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.staticCompositionLocalOf
-import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
-import androidx.compose.ui.unit.dp
+import androidx.wear.compose.material3.tokens.ShapeKeyTokens
+import androidx.wear.compose.material3.tokens.ShapeTokens
/**
* Material surfaces can be displayed in different shapes. Shapes direct attention, identify
@@ -31,22 +34,20 @@
* curved shapes (mostly polygonal). The default [Shapes] theme for Material3 is rounded rectangles,
* with various degrees of corner roundness:
*
- * - None
* - Extra Small
* - Small
* - Medium
* - Large
- * - Full
+ * - Extra Large
*
* You can customize the shape system for all components in the [MaterialTheme] or you can do it
* on a per component basis by overriding the shape parameter for that
- * component. For example, by default, buttons use the shape style “full.” If your product requires
+ * component. For example, by default, buttons use the shape style "large". If your product requires
* a smaller amount of roundness, you can override the shape parameter with a different shape
* value like [Shapes.small].
*
* TODO(b/273226734) Review documentation with references to components that use the shape themes.
*
- * @param none By default, provides [ShapeDefaults.None], which is [RectangleShape]
* @param extraSmall By default, provides [ShapeDefaults.ExtraSmall], a [RoundedCornerShape]
* with 4dp [CornerSize] (used by bundled Cards).
* @param small By default, provides [ShapeDefaults.Small], a [RoundedCornerShape]
@@ -57,71 +58,57 @@
* with 24dp [CornerSize] (used by Cards).
* @param extraLarge By default, provides [ShapeDefaults.ExtraLarge], a
* [RoundedCornerShape] with 32dp [CornerSize].
- * @param full By default, provides [ShapeDefaults.Full], a Stadium shape with
- * 50% rounded [CornerSize] (used by Button).
*/
@Immutable
class Shapes(
- val none: Shape = ShapeDefaults.None,
- val extraSmall: Shape = ShapeDefaults.ExtraSmall,
- val small: Shape = ShapeDefaults.Small,
- val medium: Shape = ShapeDefaults.Medium,
- val large: Shape = ShapeDefaults.Large,
- val extraLarge: Shape = ShapeDefaults.ExtraLarge,
- val full: Shape = ShapeDefaults.Full,
+ val extraSmall: CornerBasedShape = ShapeDefaults.ExtraSmall,
+ val small: CornerBasedShape = ShapeDefaults.Small,
+ val medium: CornerBasedShape = ShapeDefaults.Medium,
+ val large: CornerBasedShape = ShapeDefaults.Large,
+ val extraLarge: CornerBasedShape = ShapeDefaults.ExtraLarge,
) {
/** Returns a copy of this Shapes, optionally overriding some of the values. */
fun copy(
- none: Shape = this.none,
- extraSmall: Shape = this.extraSmall,
- small: Shape = this.small,
- medium: Shape = this.medium,
- large: Shape = this.large,
- extraLarge: Shape = this.extraLarge,
- full: Shape = this.full
+ extraSmall: CornerBasedShape = this.extraSmall,
+ small: CornerBasedShape = this.small,
+ medium: CornerBasedShape = this.medium,
+ large: CornerBasedShape = this.large,
+ extraLarge: CornerBasedShape = this.extraLarge,
): Shapes = Shapes(
- none = none,
extraSmall = extraSmall,
small = small,
medium = medium,
large = large,
extraLarge = extraLarge,
- full = full,
)
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Shapes) return false
- if (none != other.none) return false
if (extraSmall != other.extraSmall) return false
if (small != other.small) return false
if (medium != other.medium) return false
if (large != other.large) return false
if (extraLarge != other.extraLarge) return false
- if (full != other.full) return false
return true
}
override fun hashCode(): Int {
- var result = none.hashCode()
- result = 31 * result + extraSmall.hashCode()
+ var result = extraSmall.hashCode()
result = 31 * result + small.hashCode()
result = 31 * result + medium.hashCode()
result = 31 * result + large.hashCode()
result = 31 * result + extraLarge.hashCode()
- result = 31 * result + full.hashCode()
return result
}
override fun toString(): String {
return "Shapes(" +
- "none=$none, " +
"extraSmall=$extraSmall, " +
"small=$small, " +
"medium=$medium, " +
"large=$large, " +
- "extraLarge=$extraLarge, " +
- "full=$full)"
+ "extraLarge=$extraLarge)"
}
}
@@ -129,26 +116,45 @@
* Contains the default values used by [Shapes]
*/
object ShapeDefaults {
- /** None provides a RectangleShape */
- val None = RectangleShape
/** Extra small sized corner shape */
- val ExtraSmall = RoundedCornerShape(corner = CornerSize(4.dp))
+ val ExtraSmall = ShapeTokens.CornerExtraSmall
/** Small sized corner shape */
- val Small = RoundedCornerShape(corner = CornerSize(8.dp))
+ val Small = ShapeTokens.CornerSmall
/** Medium sized corner shape */
- val Medium = RoundedCornerShape(corner = CornerSize(16.dp))
+ val Medium = ShapeTokens.CornerMedium
/** Large sized corner shape */
- val Large = RoundedCornerShape(corner = CornerSize(26.dp))
+ val Large = ShapeTokens.CornerLarge
/** Extra large sized corner shape */
- val ExtraLarge = RoundedCornerShape(corner = CornerSize(32.dp))
+ val ExtraLarge = ShapeTokens.CornerExtraLarge
+}
- /** Full provides a stadium-shape with 50% rounded corners */
- val Full = RoundedCornerShape(corner = CornerSize(50))
+/**
+ * Helper function for component shape tokens. Here is an example on how to use component color
+ * tokens:
+ * ``MaterialTheme.shapes.fromToken(FabPrimarySmallTokens.ContainerShape)``
+ */
+internal fun Shapes.fromToken(value: ShapeKeyTokens): Shape {
+ return when (value) {
+ ShapeKeyTokens.CornerExtraSmall -> extraSmall
+ ShapeKeyTokens.CornerSmall -> small
+ ShapeKeyTokens.CornerMedium -> medium
+ ShapeKeyTokens.CornerLarge -> large
+ ShapeKeyTokens.CornerExtraLarge -> extraLarge
+ ShapeKeyTokens.CornerFull -> ShapeTokens.CornerFull
+ ShapeKeyTokens.CornerNone -> ShapeTokens.CornerNone
+ }
+}
+
+/** Converts a shape token key to the local shape provided by the theme */
+@Composable
+@ReadOnlyComposable
+internal fun ShapeKeyTokens.toShape(): Shape {
+ return MaterialTheme.shapes.fromToken(this)
}
/** CompositionLocal used to specify the default shapes for the surfaces. */
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
index cfe19ea..d6a155f 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
@@ -28,6 +28,7 @@
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.ripple.rememberRipple
@@ -122,7 +123,7 @@
value, enabled, onValueChange, valueRange, steps
)
.height(InlineSliderDefaults.SliderHeight)
- .clip(MaterialTheme.shapes.full)
+ .clip(CircleShape) // TODO(b/290625297) Replace with tokens
) {
val visibleSegments = if (segmented) steps + 1 else 1
@@ -172,7 +173,7 @@
modifier = Modifier
.height(InlineSliderDefaults.BarHeight)
.weight(1f)
- .clip(MaterialTheme.shapes.full)
+ .clip(CircleShape) // TODO(b/290625297) Replace with token
.drawProgressBar(
selectedBarColor = selectedBarColor,
unselectedBarColor = unselectedBarColor,
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
index fefc897..f3d2722 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
@@ -102,6 +102,71 @@
}
/**
+ * Wear Material [TextToggleButton] is a filled text toggle button which switches between primary
+ * colors and tonal colors depending on [checked] value, and offers a single slot for
+ * text.
+ *
+ * Set the size of the [TextToggleButton] with Modifier.[touchTargetAwareSize]
+ * to ensure that the background padding will correctly reach the edge of the minimum touch target.
+ * The recommended text button sizes are [TextButtonDefaults.DefaultButtonSize],
+ * [TextButtonDefaults.LargeButtonSize], [TextButtonDefaults.SmallButtonSize] and
+ * [TextButtonDefaults.ExtraSmallButtonSize].
+ *
+ * [TextToggleButton] can be enabled or disabled. A disabled button will not respond to
+ * click events. When enabled, the checked and unchecked events are propagated by [onCheckedChange].
+ *
+ * A simple text toggle button using the default colors
+ * @sample androidx.wear.compose.material3.samples.TextToggleButtonSample
+ *
+ * @param checked Boolean flag indicating whether this toggle button is currently checked.
+ * @param onCheckedChange Callback to be invoked when this toggle button is clicked.
+ * @param modifier Modifier to be applied to the toggle button.
+ * @param enabled Controls the enabled state of the toggle button. When `false`,
+ * this toggle button will not be clickable.
+ * @param colors [ToggleButtonColors] that will be used to resolve the container and
+ * content color for this toggle button.
+ * @param interactionSource The [MutableInteractionSource] representing the stream of
+ * [Interaction]s for this toggle button. You can create and pass in your own remembered
+ * [MutableInteractionSource] if you want to observe [Interaction]s and customize the
+ * appearance / behavior of this ToggleButton in different [Interaction]s.
+ * @param shape Defines the shape for this toggle button. It is strongly recommended to use the
+ * default as this shape is a key characteristic of the Wear Material 3 Theme.
+ * @param border Optional [BorderStroke] for the [TextToggleButton].
+ * @param content The text to be drawn inside the toggle button.
+ */
+@Composable
+public fun TextToggleButton(
+ checked: Boolean,
+ onCheckedChange: (Boolean) -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ colors: ToggleButtonColors = TextButtonDefaults.textToggleButtonColors(),
+ interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
+ shape: Shape = CircleShape,
+ border: BorderStroke? = null,
+ content: @Composable BoxScope.() -> Unit,
+) {
+ androidx.wear.compose.materialcore.ToggleButton(
+ checked = checked,
+ onCheckedChange = onCheckedChange,
+ modifier = modifier.minimumInteractiveComponentSize(),
+ enabled = enabled,
+ backgroundColor = { isEnabled, isChecked ->
+ colors.containerColor(enabled = isEnabled, checked = isChecked)
+ },
+ border = { _, _ -> rememberUpdatedState(border) },
+ toggleButtonSize = TextButtonDefaults.DefaultButtonSize,
+ interactionSource = interactionSource,
+ shape = shape,
+ content = provideScopeContent(
+ colors.contentColor(enabled = enabled, checked = checked),
+ MaterialTheme.typography.buttonMedium,
+ content
+ )
+ )
+}
+
+/**
* Contains the default values used by [TextButton].
*/
object TextButtonDefaults {
@@ -203,6 +268,52 @@
)
/**
+ * Creates a [ToggleButtonColors] for a [TextToggleButton]
+ * - by default, a colored background with a contrasting content color.
+ * If the button is disabled, then the
+ * colors will have an alpha ([ContentAlpha.disabled]) value applied.
+ *
+ * @param checkedContainerColor the container color of this [TextToggleButton] when enabled
+ * and checked
+ * @param checkedContentColor the content color of this [TextToggleButton] when enabled and
+ * checked
+ * @param uncheckedContainerColor the container color of this [TextToggleButton] when enabled
+ * and unchecked
+ * @param uncheckedContentColor the content color of this [TextToggleButton] when enabled and
+ * unchecked
+ * @param disabledCheckedContainerColor the container color of this [TextToggleButton] when
+ * checked and not enabled
+ * @param disabledCheckedContentColor the content color of this [TextToggleButton] when checked
+ * and not enabled
+ * @param disabledUncheckedContainerColor the container color of this [TextToggleButton] when
+ * unchecked and not enabled
+ * @param disabledUncheckedContentColor the content color of this [TextToggleButton] when
+ * unchecked and not enabled
+ */
+ @Composable
+ public fun textToggleButtonColors(
+ checkedContainerColor: Color = MaterialTheme.colorScheme.primary,
+ checkedContentColor: Color = MaterialTheme.colorScheme.onPrimary,
+ uncheckedContainerColor: Color = MaterialTheme.colorScheme.surface,
+ uncheckedContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
+ disabledCheckedContainerColor: Color = checkedContainerColor.toDisabledColor(),
+ disabledCheckedContentColor: Color = checkedContentColor.toDisabledColor(),
+ disabledUncheckedContainerColor: Color = uncheckedContainerColor.toDisabledColor(),
+ disabledUncheckedContentColor: Color = uncheckedContentColor.toDisabledColor(),
+ ): ToggleButtonColors {
+ return ToggleButtonColors(
+ checkedContainerColor = checkedContainerColor,
+ checkedContentColor = checkedContentColor,
+ uncheckedContainerColor = uncheckedContainerColor,
+ uncheckedContentColor = uncheckedContentColor,
+ disabledCheckedContainerColor = disabledCheckedContainerColor,
+ disabledCheckedContentColor = disabledCheckedContentColor,
+ disabledUncheckedContainerColor = disabledUncheckedContainerColor,
+ disabledUncheckedContentColor = disabledUncheckedContentColor,
+ )
+ }
+
+ /**
* The recommended background size of an extra small, compact button.
* It is recommended to apply this size using [Modifier.touchTargetAwareSize].
*/
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButtonColors.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButtonColors.kt
new file mode 100644
index 0000000..c83f367
--- /dev/null
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButtonColors.kt
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.wear.compose.material3
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.Immutable
+import androidx.compose.runtime.State
+import androidx.compose.runtime.rememberUpdatedState
+import androidx.compose.ui.graphics.Color
+
+/**
+ * Represents the different container and content colors used for toggle buttons
+ * ([IconToggleButton] and [TextToggleButton]) in various states, that are checked, unchecked,
+ * enabled and disabled.
+ */
+@Immutable
+public class ToggleButtonColors public constructor(
+ val checkedContainerColor: Color,
+ val checkedContentColor: Color,
+ val uncheckedContainerColor: Color,
+ val uncheckedContentColor: Color,
+ val disabledCheckedContainerColor: Color,
+ val disabledCheckedContentColor: Color,
+ val disabledUncheckedContainerColor: Color,
+ val disabledUncheckedContentColor: Color,
+) {
+
+ /**
+ * Determines the container color based on whether the toggle button is [enabled]
+ * and [checked].
+ *
+ * @param enabled Whether the toggle button is enabled
+ * @param checked Whether the toggle button is checked
+ */
+ @Composable
+ fun containerColor(enabled: Boolean, checked: Boolean): State<Color> {
+ return rememberUpdatedState(
+ if (enabled) {
+ if (checked) checkedContainerColor else uncheckedContainerColor
+ } else {
+ if (checked) disabledCheckedContainerColor else disabledUncheckedContainerColor
+ }
+ )
+ }
+
+ /**
+ * Determines the content color based on whether the toggle button is [enabled]
+ * and [checked].
+ *
+ * @param enabled Whether the toggle button is enabled
+ * @param checked Whether the toggle button is checked
+ */
+ @Composable
+ fun contentColor(enabled: Boolean, checked: Boolean): State<Color> {
+ return rememberUpdatedState(
+ if (enabled) {
+ if (checked) checkedContentColor else uncheckedContentColor
+ } else {
+ if (checked) disabledCheckedContentColor else disabledUncheckedContentColor
+ }
+ )
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null) return false
+ if (this::class != other::class) return false
+
+ other as ToggleButtonColors
+
+ if (checkedContainerColor != other.checkedContainerColor) return false
+ if (checkedContentColor != other.checkedContentColor) return false
+ if (uncheckedContainerColor != other.uncheckedContainerColor) return false
+ if (uncheckedContentColor != other.uncheckedContentColor) return false
+ if (disabledCheckedContainerColor != other.disabledCheckedContainerColor) return false
+ if (disabledCheckedContentColor != other.disabledCheckedContentColor) return false
+ if (disabledUncheckedContainerColor != other.disabledUncheckedContainerColor) return false
+ if (disabledUncheckedContentColor != other.disabledUncheckedContentColor) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = checkedContainerColor.hashCode()
+ result = 31 * result + checkedContentColor.hashCode()
+ result = 31 * result + uncheckedContainerColor.hashCode()
+ result = 31 * result + uncheckedContentColor.hashCode()
+ result = 31 * result + disabledCheckedContainerColor.hashCode()
+ result = 31 * result + disabledCheckedContentColor.hashCode()
+ result = 31 * result + disabledUncheckedContainerColor.hashCode()
+ result = 31 * result + disabledUncheckedContentColor.hashCode()
+ return result
+ }
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorSchemeKeyTokens.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorSchemeKeyTokens.kt
new file mode 100644
index 0000000..9bbfe57
--- /dev/null
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorSchemeKeyTokens.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// VERSION: v0_7
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.wear.compose.material3.tokens
+
+internal enum class ColorSchemeKeyTokens {
+ Background,
+ Error,
+ OnBackground,
+ OnError,
+ OnPrimary,
+ OnPrimaryContainer,
+ OnSecondary,
+ OnSecondaryContainer,
+ OnSurface,
+ OnSurfaceVariant,
+ OnTertiary,
+ OnTertiaryContainer,
+ Outline,
+ OutlineVariant,
+ Primary,
+ PrimaryContainer,
+ PrimaryDim,
+ Secondary,
+ SecondaryContainer,
+ SecondaryDim,
+ Surface,
+ SurfaceBright,
+ SurfaceDim,
+ Tertiary,
+ TertiaryContainer,
+ TertiaryDim,
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorTokens.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorTokens.kt
new file mode 100644
index 0000000..e3be595
--- /dev/null
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ColorTokens.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// VERSION: v0_8
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.wear.compose.material3.tokens
+
+internal object ColorTokens {
+ val Background = PaletteTokens.Neutral0
+ val Error = PaletteTokens.Error65
+ val OnBackground = PaletteTokens.Neutral100
+ val OnError = PaletteTokens.Error10
+ val OnPrimary = PaletteTokens.Primary10
+ val OnPrimaryContainer = PaletteTokens.Primary90
+ val OnSecondary = PaletteTokens.Secondary10
+ val OnSecondaryContainer = PaletteTokens.Secondary90
+ val OnSurface = PaletteTokens.Neutral95
+ val OnSurfaceVariant = PaletteTokens.NeutralVariant80
+ val OnTertiary = PaletteTokens.Tertiary10
+ val OnTertiaryContainer = PaletteTokens.Tertiary90
+ val Outline = PaletteTokens.NeutralVariant60
+ val OutlineVariant = PaletteTokens.NeutralVariant40
+ val Primary = PaletteTokens.Primary90
+ val PrimaryContainer = PaletteTokens.Primary30
+ val PrimaryDim = PaletteTokens.Primary80
+ val Secondary = PaletteTokens.Secondary90
+ val SecondaryContainer = PaletteTokens.Secondary30
+ val SecondaryDim = PaletteTokens.Secondary80
+ val Surface = PaletteTokens.Neutral20
+ val SurfaceBright = PaletteTokens.Neutral30
+ val SurfaceDim = PaletteTokens.Neutral15
+ val Tertiary = PaletteTokens.Tertiary90
+ val TertiaryContainer = PaletteTokens.Tertiary30
+ val TertiaryDim = PaletteTokens.Tertiary80
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/PaletteTokens.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/PaletteTokens.kt
new file mode 100644
index 0000000..65e3d32
--- /dev/null
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/PaletteTokens.kt
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// VERSION: v0_8
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.wear.compose.material3.tokens
+
+import androidx.compose.ui.graphics.Color
+
+internal object PaletteTokens {
+ val Error0 = Color(red = 0, green = 0, blue = 0)
+ val Error10 = Color(red = 65, green = 0, blue = 2)
+ val Error100 = Color(red = 255, green = 255, blue = 255)
+ val Error20 = Color(red = 104, green = 1, blue = 7)
+ val Error30 = Color(red = 137, green = 29, blue = 26)
+ val Error40 = Color(red = 170, green = 53, blue = 47)
+ val Error50 = Color(red = 203, green = 77, blue = 69)
+ val Error60 = Color(red = 236, green = 102, blue = 91)
+ val Error65 = Color(red = 253, green = 114, blue = 103)
+ val Error70 = Color(red = 255, green = 137, blue = 126)
+ val Error80 = Color(red = 255, green = 180, blue = 172)
+ val Error85 = Color(red = 255, green = 199, blue = 193)
+ val Error90 = Color(red = 255, green = 218, blue = 214)
+ val Error95 = Color(red = 255, green = 237, blue = 234)
+ val Neutral0 = Color(red = 0, green = 0, blue = 0)
+ val Neutral10 = Color(red = 31, green = 31, blue = 31)
+ val Neutral100 = Color(red = 255, green = 255, blue = 255)
+ val Neutral15 = Color(red = 37, green = 38, blue = 38)
+ val Neutral20 = Color(red = 48, green = 48, blue = 48)
+ val Neutral30 = Color(red = 71, green = 71, blue = 71)
+ val Neutral40 = Color(red = 94, green = 94, blue = 94)
+ val Neutral50 = Color(red = 117, green = 117, blue = 117)
+ val Neutral60 = Color(red = 143, green = 143, blue = 143)
+ val Neutral70 = Color(red = 171, green = 171, blue = 171)
+ val Neutral80 = Color(red = 199, green = 199, blue = 199)
+ val Neutral90 = Color(red = 227, green = 227, blue = 227)
+ val Neutral95 = Color(red = 242, green = 242, blue = 242)
+ val NeutralVariant0 = Color(red = 0, green = 0, blue = 0)
+ val NeutralVariant10 = Color(red = 25, green = 29, blue = 28)
+ val NeutralVariant100 = Color(red = 255, green = 255, blue = 255)
+ val NeutralVariant20 = Color(red = 45, green = 49, blue = 47)
+ val NeutralVariant30 = Color(red = 68, green = 71, blue = 70)
+ val NeutralVariant40 = Color(red = 92, green = 95, blue = 94)
+ val NeutralVariant50 = Color(red = 116, green = 119, blue = 117)
+ val NeutralVariant60 = Color(red = 142, green = 145, blue = 143)
+ val NeutralVariant70 = Color(red = 169, green = 172, blue = 170)
+ val NeutralVariant80 = Color(red = 196, green = 199, blue = 197)
+ val NeutralVariant90 = Color(red = 225, green = 227, blue = 225)
+ val NeutralVariant95 = Color(red = 239, green = 242, blue = 239)
+ val Primary0 = Color(red = 0, green = 0, blue = 0)
+ val Primary10 = Color(red = 4, green = 30, blue = 73)
+ val Primary100 = Color(red = 255, green = 255, blue = 255)
+ val Primary20 = Color(red = 4, green = 30, blue = 73)
+ val Primary30 = Color(red = 8, green = 66, blue = 160)
+ val Primary40 = Color(red = 11, green = 87, blue = 208)
+ val Primary50 = Color(red = 27, green = 110, blue = 243)
+ val Primary60 = Color(red = 76, green = 141, blue = 246)
+ val Primary70 = Color(red = 124, green = 172, blue = 248)
+ val Primary80 = Color(red = 168, green = 199, blue = 250)
+ val Primary90 = Color(red = 211, green = 227, blue = 253)
+ val Primary95 = Color(red = 236, green = 243, blue = 254)
+ val Secondary0 = Color(red = 0, green = 0, blue = 0)
+ val Secondary10 = Color(red = 0, green = 29, blue = 53)
+ val Secondary100 = Color(red = 255, green = 255, blue = 255)
+ val Secondary20 = Color(red = 0, green = 51, blue = 85)
+ val Secondary30 = Color(red = 0, green = 51, blue = 85)
+ val Secondary40 = Color(red = 0, green = 99, blue = 155)
+ val Secondary50 = Color(red = 4, green = 125, blue = 183)
+ val Secondary60 = Color(red = 57, green = 152, blue = 211)
+ val Secondary70 = Color(red = 90, green = 179, blue = 240)
+ val Secondary80 = Color(red = 127, green = 207, blue = 255)
+ val Secondary90 = Color(red = 194, green = 231, blue = 255)
+ val Secondary95 = Color(red = 223, green = 243, blue = 255)
+ val Tertiary0 = Color(red = 0, green = 0, blue = 0)
+ val Tertiary10 = Color(red = 7, green = 39, blue = 17)
+ val Tertiary100 = Color(red = 255, green = 255, blue = 255)
+ val Tertiary20 = Color(red = 7, green = 39, blue = 17)
+ val Tertiary30 = Color(red = 15, green = 82, blue = 35)
+ val Tertiary40 = Color(red = 20, green = 108, blue = 46)
+ val Tertiary50 = Color(red = 25, green = 134, blue = 57)
+ val Tertiary60 = Color(red = 30, green = 164, blue = 70)
+ val Tertiary70 = Color(red = 55, green = 190, blue = 95)
+ val Tertiary80 = Color(red = 109, green = 213, blue = 140)
+ val Tertiary90 = Color(red = 196, green = 238, blue = 208)
+ val Tertiary95 = Color(red = 231, green = 248, blue = 237)
+}
diff --git a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeKeyTokens.kt
similarity index 68%
copy from paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
copy to wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeKeyTokens.kt
index 5d73136..0b8f5ed 100644
--- a/paging/paging-common/src/commonMain/kotlin/androidx/paging/annotation.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeKeyTokens.kt
@@ -14,6 +14,17 @@
* limitations under the License.
*/
-package androidx.paging
+// VERSION: v0_7
+// GENERATED CODE - DO NOT MODIFY BY HAND
-public expect annotation class MainThread()
+package androidx.wear.compose.material3.tokens
+
+internal enum class ShapeKeyTokens {
+ CornerExtraLarge,
+ CornerExtraSmall,
+ CornerFull,
+ CornerLarge,
+ CornerMedium,
+ CornerNone,
+ CornerSmall,
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeTokens.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeTokens.kt
new file mode 100644
index 0000000..7a65a84
--- /dev/null
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/tokens/ShapeTokens.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// VERSION: v0_7
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.wear.compose.material3.tokens
+
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.unit.dp
+
+internal object ShapeTokens {
+ val CornerExtraLarge = RoundedCornerShape(36.0.dp)
+ val CornerExtraSmall = RoundedCornerShape(4.0.dp)
+ val CornerFull = CircleShape
+ val CornerLarge = RoundedCornerShape(26.0.dp)
+ val CornerMedium = RoundedCornerShape(16.0.dp)
+ val CornerNone = RectangleShape
+ val CornerSmall = RoundedCornerShape(8.0.dp)
+}
diff --git a/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt b/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
index 377b170..138c202 100644
--- a/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
+++ b/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHost.kt
@@ -427,4 +427,4 @@
}
}
-private const val TAG = "SwipeDismissableNavHost"
\ No newline at end of file
+private const val TAG = "SwipeDismissableNavHost"
diff --git a/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHostController.kt b/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHostController.kt
index 42c64b5..781efde 100644
--- a/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHostController.kt
+++ b/wear/compose/compose-navigation/src/main/java/androidx/wear/compose/navigation/SwipeDismissableNavHostController.kt
@@ -44,4 +44,4 @@
@Composable
public fun NavController.currentBackStackEntryAsState(): State<NavBackStackEntry?> {
return currentBackStackEntryFlow.collectAsState(null)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CardDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CardDemo.kt
index 5aa339c..9af6402 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CardDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CardDemo.kt
@@ -149,4 +149,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ChipDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ChipDemo.kt
index 8835d23..9244802 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ChipDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ChipDemo.kt
@@ -877,4 +877,4 @@
shape = shape,
content = null
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CurvedLayoutDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CurvedLayoutDemo.kt
index a6918ed..041d056 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CurvedLayoutDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/CurvedLayoutDemo.kt
@@ -387,4 +387,4 @@
.clip(CircleShape)
.background(Color.White)
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/DemoApp.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/DemoApp.kt
index d06de43..7e7a1a8 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/DemoApp.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/DemoApp.kt
@@ -23,6 +23,7 @@
import androidx.compose.foundation.gestures.ScrollableState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
@@ -39,8 +40,6 @@
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.rotary.onRotaryScrollEvent
import androidx.compose.ui.platform.testTag
-import androidx.compose.ui.semantics.heading
-import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
@@ -146,7 +145,7 @@
style = MaterialTheme.typography.caption1,
color = Color.White,
textAlign = TextAlign.Center,
- modifier = Modifier.fillMaxWidth().semantics { heading() }
+ modifier = Modifier.fillMaxWidth()
)
}
@@ -278,6 +277,7 @@
fun ScalingLazyColumnWithRSB(
modifier: Modifier = Modifier,
state: ScalingLazyListState = rememberScalingLazyListState(),
+ contentPadding: PaddingValues = PaddingValues(horizontal = 10.dp),
scalingParams: ScalingParams = ScalingLazyColumnDefaults.scalingParams(),
reverseLayout: Boolean = false,
snap: Boolean = true,
@@ -300,6 +300,7 @@
focusRequester = focusRequester
),
state = state,
+ contentPadding = contentPadding,
reverseLayout = reverseLayout,
scalingParams = scalingParams,
flingBehavior = flingBehavior,
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ExpandableDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ExpandableDemo.kt
index 839e65e..a676141 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ExpandableDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ExpandableDemo.kt
@@ -17,14 +17,20 @@
package androidx.wear.compose.integration.demos
import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
@@ -35,9 +41,12 @@
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.ScalingLazyListScope
import androidx.wear.compose.foundation.rememberExpandableState
+import androidx.wear.compose.foundation.rememberExpandableStateMapping
+import androidx.wear.compose.material.Button
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
import androidx.wear.compose.material.CompactChip
+import androidx.wear.compose.material.ListHeader
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
@@ -60,9 +69,57 @@
}
}
+private data class ItemsToShow(val text: String, val key: Int = keySeq++) {
+ override fun toString() = "$text $key"
+
+ companion object {
+ var keySeq: Int = 0
+ }
+}
+
+@Composable
+fun ExpandableMultipleItems() {
+ val items = remember {
+ ItemsToShow.keySeq = 0
+ mutableStateListOf(*Array(100) { ItemsToShow("Item") })
+ }
+
+ val states = rememberExpandableStateMapping<Int>()
+
+ ScalingLazyColumn(
+ modifier = Modifier.fillMaxSize()
+ ) {
+ items.forEachIndexed { ix, item ->
+ val state = states.getOrPutNew(item.key)
+ expandableItem(state, item.key) { expanded ->
+ Text((if (expanded) { "Expanded " } else { "" }) + item)
+ }
+ item(key = item.key + 1_000_000) {
+ Row(
+ verticalAlignment = CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(5.dp)
+ ) {
+ Button(onClick = { state.expanded = !state.expanded }) {
+ Text(if (state.expanded) { "-" } else { "+" })
+ }
+ Button(onClick = { items.removeAt(ix) }) {
+ Text("Del")
+ }
+ Button(onClick = {
+ items.add(ix, ItemsToShow("New"))
+ }) {
+ Text("Add")
+ }
+ }
+ }
+ }
+ }
+}
+
@Composable
fun ExpandableText() {
val state = rememberExpandableState()
+ val state2 = rememberExpandableState()
ContainingScalingLazyColumn {
expandableItem(state) { expanded ->
@@ -78,6 +135,22 @@
)
}
expandButton(state, outline = false)
+
+ demoSeparator()
+ item {
+ ListHeader {
+ Text("Inline expandable.")
+ }
+ }
+ expandableItem(state2) { expanded ->
+ Row(verticalAlignment = CenterVertically) {
+ Text(if (expanded) "Expanded" else "Collapsed")
+ Spacer(Modifier.width(10.dp))
+ Button(onClick = { state2.expanded = !expanded }) {
+ Text(if (expanded) "-" else "+")
+ }
+ }
+ }
}
}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/FoundationDemos.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/FoundationDemos.kt
index 5aff765..e92f70a 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/FoundationDemos.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/FoundationDemos.kt
@@ -88,6 +88,7 @@
"Expandables",
listOf(
ComposableDemo("Items in SLC") { ExpandableListItems() },
+ ComposableDemo("Multiple Items") { ExpandableMultipleItems() },
ComposableDemo("Expandable Text") { ExpandableText() },
ComposableDemo("Items Sample") { ExpandableWithItemsSample() },
ComposableDemo("Text Sample") { ExpandableTextSample() },
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
index 27633f6..43c5978 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
@@ -229,4 +229,4 @@
size == other.size
override fun hashCode(): Int = position.hashCode() + 31 * size.hashCode()
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
index 23056f3..4c6e84b 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
@@ -419,4 +419,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScrollAwayDemos.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScrollAwayDemos.kt
index 5ff8866..8dd28b2 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScrollAwayDemos.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScrollAwayDemos.kt
@@ -17,6 +17,7 @@
package androidx.wear.compose.integration.demos
import androidx.compose.foundation.background
+import androidx.compose.foundation.gestures.ScrollableDefaults
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
@@ -33,9 +34,10 @@
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
+import androidx.wear.compose.foundation.ExperimentalWearFoundationApi
import androidx.wear.compose.foundation.lazy.AutoCenteringParams
-import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
+import androidx.wear.compose.foundation.rememberActiveFocusRequester
import androidx.wear.compose.material.Card
import androidx.wear.compose.material.Chip
import androidx.wear.compose.material.ChipDefaults
@@ -126,9 +128,11 @@
)
}
+@OptIn(ExperimentalWearFoundationApi::class)
@Composable
private fun ColumnCardDemo(offset: Dp) {
val scrollState = rememberScrollState()
+ val focusRequester = rememberActiveFocusRequester()
Scaffold(
modifier = Modifier.fillMaxSize(),
@@ -147,6 +151,11 @@
Column(
modifier = Modifier
.verticalScroll(scrollState)
+ .rsbScroll(
+ scrollableState = scrollState,
+ flingBehavior = ScrollableDefaults.flingBehavior(),
+ focusRequester = focusRequester
+ )
) {
val modifier = Modifier.height(LocalConfiguration.current.screenHeightDp.dp / 2)
repeat(3) { i ->
@@ -156,9 +165,11 @@
}
}
+@OptIn(ExperimentalWearFoundationApi::class)
@Composable
private fun LazyColumnCardDemo(offset: Dp, itemIndex: Int, initialVisibleItemIndex: Int) {
val scrollState = rememberLazyListState(initialFirstVisibleItemIndex = initialVisibleItemIndex)
+ val focusRequester = rememberActiveFocusRequester()
Scaffold(
modifier = Modifier.fillMaxSize(),
@@ -174,7 +185,12 @@
}
) {
LazyColumn(
- state = scrollState
+ state = scrollState,
+ modifier = Modifier.rsbScroll(
+ scrollableState = scrollState,
+ flingBehavior = ScrollableDefaults.flingBehavior(),
+ focusRequester = focusRequester
+ )
) {
items(5) { i ->
val modifier = Modifier.fillParentMaxHeight(0.5f)
@@ -210,7 +226,7 @@
PositionIndicator(scalingLazyListState = scrollState)
}
) {
- ScalingLazyColumn(
+ ScalingLazyColumnWithRSB(
contentPadding = PaddingValues(10.dp),
state = scrollState,
autoCentering = AutoCenteringParams(itemIndex = 1, itemOffset = 0)
@@ -252,7 +268,7 @@
PositionIndicator(scalingLazyListState = scrollState)
}
) {
- ScalingLazyColumn(
+ ScalingLazyColumnWithRSB(
contentPadding = PaddingValues(10.dp),
state = scrollState,
) {
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
index 8e038f0..52744d3 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
@@ -250,4 +250,4 @@
enabled = enabled,
colors = colors,
)
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ThemeDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ThemeDemo.kt
index d6cb8d30..223460f 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ThemeDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ThemeDemo.kt
@@ -177,4 +177,4 @@
style = MaterialTheme.typography.button,
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/Common.kt b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/Common.kt
index 58c38b0..af8e91f 100644
--- a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/Common.kt
+++ b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/Common.kt
@@ -16,4 +16,4 @@
package androidx.wear.compose.integration.macrobenchmark.target
-internal val CONTENT_DESCRIPTION = "find-me"
\ No newline at end of file
+internal val CONTENT_DESCRIPTION = "find-me"
diff --git a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/ScrollActivity.kt b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/ScrollActivity.kt
index ee57c4f..c2e4a1b 100644
--- a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/ScrollActivity.kt
+++ b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/ScrollActivity.kt
@@ -69,4 +69,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/StartupActivity.kt b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/StartupActivity.kt
index db764c8..aaf1043 100644
--- a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/StartupActivity.kt
+++ b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/StartupActivity.kt
@@ -30,4 +30,4 @@
Text("Wear Compose Macrobenchmark Target")
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/SwipeActivity.kt b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/SwipeActivity.kt
index 4282144..4c646c0e0 100644
--- a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/SwipeActivity.kt
+++ b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/SwipeActivity.kt
@@ -64,4 +64,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/BaselineProfile.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/BaselineProfile.kt
index 2d048cb..cbc59ca 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/BaselineProfile.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/BaselineProfile.kt
@@ -166,4 +166,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/Common.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/Common.kt
index b60c1cc..7c4b75e 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/Common.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/Common.kt
@@ -16,4 +16,4 @@
package androidx.wear.compose.integration.macrobenchmark.test
-internal val CONTENT_DESCRIPTION = "find-me"
\ No newline at end of file
+internal val CONTENT_DESCRIPTION = "find-me"
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/CompositionMetric.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/CompositionMetric.kt
index eddb34a..784061a 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/CompositionMetric.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/CompositionMetric.kt
@@ -50,4 +50,4 @@
Measurement("${shortName}RecomposeCount", durationsNs.count().toDouble())
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/ScrollBenchmark.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/ScrollBenchmark.kt
index ced270c..cb19f5f 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/ScrollBenchmark.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/ScrollBenchmark.kt
@@ -80,4 +80,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/StartupBenchmark.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/StartupBenchmark.kt
index 0b8754f..a21fa51 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/StartupBenchmark.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/StartupBenchmark.kt
@@ -50,4 +50,4 @@
@JvmStatic
fun parameters() = createStartupCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/SwipeBenchmark.kt b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/SwipeBenchmark.kt
index 94d3d47..c9871fe 100644
--- a/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/SwipeBenchmark.kt
+++ b/wear/compose/integration-tests/macrobenchmark/src/main/java/androidx/wear/compose/integration/macrobenchmark/SwipeBenchmark.kt
@@ -80,4 +80,4 @@
@JvmStatic
fun parameters() = createCompilationParams()
}
-}
\ No newline at end of file
+}
diff --git a/wear/protolayout/protolayout-expression-pipeline/build.gradle b/wear/protolayout/protolayout-expression-pipeline/build.gradle
index 09014b5..a7e1cdd 100644
--- a/wear/protolayout/protolayout-expression-pipeline/build.gradle
+++ b/wear/protolayout/protolayout-expression-pipeline/build.gradle
@@ -28,12 +28,10 @@
implementation("androidx.core:core:1.7.0")
implementation("androidx.concurrent:concurrent-futures:1.1.0")
- implementation("androidx.annotation:annotation-experimental:1.3.0")
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
implementation(project(path: ":wear:protolayout:protolayout-proto", configuration: "shadow"))
implementation(project(":wear:protolayout:protolayout-expression"))
- compileOnly(libs.kotlinStdlib) // For annotation-experimental
-
testImplementation(libs.mockitoCore4)
testImplementation(libs.testExtJunit)
testImplementation(libs.testExtTruth)
diff --git a/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/DynamicTypeEvaluator.java b/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/DynamicTypeEvaluator.java
index 41ae6e5..04ec320 100644
--- a/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/DynamicTypeEvaluator.java
+++ b/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/DynamicTypeEvaluator.java
@@ -108,7 +108,7 @@
public class DynamicTypeEvaluator {
private static final String TAG = "DynamicTypeEvaluator";
private static final QuotaManager NO_OP_QUOTA_MANAGER =
- new FixedQuotaManagerImpl(Integer.MAX_VALUE);
+ new FixedQuotaManagerImpl(Integer.MAX_VALUE, "dynamic nodes noop");
@NonNull
private static final QuotaManager DISABLED_ANIMATIONS_QUOTA_MANAGER =
diff --git a/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/FixedQuotaManagerImpl.java b/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/FixedQuotaManagerImpl.java
index dbe00c9..1dfbd3e 100644
--- a/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/FixedQuotaManagerImpl.java
+++ b/wear/protolayout/protolayout-expression-pipeline/src/main/java/androidx/wear/protolayout/expression/pipeline/FixedQuotaManagerImpl.java
@@ -16,6 +16,7 @@
package androidx.wear.protolayout.expression.pipeline;
+import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.annotation.VisibleForTesting;
@@ -24,11 +25,18 @@
@RestrictTo(Scope.LIBRARY_GROUP)
public class FixedQuotaManagerImpl implements QuotaManager {
private final int mQuotaCap;
+ @NonNull private final String mQuotaName;
private int mQuotaCounter = 0;
/** Creates a {@link FixedQuotaManagerImpl} with the given quota cap. */
public FixedQuotaManagerImpl(int quotaCap) {
+ this(quotaCap, /* quotaName= */ "");
+ }
+
+ /** Creates a {@link FixedQuotaManagerImpl} with the given quota cap and quota name. */
+ public FixedQuotaManagerImpl(int quotaCap, @NonNull String quotaName) {
+ this.mQuotaName = quotaName;
this.mQuotaCap = quotaCap;
}
@@ -54,7 +62,9 @@
public void releaseQuota(int quota) {
if (mQuotaCounter - quota < 0) {
throw new IllegalArgumentException(
- "Trying to release more quota than it was acquired!");
+ "Trying to release more quota"
+ + (mQuotaName.isEmpty() ? "" : " for " + mQuotaName)
+ + " than it was acquired!");
}
mQuotaCounter -= quota;
}
diff --git a/wear/protolayout/protolayout-renderer/build.gradle b/wear/protolayout/protolayout-renderer/build.gradle
index 4b86d05..79330e35 100644
--- a/wear/protolayout/protolayout-renderer/build.gradle
+++ b/wear/protolayout/protolayout-renderer/build.gradle
@@ -25,7 +25,6 @@
annotationProcessor(libs.nullaway)
api("androidx.annotation:annotation:1.2.0")
api("androidx.core:core:1.7.0")
- api(libs.guavaListenableFuture)
api(libs.guava)
implementation("androidx.core:core:1.3.2")
diff --git a/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/dynamicdata/ProtoLayoutDynamicDataPipeline.java b/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/dynamicdata/ProtoLayoutDynamicDataPipeline.java
index 084e1a2..463af2e 100644
--- a/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/dynamicdata/ProtoLayoutDynamicDataPipeline.java
+++ b/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/dynamicdata/ProtoLayoutDynamicDataPipeline.java
@@ -85,7 +85,7 @@
@NonNull
private static final QuotaManager DISABLED_ANIMATIONS_QUOTA_MANAGER =
- new FixedQuotaManagerImpl(/* quotaCap= */ 0);
+ new FixedQuotaManagerImpl(/* quotaCap= */ 0, "disabled animations");
@NonNull final PositionIdTree<NodeInfo> mPositionIdTree = new PositionIdTree<>();
@NonNull final List<QuotaAwareAnimationSet> mEnterAnimations = new ArrayList<>();
diff --git a/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/impl/ProtoLayoutViewInstance.java b/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/impl/ProtoLayoutViewInstance.java
index ae4e55c..5f53a02 100644
--- a/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/impl/ProtoLayoutViewInstance.java
+++ b/wear/protolayout/protolayout-renderer/src/main/java/androidx/wear/protolayout/renderer/impl/ProtoLayoutViewInstance.java
@@ -674,8 +674,11 @@
? new ProtoLayoutDynamicDataPipeline(
config.getPlatformDataProviders(),
stateStore,
- new FixedQuotaManagerImpl(config.getRunningAnimationsLimit()),
- new FixedQuotaManagerImpl(DYNAMIC_NODES_MAX_COUNT))
+ new FixedQuotaManagerImpl(
+ config.getRunningAnimationsLimit(),
+ "animations"),
+ new FixedQuotaManagerImpl(
+ DYNAMIC_NODES_MAX_COUNT, "dynamic nodes"))
: new ProtoLayoutDynamicDataPipeline(
config.getPlatformDataProviders(), stateStore);
mDataPipeline.setFullyVisible(config.getIsViewFullyVisible());
diff --git a/wear/protolayout/protolayout/build.gradle b/wear/protolayout/protolayout/build.gradle
index 27a9828..dfa897c 100644
--- a/wear/protolayout/protolayout/build.gradle
+++ b/wear/protolayout/protolayout/build.gradle
@@ -25,12 +25,10 @@
annotationProcessor(libs.nullaway)
api("androidx.annotation:annotation:1.2.0")
- implementation("androidx.annotation:annotation-experimental:1.3.0")
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
implementation(project(path: ":wear:protolayout:protolayout-proto", configuration: "shadow"))
api(project(":wear:protolayout:protolayout-expression"))
- compileOnly(libs.kotlinStdlib) // For annotation-experimental
-
testImplementation(libs.testExtJunit)
testImplementation(libs.testExtTruth)
testImplementation(libs.testRunner)
diff --git a/wear/tiles/tiles-material/src/test/resources/robolectric.properties b/wear/tiles/tiles-material/src/test/resources/robolectric.properties
index 34d9449..69fde47 100644
--- a/wear/tiles/tiles-material/src/test/resources/robolectric.properties
+++ b/wear/tiles/tiles-material/src/test/resources/robolectric.properties
@@ -1,3 +1,3 @@
# robolectric properties
-# Temporary until Wear team fixes their tests to work against sdk=33 (b/281072091).
-sdk=29
+# Temporary until we update Robolectric to support API level 34.
+sdk=33
diff --git a/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/checkers/CheckAccessibilityAvailable.kt b/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/checkers/CheckAccessibilityAvailable.kt
index 75db840..2fd843f 100644
--- a/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/checkers/CheckAccessibilityAvailable.kt
+++ b/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/checkers/CheckAccessibilityAvailable.kt
@@ -102,4 +102,4 @@
false
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/connection/TilesConnectionBinder.kt b/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/connection/TilesConnectionBinder.kt
index c015756..f8f051a 100644
--- a/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/connection/TilesConnectionBinder.kt
+++ b/wear/tiles/tiles-renderer/src/main/java/androidx/wear/tiles/connection/TilesConnectionBinder.kt
@@ -192,4 +192,4 @@
private suspend fun cancelBinderRelease() {
releaseBinderJob?.cancelAndJoin()
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/TilesTestRunner.kt b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/TilesTestRunner.kt
index 9d3c202..0e36361 100644
--- a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/TilesTestRunner.kt
+++ b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/TilesTestRunner.kt
@@ -26,4 +26,4 @@
.doNotInstrumentPackage("androidx.wear.tiles.checkers")
.doNotInstrumentPackage("androidx.wear.tiles.connection")
.build()
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/checkers/TimelineCheckerTest.kt b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/checkers/TimelineCheckerTest.kt
index b91d8275..632f85e 100644
--- a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/checkers/TimelineCheckerTest.kt
+++ b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/checkers/TimelineCheckerTest.kt
@@ -111,4 +111,4 @@
).build()
).build()
).build()
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/DefaultTileClientTest.kt b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/DefaultTileClientTest.kt
index 67aa9ea..64395dd 100644
--- a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/DefaultTileClientTest.kt
+++ b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/DefaultTileClientTest.kt
@@ -368,4 +368,4 @@
onTileLeaveCalled = true
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/TilesConnectionBinderTest.kt b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/TilesConnectionBinderTest.kt
index 64ae254..6f5d200 100644
--- a/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/TilesConnectionBinderTest.kt
+++ b/wear/tiles/tiles-renderer/src/test/java/androidx/wear/tiles/connection/TilesConnectionBinderTest.kt
@@ -331,4 +331,4 @@
TODO("Not yet implemented")
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-testing/src/test/java/androidx/wear/tiles/testing/TilesTestingTestRunner.kt b/wear/tiles/tiles-testing/src/test/java/androidx/wear/tiles/testing/TilesTestingTestRunner.kt
index 5392776..22cfc6d 100644
--- a/wear/tiles/tiles-testing/src/test/java/androidx/wear/tiles/testing/TilesTestingTestRunner.kt
+++ b/wear/tiles/tiles-testing/src/test/java/androidx/wear/tiles/testing/TilesTestingTestRunner.kt
@@ -26,4 +26,4 @@
.doNotInstrumentPackage("androidx.wear.tiles.connection")
.doNotInstrumentPackage("androidx.wear.tiles.testing")
.build()
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TestTileService.kt b/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TestTileService.kt
index cb3b2ea..78f9136 100644
--- a/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TestTileService.kt
+++ b/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TestTileService.kt
@@ -55,4 +55,4 @@
.setVersion(RESOURCES_VERSION)
.build()
)
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TileServiceViewAdapterTest.kt b/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TileServiceViewAdapterTest.kt
index d197c38..64b50f4 100644
--- a/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TileServiceViewAdapterTest.kt
+++ b/wear/tiles/tiles-tooling/src/androidTest/java/androidx/wear/tiles/tooling/TileServiceViewAdapterTest.kt
@@ -70,4 +70,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles-tooling/src/test/java/androidx/wear/tiles/tooling/FindMethodTest.kt b/wear/tiles/tiles-tooling/src/test/java/androidx/wear/tiles/tooling/FindMethodTest.kt
index e84bbc5..b9b5986 100644
--- a/wear/tiles/tiles-tooling/src/test/java/androidx/wear/tiles/tooling/FindMethodTest.kt
+++ b/wear/tiles/tiles-tooling/src/test/java/androidx/wear/tiles/tooling/FindMethodTest.kt
@@ -59,4 +59,4 @@
assertEquals("aFinal", B::class.java.findMethod("aFinal").invoke(b))
assertEquals("aOpenProtected2", B::class.java.findMethod("aOpenProtected2").invoke(b))
}
-}
\ No newline at end of file
+}
diff --git a/wear/tiles/tiles/build.gradle b/wear/tiles/tiles/build.gradle
index 8b13595..9657541 100644
--- a/wear/tiles/tiles/build.gradle
+++ b/wear/tiles/tiles/build.gradle
@@ -28,12 +28,10 @@
api(project(":wear:protolayout:protolayout-expression"))
api(libs.guavaListenableFuture)
- implementation("androidx.annotation:annotation-experimental:1.3.0")
+ implementation("androidx.annotation:annotation-experimental:1.3.1")
implementation("androidx.concurrent:concurrent-futures:1.1.0")
implementation(project(path: ":wear:tiles:tiles-proto"))
- compileOnly(libs.kotlinStdlib) // For annotation-experimental
-
testImplementation(libs.testExtJunit)
testImplementation(libs.testExtTruth)
testImplementation(libs.testCore)
diff --git a/wear/watchface/watchface-client-guava/api/current.txt b/wear/watchface/watchface-client-guava/api/current.txt
index 471cc7f..9c9689d 100644
--- a/wear/watchface/watchface-client-guava/api/current.txt
+++ b/wear/watchface/watchface-client-guava/api/current.txt
@@ -7,6 +7,7 @@
method @Deprecated public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, int surfaceWidth, int surfaceHeight);
method public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(String id, android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, int surfaceWidth, int surfaceHeight);
method public static final com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceControlClient(android.content.Context context, String watchFacePackageName);
+ method public static final com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceRuntimeControlClientAsync(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName);
method @Deprecated public java.util.Map<java.lang.Integer,androidx.wear.watchface.client.DefaultComplicationDataSourcePolicyAndType> getDefaultComplicationDataSourcePoliciesAndType(android.content.ComponentName watchFaceName);
method public androidx.wear.watchface.client.EditorServiceClient getEditorServiceClient();
method public androidx.wear.watchface.client.InteractiveWatchFaceClient? getInteractiveWatchFaceClientInstance(String instanceId);
@@ -19,15 +20,18 @@
public static final class ListenableWatchFaceControlClient.Companion {
method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceControlClient(android.content.Context context, String watchFacePackageName);
+ method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceRuntimeControlClientAsync(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName);
}
public final class ListenableWatchFaceMetadataClient {
method public static com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> create(android.content.Context context, android.content.ComponentName watchFaceName);
+ method public static com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String resourceOnlyWatchFacePackageName);
field public static final androidx.wear.watchface.client.ListenableWatchFaceMetadataClient.Companion Companion;
}
public static final class ListenableWatchFaceMetadataClient.Companion {
method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> create(android.content.Context context, android.content.ComponentName watchFaceName);
+ method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String resourceOnlyWatchFacePackageName);
}
}
diff --git a/wear/watchface/watchface-client-guava/api/restricted_current.txt b/wear/watchface/watchface-client-guava/api/restricted_current.txt
index 471cc7f..9c9689d 100644
--- a/wear/watchface/watchface-client-guava/api/restricted_current.txt
+++ b/wear/watchface/watchface-client-guava/api/restricted_current.txt
@@ -7,6 +7,7 @@
method @Deprecated public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, int surfaceWidth, int surfaceHeight);
method public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(String id, android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, int surfaceWidth, int surfaceHeight);
method public static final com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceControlClient(android.content.Context context, String watchFacePackageName);
+ method public static final com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceRuntimeControlClientAsync(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName);
method @Deprecated public java.util.Map<java.lang.Integer,androidx.wear.watchface.client.DefaultComplicationDataSourcePolicyAndType> getDefaultComplicationDataSourcePoliciesAndType(android.content.ComponentName watchFaceName);
method public androidx.wear.watchface.client.EditorServiceClient getEditorServiceClient();
method public androidx.wear.watchface.client.InteractiveWatchFaceClient? getInteractiveWatchFaceClientInstance(String instanceId);
@@ -19,15 +20,18 @@
public static final class ListenableWatchFaceControlClient.Companion {
method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceControlClient(android.content.Context context, String watchFacePackageName);
+ method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.ListenableWatchFaceControlClient> createWatchFaceRuntimeControlClientAsync(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName);
}
public final class ListenableWatchFaceMetadataClient {
method public static com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> create(android.content.Context context, android.content.ComponentName watchFaceName);
+ method public static com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String resourceOnlyWatchFacePackageName);
field public static final androidx.wear.watchface.client.ListenableWatchFaceMetadataClient.Companion Companion;
}
public static final class ListenableWatchFaceMetadataClient.Companion {
method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> create(android.content.Context context, android.content.ComponentName watchFaceName);
+ method public com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.client.WatchFaceMetadataClient> createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String resourceOnlyWatchFacePackageName);
}
}
diff --git a/wear/watchface/watchface-client-guava/src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceControlClientTest.kt b/wear/watchface/watchface-client-guava/src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceControlClientTest.kt
index 4801d04..00ef1e5 100644
--- a/wear/watchface/watchface-client-guava/src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceControlClientTest.kt
+++ b/wear/watchface/watchface-client-guava/src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceControlClientTest.kt
@@ -44,11 +44,12 @@
import org.junit.Assert
import org.junit.Assert.assertNull
import org.junit.Before
+import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.MockitoAnnotations
+import org.mockito.junit.MockitoJUnit
private const val TIMEOUT_MS = 500L
@@ -56,6 +57,9 @@
@MediumTest
public class ListenableWatchFaceControlClientTest {
+ @get:Rule
+ val mocks = MockitoJUnit.rule()
+
@Mock private lateinit var surfaceHolder: SurfaceHolder
@Mock private lateinit var surface: Surface
@@ -63,7 +67,6 @@
@Before
public fun setUp() {
- MockitoAnnotations.initMocks(this)
Mockito.`when`(surfaceHolder.surfaceFrame).thenReturn(Rect(0, 0, 400, 400))
Mockito.`when`(surfaceHolder.surface).thenReturn(surface)
}
diff --git a/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceControlClient.kt b/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceControlClient.kt
index e3de152..11fa95b 100644
--- a/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceControlClient.kt
+++ b/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceControlClient.kt
@@ -21,6 +21,8 @@
import androidx.concurrent.futures.ResolvableFuture
import androidx.core.util.Consumer
import androidx.wear.watchface.Renderer
+import androidx.wear.watchface.WatchFaceRuntimeService
+import androidx.wear.watchface.client.WatchFaceControlClient.Companion.createWatchFaceControlClient
import androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException
import androidx.wear.watchface.complications.data.ComplicationData
import androidx.wear.watchface.style.UserStyleData
@@ -119,6 +121,51 @@
)
)
}
+
+ /**
+ * Similar [createWatchFaceControlClient] this constructs a [WatchFaceControlClient] which
+ * attempts to connect to the watch face runtime in the android package
+ * [runtimePackageName].
+ *
+ * A watch face runtime is a special type of watch face, which renders a watch face
+ * described by resources in another package [resourceOnlyWatchFacePackageName].
+ *
+ * Note only one watch face definition per resource only watch face package is supported.
+ *
+ * Currently Wear OS only supports the runtime for the Android Watch Face Format (see
+ * https://developer.android.com/training/wearables/wff for more details).
+ *
+ * @param context Calling application's [Context].
+ * @param runtimePackageName The name of the package containing the watch face runtime's
+ * control service to bind to.
+ * @param resourceOnlyWatchFacePackageName The name of the package from which to load the
+ * resource only watch face. This is exposed to the runtime via the
+ * `resourceOnlyWatchFacePackageName` parameter passed to
+ * [WatchFaceRuntimeService.createUserStyleSchema],
+ * [WatchFaceRuntimeService.createComplicationSlotsManager],
+ * [WatchFaceRuntimeService.createUserStyleFlavors] and
+ * [WatchFaceRuntimeService.createWatchFace]).
+ * @return [ListenableFuture]<[ListenableWatchFaceControlClient]> which on success resolves
+ * to a [ListenableWatchFaceControlClient] or throws a [ServiceNotBoundException] if the
+ * watch face control service can not be bound.
+ */
+ @JvmStatic
+ public fun createWatchFaceRuntimeControlClientAsync(
+ context: Context,
+ runtimePackageName: String,
+ resourceOnlyWatchFacePackageName: String
+ ): ListenableFuture<ListenableWatchFaceControlClient> =
+ launchFutureCoroutine(
+ "ListenableWatchFaceControlClient.createWatchFaceRuntimeControlClient",
+ ) {
+ ListenableWatchFaceControlClient(
+ WatchFaceControlClient.createWatchFaceRuntimeControlClient(
+ context,
+ runtimePackageName,
+ resourceOnlyWatchFacePackageName
+ )
+ )
+ }
}
@Suppress("DEPRECATION")
diff --git a/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceMetadataClient.kt b/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceMetadataClient.kt
index 6d25efd..5a49cbb 100644
--- a/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceMetadataClient.kt
+++ b/wear/watchface/watchface-client-guava/src/main/java/androidx/wear/watchface/client/ListenableWatchFaceMetadataClient.kt
@@ -53,6 +53,38 @@
WatchFaceMetadataClient.Companion.ParserProvider()
)
+ /**
+ * Constructs a [WatchFaceMetadataClient] for fetching metadata for the specified resource
+ * only watch face runtime. A resource only watch face runtime, is a special kind of watch
+ * face that is the runtime for a watch face defined by another package that contains only
+ * resources and no executable code.
+ *
+ * @param context Calling application's [Context].
+ * @param watchFaceName The [ComponentName] of the watch face to fetch meta data from.
+ * @param resourceOnlyWatchFacePackageName The package the runtime should load the resources
+ * from.
+ * @return A [ListenableFuture] which resolves with [WatchFaceMetadataClient] if there is
+ * one, otherwise it throws a [ServiceNotBoundException] if the underlying watch face
+ * control service can not be bound or a [ServiceStartFailureException] if the watch face
+ * dies during startup.
+ */
+ @Suppress("AsyncSuffixFuture")
+ @JvmStatic
+ public fun createForRuntime(
+ context: Context,
+ watchFaceName: ComponentName,
+ resourceOnlyWatchFacePackageName: String
+ ) =
+ ListenableWatchFaceControlClient.launchFutureCoroutine(
+ "ListenableWatchFaceMetadataClient.create"
+ ) {
+ WatchFaceMetadataClient.createForRuntime(
+ context,
+ watchFaceName,
+ resourceOnlyWatchFacePackageName
+ )
+ }
+
internal fun createImpl(
context: Context,
intent: Intent,
diff --git a/wear/watchface/watchface-client/api/current.txt b/wear/watchface/watchface-client/api/current.txt
index 41cfe98..9e3a9b6 100644
--- a/wear/watchface/watchface-client/api/current.txt
+++ b/wear/watchface/watchface-client/api/current.txt
@@ -206,6 +206,7 @@
method @Deprecated @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, @Px int surfaceWidth, @Px int surfaceHeight) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public default androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(String id, android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, @Px int surfaceWidth, @Px int surfaceHeight) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public static suspend Object? createWatchFaceControlClient(android.content.Context context, String watchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public static suspend Object? createWatchFaceRuntimeControlClient(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
method @Deprecated @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public java.util.Map<java.lang.Integer,androidx.wear.watchface.client.DefaultComplicationDataSourcePolicyAndType> getDefaultComplicationDataSourcePoliciesAndType(android.content.ComponentName watchFaceName) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.EditorServiceClient getEditorServiceClient() throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.InteractiveWatchFaceClient? getInteractiveWatchFaceClientInstance(String instanceId) throws android.os.RemoteException;
@@ -217,6 +218,7 @@
public static final class WatchFaceControlClient.Companion {
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public suspend Object? createWatchFaceControlClient(android.content.Context context, String watchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public suspend Object? createWatchFaceRuntimeControlClient(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
}
public static final class WatchFaceControlClient.ServiceNotBoundException extends java.lang.Exception {
@@ -244,6 +246,7 @@
public static final class WatchFaceMetadataClient.Companion {
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class, PackageManager.NameNotFoundException::class}) public suspend Object? create(android.content.Context context, android.content.ComponentName watchFaceName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceMetadataClient>) throws android.content.pm.PackageManager.NameNotFoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class, PackageManager.NameNotFoundException::class}) public suspend Object? createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String runtimePackage, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceMetadataClient>) throws android.content.pm.PackageManager.NameNotFoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceStartFailureException;
}
public static final class WatchFaceMetadataClient.ServiceNotBoundException extends java.lang.Exception {
diff --git a/wear/watchface/watchface-client/api/restricted_current.txt b/wear/watchface/watchface-client/api/restricted_current.txt
index 41cfe98..9e3a9b6 100644
--- a/wear/watchface/watchface-client/api/restricted_current.txt
+++ b/wear/watchface/watchface-client/api/restricted_current.txt
@@ -206,6 +206,7 @@
method @Deprecated @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, @Px int surfaceWidth, @Px int surfaceHeight) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public default androidx.wear.watchface.client.HeadlessWatchFaceClient? createHeadlessWatchFaceClient(String id, android.content.ComponentName watchFaceName, androidx.wear.watchface.client.DeviceConfig deviceConfig, @Px int surfaceWidth, @Px int surfaceHeight) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public static suspend Object? createWatchFaceControlClient(android.content.Context context, String watchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public static suspend Object? createWatchFaceRuntimeControlClient(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
method @Deprecated @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public java.util.Map<java.lang.Integer,androidx.wear.watchface.client.DefaultComplicationDataSourcePolicyAndType> getDefaultComplicationDataSourcePoliciesAndType(android.content.ComponentName watchFaceName) throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.EditorServiceClient getEditorServiceClient() throws android.os.RemoteException;
method @kotlin.jvm.Throws(exceptionClasses=RemoteException::class) public androidx.wear.watchface.client.InteractiveWatchFaceClient? getInteractiveWatchFaceClientInstance(String instanceId) throws android.os.RemoteException;
@@ -217,6 +218,7 @@
public static final class WatchFaceControlClient.Companion {
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public suspend Object? createWatchFaceControlClient(android.content.Context context, String watchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class}) public suspend Object? createWatchFaceRuntimeControlClient(android.content.Context context, String runtimePackageName, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceControlClient>) throws androidx.wear.watchface.client.WatchFaceControlClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceControlClient.ServiceStartFailureException;
}
public static final class WatchFaceControlClient.ServiceNotBoundException extends java.lang.Exception {
@@ -244,6 +246,7 @@
public static final class WatchFaceMetadataClient.Companion {
method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class, PackageManager.NameNotFoundException::class}) public suspend Object? create(android.content.Context context, android.content.ComponentName watchFaceName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceMetadataClient>) throws android.content.pm.PackageManager.NameNotFoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceStartFailureException;
+ method @kotlin.jvm.Throws(exceptionClasses={ServiceNotBoundException::class, ServiceStartFailureException::class, PackageManager.NameNotFoundException::class}) public suspend Object? createForRuntime(android.content.Context context, android.content.ComponentName watchFaceName, String runtimePackage, kotlin.coroutines.Continuation<? super androidx.wear.watchface.client.WatchFaceMetadataClient>) throws android.content.pm.PackageManager.NameNotFoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceNotBoundException, androidx.wear.watchface.client.WatchFaceMetadataClient.ServiceStartFailureException;
}
public static final class WatchFaceMetadataClient.ServiceNotBoundException extends java.lang.Exception {
diff --git a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/HeadlessWatchFaceClientTest.kt b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/HeadlessWatchFaceClientTest.kt
index d6c8fb5..bf838f8 100644
--- a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/HeadlessWatchFaceClientTest.kt
+++ b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/HeadlessWatchFaceClientTest.kt
@@ -61,7 +61,8 @@
context,
Intent(context, WatchFaceControlTestService::class.java).apply {
action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
- }
+ },
+ resourceOnlyWatchFacePackageName = null
)
}
diff --git a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt
index ff8ba4b..26eb17a 100644
--- a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt
+++ b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt
@@ -22,6 +22,7 @@
import android.graphics.Rect
import android.os.Build
import android.os.Parcel
+import android.support.wearable.watchface.SharedMemoryImage
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
@@ -29,8 +30,8 @@
import androidx.wear.watchface.DrawMode
import androidx.wear.watchface.RenderParameters
import androidx.wear.watchface.client.ComplicationSlotState
+import androidx.wear.watchface.client.EditorState
import androidx.wear.watchface.client.WatchFaceId
-import androidx.wear.watchface.client.asApiEditorState
import androidx.wear.watchface.complications.SystemDataSources
import androidx.wear.watchface.complications.data.ComplicationType
import androidx.wear.watchface.complications.data.LongTextComplicationData
@@ -52,6 +53,26 @@
import org.junit.Test
import org.junit.runner.RunWith
+// FIXME: We shouldn't have to define this here, we should be able to import it.
+internal fun EditorStateWireFormat.asApiEditorState(): EditorState {
+ return EditorState(
+ WatchFaceId(watchFaceInstanceId ?: ""),
+ UserStyleData(userStyle.mUserStyle),
+ previewComplicationData.associateBy(
+ { it.id },
+ { it.complicationData.toApiComplicationData() }
+ ),
+ commitChanges,
+ previewImageBundle?.let {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
+ SharedMemoryImage.ashmemReadImageBundle(it)
+ } else {
+ null
+ }
+ }
+ )
+}
+
/** Tests that we can deserialize golden resources correctly to ensure backwards compatibility. */
@RunWith(AndroidJUnit4::class)
@MediumTest
diff --git a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/TestWatchFaceServices.kt b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/TestWatchFaceServices.kt
index d758df7..5179e06c5 100644
--- a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/TestWatchFaceServices.kt
+++ b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/TestWatchFaceServices.kt
@@ -34,6 +34,7 @@
import androidx.wear.watchface.RenderParameters
import androidx.wear.watchface.Renderer
import androidx.wear.watchface.WatchFace
+import androidx.wear.watchface.WatchFaceRuntimeService
import androidx.wear.watchface.WatchFaceService
import androidx.wear.watchface.WatchFaceType
import androidx.wear.watchface.WatchState
@@ -54,6 +55,7 @@
import androidx.wear.watchface.samples.ExampleOpenGLBackgroundInitWatchFaceService
import androidx.wear.watchface.samples.R
import androidx.wear.watchface.style.CurrentUserStyleRepository
+import androidx.wear.watchface.style.UserStyleFlavors
import androidx.wear.watchface.style.UserStyleSchema
import androidx.wear.watchface.style.UserStyleSetting
import androidx.wear.watchface.style.WatchFaceLayer
@@ -261,6 +263,76 @@
.setOverlayStyle(watchFaceOverlayStyle)
}
+@Suppress("Deprecation")
+internal class TestWatchFaceRuntimeService(
+ testContext: Context,
+ private var surfaceHolderOverride: SurfaceHolder
+) : WatchFaceRuntimeService() {
+
+ lateinit var lastResourceOnlyWatchFacePackageName: String
+ val lastResourceOnlyWatchFacePackageNameLatch = CountDownLatch(1)
+
+ init {
+ attachBaseContext(testContext)
+ }
+
+ override fun getWallpaperSurfaceHolderOverride() = surfaceHolderOverride
+
+ override fun createUserStyleSchema(resourceOnlyWatchFacePackageName: String) =
+ UserStyleSchema(emptyList())
+
+ override fun createComplicationSlotsManager(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ) = ComplicationSlotsManager(emptyList(), currentUserStyleRepository)
+
+ override fun createUserStyleFlavors(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager,
+ resourceOnlyWatchFacePackageName: String
+ ) = UserStyleFlavors()
+
+ override suspend fun createWatchFace(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): WatchFace {
+ lastResourceOnlyWatchFacePackageName = resourceOnlyWatchFacePackageName
+ lastResourceOnlyWatchFacePackageNameLatch.countDown()
+
+ return WatchFace(
+ WatchFaceType.DIGITAL,
+ @Suppress("deprecation")
+ object :
+ Renderer.CanvasRenderer(
+ surfaceHolder,
+ currentUserStyleRepository,
+ watchState,
+ CanvasType.HARDWARE,
+ 16
+ ) {
+ override fun render(
+ canvas: Canvas,
+ bounds: Rect,
+ zonedDateTime: ZonedDateTime
+ ) {
+ // Actually rendering something isn't required.
+ }
+
+ override fun renderHighlightLayer(
+ canvas: Canvas,
+ bounds: Rect,
+ zonedDateTime: ZonedDateTime
+ ) {
+ // Actually rendering something isn't required.
+ }
+ }
+ )
+ }
+}
+
internal class TestAsyncCanvasRenderInitWatchFaceService(
testContext: Context,
private var surfaceHolderOverride: SurfaceHolder,
diff --git a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
index 6e145da..c46d71e 100644
--- a/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
+++ b/wear/watchface/watchface-client/src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt
@@ -119,7 +119,7 @@
import org.mockito.Mockito
import org.mockito.Mockito.mock
import org.mockito.Mockito.`when`
-import org.mockito.MockitoAnnotations
+import org.mockito.junit.MockitoJUnit
private const val CONNECT_TIMEOUT_MILLIS = 500L
private const val DESTROY_TIMEOUT_MILLIS = 500L
@@ -133,10 +133,14 @@
context,
Intent(context, WatchFaceControlTestService::class.java).apply {
action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
- }
+ },
+ resourceOnlyWatchFacePackageName = null
)
}
+ @get:Rule
+ val mocks = MockitoJUnit.rule()
+
@Mock protected lateinit var surfaceHolder: SurfaceHolder
@Mock protected lateinit var surfaceHolder2: SurfaceHolder
@@ -163,7 +167,6 @@
@Before
fun setUp() {
- MockitoAnnotations.initMocks(this)
WatchFaceControlTestService.apiVersionOverride = null
Mockito.`when`(surfaceHolder.surfaceFrame).thenReturn(Rect(0, 0, 400, 400))
Mockito.`when`(surfaceHolder.surface).thenReturn(surface)
@@ -503,6 +506,50 @@
}
@Test
+ @Suppress("deprecation") // getOrCreateInteractiveWatchFaceClient
+ fun resourceOnlyWatchFacePackageName() {
+ val watchFaceService = TestWatchFaceRuntimeService(context, surfaceHolder)
+ val service = runBlocking {
+ WatchFaceControlClient.createWatchFaceControlClientImpl(
+ context,
+ Intent(context, WatchFaceControlTestService::class.java).apply {
+ action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
+ },
+ resourceOnlyWatchFacePackageName = "com.example.watchface"
+ )
+ }
+
+ val deferredInteractiveInstance = handlerCoroutineScope.async {
+ service.getOrCreateInteractiveWatchFaceClient(
+ "testId",
+ deviceConfig,
+ systemState,
+ userStyle = null,
+ complications
+ )
+ }
+
+ // Create the engine which triggers construction of the interactive instance.
+ handler.post {
+ engine = watchFaceService.onCreateEngine() as WatchFaceService.EngineWrapper
+ }
+
+ // Wait for the instance to be created.
+ val interactiveInstance = awaitWithTimeout(deferredInteractiveInstance)
+
+ // Make sure watch face init has completed.
+ assertTrue(
+ watchFaceService.lastResourceOnlyWatchFacePackageNameLatch
+ .await(UPDATE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
+ )
+
+ assertThat(watchFaceService.lastResourceOnlyWatchFacePackageName)
+ .isEqualTo("com.example.watchface")
+
+ interactiveInstance.close()
+ }
+
+ @Test
@Suppress("Deprecation")
fun getInteractiveWatchFaceInstance() {
val testId = "testId"
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
index 307c757..3847531 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
@@ -122,7 +122,8 @@
/**
* Renders the [androidx.wear.watchface.ComplicationSlot] to a shared memory backed [Bitmap]
- * with the given settings.
+ * with the given settings. The complication will be rendered at the same scale as it would be
+ * when the watch face is full screen.
*
* @param complicationSlotId The id of the complication to render
* @param renderParameters The [RenderParameters] to draw with
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
index 4414c28..833269b 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceControlClient.kt
@@ -27,6 +27,7 @@
import androidx.annotation.RestrictTo
import androidx.core.util.Consumer
import androidx.wear.watchface.Renderer
+import androidx.wear.watchface.WatchFaceService
import androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy
import androidx.wear.watchface.complications.data.ComplicationData
import androidx.wear.watchface.complications.data.ComplicationType
@@ -79,13 +80,52 @@
context,
Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE).apply {
setPackage(watchFacePackageName)
- }
+ },
+ null
+ )
+
+ /**
+ * Similar [createWatchFaceControlClient] this constructs a [WatchFaceControlClient] which
+ * attempts to connect to the watch face runtime in the android package
+ * [runtimePackageName].
+ *
+ * A watch face runtime is a special type of watch face, which renders a watch face
+ * described by resources in another package [resourceOnlyWatchFacePackageName].
+ *
+ * Currently Wear OS only supports the runtime for the Android Watch Face Format (see
+ * https://developer.android.com/training/wearables/wff for more details).
+ *
+ * @param context Calling application's [Context].
+ * @param runtimePackageName The name of the package containing the watch face runtime's
+ * control service to bind to.
+ * @param resourceOnlyWatchFacePackageName The name of the package from which to load the
+ * resource only watch face. This is exposed to the runtime via
+ * [WatchFaceService.resourceOnlyWatchFacePackageName]. Note only one watch face
+ * definition per resource only watch face package is supported.
+ * @return The [WatchFaceControlClient] if there is one.
+ * @throws [ServiceNotBoundException] if the watch face control service can not be bound or
+ * a [ServiceStartFailureException] if the watch face dies during startup.
+ */
+ @JvmStatic
+ @Throws(ServiceNotBoundException::class, ServiceStartFailureException::class)
+ public suspend fun createWatchFaceRuntimeControlClient(
+ context: Context,
+ runtimePackageName: String,
+ resourceOnlyWatchFacePackageName: String
+ ): WatchFaceControlClient =
+ createWatchFaceControlClientImpl(
+ context,
+ Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE).apply {
+ setPackage(runtimePackageName)
+ },
+ resourceOnlyWatchFacePackageName
)
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public suspend fun createWatchFaceControlClientImpl(
context: Context,
- intent: Intent
+ intent: Intent,
+ resourceOnlyWatchFacePackageName: String?
): WatchFaceControlClient {
val deferredService = CompletableDeferred<IWatchFaceControlService>()
val traceEvent = AsyncTraceEvent("WatchFaceControlClientImpl.bindService")
@@ -107,7 +147,12 @@
traceEvent.close()
throw ServiceNotBoundException()
}
- return WatchFaceControlClientImpl(context, deferredService.await(), serviceConnection)
+ return WatchFaceControlClientImpl(
+ context,
+ deferredService.await(),
+ serviceConnection,
+ resourceOnlyWatchFacePackageName
+ )
}
}
@@ -342,7 +387,8 @@
internal constructor(
private val context: Context,
private val service: IWatchFaceControlService,
- private val serviceConnection: ServiceConnection
+ private val serviceConnection: ServiceConnection,
+ private val resourceOnlyWatchFacePackageName: String?
) : WatchFaceControlClient {
private var closed = false
@@ -499,8 +545,8 @@
it.value.asWireComplicationData()
)
},
- null,
- null
+ /* auxiliaryComponentPackageName = */ resourceOnlyWatchFacePackageName,
+ /* auxiliaryComponentClassName = */ null
),
object : IPendingInteractiveWatchFace.Stub() {
override fun getApiVersion() =
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceMetadataClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceMetadataClient.kt
index f1569cb..a0dfe00 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceMetadataClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/WatchFaceMetadataClient.kt
@@ -93,6 +93,43 @@
)
}
+ /**
+ * Constructs a [WatchFaceMetadataClient] for fetching metadata for the specified resource
+ * only watch face from its runtime. A resource only watch face runtime is a special watch
+ * face that knows how to load watch faces from resources in another package that contains
+ * only resources and no executable code.
+ *
+ * @param context Calling application's [Context].
+ * @param watchFaceName The [ComponentName] of the watch face to fetch meta data from.
+ * @param runtimePackage The package that contains the Resource only Watch Face runtime.
+ * @return The [WatchFaceMetadataClient] if there is one.
+ * @throws [ServiceNotBoundException] if the underlying watch face control service can not
+ * be bound or a [ServiceStartFailureException] if the watch face dies during startup. If
+ * the service's manifest contains an
+ * androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data node then
+ * [PackageManager.NameNotFoundException] is thrown if [watchFaceName] is invalid.
+ */
+ @Throws(
+ ServiceNotBoundException::class,
+ ServiceStartFailureException::class,
+ PackageManager.NameNotFoundException::class
+ )
+ @SuppressWarnings("MissingJvmstatic") // Can't really call a suspend fun from java.
+ public suspend fun createForRuntime(
+ context: Context,
+ watchFaceName: ComponentName,
+ runtimePackage: String
+ ): WatchFaceMetadataClient {
+ return createImpl(
+ context,
+ Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE).apply {
+ setPackage(runtimePackage)
+ },
+ watchFaceName,
+ parserProvider = null
+ )
+ }
+
@Suppress("DEPRECATION") // getServiceInfo
internal fun isXmlVersionCompatible(
context: Context,
@@ -156,10 +193,10 @@
context: Context,
intent: Intent,
watchFaceName: ComponentName,
- parserProvider: ParserProvider
+ parserProvider: ParserProvider?
): WatchFaceMetadataClient {
// Check if there's static metadata we can read (fast).
- parserProvider.getParser(context, watchFaceName)?.let {
+ parserProvider?.getParser(context, watchFaceName)?.let {
return XmlWatchFaceMetadataClientImpl(
XmlSchemaAndComplicationSlotsDefinition.inflate(
context.packageManager.getResourcesForApplication(
diff --git a/wear/watchface/watchface-complications-data-source-samples/build.gradle b/wear/watchface/watchface-complications-data-source-samples/build.gradle
index e374bb3..8fe99bd 100644
--- a/wear/watchface/watchface-complications-data-source-samples/build.gradle
+++ b/wear/watchface/watchface-complications-data-source-samples/build.gradle
@@ -16,8 +16,7 @@
plugins {
id("AndroidXPlugin")
- id("com.android.library")
- id("kotlin-android")
+ id("com.android.application")
}
dependencies {
@@ -32,6 +31,26 @@
defaultConfig {
minSdkVersion 29
}
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android.txt')
+ }
+
+ /*
+ Release and debug targets will have different package names. Package name for debug version
+ will have suffix .debug, so this should be appended to package name when i.e. uninstalling.
+ */
+ debug {
+ applicationIdSuffix ".debug"
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility 1.8
+ targetCompatibility 1.8
+ }
namespace "androidx.wear.watchface.complications.datasource.samples"
}
-
diff --git a/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/HealthDataSourceServices.kt b/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/HealthDataSourceServices.kt
index ff02a33..ebb3a88 100644
--- a/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/HealthDataSourceServices.kt
+++ b/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/HealthDataSourceServices.kt
@@ -18,6 +18,7 @@
import android.Manifest.permission
import android.content.pm.PackageManager.PERMISSION_GRANTED
+import android.os.Build
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicString
import androidx.wear.protolayout.expression.PlatformHealthSources
@@ -137,6 +138,24 @@
request: ComplicationRequest,
listener: ComplicationRequestListener
) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ val text =
+ PlainComplicationText.Builder(getString(R.string.dynamic_data_not_supported))
+ .build()
+ listener.onComplicationData(
+ RangedValueComplicationData.Builder(
+ value = 0f,
+ min = 0f,
+ max = max,
+ contentDescription = text
+ )
+ .setTitle(title)
+ .setText(text)
+ .build()
+ )
+ return
+ }
+
val value = value
if (value == null) {
// Missing permission.
diff --git a/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/TimeDataSourceService.kt b/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/TimeDataSourceService.kt
index 5e9ccf8..fe284ca 100644
--- a/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/TimeDataSourceService.kt
+++ b/wear/watchface/watchface-complications-data-source-samples/src/main/java/androidx/wear/watchface/complications/datasource/samples/dynamic/TimeDataSourceService.kt
@@ -16,6 +16,7 @@
package androidx.wear.watchface.complications.datasource.samples.dynamic
+import android.os.Build
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicDuration
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicInstant
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicString
@@ -33,6 +34,21 @@
request: ComplicationRequest,
listener: ComplicationRequestListener
) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
+ val text = PlainComplicationText.Builder("--").build()
+ listener.onComplicationData(
+ RangedValueComplicationData.Builder(
+ value = 0f,
+ min = 0f,
+ max = 9f,
+ contentDescription = text
+ )
+ .setText(text)
+ .build()
+ )
+ return
+ }
+
val epochDuration: DynamicDuration =
DynamicInstant.withSecondsPrecision(EPOCH)
.durationUntil(DynamicInstant.platformTimeWithSecondsPrecision())
diff --git a/wear/watchface/watchface-complications-data-source/src/main/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.kt b/wear/watchface/watchface-complications-data-source/src/main/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.kt
index 59670b9..dd4398b 100644
--- a/wear/watchface/watchface-complications-data-source/src/main/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.kt
+++ b/wear/watchface/watchface-complications-data-source/src/main/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.kt
@@ -185,14 +185,21 @@
* - The manifest declaration of this service must include an intent filter for
* android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST.
* - A ComplicationDataSourceService must include a `meta-data` tag with
- * android.support.wearable.complications.SUPPORTED_TYPES in its manifest entry. The value of this
- * tag should be a comma separated list of types supported by the data source, from this table: |
- * Androidx class | Tag name | |--------------------------------------|-------------------| |
- * [GoalProgressComplicationData] | GOAL_PROGRESS | | [LongTextComplicationData] | LONG_TEXT | |
- * [MonochromaticImageComplicationData] | ICON | | [PhotoImageComplicationData] | LARGE_IMAGE | |
- * [RangedValueComplicationData] | RANGED_TEXT | | [ShortTextComplicationData] | SHORT_TEXT | |
- * [SmallImageComplicationData] | SMALL_IMAGE | | [WeightedElementsComplicationData] |
- * WEIGHTED_ELEMENTS |
+ * android.support.wearable.complications.SUPPORTED_TYPES in its manifest entry.
+ *
+ * The value of android.support.wearable.complications.SUPPORTED_TYPES should be a comma separated
+ * list of types supported by the data source, from this table:
+ *
+ * | Androidx class | Tag name |
+ * |--------------------------------------|-------------------|
+ * | [GoalProgressComplicationData] | GOAL_PROGRESS |
+ * | [LongTextComplicationData] | LONG_TEXT |
+ * | [MonochromaticImageComplicationData] | ICON |
+ * | [PhotoImageComplicationData] | LARGE_IMAGE |
+ * | [RangedValueComplicationData] | RANGED_TEXT |
+ * | [ShortTextComplicationData] | SHORT_TEXT |
+ * | [SmallImageComplicationData] | SMALL_IMAGE |
+ * | [WeightedElementsComplicationData] | WEIGHTED_ELEMENTS |
*
* The order in which types are listed has no significance. In the case where a watch face supports
* multiple types in a single complication slot, the watch face will determine which types it
@@ -230,33 +237,25 @@
* isForSafeWatchFace are gated behind the privileged permission
* `com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE`.
* - A ComplicationDataSourceService should include a `meta-data` tag with
- * android.support.wearable.complications.UPDATE_PERIOD_SECONDS its manifest entry. The value of
+ * `android.support.wearable.complications.UPDATE_PERIOD_SECONDS` its manifest entry. The value of
* this tag is the number of seconds the complication data source would like to elapse between
* update requests.
*
- * Note that update requests are not guaranteed to be sent with this frequency.
+ * **Note that update requests are not guaranteed to be sent with this frequency.** For
+ * complications with frequent updates they can also register a separate
+ * [METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS] meta data tag which supports sampling at up
+ * to 1Hz when the watch face is visible and non-ambient, however this also requires the
+ * DataSourceService to have the privileged permission
+ * `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`.
*
* If a complication data source never needs to receive update requests beyond the one sent when a
* complication is activated, the value of this tag should be 0.
*
- * For example, a complication data source that would like to update every ten minutes should
+ * For example, a complication data source that would like to update at most every hour should
* include the following in its manifest entry:
* ```
* <meta-data android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
- * android:value="600"/>
- * ```
- *
- * There is a lower limit for android.support.wearable.complications.UPDATE_PERIOD_SECONDS imposed
- * by the system to prevent excessive power drain. For complications with frequent updates they can
- * also register a separate [METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS] meta data tag which
- * supports sampling at up to 1Hz when the watch face is visible and non-ambient, however this also
- * requires the DataSourceService to have the privileged permission
- * `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`.
- *
- * ```
- * <meta-data android:name=
- * "androidx.wear.watchface.complications.data.source.IMMEDIATE_UPDATE_PERIOD_MILLISECONDS"
- * android:value="1000"/>
+ * android:value="3600"/>
* ```
* - A ComplicationDataSourceService can include a `meta-data` tag with
* android.support.wearable.complications.PROVIDER_CONFIG_ACTION its manifest entry to cause a
diff --git a/wear/watchface/watchface-complications-data-source/src/test/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceServiceTest.kt b/wear/watchface/watchface-complications-data-source/src/test/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceServiceTest.kt
index a5bfa74..8f2a7f2 100644
--- a/wear/watchface/watchface-complications-data-source/src/test/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceServiceTest.kt
+++ b/wear/watchface/watchface-complications-data-source/src/test/java/androidx/wear/watchface/complications/datasource/ComplicationDataSourceServiceTest.kt
@@ -17,6 +17,7 @@
import android.content.Intent
import android.content.res.Resources
+import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.HandlerThread
@@ -25,6 +26,7 @@
import android.support.wearable.complications.IComplicationManager
import android.support.wearable.complications.IComplicationProvider
import android.util.Log
+import androidx.annotation.RequiresApi
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicString
import androidx.wear.watchface.complications.data.ComplicationData
@@ -51,6 +53,7 @@
import org.mockito.Mockito.verify
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.mock
+import org.robolectric.annotation.Config
import org.robolectric.annotation.internal.DoNotInstrument
import org.robolectric.shadows.ShadowLog
import org.robolectric.shadows.ShadowLooper.runUiThreadTasks
@@ -308,6 +311,7 @@
.isEqualTo("hello preview")
}
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
enum class GetComplicationPreviewDataInvalidScenario(
val data: ComplicationData,
val message: String
@@ -374,6 +378,7 @@
}
@Test
+ @Config(minSdk = Build.VERSION_CODES.TIRAMISU)
fun testGetComplicationPreviewData_invalid_fails() {
for (scenario in GetComplicationPreviewDataInvalidScenario.values()) {
mService.previewData = scenario.data
diff --git a/wear/watchface/watchface-complications-data/api/current.txt b/wear/watchface/watchface-complications-data/api/current.txt
index 4d6aff8..80af828 100644
--- a/wear/watchface/watchface-complications-data/api/current.txt
+++ b/wear/watchface/watchface-complications-data/api/current.txt
@@ -92,7 +92,7 @@
property public final java.time.Instant instant;
}
- public final class DynamicComplicationText implements androidx.wear.watchface.complications.data.ComplicationText {
+ @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final class DynamicComplicationText implements androidx.wear.watchface.complications.data.ComplicationText {
ctor public DynamicComplicationText(androidx.wear.protolayout.expression.DynamicBuilders.DynamicString dynamicValue, CharSequence fallbackValue);
method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicString getDynamicValue();
method public CharSequence getFallbackValue();
@@ -116,7 +116,7 @@
@RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final class GoalProgressComplicationData extends androidx.wear.watchface.complications.data.ComplicationData {
method public androidx.wear.watchface.complications.data.ColorRamp? getColorRamp();
method public androidx.wear.watchface.complications.data.ComplicationText? getContentDescription();
- method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
+ method @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method public androidx.wear.watchface.complications.data.MonochromaticImage? getMonochromaticImage();
method public androidx.wear.watchface.complications.data.SmallImage? getSmallImage();
method public float getTargetValue();
@@ -125,7 +125,7 @@
method public float getValue();
property public final androidx.wear.watchface.complications.data.ColorRamp? colorRamp;
property public final androidx.wear.watchface.complications.data.ComplicationText? contentDescription;
- property public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
+ property @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
property public final androidx.wear.watchface.complications.data.MonochromaticImage? monochromaticImage;
property public final androidx.wear.watchface.complications.data.SmallImage? smallImage;
property public final float targetValue;
@@ -138,7 +138,7 @@
}
@RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public static final class GoalProgressComplicationData.Builder {
- ctor public GoalProgressComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
+ ctor @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public GoalProgressComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
ctor public GoalProgressComplicationData.Builder(float value, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
method public androidx.wear.watchface.complications.data.GoalProgressComplicationData build();
method public androidx.wear.watchface.complications.data.GoalProgressComplicationData.Builder setColorRamp(androidx.wear.watchface.complications.data.ColorRamp? colorRamp);
@@ -321,7 +321,7 @@
public final class RangedValueComplicationData extends androidx.wear.watchface.complications.data.ComplicationData {
method public androidx.wear.watchface.complications.data.ColorRamp? getColorRamp();
method public androidx.wear.watchface.complications.data.ComplicationText? getContentDescription();
- method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
+ method @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method public float getMax();
method public float getMin();
method public androidx.wear.watchface.complications.data.MonochromaticImage? getMonochromaticImage();
@@ -332,7 +332,7 @@
method public int getValueType();
property public final androidx.wear.watchface.complications.data.ColorRamp? colorRamp;
property public final androidx.wear.watchface.complications.data.ComplicationText? contentDescription;
- property public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
+ property @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
property public final float max;
property public final float min;
property public final androidx.wear.watchface.complications.data.MonochromaticImage? monochromaticImage;
@@ -350,6 +350,7 @@
}
public static final class RangedValueComplicationData.Builder {
+ ctor @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public RangedValueComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float min, float max, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
ctor public RangedValueComplicationData.Builder(float value, float min, float max, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
method public androidx.wear.watchface.complications.data.RangedValueComplicationData build();
method public androidx.wear.watchface.complications.data.RangedValueComplicationData.Builder setColorRamp(androidx.wear.watchface.complications.data.ColorRamp? colorRamp);
diff --git a/wear/watchface/watchface-complications-data/api/restricted_current.txt b/wear/watchface/watchface-complications-data/api/restricted_current.txt
index 4d6aff8..80af828 100644
--- a/wear/watchface/watchface-complications-data/api/restricted_current.txt
+++ b/wear/watchface/watchface-complications-data/api/restricted_current.txt
@@ -92,7 +92,7 @@
property public final java.time.Instant instant;
}
- public final class DynamicComplicationText implements androidx.wear.watchface.complications.data.ComplicationText {
+ @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final class DynamicComplicationText implements androidx.wear.watchface.complications.data.ComplicationText {
ctor public DynamicComplicationText(androidx.wear.protolayout.expression.DynamicBuilders.DynamicString dynamicValue, CharSequence fallbackValue);
method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicString getDynamicValue();
method public CharSequence getFallbackValue();
@@ -116,7 +116,7 @@
@RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final class GoalProgressComplicationData extends androidx.wear.watchface.complications.data.ComplicationData {
method public androidx.wear.watchface.complications.data.ColorRamp? getColorRamp();
method public androidx.wear.watchface.complications.data.ComplicationText? getContentDescription();
- method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
+ method @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method public androidx.wear.watchface.complications.data.MonochromaticImage? getMonochromaticImage();
method public androidx.wear.watchface.complications.data.SmallImage? getSmallImage();
method public float getTargetValue();
@@ -125,7 +125,7 @@
method public float getValue();
property public final androidx.wear.watchface.complications.data.ColorRamp? colorRamp;
property public final androidx.wear.watchface.complications.data.ComplicationText? contentDescription;
- property public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
+ property @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
property public final androidx.wear.watchface.complications.data.MonochromaticImage? monochromaticImage;
property public final androidx.wear.watchface.complications.data.SmallImage? smallImage;
property public final float targetValue;
@@ -138,7 +138,7 @@
}
@RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public static final class GoalProgressComplicationData.Builder {
- ctor public GoalProgressComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
+ ctor @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public GoalProgressComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
ctor public GoalProgressComplicationData.Builder(float value, float targetValue, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
method public androidx.wear.watchface.complications.data.GoalProgressComplicationData build();
method public androidx.wear.watchface.complications.data.GoalProgressComplicationData.Builder setColorRamp(androidx.wear.watchface.complications.data.ColorRamp? colorRamp);
@@ -321,7 +321,7 @@
public final class RangedValueComplicationData extends androidx.wear.watchface.complications.data.ComplicationData {
method public androidx.wear.watchface.complications.data.ColorRamp? getColorRamp();
method public androidx.wear.watchface.complications.data.ComplicationText? getContentDescription();
- method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
+ method @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method public float getMax();
method public float getMin();
method public androidx.wear.watchface.complications.data.MonochromaticImage? getMonochromaticImage();
@@ -332,7 +332,7 @@
method public int getValueType();
property public final androidx.wear.watchface.complications.data.ColorRamp? colorRamp;
property public final androidx.wear.watchface.complications.data.ComplicationText? contentDescription;
- property public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
+ property @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public final androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? dynamicValue;
property public final float max;
property public final float min;
property public final androidx.wear.watchface.complications.data.MonochromaticImage? monochromaticImage;
@@ -350,6 +350,7 @@
}
public static final class RangedValueComplicationData.Builder {
+ ctor @RequiresApi(android.os.Build.VERSION_CODES.TIRAMISU) public RangedValueComplicationData.Builder(androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat dynamicValue, float fallbackValue, float min, float max, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
ctor public RangedValueComplicationData.Builder(float value, float min, float max, androidx.wear.watchface.complications.data.ComplicationText contentDescription);
method public androidx.wear.watchface.complications.data.RangedValueComplicationData build();
method public androidx.wear.watchface.complications.data.RangedValueComplicationData.Builder setColorRamp(androidx.wear.watchface.complications.data.ColorRamp? colorRamp);
diff --git a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/ComplicationDataEvaluator.kt b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/ComplicationDataEvaluator.kt
index 830ced78..619c2c7 100644
--- a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/ComplicationDataEvaluator.kt
+++ b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/ComplicationDataEvaluator.kt
@@ -51,6 +51,7 @@
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
+import kotlinx.coroutines.flow.map
import kotlinx.coroutines.invoke
import kotlinx.coroutines.launch
@@ -148,21 +149,34 @@
*/
private fun WireComplicationData.topLevelSetterFlows(): List<Flow<WireComplicationDataSetter>> =
buildList {
- if (hasRangedDynamicValue()) {
+ if (hasRangedDynamicValue() && rangedDynamicValue != null) {
add(
- bindDynamicFloat(
- rangedDynamicValue,
- dynamicValueTrimmer = { setRangedDynamicValue(null) },
- floatSetter = { setRangedValue(it) },
- )
+ rangedDynamicValue!!
+ .evaluate()
+ .toDataSetter(
+ setter = { setRangedValue(it) },
+ dynamicValueTrimmer = { setRangedDynamicValue(null) },
+ )
)
}
- if (hasLongText()) add(bindDynamicText(longText) { setLongText(it) })
- if (hasLongTitle()) add(bindDynamicText(longTitle) { setLongTitle(it) })
- if (hasShortText()) add(bindDynamicText(shortText) { setShortText(it) })
- if (hasShortTitle()) add(bindDynamicText(shortTitle) { setShortTitle(it) })
- if (hasContentDescription()) {
- add(bindDynamicText(contentDescription) { setContentDescription(it) })
+ if (hasLongText() && longText?.dynamicValue != null) {
+ add(longText!!.dynamicValue!!.evaluateToTextSetter { setLongText(it) })
+ }
+ if (hasLongTitle() && longTitle?.dynamicValue != null) {
+ add(longTitle!!.dynamicValue!!.evaluateToTextSetter { setLongTitle(it) })
+ }
+ if (hasShortText() && shortText?.dynamicValue != null) {
+ add(shortText!!.dynamicValue!!.evaluateToTextSetter { setShortText(it) })
+ }
+ if (hasShortTitle() && shortTitle?.dynamicValue != null) {
+ add(shortTitle!!.dynamicValue!!.evaluateToTextSetter { setShortTitle(it) })
+ }
+ if (hasContentDescription() && contentDescription?.dynamicValue != null) {
+ add(
+ contentDescription!!.dynamicValue!!.evaluateToTextSetter {
+ setContentDescription(it)
+ }
+ )
}
}
@@ -231,91 +245,92 @@
}
}
- /**
- * Returns a [Flow] of [WireComplicationDataSetter] based on [DynamicFloat] evaluation.
- *
- * Uses the generic [bindDynamicType] that provides a default [Executor] and
- * [DynamicTypeValueReceiver] based on the generated [Flow].
- */
- private fun bindDynamicFloat(
- dynamicFloat: DynamicFloat?,
+ /** Converts a generic flow to a [WireComplicationDataSetter]. */
+ private fun <T : Any> Flow<T?>.toDataSetter(
+ setter: WireComplicationData.Builder.(T) -> WireComplicationData.Builder,
dynamicValueTrimmer: WireComplicationData.Builder.() -> WireComplicationData.Builder,
- floatSetter: WireComplicationData.Builder.(Float) -> WireComplicationData.Builder,
): Flow<WireComplicationDataSetter> {
- // If there's no dynamic value, return a no-op setter.
- dynamicFloat ?: return flowOf { it }
- return bindDynamicType(
+ return map { value ->
+ if (value == null) return@map { null } // emit invalidating setter.
+ { builder ->
+ var newBuilder = setter(builder, value)
+ if (!keepDynamicValues) newBuilder = dynamicValueTrimmer(newBuilder)
+ newBuilder
+ }
+ }
+ }
+
+ /**
+ * Evaluates a [DynamicString] and converts it to a [WireComplicationDataSetter].
+ *
+ * This combines [DynamicString.evaluate] and [toDataSetter] because the trimming requires the
+ * evaluated [DynamicString], so combining it avoids mentioning it twice, i.e.:
+ * ```
+ * dynamicString.evaluate().toTextSetter(dynamicString) { ... }
+ * ```
+ */
+ private fun DynamicString.evaluateToTextSetter(
+ setter: WireComplicationData.Builder.(WireComplicationText) -> WireComplicationData.Builder,
+ ): Flow<WireComplicationDataSetter> =
+ evaluate()
+ .toDataSetter(
+ setter = { value ->
+ if (keepDynamicValues) {
+ setter(WireComplicationText(value, this@evaluateToTextSetter))
+ } else {
+ setter(WireComplicationText(value))
+ }
+ },
+ dynamicValueTrimmer = { this }, // Trimming is done in setter.
+ )
+
+ /**
+ * Binds a [DynamicFloat], returning a [Flow] of [Float] or `null` if the binding is
+ * invalidated.
+ */
+ private fun DynamicFloat.evaluate(): Flow<Float?> {
+ return evaluateDynamicType(
bindingRequest = { executor, receiver ->
- DynamicTypeBindingRequest.forDynamicFloat(dynamicFloat, executor, receiver)
- },
- builderSetter = { builder, value ->
- val trimmed = if (keepDynamicValues) builder else dynamicValueTrimmer(builder)
- floatSetter(trimmed, value)
+ DynamicTypeBindingRequest.forDynamicFloat(this@evaluate, executor, receiver)
}
)
}
/**
- * Returns a [Flow] of [WireComplicationDataSetter] based on [DynamicString] evaluation (within
- * a [WireComplicationText].
- *
- * Uses the generic [bindDynamicType] that provides a default [Executor] and
- * [DynamicTypeValueReceiver] based on the generated [Flow].
+ * Binds a [DynamicString], returning a [Flow] of [String] or `null` if the binding is
+ * invalidated.
*/
- private fun bindDynamicText(
- unevaluatedText: WireComplicationText?,
- textSetter:
- WireComplicationData.Builder.(WireComplicationText) -> WireComplicationData.Builder,
- ): Flow<WireComplicationDataSetter> {
- // If there's no dynamic value, return a no-op setter.
- val dynamicString: DynamicString = unevaluatedText?.dynamicValue ?: return flowOf { it }
- return bindDynamicType(
+ private fun DynamicString.evaluate(): Flow<String?> {
+ return evaluateDynamicType(
bindingRequest = { executor, receiver ->
DynamicTypeBindingRequest.forDynamicString(
- dynamicString,
+ this@evaluate,
ULocale.getDefault(),
executor,
receiver,
)
- },
- builderSetter = { builder, value ->
- val evaluatedText =
- if (keepDynamicValues) {
- WireComplicationText(value, dynamicString)
- } else {
- WireComplicationText(value)
- }
- textSetter(builder, evaluatedText)
}
)
}
/**
- * Returns a [Flow] of [WireComplicationDataSetter] based on a [DynamicTypeBindingRequest] and a
- * [builderSetter] that takes the evaluated raw value and sets the relevant builder field..
- *
- * In high-level terms, this converts the [DynamicTypeValueReceiver] callback given to
- * [DynamicTypeEvaluator.bind] into a Kotlin [Flow], for easier use (e.g. to [combine] binding
- * of multiple fields). The [Flow] is conflated (ignoring emissions that we didn't have time to
- * process), as only the latest evaluation matters.
+ * Converts [DynamicTypeEvaluator.bind] to [Flow], emitting `null` when the binding is
+ * invalidated.
*
* The actual implementation of [DynamicTypeValueReceiver] is separated to the helper class
- * [DynamicTypeValueReceiverToChannelConverter].
+ * [DynamicTypeValueReceiverToChannel].
*/
- private fun <T : Any> bindDynamicType(
+ private fun <T : Any> evaluateDynamicType(
bindingRequest: (Executor, DynamicTypeValueReceiver<T>) -> DynamicTypeBindingRequest,
- builderSetter: (WireComplicationData.Builder, T) -> WireComplicationData.Builder,
- ): Flow<WireComplicationDataSetter> =
+ ): Flow<T?> =
callbackFlow {
// Binding DynamicTypeEvaluator to the provided binding request.
val boundDynamicType: BoundDynamicType =
evaluator.bind(
bindingRequest(
currentCoroutineContext().asExecutor(),
- DynamicTypeValueReceiverToChannelConverter(
- /* callbackFlow */ channel,
- builderSetter
- )
+ // Emitting values to the callbackFlow's channel.
+ DynamicTypeValueReceiverToChannel(channel)
)
)
// Start evaluation.
@@ -331,26 +346,21 @@
/**
* Converts [DynamicTypeValueReceiver] into a [SendChannel] (from a [callbackFlow]).
*
- * When [onData] is invoked, emits a method that applies the [builderSetter] on the data. When
- * [onInvalidated] is invoked, emits a method that returns `null`.
+ * [onData] emits the value, [onInvalidated] emits `null`.
*/
- private class DynamicTypeValueReceiverToChannelConverter<T : Any>(
- private val channel: SendChannel<WireComplicationDataSetter>,
- private val builderSetter:
- (WireComplicationData.Builder, T) -> WireComplicationData.Builder,
+ private class DynamicTypeValueReceiverToChannel<T : Any>(
+ private val channel: SendChannel<T?>,
) : DynamicTypeValueReceiver<T> {
override fun onData(newData: T) {
channel
- // Setter method that applies the builderSetter.
- .trySend { builder -> builderSetter(builder, newData) }
+ .trySend(newData)
// Shouldn't fail for overflow as we conflate the flow.
.onFailure { e -> Log.e(TAG, "Failed sending dynamic update.", e) }
}
override fun onInvalidated() {
channel
- // Setter method that returns null.
- .trySend { null }
+ .trySend(null)
// Shouldn't fail for overflow as we conflate the flow.
.onFailure { e -> Log.e(TAG, "Failed sending dynamic update.", e) }
}
diff --git a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Data.kt b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Data.kt
index ed289b7..0244924 100644
--- a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Data.kt
+++ b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Data.kt
@@ -246,7 +246,8 @@
}
/**
- * Sets the complication's fallback, used in case any dynamic value has been invalidated.
+ * Sets the complication's fallback, used in case any dynamic value cannot be evaluated,
+ * e.g. when a data source is not available.
*
* IMPORTANT: This is only used when the system supports dynamic values. See each dynamic
* value field's fallback companion field for the situation where the system does not
@@ -881,7 +882,7 @@
public class RangedValueComplicationData
internal constructor(
public val value: Float,
- public val dynamicValue: DynamicFloat?,
+ @get:RequiresApi(Build.VERSION_CODES.TIRAMISU) public val dynamicValue: DynamicFloat?,
public val min: Float,
public val max: Float,
public val monochromaticImage: MonochromaticImage?,
@@ -976,8 +977,8 @@
* semantic meaning of value can be specified via [setValueType].
*
* IMPORTANT: This is only used when the system does not support dynamic values _at all_.
- * See [setDynamicValueInvalidationFallback] for the situation where the dynamic value has
- * been invalidated.
+ * See [setDynamicValueInvalidationFallback] for the situation where the dynamic value
+ * cannot be evaluated, e.g. when a data source is not available.
*
* @param min The minimum value. For [TYPE_PERCENTAGE] this must be 0f.
* @param max The maximum value. This must be less than [Float.MAX_VALUE]. For
@@ -987,7 +988,7 @@
* complications do not have textual representation this attribute can be used for
* providing such. Please do not include the word 'complication' in the description.
*/
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
public constructor(
dynamicValue: DynamicFloat,
fallbackValue: Float,
@@ -1245,7 +1246,7 @@
public class GoalProgressComplicationData
internal constructor(
public val value: Float,
- public val dynamicValue: DynamicFloat?,
+ @get:RequiresApi(Build.VERSION_CODES.TIRAMISU) public val dynamicValue: DynamicFloat?,
public val targetValue: Float,
public val monochromaticImage: MonochromaticImage?,
public val smallImage: SmallImage?,
@@ -1324,8 +1325,8 @@
* systems that don't support dynamic values, and should be >= 0.
*
* IMPORTANT: This is only used when the system does not support dynamic values _at all_.
- * See [setDynamicValueInvalidationFallback] for the situation where the dynamic value has
- * been invalidated.
+ * See [setDynamicValueInvalidationFallback] for the situation where the dynamic value
+ * cannot be evaluated, e.g. when a data source is not available.
*
* @param targetValue The target value. This must be less than [Float.MAX_VALUE].
* @param contentDescription Defines localized text that briefly describes content of the
@@ -1333,6 +1334,7 @@
* complications do not have textual representation this attribute can be used for
* providing such. Please do not include the word 'complication' in the description.
*/
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
public constructor(
dynamicValue: DynamicFloat,
fallbackValue: Float,
diff --git a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Text.kt b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Text.kt
index 89fb62e..2652d18 100644
--- a/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Text.kt
+++ b/wear/watchface/watchface-complications-data/src/main/java/androidx/wear/watchface/complications/data/Text.kt
@@ -16,8 +16,10 @@
package androidx.wear.watchface.complications.data
+import android.annotation.SuppressLint
import android.content.res.Resources
import android.icu.util.TimeZone
+import android.os.Build
import android.support.wearable.complications.ComplicationData as WireComplicationData
import android.support.wearable.complications.ComplicationText as WireComplicationText
import android.support.wearable.complications.ComplicationText.TimeDifferenceBuilder as WireComplicationTextTimeDifferenceBuilder
@@ -32,6 +34,7 @@
import android.text.style.SuperscriptSpan
import android.text.style.TypefaceSpan
import android.text.style.UnderlineSpan
+import androidx.annotation.RequiresApi
import androidx.annotation.RestrictTo
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicString
import java.time.Instant
@@ -542,6 +545,7 @@
}
/** Converts a [WireComplicationText] into an equivalent [ComplicationText] instead. */
+@SuppressLint("NewApi") // This is what's in the wire format, regardless of whether it's supported.
internal fun WireComplicationText.toApiComplicationText(
placeholderAware: Boolean = false
): ComplicationText =
@@ -611,9 +615,10 @@
* @param fallbackValue Used when the system does not support dynamic values.
*
* IMPORTANT: This is only used when the system does not support dynamic values _at all_. See
- * [ComplicationData.BaseBuilder.setDynamicValueInvalidationFallback] for the situation where the
- * dynamic value has been invalidated.
+ * [ComplicationData.dynamicValueInvalidationFallback] for the situation where the dynamic value
+ * cannot be evaluated, e.g. when a data source is not available.
*/
+@RequiresApi(Build.VERSION_CODES.TIRAMISU)
public class DynamicComplicationText(
public val dynamicValue: DynamicString,
public val fallbackValue: CharSequence,
diff --git a/wear/watchface/watchface-complications-data/src/test/java/androidx/wear/watchface/complications/data/TextTest.kt b/wear/watchface/watchface-complications-data/src/test/java/androidx/wear/watchface/complications/data/TextTest.kt
index 0af4fd4..6acc27c 100644
--- a/wear/watchface/watchface-complications-data/src/test/java/androidx/wear/watchface/complications/data/TextTest.kt
+++ b/wear/watchface/watchface-complications-data/src/test/java/androidx/wear/watchface/complications/data/TextTest.kt
@@ -18,6 +18,7 @@
import android.content.Context
import android.icu.util.TimeZone
+import android.os.Build
import android.support.wearable.complications.ComplicationText as WireComplicationText
import android.support.wearable.complications.ComplicationText.TimeDifferenceBuilder as WireTimeDifferenceBuilder
import android.support.wearable.complications.ComplicationText.TimeFormatBuilder as WireTimeFormatBuilder
@@ -31,6 +32,7 @@
import org.junit.Assert.assertNull
import org.junit.Test
import org.junit.runner.RunWith
+import org.robolectric.annotation.Config
@RunWith(SharedRobolectricTestRunner::class)
public class AsWireComplicationTextTest {
@@ -124,6 +126,7 @@
}
@Test
+ @Config(minSdk = Build.VERSION_CODES.TIRAMISU)
public fun dynamicText() {
val text = DynamicComplicationText(DynamicString.constant("dynamic"), "fallback")
@@ -208,6 +211,7 @@
}
@Test
+ @Config(minSdk = Build.VERSION_CODES.TIRAMISU)
public fun dynamicText() {
val wireText = WireComplicationText("fallback", DynamicString.constant("dynamic"))
diff --git a/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/ComplicationDrawableTest.java b/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/ComplicationDrawableTest.java
index 5baf25b..1241de7 100644
--- a/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/ComplicationDrawableTest.java
+++ b/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/ComplicationDrawableTest.java
@@ -65,10 +65,12 @@
import org.jetbrains.annotations.Nullable;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
import org.robolectric.Robolectric;
import org.robolectric.annotation.internal.DoNotInstrument;
@@ -89,16 +91,16 @@
private androidx.wear.watchface.complications.data.ComplicationData mComplicationData;
private int mDefaultTextSize;
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
+
@Mock Canvas mMockCanvas;
@Mock Drawable mMockDrawableActive;
@Mock Drawable mMockDrawableAmbient;
@Mock PendingIntent mMockPendingIntent;
@Mock Drawable.Callback mMockDrawableCallback;
- @SuppressWarnings("deprecation") // b/251211092
@Before
public void setUp() {
- MockitoAnnotations.openMocks(this);
mComplicationDrawable = new ComplicationDrawable();
mComplicationDrawable.setCallback(mMockDrawableCallback);
diff --git a/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/RoundedDrawableTest.java b/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/RoundedDrawableTest.java
index 3ffc761..d4d5393 100644
--- a/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/RoundedDrawableTest.java
+++ b/wear/watchface/watchface-complications-rendering/src/test/java/androidx/wear/watchface/complications/rendering/RoundedDrawableTest.java
@@ -33,10 +33,12 @@
import androidx.test.core.app.ApplicationProvider;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
import org.robolectric.annotation.internal.DoNotInstrument;
/** Tests for {@link RoundedDrawable} */
@@ -50,12 +52,12 @@
private RoundedDrawable mRoundedDrawable;
private BitmapDrawable mBitmapDrawable;
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
+
@Mock Canvas mMockCanvas;
- @SuppressWarnings("deprecation") // b/251211092
@Before
public void setUp() {
- MockitoAnnotations.openMocks(this);
mRoundedDrawable = new RoundedDrawable();
mBitmapDrawable =
new BitmapDrawable(
diff --git a/wear/watchface/watchface-complications/api/current.txt b/wear/watchface/watchface-complications/api/current.txt
index cb7f48e..ebc68f2 100644
--- a/wear/watchface/watchface-complications/api/current.txt
+++ b/wear/watchface/watchface-complications/api/current.txt
@@ -90,6 +90,7 @@
field public static final int DATA_SOURCE_TIME_AND_DATE = 3; // 0x3
field public static final int DATA_SOURCE_UNREAD_NOTIFICATION_COUNT = 7; // 0x7
field public static final int DATA_SOURCE_WATCH_BATTERY = 1; // 0x1
+ field @RequiresApi(android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final int DATA_SOURCE_WEATHER = 17; // 0x11
field public static final int DATA_SOURCE_WORLD_CLOCK = 5; // 0x5
field public static final int NO_DATA_SOURCE = -1; // 0xffffffff
}
diff --git a/wear/watchface/watchface-complications/api/restricted_current.txt b/wear/watchface/watchface-complications/api/restricted_current.txt
index cb7f48e..ebc68f2 100644
--- a/wear/watchface/watchface-complications/api/restricted_current.txt
+++ b/wear/watchface/watchface-complications/api/restricted_current.txt
@@ -90,6 +90,7 @@
field public static final int DATA_SOURCE_TIME_AND_DATE = 3; // 0x3
field public static final int DATA_SOURCE_UNREAD_NOTIFICATION_COUNT = 7; // 0x7
field public static final int DATA_SOURCE_WATCH_BATTERY = 1; // 0x1
+ field @RequiresApi(android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) public static final int DATA_SOURCE_WEATHER = 17; // 0x11
field public static final int DATA_SOURCE_WORLD_CLOCK = 5; // 0x5
field public static final int NO_DATA_SOURCE = -1; // 0xffffffff
}
diff --git a/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/DefaultComplicationDataSourcePolicy.kt b/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/DefaultComplicationDataSourcePolicy.kt
index 1ae59f1..c142a0d2 100644
--- a/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/DefaultComplicationDataSourcePolicy.kt
+++ b/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/DefaultComplicationDataSourcePolicy.kt
@@ -355,6 +355,11 @@
}
val systemDataSourceFallback =
parser.getAttributeIntValue(NAMESPACE_APP, "systemDataSourceFallback", 0)
+ require(SystemDataSources.isAllowedOnDevice(systemDataSourceFallback)) {
+ "$nodeName at line ${parser.lineNumber} cannot have the supplied " +
+ "systemDataSourceFallback value at the current API level."
+ }
+
require(parser.hasValue("systemDataSourceFallbackDefaultType")) {
"A $nodeName must have a systemDataSourceFallbackDefaultType attribute"
}
diff --git a/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/SystemDataSources.kt b/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/SystemDataSources.kt
index b3d620f..d0053b3 100644
--- a/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/SystemDataSources.kt
+++ b/wear/watchface/watchface-complications/src/main/java/androidx/wear/watchface/complications/SystemDataSources.kt
@@ -15,7 +15,9 @@
*/
package androidx.wear.watchface.complications
+import android.os.Build
import androidx.annotation.IntDef
+import androidx.annotation.RequiresApi
import androidx.annotation.RestrictTo
import androidx.wear.watchface.complications.data.ComplicationType
@@ -25,7 +27,7 @@
*/
public class SystemDataSources private constructor() {
public companion object {
- // NEXT AVAILABLE DATA SOURCE ID: 17
+ // NEXT AVAILABLE DATA SOURCE ID: 18
/** Specifies that no complication data source should be used. */
public const val NO_DATA_SOURCE: Int = -1
@@ -177,6 +179,29 @@
* This complication data source supports only [ComplicationType.SHORT_TEXT].
*/
public const val DATA_SOURCE_DAY_AND_DATE: Int = 16
+
+ /**
+ * Id for the 'weather' complication complication data source.
+ *
+ * This is a safe complication data source, so if a watch face uses this as a default it
+ * will be able to receive data from it even before the RECEIVE_COMPLICATION_DATA permission
+ * has been granted.
+ *
+ * This complication data source supports the following types:
+ * [ComplicationType.SHORT_TEXT], [ComplicationType.LONG_TEXT],
+ * [ComplicationType.SMALL_IMAGE].
+ */
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ public const val DATA_SOURCE_WEATHER: Int = 17
+
+ /** Checks if the given data source is implemented by the device. */
+ internal fun isAllowedOnDevice(@DataSourceId systemDataSourceFallback: Int): Boolean {
+ return when {
+ systemDataSourceFallback == DATA_SOURCE_WEATHER &&
+ Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> false
+ else -> true
+ }
+ }
}
/** System complication data source id as defined in [SystemDataSources]. */
@@ -193,7 +218,8 @@
DATA_SOURCE_SUNRISE_SUNSET,
DATA_SOURCE_DAY_OF_WEEK,
DATA_SOURCE_FAVORITE_CONTACT,
- DATA_SOURCE_DAY_AND_DATE
+ DATA_SOURCE_DAY_AND_DATE,
+ DATA_SOURCE_WEATHER,
)
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Retention(AnnotationRetention.SOURCE)
diff --git a/wear/watchface/watchface-data/src/main/java/androidx/wear/watchface/control/data/WallpaperInteractiveWatchFaceInstanceParams.java b/wear/watchface/watchface-data/src/main/java/androidx/wear/watchface/control/data/WallpaperInteractiveWatchFaceInstanceParams.java
index 5e20ee5..f9ea844 100644
--- a/wear/watchface/watchface-data/src/main/java/androidx/wear/watchface/control/data/WallpaperInteractiveWatchFaceInstanceParams.java
+++ b/wear/watchface/watchface-data/src/main/java/androidx/wear/watchface/control/data/WallpaperInteractiveWatchFaceInstanceParams.java
@@ -145,6 +145,16 @@
mIdAndComplicationDataWireFormats = idAndComplicationDataWireFormats;
}
+ @Nullable
+ public String getAuxiliaryComponentClassName() {
+ return mAuxiliaryComponentClassName;
+ }
+
+ @Nullable
+ public String getAuxiliaryComponentPackageName() {
+ return mAuxiliaryComponentPackageName;
+ }
+
/**
* Serializes this WallpaperInteractiveWatchFaceInstanceParams to the specified {@link Parcel}.
*/
diff --git a/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt b/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt
index e7e8235..561aa31 100644
--- a/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt
+++ b/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt
@@ -94,6 +94,7 @@
import androidx.wear.watchface.style.UserStyleSetting.ListUserStyleSetting.ListOption
import androidx.wear.watchface.style.UserStyleSetting.Option
import androidx.wear.watchface.style.WatchFaceLayer
+import androidx.wear.watchface.style.data.UserStyleWireFormat
import com.google.common.truth.Truth.assertThat
import java.lang.IllegalArgumentException
import java.time.Instant
@@ -1262,15 +1263,16 @@
assertThat(editorSession.complicationsDataSourceInfo.value[LEFT_COMPLICATION_ID]!!.name)
.isEqualTo("TestDataSource3")
+ val intent = TestComplicationHelperActivity.lastIntent!!
assertThat(
- TestComplicationHelperActivity.lastIntent
- ?.extras
- ?.getString(ComplicationDataSourceChooserIntent.EXTRA_WATCHFACE_INSTANCE_ID)
+ intent.extras?.getString(
+ ComplicationDataSourceChooserIntent.EXTRA_WATCHFACE_INSTANCE_ID
+ )
)
.isEqualTo(testInstanceId.id)
assertThat(
- (TestComplicationHelperActivity.lastIntent?.getParcelableExtra(
+ (intent.getParcelableExtra(
ComplicationDataSourceChooserIntent.EXTRA_COMPLICATION_DENIED
) as Intent?)
?.action
@@ -1278,7 +1280,7 @@
.isEqualTo(complicationDeniedDialogIntent.action)
assertThat(
- (TestComplicationHelperActivity.lastIntent?.getParcelableExtra(
+ (intent.getParcelableExtra(
ComplicationDataSourceChooserIntent.EXTRA_COMPLICATION_RATIONALE
) as Intent?)
?.action
@@ -1289,6 +1291,12 @@
// it's set up.
assertThat(editorSession.complicationSlotsState.value[LEFT_COMPLICATION_ID]!!.bounds)
.isEqualTo(Rect(40, 160, 160, 240))
+
+ val userStyleWireFormat =
+ intent.getParcelableExtra(ComplicationDataSourceChooserIntent.EXTRA_USER_STYLE)
+ as UserStyleWireFormat?
+ assertThat(UserStyleData(userStyleWireFormat!!))
+ .isEqualTo(editorSession.userStyle.value.toUserStyleData())
}
}
diff --git a/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt b/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
index 55da8af..acfcd72 100644
--- a/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
+++ b/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
@@ -1130,6 +1130,7 @@
input.instanceId,
input.showComplicationDeniedDialogIntent,
input.showComplicationRationaleDialogIntent,
+ input.editorSession.userStyle.value.toUserStyleData()
)
val complicationState = complicationSlotsState[input.complicationSlotId]!!
intent.replaceExtras(
diff --git a/wear/watchface/watchface-guava/api/current.txt b/wear/watchface/watchface-guava/api/current.txt
index 2460e8b2..115e276 100644
--- a/wear/watchface/watchface-guava/api/current.txt
+++ b/wear/watchface/watchface-guava/api/current.txt
@@ -43,6 +43,12 @@
method @UiThread public final void runUiThreadGlCommands(Runnable runnable);
}
+ public abstract class ListenableWatchFaceRuntimeService extends androidx.wear.watchface.WatchFaceRuntimeService {
+ ctor public ListenableWatchFaceRuntimeService();
+ method protected final suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ method protected abstract com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.WatchFace> createWatchFaceFutureAsync(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName);
+ }
+
public abstract class ListenableWatchFaceService extends androidx.wear.watchface.WatchFaceService {
ctor public ListenableWatchFaceService();
method protected suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
diff --git a/wear/watchface/watchface-guava/api/restricted_current.txt b/wear/watchface/watchface-guava/api/restricted_current.txt
index 2460e8b2..115e276 100644
--- a/wear/watchface/watchface-guava/api/restricted_current.txt
+++ b/wear/watchface/watchface-guava/api/restricted_current.txt
@@ -43,6 +43,12 @@
method @UiThread public final void runUiThreadGlCommands(Runnable runnable);
}
+ public abstract class ListenableWatchFaceRuntimeService extends androidx.wear.watchface.WatchFaceRuntimeService {
+ ctor public ListenableWatchFaceRuntimeService();
+ method protected final suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ method protected abstract com.google.common.util.concurrent.ListenableFuture<androidx.wear.watchface.WatchFace> createWatchFaceFutureAsync(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName);
+ }
+
public abstract class ListenableWatchFaceService extends androidx.wear.watchface.WatchFaceService {
ctor public ListenableWatchFaceService();
method protected suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRenderer2Test.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRenderer2Test.kt
index c831044..540297d 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRenderer2Test.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRenderer2Test.kt
@@ -137,11 +137,12 @@
initFuture,
sharedAssetsFuture
)
+ val controlClient = createWatchFaceControlClientService()
val deferredClient =
handlerCoroutineScope.async {
@Suppress("deprecation")
- watchFaceControlClientService.getOrCreateInteractiveWatchFaceClient(
+ controlClient.getOrCreateInteractiveWatchFaceClient(
"testId",
DeviceConfig(false, false, 0, 0),
WatchUiState(false, 0),
@@ -150,7 +151,7 @@
)
}
- handler.post { watchFaceService.onCreateEngine() as WatchFaceService.EngineWrapper }
+ handler.post { watchFaceService.onCreateEngine() }
val client = awaitWithTimeout(deferredClient)
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRendererTest.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRendererTest.kt
index 66ce0b7..491c443 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRendererTest.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableCanvasRendererTest.kt
@@ -109,11 +109,12 @@
val initFuture = SettableFuture.create<Unit>()
val watchFaceService =
TestAsyncCanvasRenderInitWatchFaceService(context, surfaceHolder, initFuture)
+ val controlClient = createWatchFaceControlClientService()
val deferredClient =
handlerCoroutineScope.async {
@Suppress("deprecation")
- watchFaceControlClientService.getOrCreateInteractiveWatchFaceClient(
+ controlClient.getOrCreateInteractiveWatchFaceClient(
"testId",
DeviceConfig(false, false, 0, 0),
WatchUiState(false, 0),
@@ -122,7 +123,7 @@
)
}
- handler.post { watchFaceService.onCreateEngine() as WatchFaceService.EngineWrapper }
+ handler.post { watchFaceService.onCreateEngine() }
val client = awaitWithTimeout(deferredClient)
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRenderer2Test.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRenderer2Test.kt
index b7edca4..e64777b 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRenderer2Test.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRenderer2Test.kt
@@ -127,11 +127,12 @@
onBackgroundThreadGlContextFuture,
sharedAssetsFuture
)
+ val controlClient = createWatchFaceControlClientService()
val deferredClient =
handlerCoroutineScope.async {
@Suppress("deprecation")
- watchFaceControlClientService.getOrCreateInteractiveWatchFaceClient(
+ controlClient.getOrCreateInteractiveWatchFaceClient(
"testId",
DeviceConfig(false, false, 0, 0),
WatchUiState(false, 0),
@@ -140,7 +141,7 @@
)
}
- handler.post { watchFaceService.onCreateEngine() as WatchFaceService.EngineWrapper }
+ handler.post { watchFaceService.onCreateEngine() }
val client = awaitWithTimeout(deferredClient)
try {
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRendererTest.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRendererTest.kt
index 21de436..0c292bc 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRendererTest.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableGlesRendererTest.kt
@@ -106,11 +106,12 @@
onUiThreadGlSurfaceCreatedFuture,
onBackgroundThreadGlContextFuture
)
+ val controlClient = createWatchFaceControlClientService()
val deferredClient =
handlerCoroutineScope.async {
@Suppress("deprecation")
- watchFaceControlClientService.getOrCreateInteractiveWatchFaceClient(
+ controlClient.getOrCreateInteractiveWatchFaceClient(
"testId",
DeviceConfig(false, false, 0, 0),
WatchUiState(false, 0),
@@ -119,7 +120,7 @@
)
}
- handler.post { watchFaceService.onCreateEngine() as WatchFaceService.EngineWrapper }
+ handler.post { watchFaceService.onCreateEngine() }
val client = awaitWithTimeout(deferredClient)
try {
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableWatchFaceServiceTest.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableWatchFaceServiceTest.kt
index c4a385b..b12573c 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableWatchFaceServiceTest.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/AsyncListenableWatchFaceServiceTest.kt
@@ -16,12 +16,18 @@
package androidx.wear.watchface
+import android.content.Context
import android.graphics.Canvas
import android.graphics.Rect
+import android.os.Build
import android.view.SurfaceHolder
+import androidx.annotation.RequiresApi
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
+import androidx.wear.watchface.client.DeviceConfig
+import androidx.wear.watchface.client.WatchUiState
import androidx.wear.watchface.style.CurrentUserStyleRepository
+import androidx.wear.watchface.style.UserStyleFlavors
import androidx.wear.watchface.style.UserStyleSchema
import com.google.common.truth.Truth.assertThat
import com.google.common.util.concurrent.ListenableFuture
@@ -30,6 +36,7 @@
import java.time.ZonedDateTime
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
+import kotlinx.coroutines.async
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@@ -90,6 +97,56 @@
)
}
+private class TestAsyncListenableWatchFaceRuntimeService(
+ testContext: Context,
+ private var surfaceHolderOverride: SurfaceHolder,
+) : ListenableWatchFaceRuntimeService() {
+ lateinit var lastResourceOnlyWatchFacePackageName: String
+
+ init {
+ attachBaseContext(testContext)
+ }
+
+ override fun getWallpaperSurfaceHolderOverride() = surfaceHolderOverride
+
+ override fun createWatchFaceFutureAsync(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): ListenableFuture<WatchFace> {
+ lastResourceOnlyWatchFacePackageName = resourceOnlyWatchFacePackageName
+
+ val future = SettableFuture.create<WatchFace>()
+ // Post a task to resolve the future.
+ getUiThreadHandler().post {
+ future.set(
+ WatchFace(
+ WatchFaceType.DIGITAL,
+ FakeRenderer(surfaceHolder, watchState, currentUserStyleRepository)
+ )
+ .apply { setOverridePreviewReferenceInstant(REFERENCE_PREVIEW_TIME) }
+ )
+ }
+ return future
+ }
+
+ override fun createUserStyleSchema(resourceOnlyWatchFacePackageName: String) =
+ UserStyleSchema(emptyList())
+
+ override fun createComplicationSlotsManager(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ) = ComplicationSlotsManager(emptyList(), currentUserStyleRepository)
+
+ override fun createUserStyleFlavors(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager,
+ resourceOnlyWatchFacePackageName: String
+ ) = UserStyleFlavors()
+}
+
/**
* Illustrates that createWatchFaceFuture can be resolved in a different task posted to the main
* looper.
@@ -126,3 +183,39 @@
assertThat(watchFace.overridePreviewReferenceInstant).isEqualTo(REFERENCE_PREVIEW_TIME)
}
}
+
+@RunWith(AndroidJUnit4::class)
+@RequiresApi(Build.VERSION_CODES.O_MR1)
+@MediumTest
+public class AsyncListenableWatchFaceRuntimeServiceTest : WatchFaceControlClientServiceTest() {
+
+ @Test
+ public fun asyncTest() {
+ val service = TestAsyncListenableWatchFaceRuntimeService(context, surfaceHolder)
+ val controlClient = createWatchFaceRuntimeControlClientService("com.example.wf")
+
+ val deferredClient =
+ handlerCoroutineScope.async {
+ @Suppress("deprecation")
+ controlClient.getOrCreateInteractiveWatchFaceClient(
+ "testId",
+ DeviceConfig(false, false, 0, 0),
+ WatchUiState(false, 0),
+ null,
+ emptyMap()
+ )
+ }
+
+ handler.post { service.onCreateEngine() }
+
+ val client = awaitWithTimeout(deferredClient)
+
+ // To avoid a race condition, we need to wait for the watchface to be fully created, which
+ // this does.
+ client.complicationSlotsState
+
+ assertThat(service.lastResourceOnlyWatchFacePackageName).isEqualTo("com.example.wf")
+
+ client.close()
+ }
+}
diff --git a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/WatchFaceControlTestService.kt b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/WatchFaceControlTestService.kt
index 9ebc13c..029435f 100644
--- a/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/WatchFaceControlTestService.kt
+++ b/wear/watchface/watchface-guava/src/androidTest/java/androidx/wear/watchface/WatchFaceControlTestService.kt
@@ -91,14 +91,27 @@
val glSurface = Surface(surfaceTexture)
val glSurfaceHolder = Mockito.mock(SurfaceHolder::class.java)
- val watchFaceControlClientService = runBlocking {
- WatchFaceControlClient.createWatchFaceControlClientImpl(
- context,
- Intent(context, WatchFaceControlTestService::class.java).apply {
- action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
- }
- )
- }
+ fun createWatchFaceControlClientService() =
+ runBlocking {
+ WatchFaceControlClient.createWatchFaceControlClientImpl(
+ context,
+ Intent(context, WatchFaceControlTestService::class.java).apply {
+ action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
+ },
+ resourceOnlyWatchFacePackageName = null
+ )
+ }
+
+ fun createWatchFaceRuntimeControlClientService(resourceOnlyWatchFacePackageName: String) =
+ runBlocking {
+ WatchFaceControlClient.createWatchFaceControlClientImpl(
+ context,
+ Intent(context, WatchFaceControlTestService::class.java).apply {
+ action = WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE
+ },
+ resourceOnlyWatchFacePackageName
+ )
+ }
@Before
fun setUp() {
diff --git a/wear/watchface/watchface-guava/src/main/java/androidx/wear/watchface/ListenableWatchFaceService.kt b/wear/watchface/watchface-guava/src/main/java/androidx/wear/watchface/ListenableWatchFaceService.kt
index a1e25de..07cde9d 100644
--- a/wear/watchface/watchface-guava/src/main/java/androidx/wear/watchface/ListenableWatchFaceService.kt
+++ b/wear/watchface/watchface-guava/src/main/java/androidx/wear/watchface/ListenableWatchFaceService.kt
@@ -73,3 +73,58 @@
future.addListener({ it.resume(future.get()) }, { runnable -> runnable.run() })
}
}
+
+/**
+ * [ListenableFuture]-based compatibility wrapper around [WatchFaceRuntimeService]'s suspending
+ * [WatchFaceService.createWatchFace].
+ */
+public abstract class ListenableWatchFaceRuntimeService : WatchFaceRuntimeService() {
+ /**
+ * Override this factory method to create your WatchFaceImpl. This method will be called by the
+ * library on a background thread, if possible any expensive initialization should be done
+ * asynchronously. The [WatchFace] and its [Renderer] should be accessed exclusively from the
+ * UiThread afterwards. There is a memory barrier between construction and rendering so no
+ * special threading primitives are required.
+ *
+ * Warning the system will likely time out waiting for watch face initialization if it takes
+ * longer than [MAX_CREATE_WATCHFACE_TIME_MILLIS] milliseconds.
+ *
+ * Note cancellation of the returned future is not supported.
+ *
+ * @param surfaceHolder The [SurfaceHolder] to pass to the [Renderer]'s constructor.
+ * @param watchState The [WatchState] for the watch face.
+ * @param complicationSlotsManager The [ComplicationSlotsManager] returned by
+ * [createComplicationSlotsManager].
+ * @param currentUserStyleRepository The [CurrentUserStyleRepository] constructed using the
+ * [UserStyleSchema] returned by [createUserStyleSchema].
+ * @param resourceOnlyWatchFacePackageName The android package from which the watch face
+ * definition should be loaded.
+ * @return A [ListenableFuture] for a [WatchFace] whose [Renderer] uses the provided
+ * [surfaceHolder].
+ */
+ protected abstract fun createWatchFaceFutureAsync(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): ListenableFuture<WatchFace>
+
+ final override suspend fun createWatchFace(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): WatchFace = suspendCancellableCoroutine {
+ val future =
+ createWatchFaceFutureAsync(
+ surfaceHolder,
+ watchState,
+ complicationSlotsManager,
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName
+ )
+ future.addListener({ it.resume(future.get()) }, { runnable -> runnable.run() })
+ }
+}
diff --git a/wear/watchface/watchface-samples-minimal-complications/build.gradle b/wear/watchface/watchface-samples-minimal-complications/build.gradle
index eb6c3db..8e82388 100644
--- a/wear/watchface/watchface-samples-minimal-complications/build.gradle
+++ b/wear/watchface/watchface-samples-minimal-complications/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import androidx.build.LibraryType
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -34,13 +32,6 @@
implementation(libs.guavaAndroid)
}
-androidx {
- name = "Wear Watchface Minimal Complications Sample"
- type = LibraryType.SAMPLES
- inceptionYear = "2021"
- description = "Contains the sample code for the Androidx Wear Watchface library"
-}
-
android {
defaultConfig {
applicationId "androidx.wear.watchface.samples.minimal.complications"
diff --git a/wear/watchface/watchface-samples-minimal-instances/build.gradle b/wear/watchface/watchface-samples-minimal-instances/build.gradle
index cefa848..83345b2 100644
--- a/wear/watchface/watchface-samples-minimal-instances/build.gradle
+++ b/wear/watchface/watchface-samples-minimal-instances/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import androidx.build.LibraryType
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -33,17 +31,10 @@
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1")
}
-androidx {
- name = "Wear Watchface Minimal Style Sample"
- type = LibraryType.SAMPLES
- inceptionYear = "2021"
- description = "Contains the sample code for the Androidx Wear Watchface library"
-}
-
android {
defaultConfig {
applicationId "androidx.wear.watchface.samples.minimal.instances"
- minSdkVersion 26
+ minSdkVersion 30
}
buildTypes {
diff --git a/wear/watchface/watchface-samples-minimal-style/build.gradle b/wear/watchface/watchface-samples-minimal-style/build.gradle
index 76d81e8..e03b619 100644
--- a/wear/watchface/watchface-samples-minimal-style/build.gradle
+++ b/wear/watchface/watchface-samples-minimal-style/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import androidx.build.LibraryType
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -31,13 +29,6 @@
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1")
}
-androidx {
- name = "Wear Watchface Minimal Style Sample"
- type = LibraryType.SAMPLES
- inceptionYear = "2021"
- description = "Contains the sample code for the Androidx Wear Watchface library"
-}
-
android {
defaultConfig {
applicationId "androidx.wear.watchface.samples.minimal.style"
diff --git a/wear/watchface/watchface/api/current.txt b/wear/watchface/watchface/api/current.txt
index cc6e5d8..ba61967 100644
--- a/wear/watchface/watchface/api/current.txt
+++ b/wear/watchface/watchface/api/current.txt
@@ -394,6 +394,18 @@
@SuppressCompatibility @kotlin.RequiresOptIn(message="This is an experimental API that may change or be removed without warning.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface WatchFaceExperimental {
}
+ public abstract class WatchFaceRuntimeService extends androidx.wear.watchface.WatchFaceService {
+ ctor public WatchFaceRuntimeService();
+ method protected final androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository);
+ method @WorkerThread protected abstract androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName);
+ method protected final androidx.wear.watchface.style.UserStyleFlavors createUserStyleFlavors(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager);
+ method @WorkerThread protected abstract androidx.wear.watchface.style.UserStyleFlavors createUserStyleFlavors(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, String resourceOnlyWatchFacePackageName);
+ method protected final androidx.wear.watchface.style.UserStyleSchema createUserStyleSchema();
+ method @WorkerThread protected abstract androidx.wear.watchface.style.UserStyleSchema createUserStyleSchema(String resourceOnlyWatchFacePackageName);
+ method @WorkerThread protected abstract suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ method protected final suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ }
+
public abstract class WatchFaceService extends android.service.wallpaper.WallpaperService {
ctor public WatchFaceService();
method @WorkerThread protected androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository);
diff --git a/wear/watchface/watchface/api/restricted_current.txt b/wear/watchface/watchface/api/restricted_current.txt
index cc6e5d8..ba61967 100644
--- a/wear/watchface/watchface/api/restricted_current.txt
+++ b/wear/watchface/watchface/api/restricted_current.txt
@@ -394,6 +394,18 @@
@SuppressCompatibility @kotlin.RequiresOptIn(message="This is an experimental API that may change or be removed without warning.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface WatchFaceExperimental {
}
+ public abstract class WatchFaceRuntimeService extends androidx.wear.watchface.WatchFaceService {
+ ctor public WatchFaceRuntimeService();
+ method protected final androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository);
+ method @WorkerThread protected abstract androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName);
+ method protected final androidx.wear.watchface.style.UserStyleFlavors createUserStyleFlavors(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager);
+ method @WorkerThread protected abstract androidx.wear.watchface.style.UserStyleFlavors createUserStyleFlavors(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, String resourceOnlyWatchFacePackageName);
+ method protected final androidx.wear.watchface.style.UserStyleSchema createUserStyleSchema();
+ method @WorkerThread protected abstract androidx.wear.watchface.style.UserStyleSchema createUserStyleSchema(String resourceOnlyWatchFacePackageName);
+ method @WorkerThread protected abstract suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, String resourceOnlyWatchFacePackageName, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ method protected final suspend Object? createWatchFace(android.view.SurfaceHolder surfaceHolder, androidx.wear.watchface.WatchState watchState, androidx.wear.watchface.ComplicationSlotsManager complicationSlotsManager, androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository, kotlin.coroutines.Continuation<? super androidx.wear.watchface.WatchFace>);
+ }
+
public abstract class WatchFaceService extends android.service.wallpaper.WallpaperService {
ctor public WatchFaceService();
method @WorkerThread protected androidx.wear.watchface.ComplicationSlotsManager createComplicationSlotsManager(androidx.wear.watchface.style.CurrentUserStyleRepository currentUserStyleRepository);
diff --git a/wear/watchface/watchface/build.gradle b/wear/watchface/watchface/build.gradle
index c67c751..9807b57 100644
--- a/wear/watchface/watchface/build.gradle
+++ b/wear/watchface/watchface/build.gradle
@@ -45,6 +45,7 @@
androidTestImplementation(libs.mockitoKotlin)
androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.kotlinTest)
testImplementation(project(":wear:watchface:watchface-complications-rendering"))
testImplementation(libs.testExtJunit)
diff --git a/wear/watchface/watchface/samples/app/build.gradle b/wear/watchface/watchface/samples/app/build.gradle
index 101b6ba..227a7ae 100644
--- a/wear/watchface/watchface/samples/app/build.gradle
+++ b/wear/watchface/watchface/samples/app/build.gradle
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-import androidx.build.LibraryType
-
plugins {
id("AndroidXPlugin")
id("com.android.application")
@@ -25,13 +23,6 @@
implementation(project(":wear:watchface:watchface-samples"))
}
-androidx {
- name = "Wear Watchface Samples app"
- type = LibraryType.SAMPLES
- inceptionYear = "2021"
- description = "APK for the sample code for the Androidx Wear Watchface library"
-}
-
android {
defaultConfig {
minSdkVersion 26
diff --git a/wear/watchface/watchface/samples/app/src/main/AndroidManifest.xml b/wear/watchface/watchface/samples/app/src/main/AndroidManifest.xml
index bfc4724..adb0bc6 100644
--- a/wear/watchface/watchface/samples/app/src/main/AndroidManifest.xml
+++ b/wear/watchface/watchface/samples/app/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,10 +17,13 @@
xmlns:tools="http://schemas.android.com/tools">
<application>
- <service
- android:name="androidx.wear.watchface.samples.ExampleOpenGLBackgroundInitWatchFaceService"
- tools:node="remove"/>
- <service android:name="androidx.wear.watchface.samples.ExampleOpenGLWatchFaceService"
- tools:node="remove"/>
+ <service
+ android:name="androidx.wear.watchface.samples.ExampleOpenGLBackgroundInitWatchFaceService"
+ android:exported="true"
+ tools:node="remove" />
+ <service
+ android:name="androidx.wear.watchface.samples.ExampleOpenGLWatchFaceService"
+ android:exported="true"
+ tools:node="remove" />
</application>
</manifest>
diff --git a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/ComplicationHelperActivityTest.kt b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/ComplicationHelperActivityTest.kt
index dcc2146..173aed5 100644
--- a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/ComplicationHelperActivityTest.kt
+++ b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/ComplicationHelperActivityTest.kt
@@ -28,6 +28,7 @@
import androidx.wear.watchface.complications.data.ComplicationType.LONG_TEXT
import androidx.wear.watchface.complications.data.ComplicationType.MONOCHROMATIC_IMAGE
import androidx.wear.watchface.complications.data.ComplicationType.SHORT_TEXT
+import androidx.wear.watchface.style.UserStyleData
import com.google.common.truth.Truth.assertThat
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
@@ -283,7 +284,8 @@
instanceId: String? = null,
vararg supportedTypes: ComplicationType = defaultSupportedTypes,
complicationDeniedIntent: Intent? = Intent(),
- complicationRationalIntent: Intent? = Intent()
+ complicationRationalIntent: Intent? = Intent(),
+ userStyleData: UserStyleData? = null
) =
ComplicationHelperActivity.createComplicationDataSourceChooserHelperIntent(
context,
@@ -292,7 +294,8 @@
supportedTypes.asList(),
instanceId,
complicationDeniedIntent,
- complicationRationalIntent
+ complicationRationalIntent,
+ userStyleData
)
private fun createPermissionOnlyIntent(
diff --git a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
index 53dddff..6d2a482 100644
--- a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
+++ b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
@@ -92,7 +92,7 @@
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.MockitoAnnotations
+import org.mockito.junit.MockitoJUnit
private const val BITMAP_WIDTH = 400
private const val BITMAP_HEIGHT = 400
@@ -133,6 +133,9 @@
@RequiresApi(Build.VERSION_CODES.O_MR1)
public class WatchFaceServiceImageTest {
+ @get:Rule
+ val mocks = MockitoJUnit.rule()
+
@Mock private lateinit var surfaceHolder: SurfaceHolder
@Mock private lateinit var surface: Surface
@@ -194,11 +197,9 @@
private lateinit var engineWrapper: WatchFaceService.EngineWrapper
private lateinit var interactiveWatchFaceInstance: IInteractiveWatchFace
- @Suppress("DEPRECATION") // b/251211092
@Before
public fun setUp() {
Assume.assumeTrue("This test suite assumes API 27", Build.VERSION.SDK_INT >= 27)
- MockitoAnnotations.initMocks(this)
pretendBinderThread.start()
pretendBinderHandler = Handler(pretendBinderThread.looper)
diff --git a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/XmlDefinedUserStyleSchemaAndComplicationSlotsTest.kt b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/XmlDefinedUserStyleSchemaAndComplicationSlotsTest.kt
index cc04564..e47d35f 100644
--- a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/XmlDefinedUserStyleSchemaAndComplicationSlotsTest.kt
+++ b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/XmlDefinedUserStyleSchemaAndComplicationSlotsTest.kt
@@ -59,19 +59,22 @@
import androidx.wear.watchface.style.UserStyleSetting.LongRangeUserStyleSetting.LongRangeOption
import androidx.wear.watchface.style.data.UserStyleWireFormat
import com.google.common.truth.Truth.assertThat
+import java.lang.IllegalArgumentException
import java.time.ZonedDateTime
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
+import kotlin.test.assertFailsWith
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Assert
import org.junit.Assume
import org.junit.Before
+import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.MockitoAnnotations
+import org.mockito.junit.MockitoJUnit
private const val BITMAP_WIDTH = 400
private const val BITMAP_HEIGHT = 400
@@ -81,13 +84,14 @@
class TestXmlWatchFaceService(
testContext: Context,
- private var surfaceHolderOverride: SurfaceHolder
+ private var surfaceHolderOverride: SurfaceHolder,
+ private var xmlWatchFaceResourceId: Int,
) : WatchFaceService() {
init {
attachBaseContext(testContext)
}
- override fun getXmlWatchFaceResourceId() = R.xml.xml_watchface
+ override fun getXmlWatchFaceResourceId() = xmlWatchFaceResourceId
override fun getWallpaperSurfaceHolderOverride() = surfaceHolderOverride
@@ -155,7 +159,10 @@
@RunWith(AndroidJUnit4::class)
@MediumTest
-public class XmlDefinedUserStyleSchemaAndComplicationSlotsTest {
+class XmlDefinedUserStyleSchemaAndComplicationSlotsTest {
+
+ @get:Rule
+ val mocks = MockitoJUnit.rule()
@Mock private lateinit var surfaceHolder: SurfaceHolder
@@ -166,28 +173,26 @@
private var initLatch = CountDownLatch(1)
private lateinit var interactiveWatchFaceInstance: IInteractiveWatchFace
- @Suppress("DEPRECATION") // b/251211092
@Before
- public fun setUp() {
+ fun setUp() {
Assume.assumeTrue("This test suite assumes API 29", Build.VERSION.SDK_INT >= 29)
- MockitoAnnotations.initMocks(this)
}
@After
- public fun tearDown() {
+ fun tearDown() {
InteractiveInstanceManager.setParameterlessEngine(null)
if (this::interactiveWatchFaceInstance.isInitialized) {
interactiveWatchFaceInstance.release()
}
}
- private fun setPendingWallpaperInteractiveWatchFaceInstance() {
+ private fun setPendingWallpaperInteractiveWatchFaceInstance(instanceId: String) {
val existingInstance =
InteractiveInstanceManager
.getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance(
InteractiveInstanceManager.PendingWallpaperInteractiveWatchFaceInstance(
WallpaperInteractiveWatchFaceInstanceParams(
- INTERACTIVE_INSTANCE_ID,
+ instanceId,
DeviceConfig(false, false, 0, 0),
WatchUiState(false, 0),
UserStyleWireFormat(emptyMap()),
@@ -216,13 +221,14 @@
assertThat(existingInstance).isNull()
}
- @Test
- @Suppress("Deprecation", "NewApi") // userStyleSettings
- public fun staticSchemaAndComplicationsRead() {
+ private fun createAndMountTestService(
+ xmlWatchFaceResourceId: Int = R.xml.xml_watchface,
+ ): WatchFaceService.EngineWrapper {
val service =
TestXmlWatchFaceService(
- ApplicationProvider.getApplicationContext<Context>(),
- surfaceHolder
+ ApplicationProvider.getApplicationContext(),
+ surfaceHolder,
+ xmlWatchFaceResourceId
)
Mockito.`when`(surfaceHolder.surfaceFrame)
@@ -231,11 +237,21 @@
Mockito.`when`(surfaceHolder.surface).thenReturn(surface)
Mockito.`when`(surface.isValid).thenReturn(false)
- setPendingWallpaperInteractiveWatchFaceInstance()
+ setPendingWallpaperInteractiveWatchFaceInstance(
+ "${INTERACTIVE_INSTANCE_ID}_$xmlWatchFaceResourceId"
+ )
val wrapper = service.onCreateEngine() as WatchFaceService.EngineWrapper
assertThat(initLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)).isTrue()
+ return wrapper
+ }
+
+ @Test
+ @Suppress("Deprecation", "NewApi") // userStyleSettings
+ fun staticSchemaAndComplicationsRead() {
+ val wrapper = createAndMountTestService()
+
runBlocking {
val watchFaceImpl = wrapper.deferredWatchFaceImpl.await()
val schema = watchFaceImpl.currentUserStyleRepository.schema
@@ -393,4 +409,42 @@
)
}
}
+
+ @Test
+ fun staticSchemaAndComplicationsRead_invalidXml() {
+ // test that when the xml cannot be parsed, the error is propagated and that
+ // the deferred values of the engine wrapper do not hang indefinitely
+ val wrapper = createAndMountTestService(R.xml.xml_watchface_invalid)
+ runBlocking {
+ val exception =
+ assertFailsWith<IllegalArgumentException> { wrapper.deferredValidation.await() }
+ assertThat(exception.message).contains("must have a systemDataSourceFallback attribute")
+ assertThat(wrapper.deferredWatchFaceImpl.isCancelled)
+ }
+ }
+
+ @Test
+ fun readsComplicationWithWeatherDefaultOnApi34() {
+ Assume.assumeTrue("This test runs only on API >= 34", Build.VERSION.SDK_INT >= 34)
+ val wrapper = createAndMountTestService(R.xml.xml_watchface_weather)
+ runBlocking {
+ val watchFaceImpl = wrapper.deferredWatchFaceImpl.await()
+ val complicationSlot = watchFaceImpl.complicationSlotsManager.complicationSlots[10]!!
+ assertThat(complicationSlot.defaultDataSourcePolicy.systemDataSourceFallback)
+ .isEqualTo(SystemDataSources.DATA_SOURCE_WEATHER)
+ }
+ }
+
+ @Test
+ fun throwsExceptionOnReadingComplicationWithWeatherDefaultOnApiBelow34() {
+ Assume.assumeTrue("This test runs only on API < 34", Build.VERSION.SDK_INT < 34)
+ val wrapper = createAndMountTestService(R.xml.xml_watchface_weather)
+
+ runBlocking {
+ val exception =
+ assertFailsWith<IllegalArgumentException> { wrapper.deferredValidation.await() }
+ assertThat(exception.message)
+ .contains("cannot have the supplied systemDataSourceFallback value")
+ }
+ }
}
diff --git a/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_invalid.xml b/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_invalid.xml
new file mode 100644
index 0000000..7a1fe31
--- /dev/null
+++ b/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_invalid.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<XmlWatchFace xmlns:app="http://schemas.android.com/apk/res-auto"
+ app:complicationScaleX="10.0"
+ app:complicationScaleY="100.0">
+ <ComplicationSlot
+ app:slotId="@integer/complication_slot_10"
+ app:name="@string/complication_name_one"
+ app:screenReaderName="@string/complication_screen_reader_name_one"
+ app:boundsType="ROUND_RECT"
+ app:supportedTypes="RANGED_VALUE|SHORT_TEXT|SMALL_IMAGE">
+ <ComplicationSlotBounds app:left="3" app:top="70" app:right="7" app:bottom="90"/>
+ </ComplicationSlot>
+</XmlWatchFace>
diff --git a/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_weather.xml b/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_weather.xml
new file mode 100644
index 0000000..fdcf220
--- /dev/null
+++ b/wear/watchface/watchface/src/androidTest/res/xml/xml_watchface_weather.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<XmlWatchFace xmlns:app="http://schemas.android.com/apk/res-auto"
+ app:complicationScaleX="10.0"
+ app:complicationScaleY="100.0">
+ <ComplicationSlot
+ app:slotId="@integer/complication_slot_10"
+ app:name="@string/complication_name_one"
+ app:screenReaderName="@string/complication_screen_reader_name_one"
+ app:boundsType="ROUND_RECT"
+ app:supportedTypes="RANGED_VALUE|SHORT_TEXT|SMALL_IMAGE"
+ app:systemDataSourceFallback="DATA_SOURCE_WEATHER"
+ app:systemDataSourceFallbackDefaultType="SHORT_TEXT">
+ <ComplicationSlotBounds app:left="3" app:top="70" app:right="7" app:bottom="90"/>
+ </ComplicationSlot>
+</XmlWatchFace>
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationDataSourceChooserIntent.java b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationDataSourceChooserIntent.java
index b88da15..57a55e2 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationDataSourceChooserIntent.java
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationDataSourceChooserIntent.java
@@ -110,6 +110,13 @@
"android.support.wearable.complications.EXTRA_PROVIDER_INFO";
/**
+ * Key for an extra that holds the [UserStyleWireFormat].
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ public static final String EXTRA_USER_STYLE =
+ "androidx.wear.watchface.complications.EXTRA_USER_STYLE";
+
+ /**
* Returns an intent that may be used to start an activity to allow the user to select a
* complication data source for the given complication. The activity will show a list of all
* complication data source that can supply data of at least one of the {@code supportedTypes}.
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationHelperActivity.java b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationHelperActivity.java
index 42badfe..f5c3b71 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationHelperActivity.java
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/ComplicationHelperActivity.java
@@ -33,6 +33,7 @@
import androidx.core.app.ActivityCompat;
import androidx.wear.watchface.complications.ComplicationDataSourceUpdateRequesterConstants;
import androidx.wear.watchface.complications.data.ComplicationType;
+import androidx.wear.watchface.style.UserStyleData;
import java.util.Collection;
import java.util.Objects;
@@ -383,7 +384,8 @@
@NonNull Collection<ComplicationType> supportedTypes,
@Nullable String watchFaceInstanceId,
@Nullable Intent complicationDenied,
- @Nullable Intent complicationRationale) {
+ @Nullable Intent complicationRationale,
+ @Nullable UserStyleData userStyleData) {
Intent intent = new Intent(context, ComplicationHelperActivity.class);
intent.setAction(ACTION_START_PROVIDER_CHOOSER);
intent.putExtra(
@@ -405,6 +407,11 @@
ComplicationDataSourceChooserIntent.EXTRA_COMPLICATION_RATIONALE,
complicationRationale);
}
+ if (userStyleData != null) {
+ intent.putExtra(
+ ComplicationDataSourceChooserIntent.EXTRA_USER_STYLE,
+ userStyleData.toWireFormat());
+ }
int[] wireSupportedTypes = new int[supportedTypes.size()];
int i = 0;
for (ComplicationType supportedType : supportedTypes) {
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/Renderer.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/Renderer.kt
index 85b31e1..bab898a 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/Renderer.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/Renderer.kt
@@ -1807,4 +1807,4 @@
height: Int,
config: Bitmap.Config
) = Bitmap.createBitmap(picture, width, height, config)
-}
\ No newline at end of file
+}
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
index 20f9460..5274c7c 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFace.kt
@@ -22,6 +22,7 @@
import android.content.ComponentName
import android.content.Context
import android.content.Intent
+import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
@@ -249,7 +250,8 @@
}
.apply { setContext(context) }
- val engine = watchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ val engine = watchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
val headlessWatchFaceImpl = engine.createHeadlessInstance(params)
return engine.deferredWatchFaceImpl.await().WFEditorDelegate(headlessWatchFaceImpl)
}
@@ -404,8 +406,7 @@
* This class allows the watch face to configure the status overlay which is rendered by the
* system on top of the watch face.
*
- * Note: While the plumbing was built, the System UI side of the this feature was never
- * implemented, and this method will be removed.
+ * Note: This is not a supported API and will be removed.
*/
@Deprecated("OverlayStyle will be removed in a future release.")
public class OverlayStyle(
@@ -665,11 +666,7 @@
internal var lastDrawTimeMillis: Long = 0
internal var nextDrawTimeMillis: Long = 0
- internal val componentName =
- ComponentName(
- watchFaceHostApi.getContext().packageName,
- watchFaceHostApi.getContext().javaClass.name
- )
+ internal val componentName = watchFaceHostApi.getComponentName()
internal fun getWatchFaceStyle() =
WatchFaceStyle(
@@ -1250,7 +1247,16 @@
)
}
- val bounds = it.computeBounds(renderer.screenBounds)
+ // Compute the bounds of the complication based on the display rather than
+ // the headless renderer (which may be smaller).
+ val bounds = it.computeBounds(
+ Rect(
+ 0,
+ 0,
+ Resources.getSystem().displayMetrics.widthPixels,
+ Resources.getSystem().displayMetrics.heightPixels
+ )
+ )
var prevData: ComplicationData? = null
val screenshotComplicationData = params.complicationData
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceHostApi.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceHostApi.kt
index 3f160d0..4d6b2dc 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceHostApi.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceHostApi.kt
@@ -149,4 +149,7 @@
/** Requests the system to capture an updated preview image. */
public fun sendPreviewImageNeedsUpdateRequest() {}
+
+ /** Returns ComponentName of the watch face. */
+ public fun getComponentName(): ComponentName
}
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
index d9c04a97..049c6c6 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/WatchFaceService.kt
@@ -293,12 +293,25 @@
* not be inflated from XML.
*
* Note it is an error to define a XmlSchemaAndComplicationSlotsDefinition and not use it.
+ *
+ * As of Wear OS 4, complications can provide data using dynamic values, that the platform evaluates
+ * continuously and sends the evaluated results to the watch face. Privileged watch faces that can
+ * utilize the unevaluated dynamic values, can include the privileged permission
+ * `com.google.wear.permission.GET_COMPLICATION_DYNAMIC_VALUE` in their manifest, which will tell
+ * the system to avoid pruning them from the [ComplicationData], where they will show up in the
+ * relevant fields next to the evaluated values.
*/
public abstract class WatchFaceService : WallpaperService() {
public companion object {
private const val TAG = "WatchFaceService"
+ /**
+ * [ComponentName] is not allowed to have null for the class name (and it can be null for
+ * resource only watch faces), hence this placeholder.
+ */
+ private const val RESOURCE_ONLY_CLASS_NAME_PLACEHOLDER = "null"
+
/** Whether to log every frame. */
private const val LOG_VERBOSE = false
@@ -446,7 +459,7 @@
}
}
- private val xmlSchemaAndComplicationSlotsDefinition:
+ internal val xmlSchemaAndComplicationSlotsDefinition:
XmlSchemaAndComplicationSlotsDefinition by lazy {
val resourceId = getXmlWatchFaceResourceId()
if (resourceId == 0) {
@@ -477,6 +490,10 @@
xmlSchemaAndComplicationSlotsDefinition.schema?.userStyleSettings ?: emptyList()
)
+ internal open fun createUserStyleSchemaInternal(
+ resourceOnlyWatchFacePackageName: String?
+ ): UserStyleSchema = createUserStyleSchema()
+
/**
* If the WatchFaceService's manifest doesn't define a
* androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data tag then override
@@ -501,6 +518,11 @@
getComplicationSlotInflationFactory(currentUserStyleRepository)
)
+ internal open fun createComplicationSlotsManagerInternal(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String?
+ ): ComplicationSlotsManager = createComplicationSlotsManager(currentUserStyleRepository)
+
/**
* Used when inflating [ComplicationSlot]s from XML to provide a
* [ComplicationSlotInflationFactory] which provides the [CanvasComplicationFactory] and where
@@ -566,6 +588,13 @@
complicationSlotsManager: ComplicationSlotsManager
): UserStyleFlavors = xmlSchemaAndComplicationSlotsDefinition.flavors ?: UserStyleFlavors()
+ internal open fun createUserStyleFlavorsInternal(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager,
+ resourceOnlyWatchFacePackageName: String?
+ ): UserStyleFlavors =
+ createUserStyleFlavors(currentUserStyleRepository, complicationSlotsManager)
+
/**
* Override this factory method to create your WatchFaceImpl. This method will be called by the
* library on a background thread, if possible any expensive initialization should be done
@@ -592,13 +621,27 @@
currentUserStyleRepository: CurrentUserStyleRepository
): WatchFace
+ internal open suspend fun createWatchFaceInternal(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String?
+ ): WatchFace =
+ createWatchFace(
+ surfaceHolder,
+ watchState,
+ complicationSlotsManager,
+ currentUserStyleRepository,
+ )
+
/** Creates an interactive engine for WallpaperService. */
final override fun onCreateEngine(): Engine =
- EngineWrapper(getUiThreadHandler(), getBackgroundThreadHandler(), false)
+ EngineWrapper(getUiThreadHandler(), getBackgroundThreadHandler(), null)
/** Creates a headless engine. */
- internal fun createHeadlessEngine(): Engine =
- EngineWrapper(getUiThreadHandler(), getBackgroundThreadHandler(), true)
+ internal fun createHeadlessEngine(watchFaceName: ComponentName): Engine =
+ EngineWrapper(getUiThreadHandler(), getBackgroundThreadHandler(), watchFaceName)
/** Returns the ui thread [Handler]. */
public fun getUiThreadHandler(): Handler = getUiThreadHandlerImpl()
@@ -1149,7 +1192,7 @@
public inner class EngineWrapper(
private val uiThreadHandler: Handler,
private val backgroundThreadHandler: Handler,
- headless: Boolean
+ headlessComponentName: ComponentName?
) :
WallpaperService.Engine(),
WatchFaceHostApi,
@@ -1197,7 +1240,7 @@
// That's supposed to get sent very quickly, but in case it doesn't we initially
// assume we're not in ambient mode which should be correct most of the time.
isAmbient.value = false
- isHeadless = headless
+ isHeadless = (headlessComponentName != null)
isLocked.value =
(getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).isDeviceLocked
}
@@ -1277,6 +1320,7 @@
internal var immutableSystemStateDone = false
internal var immutableChinHeightDone = false
internal var systemHasSentWatchUiState = false
+ internal var resourceOnlyWatchFacePackageName: String? = headlessComponentName?.packageName
private var asyncWatchFaceConstructionPending = false
@@ -1885,23 +1929,34 @@
/** This will be called from a binder thread. */
@WorkerThread
internal fun getDefaultProviderPolicies(): Array<IdTypeAndDefaultProviderPolicyWireFormat> {
- return createComplicationSlotsManager(
- CurrentUserStyleRepository(createUserStyleSchema())
+ return createComplicationSlotsManagerInternal(
+ CurrentUserStyleRepository(
+ createUserStyleSchemaInternal(resourceOnlyWatchFacePackageName)
+ ),
+ resourceOnlyWatchFacePackageName
)
.getDefaultProviderPolicies()
}
/** This will be called from a binder thread. */
@WorkerThread
- internal fun getUserStyleSchemaWireFormat() = createUserStyleSchema().toWireFormat()
+ internal fun getUserStyleSchemaWireFormat() =
+ createUserStyleSchemaInternal(resourceOnlyWatchFacePackageName).toWireFormat()
/** This will be called from a binder thread. */
@WorkerThread
internal fun getUserStyleFlavorsWireFormat(): UserStyleFlavorsWireFormat {
- val currentUserStyleRepository = CurrentUserStyleRepository(createUserStyleSchema())
- return createUserStyleFlavors(
+ val currentUserStyleRepository =
+ CurrentUserStyleRepository(
+ createUserStyleSchemaInternal(resourceOnlyWatchFacePackageName)
+ )
+ return createUserStyleFlavorsInternal(
currentUserStyleRepository,
- createComplicationSlotsManager(currentUserStyleRepository)
+ createComplicationSlotsManagerInternal(
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName
+ ),
+ resourceOnlyWatchFacePackageName
)
.toWireFormat()
}
@@ -1910,7 +1965,12 @@
@OptIn(ComplicationExperimental::class)
@WorkerThread
internal fun getComplicationSlotMetadataWireFormats() =
- createComplicationSlotsManager(CurrentUserStyleRepository(createUserStyleSchema()))
+ createComplicationSlotsManagerInternal(
+ CurrentUserStyleRepository(
+ createUserStyleSchemaInternal(resourceOnlyWatchFacePackageName)
+ ),
+ resourceOnlyWatchFacePackageName
+ )
.complicationSlots
.map {
val systemDataSourceFallbackDefaultType =
@@ -2043,6 +2103,8 @@
setWatchUiState(params.watchUiState, fromSysUi = false)
initialUserStyle = params.userStyle
+ resourceOnlyWatchFacePackageName = params.auxiliaryComponentPackageName
+
mutableWatchState.watchFaceInstanceId.value = sanitizeWatchFaceId(params.instanceId)
val watchState = mutableWatchState.asWatchState()
@@ -2105,72 +2167,94 @@
}
backgroundThreadCoroutineScope.launch {
- val timeBefore = System.currentTimeMillis()
- val currentUserStyleRepository =
- TraceEvent("WatchFaceService.createUserStyleSchema").use {
- CurrentUserStyleRepository(createUserStyleSchema())
- }
- initStyle(currentUserStyleRepository)
-
- val complicationSlotsManager =
- TraceEvent("WatchFaceService.createComplicationsManager").use {
- createComplicationSlotsManager(currentUserStyleRepository)
- }
- complicationSlotsManager.watchFaceHostApi = this@EngineWrapper
- complicationSlotsManager.watchState = watchState
- complicationSlotsManager.listenForStyleChanges(uiThreadCoroutineScope)
- listenForComplicationChanges(complicationSlotsManager)
- if (!watchState.isHeadless) {
- periodicallyWriteComplicationDataCache(
- _context,
- watchState.watchFaceInstanceId.value,
- complicationsFlow
- )
- }
-
- val userStyleFlavors =
- TraceEvent("WatchFaceService.createUserStyleFlavors").use {
- createUserStyleFlavors(currentUserStyleRepository, complicationSlotsManager)
- }
-
- deferredEarlyInitDetails.complete(
- EarlyInitDetails(
- complicationSlotsManager,
- currentUserStyleRepository,
- userStyleFlavors
- )
- )
-
+ // deferred objects used to signal to the UI thread that some init steps have
+ // finished
val deferredWatchFace = CompletableDeferred<WatchFace>()
val initComplicationsDone = CompletableDeferred<Unit>()
- // WatchFaceImpl (which registers broadcast observers) needs to be constructed
- // on the UIThread. Part of this process can be done in parallel with
- // createWatchFace.
- uiThreadCoroutineScope.launch {
- createWatchFaceImpl(
- complicationSlotsManager,
- currentUserStyleRepository,
+ // add here all the deferred values completed in the background thread
+ val futuresToCancelOnError =
+ listOf(
deferredWatchFace,
initComplicationsDone,
- watchState
+ deferredEarlyInitDetails,
+ this@EngineWrapper.deferredWatchFace,
+ deferredWatchFaceImpl,
+ deferredValidation,
)
- }
try {
+ val timeBefore = System.currentTimeMillis()
+ val currentUserStyleRepository =
+ TraceEvent("WatchFaceService.createUserStyleSchema").use {
+ CurrentUserStyleRepository(
+ createUserStyleSchemaInternal(resourceOnlyWatchFacePackageName)
+ )
+ }
+ initStyle(currentUserStyleRepository)
+
+ val complicationSlotsManager =
+ TraceEvent("WatchFaceService.createComplicationsManager").use {
+ createComplicationSlotsManagerInternal(
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName
+ )
+ }
+ complicationSlotsManager.watchFaceHostApi = this@EngineWrapper
+ complicationSlotsManager.watchState = watchState
+ complicationSlotsManager.listenForStyleChanges(uiThreadCoroutineScope)
+ listenForComplicationChanges(complicationSlotsManager)
+ if (!watchState.isHeadless) {
+ periodicallyWriteComplicationDataCache(
+ _context,
+ watchState.watchFaceInstanceId.value,
+ complicationsFlow
+ )
+ }
+
+ val userStyleFlavors =
+ TraceEvent("WatchFaceService.createUserStyleFlavors").use {
+ createUserStyleFlavorsInternal(
+ currentUserStyleRepository,
+ complicationSlotsManager,
+ resourceOnlyWatchFacePackageName
+ )
+ }
+
+ deferredEarlyInitDetails.complete(
+ EarlyInitDetails(
+ complicationSlotsManager,
+ currentUserStyleRepository,
+ userStyleFlavors
+ )
+ )
+
+ // WatchFaceImpl (which registers broadcast observers) needs to be constructed
+ // on the UIThread. Part of this process can be done in parallel with
+ // createWatchFace.
+ uiThreadCoroutineScope.launch {
+ createWatchFaceImpl(
+ complicationSlotsManager,
+ currentUserStyleRepository,
+ deferredWatchFace,
+ initComplicationsDone,
+ watchState
+ )
+ }
+
val surfaceHolder = overrideSurfaceHolder ?: deferredSurfaceHolder.await()
val watchFace =
TraceEvent("WatchFaceService.createWatchFace").use {
// Note by awaiting deferredSurfaceHolder we ensure onSurfaceChanged has
// been called and we're passing the correct updated surface holder.
- // This is
- // important for GL rendering.
- createWatchFace(
+ // This is important for GL rendering.
+ createWatchFaceInternal(
surfaceHolder,
watchState,
complicationSlotsManager,
- currentUserStyleRepository
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName
)
}
this@EngineWrapper.deferredWatchFace.complete(watchFace)
@@ -2208,7 +2292,11 @@
throw e
} catch (e: Exception) {
Log.e(TAG, "WatchFace crashed during init", e)
- deferredValidation.completeExceptionally(e)
+ futuresToCancelOnError.forEach {
+ if (!it.isCompleted) {
+ it.completeExceptionally(e)
+ }
+ }
}
deferredValidation.complete(Unit)
@@ -2497,6 +2585,14 @@
}
}
+ override fun getComponentName(): ComponentName {
+ resourceOnlyWatchFacePackageName?.let {
+ return ComponentName(it, RESOURCE_ONLY_CLASS_NAME_PLACEHOLDER)
+ }
+
+ return ComponentName(getContext().packageName, getContext().javaClass.name)
+ }
+
override fun onWatchFaceColorsChanged(watchFaceColors: WatchFaceColors?) {
synchronized(lock) {
lastWatchFaceColors = watchFaceColors
@@ -2777,6 +2873,7 @@
writer.println("surfaceDestroyed=$surfaceDestroyed")
writer.println("lastComplications=${complicationsFlow.value.joinToString()}")
writer.println("pendingUpdateTime=${pendingUpdateTime.isPending()}")
+ writer.println("Resource only package name $resourceOnlyWatchFacePackageName")
synchronized(lock) {
forEachListener("dump") { writer.println("listener = ${it.asBinder()}") }
@@ -2824,6 +2921,184 @@
}
/**
+ * WatchFaceRuntimeService is a special kind of [WatchFaceService], which loads the watch face
+ * definition from another resource only watch face package (see the
+ * `resourceOnlyWatchFacePackageName` parameter passed to [createUserStyleSchema],
+ * [createComplicationSlotsManager], [createUserStyleFlavors] and [createWatchFace]).
+ *
+ * Note because a WatchFaceRuntimeService loads it's resources from another package, it will need
+ * the following permission:
+ * ```
+ * <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
+ * tools:ignore="QueryAllPackagesPermission" />
+ * ```
+ *
+ * Currently Wear OS only supports the runtime for the Android Watch Face Format (see
+ * https://developer.android.com/training/wearables/wff for more details).
+ *
+ * Note only one watch face definition per resource only watch face package is supported.
+ */
+abstract class WatchFaceRuntimeService : WatchFaceService() {
+ /**
+ * If the WatchFaceService's manifest doesn't define a
+ * androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data tag then override
+ * this factory method to create a non-empty [UserStyleSchema]. A [CurrentUserStyleRepository]
+ * constructed with this schema will be passed to [createComplicationSlotsManager],
+ * [createUserStyleFlavors] and [createWatchFace]. This is called on a background thread.
+ *
+ * @param resourceOnlyWatchFacePackageName The android package from which the watch face
+ * definition should be loaded.
+ * @return The [UserStyleSchema] to create a [CurrentUserStyleRepository] with, which is passed
+ * to [createComplicationSlotsManager] and [createWatchFace].
+ */
+ @WorkerThread
+ protected abstract fun createUserStyleSchema(
+ resourceOnlyWatchFacePackageName: String
+ ): UserStyleSchema
+
+ override fun createUserStyleSchemaInternal(
+ resourceOnlyWatchFacePackageName: String?
+ ): UserStyleSchema = createUserStyleSchema(resourceOnlyWatchFacePackageName!!)
+
+ @Suppress("DocumentExceptions") // NB this method isn't expected to be called from user code.
+ final override fun createUserStyleSchema(): UserStyleSchema {
+ throw UnsupportedOperationException("resourceOnlyWatchFacePackageName must be specified")
+ }
+
+ /**
+ * If the WatchFaceService's manifest doesn't define a
+ * androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data tag then override
+ * this factory method to create a non-empty [ComplicationSlotsManager]. This manager will be
+ * passed to [createUserStyleFlavors] and [createWatchFace]. This will be called from a
+ * background thread but the ComplicationSlotsManager should be accessed exclusively from the
+ * UiThread afterwards.
+ *
+ * @param currentUserStyleRepository The [CurrentUserStyleRepository] constructed using the
+ * [UserStyleSchema] returned by [createUserStyleSchema].
+ * @param resourceOnlyWatchFacePackageName The android package from which the watch face
+ * definition should be loaded.
+ * @return The [ComplicationSlotsManager] to pass into [createWatchFace].
+ */
+ @WorkerThread
+ protected abstract fun createComplicationSlotsManager(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): ComplicationSlotsManager
+
+ internal override fun createComplicationSlotsManagerInternal(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String?
+ ): ComplicationSlotsManager =
+ createComplicationSlotsManager(
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName!!
+ )
+
+ @Suppress("DocumentExceptions") // NB this method isn't expected to be called from user code.
+ final override fun createComplicationSlotsManager(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ ): ComplicationSlotsManager {
+ throw UnsupportedOperationException("resourceOnlyWatchFacePackageName must be specified")
+ }
+
+ /**
+ * If the WatchFaceService's manifest doesn't define a
+ * androidx.wear.watchface.XmlSchemaAndComplicationSlotsDefinition meta data tag then override
+ * this factory method to create non-empty [UserStyleFlavors]. This is called on a background
+ * thread. The system reads the flavors once and changes may be ignored until the APK is
+ * updated. Metadata tag "androidx.wear.watchface.FLAVORS_SUPPORTED" should be added to let the
+ * system know the service supports flavors.
+ *
+ * @param currentUserStyleRepository The [CurrentUserStyleRepository] constructed using the
+ * [UserStyleSchema] returned by [createUserStyleSchema].
+ * @param complicationSlotsManager The [ComplicationSlotsManager] returned by
+ * [createComplicationSlotsManager]
+ * @param resourceOnlyWatchFacePackageName The android package from which the watch face
+ * definition should be loaded.
+ * @return The [UserStyleFlavors], which is exposed to the system.
+ */
+ @WorkerThread
+ protected abstract fun createUserStyleFlavors(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager,
+ resourceOnlyWatchFacePackageName: String
+ ): UserStyleFlavors
+
+ internal override fun createUserStyleFlavorsInternal(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager,
+ resourceOnlyWatchFacePackageName: String?
+ ): UserStyleFlavors =
+ createUserStyleFlavors(
+ currentUserStyleRepository,
+ complicationSlotsManager,
+ resourceOnlyWatchFacePackageName!!
+ )
+
+ @Suppress("DocumentExceptions") // NB this method isn't expected to be called from user code.
+ final override fun createUserStyleFlavors(
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ complicationSlotsManager: ComplicationSlotsManager
+ ): UserStyleFlavors {
+ throw UnsupportedOperationException("resourceOnlyWatchFacePackageName must be specified")
+ }
+
+ /**
+ * Override this factory method to create your WatchFaceImpl. This method will be called by the
+ * library on a background thread, if possible any expensive initialization should be done
+ * asynchronously. The [WatchFace] and its [Renderer] should be accessed exclusively from the
+ * UiThread afterwards. There is a memory barrier between construction and rendering so no
+ * special threading primitives are required.
+ *
+ * Warning the system will likely time out waiting for watch face initialization if it takes
+ * longer than [WatchFaceService.MAX_CREATE_WATCHFACE_TIME_MILLIS] milliseconds.
+ *
+ * @param surfaceHolder The [SurfaceHolder] to pass to the [Renderer]'s constructor.
+ * @param watchState The [WatchState] for the watch face.
+ * @param complicationSlotsManager The [ComplicationSlotsManager] returned by
+ * [createComplicationSlotsManager].
+ * @param currentUserStyleRepository The [CurrentUserStyleRepository] constructed using the
+ * [UserStyleSchema] returned by [createUserStyleSchema].
+ * @param resourceOnlyWatchFacePackageName The android package from which the watch face
+ * definition should be loaded.
+ * @return A [WatchFace] whose [Renderer] uses the provided [surfaceHolder].
+ */
+ @WorkerThread
+ protected abstract suspend fun createWatchFace(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String
+ ): WatchFace
+
+ internal override suspend fun createWatchFaceInternal(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository,
+ resourceOnlyWatchFacePackageName: String?
+ ): WatchFace =
+ createWatchFace(
+ surfaceHolder,
+ watchState,
+ complicationSlotsManager,
+ currentUserStyleRepository,
+ resourceOnlyWatchFacePackageName!!
+ )
+
+ @Suppress("DocumentExceptions") // NB this method isn't expected to be called from user code.
+ final override suspend fun createWatchFace(
+ surfaceHolder: SurfaceHolder,
+ watchState: WatchState,
+ complicationSlotsManager: ComplicationSlotsManager,
+ currentUserStyleRepository: CurrentUserStyleRepository
+ ): WatchFace {
+ throw UnsupportedOperationException("resourceOnlyWatchFacePackageName must be specified")
+ }
+}
+
+/**
* Runs the supplied task on the handler thread. If we're not on the handler thread a task is
* posted.
*
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/InteractiveInstanceManager.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/InteractiveInstanceManager.kt
index 07232b0..d4ef013 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/InteractiveInstanceManager.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/InteractiveInstanceManager.kt
@@ -17,6 +17,7 @@
package androidx.wear.watchface.control
import android.annotation.SuppressLint
+import android.util.Log
import androidx.annotation.UiThread
import androidx.annotation.VisibleForTesting
import androidx.wear.watchface.IndentingPrintWriter
@@ -49,6 +50,8 @@
)
companion object {
+ private const val TAG = "InteractiveInstanceManager"
+
private val instances = HashMap<String, RefCountedInteractiveWatchFaceInstance>()
private val pendingWallpaperInteractiveWatchFaceInstanceLock = Any()
private var pendingWallpaperInteractiveWatchFaceInstance:
@@ -204,6 +207,18 @@
// system thinks we should have. Note runBlocking is safe here because we never await.
val engine = impl.engine!!
engine.setUserStyle(value.params.userStyle)
+
+ if (engine.resourceOnlyWatchFacePackageName !=
+ value.params.auxiliaryComponentPackageName
+ ) {
+ val message =
+ "Existing instance has the resourceOnlyWatchFacePackageName of " +
+ "${engine.resourceOnlyWatchFacePackageName}, which is different from the " +
+ "argument watchFaceId of ${value.params.auxiliaryComponentPackageName}."
+ Log.e(TAG, message)
+ throw IllegalStateException(message)
+ }
+
return impl
}
diff --git a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
index 3ca3862..98582e5 100644
--- a/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
+++ b/wear/watchface/watchface/src/main/java/androidx/wear/watchface/control/WatchFaceControlService.kt
@@ -193,7 +193,8 @@
}
watchFaceService.onCreate()
val engine =
- watchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ watchFaceService.createHeadlessEngine(watchFaceName)
+ as WatchFaceService.EngineWrapper
ServiceAndEngine(watchFaceService, engine)
} else {
null
diff --git a/wear/watchface/watchface/src/main/res/values/attrs.xml b/wear/watchface/watchface/src/main/res/values/attrs.xml
index 3e8d8b2..02dacba 100644
--- a/wear/watchface/watchface/src/main/res/values/attrs.xml
+++ b/wear/watchface/watchface/src/main/res/values/attrs.xml
@@ -80,6 +80,7 @@
<enum name="DATA_SOURCE_DAY_OF_WEEK" value="13" />
<enum name="DATA_SOURCE_FAVORITE_CONTACT" value="14" />
<enum name="DATA_SOURCE_DAY_AND_DATE" value="16" />
+ <enum name="DATA_SOURCE_WEATHER" value="17" />
</attr>
<!-- Required. The default [ComplicationType] for the default complication data source.
diff --git a/wear/watchface/watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt b/wear/watchface/watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
index b953af0..d55140d 100644
--- a/wear/watchface/watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
+++ b/wear/watchface/watchface/src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt
@@ -3319,12 +3319,14 @@
choreographer
)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
engineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
engineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -3886,7 +3888,9 @@
choreographer
)
- testWatchFaceService.createHeadlessEngine()
+ testWatchFaceService.createHeadlessEngine(
+ ComponentName("test.watchface.app", "test.watchface.class")
+ )
runPostedTasksFor(0)
@@ -4550,12 +4554,14 @@
engineWrapper.onCreate(surfaceHolder)
engineWrapper.onSurfaceChanged(surfaceHolder, 0, 100, 100)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
val headlessEngineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
headlessEngineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -4691,12 +4697,14 @@
engineWrapper.onCreate(surfaceHolder)
engineWrapper.onSurfaceChanged(surfaceHolder, 0, 100, 100)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
val headlessEngineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
headlessEngineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -4823,12 +4831,14 @@
engineWrapper.onCreate(surfaceHolder)
engineWrapper.onSurfaceChanged(surfaceHolder, 0, 100, 100)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
val headlessEngineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
headlessEngineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -5119,12 +5129,14 @@
choreographer
)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
engineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
engineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -5187,12 +5199,14 @@
choreographer
)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
engineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
engineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
@@ -6381,12 +6395,14 @@
forceIsVisible = true
)
+ val componentName = ComponentName("test.watchface.app", "test.watchface.class")
engineWrapper =
- testWatchFaceService.createHeadlessEngine() as WatchFaceService.EngineWrapper
+ testWatchFaceService.createHeadlessEngine(componentName)
+ as WatchFaceService.EngineWrapper
engineWrapper.createHeadlessInstance(
HeadlessWatchFaceInstanceParams(
- ComponentName("test.watchface.app", "test.watchface.class"),
+ componentName,
DeviceConfig(false, false, 100, 200),
100,
100,
diff --git a/wear/wear-input/samples/src/main/java/androidx/wear/input/samples/WearableRemoteInputExtenderSample.kt b/wear/wear-input/samples/src/main/java/androidx/wear/input/samples/WearableRemoteInputExtenderSample.kt
index 9d18a11..f82948c 100644
--- a/wear/wear-input/samples/src/main/java/androidx/wear/input/samples/WearableRemoteInputExtenderSample.kt
+++ b/wear/wear-input/samples/src/main/java/androidx/wear/input/samples/WearableRemoteInputExtenderSample.kt
@@ -29,4 +29,4 @@
setEmojisAllowed(false)
setInputActionType(EditorInfo.IME_ACTION_GO)
}.build()
-}
\ No newline at end of file
+}
diff --git a/wear/wear-input/src/main/java/androidx/wear/input/RemoteInputIntentHelper.kt b/wear/wear-input/src/main/java/androidx/wear/input/RemoteInputIntentHelper.kt
index 87ded0e..542604f 100644
--- a/wear/wear-input/src/main/java/androidx/wear/input/RemoteInputIntentHelper.kt
+++ b/wear/wear-input/src/main/java/androidx/wear/input/RemoteInputIntentHelper.kt
@@ -271,4 +271,4 @@
smartReplyContext: List<CharSequence>
): Intent = intent.putExtra(EXTRA_SMART_REPLY_CONTEXT, ArrayList(smartReplyContext))
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-input/src/main/java/androidx/wear/input/WearableRemoteInputExtender.kt b/wear/wear-input/src/main/java/androidx/wear/input/WearableRemoteInputExtender.kt
index 0b27c43..6ccbcde 100644
--- a/wear/wear-input/src/main/java/androidx/wear/input/WearableRemoteInputExtender.kt
+++ b/wear/wear-input/src/main/java/androidx/wear/input/WearableRemoteInputExtender.kt
@@ -116,4 +116,4 @@
public fun RemoteInput.Builder.wearableExtender(block: WearableRemoteInputExtender.() -> Unit):
RemoteInput.Builder =
- WearableRemoteInputExtender(this).apply { block() }.get()
\ No newline at end of file
+ WearableRemoteInputExtender(this).apply { block() }.get()
diff --git a/wear/wear-input/src/test/java/androidx/wear/input/RemoteInputIntentHelperTest.kt b/wear/wear-input/src/test/java/androidx/wear/input/RemoteInputIntentHelperTest.kt
index 2daadf3..c066fb4 100644
--- a/wear/wear-input/src/test/java/androidx/wear/input/RemoteInputIntentHelperTest.kt
+++ b/wear/wear-input/src/test/java/androidx/wear/input/RemoteInputIntentHelperTest.kt
@@ -95,4 +95,4 @@
RemoteInputIntentHelper.putSmartReplyContextExtra(intent, smartReplyContext)
assertEquals(smartReplyContext, RemoteInputIntentHelper.getSmartReplyContextExtra(intent))
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-input/src/test/java/androidx/wear/input/WearInputTestRunner.kt b/wear/wear-input/src/test/java/androidx/wear/input/WearInputTestRunner.kt
index 01ffe1c..426feb0 100644
--- a/wear/wear-input/src/test/java/androidx/wear/input/WearInputTestRunner.kt
+++ b/wear/wear-input/src/test/java/androidx/wear/input/WearInputTestRunner.kt
@@ -37,4 +37,4 @@
)
.doNotInstrumentPackage("androidx.wear.input")
.build()
-}
\ No newline at end of file
+}
diff --git a/wear/wear-input/src/test/java/androidx/wear/input/WearableRemoteInputExtenderTest.kt b/wear/wear-input/src/test/java/androidx/wear/input/WearableRemoteInputExtenderTest.kt
index 6028816..5c410ac 100644
--- a/wear/wear-input/src/test/java/androidx/wear/input/WearableRemoteInputExtenderTest.kt
+++ b/wear/wear-input/src/test/java/androidx/wear/input/WearableRemoteInputExtenderTest.kt
@@ -128,4 +128,4 @@
IME_ACTION_NEXT to INPUT_ACTION_TYPE_SEND // other value
)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/PhoneTypeHelper.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/PhoneTypeHelper.kt
index fa65591..084d416 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/PhoneTypeHelper.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/PhoneTypeHelper.kt
@@ -93,4 +93,4 @@
@IntDef(DEVICE_TYPE_ERROR, DEVICE_TYPE_ANDROID, DEVICE_TYPE_IOS, DEVICE_TYPE_UNKNOWN)
internal annotation class DeviceFamily
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeChallenge.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeChallenge.kt
index b1a4123..d503ebd 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeChallenge.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeChallenge.kt
@@ -58,4 +58,4 @@
override fun hashCode(): Int {
return value.toByteArray(StandardCharsets.UTF_8).contentHashCode()
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeVerifier.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeVerifier.kt
index 085aaee..b6728e0 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeVerifier.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/CodeVerifier.kt
@@ -108,4 +108,4 @@
override fun hashCode(): Int {
return getValueBytes().contentHashCode()
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthClient.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthClient.kt
index c564a62..29ee6b7 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthClient.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthClient.kt
@@ -382,4 +382,4 @@
service = null
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthService.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthService.kt
index e0bbce3..0761dd3 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthService.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/authentication/RemoteAuthService.kt
@@ -186,4 +186,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingConfig.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingConfig.kt
index a5515ed..da4eed0 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingConfig.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingConfig.kt
@@ -156,4 +156,4 @@
public fun build(): BridgingConfig =
BridgingConfig(packageName, isBridgingEnabled, excludedTags)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManager.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManager.kt
index 6b07b6b..4cb0ce7 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManager.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManager.kt
@@ -136,4 +136,4 @@
private fun isWearableDevice(context: Context): Boolean =
context.packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManagerService.kt b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManagerService.kt
index f279f73..fe55f41 100644
--- a/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManagerService.kt
+++ b/wear/wear-phone-interactions/src/main/java/androidx/wear/phone/interactions/notifications/BridgingManagerService.kt
@@ -71,4 +71,4 @@
bridgingConfigurationHandler
.applyBridgingConfiguration(bridgingConfig)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/PhoneTypeHelperTest.kt b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/PhoneTypeHelperTest.kt
index c67bdca..4a5b80f0 100644
--- a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/PhoneTypeHelperTest.kt
+++ b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/PhoneTypeHelperTest.kt
@@ -26,12 +26,13 @@
import androidx.wear.phone.interactions.PhoneTypeHelper.Companion.getPhoneDeviceType
import com.google.common.truth.Truth.assertThat
import org.junit.Before
+import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito
-import org.mockito.MockitoAnnotations
+import org.mockito.junit.MockitoJUnit
import org.robolectric.annotation.Config
import org.robolectric.annotation.internal.DoNotInstrument
import org.robolectric.shadows.ShadowContentResolver
@@ -45,14 +46,15 @@
.path(PhoneTypeHelper.BLUETOOTH_MODE)
.build()
+ @get:Rule
+ val mocks = MockitoJUnit.rule()
+
@Mock
var mockContentProvider: ContentProvider? = null
private var contentResolver: ContentResolver? = null
- @Suppress("DEPRECATION") // b/251211092
@Before
fun setUp() {
- MockitoAnnotations.openMocks(this)
ShadowContentResolver.registerProviderInternal(
PhoneTypeHelper.SETTINGS_AUTHORITY,
mockContentProvider
diff --git a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/CodeVerifierCodeChallengeTest.kt b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/CodeVerifierCodeChallengeTest.kt
index 9de98e3..2e333f7 100644
--- a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/CodeVerifierCodeChallengeTest.kt
+++ b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/CodeVerifierCodeChallengeTest.kt
@@ -83,4 +83,4 @@
assertThat(CodeChallenge(CodeVerifier())).isNotEqualTo(CodeChallenge(CodeVerifier()))
assertThat(CodeChallenge(CodeVerifier())).isNotEqualTo(null)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/OAuthRequestResponseTest.kt b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/OAuthRequestResponseTest.kt
index 9d2cc93..ff346ef 100644
--- a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/OAuthRequestResponseTest.kt
+++ b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/authentication/OAuthRequestResponseTest.kt
@@ -500,4 +500,4 @@
assertThat(request.redirectUrl).isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerServiceTest.kt b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerServiceTest.kt
index 4c765e2..6089338 100644
--- a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerServiceTest.kt
+++ b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerServiceTest.kt
@@ -122,4 +122,4 @@
override fun applyBridgingConfiguration(bridgingConfig: BridgingConfig) {
this.bridgingConfig = bridgingConfig
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerTest.kt b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerTest.kt
index e49909c..c4c4762 100644
--- a/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerTest.kt
+++ b/wear/wear-phone-interactions/src/test/java/androidx/wear/phone/interactions/notifications/BridgingManagerTest.kt
@@ -166,4 +166,4 @@
private companion object {
private const val PACKAGE_NAME = "foo_package"
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-remote-interactions/src/androidTest/java/androidx/wear/remote/interactions/test/WatchFaceConfigIntentHelperTest.kt b/wear/wear-remote-interactions/src/androidTest/java/androidx/wear/remote/interactions/test/WatchFaceConfigIntentHelperTest.kt
index 802f257..5ed8349 100644
--- a/wear/wear-remote-interactions/src/androidTest/java/androidx/wear/remote/interactions/test/WatchFaceConfigIntentHelperTest.kt
+++ b/wear/wear-remote-interactions/src/androidTest/java/androidx/wear/remote/interactions/test/WatchFaceConfigIntentHelperTest.kt
@@ -52,4 +52,4 @@
fun testParseWatchPeerIdNull() {
assert(null == WatchFaceConfigIntentHelper.getPeerIdExtra(Intent()))
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-remote-interactions/src/main/java/androidx/wear/remote/interactions/WatchFaceConfigIntentHelper.kt b/wear/wear-remote-interactions/src/main/java/androidx/wear/remote/interactions/WatchFaceConfigIntentHelper.kt
index 54eefab..d36cd18 100644
--- a/wear/wear-remote-interactions/src/main/java/androidx/wear/remote/interactions/WatchFaceConfigIntentHelper.kt
+++ b/wear/wear-remote-interactions/src/main/java/androidx/wear/remote/interactions/WatchFaceConfigIntentHelper.kt
@@ -129,4 +129,4 @@
public fun putPeerIdExtra(watchFaceIntent: Intent, peerId: String): Intent =
watchFaceIntent.putExtra(EXTRA_PEER_ID, peerId)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-remote-interactions/src/test/java/androidx/wear/remote/interactions/WearRemoteInteractionsTestRunner.kt b/wear/wear-remote-interactions/src/test/java/androidx/wear/remote/interactions/WearRemoteInteractionsTestRunner.kt
index c15dd4b..f25150bd 100644
--- a/wear/wear-remote-interactions/src/test/java/androidx/wear/remote/interactions/WearRemoteInteractionsTestRunner.kt
+++ b/wear/wear-remote-interactions/src/test/java/androidx/wear/remote/interactions/WearRemoteInteractionsTestRunner.kt
@@ -36,4 +36,4 @@
)
.doNotInstrumentPackage("androidx.wear.remote.interactions")
.build()
-}
\ No newline at end of file
+}
diff --git a/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainActivity.kt b/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainActivity.kt
index 8a5455e..2ec5a44 100644
--- a/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainActivity.kt
+++ b/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainActivity.kt
@@ -137,4 +137,4 @@
private companion object {
private const val TAG = "AmbientSample"
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainViewModel.kt b/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainViewModel.kt
index cfb137d..4613969 100644
--- a/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainViewModel.kt
+++ b/wear/wear-samples-ambient/src/main/java/androidx/wear/samples/ambient/MainViewModel.kt
@@ -82,4 +82,4 @@
updates.value = value
updateTimestamp.value = System.currentTimeMillis()
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear/src/androidTest/java/androidx/wear/widget/ConfirmationOverlayTest.java b/wear/wear/src/androidTest/java/androidx/wear/widget/ConfirmationOverlayTest.java
index b732229..c0be286 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/widget/ConfirmationOverlayTest.java
+++ b/wear/wear/src/androidTest/java/androidx/wear/widget/ConfirmationOverlayTest.java
@@ -34,12 +34,12 @@
import androidx.wear.R;
import androidx.wear.widget.util.WakeLockRule;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -55,17 +55,14 @@
public final ActivityTestRule<ConfirmationOverlayTestActivity> mActivityRule =
new ActivityTestRule<>(ConfirmationOverlayTestActivity.class, true, true);
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
+
@Mock
private ConfirmationOverlay.OnAnimationFinishedListener mOnAnimationFinishedListener;
private LinearLayout mLinearLayout;
private TextView mActualTextView;
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
-
private Activity setupActivity() {
Activity activity = mActivityRule.getActivity();
mLinearLayout = new LinearLayout(activity);
diff --git a/wear/wear/src/androidTest/java/androidx/wear/widget/ScrollManagerTest.java b/wear/wear/src/androidTest/java/androidx/wear/widget/ScrollManagerTest.java
index 8ce380f..9c78ac1 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/widget/ScrollManagerTest.java
+++ b/wear/wear/src/androidTest/java/androidx/wear/widget/ScrollManagerTest.java
@@ -36,7 +36,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
@MediumTest
@RunWith(AndroidJUnit4.class)
@@ -55,6 +56,8 @@
public final ActivityTestRule<WearableRecyclerViewTestActivity> mActivityRule =
new ActivityTestRule<>(WearableRecyclerViewTestActivity.class, true, true);
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
+
@Mock
WearableRecyclerView mMockWearableRecyclerView;
@@ -62,7 +65,6 @@
@Before
public void setUp() throws Throwable {
- MockitoAnnotations.initMocks(this);
mScrollManagerUnderTest = new ScrollManager();
mScrollManagerUnderTest.setRecyclerView(mMockWearableRecyclerView, TEST_WIDTH, TEST_HEIGHT);
}
diff --git a/wear/wear/src/androidTest/java/androidx/wear/widget/WearableRecyclerViewTest.java b/wear/wear/src/androidTest/java/androidx/wear/widget/WearableRecyclerViewTest.java
index 03e34be..ad4bf84 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/widget/WearableRecyclerViewTest.java
+++ b/wear/wear/src/androidTest/java/androidx/wear/widget/WearableRecyclerViewTest.java
@@ -45,12 +45,12 @@
import androidx.wear.test.R;
import androidx.wear.widget.util.WakeLockRule;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
@LargeTest
@RunWith(AndroidJUnit4.class)
@@ -67,10 +67,7 @@
public final ActivityScenarioRule<WearableRecyclerViewTestActivity> mActivityRule =
new ActivityScenarioRule<>(WearableRecyclerViewTestActivity.class);
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
@Test
public void testCaseInitState() {
diff --git a/wear/wear/src/androidTest/java/androidx/wear/widget/drawer/WearableDrawerLayoutEspressoTest.java b/wear/wear/src/androidTest/java/androidx/wear/widget/drawer/WearableDrawerLayoutEspressoTest.java
index 0f61106..7327b13 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/widget/drawer/WearableDrawerLayoutEspressoTest.java
+++ b/wear/wear/src/androidTest/java/androidx/wear/widget/drawer/WearableDrawerLayoutEspressoTest.java
@@ -64,12 +64,12 @@
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
import java.util.concurrent.TimeoutException;
@@ -91,12 +91,10 @@
private final Intent mSinglePageIntent =
new DrawerTestActivity.Builder().setStyle(DrawerStyle.BOTH_DRAWER_NAV_SINGLE_PAGE)
.build();
- @Mock WearableNavigationDrawerView.OnItemSelectedListener mNavDrawerItemSelectedListener;
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
+ @Rule public final MockitoRule mocks = MockitoJUnit.rule();
+
+ @Mock WearableNavigationDrawerView.OnItemSelectedListener mNavDrawerItemSelectedListener;
@Test
public void openingNavigationDrawerDoesNotCloseActionDrawer() {
diff --git a/wear/wear/src/main/java/androidx/wear/activity/ConfirmationActivity.java b/wear/wear/src/main/java/androidx/wear/activity/ConfirmationActivity.java
index fc93614..1f4764d 100644
--- a/wear/wear/src/main/java/androidx/wear/activity/ConfirmationActivity.java
+++ b/wear/wear/src/main/java/androidx/wear/activity/ConfirmationActivity.java
@@ -85,7 +85,7 @@
public static final int OPEN_ON_PHONE_ANIMATION = 2;
public static final int FAILURE_ANIMATION = 3;
- /** Default animation duration in milliseconds. **/
+ /** Default animation duration in milliseconds. */
static final int DEFAULT_ANIMATION_DURATION_MILLIS =
ConfirmationOverlay.DEFAULT_ANIMATION_DURATION_MS;
diff --git a/wear/wear/src/main/java/androidx/wear/ambient/AmbientLifecycleObserverImpl.kt b/wear/wear/src/main/java/androidx/wear/ambient/AmbientLifecycleObserverImpl.kt
index 34841f6..29a29e2 100644
--- a/wear/wear/src/main/java/androidx/wear/ambient/AmbientLifecycleObserverImpl.kt
+++ b/wear/wear/src/main/java/androidx/wear/ambient/AmbientLifecycleObserverImpl.kt
@@ -132,4 +132,4 @@
super.onDestroy(owner)
delegate.onDestroy()
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear/src/main/java/androidx/wear/widget/ConfirmationOverlay.java b/wear/wear/src/main/java/androidx/wear/widget/ConfirmationOverlay.java
index 89b5914..604b1e0 100644
--- a/wear/wear/src/main/java/androidx/wear/widget/ConfirmationOverlay.java
+++ b/wear/wear/src/main/java/androidx/wear/widget/ConfirmationOverlay.java
@@ -101,10 +101,10 @@
void onAnimationFinished();
}
- /** Default animation duration in ms. **/
+ /** Default animation duration in ms. */
public static final int DEFAULT_ANIMATION_DURATION_MS = 1000;
- /** Default animation duration in ms. **/
+ /** Default animation duration in ms. */
private static final int A11Y_ANIMATION_DURATION_MS = 5000;
/** Types of animations to display in the overlay. */
diff --git a/wear/wear/src/test/java/androidx/wear/ambient/AmbientLifecycleObserverTestActivity.kt b/wear/wear/src/test/java/androidx/wear/ambient/AmbientLifecycleObserverTestActivity.kt
index 5529c95..e6a4ea6 100644
--- a/wear/wear/src/test/java/androidx/wear/ambient/AmbientLifecycleObserverTestActivity.kt
+++ b/wear/wear/src/test/java/androidx/wear/ambient/AmbientLifecycleObserverTestActivity.kt
@@ -49,4 +49,4 @@
lifecycle.addObserver(observer)
}
-}
\ No newline at end of file
+}
diff --git a/wear/wear/src/test/java/androidx/wear/utils/WearTypeHelperTest.java b/wear/wear/src/test/java/androidx/wear/utils/WearTypeHelperTest.java
index 47c60499..33f4219 100644
--- a/wear/wear/src/test/java/androidx/wear/utils/WearTypeHelperTest.java
+++ b/wear/wear/src/test/java/androidx/wear/utils/WearTypeHelperTest.java
@@ -26,7 +26,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.internal.DoNotInstrument;
@@ -38,10 +37,8 @@
private ShadowPackageManager mShadowPackageManager = null;
private Context mContext;
- @SuppressWarnings("deprecation") // b/251211092
@Before
public void setUp() {
- MockitoAnnotations.openMocks(this);
mContext = ApplicationProvider.getApplicationContext();
mShadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
}
diff --git a/wear/wear/src/test/java/androidx/wear/utils/WearUtilsTestRunner.kt b/wear/wear/src/test/java/androidx/wear/utils/WearUtilsTestRunner.kt
index 6e8c2c2..3c30025 100644
--- a/wear/wear/src/test/java/androidx/wear/utils/WearUtilsTestRunner.kt
+++ b/wear/wear/src/test/java/androidx/wear/utils/WearUtilsTestRunner.kt
@@ -36,4 +36,4 @@
)
.doNotInstrumentPackage("androidx.wear.utils")
.build()
-}
\ No newline at end of file
+}
diff --git a/window/extensions/core/core/build.gradle b/window/extensions/core/core/build.gradle
index 5a895b0..1f8f7fb 100644
--- a/window/extensions/core/core/build.gradle
+++ b/window/extensions/core/core/build.gradle
@@ -21,6 +21,7 @@
plugins {
id("AndroidXPlugin")
id("com.android.library")
+ id("kotlin-android")
}
dependencies {
diff --git a/window/extensions/core/core/src/test/java/androidx/window/extensions/core/util/function/FunctionalInterfaceIntegrityTest.kt b/window/extensions/core/core/src/test/java/androidx/window/extensions/core/util/function/FunctionalInterfaceIntegrityTest.kt
index 8670854..571a7a5f 100644
--- a/window/extensions/core/core/src/test/java/androidx/window/extensions/core/util/function/FunctionalInterfaceIntegrityTest.kt
+++ b/window/extensions/core/core/src/test/java/androidx/window/extensions/core/util/function/FunctionalInterfaceIntegrityTest.kt
@@ -57,4 +57,4 @@
assertTrue(Function::class.java.isInstance(testFunction))
assertEquals(1, functionClass.declaredMethods.size)
}
-}
\ No newline at end of file
+}
diff --git a/window/extensions/extensions/src/main/java/androidx/window/extensions/layout/FoldingFeature.java b/window/extensions/extensions/src/main/java/androidx/window/extensions/layout/FoldingFeature.java
index 0e74057..9f95510 100644
--- a/window/extensions/extensions/src/main/java/androidx/window/extensions/layout/FoldingFeature.java
+++ b/window/extensions/extensions/src/main/java/androidx/window/extensions/layout/FoldingFeature.java
@@ -122,11 +122,11 @@
*/
private static void validateFeatureBounds(@NonNull Rect bounds) {
if (bounds.width() == 0 && bounds.height() == 0) {
- throw new IllegalArgumentException("Bounds must be non zero");
+ throw new IllegalArgumentException("Bounds must be non zero. Bounds: " + bounds);
}
if (bounds.left != 0 && bounds.top != 0) {
throw new IllegalArgumentException("Bounding rectangle must start at the top or "
- + "left window edge for folding features");
+ + "left window edge for folding features. Bounds: " + bounds);
}
}
diff --git a/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/TestConsumer.kt b/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/TestConsumer.kt
index 4cb80f0..05a18ec 100644
--- a/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/TestConsumer.kt
+++ b/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/TestConsumer.kt
@@ -88,4 +88,4 @@
return values[valueIndex]
}
}
-}
\ No newline at end of file
+}
diff --git a/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/layout/WindowInfoTrackerEndToEndTest.kt b/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/layout/WindowInfoTrackerEndToEndTest.kt
index f4ab61e..6f6e4e3 100644
--- a/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/layout/WindowInfoTrackerEndToEndTest.kt
+++ b/window/integration-tests/configuration-change-tests/src/androidTest/java/androidx/window/integration/layout/WindowInfoTrackerEndToEndTest.kt
@@ -177,4 +177,4 @@
}
return foldingFeatureStateCounter
}
-}
\ No newline at end of file
+}
diff --git a/window/window-core/src/main/java/androidx/window/core/layout/WindowHeightSizeClass.kt b/window/window-core/src/main/java/androidx/window/core/layout/WindowHeightSizeClass.kt
index 849def5..b03985f 100644
--- a/window/window-core/src/main/java/androidx/window/core/layout/WindowHeightSizeClass.kt
+++ b/window/window-core/src/main/java/androidx/window/core/layout/WindowHeightSizeClass.kt
@@ -92,4 +92,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-core/src/main/java/androidx/window/core/layout/WindowSizeClass.kt b/window/window-core/src/main/java/androidx/window/core/layout/WindowSizeClass.kt
index c4ad955..aeb4bdf 100644
--- a/window/window-core/src/main/java/androidx/window/core/layout/WindowSizeClass.kt
+++ b/window/window-core/src/main/java/androidx/window/core/layout/WindowSizeClass.kt
@@ -84,4 +84,4 @@
return WindowSizeClass(windowWidthSizeClass, windowHeightSizeClass)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-core/src/test/java/androidx/window/core/layout/WindowHeightSizeClassTest.kt b/window/window-core/src/test/java/androidx/window/core/layout/WindowHeightSizeClassTest.kt
index cf667a8..498133b 100644
--- a/window/window-core/src/test/java/androidx/window/core/layout/WindowHeightSizeClassTest.kt
+++ b/window/window-core/src/test/java/androidx/window/core/layout/WindowHeightSizeClassTest.kt
@@ -45,4 +45,4 @@
fun testInvalidSizeBucket() {
WindowHeightSizeClass.compute(-1f)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-core/src/test/java/androidx/window/core/layout/WindowWidthSizeClassTest.kt b/window/window-core/src/test/java/androidx/window/core/layout/WindowWidthSizeClassTest.kt
index 1050bef..5256b3c16 100644
--- a/window/window-core/src/test/java/androidx/window/core/layout/WindowWidthSizeClassTest.kt
+++ b/window/window-core/src/test/java/androidx/window/core/layout/WindowWidthSizeClassTest.kt
@@ -45,4 +45,4 @@
fun testInvalidSizeBucket() {
WindowWidthSizeClass.compute(-1f)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLog.kt b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLog.kt
index 3ab4096..5a80058 100644
--- a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLog.kt
+++ b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLog.kt
@@ -20,4 +20,4 @@
* A data class to hold a title and a detail or subtitle that can be shown using [InfoLogAdapter]
* . This can be used to create samples with an ordered timeline of events.
*/
-data class InfoLog(val title: String, val detail: String, val id: Int)
\ No newline at end of file
+data class InfoLog(val title: String, val detail: String, val id: Int)
diff --git a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogAdapter.kt b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogAdapter.kt
index 81df057..572681b 100644
--- a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogAdapter.kt
+++ b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogAdapter.kt
@@ -55,4 +55,4 @@
private fun append(item: InfoLog) {
items.add(0, item)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogVH.kt b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogVH.kt
index 1bf7dfe..9d432bc 100644
--- a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogVH.kt
+++ b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/infolog/InfoLogVH.kt
@@ -24,4 +24,4 @@
class InfoLogVH(view: View) : RecyclerView.ViewHolder(view) {
val titleView: TextView = view.findViewById(R.id.title_view)
val detailView: TextView = view.findViewById(R.id.detail_view)
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/util/PictureInPictureUtil.kt b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/util/PictureInPictureUtil.kt
index 70eedab..a78ec24 100644
--- a/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/util/PictureInPictureUtil.kt
+++ b/window/window-demos/demo-common/src/main/java/androidx/window/demo/common/util/PictureInPictureUtil.kt
@@ -104,4 +104,4 @@
Toast.makeText(activity, "PiP not supported", Toast.LENGTH_LONG).show()
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/TrustedEmbeddingActivity.kt b/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/TrustedEmbeddingActivity.kt
index bc2e7cd..67c0b09 100644
--- a/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/TrustedEmbeddingActivity.kt
+++ b/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/TrustedEmbeddingActivity.kt
@@ -34,4 +34,4 @@
findViewById<TextView>(R.id.detail_text_view).text =
getString(R.string.trusted_embedding_activity_detail)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/UntrustedEmbeddingActivity.kt b/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/UntrustedEmbeddingActivity.kt
index f26aeee..cfe7c21 100644
--- a/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/UntrustedEmbeddingActivity.kt
+++ b/window/window-demos/demo-second-app/src/main/java/androidx/window/demo2/embedding/UntrustedEmbeddingActivity.kt
@@ -34,4 +34,4 @@
findViewById<TextView>(R.id.detail_text_view).text =
getString(R.string.untrusted_embedding_activity_detail)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/DisplayFeaturesNoConfigChangeActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/DisplayFeaturesNoConfigChangeActivity.kt
index bd77218..ffe96e4 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/DisplayFeaturesNoConfigChangeActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/DisplayFeaturesNoConfigChangeActivity.kt
@@ -18,4 +18,4 @@
import androidx.window.demo.common.DisplayFeaturesActivity
-class DisplayFeaturesNoConfigChangeActivity : DisplayFeaturesActivity()
\ No newline at end of file
+class DisplayFeaturesNoConfigChangeActivity : DisplayFeaturesActivity()
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/ImeActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/ImeActivity.kt
index a31144d..6d20aaa 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/ImeActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/ImeActivity.kt
@@ -46,4 +46,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/RearDisplayActivityConfigChanges.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/RearDisplayActivityConfigChanges.kt
index 3d35924..97ab277 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/RearDisplayActivityConfigChanges.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/RearDisplayActivityConfigChanges.kt
@@ -165,4 +165,4 @@
private companion object {
private val TAG = RearDisplayActivityConfigChanges::class.java.simpleName
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayout.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayout.kt
index 06ba0be..e50802c 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayout.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayout.kt
@@ -194,4 +194,4 @@
private fun isValidFoldFeature(displayFeature: DisplayFeature): Boolean {
return displayFeature is FoldingFeature
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayoutActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayoutActivity.kt
index 89290a9e..d7ac4bb 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayoutActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/SplitLayoutActivity.kt
@@ -51,4 +51,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/TestIme.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/TestIme.kt
index a63b171..ea31885 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/TestIme.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/TestIme.kt
@@ -90,4 +90,4 @@
override fun onEvaluateFullscreenMode(): Boolean {
return false
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateCallbackActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateCallbackActivity.kt
index 2122cbd..e6aa9f9 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateCallbackActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateCallbackActivity.kt
@@ -162,4 +162,4 @@
companion object {
val TAG = WindowStateCallbackActivity::class.simpleName
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateConfigView.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateConfigView.kt
index 4a18150..6cdd672 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateConfigView.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateConfigView.kt
@@ -68,4 +68,4 @@
configValue = value
configView.text = value
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateView.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateView.kt
index df757f9..c5b2f7a 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateView.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/coresdk/WindowStateView.kt
@@ -167,4 +167,4 @@
companion object {
private val TIME_FORMAT = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoAdapter.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoAdapter.kt
index 5bc46ae..4834333 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoAdapter.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoAdapter.kt
@@ -36,4 +36,4 @@
override fun getItemCount(): Int {
return demoItems.size
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoItem.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoItem.kt
index 88f3c65..c37223a6 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoItem.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoItem.kt
@@ -17,4 +17,4 @@
import android.app.Activity
-class DemoItem(val description: String, val buttonTitle: String, val clazz: Class<out Activity>)
\ No newline at end of file
+class DemoItem(val description: String, val buttonTitle: String, val clazz: Class<out Activity>)
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoVH.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoVH.kt
index d986288..09a0901 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoVH.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/DemoVH.kt
@@ -36,4 +36,4 @@
view.context.startActivity(intent)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/WindowDemosActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/WindowDemosActivity.kt
index 19c0156..109394a 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/demos/WindowDemosActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/demos/WindowDemosActivity.kt
@@ -75,4 +75,4 @@
recyclerView.adapter = DemoAdapter(demoItems)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/DemoActivityEmbeddingController.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/DemoActivityEmbeddingController.kt
index d8130d1..d06ea28 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/DemoActivityEmbeddingController.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/DemoActivityEmbeddingController.kt
@@ -81,4 +81,4 @@
return globalInstance!!
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExampleWindowInitializer.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExampleWindowInitializer.kt
index a797d43..f9d8303 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExampleWindowInitializer.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExampleWindowInitializer.kt
@@ -255,4 +255,4 @@
override fun dependencies(): List<Class<out Initializer<*>>> {
return emptyList()
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExpandedDialogActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExpandedDialogActivity.kt
index 3419fcb..0c29311 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExpandedDialogActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/ExpandedDialogActivity.kt
@@ -41,4 +41,4 @@
dialog.show()
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityA.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityA.kt
index 94757d6..c79e224 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityA.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityA.kt
@@ -16,4 +16,4 @@
package androidx.window.demo.embedding
-open class SplitActivityA : SplitActivityBase()
\ No newline at end of file
+open class SplitActivityA : SplitActivityBase()
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityB.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityB.kt
index 90a67dd..aec91b9 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityB.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityB.kt
@@ -36,4 +36,4 @@
intent.removeExtra(EXTRA_LAUNCH_C_TO_SIDE)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityD.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityD.kt
index a9ec11a..705dfee 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityD.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityD.kt
@@ -27,4 +27,4 @@
findViewById<View>(R.id.root_split_activity_layout)
.setBackgroundColor(Color.parseColor("#eeeeee"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityDetail.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityDetail.kt
index 5db4314..53b8f6d 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityDetail.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityDetail.kt
@@ -45,4 +45,4 @@
companion object {
const val EXTRA_SELECTED_ITEM = "selected_item"
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityE.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityE.kt
index 17c43b1..2766a7c 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityE.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityE.kt
@@ -27,4 +27,4 @@
findViewById<View>(R.id.root_split_activity_layout)
.setBackgroundColor(Color.parseColor("#ede7f6"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityF.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityF.kt
index 325524e..5fbf9ce 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityF.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityF.kt
@@ -27,4 +27,4 @@
findViewById<View>(R.id.root_split_activity_layout)
.setBackgroundColor(Color.parseColor("#ffebee"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityList.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityList.kt
index 345b5eb..050cf98 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityList.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityList.kt
@@ -62,4 +62,4 @@
startIntent.putExtra(EXTRA_SELECTED_ITEM, text)
startActivity(startIntent)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityListPlaceholder.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityListPlaceholder.kt
index ab08fe7..efddba7 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityListPlaceholder.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityListPlaceholder.kt
@@ -16,4 +16,4 @@
package androidx.window.demo.embedding
-open class SplitActivityListPlaceholder : SplitActivityPlaceholder()
\ No newline at end of file
+open class SplitActivityListPlaceholder : SplitActivityPlaceholder()
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityPlaceholder.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityPlaceholder.kt
index 380b5b7..687f931 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityPlaceholder.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityPlaceholder.kt
@@ -32,4 +32,4 @@
viewBinding.rootSplitActivityLayout.setBackgroundColor(Color.parseColor("#eeeeee"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityTrampoline.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityTrampoline.kt
index 3732156..173d596 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityTrampoline.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitActivityTrampoline.kt
@@ -54,4 +54,4 @@
finish()
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleActivityBase.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleActivityBase.kt
index ccde719..e4ed4d3 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleActivityBase.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleActivityBase.kt
@@ -113,4 +113,4 @@
SplitAttributes.LayoutDirection.BOTTOM_TO_TOP,
)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleMainActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleMainActivity.kt
index 1ee12e7..1021af3 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleMainActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleMainActivity.kt
@@ -423,4 +423,4 @@
internal const val EXTRA_LAUNCH_SECONDARY = "launch_secondary"
internal const val TAG_CUSTOMIZED_SPLIT_ATTRIBUTES = "customized_split_attributes"
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePlaceholderActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePlaceholderActivity.kt
index e9fc3b7..2f65329 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePlaceholderActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePlaceholderActivity.kt
@@ -25,4 +25,4 @@
viewBinding.rootSplitActivityLayout.setBackgroundColor(Color.parseColor("#eeeeee"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePrimaryActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePrimaryActivity.kt
index 07f269d..097da84 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePrimaryActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesTogglePrimaryActivity.kt
@@ -106,4 +106,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleSecondaryActivity.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleSecondaryActivity.kt
index 502fb72..eac978a 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleSecondaryActivity.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitAttributesToggleSecondaryActivity.kt
@@ -199,4 +199,4 @@
override fun onNothingSelected(view: AdapterView<*>?) {
// Auto-generated method stub
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityA.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityA.kt
index 9ba2ac3..d28577c 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityA.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityA.kt
@@ -16,4 +16,4 @@
package androidx.window.demo.embedding
-class SplitDeviceStateActivityA : SplitDeviceStateActivityBase()
\ No newline at end of file
+class SplitDeviceStateActivityA : SplitDeviceStateActivityBase()
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityB.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityB.kt
index 6711d76..e018e7f 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityB.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityB.kt
@@ -27,4 +27,4 @@
findViewById<View>(R.id.root_split_activity_layout)
.setBackgroundColor(Color.parseColor("#fff3e0"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityBase.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityBase.kt
index dbb25ec..16aad4f 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityBase.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitDeviceStateActivityBase.kt
@@ -395,4 +395,4 @@
*/
const val DEFAULT_MINIMUM_WIDTH_DP = 600
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityBase.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityBase.kt
index fa767bf..e9670f8 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityBase.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityBase.kt
@@ -34,4 +34,4 @@
viewBinding = ActivitySplitImeLayoutBinding.inflate(layoutInflater)
setContentView(viewBinding.root)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityMain.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityMain.kt
index d866e9f..bd4fb12 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityMain.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityMain.kt
@@ -25,4 +25,4 @@
super.onCreate(savedInstanceState)
viewBinding.rootSplitActivityLayout.setBackgroundColor(Color.parseColor("#e0f7fa"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityPlaceholder.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityPlaceholder.kt
index 4ecd3ac..a77c616 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityPlaceholder.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitImeActivityPlaceholder.kt
@@ -57,4 +57,4 @@
windowManager.removeView(imeLayeringTargetPlaceholder)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityA.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityA.kt
index eaffe18..36e6f01 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityA.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityA.kt
@@ -16,4 +16,4 @@
package androidx.window.demo.embedding
-open class SplitPipActivityA : SplitPipActivityBase()
\ No newline at end of file
+open class SplitPipActivityA : SplitPipActivityBase()
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityB.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityB.kt
index 2446624..64f2508 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityB.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityB.kt
@@ -24,4 +24,4 @@
super.onCreate(savedInstanceState)
viewBinding.rootSplitActivityLayout.setBackgroundColor(Color.parseColor("#fff3e0"))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityBase.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityBase.kt
index 7e62662..9c53836 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityBase.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityBase.kt
@@ -307,4 +307,4 @@
ruleController.addRule(rule)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityNoPip.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityNoPip.kt
index 0af97fb..6df6b7d 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityNoPip.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityNoPip.kt
@@ -23,4 +23,4 @@
super.onCreate(savedInstanceState)
viewBinding.placeholderText.text = "PiP not supported"
}
-}
\ No newline at end of file
+}
diff --git a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityPlaceholder.kt b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityPlaceholder.kt
index 5989917..9404edd 100644
--- a/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityPlaceholder.kt
+++ b/window/window-demos/demo/src/main/java/androidx/window/demo/embedding/SplitPipActivityPlaceholder.kt
@@ -16,4 +16,4 @@
package androidx.window.demo.embedding
-open class SplitPipActivityPlaceholder : SplitActivityPlaceholder()
\ No newline at end of file
+open class SplitPipActivityPlaceholder : SplitActivityPlaceholder()
diff --git a/window/window-java/src/androidTest/java/androidx/window/java/TestConsumer.kt b/window/window-java/src/androidTest/java/androidx/window/java/TestConsumer.kt
index e96e396..cb53396 100644
--- a/window/window-java/src/androidTest/java/androidx/window/java/TestConsumer.kt
+++ b/window/window-java/src/androidTest/java/androidx/window/java/TestConsumer.kt
@@ -38,4 +38,4 @@
assertValueCount(1)
assertEquals(t, values.first())
}
-}
\ No newline at end of file
+}
diff --git a/window/window-java/src/main/java/androidx/window/java/area/WindowAreaControllerCallbackAdapter.kt b/window/window-java/src/main/java/androidx/window/java/area/WindowAreaControllerCallbackAdapter.kt
index 3bd79e7..a5697db 100644
--- a/window/window-java/src/main/java/androidx/window/java/area/WindowAreaControllerCallbackAdapter.kt
+++ b/window/window-java/src/main/java/androidx/window/java/area/WindowAreaControllerCallbackAdapter.kt
@@ -64,4 +64,4 @@
fun removeWindowAreaInfoListListener(listener: Consumer<List<WindowAreaInfo>>) {
callbackToFlowAdapter.disconnect(listener)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-java/src/main/java/androidx/window/java/core/CallbackToFlowAdapter.kt b/window/window-java/src/main/java/androidx/window/java/core/CallbackToFlowAdapter.kt
index 67c2e86..175c1ada 100644
--- a/window/window-java/src/main/java/androidx/window/java/core/CallbackToFlowAdapter.kt
+++ b/window/window-java/src/main/java/androidx/window/java/core/CallbackToFlowAdapter.kt
@@ -61,4 +61,4 @@
consumerToJobMap.remove(consumer)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-java/src/main/java/androidx/window/java/embedding/SplitControllerCallbackAdapter.kt b/window/window-java/src/main/java/androidx/window/java/embedding/SplitControllerCallbackAdapter.kt
index d5b4db9..98b14ba 100644
--- a/window/window-java/src/main/java/androidx/window/java/embedding/SplitControllerCallbackAdapter.kt
+++ b/window/window-java/src/main/java/androidx/window/java/embedding/SplitControllerCallbackAdapter.kt
@@ -74,4 +74,4 @@
fun removeSplitListener(consumer: Consumer<List<SplitInfo>>) {
callbackToFlowAdapter.disconnect(consumer)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-java/src/test/java/androidx/window/java/layout/WindowInfoTrackerCallbackAdapterTest.kt b/window/window-java/src/test/java/androidx/window/java/layout/WindowInfoTrackerCallbackAdapterTest.kt
index f924a0f..765c903 100644
--- a/window/window-java/src/test/java/androidx/window/java/layout/WindowInfoTrackerCallbackAdapterTest.kt
+++ b/window/window-java/src/test/java/androidx/window/java/layout/WindowInfoTrackerCallbackAdapterTest.kt
@@ -62,4 +62,4 @@
verifyNoMoreInteractions(consumer)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/TestActivity.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/TestActivity.kt
index 510278d..993ebaf 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/TestActivity.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/TestActivity.kt
@@ -21,4 +21,4 @@
/**
* A test [Activity] for testing purposes.
*/
-public class TestActivity : Activity()
\ No newline at end of file
+public class TestActivity : Activity()
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/DisplayFeatureTestingTest.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/DisplayFeatureTestingTest.kt
index d9ab535..a3db94b 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/DisplayFeatureTestingTest.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/DisplayFeatureTestingTest.kt
@@ -148,4 +148,4 @@
assertEquals(expected.state, actual.state)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/Utils.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/Utils.kt
index 9c57994..483f289 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/Utils.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/Utils.kt
@@ -27,4 +27,4 @@
fun assumePlatformAtOrBelow(version: Int) {
Assume.assumeTrue(Build.VERSION.SDK_INT <= version)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRuleTest.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRuleTest.kt
index 8f2df43..926e65d 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRuleTest.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRuleTest.kt
@@ -182,4 +182,4 @@
}
private object TestException : Exception("TEST EXCEPTION")
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoTestingTest.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoTestingTest.kt
index 4e7e644..a50f84a 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoTestingTest.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowLayoutInfoTestingTest.kt
@@ -41,4 +41,4 @@
assertEquals(expected, actual)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowMetricsCalculatorRuleTest.kt b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowMetricsCalculatorRuleTest.kt
index a663eaf..7ca466f 100644
--- a/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowMetricsCalculatorRuleTest.kt
+++ b/window/window-testing/src/androidTest/java/androidx/window/testing/layout/WindowMetricsCalculatorRuleTest.kt
@@ -180,4 +180,4 @@
}
private object TestException : Exception("TEST EXCEPTION")
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityEmbeddingRule.kt b/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityEmbeddingRule.kt
index 70f2ba7..7f376e8 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityEmbeddingRule.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityEmbeddingRule.kt
@@ -91,4 +91,4 @@
fun overrideSplitInfo(activity: Activity, splitInfoList: List<SplitInfo>) {
stubEmbeddingBackend.overrideSplitInfo(activity, splitInfoList)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityStackTesting.kt b/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityStackTesting.kt
index 879ed68..cb71422 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityStackTesting.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/embedding/ActivityStackTesting.kt
@@ -45,4 +45,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY)
@VisibleForTesting
@JvmField
-val TEST_ACTIVITY_STACK_TOKEN = Binder()
\ No newline at end of file
+val TEST_ACTIVITY_STACK_TOKEN = Binder()
diff --git a/window/window-testing/src/main/java/androidx/window/testing/embedding/SplitInfoTesting.kt b/window/window-testing/src/main/java/androidx/window/testing/embedding/SplitInfoTesting.kt
index 1ed7844..b010299 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/embedding/SplitInfoTesting.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/embedding/SplitInfoTesting.kt
@@ -50,4 +50,4 @@
TEST_SPLIT_INFO_TOKEN
)
-private val TEST_SPLIT_INFO_TOKEN = Binder()
\ No newline at end of file
+private val TEST_SPLIT_INFO_TOKEN = Binder()
diff --git a/window/window-testing/src/main/java/androidx/window/testing/embedding/StubEmbeddingBackendDecorator.kt b/window/window-testing/src/main/java/androidx/window/testing/embedding/StubEmbeddingBackendDecorator.kt
index 94bbc1a..9ed034f 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/embedding/StubEmbeddingBackendDecorator.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/embedding/StubEmbeddingBackendDecorator.kt
@@ -28,4 +28,4 @@
override fun decorate(embeddingBackend: EmbeddingBackend): EmbeddingBackend {
return stubEmbeddingBackend
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/DisplayFeatureTesting.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/DisplayFeatureTesting.kt
index 5bf4fac..377fa77 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/DisplayFeatureTesting.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/DisplayFeatureTesting.kt
@@ -214,4 +214,4 @@
"$isSeparating, occlusionType = $occlusionType, orientation = $orientation, state = " +
"$state"
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/PublishLayoutInfoTracker.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/PublishLayoutInfoTracker.kt
index 22b4af7..9f0ef8b 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/PublishLayoutInfoTracker.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/PublishLayoutInfoTracker.kt
@@ -35,4 +35,4 @@
override fun windowLayoutInfo(@UiContext context: Context): Flow<WindowLayoutInfo> {
return flow
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/PublishWindowInfoTrackerDecorator.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/PublishWindowInfoTrackerDecorator.kt
index 6022b32..f1e9a71 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/PublishWindowInfoTrackerDecorator.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/PublishWindowInfoTrackerDecorator.kt
@@ -27,4 +27,4 @@
override fun decorate(tracker: WindowInfoTracker): WindowInfoTracker {
return PublishLayoutInfoTracker(tracker, flow)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/StubMetricDecorator.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/StubMetricDecorator.kt
index 7a8eeb2..41b7931 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/StubMetricDecorator.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/StubMetricDecorator.kt
@@ -26,4 +26,4 @@
override fun decorate(calculator: WindowMetricsCalculator): WindowMetricsCalculator {
return StubWindowMetricsCalculator()
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/StubWindowMetricsCalculator.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/StubWindowMetricsCalculator.kt
index 5a040ab..a057f1c 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/StubWindowMetricsCalculator.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/StubWindowMetricsCalculator.kt
@@ -96,4 +96,4 @@
display.getRealSize(point)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRule.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRule.kt
index b8d4b070..c851198 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRule.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoPublisherRule.kt
@@ -73,4 +73,4 @@
fun overrideWindowLayoutInfo(info: WindowLayoutInfo) {
flow.tryEmit(info)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoTesting.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoTesting.kt
index da9ca79..25cf9b0 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoTesting.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowLayoutInfoTesting.kt
@@ -31,4 +31,4 @@
@JvmOverloads
fun TestWindowLayoutInfo(displayFeatures: List<DisplayFeature> = emptyList()): WindowLayoutInfo {
return WindowLayoutInfo(displayFeatures)
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowMetricsCalculatorRule.kt b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowMetricsCalculatorRule.kt
index 10e68f1..0a86aed 100644
--- a/window/window-testing/src/main/java/androidx/window/testing/layout/WindowMetricsCalculatorRule.kt
+++ b/window/window-testing/src/main/java/androidx/window/testing/layout/WindowMetricsCalculatorRule.kt
@@ -45,4 +45,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityEmbeddingRuleTest.kt b/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityEmbeddingRuleTest.kt
index 6bd7721..03d16d5 100644
--- a/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityEmbeddingRuleTest.kt
+++ b/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityEmbeddingRuleTest.kt
@@ -333,4 +333,4 @@
}
private object TestException : Exception("TEST EXCEPTION")
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityStackTestingTest.kt b/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityStackTestingTest.kt
index 487aeab..6bde585 100644
--- a/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityStackTestingTest.kt
+++ b/window/window-testing/src/test/java/androidx/window/testing/embedding/ActivityStackTestingTest.kt
@@ -49,4 +49,4 @@
assertTrue(activity in activityStack)
assertFalse(activityStack.isEmpty)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/test/java/androidx/window/testing/embedding/SplitInfoTestingTest.kt b/window/window-testing/src/test/java/androidx/window/testing/embedding/SplitInfoTestingTest.kt
index b434d3b..5bf9eeb 100644
--- a/window/window-testing/src/test/java/androidx/window/testing/embedding/SplitInfoTestingTest.kt
+++ b/window/window-testing/src/test/java/androidx/window/testing/embedding/SplitInfoTestingTest.kt
@@ -57,4 +57,4 @@
assertEquals(secondaryActivityStack, splitInfo.secondaryActivityStack)
assertEquals(splitAttributes, splitInfo.splitAttributes)
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/test/java/androidx/window/testing/embedding/StubEmbeddingBackendTest.kt b/window/window-testing/src/test/java/androidx/window/testing/embedding/StubEmbeddingBackendTest.kt
index 4afd0ce..d475d98 100644
--- a/window/window-testing/src/test/java/androidx/window/testing/embedding/StubEmbeddingBackendTest.kt
+++ b/window/window-testing/src/test/java/androidx/window/testing/embedding/StubEmbeddingBackendTest.kt
@@ -50,4 +50,4 @@
fun hasListenersIsInitiallyFalse() {
assertFalse(backend.hasSplitInfoListeners(mock()))
}
-}
\ No newline at end of file
+}
diff --git a/window/window-testing/src/test/java/androidx/window/testing/embedding/TestSplitInfo.kt b/window/window-testing/src/test/java/androidx/window/testing/embedding/TestSplitInfo.kt
index 8c261ef..04b385c 100644
--- a/window/window-testing/src/test/java/androidx/window/testing/embedding/TestSplitInfo.kt
+++ b/window/window-testing/src/test/java/androidx/window/testing/embedding/TestSplitInfo.kt
@@ -71,4 +71,4 @@
isEmpty,
token
)
-}
\ No newline at end of file
+}
diff --git a/window/window/samples/src/main/java/androidx.window.samples.embedding/SplitAttributesCalculatorSamples.kt b/window/window/samples/src/main/java/androidx.window.samples.embedding/SplitAttributesCalculatorSamples.kt
index e244fb9..d1ac513 100644
--- a/window/window/samples/src/main/java/androidx.window.samples.embedding/SplitAttributesCalculatorSamples.kt
+++ b/window/window/samples/src/main/java/androidx.window.samples.embedding/SplitAttributesCalculatorSamples.kt
@@ -149,4 +149,4 @@
/** Assume it's a valid [Application]... */
val context = Application()
const val TAG_SPLIT_RULE_MAIN = "main"
-const val TAG_SPLIT_RULE_EXPAND_IN_PORTRAIT = "expand_in_portrait"
\ No newline at end of file
+const val TAG_SPLIT_RULE_EXPAND_IN_PORTRAIT = "expand_in_portrait"
diff --git a/window/window/src/androidTest/java/androidx/window/TestConfigChangeHandlingActivity.kt b/window/window/src/androidTest/java/androidx/window/TestConfigChangeHandlingActivity.kt
index 541a273..7220470 100644
--- a/window/window/src/androidTest/java/androidx/window/TestConfigChangeHandlingActivity.kt
+++ b/window/window/src/androidTest/java/androidx/window/TestConfigChangeHandlingActivity.kt
@@ -16,4 +16,4 @@
package androidx.window
/** Activity that handles orientation configuration change. */
-internal class TestConfigChangeHandlingActivity : TestActivity()
\ No newline at end of file
+internal class TestConfigChangeHandlingActivity : TestActivity()
diff --git a/window/window/src/androidTest/java/androidx/window/WindowPropertiesTest.kt b/window/window/src/androidTest/java/androidx/window/WindowPropertiesTest.kt
index 57f5d51..ca75428 100644
--- a/window/window/src/androidTest/java/androidx/window/WindowPropertiesTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/WindowPropertiesTest.kt
@@ -135,4 +135,4 @@
}
return property.boolean
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/WindowTestUtils.kt b/window/window/src/androidTest/java/androidx/window/WindowTestUtils.kt
index d9ae80b..9d019d4 100644
--- a/window/window/src/androidTest/java/androidx/window/WindowTestUtils.kt
+++ b/window/window/src/androidTest/java/androidx/window/WindowTestUtils.kt
@@ -39,4 +39,4 @@
assumeTrue(apiLevel > 0)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/area/SafeWindowAreaComponentProviderTest.kt b/window/window/src/androidTest/java/androidx/window/area/SafeWindowAreaComponentProviderTest.kt
index 50bb347..ccf3521 100644
--- a/window/window/src/androidTest/java/androidx/window/area/SafeWindowAreaComponentProviderTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/area/SafeWindowAreaComponentProviderTest.kt
@@ -52,4 +52,4 @@
assertNull(safeComponent)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/area/WindowAreaControllerImplTest.kt b/window/window/src/androidTest/java/androidx/window/area/WindowAreaControllerImplTest.kt
index e664813f..4ae7871 100644
--- a/window/window/src/androidTest/java/androidx/window/area/WindowAreaControllerImplTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/area/WindowAreaControllerImplTest.kt
@@ -653,4 +653,4 @@
private const val FEATURE_VENDOR_API_LEVEL = 3
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/core/ActivityComponentInfoTest.kt b/window/window/src/androidTest/java/androidx/window/core/ActivityComponentInfoTest.kt
index 267f7df..1b11dda 100644
--- a/window/window/src/androidTest/java/androidx/window/core/ActivityComponentInfoTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/core/ActivityComponentInfoTest.kt
@@ -33,4 +33,4 @@
assertEquals(componentName.packageName, activityComponentInfo.packageName)
assertEquals(componentName.className, activityComponentInfo.className)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/core/BoundsTest.kt b/window/window/src/androidTest/java/androidx/window/core/BoundsTest.kt
index 0dcb697..a872cdd 100644
--- a/window/window/src/androidTest/java/androidx/window/core/BoundsTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/core/BoundsTest.kt
@@ -81,4 +81,4 @@
assertTrue(zeroBounds.isZero)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/embedding/RuleParserTests.kt b/window/window/src/androidTest/java/androidx/window/embedding/RuleParserTests.kt
index 03401c9..2b62a06 100644
--- a/window/window/src/androidTest/java/androidx/window/embedding/RuleParserTests.kt
+++ b/window/window/src/androidTest/java/androidx/window/embedding/RuleParserTests.kt
@@ -332,4 +332,4 @@
const val TEST_TAG = "test"
const val TAG_CUSTOM_ACTIVITY_RULE = "rule1"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/embedding/SafeActivityEmbeddingComponentProviderTest.kt b/window/window/src/androidTest/java/androidx/window/embedding/SafeActivityEmbeddingComponentProviderTest.kt
index 1eab9d0..bd56b26 100644
--- a/window/window/src/androidTest/java/androidx/window/embedding/SafeActivityEmbeddingComponentProviderTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/embedding/SafeActivityEmbeddingComponentProviderTest.kt
@@ -82,4 +82,4 @@
companion object {
private const val TAG = "SafeActivityEmbeddingComponentProviderTest"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/layout/SafeWindowLayoutComponentProviderTest.kt b/window/window/src/androidTest/java/androidx/window/layout/SafeWindowLayoutComponentProviderTest.kt
index 9855ce8..4a680cf 100644
--- a/window/window/src/androidTest/java/androidx/window/layout/SafeWindowLayoutComponentProviderTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/layout/SafeWindowLayoutComponentProviderTest.kt
@@ -63,4 +63,4 @@
assertNull(safeComponent)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/androidTest/java/androidx/window/layout/util/ContextCompatHelperTest.kt b/window/window/src/androidTest/java/androidx/window/layout/util/ContextCompatHelperTest.kt
index 59d0af6..2f7d05e 100644
--- a/window/window/src/androidTest/java/androidx/window/layout/util/ContextCompatHelperTest.kt
+++ b/window/window/src/androidTest/java/androidx/window/layout/util/ContextCompatHelperTest.kt
@@ -51,4 +51,4 @@
val contextWrapper = ContextWrapper(null)
assertEquals(contextWrapper, unwrapUiContext(contextWrapper))
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/debug/java/androidx/window/core/BuildConfig.kt b/window/window/src/debug/java/androidx/window/core/BuildConfig.kt
index 0ce7a67..8ffcdfd 100644
--- a/window/window/src/debug/java/androidx/window/core/BuildConfig.kt
+++ b/window/window/src/debug/java/androidx/window/core/BuildConfig.kt
@@ -24,4 +24,4 @@
*/
internal object BuildConfig {
val verificationMode: VerificationMode = STRICT
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/SafeWindowExtensionsProvider.kt b/window/window/src/main/java/androidx/window/SafeWindowExtensionsProvider.kt
index c33b215..4da6663 100644
--- a/window/window/src/main/java/androidx/window/SafeWindowExtensionsProvider.kt
+++ b/window/window/src/main/java/androidx/window/SafeWindowExtensionsProvider.kt
@@ -64,4 +64,4 @@
get() {
return loader.loadClass(WindowExtensionsConstants.WINDOW_EXTENSIONS_PROVIDER_CLASS)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/WindowProperties.kt b/window/window/src/main/java/androidx/window/WindowProperties.kt
index 6f73640..405f79c 100644
--- a/window/window/src/main/java/androidx/window/WindowProperties.kt
+++ b/window/window/src/main/java/androidx/window/WindowProperties.kt
@@ -182,4 +182,4 @@
*/
const val PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES =
"android.window.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES"
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/RearDisplayPresentationSessionPresenterImpl.kt b/window/window/src/main/java/androidx/window/area/RearDisplayPresentationSessionPresenterImpl.kt
index 4c06141..60aabc8 100644
--- a/window/window/src/main/java/androidx/window/area/RearDisplayPresentationSessionPresenterImpl.kt
+++ b/window/window/src/main/java/androidx/window/area/RearDisplayPresentationSessionPresenterImpl.kt
@@ -35,4 +35,4 @@
override fun close() {
windowAreaComponent.endRearDisplayPresentationSession()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaAdapter.kt b/window/window/src/main/java/androidx/window/area/WindowAreaAdapter.kt
index 24e7152..c884dc6 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaAdapter.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaAdapter.kt
@@ -43,4 +43,4 @@
else -> WINDOW_AREA_STATUS_UNSUPPORTED
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaCapability.kt b/window/window/src/main/java/androidx/window/area/WindowAreaCapability.kt
index 8586aec..7992fbd 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaCapability.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaCapability.kt
@@ -107,4 +107,4 @@
result = 31 * result + status.hashCode()
return result
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaInfo.kt b/window/window/src/main/java/androidx/window/area/WindowAreaInfo.kt
index e38bdaa..dcfd01f 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaInfo.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaInfo.kt
@@ -129,4 +129,4 @@
return "WindowAreaInfo{ Metrics: $metrics, type: $type, " +
"Capabilities: ${capabilityMap.entries} }"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaPresentationSessionCallback.kt b/window/window/src/main/java/androidx/window/area/WindowAreaPresentationSessionCallback.kt
index 2d4b8ce..05b6d2d 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaPresentationSessionCallback.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaPresentationSessionCallback.kt
@@ -54,4 +54,4 @@
* If content was never presented, then this method will never be called.
*/
fun onContainerVisibilityChanged(isVisible: Boolean)
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaSession.kt b/window/window/src/main/java/androidx/window/area/WindowAreaSession.kt
index 41ca43ea..7743ef0 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaSession.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaSession.kt
@@ -27,4 +27,4 @@
* Closes the active session, no-op if the session is not currently active.
*/
fun close()
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaSessionCallback.kt b/window/window/src/main/java/androidx/window/area/WindowAreaSessionCallback.kt
index b76e175..e551660 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaSessionCallback.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaSessionCallback.kt
@@ -37,4 +37,4 @@
* can be expanded to alert for more errors in the future.
*/
fun onSessionEnded(t: Throwable?)
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/WindowAreaSessionPresenter.kt b/window/window/src/main/java/androidx/window/area/WindowAreaSessionPresenter.kt
index bc8bfc8..b06cbbd 100644
--- a/window/window/src/main/java/androidx/window/area/WindowAreaSessionPresenter.kt
+++ b/window/window/src/main/java/androidx/window/area/WindowAreaSessionPresenter.kt
@@ -37,4 +37,4 @@
* corresponding display and start showing content.
*/
fun setContentView(view: View)
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/area/utils/DeviceMetrics.kt b/window/window/src/main/java/androidx/window/area/utils/DeviceMetrics.kt
index 009d892..f8bcab0 100644
--- a/window/window/src/main/java/androidx/window/area/utils/DeviceMetrics.kt
+++ b/window/window/src/main/java/androidx/window/area/utils/DeviceMetrics.kt
@@ -47,4 +47,4 @@
return "DeviceMetrics{ Manufacturer: $manufacturer, model: $model, " +
"Rear display metrics: $rearDisplayMetrics }"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/ActivityComponentInfo.kt b/window/window/src/main/java/androidx/window/core/ActivityComponentInfo.kt
index b2e1745..47a09d3d 100644
--- a/window/window/src/main/java/androidx/window/core/ActivityComponentInfo.kt
+++ b/window/window/src/main/java/androidx/window/core/ActivityComponentInfo.kt
@@ -53,4 +53,4 @@
override fun toString(): String {
return "ClassInfo { packageName: $packageName, className: $className }"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/Bounds.kt b/window/window/src/main/java/androidx/window/core/Bounds.kt
index 4d67a07..630c188 100644
--- a/window/window/src/main/java/androidx/window/core/Bounds.kt
+++ b/window/window/src/main/java/androidx/window/core/Bounds.kt
@@ -98,4 +98,4 @@
result = 31 * result + bottom
return result
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/ConsumerAdapter.kt b/window/window/src/main/java/androidx/window/core/ConsumerAdapter.kt
index af51cd0..dae0489 100644
--- a/window/window/src/main/java/androidx/window/core/ConsumerAdapter.kt
+++ b/window/window/src/main/java/androidx/window/core/ConsumerAdapter.kt
@@ -187,4 +187,4 @@
return name == "toString" && returnType.equals(String::class.java) && args == null
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/ExperimentalWindowApi.kt b/window/window/src/main/java/androidx/window/core/ExperimentalWindowApi.kt
index 686d49a..922a35c 100644
--- a/window/window/src/main/java/androidx/window/core/ExperimentalWindowApi.kt
+++ b/window/window/src/main/java/androidx/window/core/ExperimentalWindowApi.kt
@@ -19,4 +19,4 @@
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
-public annotation class ExperimentalWindowApi
\ No newline at end of file
+public annotation class ExperimentalWindowApi
diff --git a/window/window/src/main/java/androidx/window/core/ExtensionsUtil.kt b/window/window/src/main/java/androidx/window/core/ExtensionsUtil.kt
index 7409025..d12062c 100644
--- a/window/window/src/main/java/androidx/window/core/ExtensionsUtil.kt
+++ b/window/window/src/main/java/androidx/window/core/ExtensionsUtil.kt
@@ -17,17 +17,20 @@
package androidx.window.core
import android.util.Log
+import androidx.annotation.VisibleForTesting
import androidx.window.core.VerificationMode.LOG
import androidx.window.extensions.WindowExtensionsProvider
internal object ExtensionsUtil {
private val TAG = ExtensionsUtil::class.simpleName
+ private var overrideVendorApiLevel: Int? = null
val safeVendorApiLevel: Int
get() {
return try {
- WindowExtensionsProvider.getWindowExtensions().vendorApiLevel
+ overrideVendorApiLevel
+ ?: WindowExtensionsProvider.getWindowExtensions().vendorApiLevel
} catch (e: NoClassDefFoundError) {
if (BuildConfig.verificationMode == LOG) {
Log.d(TAG, "Embedding extension version not found")
@@ -40,4 +43,14 @@
0
}
}
-}
\ No newline at end of file
+
+ @VisibleForTesting
+ internal fun setOverrideVendorApiLevel(apiLevel: Int) {
+ overrideVendorApiLevel = apiLevel
+ }
+
+ @VisibleForTesting
+ internal fun resetOverrideVendorApiLevel() {
+ overrideVendorApiLevel = null
+ }
+}
diff --git a/window/window/src/main/java/androidx/window/core/PredicateAdapter.kt b/window/window/src/main/java/androidx/window/core/PredicateAdapter.kt
index 0685df8..bb38227 100644
--- a/window/window/src/main/java/androidx/window/core/PredicateAdapter.kt
+++ b/window/window/src/main/java/androidx/window/core/PredicateAdapter.kt
@@ -145,4 +145,4 @@
return predicate.toString()
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/SpecificationComputer.kt b/window/window/src/main/java/androidx/window/core/SpecificationComputer.kt
index 11434c2..27726df 100644
--- a/window/window/src/main/java/androidx/window/core/SpecificationComputer.kt
+++ b/window/window/src/main/java/androidx/window/core/SpecificationComputer.kt
@@ -170,4 +170,4 @@
override fun debug(tag: String, message: String) {
Log.d(tag, message)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/VerificationMode.kt b/window/window/src/main/java/androidx/window/core/VerificationMode.kt
index d5fd8a5..0b50148 100644
--- a/window/window/src/main/java/androidx/window/core/VerificationMode.kt
+++ b/window/window/src/main/java/androidx/window/core/VerificationMode.kt
@@ -23,4 +23,4 @@
STRICT,
LOG,
QUIET
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/core/Version.kt b/window/window/src/main/java/androidx/window/core/Version.kt
index ce05070..acdefb5 100644
--- a/window/window/src/main/java/androidx/window/core/Version.kt
+++ b/window/window/src/main/java/androidx/window/core/Version.kt
@@ -104,4 +104,4 @@
return Version(major, minor, patch, description)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingAspectRatio.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingAspectRatio.kt
index e09b9a4..67330c9 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingAspectRatio.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingAspectRatio.kt
@@ -105,4 +105,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingBackend.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingBackend.kt
index c8825c0..f35d5de 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingBackend.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingBackend.kt
@@ -105,4 +105,4 @@
* Returns an instance of [EmbeddingBackend]
*/
fun decorate(embeddingBackend: EmbeddingBackend): EmbeddingBackend
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingCompat.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingCompat.kt
index a3559bb..2c543f3 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingCompat.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingCompat.kt
@@ -206,4 +206,4 @@
) { _, _, _ -> } as ActivityEmbeddingComponent
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingInterfaceCompat.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingInterfaceCompat.kt
index 26d8846..ccfba1d 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingInterfaceCompat.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingInterfaceCompat.kt
@@ -56,4 +56,4 @@
fun updateSplitAttributes(splitInfo: SplitInfo, splitAttributes: SplitAttributes)
fun areSplitAttributesUpdatesSupported(): Boolean
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/EmbeddingRule.kt b/window/window/src/main/java/androidx/window/embedding/EmbeddingRule.kt
index 99287fd..c456091 100644
--- a/window/window/src/main/java/androidx/window/embedding/EmbeddingRule.kt
+++ b/window/window/src/main/java/androidx/window/embedding/EmbeddingRule.kt
@@ -42,4 +42,4 @@
override fun hashCode(): Int {
return tag.hashCode()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/ExtensionEmbeddingBackend.kt b/window/window/src/main/java/androidx/window/embedding/ExtensionEmbeddingBackend.kt
index 49f364a..c7f4c3b 100644
--- a/window/window/src/main/java/androidx/window/embedding/ExtensionEmbeddingBackend.kt
+++ b/window/window/src/main/java/androidx/window/embedding/ExtensionEmbeddingBackend.kt
@@ -435,4 +435,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/RuleController.kt b/window/window/src/main/java/androidx/window/embedding/RuleController.kt
index 4ede326..192f3ec 100644
--- a/window/window/src/main/java/androidx/window/embedding/RuleController.kt
+++ b/window/window/src/main/java/androidx/window/embedding/RuleController.kt
@@ -133,4 +133,4 @@
fun parseRules(context: Context, @XmlRes staticRuleResourceId: Int): Set<EmbeddingRule> =
RuleParser.parseRules(context.applicationContext, staticRuleResourceId) ?: emptySet()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SafeActivityEmbeddingComponentProvider.kt b/window/window/src/main/java/androidx/window/embedding/SafeActivityEmbeddingComponentProvider.kt
index be35e2a..f980f1e 100644
--- a/window/window/src/main/java/androidx/window/embedding/SafeActivityEmbeddingComponentProvider.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SafeActivityEmbeddingComponentProvider.kt
@@ -190,4 +190,4 @@
get() {
return loader.loadClass(ACTIVITY_EMBEDDING_COMPONENT_CLASS)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitAttributes.kt b/window/window/src/main/java/androidx/window/embedding/SplitAttributes.kt
index d0c39b2..3e22b1a 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitAttributes.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitAttributes.kt
@@ -436,4 +436,4 @@
*/
fun build(): SplitAttributes = SplitAttributes(splitType, layoutDirection)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitAttributesCalculatorParams.kt b/window/window/src/main/java/androidx/window/embedding/SplitAttributesCalculatorParams.kt
index 40453be..ced97c9 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitAttributesCalculatorParams.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitAttributesCalculatorParams.kt
@@ -68,4 +68,4 @@
", defaultSplitAttributes=$defaultSplitAttributes" +
", areDefaultConstraintsSatisfied=$areDefaultConstraintsSatisfied" +
", tag=$splitRuleTag}"
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitController.kt b/window/window/src/main/java/androidx/window/embedding/SplitController.kt
index d3279546..e478ff7 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitController.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitController.kt
@@ -270,4 +270,4 @@
return SplitController(backend)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitInfo.kt b/window/window/src/main/java/androidx/window/embedding/SplitInfo.kt
index 81adda5..362b032 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitInfo.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitInfo.kt
@@ -77,4 +77,4 @@
append("}")
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitPairFilter.kt b/window/window/src/main/java/androidx/window/embedding/SplitPairFilter.kt
index 399401b..c806948 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitPairFilter.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitPairFilter.kt
@@ -191,4 +191,4 @@
result = 31 * result + (secondaryActivityIntentAction?.hashCode() ?: 0)
return result
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitPairRule.kt b/window/window/src/main/java/androidx/window/embedding/SplitPairRule.kt
index 7ea22f8..a69ddb6 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitPairRule.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitPairRule.kt
@@ -334,4 +334,4 @@
", finishSecondaryWithPrimary=$finishSecondaryWithPrimary" +
", filters=$filters" +
"}"
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitPlaceholderRule.kt b/window/window/src/main/java/androidx/window/embedding/SplitPlaceholderRule.kt
index 2639171..dbc9c6e 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitPlaceholderRule.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitPlaceholderRule.kt
@@ -339,4 +339,4 @@
", finishPrimaryWithPlaceholder=$finishPrimaryWithPlaceholder" +
", filters=$filters" +
"}"
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/embedding/SplitRule.kt b/window/window/src/main/java/androidx/window/embedding/SplitRule.kt
index 765876e..75d2af5 100644
--- a/window/window/src/main/java/androidx/window/embedding/SplitRule.kt
+++ b/window/window/src/main/java/androidx/window/embedding/SplitRule.kt
@@ -336,4 +336,4 @@
", maxAspectRatioInPortrait=$maxAspectRatioInPortrait" +
", maxAspectRatioInLandscape=$maxAspectRatioInLandscape" +
"}"
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/HardwareFoldingFeature.kt b/window/window/src/main/java/androidx/window/layout/HardwareFoldingFeature.kt
index aad7487..fc52702 100644
--- a/window/window/src/main/java/androidx/window/layout/HardwareFoldingFeature.kt
+++ b/window/window/src/main/java/androidx/window/layout/HardwareFoldingFeature.kt
@@ -122,4 +122,4 @@
val HINGE: Type = Type("HINGE")
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculator.kt b/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculator.kt
index 132ff58..3a10007 100644
--- a/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculator.kt
+++ b/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculator.kt
@@ -172,4 +172,4 @@
* Returns an instance of [WindowMetricsCalculator]
*/
fun decorate(calculator: WindowMetricsCalculator): WindowMetricsCalculator
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculatorCompat.kt b/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculatorCompat.kt
index 5087722..6b7c4f2 100644
--- a/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculatorCompat.kt
+++ b/window/window/src/main/java/androidx/window/layout/WindowMetricsCalculatorCompat.kt
@@ -472,4 +472,4 @@
}
return windowInsetsCompat
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/WindowBackend.kt b/window/window/src/main/java/androidx/window/layout/adapter/WindowBackend.kt
index 2f83e75..3fb8004 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/WindowBackend.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/WindowBackend.kt
@@ -50,4 +50,4 @@
fun hasRegisteredListeners(): Boolean {
return false
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0.kt b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0.kt
index 8e257a2..39e2cfe 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0.kt
@@ -35,4 +35,4 @@
override fun unregisterLayoutChangeCallback(callback: Consumer<WindowLayoutInfo>) {
// empty implementation since there are no consumers
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi1.kt b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi1.kt
index 0d76b61..1446a39 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi1.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi1.kt
@@ -120,4 +120,4 @@
return !(contextToListeners.isEmpty() && listenerToContext.isEmpty() &&
consumerToToken.isEmpty())
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi2.kt b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi2.kt
index 5e25f8a..1c60c33 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi2.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi2.kt
@@ -96,4 +96,4 @@
override fun hasRegisteredListeners(): Boolean {
return !(contextToListeners.isEmpty() && listenerToContext.isEmpty())
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionsWindowLayoutInfoAdapter.kt b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionsWindowLayoutInfoAdapter.kt
index 5f4a31b..1c5fb13 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionsWindowLayoutInfoAdapter.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/extensions/ExtensionsWindowLayoutInfoAdapter.kt
@@ -113,4 +113,4 @@
return true
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/extensions/MulticastConsumer.kt b/window/window/src/main/java/androidx/window/layout/adapter/extensions/MulticastConsumer.kt
index 0977d4a..b57f88f 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/extensions/MulticastConsumer.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/extensions/MulticastConsumer.kt
@@ -60,4 +60,4 @@
fun isEmpty(): Boolean {
return registeredListeners.isEmpty()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/ExtensionInterfaceCompat.kt b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/ExtensionInterfaceCompat.kt
index acb3ed3..4320e4a 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/ExtensionInterfaceCompat.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/ExtensionInterfaceCompat.kt
@@ -56,4 +56,4 @@
*/
fun onWindowLayoutChanged(activity: Activity, newLayout: WindowLayoutInfo)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarCompat.kt b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarCompat.kt
index 233d710..d3f5aab 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarCompat.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarCompat.kt
@@ -432,4 +432,4 @@
return activity?.window?.attributes?.token
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarWindowBackend.kt b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarWindowBackend.kt
index 79fd244..57da910 100644
--- a/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarWindowBackend.kt
+++ b/window/window/src/main/java/androidx/window/layout/adapter/sidecar/SidecarWindowBackend.kt
@@ -250,4 +250,4 @@
globalInstance = null
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/util/ContextCompatHelper.kt b/window/window/src/main/java/androidx/window/layout/util/ContextCompatHelper.kt
index b5b1422..2b5af8a 100644
--- a/window/window/src/main/java/androidx/window/layout/util/ContextCompatHelper.kt
+++ b/window/window/src/main/java/androidx/window/layout/util/ContextCompatHelper.kt
@@ -99,4 +99,4 @@
.currentWindowMetrics.windowInsets
return WindowInsetsCompat.toWindowInsetsCompat(platformInsets)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/main/java/androidx/window/layout/util/DisplayCompatHelper.kt b/window/window/src/main/java/androidx/window/layout/util/DisplayCompatHelper.kt
index 8532337..09afea5 100644
--- a/window/window/src/main/java/androidx/window/layout/util/DisplayCompatHelper.kt
+++ b/window/window/src/main/java/androidx/window/layout/util/DisplayCompatHelper.kt
@@ -49,4 +49,4 @@
fun safeInsetBottom(displayCutout: DisplayCutout): Int {
return displayCutout.safeInsetBottom
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/release/java/androidx/window/core/BuildConfig.kt b/window/window/src/release/java/androidx/window/core/BuildConfig.kt
index fa2c094..955ad66e 100644
--- a/window/window/src/release/java/androidx/window/core/BuildConfig.kt
+++ b/window/window/src/release/java/androidx/window/core/BuildConfig.kt
@@ -24,4 +24,4 @@
*/
internal object BuildConfig {
val verificationMode: VerificationMode = QUIET
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/core/ActivityComponentInfoTest.kt b/window/window/src/test/java/androidx/window/core/ActivityComponentInfoTest.kt
index 64823b7..03f0d3b 100644
--- a/window/window/src/test/java/androidx/window/core/ActivityComponentInfoTest.kt
+++ b/window/window/src/test/java/androidx/window/core/ActivityComponentInfoTest.kt
@@ -37,4 +37,4 @@
const val PACKAGE_NAME = "package"
const val CLASS_NAME = "ClassName"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/core/BoundsTest.kt b/window/window/src/test/java/androidx/window/core/BoundsTest.kt
index 0d19d4a..c18042d 100644
--- a/window/window/src/test/java/androidx/window/core/BoundsTest.kt
+++ b/window/window/src/test/java/androidx/window/core/BoundsTest.kt
@@ -100,4 +100,4 @@
const val dimension = 100
const val doubleDimension = 200
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/core/ConsumerAdapterTest.kt b/window/window/src/test/java/androidx/window/core/ConsumerAdapterTest.kt
index 22dd2b4..1b8c8e9 100644
--- a/window/window/src/test/java/androidx/window/core/ConsumerAdapterTest.kt
+++ b/window/window/src/test/java/androidx/window/core/ConsumerAdapterTest.kt
@@ -156,4 +156,4 @@
adapter.addConsumer(listenerInterface, String::class, "addConsumer", consumer)
assertEquals(consumer.toString(), listenerInterface.consumers.first().toString())
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/core/PredicateAdapterTest.kt b/window/window/src/test/java/androidx/window/core/PredicateAdapterTest.kt
index cc8e69c..7c864ed 100644
--- a/window/window/src/test/java/androidx/window/core/PredicateAdapterTest.kt
+++ b/window/window/src/test/java/androidx/window/core/PredicateAdapterTest.kt
@@ -165,4 +165,4 @@
)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/core/SpecificationComputerTest.kt b/window/window/src/test/java/androidx/window/core/SpecificationComputerTest.kt
index 848f97a..8cd1547 100644
--- a/window/window/src/test/java/androidx/window/core/SpecificationComputerTest.kt
+++ b/window/window/src/test/java/androidx/window/core/SpecificationComputerTest.kt
@@ -102,4 +102,4 @@
const val TAG = "test-tag-3462353414123412"
const val MESSAGE = "test-message-123412431241235"
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingControllerTest.kt b/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingControllerTest.kt
index 2234cc4..c4cf0b5 100644
--- a/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingControllerTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingControllerTest.kt
@@ -106,4 +106,4 @@
EmbeddingBackend.reset()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingOptionsTest.kt b/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingOptionsTest.kt
new file mode 100644
index 0000000..d9c2127
--- /dev/null
+++ b/window/window/src/test/java/androidx/window/embedding/ActivityEmbeddingOptionsTest.kt
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.window.embedding
+
+import android.app.Activity
+import android.app.ActivityOptions
+import android.content.Context
+import androidx.window.core.ExtensionsUtil
+import androidx.window.extensions.WindowExtensions
+import org.junit.After
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertThrows
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+import org.mockito.kotlin.any
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.never
+import org.mockito.kotlin.verify
+import org.mockito.kotlin.whenever
+
+/**
+ * The unit tests for activity embedding extension functions to [ActivityOptions]
+ *
+ * @see [ActivityOptions.setLaunchingActivityStack]
+ * @see [ActivityOptions.isSetLaunchingActivityStackSupported]
+ */
+@OptIn(androidx.window.core.ExperimentalWindowApi::class)
+class ActivityEmbeddingOptionsTest {
+
+ private lateinit var mockEmbeddingBackend: EmbeddingBackend
+ private lateinit var mockContext: Context
+ private lateinit var mockActivity: Activity
+ private lateinit var mockActivityStack: ActivityStack
+ private lateinit var mockActivityOptions: ActivityOptions
+
+ @Before
+ fun setUp() {
+ mockEmbeddingBackend = mock()
+ mockContext = mock()
+ mockActivity = mock()
+ mockActivityOptions = mock()
+ mockActivityStack = ActivityStack(listOf(), true, mock())
+
+ whenever(mockActivity.applicationContext).doReturn(mockContext)
+ whenever(mockEmbeddingBackend.getActivityStack(mockActivity)).doReturn(mockActivityStack)
+
+ EmbeddingBackend.overrideDecorator(object : EmbeddingBackendDecorator {
+ override fun decorate(embeddingBackend: EmbeddingBackend): EmbeddingBackend =
+ mockEmbeddingBackend
+ })
+
+ // ActivityEmbeddingOptions is only supported since level 3
+ ExtensionsUtil.setOverrideVendorApiLevel(WindowExtensions.VENDOR_API_LEVEL_3)
+ }
+
+ @After
+ fun tearDown() {
+ EmbeddingBackend.reset()
+ ExtensionsUtil.resetOverrideVendorApiLevel()
+ }
+
+ @Test
+ fun testSetLaunchingActivityStack() {
+ mockActivityOptions.setLaunchingActivityStack(mockActivity, mockActivityStack)
+
+ verify(mockEmbeddingBackend).setLaunchingActivityStack(
+ mockActivityOptions, mockActivityStack.token)
+ }
+
+ @Test
+ fun testSetLaunchingActivityStack_byActivity() {
+ mockActivityOptions.setLaunchingActivityStack(mockActivity)
+
+ verify(mockEmbeddingBackend).setLaunchingActivityStack(
+ mockActivityOptions, mockActivityStack.token)
+ }
+
+ @Test
+ fun testSetLaunchingActivityStack_unsupportedApiLevel() {
+ ExtensionsUtil.setOverrideVendorApiLevel(WindowExtensions.VENDOR_API_LEVEL_2)
+
+ assertThrows(UnsupportedOperationException::class.java) {
+ mockActivityOptions.setLaunchingActivityStack(mockActivity, mockActivityStack)
+ }
+ verify(mockEmbeddingBackend, never()).setLaunchingActivityStack(any(), any())
+ }
+
+ @Test
+ fun testIsSetLaunchingActivityStackSupported() {
+ ExtensionsUtil.setOverrideVendorApiLevel(WindowExtensions.VENDOR_API_LEVEL_2)
+
+ assertFalse(mockActivityOptions.isSetLaunchingActivityStackSupported())
+
+ ExtensionsUtil.setOverrideVendorApiLevel(WindowExtensions.VENDOR_API_LEVEL_3)
+
+ assertTrue(mockActivityOptions.isSetLaunchingActivityStackSupported())
+ }
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/ActivityRuleTest.kt b/window/window/src/test/java/androidx/window/embedding/ActivityRuleTest.kt
index d5cce1a..72a8a26 100644
--- a/window/window/src/test/java/androidx/window/embedding/ActivityRuleTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/ActivityRuleTest.kt
@@ -114,4 +114,4 @@
null
)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/ActivityStackTest.kt b/window/window/src/test/java/androidx/window/embedding/ActivityStackTest.kt
index 7c905fb..27a9e13 100644
--- a/window/window/src/test/java/androidx/window/embedding/ActivityStackTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/ActivityStackTest.kt
@@ -76,4 +76,4 @@
assertTrue(stackString.contains(isEmpty.toString()))
assertTrue(stackString.contains(token.toString()))
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/EmbeddingAspectRatioTest.kt b/window/window/src/test/java/androidx/window/embedding/EmbeddingAspectRatioTest.kt
index fc5fb0c..1b4bf36 100644
--- a/window/window/src/test/java/androidx/window/embedding/EmbeddingAspectRatioTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/EmbeddingAspectRatioTest.kt
@@ -65,4 +65,4 @@
EmbeddingAspectRatio.buildAspectRatioFromValue(1.1f)
)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/EmbeddingCompatTest.kt b/window/window/src/test/java/androidx/window/embedding/EmbeddingCompatTest.kt
index 029aa99..545f5f2 100644
--- a/window/window/src/test/java/androidx/window/embedding/EmbeddingCompatTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/EmbeddingCompatTest.kt
@@ -79,4 +79,4 @@
private val CONSUMER_ADAPTER = ConsumerAdapter(LOADER)
private val EMBEDDING_ADAPTER = EmbeddingAdapter(PREDICATE_ADAPTER)
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/RuleControllerTest.kt b/window/window/src/test/java/androidx/window/embedding/RuleControllerTest.kt
index 901f009..384ce64 100644
--- a/window/window/src/test/java/androidx/window/embedding/RuleControllerTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/RuleControllerTest.kt
@@ -94,4 +94,4 @@
EmbeddingBackend.reset()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitAttributesCalculatorParamsTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitAttributesCalculatorParamsTest.kt
index 566c225..f0065b4 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitAttributesCalculatorParamsTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitAttributesCalculatorParamsTest.kt
@@ -81,4 +81,4 @@
assertTrue(paramsString.contains(areDefaultConstraintsSatisfied.toString()))
assertTrue(paramsString.contains(splitRuleTag))
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitAttributesTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitAttributesTest.kt
index 7acee3d..0f466c3 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitAttributesTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitAttributesTest.kt
@@ -129,4 +129,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitControllerTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitControllerTest.kt
index 028eafa..2188e0e 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitControllerTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitControllerTest.kt
@@ -112,4 +112,4 @@
splitController.invalidateTopVisibleSplitAttributes()
verify(mockBackend).invalidateTopVisibleSplitAttributes()
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitInfoTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitInfoTest.kt
index b207678..4838a39 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitInfoTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitInfoTest.kt
@@ -100,4 +100,4 @@
isEmpty: Boolean = false,
token: IBinder = INVALID_ACTIVITY_STACK_TOKEN,
): ActivityStack = ActivityStack(activitiesInProcess, isEmpty, token)
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitPairFilterTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitPairFilterTest.kt
index 5e35eae..3782edc 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitPairFilterTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitPairFilterTest.kt
@@ -218,4 +218,4 @@
private val WILDCARD_CLASS_COMPONENT = ComponentName(FAKE_PACKAGE, "*")
private val WILDCARD_COMPONENT = ComponentName("*", "*")
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitPairRuleTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitPairRuleTest.kt
index eeaa0f8..0a23c45 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitPairRuleTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitPairRuleTest.kt
@@ -375,4 +375,4 @@
return Rect(0, 0, minValidWidthPx, minValidWidthPx)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitPlaceHolderRuleTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitPlaceHolderRuleTest.kt
index d8cc0fa..856fdb9 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitPlaceHolderRuleTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitPlaceHolderRuleTest.kt
@@ -355,4 +355,4 @@
return Rect(0, 0, minValidWidthPx, minValidWidthPx)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/embedding/SplitRuleTest.kt b/window/window/src/test/java/androidx/window/embedding/SplitRuleTest.kt
index 0de2845..4c275c1 100644
--- a/window/window/src/test/java/androidx/window/embedding/SplitRuleTest.kt
+++ b/window/window/src/test/java/androidx/window/embedding/SplitRuleTest.kt
@@ -37,4 +37,4 @@
fun test_minSmallestWidthMustBeNonNegative() {
SplitRule(minSmallestWidthDp = -1, defaultSplitAttributes = SplitAttributes())
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/layout/HardwareFoldingFeatureTest.kt b/window/window/src/test/java/androidx/window/layout/HardwareFoldingFeatureTest.kt
index 840014a..13c9ada 100644
--- a/window/window/src/test/java/androidx/window/layout/HardwareFoldingFeatureTest.kt
+++ b/window/window/src/test/java/androidx/window/layout/HardwareFoldingFeatureTest.kt
@@ -201,4 +201,4 @@
assertEquals(FoldingFeature.Orientation.VERTICAL, feature.orientation)
}
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0Test.kt b/window/window/src/test/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0Test.kt
index 7b0ee0f..bcf2eb0 100644
--- a/window/window/src/test/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0Test.kt
+++ b/window/window/src/test/java/androidx/window/layout/adapter/extensions/ExtensionWindowBackendApi0Test.kt
@@ -36,4 +36,4 @@
fun test_removingConsumer_doesNotCrash() {
backend.unregisterLayoutChangeCallback(mock())
}
-}
\ No newline at end of file
+}
diff --git a/window/window/src/test/java/androidx/window/reflection/ReflectionUtilsTest.kt b/window/window/src/test/java/androidx/window/reflection/ReflectionUtilsTest.kt
index bdab6f7..d02236c 100644
--- a/window/window/src/test/java/androidx/window/reflection/ReflectionUtilsTest.kt
+++ b/window/window/src/test/java/androidx/window/reflection/ReflectionUtilsTest.kt
@@ -85,4 +85,4 @@
private fun testMethod(): Int {
return 0
}
-}
\ No newline at end of file
+}
diff --git a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/CoroutineSleepWorker.kt b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/CoroutineSleepWorker.kt
index a706bc8..90bd74d 100644
--- a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/CoroutineSleepWorker.kt
+++ b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/CoroutineSleepWorker.kt
@@ -37,4 +37,4 @@
Log.e(tag, "finished sleep; stopped=$isStopped")
return Result.success()
}
-}
\ No newline at end of file
+}
diff --git a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/DirectBootReceiver.kt b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/DirectBootReceiver.kt
index 4c382dc..5b76c50 100644
--- a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/DirectBootReceiver.kt
+++ b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/DirectBootReceiver.kt
@@ -27,4 +27,4 @@
// accessible yet.
println("request a workmanager: ${WorkManager.getInstance(context)}")
}
-}
\ No newline at end of file
+}
diff --git a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java
index ddc135e..3aeb022 100644
--- a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java
+++ b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/MainActivity.java
@@ -620,6 +620,8 @@
return new OneTimeWorkRequest.Builder(RemoteWorker.class)
.setInputData(data)
+ .setConstraints(new Constraints.Builder()
+ .setRequiredNetworkType(NetworkType.CONNECTED).build())
.build();
}
}
diff --git a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorker.kt b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorker.kt
index 51c604c..54944cb 100644
--- a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorker.kt
+++ b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorker.kt
@@ -59,7 +59,7 @@
val scope = CoroutineScope(Dispatchers.Default)
job = scope.launch {
for (i in 1..10) {
- delay(1000)
+ delay(10000)
progress = workDataOf(Progress to i * 10)
setForegroundAsync(getForegroundInfo(NotificationId))
setProgressAsync(progress).await()
@@ -75,6 +75,7 @@
}
override fun onStopped() {
+ super.onStopped()
job?.cancel()
}
diff --git a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorkerService2.kt b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorkerService2.kt
index 256bc17..cbca8fd 100644
--- a/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorkerService2.kt
+++ b/work/integration-tests/testapp/src/main/java/androidx/work/integration/testapp/RemoteWorkerService2.kt
@@ -18,4 +18,4 @@
import androidx.work.multiprocess.RemoteWorkerService
-class RemoteWorkerService2 : RemoteWorkerService()
\ No newline at end of file
+class RemoteWorkerService2 : RemoteWorkerService()
diff --git a/work/work-benchmark/src/androidTest/java/androidx/work/benchmark/NoOpWorker.kt b/work/work-benchmark/src/androidTest/java/androidx/work/benchmark/NoOpWorker.kt
index 760ffd9..40dfe8b 100644
--- a/work/work-benchmark/src/androidTest/java/androidx/work/benchmark/NoOpWorker.kt
+++ b/work/work-benchmark/src/androidTest/java/androidx/work/benchmark/NoOpWorker.kt
@@ -28,4 +28,4 @@
override suspend fun doWork(): Result {
return Result.success()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/ConstraintsTest.kt b/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/ConstraintsTest.kt
index a0edc00..4ae532f 100644
--- a/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/ConstraintsTest.kt
+++ b/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/ConstraintsTest.kt
@@ -76,4 +76,4 @@
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.build()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/UserInitiatedTaskRequestTest.kt b/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/UserInitiatedTaskRequestTest.kt
index 73fe646..8b2f117 100644
--- a/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/UserInitiatedTaskRequestTest.kt
+++ b/work/work-datatransfer/src/androidTest/java/androidx/work/datatransfer/UserInitiatedTaskRequestTest.kt
@@ -117,4 +117,4 @@
// test stub
}
}
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/Constraints.kt b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/Constraints.kt
index 2603e0d..481fc38 100644
--- a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/Constraints.kt
+++ b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/Constraints.kt
@@ -60,4 +60,4 @@
return NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.build()
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/TransferInfo.kt b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/TransferInfo.kt
index 91d8cdb..7aa0a35 100644
--- a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/TransferInfo.kt
+++ b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/TransferInfo.kt
@@ -44,4 +44,4 @@
result = 31 * result + (estimatedDownloadBytes xor (estimatedDownloadBytes ushr 32)).toInt()
return result
}
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTask.kt b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTask.kt
index 1c9741d..140aa15 100644
--- a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTask.kt
+++ b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTask.kt
@@ -46,4 +46,4 @@
* - [JobParameters.STOP_REASON_USER]
*/
abstract suspend fun performTask()
-}
\ No newline at end of file
+}
diff --git a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTaskRequest.kt b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTaskRequest.kt
index 994d469..7fe650b 100644
--- a/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTaskRequest.kt
+++ b/work/work-datatransfer/src/main/java/androidx/work/datatransfer/UserInitiatedTaskRequest.kt
@@ -99,4 +99,4 @@
*/
TASK_STATE_FINISHED,
}
-}
\ No newline at end of file
+}
diff --git a/work/work-inspection/src/androidTest/java/androidx/work/inspection/DispatchingExecutor.kt b/work/work-inspection/src/androidTest/java/androidx/work/inspection/DispatchingExecutor.kt
index 68643032..741a4e3 100644
--- a/work/work-inspection/src/androidTest/java/androidx/work/inspection/DispatchingExecutor.kt
+++ b/work/work-inspection/src/androidTest/java/androidx/work/inspection/DispatchingExecutor.kt
@@ -41,4 +41,4 @@
job.join()
}
}
-}
\ No newline at end of file
+}
diff --git a/work/work-inspection/src/androidTest/java/androidx/work/inspection/worker/IdleWorker.kt b/work/work-inspection/src/androidTest/java/androidx/work/inspection/worker/IdleWorker.kt
index c4ba239..b607f18 100644
--- a/work/work-inspection/src/androidTest/java/androidx/work/inspection/worker/IdleWorker.kt
+++ b/work/work-inspection/src/androidTest/java/androidx/work/inspection/worker/IdleWorker.kt
@@ -35,4 +35,4 @@
}
return Result.success()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-multiprocess/build.gradle b/work/work-multiprocess/build.gradle
index 94c4112..d671988 100644
--- a/work/work-multiprocess/build.gradle
+++ b/work/work-multiprocess/build.gradle
@@ -23,6 +23,9 @@
}
android {
+ defaultConfig {
+ multiDexEnabled = true
+ }
buildTypes.all {
consumerProguardFiles "proguard-rules.pro"
}
@@ -30,22 +33,20 @@
}
dependencies {
- api project(":work:work-runtime-ktx")
+ api project(":work:work-runtime")
api(libs.kotlinStdlib)
api(libs.kotlinCoroutinesAndroid)
api(libs.guavaListenableFuture)
implementation("androidx.core:core:1.9.0")
implementation("androidx.room:room-runtime:2.5.0")
- androidTestImplementation(libs.kotlinStdlib)
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.testCore)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.espressoCore)
androidTestImplementation(libs.mockitoCore, excludes.bytebuddy) // DexMaker has its own MockMaker
androidTestImplementation(libs.dexmakerMockito, excludes.bytebuddy) // DexMaker has its own MockMaker
- androidTestImplementation(project(":internal-testutils-runtime"))
- testImplementation(libs.kotlinStdlib)
- testImplementation(libs.junit)
+ androidTestImplementation(libs.truth)
+ androidTestImplementation(libs.multidex)
}
androidx {
diff --git a/work/work-multiprocess/src/androidTest/AndroidManifest.xml b/work/work-multiprocess/src/androidTest/AndroidManifest.xml
index e49600c..733b8f7 100644
--- a/work/work-multiprocess/src/androidTest/AndroidManifest.xml
+++ b/work/work-multiprocess/src/androidTest/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
- <application>
+ <application android:name="androidx.multidex.MultiDexApplication">
<service android:name="androidx.work.multiprocess.RemoteWorkerService" />
</application>
diff --git a/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/ParcelableInterruptRequestTest.kt b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/ParcelableInterruptRequestTest.kt
new file mode 100644
index 0000000..76eae3e
--- /dev/null
+++ b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/ParcelableInterruptRequestTest.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.work.multiprocess
+
+import android.app.job.JobParameters.STOP_REASON_CONSTRAINT_CHARGING
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import androidx.work.multiprocess.parcelable.ParcelConverters
+import androidx.work.multiprocess.parcelable.ParcelableInterruptRequest
+import com.google.common.truth.Truth
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class ParcelableInterruptRequestTest {
+
+ @Test
+ fun testInterruptRequest() {
+ val request = ParcelableInterruptRequest("id1", STOP_REASON_CONSTRAINT_CHARGING)
+ val parcelled = ParcelConverters.unmarshall(
+ ParcelConverters.marshall(request),
+ ParcelableInterruptRequest.CREATOR
+ )
+ Truth.assertThat(parcelled).isEqualTo(request)
+ }
+}
diff --git a/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/RemoteListenableWorkerTest.kt b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/RemoteListenableWorkerTest.kt
index 5871f12..7d8ffee 100644
--- a/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/RemoteListenableWorkerTest.kt
+++ b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/RemoteListenableWorkerTest.kt
@@ -16,6 +16,8 @@
package androidx.work.multiprocess
+import android.annotation.SuppressLint
+import android.app.job.JobParameters.STOP_REASON_CONSTRAINT_CONNECTIVITY
import android.content.Context
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -36,10 +38,15 @@
import androidx.work.impl.WorkerWrapper
import androidx.work.impl.foreground.ForegroundProcessor
import androidx.work.impl.utils.SerialExecutorImpl
+import androidx.work.impl.utils.futures.SettableFuture
import androidx.work.impl.utils.taskexecutor.TaskExecutor
import androidx.work.multiprocess.RemoteListenableWorker.ARGUMENT_CLASS_NAME
import androidx.work.multiprocess.RemoteListenableWorker.ARGUMENT_PACKAGE_NAME
+import com.google.common.util.concurrent.ListenableFuture
import java.util.concurrent.Executor
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.withTimeoutOrNull
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Before
@@ -57,6 +64,7 @@
private lateinit var mForegroundProcessor: ForegroundProcessor
private lateinit var mWorkManager: WorkManagerImpl
private lateinit var mExecutor: Executor
+ private val workerFactory = TrackingRemoteWorkerFactory()
// Necessary for the reified function
public lateinit var mContext: Context
@@ -76,6 +84,7 @@
mConfiguration = Configuration.Builder()
.setExecutor(mExecutor)
.setTaskExecutor(mExecutor)
+ .setWorkerFactory(workerFactory)
.build()
mTaskExecutor = mock(TaskExecutor::class.java)
`when`(mTaskExecutor.serialTaskExecutor).thenReturn(SerialExecutorImpl(mExecutor))
@@ -149,6 +158,25 @@
@Test
@MediumTest
+ public fun testRemoteStopWorker() = runBlocking {
+ if (Build.VERSION.SDK_INT <= 27) {
+ // Exclude <= API 27, from tests because it causes a SIGSEGV.
+ return@runBlocking
+ }
+
+ val request = buildRequest<RemoteStopWorker>()
+ val wrapper = buildWrapper(request)
+ wrapper.run()
+ val remote = workerFactory.awaitRemote(request.id) as RemoteStopWorker
+ remote.startRemoteDeferred.await()
+ wrapper.interrupt(STOP_REASON_CONSTRAINT_CONNECTIVITY)
+ val reason = withTimeoutOrNull(2000) { remote.stopDeferred.await() }
+ ?: throw AssertionError("Stop wasn't called")
+ assertEquals(STOP_REASON_CONSTRAINT_CONNECTIVITY, reason)
+ }
+
+ @Test
+ @MediumTest
public fun testUnbindService_successWorker() {
if (Build.VERSION.SDK_INT <= 27) {
// Exclude <= API 27, from tests because it causes a SIGSEGV.
@@ -223,3 +251,24 @@
assertNull(worker.mClient.connection)
}
}
+
+public class RemoteStopWorker(
+ context: Context,
+ parameters: WorkerParameters
+) : RemoteListenableWorker(context, parameters) {
+
+ val startRemoteDeferred = CompletableDeferred<Unit>()
+ val stopDeferred = CompletableDeferred<Int>()
+
+ override fun startRemoteWork(): ListenableFuture<Result> {
+ startRemoteDeferred.complete(Unit)
+ return SettableFuture.create()
+ }
+
+ // in this context stop reason doesn't make difference
+ @SuppressLint("NewApi")
+ override fun onStopped() {
+ super.onStopped()
+ stopDeferred.complete(stopReason)
+ }
+}
diff --git a/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/TrackingRemoteWorkerFactory.kt b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/TrackingRemoteWorkerFactory.kt
new file mode 100644
index 0000000..90ac5a7
--- /dev/null
+++ b/work/work-multiprocess/src/androidTest/java/androidx/work/multiprocess/TrackingRemoteWorkerFactory.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.work.multiprocess
+
+import android.content.Context
+import androidx.work.ListenableWorker
+import androidx.work.WorkerFactory
+import androidx.work.WorkerParameters
+import java.util.UUID
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.filterNotNull
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.map
+
+class TrackingRemoteWorkerFactory : WorkerFactory() {
+ private val factory = object : WorkerFactory() {
+ override fun createWorker(
+ appContext: Context,
+ workerClassName: String,
+ workerParameters: WorkerParameters
+ ): ListenableWorker? = null
+ }
+ val createdWorkers = MutableStateFlow<Map<UUID, Workers>>(emptyMap())
+
+ override fun createWorker(
+ appContext: Context,
+ workerClassName: String,
+ workerParameters: WorkerParameters
+ ): ListenableWorker {
+ return factory.createWorkerWithDefaultFallback(
+ appContext,
+ workerClassName,
+ workerParameters
+ )!!.also {
+ val oldWorkers = createdWorkers.value[it.id]
+ val workers = if (oldWorkers == null)
+ Workers(localProxy = it)
+ else
+ Workers(oldWorkers.localProxy, it)
+
+ createdWorkers.value = createdWorkers.value + (it.id to workers)
+ }
+ }
+
+ suspend fun awaitRemote(id: UUID): ListenableWorker =
+ createdWorkers.map { it[id]?.remote }.filterNotNull().first()
+
+ data class Workers(val localProxy: ListenableWorker, val remote: ListenableWorker? = null)
+}
diff --git a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableCallback.java b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableCallback.java
index 5f78eb7..ed49d93 100644
--- a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableCallback.java
+++ b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableCallback.java
@@ -100,7 +100,7 @@
/**
* Dispatches failures callbacks safely.
- **/
+ */
public static void reportFailure(
@NonNull IWorkManagerImplCallback callback,
@NonNull Throwable throwable) {
diff --git a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableWorkerImpl.java b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableWorkerImpl.java
index 975626d..77ab200 100644
--- a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableWorkerImpl.java
+++ b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/ListenableWorkerImpl.java
@@ -29,9 +29,9 @@
import androidx.work.Logger;
import androidx.work.ProgressUpdater;
import androidx.work.WorkerParameters;
-import androidx.work.impl.utils.futures.SettableFuture;
import androidx.work.impl.utils.taskexecutor.TaskExecutor;
import androidx.work.multiprocess.parcelable.ParcelConverters;
+import androidx.work.multiprocess.parcelable.ParcelableInterruptRequest;
import androidx.work.multiprocess.parcelable.ParcelableRemoteWorkRequest;
import androidx.work.multiprocess.parcelable.ParcelableResult;
import androidx.work.multiprocess.parcelable.ParcelableWorkerParameters;
@@ -50,7 +50,7 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class ListenableWorkerImpl extends IListenableWorkerImpl.Stub {
// Synthetic access
- static final String TAG = Logger.tagWithPrefix("ListenableWorkerImpl");
+ static final String TAG = Logger.tagWithPrefix("WM-RemoteWorker ListenableWorkerImpl");
// Synthetic access
static byte[] sEMPTY = new byte[0];
// Synthetic access
@@ -67,7 +67,7 @@
// Synthetic access
final ForegroundUpdater mForegroundUpdater;
// Synthetic access
- final Map<String, ListenableFuture<ListenableWorker.Result>> mFutureMap;
+ final Map<String, RemoteWorkerWrapper> mRemoteWorkerWrapperMap;
ListenableWorkerImpl(@NonNull Context context) {
mContext = context.getApplicationContext();
@@ -76,7 +76,7 @@
mTaskExecutor = remoteInfo.getTaskExecutor();
mProgressUpdater = remoteInfo.getProgressUpdater();
mForegroundUpdater = remoteInfo.getForegroundUpdater();
- mFutureMap = new HashMap<>();
+ mRemoteWorkerWrapperMap = new HashMap<>();
}
@Override
@@ -122,7 +122,7 @@
reportFailure(callback, cancellationException);
} finally {
synchronized (sLock) {
- mFutureMap.remove(id);
+ mRemoteWorkerWrapperMap.remove(id);
}
}
}
@@ -137,23 +137,21 @@
@NonNull final byte[] request,
@NonNull final IWorkManagerImplCallback callback) {
try {
- ParcelableWorkerParameters parcelableWorkerParameters =
- ParcelConverters.unmarshall(request, ParcelableWorkerParameters.CREATOR);
- final String id = parcelableWorkerParameters.getId().toString();
+ ParcelableInterruptRequest interruptRequest =
+ ParcelConverters.unmarshall(request, ParcelableInterruptRequest.CREATOR);
+ final String id = interruptRequest.getId();
+ final int stopReason = interruptRequest.getStopReason();
Logger.get().debug(TAG, "Interrupting work with id (" + id + ")");
- final ListenableFuture<ListenableWorker.Result> future;
+ final RemoteWorkerWrapper remoteWorker;
synchronized (sLock) {
- future = mFutureMap.remove(id);
+ remoteWorker = mRemoteWorkerWrapperMap.remove(id);
}
- if (future != null) {
+ if (remoteWorker != null) {
mTaskExecutor.getSerialTaskExecutor()
- .execute(new Runnable() {
- @Override
- public void run() {
- future.cancel(true);
- reportSuccess(callback, sEMPTY);
- }
+ .execute(() -> {
+ remoteWorker.interrupt(stopReason);
+ reportSuccess(callback, sEMPTY);
});
} else {
// Nothing to do.
@@ -170,39 +168,14 @@
@NonNull String workerClassName,
@NonNull WorkerParameters workerParameters) {
- final SettableFuture<ListenableWorker.Result> future = SettableFuture.create();
- Logger.get().debug(TAG, "Tracking execution of " + id + " (" + workerClassName + ")");
+ RemoteWorkerWrapper remoteWorker = RemoteWorkerWrapperKt.create(
+ mContext, mConfiguration, workerClassName, workerParameters, mTaskExecutor
+ );
synchronized (sLock) {
- mFutureMap.put(id, future);
+ mRemoteWorkerWrapperMap.put(id, remoteWorker);
}
- mTaskExecutor.getMainThreadExecutor().execute(() -> {
- try {
- ListenableWorker worker = mConfiguration.getWorkerFactory()
- .createWorkerWithDefaultFallback(mContext, workerClassName,
- workerParameters);
- if (worker == null) {
- String message = "Unable to create an instance of " + workerClassName;
- Logger.get().error(TAG, message);
- future.setException(new IllegalStateException(message));
- return;
- }
- if (!(worker instanceof RemoteListenableWorker)) {
- String message = workerClassName + " does not extend "
- + RemoteListenableWorker.class.getName();
- Logger.get().error(TAG, message);
- future.setException(new IllegalStateException(message));
- return;
- }
-
- RemoteListenableWorker remoteListenableWorker = (RemoteListenableWorker) worker;
- future.setFuture(remoteListenableWorker.startRemoteWork());
- } catch (Throwable throwable) {
- future.setException(throwable);
- }
- });
-
- return future;
+ return remoteWorker.getFuture();
}
}
diff --git a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteListenableWorker.java b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteListenableWorker.java
index bdae59a..16d1eed 100644
--- a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteListenableWorker.java
+++ b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteListenableWorker.java
@@ -16,11 +16,13 @@
package androidx.work.multiprocess;
+import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.os.RemoteException;
import android.text.TextUtils;
+import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.util.Function;
@@ -32,9 +34,9 @@
import androidx.work.impl.model.WorkSpec;
import androidx.work.impl.utils.futures.SettableFuture;
import androidx.work.multiprocess.parcelable.ParcelConverters;
+import androidx.work.multiprocess.parcelable.ParcelableInterruptRequest;
import androidx.work.multiprocess.parcelable.ParcelableRemoteWorkRequest;
import androidx.work.multiprocess.parcelable.ParcelableResult;
-import androidx.work.multiprocess.parcelable.ParcelableWorkerParameters;
import com.google.common.util.concurrent.ListenableFuture;
@@ -180,24 +182,22 @@
/**
* {@inheritDoc}
*/
+ @SuppressLint("NewApi")
@Override
+ @CallSuper
@SuppressWarnings("FutureReturnValueIgnored")
public void onStopped() {
super.onStopped();
+ int stopReason = getStopReason();
// Delegate interruptions to the remote process.
if (mComponentName != null) {
mClient.execute(mComponentName,
- new RemoteDispatcher<IListenableWorkerImpl>() {
- @Override
- public void execute(
- @NonNull IListenableWorkerImpl listenableWorkerImpl,
- @NonNull IWorkManagerImplCallback callback)
- throws RemoteException {
- ParcelableWorkerParameters parcelableWorkerParameters =
- new ParcelableWorkerParameters(mWorkerParameters);
- byte[] request = ParcelConverters.marshall(parcelableWorkerParameters);
- listenableWorkerImpl.interrupt(request, callback);
- }
+ (listenableWorkerImpl, callback) -> {
+ ParcelableInterruptRequest interruptRequest =
+ new ParcelableInterruptRequest(
+ mWorkerParameters.getId().toString(), stopReason);
+ byte[] request = ParcelConverters.marshall(interruptRequest);
+ listenableWorkerImpl.interrupt(request, callback);
});
}
}
diff --git a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteWorkerWrapper.kt b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteWorkerWrapper.kt
new file mode 100644
index 0000000..0697869
--- /dev/null
+++ b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/RemoteWorkerWrapper.kt
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.work.multiprocess
+
+import android.content.Context
+import androidx.work.Configuration
+import androidx.work.ListenableWorker
+import androidx.work.Logger
+import androidx.work.WorkInfo
+import androidx.work.WorkerParameters
+import androidx.work.impl.utils.futures.SettableFuture
+import androidx.work.impl.utils.taskexecutor.TaskExecutor
+import com.google.common.util.concurrent.ListenableFuture
+import java.util.concurrent.CancellationException
+import java.util.concurrent.atomic.AtomicInteger
+
+internal class RemoteWorkerWrapper(val future: ListenableFuture<ListenableWorker.Result>) {
+ internal val stopReason = AtomicInteger(WorkInfo.STOP_REASON_NOT_STOPPED)
+
+ fun interrupt(stopReason: Int) {
+ this.stopReason.set(stopReason)
+ future.cancel(true)
+ }
+}
+
+@JvmName("create")
+internal fun RemoteWorkerWrapper(
+ context: Context,
+ configuration: Configuration,
+ workerClassName: String,
+ workerParameters: WorkerParameters,
+ taskExecutor: TaskExecutor,
+): RemoteWorkerWrapper {
+ val future = SettableFuture.create<ListenableWorker.Result>()
+ val wrapper = RemoteWorkerWrapper(future)
+
+ taskExecutor.mainThreadExecutor.execute {
+ try {
+ if (future.isCancelled) return@execute
+ val worker = configuration.workerFactory
+ .createWorkerWithDefaultFallback(context, workerClassName, workerParameters)
+ if (worker == null) {
+ val message = "Unable to create an instance of $workerClassName"
+ Logger.get().error(ListenableWorkerImpl.TAG, message)
+ future.setException(IllegalStateException(message))
+ return@execute
+ }
+ if (worker !is RemoteListenableWorker) {
+ val message = "$workerClassName does not extend " +
+ RemoteListenableWorker::class.java.name
+ Logger.get().error(ListenableWorkerImpl.TAG, message)
+ future.setException(IllegalStateException(message))
+ return@execute
+ }
+ future.addListener({
+ try {
+ future.get()
+ } catch (e: CancellationException) {
+ worker.stop(wrapper.stopReason.get())
+ } catch (_: Throwable) {
+ // Here we handle only cancellations.
+ // Other exceptions are handled through over channels
+ }
+ }, taskExecutor.serialTaskExecutor)
+ future.setFuture(worker.startRemoteWork())
+ } catch (throwable: Throwable) {
+ future.setException(throwable)
+ }
+ }
+ return wrapper
+}
diff --git a/work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableInterruptRequest.kt b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableInterruptRequest.kt
new file mode 100644
index 0000000..bf8fa0c
--- /dev/null
+++ b/work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableInterruptRequest.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.work.multiprocess.parcelable
+
+import android.annotation.SuppressLint
+import android.os.Parcel
+import android.os.Parcelable
+import androidx.annotation.RestrictTo
+
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@SuppressLint("BanParcelableUsage")
+data class ParcelableInterruptRequest(val id: String, val stopReason: Int) : Parcelable {
+
+ internal constructor(parcel: Parcel) : this(parcel.readString()!!, parcel.readInt())
+
+ companion object {
+ @JvmField
+ val CREATOR = object : Parcelable.Creator<ParcelableInterruptRequest> {
+ override fun createFromParcel(parcel: Parcel): ParcelableInterruptRequest {
+ return ParcelableInterruptRequest(parcel)
+ }
+
+ override fun newArray(size: Int): Array<ParcelableInterruptRequest?> {
+ return arrayOfNulls(size)
+ }
+ }
+ }
+
+ override fun describeContents(): Int = 0
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeString(id)
+ parcel.writeInt(stopReason)
+ }
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/ContentUriTriggerWorkersTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/ContentUriTriggerWorkersTest.kt
index 35f3978..0b6b40d 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/ContentUriTriggerWorkersTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/ContentUriTriggerWorkersTest.kt
@@ -105,4 +105,4 @@
}
override fun hasLimitedSchedulingSlots() = true
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/CoroutineWorkerTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/CoroutineWorkerTest.kt
index 7d3bdbc..b01fe14 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/CoroutineWorkerTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/CoroutineWorkerTest.kt
@@ -262,4 +262,4 @@
progressUpdater,
mForegroundUpdater
)
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/StopReasonTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/StopReasonTest.kt
index e0b8abc..bda7fa7 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/StopReasonTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/StopReasonTest.kt
@@ -111,4 +111,4 @@
assertThat(workInfo.state).isEqualTo(WorkInfo.State.CANCELLED)
assertThat(workInfo.stopReason).isEqualTo(WorkInfo.STOP_REASON_NOT_STOPPED)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/WorkInfoFlowsTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/WorkInfoFlowsTest.kt
index 1d2b7d7..d274179 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/WorkInfoFlowsTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/WorkInfoFlowsTest.kt
@@ -145,4 +145,4 @@
assertThat(secondList.size).isEqualTo(2)
assertThat(secondList.map { it.id }).containsExactly(request1.id, request2.id)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/ProcessorTests.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/ProcessorTests.kt
index 4f5ed11..1f17847 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/ProcessorTests.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/ProcessorTests.kt
@@ -150,6 +150,7 @@
firstWorker.countDown()
blockedThread.shutdown()
assertTrue(blockedThread.awaitTermination(3, TimeUnit.SECONDS))
+ assertTrue(context.intents.isEmpty())
}
@Test
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkContinuationImplTestKt.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkContinuationImplTestKt.kt
index 45c8b78..4f79d7e 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkContinuationImplTestKt.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkContinuationImplTestKt.kt
@@ -77,4 +77,4 @@
val intArray = info.outputData.getIntArray(intTag)!!.sortedArray()
assertThat(intArray).isEqualTo(intArrayOf(1, 3))
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
index 882d802..90981fc 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
@@ -2091,6 +2091,13 @@
eq(PackageManager.DONT_KILL_APP));
reset(packageManager);
+
+ // Scheduling work involved enabling RescheduleReceiver.class.
+ // Mark the component state as enabled (so we can check for disablement).
+ // This is necessary because we are using a PackageManager mock here.
+ when(packageManager.getComponentEnabledSetting(eq(componentName)))
+ .thenReturn(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+
mWorkManagerImpl.cancelWorkById(stopAwareWorkRequest.getId())
.getResult()
.get();
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerInitializationTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerInitializationTest.kt
index ee46004..3078798 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerInitializationTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerInitializationTest.kt
@@ -61,4 +61,4 @@
override fun isDeviceProtectedStorage() = deviceProtectedStorage
override fun getApplicationContext() = this
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTestKt.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTestKt.kt
index 0565d6c..c6bd5c0 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTestKt.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTestKt.kt
@@ -144,4 +144,4 @@
doWork.complete(Unit)
return result.await()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/background/WorkManagerImplTestKt.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/background/WorkManagerImplTestKt.kt
index 1fd0a4bf..702d26d 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/background/WorkManagerImplTestKt.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/background/WorkManagerImplTestKt.kt
@@ -77,4 +77,4 @@
secondValueLatch.await()
assertThat(secondCancelAll).isEqualTo(50)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/WorkConstraintsTrackerTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/WorkConstraintsTrackerTest.kt
index 48ff014..0a8dac5 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/WorkConstraintsTrackerTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/WorkConstraintsTrackerTest.kt
@@ -134,4 +134,4 @@
): WorkConstraintsTracker {
val controllers = trackers.map { TestConstraintController(it, TEST_WORKSPEC_IDS) }
return WorkConstraintsTracker(controllers)
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/controllers/ConstraintControllerTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/controllers/ConstraintControllerTest.kt
index f514d4a..35fd295 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/controllers/ConstraintControllerTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/constraints/controllers/ConstraintControllerTest.kt
@@ -111,4 +111,4 @@
private val ConstraintsNotMet: ConstraintsNotMet = ConstraintsNotMet(
StopReason(STOP_REASON_CONSTRAINT_DEVICE_IDLE)
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestConstraints.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestConstraints.kt
index e7050c9..a452673 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestConstraints.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestConstraints.kt
@@ -65,4 +65,4 @@
val ConstraintsNotMet = ConstraintsState.ConstraintsNotMet(StopReason.ConstraintTest)
val StopReason.Companion.ConstraintTest
- get() = StopReason(234234234)
\ No newline at end of file
+ get() = StopReason(234234234)
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestOverrideClock.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestOverrideClock.kt
index 5a43269..0405bd1 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestOverrideClock.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TestOverrideClock.kt
@@ -30,4 +30,4 @@
return if (currentTimeMillis == Long.MAX_VALUE) System.currentTimeMillis()
else currentTimeMillis
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TrackingWorkerFactory.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TrackingWorkerFactory.kt
index b541a24..ff18431 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TrackingWorkerFactory.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/testutils/TrackingWorkerFactory.kt
@@ -56,4 +56,4 @@
suspend fun await(id: UUID): ListenableWorker {
return createdWorkers.map { it[id] }.filterNotNull().first()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/utils/SerialExecutorTest.kt b/work/work-runtime/src/androidTest/java/androidx/work/impl/utils/SerialExecutorTest.kt
index 814e22f..adf7c5c 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/utils/SerialExecutorTest.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/utils/SerialExecutorTest.kt
@@ -73,4 +73,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/testutils/FlowTester.kt b/work/work-runtime/src/androidTest/java/androidx/work/testutils/FlowTester.kt
index 9c5c203..f2eafe6 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/testutils/FlowTester.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/testutils/FlowTester.kt
@@ -57,4 +57,4 @@
fun launch(scope: CoroutineScope) {
flow.onEach { channel.send(it) }.launchIn(scope)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/testutils/TestEnv.kt b/work/work-runtime/src/androidTest/java/androidx/work/testutils/TestEnv.kt
index 15288f2..2b138c8 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/testutils/TestEnv.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/testutils/TestEnv.kt
@@ -52,4 +52,4 @@
fun WorkManager(env: TestEnv, schedulers: List<Scheduler>, trackers: Trackers) = WorkManagerImpl(
env.context, env.configuration, env.taskExecutor, env.db, schedulers,
env.processor, trackers
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/worker/CompletableWorker.kt b/work/work-runtime/src/androidTest/java/androidx/work/worker/CompletableWorker.kt
index 39577a9..5809434 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/worker/CompletableWorker.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/worker/CompletableWorker.kt
@@ -27,4 +27,4 @@
) : CoroutineWorker(appContext, params) {
val result = CompletableDeferred<Result>()
override suspend fun doWork() = result.await()
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/worker/ProgressUpdatingWorker.kt b/work/work-runtime/src/androidTest/java/androidx/work/worker/ProgressUpdatingWorker.kt
index 2cd3acb..977be7d 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/worker/ProgressUpdatingWorker.kt
+++ b/work/work-runtime/src/androidTest/java/androidx/work/worker/ProgressUpdatingWorker.kt
@@ -44,4 +44,4 @@
else -> Result.success()
}
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/ArrayCreatingInputMerger.kt b/work/work-runtime/src/main/java/androidx/work/ArrayCreatingInputMerger.kt
index 5435ca2..aa4bb47 100644
--- a/work/work-runtime/src/main/java/androidx/work/ArrayCreatingInputMerger.kt
+++ b/work/work-runtime/src/main/java/androidx/work/ArrayCreatingInputMerger.kt
@@ -102,4 +102,4 @@
Array.set(newArray, 0, obj)
return newArray
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/BackoffPolicy.kt b/work/work-runtime/src/main/java/androidx/work/BackoffPolicy.kt
index e0539b6..541a6f9 100644
--- a/work/work-runtime/src/main/java/androidx/work/BackoffPolicy.kt
+++ b/work/work-runtime/src/main/java/androidx/work/BackoffPolicy.kt
@@ -30,4 +30,4 @@
* Used to indicate that [WorkManager] should increase the backoff time linearly
*/
LINEAR
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/Configuration.kt b/work/work-runtime/src/main/java/androidx/work/Configuration.kt
index 744e2c5..086d706 100644
--- a/work/work-runtime/src/main/java/androidx/work/Configuration.kt
+++ b/work/work-runtime/src/main/java/androidx/work/Configuration.kt
@@ -475,4 +475,4 @@
max(2, min(Runtime.getRuntime().availableProcessors() - 1, 4)),
factory
)
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/DirectExecutor.kt b/work/work-runtime/src/main/java/androidx/work/DirectExecutor.kt
index 0fcc520..9a4c7d3 100644
--- a/work/work-runtime/src/main/java/androidx/work/DirectExecutor.kt
+++ b/work/work-runtime/src/main/java/androidx/work/DirectExecutor.kt
@@ -34,4 +34,4 @@
override fun toString(): String {
return "DirectExecutor"
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/ExistingPeriodicWorkPolicy.kt b/work/work-runtime/src/main/java/androidx/work/ExistingPeriodicWorkPolicy.kt
index 7d8f83b..b0efb8c 100644
--- a/work/work-runtime/src/main/java/androidx/work/ExistingPeriodicWorkPolicy.kt
+++ b/work/work-runtime/src/main/java/androidx/work/ExistingPeriodicWorkPolicy.kt
@@ -70,4 +70,4 @@
* is unclear.
*/
CANCEL_AND_REENQUEUE,
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/ExistingWorkPolicy.kt b/work/work-runtime/src/main/java/androidx/work/ExistingWorkPolicy.kt
index 455c0d5..5eeaf77 100644
--- a/work/work-runtime/src/main/java/androidx/work/ExistingWorkPolicy.kt
+++ b/work/work-runtime/src/main/java/androidx/work/ExistingWorkPolicy.kt
@@ -52,4 +52,4 @@
* *dropped* and the newly-specified work is the start of a new sequence.
*/
APPEND_OR_REPLACE
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/InputMerger.kt b/work/work-runtime/src/main/java/androidx/work/InputMerger.kt
index 5296a96..3a8adcc 100644
--- a/work/work-runtime/src/main/java/androidx/work/InputMerger.kt
+++ b/work/work-runtime/src/main/java/androidx/work/InputMerger.kt
@@ -48,4 +48,4 @@
Logger.get().error(TAG, "Trouble instantiating $className", e)
}
return null
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/InputMergerFactory.kt b/work/work-runtime/src/main/java/androidx/work/InputMergerFactory.kt
index da1b3db..d86f57d 100644
--- a/work/work-runtime/src/main/java/androidx/work/InputMergerFactory.kt
+++ b/work/work-runtime/src/main/java/androidx/work/InputMergerFactory.kt
@@ -59,4 +59,4 @@
internal object NoOpInputMergerFactory : InputMergerFactory() {
override fun createInputMerger(className: String) = null
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/NetworkType.kt b/work/work-runtime/src/main/java/androidx/work/NetworkType.kt
index ac00245..acec19d 100644
--- a/work/work-runtime/src/main/java/androidx/work/NetworkType.kt
+++ b/work/work-runtime/src/main/java/androidx/work/NetworkType.kt
@@ -56,4 +56,4 @@
*/
@RequiresApi(30)
TEMPORARILY_UNMETERED
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/OneTimeWorkRequest.kt b/work/work-runtime/src/main/java/androidx/work/OneTimeWorkRequest.kt
index bb4f998..37c4559 100644
--- a/work/work-runtime/src/main/java/androidx/work/OneTimeWorkRequest.kt
+++ b/work/work-runtime/src/main/java/androidx/work/OneTimeWorkRequest.kt
@@ -23,7 +23,7 @@
* A [WorkRequest] for non-repeating work.
*
* OneTimeWorkRequests can be put in simple or complex graphs of work by using methods like
- * [WorkManager.beginWith] or [WorkManager.beginWith].
+ * [WorkManager.enqueue] or [WorkManager.beginWith].
*/
class OneTimeWorkRequest internal constructor(builder: Builder) :
WorkRequest(builder.id, builder.workSpec, builder.tags) {
diff --git a/work/work-runtime/src/main/java/androidx/work/OutOfQuotaPolicy.kt b/work/work-runtime/src/main/java/androidx/work/OutOfQuotaPolicy.kt
index 0d8747a..497052d 100644
--- a/work/work-runtime/src/main/java/androidx/work/OutOfQuotaPolicy.kt
+++ b/work/work-runtime/src/main/java/androidx/work/OutOfQuotaPolicy.kt
@@ -30,4 +30,4 @@
* be dropped and no work requests are enqueued.
*/
DROP_WORK_REQUEST
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/OverwritingInputMerger.kt b/work/work-runtime/src/main/java/androidx/work/OverwritingInputMerger.kt
index f55c782..5c4bd8a 100644
--- a/work/work-runtime/src/main/java/androidx/work/OverwritingInputMerger.kt
+++ b/work/work-runtime/src/main/java/androidx/work/OverwritingInputMerger.kt
@@ -31,4 +31,4 @@
output.putAll(mergedValues)
return output.build()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/StopReason.kt b/work/work-runtime/src/main/java/androidx/work/StopReason.kt
index d382aab..f7629b7 100644
--- a/work/work-runtime/src/main/java/androidx/work/StopReason.kt
+++ b/work/work-runtime/src/main/java/androidx/work/StopReason.kt
@@ -32,4 +32,4 @@
val ConstraintStorageNotLow = StopReason(STOP_REASON_CONSTRAINT_STORAGE_NOT_LOW)
val Unknown = StopReason(WorkInfo.STOP_REASON_UNKNOWN)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/WorkInfo.kt b/work/work-runtime/src/main/java/androidx/work/WorkInfo.kt
index 66cc236..95a2c52 100644
--- a/work/work-runtime/src/main/java/androidx/work/WorkInfo.kt
+++ b/work/work-runtime/src/main/java/androidx/work/WorkInfo.kt
@@ -268,4 +268,4 @@
*/
const val STOP_REASON_UNKNOWN = -512
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/WorkManager.java b/work/work-runtime/src/main/java/androidx/work/WorkManager.java
index ddfb9ade..bd3213b 100644
--- a/work/work-runtime/src/main/java/androidx/work/WorkManager.java
+++ b/work/work-runtime/src/main/java/androidx/work/WorkManager.java
@@ -120,8 +120,7 @@
* uniquely-identifiable name (see
* {@link #beginUniqueWork(String, ExistingWorkPolicy, OneTimeWorkRequest)}).
* <p>
- * <a name="initializing"></a>
- * <b>Initializing WorkManager</b>
+ * <h3 id="initializing">Initializing WorkManager</h3>
* <p>
* By default, WorkManager auto-initializes itself using a built-in {@code ContentProvider}.
* ContentProviders are created and run before the {@code Application} object, so this allows the
@@ -130,8 +129,7 @@
* {@link Configuration.Provider} or
* {@link WorkManager#initialize(android.content.Context, androidx.work.Configuration)}.
* <p>
- * <a name="worker_class_names"></a>
- * <b>Renaming and Removing ListenableWorker Classes</b>
+ * <h3 id="worker_class_names">Renaming and Removing ListenableWorker Classes</h3>
* <p>
* Exercise caution in renaming classes derived from {@link ListenableWorker}s. WorkManager stores
* the class name in its internal database when the {@link WorkRequest} is enqueued so it can later
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 8232cf1a8..d2bc7a7 100644
--- a/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt
+++ b/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt
@@ -352,4 +352,4 @@
@SuppressLint("MinMaxConstant")
const val MIN_BACKOFF_MILLIS = 10 * 1000L // 10 seconds.
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/Processor.java b/work/work-runtime/src/main/java/androidx/work/impl/Processor.java
index 9ca4242..104e4c6 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/Processor.java
+++ b/work/work-runtime/src/main/java/androidx/work/impl/Processor.java
@@ -416,11 +416,14 @@
@Nullable
private WorkerWrapper cleanUpWorkerUnsafe(@NonNull String id) {
WorkerWrapper wrapper = mForegroundWorkMap.remove(id);
- if (wrapper == null) {
+ boolean wasForeground = wrapper != null;
+ if (!wasForeground) {
wrapper = mEnqueuedWorkMap.remove(id);
}
mWorkRuns.remove(id);
- stopForegroundService();
+ if (wasForeground) {
+ stopForegroundService();
+ }
return wrapper;
}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/StartStopToken.kt b/work/work-runtime/src/main/java/androidx/work/impl/StartStopToken.kt
index f9c4245..4849958 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/StartStopToken.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/StartStopToken.kt
@@ -61,4 +61,4 @@
fun tokenFor(spec: WorkSpec) = tokenFor(spec.generationalId())
fun remove(spec: WorkSpec) = remove(spec.generationalId())
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/WorkDatabasePathHelper.kt b/work/work-runtime/src/main/java/androidx/work/impl/WorkDatabasePathHelper.kt
index 32db40c..2295959 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/WorkDatabasePathHelper.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/WorkDatabasePathHelper.kt
@@ -122,4 +122,4 @@
fun getNoBackupFilesDir(context: Context): File {
return context.noBackupFilesDir
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/WorkLauncher.kt b/work/work-runtime/src/main/java/androidx/work/impl/WorkLauncher.kt
index 07d09eb..51509e1 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/WorkLauncher.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/WorkLauncher.kt
@@ -63,4 +63,4 @@
StopWorkRunnable(processor, workSpecId, false, reason)
)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/WorkManagerImplExt.kt b/work/work-runtime/src/main/java/androidx/work/impl/WorkManagerImplExt.kt
index 36456f2..d99874f 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/WorkManagerImplExt.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/WorkManagerImplExt.kt
@@ -89,4 +89,4 @@
WorkLauncherImpl(processor, workTaskExecutor),
workTaskExecutor
),
- )
\ No newline at end of file
+ )
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/WorkerUpdater.kt b/work/work-runtime/src/main/java/androidx/work/impl/WorkerUpdater.kt
index 0461ddb..501160c 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/WorkerUpdater.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/WorkerUpdater.kt
@@ -167,4 +167,4 @@
private fun OperationImpl.failWorkTypeChanged(message: String) = markState(
FAILURE(UnsupportedOperationException(message))
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/constraints/NetworkState.kt b/work/work-runtime/src/main/java/androidx/work/impl/constraints/NetworkState.kt
index a74d3ce..74e27a2 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/constraints/NetworkState.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/constraints/NetworkState.kt
@@ -38,4 +38,4 @@
* Determines if the network is not roaming.
*/
val isNotRoaming: Boolean
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/constraints/controllers/ContraintControllers.kt b/work/work-runtime/src/main/java/androidx/work/impl/constraints/controllers/ContraintControllers.kt
index 0308c47..4d87576 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/constraints/controllers/ContraintControllers.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/constraints/controllers/ContraintControllers.kt
@@ -187,4 +187,4 @@
companion object {
private val TAG = Logger.tagWithPrefix("NetworkMeteredCtrlr")
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.kt b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.kt
index e3ff321..a86c311 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/BatteryNotLowTracker.kt
@@ -78,4 +78,4 @@
/**
* {@see https://android.googlesource.com/platform/frameworks/base/+/oreo-release/core/res/res/values/config.xml#986}
*/
-internal const val BATTERY_LOW_THRESHOLD = 0.15f
\ No newline at end of file
+internal const val BATTERY_LOW_THRESHOLD = 0.15f
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.kt b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.kt
index b5e78c2..609fcc6 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.kt
@@ -161,4 +161,4 @@
Logger.get().error(TAG, "Received exception while unregistering network callback", e)
}
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/Trackers.kt b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/Trackers.kt
index 6c0757d..fb42e4d 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/Trackers.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/constraints/trackers/Trackers.kt
@@ -52,4 +52,4 @@
*/
val storageNotLowTracker: ConstraintTracker<Boolean> =
StorageNotLowTracker(context.applicationContext, taskExecutor),
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/Dependency.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/Dependency.kt
index 6bfda90..4b20b80 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/Dependency.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/Dependency.kt
@@ -48,4 +48,4 @@
val workSpecId: String,
@ColumnInfo(name = "prerequisite_id")
val prerequisiteId: String
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/DependencyDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/DependencyDao.kt
index d77d3d4..852f4bb 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/DependencyDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/DependencyDao.kt
@@ -72,4 +72,4 @@
*/
@Query("SELECT COUNT(*)>0 FROM dependency WHERE prerequisite_id=:id")
fun hasDependents(id: String): Boolean
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/Preference.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/Preference.kt
index 05279a7..06bf8b2 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/Preference.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/Preference.kt
@@ -32,4 +32,4 @@
val value: Long?
) {
constructor(key: String, value: Boolean) : this(key, if (value) 1L else 0L)
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/PreferenceDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/PreferenceDao.kt
index 6f2b405..a5db03d 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/PreferenceDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/PreferenceDao.kt
@@ -52,4 +52,4 @@
*/
@Query("SELECT long_value FROM Preference where `key`=:key")
fun getObservableLongValue(key: String): LiveData<Long?>
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/RawWorkInfoDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/RawWorkInfoDao.kt
index 47d39d9..eeab965 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/RawWorkInfoDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/RawWorkInfoDao.kt
@@ -57,4 +57,4 @@
fun RawWorkInfoDao.getWorkInfoPojosFlow(
dispatcher: CoroutineDispatcher,
query: SupportSQLiteQuery
-): Flow<List<WorkInfo>> = getWorkInfoPojosFlow(query).dedup(dispatcher)
\ No newline at end of file
+): Flow<List<WorkInfo>> = getWorkInfoPojosFlow(query).dedup(dispatcher)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfo.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfo.kt
index 1a34f1a..3dbe942 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfo.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfo.kt
@@ -49,4 +49,4 @@
)
fun systemIdInfo(generationalId: WorkGenerationalId, systemId: Int) =
- SystemIdInfo(generationalId.workSpecId, generationalId.generation, systemId)
\ No newline at end of file
+ SystemIdInfo(generationalId.workSpecId, generationalId.generation, systemId)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfoDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfoDao.kt
index b07aeca..fb23d89 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfoDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/SystemIdInfoDao.kt
@@ -67,4 +67,4 @@
*/
@Query("SELECT DISTINCT work_spec_id FROM SystemIdInfo")
fun getWorkSpecIds(): List<String>
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkName.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkName.kt
index c2f4dac..b9d286d 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkName.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkName.kt
@@ -42,4 +42,4 @@
val name: String,
@ColumnInfo(name = "work_spec_id")
val workSpecId: String
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkNameDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkNameDao.kt
index ab329c2..01b137c9f 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkNameDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkNameDao.kt
@@ -48,4 +48,4 @@
*/
@Query("SELECT name FROM workname WHERE work_spec_id=:workSpecId")
fun getNamesForWorkSpecId(workSpecId: String): List<String>
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgress.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgress.kt
index a0489b3..9cf3df14 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgress.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgress.kt
@@ -42,4 +42,4 @@
val workSpecId: String,
@ColumnInfo(name = "progress")
val progress: Data
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgressDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgressDao.kt
index c550f55..2a9f9aa 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgressDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkProgressDao.kt
@@ -57,4 +57,4 @@
*/
@Query("SELECT progress FROM WorkProgress WHERE work_spec_id=:workSpecId")
fun getProgressForWorkSpecId(workSpecId: String): Data?
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkSpec.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkSpec.kt
index abd004b..2ed1d4d 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkSpec.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkSpec.kt
@@ -538,4 +538,4 @@
data class WorkGenerationalId(val workSpecId: String, val generation: Int)
-fun WorkSpec.generationalId() = WorkGenerationalId(id, generation)
\ No newline at end of file
+fun WorkSpec.generationalId() = WorkGenerationalId(id, generation)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTag.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTag.kt
index 2be613b..0e43eec 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTag.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTag.kt
@@ -42,4 +42,4 @@
val tag: String,
@ColumnInfo(name = "work_spec_id")
val workSpecId: String
-)
\ No newline at end of file
+)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTagDao.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTagDao.kt
index 2828c61f..6bcdc88 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTagDao.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTagDao.kt
@@ -63,4 +63,4 @@
fun insertTags(id: String, tags: Set<String>) {
tags.forEach { tag -> insert(WorkTag(tag, id)) }
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
index 9e3be24..c588d016 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
@@ -279,4 +279,4 @@
}
return triggers
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/DurationApi26.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/DurationApi26.kt
index fd30e8c..df7c3d9 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/DurationApi26.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/DurationApi26.kt
@@ -24,4 +24,4 @@
@DoNotInline
internal fun Duration.toMillisCompat(): Long {
return this.toMillis()
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi23.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi23.kt
index ad91ac2..a7efae1 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi23.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi23.kt
@@ -23,4 +23,4 @@
import androidx.annotation.RequiresApi
@DoNotInline
-fun ConnectivityManager.getActiveNetworkCompat() = activeNetwork
\ No newline at end of file
+fun ConnectivityManager.getActiveNetworkCompat() = activeNetwork
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi24.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi24.kt
index 6150d44..8e27226 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi24.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/NetworkApi24.kt
@@ -25,4 +25,4 @@
@DoNotInline
fun ConnectivityManager.registerDefaultNetworkCallbackCompat(
networkCallback: ConnectivityManager.NetworkCallback
-) = registerDefaultNetworkCallback(networkCallback)
\ No newline at end of file
+) = registerDefaultNetworkCallback(networkCallback)
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/PackageManagerHelper.java b/work/work-runtime/src/main/java/androidx/work/impl/utils/PackageManagerHelper.java
index f0534d5..3708813 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/PackageManagerHelper.java
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/PackageManagerHelper.java
@@ -36,7 +36,7 @@
* Uses {@link PackageManager} to enable/disable a manifest-defined component
*
* @param context {@link Context}
- * @param klazz The class of component
+ * @param klazz The class of component
* @param enabled {@code true} if component should be enabled
*/
public static void setComponentEnabled(
@@ -44,6 +44,14 @@
@NonNull Class<?> klazz,
boolean enabled) {
try {
+ boolean current = isComponentEnabled(
+ getComponentEnabledSetting(context, klazz.getName()), false);
+
+ if (enabled == current) {
+ Logger.get().debug(TAG, "Skipping component enablement for " + klazz.getName());
+ return;
+ }
+
PackageManager packageManager = context.getPackageManager();
ComponentName componentName = new ComponentName(context, klazz.getName());
packageManager.setComponentEnabledSetting(componentName,
@@ -63,23 +71,48 @@
/**
* Convenience method for {@link #isComponentExplicitlyEnabled(Context, String)}
*/
- public static boolean isComponentExplicitlyEnabled(@NonNull Context context,
+ public static boolean isComponentExplicitlyEnabled(
+ @NonNull Context context,
@NonNull Class<?> klazz) {
- return isComponentExplicitlyEnabled(context, klazz.getName());
+ int setting = getComponentEnabledSetting(context, klazz.getName());
+ return isComponentEnabled(setting, false);
}
/**
* Checks if a manifest-defined component is explicitly enabled
*
- * @param context {@link Context}
+ * @param context {@link Context}
* @param className {@link Class#getName()} name of component
* @return {@code true} if component is explicitly enabled
*/
public static boolean isComponentExplicitlyEnabled(@NonNull Context context,
@NonNull String className) {
+ int state = getComponentEnabledSetting(context, className);
+ return state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+ }
+
+ /**
+ * Retrieves the component enabled setting from {@link PackageManager}.
+ */
+ private static int getComponentEnabledSetting(
+ @NonNull Context context,
+ @NonNull String className) {
PackageManager packageManager = context.getPackageManager();
ComponentName componentName = new ComponentName(context, className);
- int state = packageManager.getComponentEnabledSetting(componentName);
- return state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+ return packageManager.getComponentEnabledSetting(componentName);
+ }
+
+ private static boolean isComponentEnabled(
+ int setting,
+ boolean defaults) {
+ if (setting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
+ return defaults;
+ }
+ // Simplifying the expression here, given the linter is extremely unhappy.
+ // Treating the below cases as enabled == false
+ // COMPONENT_ENABLED_STATE_DISABLED
+ // COMPONENT_ENABLED_STATE_DISABLED_USER
+ // COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
+ return setting == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
}
}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/RawQueries.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/RawQueries.kt
index 79d6ab1..baeb2c6 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/RawQueries.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/RawQueries.kt
@@ -69,4 +69,4 @@
return
}
builder.append((List(count) { "?" }.joinToString(",")))
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/StartWorkRunnable.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/StartWorkRunnable.kt
index 55734d1..58e8038 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/StartWorkRunnable.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/StartWorkRunnable.kt
@@ -33,4 +33,4 @@
override fun run() {
processor.startWork(startStopToken, runtimeExtras)
}
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/utils/WakeLocks.kt b/work/work-runtime/src/main/java/androidx/work/impl/utils/WakeLocks.kt
index 169ccf1..7163da9 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/utils/WakeLocks.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/utils/WakeLocks.kt
@@ -69,4 +69,4 @@
private object WakeLocksHolder {
val wakeLocks = WeakHashMap<PowerManager.WakeLock, String>()
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/main/java/androidx/work/impl/workers/CombineContinuationsWorker.kt b/work/work-runtime/src/main/java/androidx/work/impl/workers/CombineContinuationsWorker.kt
index 484da27..4aff2ab 100644
--- a/work/work-runtime/src/main/java/androidx/work/impl/workers/CombineContinuationsWorker.kt
+++ b/work/work-runtime/src/main/java/androidx/work/impl/workers/CombineContinuationsWorker.kt
@@ -27,4 +27,4 @@
workerParams: WorkerParameters
) : Worker(context, workerParams) {
override fun doWork() = Result.success(inputData)
-}
\ No newline at end of file
+}
diff --git a/work/work-runtime/src/test/java/androidx/work/WorkInfoTest.kt b/work/work-runtime/src/test/java/androidx/work/WorkInfoTest.kt
index 45adbaf..4b87fcd 100644
--- a/work/work-runtime/src/test/java/androidx/work/WorkInfoTest.kt
+++ b/work/work-runtime/src/test/java/androidx/work/WorkInfoTest.kt
@@ -64,4 +64,4 @@
)
assertThat(info1 == info2).isFalse()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerRealExecutorTest.kt b/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerRealExecutorTest.kt
index db35c0e..2089353 100644
--- a/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerRealExecutorTest.kt
+++ b/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerRealExecutorTest.kt
@@ -248,4 +248,4 @@
executor.execute(DrainTask(executor))
latch.await()
}
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerTest.java b/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerTest.java
index cd27900..5bfd76e 100644
--- a/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerTest.java
+++ b/work/work-testing/src/androidTest/java/androidx/work/testing/TestSchedulerTest.java
@@ -44,7 +44,6 @@
import androidx.work.testing.workers.TestWorker;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -78,7 +77,6 @@
CountingTestWorker.COUNT.set(0);
}
- @Ignore // b/281720148
@Test
public void testWorker_shouldSucceedSynchronously()
throws InterruptedException, ExecutionException {
diff --git a/work/work-testing/src/androidTest/java/androidx/work/testing/workers/RetryWorker.kt b/work/work-testing/src/androidTest/java/androidx/work/testing/workers/RetryWorker.kt
index 0f7485d..8dcf298 100644
--- a/work/work-testing/src/androidTest/java/androidx/work/testing/workers/RetryWorker.kt
+++ b/work/work-testing/src/androidTest/java/androidx/work/testing/workers/RetryWorker.kt
@@ -32,4 +32,4 @@
else future.set(Result.success())
return future
}
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/main/java/androidx/work/testing/SynchronousSerialExecutor.kt b/work/work-testing/src/main/java/androidx/work/testing/SynchronousSerialExecutor.kt
index 0b128f4..0eb0083 100644
--- a/work/work-testing/src/main/java/androidx/work/testing/SynchronousSerialExecutor.kt
+++ b/work/work-testing/src/main/java/androidx/work/testing/SynchronousSerialExecutor.kt
@@ -46,4 +46,4 @@
override fun hasPendingTasks(): Boolean {
return synchronized(lock) { tasks.isNotEmpty() }
}
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/main/java/androidx/work/testing/TestClock.kt b/work/work-testing/src/main/java/androidx/work/testing/TestClock.kt
index 182b49d..83f6e54 100644
--- a/work/work-testing/src/main/java/androidx/work/testing/TestClock.kt
+++ b/work/work-testing/src/main/java/androidx/work/testing/TestClock.kt
@@ -29,4 +29,4 @@
override fun currentTimeMillis(): Long {
return timeMillis
}
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/main/java/androidx/work/testing/TestScheduler.kt b/work/work-testing/src/main/java/androidx/work/testing/TestScheduler.kt
index f871ce7..f279227 100644
--- a/work/work-testing/src/main/java/androidx/work/testing/TestScheduler.kt
+++ b/work/work-testing/src/main/java/androidx/work/testing/TestScheduler.kt
@@ -259,4 +259,4 @@
}
return dao.getWorkSpec(id)
?: throw IllegalStateException("WorkSpec is already deleted from WM's db")
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.kt b/work/work-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.kt
index 06e7dde..b873e10 100644
--- a/work/work-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.kt
+++ b/work/work-testing/src/main/java/androidx/work/testing/TestWorkManagerImpl.kt
@@ -106,4 +106,4 @@
executorsMode
)
)
-}
\ No newline at end of file
+}
diff --git a/work/work-testing/src/test/java/androidx/work/testing/SynchronousSerialExecutorTest.kt b/work/work-testing/src/test/java/androidx/work/testing/SynchronousSerialExecutorTest.kt
index e282e2a6..a3f926c 100644
--- a/work/work-testing/src/test/java/androidx/work/testing/SynchronousSerialExecutorTest.kt
+++ b/work/work-testing/src/test/java/androidx/work/testing/SynchronousSerialExecutorTest.kt
@@ -52,4 +52,4 @@
}
assertThat(executed).isTrue()
}
-}
\ No newline at end of file
+}