Fixed DefaultMockitoSession constructor.
It was not removing the UniversalTestListener when initmocks()
failed, which would cause subsequent tests to fail because they could
not start a new session.
To test it, run the following command in a pristine device running
Android TM (without an updated adservices apk) - a lot of tests will
fail due to missing classes and methods.
$ atest AdServicesServiceCoreUnitTests 2>&1 | tee ~/tmp/log.txt && grep "Unfinished mocking session" ~/tmp/log.txt | wc
Without this patch, it would return ~216 occurrences; with it, it's 0.
Test: manual verification (see above)
Bug: 322415729
Change-Id: I14ed7c032a974c3a65caaf091d36d9667ea331b6
Merged-In: I14ed7c032a974c3a65caaf091d36d9667ea331b6
(cherry picked from commit 2982d1e4951883dea75847910feedbb852a4a2b1 - AOSP/main)
2 files changed