Last active
December 17, 2015 16:34
-
-
Save luk1337/91fb1065e359204d4096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 94b2f58e075486971cd65f3d07d19b582f8e2e66 Mon Sep 17 00:00:00 2001 | |
From: LuK1337 <priv.luk@gmail.com> | |
Date: Thu, 17 Dec 2015 16:02:42 +0100 | |
Subject: [PATCH] [WIP] Enable flip gesture sensor | |
Change-Id: I7dc0e813e4f0bd1cf45f3eed322a8aff9ee64c38 | |
--- | |
.../frameworks/base/core/res/res/values/config.xml | 6 +++ | |
sensors/bst/hal/BstSensor.cpp | 4 +- | |
sensors/bst/hal/BstSensorInfo.cpp | 47 +++++++++++----------- | |
sensors/bst/hal/BstSensorType.h | 3 +- | |
sensors/bst/tools/moto_config.mk | 4 +- | |
5 files changed, 34 insertions(+), 30 deletions(-) | |
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml | |
index d74b7c3..0576ba5 100644 | |
--- a/overlay/frameworks/base/core/res/res/values/config.xml | |
+++ b/overlay/frameworks/base/core/res/res/values/config.xml | |
@@ -318,6 +318,12 @@ | |
so that applications can still use their own mechanisms. --> | |
<bool name="config_enableAutoPowerModes">true</bool> | |
+ <!-- The OEM specified sensor type for the gesture to launch the camear app. --> | |
+ <integer name="config_cameraLaunchGestureSensorType">24</integer> | |
+ <!-- The OEM specified sensor string type for the gesture to launch camera app, this value | |
+ must match the value of config_cameraLaunchGestureSensorType in OEM's HAL --> | |
+ <string translatable="false" name="config_cameraLaunchGestureSensorStringType">android.sensor.glance_gesture</string> | |
+ | |
<!-- Device configuration setting the minfree tunable in the lowmemorykiller in the | |
kernel. A high value will cause the lowmemorykiller to fire earlier, keeping more | |
memory in the file cache and preventing I/O thrashing, but allowing fewer processes | |
diff --git a/sensors/bst/hal/BstSensor.cpp b/sensors/bst/hal/BstSensor.cpp | |
index 74487f7..d3c7b83 100644 | |
--- a/sensors/bst/hal/BstSensor.cpp | |
+++ b/sensors/bst/hal/BstSensor.cpp | |
@@ -547,7 +547,7 @@ int BstSensor::readEvents(sensors_event_t *pdata, int count) { | |
pdata_cur->data[0] = sensor_data.data.data[0]; | |
pdata_cur->data[1] = sensor_data.data.data[1]; | |
pdata_cur->data[2] = sensor_data.data.data[2]; | |
- pdata_cur->type = BST_SENSOR_TYPE_GEST_FLIP; | |
+ pdata_cur->type = SENSOR_TYPE_GLANCE_GESTURE; | |
break; | |
#ifdef __UNCALIBRATED_VIRTUAL_SENSOR_SUPPORT__ | |
@@ -696,4 +696,4 @@ int BstSensor::batch(int id, int flags, int64_t period_ns, int64_t timeout) { | |
return ret; | |
} | |
-#endif | |
\ No newline at end of file | |
+#endif | |
diff --git a/sensors/bst/hal/BstSensorInfo.cpp b/sensors/bst/hal/BstSensorInfo.cpp | |
index 8847f1f..73365fa 100644 | |
--- a/sensors/bst/hal/BstSensorInfo.cpp | |
+++ b/sensors/bst/hal/BstSensorInfo.cpp | |
@@ -282,30 +282,29 @@ const struct sensor_t BstSensorInfo::g_bst_sensor_list[] = { | |
reserved : {} | |
}, | |
+ { | |
+ name: VENDOR_NAME_BST_SHORT BST_SENSOR_NAME_GEST_FLIP SENSOR_STR, | |
+ vendor: VENDOR_NAME_BST, | |
+ version: SENSOR_VER_BST, | |
+ handle: SENSORS_GEST_FLIP_HANDLE, | |
+ type: SENSOR_TYPE_GLANCE_GESTURE, | |
+ maxRange: 1.0f, | |
+ resolution: 1.0f, | |
+ power: 0.13f, | |
+ minDelay: 0, | |
+#if __HAL_VER__ >= __SENSORS_DEVICE_API_VERSION_1_1__ | |
+ fifoReservedEventCount: 0, | |
+ fifoMaxEventCount: 0, | |
+#endif | |
+#if __HAL_VER__ >= __SENSORS_DEVICE_API_VERSION_1_3__ | |
+ stringType: SENSOR_STRING_TYPE_GLANCE_GESTURE, | |
+ requiredPermission: "", | |
+ maxDelay: 200000, | |
+ flags: SENSOR_FLAG_ONE_SHOT_MODE | SENSOR_FLAG_WAKE_UP, | |
+#endif | |
+ reserved: {} | |
+ }, | |
-// { | |
-// name: VENDOR_NAME_BST_SHORT | |
-// BST_SENSOR_NAME_GEST_FLIP SENSOR_STR, | |
-// vendor: VENDOR_NAME_BST, | |
-// version: SENSOR_VER_BST, | |
-// handle: SENSORS_GEST_FLIP_HANDLE, | |
-// type: BST_SENSOR_TYPE_GEST_FLIP, | |
-// maxRange: 1.0f, | |
-// resolution: 1.0f, | |
-// power: 0.13f, | |
-// minDelay: 0, | |
-//#if __HAL_VER__ >= __SENSORS_DEVICE_API_VERSION_1_1__ | |
-// fifoReservedEventCount: 0, | |
-// fifoMaxEventCount: 0, | |
-//#endif | |
-//#if __HAL_VER__ >= __SENSORS_DEVICE_API_VERSION_1_3__ | |
-// stringType: "bosch.gest.flip.sensor", | |
-// requiredPermission: "", | |
-// maxDelay: 200000, | |
-// flags: 0, | |
-//#endif | |
-// reserved: {} | |
-// }, | |
// | |
// { | |
// name: VENDOR_NAME_BST_SHORT BST_SENSOR_NAME_SGM SENSOR_STR, | |
@@ -506,4 +505,4 @@ const struct sensor_t *BstSensorInfo::getSensor(int handle) { | |
} | |
return s; | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/sensors/bst/hal/BstSensorType.h b/sensors/bst/hal/BstSensorType.h | |
index bea1aeb..2761661 100644 | |
--- a/sensors/bst/hal/BstSensorType.h | |
+++ b/sensors/bst/hal/BstSensorType.h | |
@@ -24,7 +24,6 @@ | |
*/ | |
enum { | |
BST_SENSOR_TYPE_NONSTD_START = 24 - 1, | |
- BST_SENSOR_TYPE_GEST_FLIP, | |
BSTEXT_SENSOR_TYPE_SW_SGM, | |
#ifdef __DOUBLE_TAP_SENSOR_SUPPORT__ | |
BSTEXT_SENSOR_TYPE_DOUBLE_TAP, | |
@@ -32,4 +31,4 @@ enum { | |
BST_SENSOR_TYPE_NONSTD_END | |
}; | |
-#endif // __BST_SENSOR_TYPE_H | |
\ No newline at end of file | |
+#endif // __BST_SENSOR_TYPE_H | |
diff --git a/sensors/bst/tools/moto_config.mk b/sensors/bst/tools/moto_config.mk | |
index e3e7092..195dac1 100644 | |
--- a/sensors/bst/tools/moto_config.mk | |
+++ b/sensors/bst/tools/moto_config.mk | |
@@ -99,7 +99,7 @@ gyro_only ?= true | |
# information - print same or higher level than information, | |
# provide addtional information as reference | |
# debug - print same or higher level than debug, normally for develop engineer use | |
-debug_trace_level ?= error | |
+debug_trace_level ?= information | |
# add the flag to mark the data trace relative function. | |
# to reduce code/ram size when customer release | |
@@ -113,7 +113,7 @@ data_log_using_ram_buffer ?= true | |
# file - log file is stored at the path /data/misc/sensor/sensord.log | |
# logcat - log to android logcat, information can be retrieved by "adb logcat" | |
# notice : this macro must be enabled together with debug_trace_level | |
-debug_log_method ?= file | |
+debug_log_method ?= logcat | |
# debug timing accuracy of data sampling | |
# notice that this macro must be disabled before release | |
-- | |
2.6.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment