Add IllegalStateException with packageName on null info

This change returns the behavior of initializeJavaContextClassLoader in
LoadedApk to throw an IllegalStateException calling out the package it
attempted to fetch. This was removed when client-side caching was added
resulting in a different stack trace without this critical piece of
information that could help make sense of why this is happening.

Bug: 180418767
Bug: 140788621
Test: N/A; builds
Change-Id: Ia1ceff922f693093012eb6e3e0f6e1d90222cde7
This commit is contained in:
Patrick Baumann
2021-03-09 13:51:12 -08:00
parent 9793a67875
commit 92a23d32a9

View File

@@ -1110,6 +1110,10 @@ public final class LoadedApk {
mPackageName,
PackageManager.MATCH_DEBUG_TRIAGED_MISSING,
UserHandle.myUserId());
if (pi == null) {
throw new IllegalStateException("Unable to get package info for "
+ mPackageName + "; is package not installed?");
}
/*
* Two possible indications that this package could be
* sharing its virtual machine with other packages: