summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authortimvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 13:21:46 +0000
committertimvolodine@chromium.org <timvolodine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 13:21:46 +0000
commitcf300234c91f44913a633eae67c5a11449e96713 (patch)
tree06c85f8f46de8bf4e4230b98fed9f3c8554673c8 /content
parenta5c405a09ab7c8e3771deff93fb4f0ee18959692 (diff)
downloadchromium_src-cf300234c91f44913a633eae67c5a11449e96713.zip
chromium_src-cf300234c91f44913a633eae67c5a11449e96713.tar.gz
chromium_src-cf300234c91f44913a633eae67c5a11449e96713.tar.bz2
Android: add UMA instrumentation for inertial sensors.
Device Motion/Orientation API use various sensors to determine orientation, acceleration etc of the mobile device. Some of the sensors may be or may not be available on the device. This patch adds instrumentation for measuring sensor availability across android based mobile devices. BUG= Review URL: https://codereview.chromium.org/66843010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/device_orientation/data_fetcher_impl_android.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/content/browser/device_orientation/data_fetcher_impl_android.cc b/content/browser/device_orientation/data_fetcher_impl_android.cc
index 230507e..c103029 100644
--- a/content/browser/device_orientation/data_fetcher_impl_android.cc
+++ b/content/browser/device_orientation/data_fetcher_impl_android.cc
@@ -8,11 +8,20 @@
#include "base/android/jni_android.h"
#include "base/memory/singleton.h"
+#include "base/metrics/histogram.h"
#include "content/browser/device_orientation/inertial_sensor_consts.h"
#include "jni/DeviceMotionAndOrientation_jni.h"
using base::android::AttachCurrentThread;
+namespace {
+
+static void updateRotationVectorHistogram(bool value) {
+ UMA_HISTOGRAM_BOOLEAN("InertialSensor.RotationVectorAndroidAvailable", value);
+}
+
+}
+
namespace content {
DataFetcherImplAndroid::DataFetcherImplAndroid()
@@ -54,8 +63,10 @@ void DataFetcherImplAndroid::GotOrientation(
device_orientation_buffer_->data.hasGamma = true;
device_orientation_buffer_->seqlock.WriteEnd();
- if (!is_orientation_buffer_ready_)
+ if (!is_orientation_buffer_ready_) {
SetOrientationBufferReadyStatus(true);
+ updateRotationVectorHistogram(true);
+ }
}
void DataFetcherImplAndroid::GotAcceleration(
@@ -191,6 +202,15 @@ void DataFetcherImplAndroid::CheckMotionBufferReadyToRead() {
device_motion_buffer_->data.interval = kInertialSensorIntervalMillis;
device_motion_buffer_->seqlock.WriteEnd();
SetMotionBufferReadyStatus(true);
+
+ UMA_HISTOGRAM_BOOLEAN("InertialSensor.AccelerometerAndroidAvailable",
+ received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION] > 0);
+ UMA_HISTOGRAM_BOOLEAN(
+ "InertialSensor.AccelerometerIncGravityAndroidAvailable",
+ received_motion_data_[RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY]
+ > 0);
+ UMA_HISTOGRAM_BOOLEAN("InertialSensor.GyroscopeAndroidAvailable",
+ received_motion_data_[RECEIVED_MOTION_DATA_ROTATION_RATE] > 0);
}
}
@@ -233,6 +253,10 @@ bool DataFetcherImplAndroid::StartFetchingDeviceOrientationData(
// to start firing all-null events.
SetOrientationBufferReadyStatus(!success);
}
+
+ if (!success)
+ updateRotationVectorHistogram(false);
+
return success;
}