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

Commit 49d30dcc authored by Suresh Kamasala's avatar Suresh Kamasala Committed by Gerrit - the friendly Code Review server
Browse files

SystemUI : Flashlight tile disappears in notification bar

In notification bar if user taps on Flashlight tile
continuously it disappears sometimes.
Update tile visibility based tile "state.visible" flag.

CRs-Fixed: 777115

Change-Id: Ibc1c32633b3d93b11853818554ee3ae5cba882d3
parent 9aa1c016
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -71,14 +71,14 @@ 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) {
                mWasLastOn = 0;
@@ -90,7 +90,7 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements

        // Always show the tile when the flashlight is or was recently on. This is needed because
        // the camera is not available while it is being used for the flashlight.
        state.visible = mWasLastOn != 0 || mFlashlightController.isAvailable();
        state.visible = (!state.value || mWasLastOn != 0) || mFlashlightController.isAvailable();
        state.label = mHost.getContext().getString(R.string.quick_settings_flashlight_label);
        state.iconId = state.value
                ? R.drawable.ic_qs_flashlight_on : R.drawable.ic_qs_flashlight_off;