From 92a23d32a9d360601d02bfe26559e0dfc4f443c5 Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Tue, 9 Mar 2021 13:51:12 -0800 Subject: [PATCH] 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 --- core/java/android/app/LoadedApk.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index be426aa7ed2ba..83d0246744df2 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -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: