Optimize notifyDexContainersLoaded.

The implementation was inefficient and was suspected to bloat the heap
with a lot of short-lived objects. This CL tries to optimize it.

- Cache secondary dex locations.
- Replace stream usages with for loops in hot methods.

Before: https://screenshot.googleplex.com/8QKVzEDtas85Wfk
After: https://screenshot.googleplex.com/4BTeXdKMNNfSccf
(The tracing code was added temporarily during local development, and is
not included in this CL.)

Bug: 276333355
Test: atest ArtServiceTests
Ignore-AOSP-First: ART Services
Change-Id: I9a4f8e4d2bcbf058d6e60b6de63e41c7119b9145
1 file changed