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

Commit df039efd authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Rebind callback to tile even when tiles dont change.

When tiles don't change, we are not re-creating the views, but still
make sure that the callback is rebound (in case that it was removed
somewhere else).

Test: manual, modify tiles and check that QQS still receives updates
Test: atest PlatformScenarioTests
Fixes: 305605894
Flag: NONE
Change-Id: I75b9954a1613c5b8729aa18096e0050451efda9b
parent 1de55d4e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -255,6 +255,10 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
            for (QSTile tile : tiles) {
                addTile(tile, collapsedView);
            }
        } else {
            for (QSPanelControllerBase.TileRecord record : mRecords) {
                record.tile.addCallback(record.callback);
            }
        }
    }

+3 −3
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy
    // Only read and modified in main thread (where click events come through).
    private int mClickEventId = 0;

    private final ArrayList<Callback> mCallbacks = new ArrayList<>();
    private final ArraySet<Callback> mCallbacks = new ArraySet<>();
    private final Object mStaleListener = new Object();
    protected TState mState;
    private TState mTmpState;
@@ -444,9 +444,9 @@ public abstract class QSTileImpl<TState extends State> implements QSTile, Lifecy
    }

    private void handleStateChanged() {
        if (mCallbacks.size() != 0) {
        if (!mCallbacks.isEmpty()) {
            for (int i = 0; i < mCallbacks.size(); i++) {
                mCallbacks.get(i).onStateChanged(mState);
                mCallbacks.valueAt(i).onStateChanged(mState);
            }
        }
    }