System context should inherit base package name.
Otherwise registerReceiver() from views inflated with the returned
context will throw (like DateTimeView).
Bug: 6376149
Change-Id: I038a680e49fba81bbebfc8c0c94f15e7cd072f33
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 8942135..64a05a8 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1480,7 +1480,9 @@
public Context createPackageContext(String packageName, int flags)
throws PackageManager.NameNotFoundException {
if (packageName.equals("system") || packageName.equals("android")) {
- return new ContextImpl(mMainThread.getSystemContext());
+ final ContextImpl context = new ContextImpl(mMainThread.getSystemContext());
+ context.mBasePackageName = mBasePackageName;
+ return context;
}
LoadedApk pi =