Fix dex file lookup in DumpInfo when dex file locations have full paths.
If `profman --dump-info` is used together with --apk (rather than
--apk-fd and --dex-location), the dex file locations returned by
DexFile.GetLocation may include full paths like
"system_ext/priv-app/SystemUI/SystemUI.apk", which don't match base
keys like "SystemUI.apk" used in DexFileData.profile_key. The result is
that --dump-info dumps methods and classes by ids rather than pretty
printed names.
This replicates how dex files are looked up in
FindDexDataUsingAnnotations used by GetClassesAndMethods, used by
`profman --dump-classes-and-methods` which works fine. Also adopt the
use of ChecksumMatch from there.
Test: adb root
adb shell kill -SIGUSR1 '$(pidof com.android.systemui)' && \
sleep 1 && \
adb shell pm compile -m speed-profile com.android.systemui
adb shell profman --dump-only \
--profile-file=data/misc/profiles/ref/com.android.systemui/primary.prof \
--apk=system_ext/priv-app/SystemUI/SystemUI.apk
verify that the output shows nice method and class names
Change-Id: Ib383d2cc24ddbca0bc6bfb0c7419475c68e4b387
1 file changed