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

Commit 1a3dd05d authored by Roman Birg's avatar Roman Birg
Browse files

SystemUI: fix flashlight tile inconsistency



Toggling the torch via an external method (such as drawing V on
screen) would put the tile in a strange state and hide the tile.

Update the tile availability properly.

Change-Id: I597853b3ff3822e24bf512bbaefd9e192394c390
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 2488f5a8
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -73,13 +73,12 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements

    @Override
    protected void handleUpdateState(BooleanState state, Object arg) {
        if (state.value) {
            mWasLastOn = SystemClock.uptimeMillis();
        }

        if (arg instanceof Boolean) {
            state.value = (Boolean) arg;
        }
        if (state.value) {
            mWasLastOn = SystemClock.uptimeMillis();
        }

        if (!state.value && mWasLastOn != 0) {
            if (SystemClock.uptimeMillis() > mWasLastOn + RECENTLY_ON_DURATION_MILLIS) {
@@ -123,7 +122,7 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements

    @Override
    public void onTorchAvailabilityChanged(boolean available) {
        refreshState();
        refreshState(mTorchManager.isTorchOn());
    }

    private Runnable mRecentlyOnTimeout = new Runnable() {