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

Commit 5a41e54f authored by Narayan Kamath's avatar Narayan Kamath
Browse files

CastTile: UX fixes for media projection.

- Long clicks on the tile are handled the same way as clicks
  regardless of whether the tile is indicating an active media
  projection session or not.
- Regular clicks on the tile when a media projection session is
  active and the device is locked with a secure keyguard should
  stop the session (and not prompt the user to unlock).

Test: manual
Bug: 124753835
Change-Id: I4009563a49377734850b3da0ead3215721de7d22
parent 095adc27
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -88,7 +88,9 @@ public class CastTile extends QSTileImpl<BooleanState> {

    @Override
    public BooleanState newTileState() {
        return new BooleanState();
        BooleanState state = new BooleanState();
        state.handlesLongClick = false;
        return state;
    }

    @Override
@@ -115,21 +117,26 @@ public class CastTile extends QSTileImpl<BooleanState> {
        handleClick();
    }

    @Override
    protected void handleLongClick() {
        handleClick();
    }

    @Override
    protected void handleClick() {
        if (getState().state == Tile.STATE_UNAVAILABLE) {
            return;
        }

        CastDevice activeProjection = getActiveDeviceMediaProjection();
        if (activeProjection == null) {
            if (mKeyguard.isSecure() && !mKeyguard.canSkipBouncer()) {
                mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
                    showDetail(true);
                });
            return;
        }

        CastDevice activeProjection = getActiveDeviceMediaProjection();
        if (activeProjection == null) {
            } else {
                showDetail(true);
            }
        } else {
            mController.stopCasting(activeProjection);
        }