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

Commit 05105162 authored by Brandon Dayauon's avatar Brandon Dayauon
Browse files

Force config update when twoline is toggled.

Based on the bug, it seems that onHandleConfigChange was not called via the perfetto trace. Here is the call order:
1) Loader Task is created
2) Loader task runs
3) Preinflation happens from setApps() in bindAllApplications() via ModelCallbacks.kt
4) When show long app names toggle happens: it eventually triggers an onHandleConfigurationChanged() which is traceable in perfetto.
5) After configChange, preinflation happens again.

In step 4) there is an early return that happens and makes it so it doesn't call the reinflation of views that happens in the mModel.rebindCallbacks().
When the force configUpdate happens upon toggle, reset the variable after it is done.

bug: 370121944
Test: presubmit/manually/perfetto in bug
Flag: NONE trying to fix edge case
Change-Id: Id0ba591bfe583b300cc241fcfc37db6dd5a85363
parent e710e70b
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -412,6 +412,7 @@ public class Launcher extends StatefulActivity<LauncherState>

    private final List<BackPressHandler> mBackPressedHandlers = new ArrayList<>();
    private boolean mIsColdStartupAfterReboot;
    private boolean mForceConfigUpdate;

    private boolean mIsNaturalScrollingEnabled;

@@ -756,7 +757,7 @@ public class Launcher extends StatefulActivity<LauncherState>
    protected void onHandleConfigurationChanged() {
        Trace.beginSection("Launcher#onHandleconfigurationChanged");
        try {
            if (!initDeviceProfile(mDeviceProfile.inv)) {
            if (!initDeviceProfile(mDeviceProfile.inv) && !mForceConfigUpdate) {
                return;
            }

@@ -770,6 +771,7 @@ public class Launcher extends StatefulActivity<LauncherState>
            mModel.rebindCallbacks();
            updateDisallowBack();
        } finally {
            mForceConfigUpdate = false;
            Trace.endSection();
        }
    }
@@ -3146,6 +3148,13 @@ public class Launcher extends StatefulActivity<LauncherState>
        return mAnimationCoordinator;
    }

    /**
     * Set to force config update when set to true next time onHandleConfigurationChanged is called.
     */
    public void setForceConfigUpdate(boolean forceConfigUpdate) {
        mForceConfigUpdate = forceConfigUpdate;
    }

    @Override
    public View.OnLongClickListener getAllAppsItemLongClickListener() {
        return ItemLongClickListener.INSTANCE_ALL_APPS;