Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: ash/common/system/chromeos/palette/palette_utils.cc

Issue 2786433002: cros: Force disable stylus features on pyro. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/chromeos/palette/palette_tray.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/palette/palette_utils.cc
diff --git a/ash/common/system/chromeos/palette/palette_utils.cc b/ash/common/system/chromeos/palette/palette_utils.cc
index f32e40c2c1d241818618e559e1a171e39fca7768..c8c496bb3ce94c8182ef46f2672e4dbe9ec8822f 100644
--- a/ash/common/system/chromeos/palette/palette_utils.cc
+++ b/ash/common/system/chromeos/palette/palette_utils.cc
@@ -11,6 +11,7 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "base/command_line.h"
+#include "base/sys_info.h"
#include "ui/events/devices/input_device_manager.h"
#include "ui/events/devices/touchscreen_device.h"
#include "ui/gfx/geometry/point.h"
@@ -18,13 +19,31 @@
namespace ash {
namespace palette_utils {
+namespace {
+// Pyro firmware currently reports it has a stylus but it does not.
+// TODO(jdufault): Remove this once firmware is fixed. See b/36367810.
+const char* kBlacklistedDevices[] = {"pyro"};
+
+bool IsBlacklisted(const std::string& name) {
+ return std::find(std::begin(kBlacklistedDevices),
+ std::end(kBlacklistedDevices),
+ name) != std::end(kBlacklistedDevices);
+}
+} // namespace
+
bool HasStylusInput() {
- // Allow the user to force-enable by passing a switch.
+ // Allow the user to force enable or disable by passing a switch. If both are
+ // present, enabling takes precedence over disabling.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAshForceEnablePalette)) {
return true;
}
+ // Disable stylus for any blacklisted devices.
+ if (IsBlacklisted(base::SysInfo::GetLsbReleaseBoard()))
+ return false;
+
+ // Check to see if the hardware reports it is stylus capable.
for (const ui::TouchscreenDevice& device :
ui::InputDeviceManager::GetInstance()->GetTouchscreenDevices()) {
if (device.is_stylus &&
« no previous file with comments | « ash/common/system/chromeos/palette/palette_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698