Status Update
Comments
jb...@google.com <jb...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
st...@gmail.com <st...@gmail.com> #3
st...@gmail.com <st...@gmail.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
ti...@google.com <ti...@google.com> #5
Jeremy, could you help triage this please?
jb...@google.com <jb...@google.com> #6
I took another look at this and Navigation has all of the right information so I am thinking it is a SeekableTransition + SharedElement interaction. On the cancellation, NavHost
correctly calls AnimatedContent
finish after that, NavHost settles to the correct target state
I assumed that as long as the beta04
correctly got the SeekableTransitionState
to the correct target state then shared elements would be in the correct state as well. Does that need to be handled separately somehow? And if that is the case, could it be that this is part of animateTo
handle cancelation?
ti...@google.com <ti...@google.com> #7
Shared elements are not special animations from the perspective of Transition
.
Not sure if this has been fixed with George's recent fixes for SeekableTransition. George, could you help take a look please?
mo...@google.com <mo...@google.com> #8
I can reproduce this on tip-of-tree.
mo...@google.com <mo...@google.com> #9
Oscar and I discovered that the problem is in SharedTransitionScope
os...@google.com <os...@google.com>
st...@gmail.com <st...@gmail.com> #10
This is marked as fixed, however I just tested with the exact same repro project on snapshot 12176588 which is the current latest as of right now as I am typing this. What was fixed here, and how was it verified? Perhaps it would help to re-run the repro project I've submitted here on tip-of-tree to see that the broken behavior remains?
The repro project is here
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
App()
}
}
}
@Serializable
object A
@Serializable
object B
@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
private fun App() {
val navController = rememberNavController()
SharedTransitionLayout {
Surface(modifier = Modifier.fillMaxSize()) {
NavHost(
navController,
A::class,
modifier = Modifier.fillMaxSize(),
) {
composable<A> {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column {
Text("A: ${LocalLifecycleOwner.current.lifecycle.currentStateAsState()}")
Button({ navController.navigate(B) }) { Text("Go to B") }
SharedBox( this@composable)
}
}
}
composable<B> {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column {
SharedBox( this@composable)
Text("B: ${LocalLifecycleOwner.current.lifecycle.currentStateAsState()}")
Button(dropUnlessResumed { navController.navigate(A) }) { Text("Go to A") }
}
}
}
}
}
}
}
@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
fun SharedTransitionScope.SharedBox(
animatedVisibilityScope: AnimatedVisibilityScope,
modifier: Modifier = Modifier,
) {
Box(
modifier
.sharedElement(
rememberSharedContentState("SharedBox"),
animatedVisibilityScope,
)
.size(200.dp)
.background(Color.Red)
)
}
And the repro steps are shown in this newly attached video.
It's important to have it run on an Android version which does have predictive back support to experience the bug. I ran this on API level 35 for this video.
Could this be re-opened, or would you like me to open a new issue? What can I do to help you here?
os...@google.com <os...@google.com> #11
The fix is on the animation library, not the navigation library. Make sure to update that dependency from the snapshot. (androidx.compose:animation:animation)
st...@gmail.com <st...@gmail.com> #12
Hey, thanks a lot for the reply.
Can I safely assume that this dependency is androidx.compose.animation:animation
or even perhaps androidx.compose.animation:animation-android
?
The repro project is using
And I can still reproduce this problem exactly as the video shows. What else could I be doing wrong? Is the fix in the latest snapshots or released on the latest animation betas btw? Perhaps I should try the latest beta release instead?
os...@google.com <os...@google.com> #13
Sorry, my bad. It's not gonna be on the 1.7.0-SNAPSHOT.
Try
And then use compose = "1.8.0-SNAPSHOT"
I've locally confirmed it fixes the issue on Android 14, using predictive back.
os...@google.com <os...@google.com> #14
For reference, I changed these in your provided project.
libs.versions.toml:
[versions]
agp = "8.4.2"
kotlin = "2.0.0"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
lifecycleRuntimeKtx = "2.8.4"
activityCompose = "1.9.1"
composeBom = "2024.06.00"
material3 = "1.3.0-beta05"
kotlinx-serialization = "1.7.1"
navigation = "2.8.0-SNAPSHOT"
compose = "1.8.0-SNAPSHOT"
#navigation = "2.8.0-beta06"
#compose = "1.7.0-beta06"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics", version.ref = "compose" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "compose" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "compose" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest", version.ref = "compose" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "compose" }
androidx-compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "compose" }
androidx-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
androidx-navigation-common = { module = "androidx.navigation:navigation-common", version.ref = "navigation" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" }
androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "navigation" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
composeCompilerGradlePlugin = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
sttings.gradle.kts:
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven(url = "https://androidx.dev/snapshots/builds/12176908/artifacts/repository")
google()
mavenCentral()
}
}
rootProject.name = "predictive-navigation-repro"
include(":app")
os...@google.com <os...@google.com> #15
FWIW, we cherry-picked the fix for the next 1.7.0 release.
I think this page will get updated with details once it's released.
st...@gmail.com <st...@gmail.com> #16
Oh 1.8 snapshot, I did not actually know that this was available yet!
Hey by the way, I really appreciate your communication here, and even taking the effort to paste your changes to my project! I just tested myself too and this is indeed fixed as you said!
So since this was now cherry picked this will even be in the next 1.7 beta release, that's great news. Thanks for helping me out here!
pr...@google.com <pr...@google.com> #17
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.animation:animation:1.7.0-beta07
androidx.compose.animation:animation-android:1.7.0-beta07
androidx.compose.animation:animation-desktop:1.7.0-beta07
Description
Component used: Navigation Version used: 2.8.0-alpha05 through 2.8.0-beta03 and 2.8.0-SNAPSHOT Devices/Android versions reproduced on: Android 15 VanillaIceCream(AP31.240426.023.B4)
Repro project attached as a zip, there is a video showcasing the bug. The repo is also public herehere toohttps://github.com/StylianosGakis/navigation-predictive-back-breaking-shared-element if you prefer to check it out this way.
This may or may not be related to https://issuetracker.google.com/issues/346608857 since this also happens after predictive back starts and is cancelled.
Steps to reproduce:
My assumption here is that the AnimatedVisibilityScope is somehow not cleaned up properly resulting in this broken behavior. But that is just my assumption, the repro project should help you understand the real issue behind all this.