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
This commit is contained in:
Narayan Kamath
2019-03-08 13:23:00 +00:00
parent 095adc27dc
commit 5a41e54f43

View File

@@ -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;
}
if (mKeyguard.isSecure() && !mKeyguard.canSkipBouncer()) {
mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
showDetail(true);
});
return;
}
CastDevice activeProjection = getActiveDeviceMediaProjection();
if (activeProjection == null) {
showDetail(true);
if (mKeyguard.isSecure() && !mKeyguard.canSkipBouncer()) {
mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
showDetail(true);
});
} else {
showDetail(true);
}
} else {
mController.stopCasting(activeProjection);
}