Set the mocked package manager only after stubbing in test
The test flake is an issue with unfinished mockito stubbing so presumably there is an async process ongoing and the package manager spy is being called during the stubbing. To address this, we've created the package manager spy later and made sure it's only set in the context after stubbing.
Note, the flake could not be reproduced (the failure rate is very low - previously 0.5% and currently 2%), so this fix isn't actually confirmed to address the issue.
Bug: 390832000
Test: AppSearchManagerServiceTest.java
Flag: TEST_ONLY
Change-Id: Iefaffb87ff275f8e7b1e7fdd5ea8ff185aa9f1e4
1 file changed