Bug 1279332 - Perform UI callback on UI thread to avoid crashing the background thread r=grisha

We're now calling setIntent on the background thread. The onTargetSelected callback expects
to be run on the UI thread, and it looks like Android hangs up when we call UI methods
on the background thread. This in turn means the entire background thread gets locked up
(we execute tasks on the background thread sequentially) and no further background runnables
are executed. This breaks anything else requiring use of the background thread, e.g.
favicon generation, search, permissions doorhangers, etc.

MozReview-Commit-ID: CoYUOMqNX0m

--HG--
extra : rebase_source : 84a4dcc8a8aad590f02ba9f8d8b2564922787d17
This commit is contained in:
Andrzej Hunt 2016-06-09 15:58:43 -07:00
parent 83a8bff8c3
commit 0e9eacd33c

View File

@ -207,7 +207,12 @@ public class GeckoActionProvider {
// Inform the target listener to refresh it's UI, if needed.
if (mOnTargetListener != null) {
mOnTargetListener.onTargetSelected();
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
mOnTargetListener.onTargetSelected();
}
});
}
}