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

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/TouchDevice.java

Issue 186943002: Plumbing maxTouchPoints for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/base/android/ui_base_jni_registrar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.ui.base;
6
7 import android.content.Context;
8 import android.content.pm.PackageManager;
9
10 import org.chromium.base.CalledByNative;
11 import org.chromium.base.JNINamespace;
12
13 /**
14 * Simple proxy to let us query the touch device from C++
15 */
16 @JNINamespace("ui")
17 public class TouchDevice {
18
19 /**
20 * Static methods only so make constructor private.
21 */
22 private TouchDevice() { }
23
24 /**
25 * Returns the number of supported touch points.
26 *
27 * @return Maximum supported touch points.
28 */
29 @CalledByNative
30 private static int maxTouchPoints(Context context) {
31 // Android only tells us if the device belongs to a "Touchscreen Class"
32 // which only guarantees a minimum number of touch points. Be
33 // conservative and return the minimum, checking membership from the
34 // highest class down.
35 if (context.getPackageManager().hasSystemFeature(
36 PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {
37 return 5;
38 } else if (context.getPackageManager().hasSystemFeature(
39 PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT)) {
40 return 2;
41 } else if (context.getPackageManager().hasSystemFeature(
42 PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)) {
43 return 2;
44 } else if (context.getPackageManager().hasSystemFeature(
45 PackageManager.FEATURE_TOUCHSCREEN)) {
46 return 1;
47 } else {
48 return 0;
49 }
50 }
51 }
OLDNEW
« no previous file with comments | « no previous file | ui/base/android/ui_base_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698