Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
pr...@google.com <pr...@google.com> #3
Is there any update on this issue? Is it fixed in latest version or it still exist?
ty...@gmail.com <ty...@gmail.com> #4
See example CL in androidx-main
and reworked since FragmentScenario
is now written in Kotlin.
dr...@gmail.com <dr...@gmail.com>
lb...@gmail.com <lb...@gmail.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit f2087040fd4cfef94d308a16d884deb75240f7dd
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Fri Jan 22 11:04:17 2021
[GH] Make FragmentScenario closeable
## Proposed Changes
- Make FragmentScenario closeable (See original CL: [aosp/1430179](https://android-review.googlesource.com/c/platform/frameworks/support/+/1430179/ ))
## Testing
Test: See JUnit test
## Issues Fixed
Fixes: 143774122
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/121 .
Resolves #121
Github-Pr-Head-Sha: 56209fab7315652cf548b6f0dd173a9b1de2a966
GitOrigin-RevId: f18f88ad0e56ca8bb35d4bedfc758e23af5c5d64
Change-Id: If207da9852d9245b7c639972508622210b0c247b
M fragment/fragment-testing/api/current.txt
M fragment/fragment-testing/api/public_plus_experimental_current.txt
M fragment/fragment-testing/api/restricted_current.txt
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioTest.kt
M fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt
https://android-review.googlesource.com/1556961
Branch: androidx-main
commit f2087040fd4cfef94d308a16d884deb75240f7dd
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Fri Jan 22 11:04:17 2021
[GH] Make FragmentScenario closeable
## Proposed Changes
- Make FragmentScenario closeable (See original CL: [aosp/1430179](
## Testing
Test: See JUnit test
## Issues Fixed
Fixes: 143774122
This is an imported pull request from
Resolves #121
Github-Pr-Head-Sha: 56209fab7315652cf548b6f0dd173a9b1de2a966
GitOrigin-RevId: f18f88ad0e56ca8bb35d4bedfc758e23af5c5d64
Change-Id: If207da9852d9245b7c639972508622210b0c247b
M fragment/fragment-testing/api/current.txt
M fragment/fragment-testing/api/public_plus_experimental_current.txt
M fragment/fragment-testing/api/restricted_current.txt
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioTest.kt
M fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt
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.