Fixed
Status Update
Comments
cc...@google.com <cc...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
cc...@google.com <cc...@google.com> #3
yea i'll take it.
cc...@google.com <cc...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
ap...@google.com <ap...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
Trivial hot startup test (
TrivialStartupBenchmark#startup[startup=WARM,compilation=None]
)Launch itself takes approx 45ms.
waitOnPackageLaunch() takes > 5.5 seconds. Of that, more than 4.5 seconds is spent waiting for the app to actually launch (that is, time elapsed before the
launching: <packagename>
trace section).It looks like the wait finishes several hundred millis later, due to UiAutomator polling every 1 second. The gap at the end of the trace is an intentional sleep, to ensure trace content isn't lost (400ms).