summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-05-31 17:59:49 -0700
committerDianne Hackborn <hackbod@google.com>2011-05-31 18:04:14 -0700
commit2f0b17573d4324832f7a20402a3d2b5920bc4866 (patch)
treeeb85b9344237741f21f4989950677692b3bdbbda /core/java/android/app
parent8ede62745faa02265f927941d1195b6c1bf05ebb (diff)
downloadframeworks_base-2f0b17573d4324832f7a20402a3d2b5920bc4866.zip
frameworks_base-2f0b17573d4324832f7a20402a3d2b5920bc4866.tar.gz
frameworks_base-2f0b17573d4324832f7a20402a3d2b5920bc4866.tar.bz2
Fix issue #4502672: Wrong xml resources used for homescreen widgets.
There was a race in the system process between applying the initial configuration and executing code in higher-level system services like the app widget service that relies on the config. For some reason it starting showing up more after my code changes; it should now be completely fixed. Also fix the activity starting window to run in compatibility mode if its application is going to be in compatibility mode. And some various cleanup and small fixes. Change-Id: I0566933bf1bbb4259c1d99a60c0a3c19af1542e5
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/ActivityThread.java18
-rw-r--r--core/java/android/app/LoadedApk.java6
2 files changed, 20 insertions, 4 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index d30010a..063665b 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -172,6 +172,11 @@ public final class ActivityThread {
// These can be accessed by multiple threads; mPackages is the lock.
// XXX For now we keep around information about all packages we have
// seen, not removing entries from this map.
+ // NOTE: The activity manager in its process needs to call in to
+ // ActivityThread to do things like update resource configurations,
+ // which means this lock gets held while the activity manager holds its
+ // own lock. Thus you MUST NEVER call back into the activity manager
+ // or anything that depends on it while holding this lock.
final HashMap<String, WeakReference<LoadedApk>> mPackages
= new HashMap<String, WeakReference<LoadedApk>>();
final HashMap<String, WeakReference<LoadedApk>> mResourcePackages
@@ -1480,7 +1485,7 @@ public final class ActivityThread {
}
public Configuration getConfiguration() {
- return mConfiguration;
+ return mResConfiguration;
}
public boolean isProfiling() {
@@ -1525,7 +1530,7 @@ public final class ActivityThread {
synchronized (this) {
ContextImpl context = getSystemContext();
context.init(new LoadedApk(this, "android", context, info,
- new CompatibilityInfo(info, 0, 0, false)), null, this);
+ CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO), null, this);
}
}
@@ -3274,6 +3279,12 @@ public final class ActivityThread {
}
}
+ public final void applyConfigurationToResources(Configuration config) {
+ synchronized (mPackages) {
+ applyConfigurationToResourcesLocked(config, null);
+ }
+ }
+
final boolean applyConfigurationToResourcesLocked(Configuration config,
CompatibilityInfo compat) {
if (mResConfiguration == null) {
@@ -3492,8 +3503,7 @@ public final class ActivityThread {
* reflect configuration changes. The configuration object passed
* in AppBindData can be safely assumed to be up to date
*/
- Resources.getSystem().updateConfiguration(mConfiguration,
- Resources.getSystem().getDisplayMetrics(), data.compatInfo);
+ applyConfigurationToResourcesLocked(data.config, data.compatInfo);
data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo);
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 5307696..6287d33 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -98,6 +98,12 @@ final class LoadedApk {
return mApplication;
}
+ /**
+ * Create information about a new .apk
+ *
+ * NOTE: This constructor is called with ActivityThread's lock held,
+ * so MUST NOT call back out to the activity manager.
+ */
public LoadedApk(ActivityThread activityThread, ApplicationInfo aInfo,
CompatibilityInfo compatInfo,
ActivityThread mainThread, ClassLoader baseLoader,