RK 全志 Android 10 && Android 11 去掉连点power键打开相机
问题描述
在进行RkAndroid 11 的定制中 遇到一个问题,客户在连点power键之后发现会打开相机,需要去掉指定功能
定位问题发现是调用了isCameraLiftTriggerEnabled这个方法,使用的是config_cameraLiftTriggerSensorType的属性去判断是否打开相机。最终定位到问题
最终修改的文件是在
frameworks/base/core/res/res/values/config.xml
修改方案如下
--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -3258,7 +3258,7 @@
<!-- Allow the gesture to double tap the power button twice to start the camera while the device
is non-interactive. -->
- <bool name="config_cameraDoubleTapPowerGestureEnabled">false</bool>
+ <bool name="config_cameraDoubleTapPowerGestureEnabled">true</bool>
<!-- Allow the gesture to double tap the volumeup button twice to start the camera while the device
is non-interactive. -->
总结
android很多的配置都是由xml文件的属性控制,认真查看代码最终都能找到具体是哪个属性控制的,建议有空的时候可以去review下,看一下整个调用过程,会让自己颇有收获。
每日赠言
历史的铁则就是:事后看来无可避免的事,在当时看来总是毫不明显。