diff options
| author | TheStrix <parthbhatia98@gmail.com> | 2016-11-08 17:38:00 +0530 |
|---|---|---|
| committer | TheStrix <parthbhatia98@gmail.com> | 2016-11-28 00:33:43 +0530 |
| commit | 28bd3ec04f0440a406087221289060936e4e4917 (patch) | |
| tree | a7e496252182c880d2d17142c2bfc2c5b0537ba2 | |
| parent | 148484a83e9bcf814407b85d6ed4863d0243d068 (diff) | |
hydrogen: Add KeyDisabler
Change-Id: Ia9ed5792d234e19a6bc5da8130cf5a380ae078db
| -rw-r--r-- | BoardConfig.mk | 3 | ||||
| -rw-r--r-- | cmhw/org/cyanogenmod/hardware/KeyDisabler.java | 46 | ||||
| -rw-r--r-- | rootdir/etc/init.target.rc | 2 |
3 files changed, 51 insertions, 0 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index fae2af2..827c0da 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -24,6 +24,9 @@ TARGET_OTA_ASSERT_DEVICE := hydrogen # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth +# CMHW +BOARD_HARDWARE_CLASS += $(DEVICE_PATH)/cmhw + # Filesystem BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 BOARD_USERDATAIMAGE_PARTITION_SIZE := 26705099776 # 26705116160 - 16384 diff --git a/cmhw/org/cyanogenmod/hardware/KeyDisabler.java b/cmhw/org/cyanogenmod/hardware/KeyDisabler.java new file mode 100644 index 0000000..0ae8ead --- /dev/null +++ b/cmhw/org/cyanogenmod/hardware/KeyDisabler.java @@ -0,0 +1,46 @@ +/* + * 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 = "/sys/bus/i2c/devices/i2c-4/4-0038/keypad_mode"; + + 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")); + } + +} diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc index 6dc3202..6cd6344 100644 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -30,6 +30,8 @@ on early-boot chown system radio /sys/bus/i2c/devices/i2c-4/4-0038/wakeup_mode chmod 0664 /sys/bus/i2c/devices/i2c-4/4-0038/wakeup_mode + chown system system /sys/bus/i2c/devices/i2c-4/4-0038/keypad_mode + chmod 0664 /sys/bus/i2c/devices/i2c-4/4-0038/keypad_mode service mmbn-daemon /system/bin/mmbn-daemon class main |
