Skip to content
Commit 08280849 authored by Jintao Zhu's avatar Jintao Zhu Committed by Jintao Zhu
Browse files

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: default avatarZheng Xiaoying <zheng.xiaoying@gm.com>

Signed-off-by: default avatarJintao Zhu <zhujtcsieee@gmail.com>

Change-Id: Ife4584804910290fac70dbe6d6934333f9a7486a
parent 42bdea36
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment