[res] Speed up AssetManager pointer locking

AssetManager needs to lock (promote()) apk asset weak pointers
to use them in pretty much any operation, and often mulitple
times for the same object.

This CL introduces a concept of an 'operation' in AssetManager,
and adds a cache for the locked assets that are retained until
the end of that operation. This way we only need to lock each
assets object exactly once, losing pretty much no performance.

Benchmarks all returned to the pre-memory-safe state values.

Bug: 280951693
Bug: 197260547
Bug: 276922628
Test: UTs + native benchmarks + java benchmarks + boot
(cherry-picked from https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/23146856)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:657f3c6bbfb7b0a7782562c5de5fd1aecc1346b3)
Merged-In: I26ef88df4f6267b5e8b89f1588f2382db74030c0
Change-Id: I26ef88df4f6267b5e8b89f1588f2382db74030c0
6 files changed