android: Handle pending exceptions in MessagePump.
It's possible for there to be a pending Java exception for the current thread when the Android version of MessagePumpForUI is called, because the ALooper we use to schedule our message pump iterations can also have other callbacks running on it and ALooper doesn't check for exceptions between callbacks. One example of this is render thread exceptions on P and earlier, which are thrown by sending a message to the UI thread in native - if we get unlucky and our MessagePumpForUI runs afterward in the same ALooper polling cycle, we will crash the first time we make a JNI call, resulting in a confusing stack trace. Avoid this by just skipping our callback execution if there is a pending exception set at the start of the callback. If the exception ends up not being fatal (caught by something higher up the stack) then our callback will be run again in the next iteration, as the fd has not been reset. Bug: 1052830 Change-Id: Ie13ceab6c2c1b988189791546fa12a5529ef17b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062434Reviewed-by:Sami Kyöstilä <skyostil@chromium.org> Commit-Queue: Richard Coles <torne@chromium.org> Cr-Commit-Position: refs/heads/master@{#742600}
Showing
Please register or sign in to comment