Fixed
Status Update
Comments
su...@google.com <su...@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
Version used: 1.0.0-alpha12
Devices/Android versions reproduced on: Pixel 2 Emulator
Canceling work that is deeper in the chain (by tag) seems to cancel the work correctly, but it get enqueued again incorrectly.
DownloadCommentsWorker:
```
override fun doWork(): Result {
System.out.println("$this::class.java - Started")
Thread.sleep(Random.nextLong(5000))
System.out.println("$this::class.java - Done")
return Result.success()
}
```
FinalWorker:
```
override fun doWork(): Result {
System.out.println("ALL WORK COMPLETE")
return Result.success()
}
```
```
WorkManager.getInstance()
.beginUniqueWork("unique", ExistingWorkPolicy.KEEP, OneTimeWorkRequestBuilder<DownloadCommentsWorker>().build())
.then(OneTimeWorkRequestBuilder<FinalWorker>().addTag("finally").build())
.enqueue()
WorkManager.getInstance().getWorkInfosForUniqueWorkLiveData("unique").observe(this, workInfos -> {
for (WorkInfo info : workInfos) {
System.out.println(info.toString());
}
});
WorkManager.getInstance().cancelAllWorkByTag("finally").getState().observe(this, state -> {
System.out.println(state);
});
```
Console Output
```
2018-12-11 11:04:51.182 6991-6991/com.plangrid.android.devgrid I/System.out: SUCCESS
2018-12-11 11:04:51.184 6991-7056/com.plangrid.android.devgrid I/System.out: com.plangrid.android.workmanager.DownloadCommentsWorker@e5d859f::class.java - Started
2018-12-11 11:04:51.240 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='4eac7884-3374-494a-a549-fcd7505fc5b4', mState=CANCELLED, mOutputData=androidx.work.Data@0, mTags=[finally, com.plangrid.android.workmanager.FinalWorker]}
2018-12-11 11:04:51.240 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='c8e75590-8f60-40b7-a2e6-4e7aa6e7830d', mState=RUNNING, mOutputData=androidx.work.Data@0, mTags=[com.plangrid.android.workmanager.DownloadCommentsWorker]}
2018-12-11 11:04:54.488 6991-7056/com.plangrid.android.devgrid I/System.out: com.plangrid.android.workmanager.DownloadCommentsWorker@e5d859f::class.java - Done
2018-12-11 11:04:54.508 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='4eac7884-3374-494a-a549-fcd7505fc5b4', mState=ENQUEUED, mOutputData=androidx.work.Data@0, mTags=[finally, com.plangrid.android.workmanager.FinalWorker]}
2018-12-11 11:04:54.509 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='c8e75590-8f60-40b7-a2e6-4e7aa6e7830d', mState=SUCCEEDED, mOutputData=androidx.work.Data@0, mTags=[com.plangrid.android.workmanager.DownloadCommentsWorker]}
2018-12-11 11:04:54.518 6991-7057/com.plangrid.android.devgrid I/System.out: ALL WORK COMPLETE
2018-12-11 11:04:54.528 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='4eac7884-3374-494a-a549-fcd7505fc5b4', mState=SUCCEEDED, mOutputData=androidx.work.Data@0, mTags=[finally, com.plangrid.android.workmanager.FinalWorker]}
2018-12-11 11:04:54.528 6991-6991/com.plangrid.android.devgrid I/System.out: WorkInfo{mId='c8e75590-8f60-40b7-a2e6-4e7aa6e7830d', mState=SUCCEEDED, mOutputData=androidx.work.Data@0, mTags=[com.plangrid.android.workmanager.DownloadCommentsWorker]}
```