Fix a bug when calling onError(int)

The lambda expression is executed on executor, so it is possible that
the message has been updated. The correct way is to fetch the
message.arg1 and use that value in the lamda expression.

This is a clean cherry-pick from
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/3725360

Bug:73750871
Test: Unit Test
Change-Id: Id13f5fabf7eaad6970ab66a83a17aba7f1eebfce
Merged-in: Id13f5fabf7eaad6970ab66a83a17aba7f1eebfce
(cherry picked from commit db18cdae661b87ff2de3847947906da735f8d5eb)
1 file changed