aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Tomin <highwaystar.ru@gmail.com>2017-11-11 14:14:05 +0800
committerWzedlare <vedatak01@gmail.com>2017-11-14 11:43:15 +0000
commit754051df986a3cab24ba42c2266de638e83424fa (patch)
tree3c448b8af826997df8bac721d80cc669af5da544
parent962c97a97aa565620fd0beb12e944fe5e1c6ecf3 (diff)
kuntao: Implement fingerprint gestures as KeyDisabler
* fingeprint gestures can be enabled by calling jni function from libvcfp.so. It has to be loaded into com.synaptics.fingerprint.Fingerprint class * added minimal needed synaptics Fingerprint and FingerprintCore classes * added dummy classes that presense checked on jni library init com/synaptics/fingerprint/CapturedImageData com/synaptics/fingerprint/DeviceInfo com/synaptics/fingerprint/EnrollProgress com/synaptics/fingerprint/EnrollResult com/synaptics/fingerprint/FingerprintEvent com/synaptics/fingerprint/IdentifyResult com/synaptics/fingerprint/NavigationReport com/synaptics/fingerprint/NavigationEvent * added libvcfp.so to proprietary-files.txt * adjusted init files and overlay to enable KeyDisabler * added keylayot for single touch (keycode 562) and long touch (keycode 563) Change-Id: I5b1e765501fe5727d10574af88c70af186667a28 Signed-off-by: Subhaam <derksoul98@gmail.com> Signed-off-by: FireLord1 <firelord.xda@lineageos.org>
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/Fingerprint.java59
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/FingerprintCore.java63
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/KeyDisabler.java63
-rw-r--r--cmhw/src/org/cyanogenmod/hardware/SynapticsDummy.java47
-rw-r--r--device.mk4
-rw-r--r--keylayout/Validity_Navigation_Sensor.idc16
-rw-r--r--keylayout/Validity_Navigation_Sensor.kl16
-rw-r--r--overlay/frameworks/base/core/res/res/values/config.xml2
-rw-r--r--overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml22
9 files changed, 290 insertions, 2 deletions
diff --git a/cmhw/src/org/cyanogenmod/hardware/Fingerprint.java b/cmhw/src/org/cyanogenmod/hardware/Fingerprint.java
new file mode 100644
index 0000000..a95fc1b
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/Fingerprint.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 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 com.synaptics.fingerprint;
+
+import android.content.Context;
+import android.util.Log;
+
+public class Fingerprint extends FingerprintCore {
+
+ //dummy jni functions to suppress errors
+ private native int jniEnableSensorDevice(int i);
+
+ private native int jniEnrollUser(Object obj);
+
+ private native int jniGetTUIDList(Object obj, Object obj2);
+
+ private native int jniNavGetConfig(Object obj);
+
+ private native int jniNavSetConfig(Object obj);
+
+ private native int jniNotify(int i, Object obj);
+
+ private native int jniRemoveEnrolledFinger(Object obj);
+
+ private native int jniRequest(int i, Object obj);
+
+ //actually used jni functions (redeclared to static)
+ private static native int jniEnableNav(boolean z);
+
+ private static native boolean jniIsNavEnabled();
+
+ public Fingerprint(Context context) {
+ super(context);
+ }
+
+ public static int enableNav(boolean z) {
+ return jniEnableNav(z);
+ }
+
+ public static boolean isNavEnabled() {
+ return jniIsNavEnabled();
+ }
+
+
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/FingerprintCore.java b/cmhw/src/org/cyanogenmod/hardware/FingerprintCore.java
new file mode 100644
index 0000000..cd1e67f
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/FingerprintCore.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 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 com.synaptics.fingerprint;
+
+import android.content.Context;
+import android.util.Log;
+
+public class FingerprintCore {
+ protected static final String TAG = "Fingerprint";
+ protected Context mContext = null;
+
+ private native int jniCancelOp();
+
+ private native int jniCleanupVcs();
+
+ private native int jniGetEnrolledFingerList(String str, VcsInt vcsInt);
+
+ private native int jniGetFingerprintImage();
+
+ private native Object[] jniGetUserList(VcsInt vcsInt);
+
+ private native String jniGetVersion();
+
+ private native int jniIdentify(String str);
+
+ private native int jniIdentifyEx(String str, Object obj);
+
+ private native int jniInitVcs(FingerprintCore fingerprintCore);
+
+ public FingerprintCore(Context context) {
+ this.mContext = context;
+ int jniInitVcs = jniInitVcs(this);
+ if (jniInitVcs != 0) {
+ Log.e(TAG, "Initialization failed, result:" + jniInitVcs);
+ }
+ }
+
+ public synchronized void FingerprintEventCallback(FingerprintEvent fingerprintEvent) {
+ }
+
+ static {
+ try {
+ System.loadLibrary("vcsfp");
+ } catch (Throwable th) {
+ Log.e(TAG, "Error loading library libvcsfp: " + th);
+ }
+ }
+
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/KeyDisabler.java b/cmhw/src/org/cyanogenmod/hardware/KeyDisabler.java
new file mode 100644
index 0000000..5c9956d
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/KeyDisabler.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014 The CyanogenMod Project
+ * Copyright (C) 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 android.util.Log;
+import com.synaptics.fingerprint.Fingerprint;
+/*
+ * Disable fingerprint gestures
+ */
+
+public class KeyDisabler {
+
+ public static final String TAG = "KeyDisabler";
+
+ private static boolean initOk = false;
+ private static Fingerprint mFingerprint = new Fingerprint(null);
+
+
+ /*
+ * Return true only if jni load didn't fail
+ */
+
+ public static boolean isSupported() {
+ Log.i(TAG, "isSupported return: " + true);
+ return true;
+ }
+
+ /*
+ * Are the fingerprint gestures currently disabled?
+ */
+
+ public static boolean isActive() {
+ Log.i(TAG, "isActive return: " + Fingerprint.isNavEnabled());
+ return Fingerprint.isNavEnabled();
+ }
+
+ /*
+ * Disable fingerprint gestures
+ */
+
+ public static boolean setActive(boolean state) {
+ Log.i(TAG, "setActive: " + !state);
+ int enableRet = Fingerprint.enableNav(!state);
+ Log.i(TAG, "enableNav ret: " + enableRet);
+ return enableRet == 0;
+ }
+
+}
diff --git a/cmhw/src/org/cyanogenmod/hardware/SynapticsDummy.java b/cmhw/src/org/cyanogenmod/hardware/SynapticsDummy.java
new file mode 100644
index 0000000..42b61f2
--- /dev/null
+++ b/cmhw/src/org/cyanogenmod/hardware/SynapticsDummy.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 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 com.synaptics.fingerprint;
+
+//set of dummy classes from SystemNavigation.apk (stock) to suppress errors
+
+class CapturedImageData {
+}
+
+class DeviceInfo {
+}
+
+class EnrollProgress {
+}
+
+class EnrollResult {
+}
+
+class FingerprintEvent {
+}
+
+class IdentifyResult {
+}
+
+class NavigationReport {
+}
+
+class NavigationEvent {
+}
+
+class VcsInt {
+ public int num;
+}
diff --git a/device.mk b/device.mk
index be102a3..5a9bc25 100644
--- a/device.mk
+++ b/device.mk
@@ -157,7 +157,9 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/keylayout/synaptics_dsx.kl:system/usr/keylayout/synaptics_dsx.kl \
$(LOCAL_PATH)/keylayout/synaptics_dsx_i2c.kl:system/usr/keylayout/synaptics_dsx_i2c.kl \
$(LOCAL_PATH)/keylayout/synaptics_dsxv26.kl:system/usr/keylayout/synaptics_dsxv26.kl \
- $(LOCAL_PATH)/keylayout/synaptics_rmi4_i2c.kl:system/usr/keylayout/synaptics_rmi4_i2c.kl
+ $(LOCAL_PATH)/keylayout/synaptics_rmi4_i2c.kl:system/usr/keylayout/synaptics_rmi4_i2c.kl \
+ $(LOCAL_PATH)/keylayout/Validity_Navigation_Sensor.idc:system/usr/idc/Validity_Navigation_Sensor.idc \
+ $(LOCAL_PATH)/keylayout/Validity_Navigation_Sensor.kl:system/usr/keylayout/Validity_Navigation_Sensor.kl
# Lights
PRODUCT_PACKAGES += \
diff --git a/keylayout/Validity_Navigation_Sensor.idc b/keylayout/Validity_Navigation_Sensor.idc
new file mode 100644
index 0000000..807889c
--- /dev/null
+++ b/keylayout/Validity_Navigation_Sensor.idc
@@ -0,0 +1,16 @@
+# Copyright (c) 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.
+
+keyboard.orientationAware = 1
+keyboard.builtIn = 1
diff --git a/keylayout/Validity_Navigation_Sensor.kl b/keylayout/Validity_Navigation_Sensor.kl
new file mode 100644
index 0000000..fefcad7
--- /dev/null
+++ b/keylayout/Validity_Navigation_Sensor.kl
@@ -0,0 +1,16 @@
+# Copyright (c) 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.
+
+key 562 BACK
+key 563 APP_SWITCH
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 914343f..a33ab5b 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -255,7 +255,7 @@
<!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
autodetected from the Configuration. -->
- <bool name="config_showNavigationBar">true</bool>
+ <bool name="config_showNavigationBar">false</bool>
<!-- Boolean indicating whether the wifi chipset has background scan support -->
<bool name="config_wifi_background_scan_support">true</bool>
diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
new file mode 100644
index 0000000..58df8cc
--- /dev/null
+++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, The Android Open Source 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.
+ */
+-->
+<resources>
+ <!-- Defaults for Settings.System.DEV_FORCE_SHOW_NAVBAR. -->
+ <integer name="def_force_disable_navkeys">1</integer>
+</resources>