Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c310ef9 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Reduce cost of WindowTokenClient config change am: 778c95ce am: b6a1d36a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16439833

Change-Id: I419e9c42305f3ad271fcb3f774e12474cdf3baaf
parents 85853b40 b6a1d36a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2700,6 +2700,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);
+4 −0
Original line number Diff line number Diff line
@@ -3212,6 +3212,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
+1 −9
Original line number Diff line number Diff line
@@ -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;