Fix issue #8133857: Tracking ANR in Gallery

Reworking the locking in resources so that we never hold the
state lock while calling in to potential long running operations.
This means the mTmpValue can no longer be final (since we need
to use it while the lock isn't held), so a new field needs to
be added as the lock and everything that touches mTmpValue must
deal with it being null, restoring the value in there when
possible, etc.

Change-Id: Ie5ffd0f66e5f2d0e869a62d72e7a55b1c74fe872
3 files changed