Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
ra...@google.com <ra...@google.com> #2
Project: platform/frameworks/support
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
https://android-review.googlesource.com/1123258
https://goto.google.com/android-sha1/b90079595f33f58fece04026a97faa0d243acdb1
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
Description
Context
Component used: work-runtime
Version used: 2.4.0 Alpha 3
Devices/Android versions reproduced on: Android 7
Description
When running a Worker with constraints that calls setForegroundAsync() on Android 7 (and potentially earlier) the foreground service is started but not stopped after the worker has completed execution.
On Android 8, 9, and 10, the foreground service is stopped as expected when the worker completes and the notification is removed.
The bug only occurs for workers that have constraints. If no constraints are set, the behavior on Android 7 is correct as well.
Sample project
Github projecthttps://github.com/otbinary/workmanager-foreground-worker contains a small sample app.
A foreground worker with a constraint (
setRequiresBatteryNotLow
) that sleeps for five seconds can be started by a broadcast intent:adb shell am broadcast -n com.github.otbinary.fgworker/.StartSleepingWorkerBroadcastReceiver
Observations
On Android 7,
WorkerWrapper.resolve()
is called only for aConstraintTrackingWorker
instance that is wrapped around the actualSleepingWorker
instance.ConstraintTrackingWorker.isRunInForeground()
isfalse
.resolve()
therefore does not callmForegroundProcessor.stopForeground()
.On Android 8+,
resolve()
is called for the actualSleepingWorker
instance whoseisRunInForeground()
returnstrue
.resolve()
callsmForegroundProcessor.stopForeground()
.