Skip to content

Commit 816e4f7

Browse files
committed
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
1 parent 4190a04 commit 816e4f7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/java/android/app/ContextImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,9 @@ public void enforceUriPermission(
14801480
public Context createPackageContext(String packageName, int flags)
14811481
throws PackageManager.NameNotFoundException {
14821482
if (packageName.equals("system") || packageName.equals("android")) {
1483-
return new ContextImpl(mMainThread.getSystemContext());
1483+
final ContextImpl context = new ContextImpl(mMainThread.getSystemContext());
1484+
context.mBasePackageName = mBasePackageName;
1485+
return context;
14841486
}
14851487

14861488
LoadedApk pi =

0 commit comments

Comments
 (0)