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

Commit 2aa40282 authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Delay animator update on tiles change.

The executor seemed to update the animator before the QS panel
generated the new tiles, causing the misaligned titles. In case the
animation starts before that delay, we also request a lazy update that
will run when trying to animate.

Flag: None
Test: Manually, by editing tiles and slowly dismissing QS
Fixes: 243855125
Change-Id: Ib3edc2a1290759a10d4301f8ec89ce67a16602cb
parent cbb00109
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -36,11 +36,11 @@ import com.android.systemui.qs.TouchAnimator.Builder;
import com.android.systemui.qs.dagger.QSScope;
import com.android.systemui.qs.tileimpl.HeightOverrideable;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.concurrency.DelayableExecutor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Executor;

import javax.inject.Inject;

@@ -64,6 +64,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener

    private static final String TAG = "QSAnimator";

    private static final int ANIMATORS_UPDATE_DELAY_MS = 100;
    private static final float EXPANDED_TILE_DELAY = .86f;
    //Non first page delays
    private static final float QS_TILE_LABEL_FADE_OUT_START = 0.15f;
@@ -133,7 +134,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
    private int mLastQQSTileHeight;
    private float mLastPosition;
    private final QSHost mHost;
    private final Executor mExecutor;
    private final DelayableExecutor mExecutor;
    private boolean mShowCollapsedOnKeyguard;
    private int mQQSTop;

@@ -144,7 +145,7 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
    public QSAnimator(@RootView View rootView, QuickQSPanel quickPanel,
            QSPanelController qsPanelController,
            QuickQSPanelController quickQSPanelController, QSHost qsTileHost,
            @Main Executor executor, TunerService tunerService,
            @Main DelayableExecutor executor, TunerService tunerService,
            QSExpansionPathInterpolator qsExpansionPathInterpolator) {
        mQsRootView = rootView;
        mQuickQsPanel = quickPanel;
@@ -753,7 +754,10 @@ public class QSAnimator implements QSHost.Callback, PagedTileLayout.PageListener
    public void onTilesChanged() {
        // Give the QS panels a moment to generate their new tiles, then create all new animators
        // hooked up to the new views.
        mExecutor.execute(mUpdateAnimators);
        mExecutor.executeDelayed(mUpdateAnimators, ANIMATORS_UPDATE_DELAY_MS);

        // Also requests a lazy animators update in case the animation starts before the executor.
        requestAnimatorUpdate();
    }

    private final TouchAnimator.Listener mNonFirstPageListener =