0
点赞
收藏
分享

微信扫一扫

rk3568 android 11 系统手势识别

目标践行者 2022-04-13 阅读 50
androidarm

功能:监测系统的手势识别,应用根据不同手势进行不同功能的切换,或者根据不同手势切换不同第三方APP。

1.手势识别文件frameworks/base/services/core/java/com/android/server/wm/DisplayPolicy.java

mSystemGestures = new SystemGesturesPointerEventListener 在此之前定义一个广播Intent

swipeIntent = new Intent("com.max.swipe_action");

在onSwipeFromRight()中发送广播

        Intent swipeIntent.putExtra("swipe","right");

        mContext.sendBroadcast(swipeIntent);

在 onSwipeFromLeft() 中发送广播

        Intent swipeIntent.putExtra("swipe","left");

        mContext.sendBroadcast(swipeIntent);

2.在frameworks/base/core/res/AndroidManifest.xml中添加广播保护

<protected-broadcast android:name="com.max.swipe_action" />

3.上层APP写一个广播接收,可以根据收到的手势识别进行功能切换

4.也可以在系统广播接收中接收该广播进行功能切换。

举报

相关推荐

0 条评论