Fix bug 2129190
The context used by the status bar (i.e., the system context) was
not properly initialized to have the right ApplicationInfo inside
its PackageInfo. This eventually caused it to believe that it
was running at 160dpi.
Kudos to Dianne for figuring this out.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 6acd665..65d6eb9 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -292,9 +292,9 @@
}
public PackageInfo(ActivityThread activityThread, String name,
- Context systemContext) {
+ Context systemContext, ApplicationInfo info) {
mActivityThread = activityThread;
- mApplicationInfo = new ApplicationInfo();
+ mApplicationInfo = info != null ? info : new ApplicationInfo();
mApplicationInfo.packageName = name;
mPackageName = name;
mAppDir = null;
@@ -2202,7 +2202,7 @@
if (mSystemContext == null) {
ApplicationContext context =
ApplicationContext.createSystemContext(this);
- PackageInfo info = new PackageInfo(this, "android", context);
+ PackageInfo info = new PackageInfo(this, "android", context, null);
context.init(info, null, this);
context.getResources().updateConfiguration(
getConfiguration(), getDisplayMetricsLocked(false));
@@ -2214,6 +2214,13 @@
return mSystemContext;
}
+ public void installSystemApplicationInfo(ApplicationInfo info) {
+ synchronized (this) {
+ ApplicationContext context = getSystemContext();
+ context.init(new PackageInfo(this, "android", context, info), null, this);
+ }
+ }
+
void scheduleGcIdler() {
if (!mGcIdlerScheduled) {
mGcIdlerScheduled = true;