refactor: Pass swipe down gesture notifications panel to native touch controller (#7448)

* refactor: Pass swipe down gesture over to native touch controller

* chore: Spotlessified

* fix: Apply reviewer
This commit is contained in:
Pun Butrach authored and GitHub committed 2026-10-27 22:34:29 +07:00
1 parent e53dcc5c42
commit 7436e7408d
3 files changed
+58 -22

No files matched your search

@@ -52,6 +52,8 @@ import java.util.function.Supplier;
import java.lang.reflect.InvocationTargetException;
import app.lawnchair.LawnchairAppKt;
import app.lawnchair.LawnchairLauncher;
import app.lawnchair.gestures.config.GestureHandlerConfig;
import app.lawnchair.util.CompatibilityKt;
/**
@@ -95,10 +97,11 @@ public class StatusBarTouchController implements TouchController {
private void dispatchTouchEvent(MotionEvent ev) {
if (mSystemUiProxy.isActive()) {
// LC-Note: If a proxy is active, pass the motion over to the proxy
mLastAction = ev.getActionMasked();
mSystemUiProxy.onStatusBarTouchEvent(ev);
} else if (!mExpanded) {
// LC-Note: For pulling down on notification panel (default gesture config)
// LC-Note: If not, call the notification panel via reflection (no animations)
mExpanded = true;
expand();
}
@@ -110,13 +113,18 @@ public class StatusBarTouchController implements TouchController {
@SuppressLint({"WrongConstant", "PrivateApi"})
private void expand() {
// LC-Note: For pulling down on notification panel (default gesture config)
try {
Class.forName("android.app.StatusBarManager")
.getMethod("expandNotificationsPanel")
.invoke(mLauncher.getSystemService("statusbar"));
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
e.printStackTrace();
// LC-Note: For pulling down on notification panel
if (mLauncher instanceof LawnchairLauncher launcher) {
launcher.getGestureController().handle(GestureHandlerConfig.OpenNotifications.INSTANCE);
} else {
// LC-Note: Fallback using older style for expanding the notifications panel
try {
Class.forName("android.app.StatusBarManager")
.getMethod("expandNotificationsPanel")
.invoke(mLauncher.getSystemService("statusbar"));
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
@@ -235,6 +243,7 @@ public class StatusBarTouchController implements TouchController {
}
}
return true;
// LC-Ignored: return SystemUiProxy.INSTANCE.get(mLauncher).isActive();
// LC-Ignored: Always intercept downward swipes on all devices regardless if a proxy is active or not.
// return SystemUiProxy.INSTANCE.get(mLauncher).isActive();
}
}