Commit 608dd9fe authored by thakis@chromium.org's avatar thakis@chromium.org

Revert 244210 "Include external touchscreen vid/pid in UMA hardw..."

Trying to get the cros asan bot green (crbug.com/333571)

> Include external touchscreen vid/pid in UMA hardware profile
> 
> Previously we looked at including the touchscreen name in the UMA
> hardware profile: https://codereview.chromium.org/23619085/.
> 
> As that posed a privacy concern, this patch includes the vid/pid
> instead.
> 
> BUG=248910
> 
> Review URL: https://codereview.chromium.org/103893005

TBR=tdresser@chromium.org

Review URL: https://codereview.chromium.org/135763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244378 0039d316-1c4b-4281-b951-d872f2087c98
parent 99cb8867
......@@ -50,7 +50,6 @@
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_device.h"
#include "gpu/config/gpu_info.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/screen.h"
#include "url/gurl.h"
......@@ -67,7 +66,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/user_manager.h"
#include "ui/events/x/touch_factory_x11.h"
#endif
using content::GpuDataManager;
......@@ -382,19 +380,6 @@ PairedDevice::Type AsBluetoothDeviceType(
NOTREACHED();
return PairedDevice::DEVICE_UNKNOWN;
}
void WriteExternalTouchscreensProto(SystemProfileProto::Hardware* hardware) {
std::set<std::pair<int, int> > touchscreen_ids =
ui::TouchFactory::GetInstance()->GetTouchscreenIds();
for (std::set<std::pair<int, int> >::iterator it = touchscreen_ids.begin();
it != touchscreen_ids.end();
++it) {
SystemProfileProto::Hardware::TouchScreen* touchscreen =
hardware->add_external_touchscreen();
touchscreen->set_vendor_id(it->first);
touchscreen->set_product_id(it->second);
}
}
#endif // defined(OS_CHROMEOS)
// Round a timestamp measured in seconds since epoch to one with a granularity
......@@ -816,9 +801,6 @@ void MetricsLog::RecordEnvironment(
uma_proto()->add_perf_data()->Swap(&perf_data_proto);
WriteBluetoothProto(hardware);
hardware->set_internal_display_supports_touch(
ui::InternalDisplaySupportsTouch());
WriteExternalTouchscreensProto(hardware);
UpdateMultiProfileUserCount();
#endif
......
......@@ -83,7 +83,7 @@ message SystemProfileProto {
}
optional OS os = 5;
// Next tag for Hardware: 16
// Next tag for Hardware: 14
// Information on the user's hardware.
message Hardware {
// The CPU architecture (x86, PowerPC, x86_64, ...)
......@@ -219,19 +219,6 @@ message SystemProfileProto {
repeated PairedDevice paired_device = 3;
}
optional Bluetooth bluetooth = 11;
// Whether the internal display produces touch events.
optional bool internal_display_supports_touch = 14;
// Vendor ids and product ids of external touchscreens.
message TouchScreen {
// Touch screen vendor id.
optional uint32 vendor_id = 1;
// Touch screen product id.
optional uint32 product_id = 2;
}
// Lists vendor and product ids of external touchscreens.
repeated TouchScreen external_touchscreen = 15;
}
optional Hardware hardware = 6;
......
......@@ -26,10 +26,6 @@ base::TimeDelta EventTimeForNow() {
}
bool ShouldDefaultToNaturalScroll() {
return InternalDisplaySupportsTouch();
}
bool InternalDisplaySupportsTouch() {
gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
if (!screen)
return false;
......
......@@ -133,9 +133,6 @@ EVENTS_EXPORT bool IsNaturalScrollEnabled();
// Returns whether natural scrolling should be used for touchpad.
EVENTS_EXPORT bool ShouldDefaultToNaturalScroll();
// Returns whether or not the internal display produces touch events.
EVENTS_EXPORT bool InternalDisplaySupportsTouch();
// Was this event generated by a touchpad device?
// The caller is responsible for ensuring that this is a mouse/touchpad event
// before calling this function.
......
......@@ -4,7 +4,6 @@
#include "ui/events/x/touch_factory_x11.h"
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h>
......@@ -82,7 +81,6 @@ void TouchFactory::UpdateDeviceList(Display* display) {
touch_device_available_ = false;
touch_device_lookup_.reset();
touch_device_list_.clear();
touchscreen_ids_.clear();
max_touch_points_ = -1;
#if !defined(USE_XI2_MT)
......@@ -133,7 +131,6 @@ void TouchFactory::UpdateDeviceList(Display* display) {
reinterpret_cast<XITouchClassInfo *>(xiclassinfo);
// Only care direct touch device (such as touch screen) right now
if (tci->mode == XIDirectTouch) {
CacheTouchscreenIds(display, devinfo->deviceid);
touch_device_lookup_[devinfo->deviceid] = true;
touch_device_list_[devinfo->deviceid] = true;
touch_device_available_ = true;
......@@ -271,40 +268,4 @@ void TouchFactory::SetPointerDeviceForTest(
}
}
void TouchFactory::CacheTouchscreenIds(Display* display, int device_id) {
XDevice* device = XOpenDevice(display, device_id);
Atom actual_type_return;
int actual_format_return;
unsigned long nitems_return;
unsigned long bytes_after_return;
unsigned char *prop_return;
const char kDeviceProductIdString[] = "Device Product ID";
Atom device_product_id_atom =
XInternAtom(display, kDeviceProductIdString, false);
if (device_product_id_atom != None &&
XGetDeviceProperty(display, device, device_product_id_atom, 0, 2,
False, XA_INTEGER, &actual_type_return,
&actual_format_return, &nitems_return,
&bytes_after_return, &prop_return) == Success) {
if (actual_type_return == XA_INTEGER &&
actual_format_return == 32 &&
nitems_return == 2) {
// An actual_format_return of 32 implies that the returned data is an
// array of longs. See the description of |prop_return| in `man
// XGetDeviceProperty` for details.
long* ptr = reinterpret_cast<long*>(prop_return);
// Internal displays will have a vid and pid of 0. Ignore them.
// ptr[0] is the vid, and ptr[1] is the pid.
if (ptr[0] || ptr[1])
touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
}
XFree(prop_return);
}
XCloseDevice(display, device);
}
} // namespace ui
......@@ -7,7 +7,6 @@
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include "base/timer/timer.h"
......@@ -73,11 +72,6 @@ class EVENTS_BASE_EXPORT TouchFactory {
// Whether any touch device is currently present and enabled.
bool IsTouchDevicePresent();
// Pairs of <vendor id, product id> of external touch screens.
const std::set<std::pair<int, int> >& GetTouchscreenIds() const {
return touchscreen_ids_;
}
// Return maximum simultaneous touch points supported by device.
int GetMaxTouchPoints() const;
......@@ -95,8 +89,6 @@ class EVENTS_BASE_EXPORT TouchFactory {
// Requirement for Singleton
friend struct DefaultSingletonTraits<TouchFactory>;
void CacheTouchscreenIds(Display* display, int id);
// NOTE: To keep track of touch devices, we currently maintain a lookup table
// to quickly decide if a device is a touch device or not. We also maintain a
// list of the touch devices. Ideally, there will be only one touch device,
......@@ -119,9 +111,6 @@ class EVENTS_BASE_EXPORT TouchFactory {
// Indicates whether touch events are explicitly disabled.
bool touch_events_disabled_;
// Indicates whether the device's internal display produces touch events.
bool internal_display_supports_touch_;
// The list of touch devices. For testing/debugging purposes, a single-pointer
// device (mouse or touch screen without sufficient X/driver support for MT)
// can sometimes be treated as a touch device. The key in the map represents
......@@ -129,9 +118,6 @@ class EVENTS_BASE_EXPORT TouchFactory {
// capable.
std::map<int, bool> touch_device_list_;
// Touch screen <vid, pid>s.
std::set<std::pair<int, int> > touchscreen_ids_;
// Maximum simultaneous touch points supported by device. In the case of
// devices with multiple digitizers (e.g. multiple touchscreens), the value
// is the maximum of the set of maximum supported contacts by each individual
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment