[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 257e49ff0d3: Fix crash between Android 4.0 and Android 5
From: |
Po Lu |
Subject: |
feature/android 257e49ff0d3: Fix crash between Android 4.0 and Android 5.1 |
Date: |
Wed, 5 Jul 2023 02:57:35 -0400 (EDT) |
branch: feature/android
commit 257e49ff0d333cd5b9967613cb14051d54dd054b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix crash between Android 4.0 and Android 5.1
* java/org/gnu/emacs/EmacsService.java (detectMouse): Don't use
function that is not present on Android 4.0.
---
java/org/gnu/emacs/EmacsService.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/java/org/gnu/emacs/EmacsService.java
b/java/org/gnu/emacs/EmacsService.java
index 820befb52d2..e1fd2dbffda 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -491,6 +491,8 @@ public final class EmacsService extends Service
int i;
if (Build.VERSION.SDK_INT
+ /* Android 4.0 and earlier don't support mouse input events at
+ all. */
< Build.VERSION_CODES.JELLY_BEAN)
return false;
@@ -504,8 +506,20 @@ public final class EmacsService extends Service
if (device == null)
continue;
- if (device.supportsSource (InputDevice.SOURCE_MOUSE))
- return true;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
+ {
+ if (device.supportsSource (InputDevice.SOURCE_MOUSE))
+ return true;
+ }
+ else
+ {
+ /* `supportsSource' is only present on API level 21 and
+ later, but earlier versions provide a bit mask
+ containing each supported source. */
+
+ if ((device.getSources () & InputDevice.SOURCE_MOUSE) != 0)
+ return true;
+ }
}
return false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/android 257e49ff0d3: Fix crash between Android 4.0 and Android 5.1,
Po Lu <=