Reduce cost of WindowTokenClient config change am: 778c95ce7c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16439833 Change-Id: I61df558230334d1fb9279c69ac91a106f3daec25
This commit is contained in:
@@ -2685,6 +2685,16 @@ public final class ActivityThread extends ClientTransactionHandler
|
||||
}
|
||||
}
|
||||
|
||||
void onSystemUiContextCleanup(ContextImpl context) {
|
||||
synchronized (this) {
|
||||
if (mDisplaySystemUiContexts == null) return;
|
||||
final int index = mDisplaySystemUiContexts.indexOfValue(context);
|
||||
if (index >= 0) {
|
||||
mDisplaySystemUiContexts.removeAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) {
|
||||
synchronized (this) {
|
||||
getSystemContext().installSystemApplicationInfo(info, classLoader);
|
||||
|
||||
@@ -3205,6 +3205,10 @@ class ContextImpl extends Context {
|
||||
final void performFinalCleanup(String who, String what) {
|
||||
//Log.i(TAG, "Cleanup up context: " + this);
|
||||
mPackageInfo.removeContextRegistrations(getOuterContext(), who, what);
|
||||
if (mContextType == CONTEXT_TYPE_SYSTEM_OR_SYSTEM_UI
|
||||
&& mToken instanceof WindowTokenClient) {
|
||||
mMainThread.onSystemUiContextCleanup(this);
|
||||
}
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package android.window;
|
||||
|
||||
import static android.window.ConfigurationHelper.diffPublicWithSizeBuckets;
|
||||
import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded;
|
||||
import static android.window.ConfigurationHelper.isDifferentDisplay;
|
||||
import static android.window.ConfigurationHelper.shouldUpdateResources;
|
||||
@@ -222,14 +221,7 @@ public class WindowTokenClient extends IWindowToken.Stub {
|
||||
() -> windowContext.dispatchConfigurationChanged(newConfig));
|
||||
}
|
||||
|
||||
// Dispatch onConfigurationChanged only if there's a significant public change to
|
||||
// make it compatible with the original behavior.
|
||||
final Configuration[] sizeConfigurations = context.getResources()
|
||||
.getSizeConfigurations();
|
||||
final SizeConfigurationBuckets buckets = sizeConfigurations != null
|
||||
? new SizeConfigurationBuckets(sizeConfigurations) : null;
|
||||
final int diff = diffPublicWithSizeBuckets(mConfiguration, newConfig, buckets);
|
||||
|
||||
final int diff = mConfiguration.diffPublicOnly(newConfig);
|
||||
if (shouldReportConfigChange && diff != 0
|
||||
&& context instanceof WindowProviderService) {
|
||||
final WindowProviderService windowProviderService = (WindowProviderService) context;
|
||||
|
||||
Reference in New Issue
Block a user