Loading
Use different context to unregisterComponentCallbacks in ViewCapture
This is required to accomadate the Launcher test suite's LeakDetector which runs in a test rule that finishes before the ViewCaptureRule does. This means that any context's which are stored inside ViewCapture's normal operation will trigger a leak detection, even if there isn't one in reality. The ViewCapture Test Rule accomadates this by deleting mRoot before the test is finished. We can piggyback off that essentially, and use mRoot's context to unregister the callback. This is guaranteed to work under normal usage, and also guaranteed to not through a memory leak detection false positive, since it will be nullified in the tests ahead of leak detection. Bug: 314132499 Test: Verified that post-submit didn't through a leak detection error message. Change-Id: I1df0dfda76f253e79b64559ce7b3111af1d37f67