Extend AnrController to improve ANR dialog controls
I5431d22bd8faa75e3deab1960a2f721784f98d42 introduced a basic ANR controller interface to allow services within the system_server register to delay the ANR dialog during an ANR. Some limitations of that interface were: 1. No way to cancel the ANR dialog if the normal function of the app resumed during the delay 2. The AnrController#getAnrDelay method was serving a dual purpose of returning the delay and showing an interim UI 3. The interim UI might live within an updatable mainline module, hence forcing the system_server to block (asynchronously) on the 'getter' for the binder call. This cl addresses the problems above with the following new methods on AnrController: onAnrDelayStarted and onAnrDelayCompleted. These methods provide a clearer interface for the following reasons: 1. onAnrDelayCompleted will return a boolean value to indicate whether the ANR dialog should still be shown after the delay 2. onAnrDelayStarted is a more explicit API that can be called asynchronously without blocking to notify external components to show an interim UI 3. The existing getAnrDelay can be handled completely within the system_server without blocking on an external binder call See design (2a) in go/transcoding-anrs for more details Test: Manual Bug: 170486601 Change-Id: Idb9190a0e6014ce64bf1412c26f6ae03f97e922d
Loading
Please register or sign in to comment