Restoring starting capturing existing activity.

ag/24138143 made the rule to produce empty captures in many cases.

ag/24138143 aimed to fix a leak that was caused by a local var
alreadyOpenActivity still referring the activity when the leak check
executes.

Fixing that by moving the variable to a method startCapturingExistingActivity.

Bug: 291638593
Test: local, presubmit
Flag: N/A
Change-Id: I281202488c6c85e2e2c5b5b3300e26d808167104
This commit is contained in:
Vadim Tryshev
2023-07-24 10:37:52 -07:00
parent 6eb4af3f45
commit 101ea3e4e5
3 changed files with 17 additions and 3 deletions

View File

@@ -201,7 +201,8 @@ public abstract class AbstractLauncherUiTest {
}
protected TestRule getRulesInsideActivityMonitor() {
final ViewCaptureRule viewCaptureRule = new ViewCaptureRule();
final ViewCaptureRule viewCaptureRule = new ViewCaptureRule(
Launcher.ACTIVITY_TRACKER::getCreatedActivity);
final RuleChain inner = RuleChain
.outerRule(new PortraitLandscapeRunner(this))
.around(new FailureWatcher(mLauncher, viewCaptureRule::getViewCaptureData))