summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lartsev <AlexLartsev19@users.noreply.github.com>2016-09-18 02:26:40 +0300
committerMoyster <oysterized@gmail.com>2016-09-26 12:49:04 +0200
commit9fdb7fc02fe165a271c6aac8f893d641b333440c (patch)
treedbc1c0557636d7e17d03de4be2ebc663747d7a14
parentc41256c5993c41f9d9feda67424207055b5822ec (diff)
Upload KeyDisabler.java
Now we can enable/disable virtual navigation keys into Settings
-rw-r--r--cmhw/org/cyanogenmod/hardware/KeyDisabler.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/cmhw/org/cyanogenmod/hardware/KeyDisabler.java b/cmhw/org/cyanogenmod/hardware/KeyDisabler.java
new file mode 100644
index 0000000..a01e708
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/KeyDisabler.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod 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 org.cyanogenmod.internal.util.FileUtils;
+
+/*
+ * Disable capacitive keys
+ *
+ * This is intended for use on devices in which the capacitive keys
+ * can be fully disabled for replacement with a soft navbar. You
+ * really should not be using this on a device with mechanical or
+ * otherwise visible-when-inactive keys
+ */
+
+public class KeyDisabler {
+
+ private static String CONTROL_PATH = "/proc/touchpanel/keypad_enable";
+
+ public static boolean isSupported() {
+ return FileUtils.isFileWritable(CONTROL_PATH);
+ }
+
+ public static boolean isActive() {
+ return FileUtils.readOneLine(CONTROL_PATH).equals("0");
+ }
+
+ public static boolean setActive(boolean state) {
+ return FileUtils.writeLine(CONTROL_PATH, (state ? "0" : "1"));
+ }
+}