Skip to content

Commit

Permalink
[Shelf Metrics] Avoid over-counting gesture events
Browse files Browse the repository at this point in the history
In overview mode, only the gesture tap event will end the overview.
Hotseat state does not update for the other gestures, such as scrolling
(it is usually used to drag a window). It is the reason why the current
code - recording the metrics for the ET_GESTURE_BEGIN event, causes
unnecessary recordings.

Bug: 1124345
Change-Id: If9931368a98776338beb893b2f5c326603849437
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389322
Reviewed-by: Xiyuan Slow <xiyuan@chromium.org>
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803926}
  • Loading branch information
Andrew Xu authored and Commit Bot committed Sep 2, 2020
1 parent a499a38 commit 8dcfda4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ash/shelf/shelf_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,16 @@ void ShelfLayoutManager::ProcessGestureEventOfInAppHotseat(

base::AutoReset<bool> hide_hotseat(&should_hide_hotseat_, true);

// Record gesture metrics only for ET_GESTURE_BEGIN to avoid over counting.
if (event->type() == ui::ET_GESTURE_BEGIN) {
// In overview mode, only the gesture tap event is able to make the hotseat
// exit the extended mode.
const bool in_overview =
Shell::Get()->overview_controller() &&
Shell::Get()->overview_controller()->InOverviewSession();
ui::EventType interesting_type =
in_overview ? ui::ET_GESTURE_TAP : ui::ET_GESTURE_BEGIN;

// Record gesture metrics only for `interesting_type` to avoid over counting.
if (event->type() == interesting_type) {
UMA_HISTOGRAM_ENUMERATION(
kHotseatGestureHistogramName,
InAppShelfGestures::kHotseatHiddenDueToInteractionOutsideOfShelf);
Expand Down

0 comments on commit 8dcfda4

Please sign in to comment.