这是我的辅助功能资源的元数据资源:
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackAllMask"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagIncludeNotImportantViews"
android:canRetrieveWindowContent="true"
android:canRequestTouchExplorationMode="true"
android:canRequestFilterKeyEvents="true"
/>
我的辅助功能服务类代码
public class MyAccessibilityService extends AccessibilityService {
@Override
protected void onServiceConnected() {
super.onServiceConnected();
Log.d("caller","service connected");
}
@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
Log.d("caller","onAccessibilityEvent Called");
}
@Override
protected boolean onGesture(int gestureId) {
Log.d("caller","on guesture called");
return super.onGesture(gestureId);
}
我已尝试将accessebilityFlags设置为flagRequestFingerprintGestures仍然无法正常工作。
答案 0 :(得分:0)
手势事件仅在触摸探索模式下发送。我看到你已经在你的xml中启用了这个功能,但是我没有看到实际请求打开它的代码。
这是您需要添加到xml
的标志android:accessibilityFlags="flagIncludeNotImportantViews|flagRequestTouchExplorationMode"