Fixed
Status Update
Comments
ia...@gmail.com <ia...@gmail.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 9fe209b0b6489fc3eba5be3c646beaf0efe8ed7e
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Aug 25 11:55:49 2020
Remove observers when unregistering ActivityResult
Currently, if you register an ActivityResult using a LifecycleOwner and
then go through process death, we add an Observer to fire the registered
callback once the lifecycle goes to STARTED. In the case of
unregistering, we should make sure to remove any observers that may have
been added.
Test: Added ActivityResultRegistryTest#testLifecycleOwnerCallbackUnregistered
Bug: 165608393
Change-Id: If81142b1a6abc72b105986a2460e4aeb96e29eaf
M activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt
M activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistry.java
https://android-review.googlesource.com/1410730
Branch: androidx-master-dev
commit 9fe209b0b6489fc3eba5be3c646beaf0efe8ed7e
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Aug 25 11:55:49 2020
Remove observers when unregistering ActivityResult
Currently, if you register an ActivityResult using a LifecycleOwner and
then go through process death, we add an Observer to fire the registered
callback once the lifecycle goes to STARTED. In the case of
unregistering, we should make sure to remove any observers that may have
been added.
Test: Added ActivityResultRegistryTest#testLifecycleOwnerCallbackUnregistered
Bug: 165608393
Change-Id: If81142b1a6abc72b105986a2460e4aeb96e29eaf
M activity/activity/src/androidTest/java/androidx/activity/result/ActivityResultRegistryTest.kt
M activity/activity/src/main/java/androidx/activity/result/ActivityResultRegistry.java
yb...@google.com <yb...@google.com>
yb...@google.com <yb...@google.com> #3
This has been fixed internally and will be available in the next release of Fragments.
yb...@google.com <yb...@google.com> #4
back to p2 since the most pressing part is fixed.
ia...@gmail.com <ia...@gmail.com> #5
As I understand it, any non-Room suspending method in the middle of a transaction will still break since you might resume the coroutine on a different thread?
I think I'd personally really like an extension method of:
fun RoomDatabase.transaction(body: suspend () -> Unit)
that replaces / obsoletes runInTransaction and would be safe to do both Room suspend methods and other, non-Room suspend methods, always returning to the correct thread for the transaction.
I think I'd personally really like an extension method of:
fun RoomDatabase.transaction(body: suspend () -> Unit)
that replaces / obsoletes runInTransaction and would be safe to do both Room suspend methods and other, non-Room suspend methods, always returning to the correct thread for the transaction.
yb...@google.com <yb...@google.com> #6
yea the issue w/ suspending room version is that we need to make sure we can carry over the transaction information so that it can go to the right thread and only it (not some other parallel task).
This is why we need a proper transaction abstraction to safely do these jumps (or at least thats what i thnk we'll need, maybe not)
This is why we need a proper transaction abstraction to safely do these jumps (or at least thats what i thnk we'll need, maybe not)
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 69961b4ef143d82f50c3a7fd3969826d51a0ee25
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Jan 31 12:57:58 2019
Room Suspending Transaction
Create an API for performing database transaction with coroutines. When
starting a transaction coroutine a thread of the database query executor
is hold for performing all database operations within the coroutine. It
is recommended that all DAO functions invoked are also suspend
functions. In the case they are blocking DAO methods, then invoking
those on a different context other than the transaction context will
throw an exception, preventing possible deadlocks.
Bug: 120854786
Test: ./gradlew room:room-compiler:test
room:integration-tests:room-testapp-kotlin:cC
room:integration-tests:room-testapp:cC
Change-Id: I30f76db29a3882968f43e1dd1c1038b5afd7f299
M room/compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/InstantQueryResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
M room/compiler/src/test/data/daoWriter/output/ComplexDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/WriterDao.java
M room/coroutines/api/2.1.0-alpha05.txt
M room/coroutines/api/current.txt
M room/coroutines/build.gradle
M room/coroutines/src/main/java/androidx/room/CoroutinesRoom.kt
A room/coroutines/src/main/java/androidx/room/RoomDatabase.kt
M room/integration-tests/kotlintestapp/build.gradle
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
M room/runtime/api/restricted_2.1.0-alpha05.txt
M room/runtime/api/restricted_current.txt
M room/runtime/src/main/java/androidx/room/RoomDatabase.java
https://android-review.googlesource.com/891674
https://goto.google.com/android-sha1/69961b4ef143d82f50c3a7fd3969826d51a0ee25
Branch: androidx-master-dev
commit 69961b4ef143d82f50c3a7fd3969826d51a0ee25
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Jan 31 12:57:58 2019
Room Suspending Transaction
Create an API for performing database transaction with coroutines. When
starting a transaction coroutine a thread of the database query executor
is hold for performing all database operations within the coroutine. It
is recommended that all DAO functions invoked are also suspend
functions. In the case they are blocking DAO methods, then invoking
those on a different context other than the transaction context will
throw an exception, preventing possible deadlocks.
Bug: 120854786
Test: ./gradlew room:room-compiler:test
room:integration-tests:room-testapp-kotlin:cC
room:integration-tests:room-testapp:cC
Change-Id: I30f76db29a3882968f43e1dd1c1038b5afd7f299
M room/compiler/src/main/kotlin/androidx/room/solver/prepared/binder/InstantPreparedQueryResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/InstantQueryResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
M room/compiler/src/test/data/daoWriter/output/ComplexDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/WriterDao.java
M room/coroutines/api/2.1.0-alpha05.txt
M room/coroutines/api/current.txt
M room/coroutines/build.gradle
M room/coroutines/src/main/java/androidx/room/CoroutinesRoom.kt
A room/coroutines/src/main/java/androidx/room/RoomDatabase.kt
M room/integration-tests/kotlintestapp/build.gradle
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
M room/runtime/api/restricted_2.1.0-alpha05.txt
M room/runtime/api/restricted_current.txt
M room/runtime/src/main/java/androidx/room/RoomDatabase.java
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit f0f9ed8db13fbeb028391af00b626e19a0f2746e
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Feb 11 14:35:55 2019
Deprecate RoomDatabase transaction methods.
Deprecate beginTransaction, setTransactionSuccessful and endTransaction,
in favor of runInTransaction. Deprecating these methods discourage
users from using them within coroutines.
Bug: 120854786
Test: ./gradlew room:room-compiler:test
room:integration-tests:room-testapp-kotlin:cC
room:integration-tests:room-testapp:cC
Change-Id: Idc1bb04555fdba78eb1142b3ba461b87e6b06a69
M room/compiler/src/main/kotlin/androidx/room/writer/ClassWriter.kt
M room/compiler/src/test/data/daoWriter/output/ComplexDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/WriterDao.java
M room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
M room/compiler/src/test/kotlin/androidx/room/writer/EntityCursorConverterWriterTest.kt
M room/coroutines/src/main/java/androidx/room/RoomDatabase.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/MigrationKotlinTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/FtsMigrationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/paging/DataSourceFactoryTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/ForeignKeyTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultiInstanceInvalidationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/QueryTransactionTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2Test.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2WithInstantTaskExecutorTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/WriteAheadLoggingTest.java
M room/runtime/api/2.1.0-alpha05.txt
M room/runtime/api/current.txt
M room/runtime/src/main/java/androidx/room/RoomDatabase.java
M room/runtime/src/main/java/androidx/room/paging/LimitOffsetDataSource.java
https://android-review.googlesource.com/900916
https://goto.google.com/android-sha1/f0f9ed8db13fbeb028391af00b626e19a0f2746e
Branch: androidx-master-dev
commit f0f9ed8db13fbeb028391af00b626e19a0f2746e
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Feb 11 14:35:55 2019
Deprecate RoomDatabase transaction methods.
Deprecate beginTransaction, setTransactionSuccessful and endTransaction,
in favor of runInTransaction. Deprecating these methods discourage
users from using them within coroutines.
Bug: 120854786
Test: ./gradlew room:room-compiler:test
room:integration-tests:room-testapp-kotlin:cC
room:integration-tests:room-testapp:cC
Change-Id: Idc1bb04555fdba78eb1142b3ba461b87e6b06a69
M room/compiler/src/main/kotlin/androidx/room/writer/ClassWriter.kt
M room/compiler/src/test/data/daoWriter/output/ComplexDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/WriterDao.java
M room/compiler/src/test/data/databasewriter/output/ComplexDatabase.java
M room/compiler/src/test/kotlin/androidx/room/writer/EntityCursorConverterWriterTest.kt
M room/coroutines/src/main/java/androidx/room/RoomDatabase.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/migration/MigrationKotlinTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/FtsMigrationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/migration/MigrationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/paging/DataSourceFactoryTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/ForeignKeyTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultiInstanceInvalidationTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/QueryTransactionTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2Test.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/RxJava2WithInstantTaskExecutorTest.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/WriteAheadLoggingTest.java
M room/runtime/api/2.1.0-alpha05.txt
M room/runtime/api/current.txt
M room/runtime/src/main/java/androidx/room/RoomDatabase.java
M room/runtime/src/main/java/androidx/room/paging/LimitOffsetDataSource.java
Description
withContext(Dispatchers.Default) {
db.beginTransaction()
db.insert(data) // DAO suspend function
db.update(anotherData) // DAO suspend function
db.setTransactionSuccessful()
db.endTransaction()
}
This can deadlock because transaction are exclusive and are ThreadLocal, meaning once a transaction is started in a thread form the default dispatcher, another coroutine dispatcher thread will get blocked even if we are within the same coroutine.