Skip to content

Commit

Permalink
Deprecate unused touch metrics
Browse files Browse the repository at this point in the history
Bug: 826476
Change-Id: Id24d14cd5dc0ac31fac4e865f71047aa75c8a786
Reviewed-on: https://chromium-review.googlesource.com/1130819
Commit-Queue: Ryan Cui <rcui@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574837}
  • Loading branch information
Ryan Cui authored and Commit Bot committed Jul 13, 2018
1 parent 3428d81 commit 73ad465
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
40 changes: 0 additions & 40 deletions ash/touch/touch_uma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@

#include "ash/touch/touch_uma.h"

#include "ash/shell.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/class_property.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/geometry/point_conversions.h"

namespace {

Expand Down Expand Up @@ -68,46 +62,12 @@ void TouchUMA::RecordGestureAction(GestureActionType action) {

void TouchUMA::RecordTouchEvent(aura::Window* target,
const ui::TouchEvent& event) {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Ash.TouchRadius",
static_cast<int>(std::max(event.pointer_details().radius_x,
event.pointer_details().radius_y)),
1, 500, 100);

WindowTouchDetails* details = target->GetProperty(kWindowTouchDetails);
if (!details) {
details = new WindowTouchDetails;
target->SetProperty(kWindowTouchDetails, details);
}

// Record the location of the touch points.
const int kBucketCountForLocation = 100;
const gfx::Rect bounds = target->GetRootWindow()->bounds();
const int bucket_size_x =
std::max(1, bounds.width() / kBucketCountForLocation);
const int bucket_size_y =
std::max(1, bounds.height() / kBucketCountForLocation);

gfx::Point position = event.root_location();

// Prefer raw event location (when available) over calibrated location.
if (event.HasNativeEvent()) {
position =
gfx::ToFlooredPoint(ui::EventLocationFromNative(event.native_event()));
position = gfx::ScaleToFlooredPoint(
position, 1.f / target->layer()->device_scale_factor());
}

position.set_x(std::min(bounds.width() - 1, std::max(0, position.x())));
position.set_y(std::min(bounds.height() - 1, std::max(0, position.y())));

UMA_HISTOGRAM_CUSTOM_COUNTS(
"Ash.TouchPositionX", position.x() / bucket_size_x, 1,
kBucketCountForLocation, kBucketCountForLocation + 1);
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Ash.TouchPositionY", position.y() / bucket_size_y, 1,
kBucketCountForLocation, kBucketCountForLocation + 1);

if (event.type() == ui::ET_TOUCH_PRESSED) {
base::RecordAction(base::UserMetricsAction("Touchscreen_Down"));

Expand Down
9 changes: 9 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4315,18 +4315,27 @@ uploading your change for review.
</histogram>

<histogram name="Ash.TouchPositionX" units="pixels">
<obsolete>
Deprecated 07/2018 due to lack of usage.
</obsolete>
<owner>tdanderson@chromium.org</owner>
<owner>kuscher@google.com</owner>
<summary>The position of the touch-events along the X axis.</summary>
</histogram>

<histogram name="Ash.TouchPositionY" units="pixels">
<obsolete>
Deprecated 07/2018 due to lack of usage.
</obsolete>
<owner>tdanderson@chromium.org</owner>
<owner>kuscher@google.com</owner>
<summary>The position of the touch-events along the Y axis.</summary>
</histogram>

<histogram name="Ash.TouchRadius" units="pixels">
<obsolete>
Deprecated 07/2018 due to lack of usage.
</obsolete>
<owner>tdanderson@chromium.org</owner>
<owner>kuscher@google.com</owner>
<summary>The radius of a touch event.</summary>
Expand Down

0 comments on commit 73ad465

Please sign in to comment.