From b15ba779ea778df799a239711ada43bdb627cd45 Mon Sep 17 00:00:00 2001 From: Xtr126 Date: Sun, 25 Feb 2024 21:59:44 +0530 Subject: [PATCH] fix: check if cursorView is null --- app/src/main/java/xtr/keymapper/server/RemoteService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/xtr/keymapper/server/RemoteService.java b/app/src/main/java/xtr/keymapper/server/RemoteService.java index a15ec35a..663b3531 100644 --- a/app/src/main/java/xtr/keymapper/server/RemoteService.java +++ b/app/src/main/java/xtr/keymapper/server/RemoteService.java @@ -37,7 +37,7 @@ public class RemoteService extends IRemoteService.Stub { private ActivityObserverService activityObserverService; String nativeLibraryDir = System.getProperty("java.library.path"); private View cursorView; - private Context context; + private Context context = null; private int TYPE_SECURE_SYSTEM_OVERLAY; Handler mHandler = new Handler(Looper.getMainLooper()); @@ -170,7 +170,8 @@ private boolean addNewDevices(String[] data) { public void startServer(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback cb, int screenWidth, int screenHeight) throws RemoteException { if (inputService != null) stopServer(); cb.asBinder().linkToDeath(this::stopServer, 0); - addCursorView(); + if (cursorView != null && !keymapConfig.pointerMode.equals(KeymapConfig.POINTER_SYSTEM)) + addCursorView(); inputService = new InputService(profile, keymapConfig, cb, screenWidth, screenHeight, cursorView, isWaylandClient); if (!isWaylandClient) { inputService.setMouseLock(true); @@ -188,7 +189,7 @@ public void stopServer() { inputService.destroyUinputDev(); inputService = null; } - removeCursorView(); + if (cursorView != null) removeCursorView(); } private final DeathRecipient mDeathRecipient = () -> mOnKeyEventListener = null;