Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
Makes sense, thanks for reporting this, I'll send a fix soon.
pr...@google.com <pr...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit ed9cc5573271288500a7f416520dc509d8047f0f
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Aug 08 13:41:08 2024
Use same visibility as expect declaration when generating RoomDatabaseConstructor
Bug: 358138953
Test: DatabaseObjectConstructorWriterKotlinCodeGenTest
Change-Id: I0b2bb1a590f48199e398f72ac2b881e1eceb571f
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseMigrationTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseObjectConstructorWriter.kt
M room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseObjectConstructorWriterKotlinCodeGenTest.kt
A room/room-compiler/src/test/test-data/kotlinCodeGen/actualDatabaseConstructor_internal.kt
https://android-review.googlesource.com/3213484
Branch: androidx-main
commit ed9cc5573271288500a7f416520dc509d8047f0f
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Aug 08 13:41:08 2024
Use same visibility as expect declaration when generating RoomDatabaseConstructor
Bug: 358138953
Test: DatabaseObjectConstructorWriterKotlinCodeGenTest
Change-Id: I0b2bb1a590f48199e398f72ac2b881e1eceb571f
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseMigrationTest.kt
M room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseObjectConstructorWriter.kt
M room/room-compiler/src/test/kotlin/androidx/room/writer/DatabaseObjectConstructorWriterKotlinCodeGenTest.kt
A room/room-compiler/src/test/test-data/kotlinCodeGen/actualDatabaseConstructor_internal.kt
ty...@gmail.com <ty...@gmail.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.room:room-compiler:2.7.0-alpha07
Description
Version used: 1.7.0
Devices/Android versions reproduced on: API 33
If this is a bug in the library, we would appreciate if you could attach:
Example project attached
Description:
It appears that ComponentActivity$ReportFullyDrawnExecutorApi16Impl.this$0 leaks memory when used in an ActivityScenario if the ActivityScenario is used to recreate the Activity soon after the Activity has been launched.
Reproduction steps:
1. Create an Activity that extends ComponentActivity
2. Set a content view for the Activity in the onCreate using either setContentView(View) or setContent { <Composable> }
3. Create an instrumented test that uses LeakCanary's DetectLeaksAfterTestSuccess Test Rule
4. In the test: Launch the Activity using ActivityScenario, and then call "recreate" on the ActivityScenario
5a. Expected result: The test launches the Activity, recreates it, and the test passes.
5b. Actual result: The test launches the Activity, recreates it, and then LeakCanary detects a memory leak from ComponentActivity$ReportFullyDrawnExecutorApi16Impl.this$0 leaking an instance of the Activity.
This issue does not occur for ComponentActivity instance that do not set a content view in onCreate, and does not occur for regular android.app.Activity instances.
I have attached an example project with eight instrumented tests that show case this issue. In the ExampleInstrumentedTest.kt tests `launchExampleViewActivityAndRecreate` and `launchExampleComposeActivityAndRecreate` both fail, and all other tests succeed. The expected behaviour is that all tests should pass.