Android: Fix StrictMode violation on Smart Selection icon loading #2
The previous fix http://crrev/c/2562059 isn't very correct: 1) It introduced menu flickering because the icons could be set after the menu is already showing. 2) Even after a pre-warming, the second #loadDrawableAsync() call could still be slow, so the icons doesn't show sometimes. 3) An internal Android framework change made the situation worse that sometimes the menu item won't send the intent. Because the menu item can change its icon from null to an actual drawable, but the framework code made the assumption that the menu item won't change. This fix moves the icon loading work to the same background task for the smart text classification task, after we get the classification result. In this way we could have a deterministic icon loading result while not violating the strict mode rule. Fixed: 1129211 Change-Id: I7c35d8221bf57bd8ed68295f797d5bd6871dbae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626461Reviewed-by:Bo <boliu@chromium.org> Commit-Queue: Shimi Zhang <ctzsm@chromium.org> Cr-Commit-Position: refs/heads/master@{#843100}
Showing
Please register or sign in to comment