Fix "already registered" error
Root cause: Upon running into the method "UiAutomationManager.registerUiTestAutomationServiceLocked", after assigning "mUiAutomationService" with newly created object, the calling of "mUiAutomationService.onAdded()" may throw an exception which simply skipping the next code line "mUiAutomationService.mServiceInterface.asBinder().linkToDeath", which preventing it from getting notification when the "mServiceInterface" process dies, then, the "mUiAutomationService" will never have a chance to be clean-up-ed. And, next time, upon running into registerUiTestAutomationServiceLocked again, it has to complain "already registered". Solution: Move the line "mUiAutomationService.onAdded()" to after the line "linkToDeath", so that, the possible exception will not prohibit the linkToDeath operation. Bug: 192317057 Test: monkey test for one day and one night Co-authored-by: Zheng Xiaoying <zheng.xiaoying@gm.com> Signed-off-by: Jintao Zhu <zhujtcsieee@gmail.com> Change-Id: Ife4584804910290fac70dbe6d6934333f9a7486a
Loading
Please register or sign in to comment