1.前言
在开发Android13时,默认在下边缘起上划,调出SystemUI;但有客户需求如下:
在屏幕任何位置上划手势,调出SystemUI。
2.修改方法
修改framewore层代码,如下:
diff --git a/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java b/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
old mode 100644
new mode 100755
index dd2f41f..e7f95be
--- a/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
+++ b/services/core/java/com/android/server/wm/SystemGesturesPointerEventListener.java
@@ -306,16 +306,17 @@ class SystemGesturesPointerEventListener implements PointerEventListener {
return SWIPE_FROM_TOP;
}
+ if (((fromY >= screenHeight - mSwipeStartThreshold.bottom
+ && y < fromY - mSwipeDistanceThreshold) || (fromY - y >= MAX_SWIPE_UP_Y_THRESHOLD))
- // modify
- if (fromY >= screenHeight - mSwipeStartThreshold.bottom
- && y < fromY - mSwipeDistanceThreshold
&& elapsed < SWIPE_TIMEOUT_MS) {
return SWIPE_FROM_BOTTOM;
}
3.验证
通过cd frameworks/base && mmm services -j16编译验证即可。