Fix ClassLoader issue of WindowContext

The root cause of this issue is that we pass mClassLoader to new created
Resources, but it may be null if we don't set ClassLoader from
container.
This CL fixes this issue by use ContextImpl#getClassLoader instead.

Bug: 203027987
Test: reproducible steps mentioned in bug

Change-Id: Ic88a351b3e9bbcf8382b9aefea63e2be2f190cb6
This commit is contained in:
Charles Chen
2021-10-19 21:21:49 +08:00
parent 9c0537028d
commit 09c03ec912

View File

@@ -2743,7 +2743,7 @@ class ContextImpl extends Context {
*/
private static Resources createWindowContextResources(@NonNull ContextImpl windowContextBase) {
final LoadedApk packageInfo = windowContextBase.mPackageInfo;
final ClassLoader classLoader = windowContextBase.mClassLoader;
final ClassLoader classLoader = windowContextBase.getClassLoader();
final IBinder token = windowContextBase.getWindowContextToken();
final String resDir = packageInfo.getResDir();