summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2016-11-17 22:54:58 +0800
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-01 01:39:13 +0000
commit3a49878e30ae825ba39d04391fcef06963cc594c (patch)
treeb7198eeafb15668f41e44ecec71a35bed3fadcdf
parent50db0bed3274f5fb8acc2dca06de0dbeab377f44 (diff)
downloadandroid_hardware_lineage_lineagehw-3a49878e30ae825ba39d04391fcef06963cc594c.tar.gz
android_hardware_lineage_lineagehw-3a49878e30ae825ba39d04391fcef06963cc594c.tar.bz2
android_hardware_lineage_lineagehw-3a49878e30ae825ba39d04391fcef06963cc594c.zip
cmhw: Add TouchscreenGestures API
Support enumerating the touchscreen gestures supported by devices. Change-Id: I75123155cca1f78f5b145f694a37638088f06e2c
-rw-r--r--src/org/cyanogenmod/hardware/TouchscreenGestures.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/org/cyanogenmod/hardware/TouchscreenGestures.java b/src/org/cyanogenmod/hardware/TouchscreenGestures.java
new file mode 100644
index 0000000..b1bf5a0
--- /dev/null
+++ b/src/org/cyanogenmod/hardware/TouchscreenGestures.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ * 2017 The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.cyanogenmod.hardware;
+
+import cyanogenmod.hardware.TouchscreenGesture;
+
+/**
+ * Touchscreen gestures API
+ *
+ * A device may implement several touchscreen gestures for use while
+ * the display is turned off, such as drawing alphabets and shapes.
+ * These gestures can be interpreted by userspace to activate certain
+ * actions and launch certain apps, such as to skip music tracks,
+ * to turn on the flashlight, or to launch the camera app.
+ *
+ * This *should always* be supported by the hardware directly.
+ * A lot of recent touch controllers have a firmware option for this.
+ *
+ * This API provides support for enumerating the gestures
+ * supported by the touchscreen.
+ */
+public class TouchscreenGestures {
+
+ /**
+ * Whether device supports touchscreen gestures
+ *
+ * @return boolean Supported devices must return always true
+ */
+ public static boolean isSupported() {
+ return false;
+ }
+
+ /*
+ * Get the list of available gestures. A mode has an integer
+ * identifier and a string name.
+ *
+ * It is the responsibility of the upper layers to
+ * map the name to a human-readable format or perform translation.
+ *
+ * @return TouchscreenGesture[] An array of the touchscreen gestures
+ * available on a device
+ */
+ public static TouchscreenGesture[] getAvailableGestures() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * This method allows to set the activation status of a gesture
+ *
+ * @param gesture The gesture to be activated
+ * state The new activation status of the gesture
+ *
+ * @return boolean Must be false if gesture is not supported
+ * or the operation failed; true in any other case.
+ */
+ public static boolean setGestureEnabled(
+ final TouchscreenGesture gesture, final boolean state) {
+ return false;
+ }
+}