diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-05-08 10:54:41 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-08 10:54:41 -0700 |
| commit | 92d7f9ff1c0c8a179ee935d86d3c94022980ead2 (patch) | |
| tree | 168df18d96613f69541483a11164990526d33d12 /core/java/android/app/ActivityThread.java | |
| parent | 947f1c8db00bd3805838ff49a5f4d220df507b47 (diff) | |
| parent | 30ca5cd11a23f06f2f8eeaa587685450826f800f (diff) | |
Merge "Fix bug #6408393 Character corruption is caused when locale is changed" into jb-dev
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 314f5c2e3f80..8799194e274e 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -2639,6 +2639,7 @@ public final class ActivityThread { if (DEBUG_CONFIGURATION) Slog.v(TAG, "Resuming activity " + r.activityInfo.name + " with newConfig " + r.newConfig); performConfigurationChanged(r.activity, r.newConfig); + freeTextLayoutCachesIfNeeded(r.activity.mCurrentConfig.diff(r.newConfig)); r.newConfig = null; } if (localLOGV) Slog.v(TAG, "Resuming " + r + " with isForward=" @@ -2955,6 +2956,7 @@ public final class ActivityThread { if (DEBUG_CONFIGURATION) Slog.v(TAG, "Updating activity vis " + r.activityInfo.name + " with new config " + r.newConfig); performConfigurationChanged(r.activity, r.newConfig); + freeTextLayoutCachesIfNeeded(r.activity.mCurrentConfig.diff(r.newConfig)); r.newConfig = null; } } else { @@ -3669,6 +3671,7 @@ public final class ActivityThread { final void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { ArrayList<ComponentCallbacks2> callbacks = null; + int configDiff = 0; synchronized (mPackages) { if (mPendingConfiguration != null) { @@ -3693,6 +3696,7 @@ public final class ActivityThread { if (!mConfiguration.isOtherSeqNewer(config) && compat == null) { return; } + configDiff = mConfiguration.diff(config); mConfiguration.updateFrom(config); config = applyCompatConfiguration(); callbacks = collectComponentCallbacksLocked(false, config); @@ -3701,6 +3705,8 @@ public final class ActivityThread { // Cleanup hardware accelerated stuff WindowManagerImpl.getDefault().trimLocalMemory(); + freeTextLayoutCachesIfNeeded(configDiff); + if (callbacks != null) { final int N = callbacks.size(); for (int i=0; i<N; i++) { @@ -3709,6 +3715,17 @@ public final class ActivityThread { } } + final void freeTextLayoutCachesIfNeeded(int configDiff) { + if (configDiff != 0) { + // Ask text layout engine to free its caches if there is a locale change + boolean hasLocaleConfigChange = ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0); + if (hasLocaleConfigChange) { + Canvas.freeTextLayoutCaches(); + if (DEBUG_CONFIGURATION) Slog.v(TAG, "Cleared TextLayout Caches"); + } + } + } + final void handleActivityConfigurationChanged(IBinder token) { ActivityClientRecord r = mActivities.get(token); if (r == null || r.activity == null) { @@ -3719,6 +3736,8 @@ public final class ActivityThread { + r.activityInfo.name); performConfigurationChanged(r.activity, mCompatConfiguration); + + freeTextLayoutCachesIfNeeded(r.activity.mCurrentConfig.diff(mCompatConfiguration)); } final void handleProfilerControl(boolean start, ProfilerControlData pcd, int profileType) { @@ -3821,6 +3840,9 @@ public final class ActivityThread { // Ask graphics to free up as much as possible (font/image caches) Canvas.freeCaches(); + // Ask text layout engine to free also as much as possible + Canvas.freeTextLayoutCaches(); + BinderInternal.forceGc("mem"); } |
