diff options
| author | Po Lu | 2025-02-07 11:11:51 +0800 |
|---|---|---|
| committer | Po Lu | 2025-02-07 11:11:51 +0800 |
| commit | 1751739152149608d28853782ce53b0b9a749bb2 (patch) | |
| tree | 0fb801cae54f132d75657f2dda116b5df6921a6f /java | |
| parent | be316dc1c74fc547fe83c0426fdec3ffd4e5fb1f (diff) | |
| download | emacs-1751739152149608d28853782ce53b0b9a749bb2.tar.gz emacs-1751739152149608d28853782ce53b0b9a749bb2.zip | |
Prevent crash when requesting storage permissions on Android
* java/org/gnu/emacs/EmacsService.java (requestStorageAccess30):
Handle ActivityNotFoundException.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsService.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index 04563590dc4..5225337a826 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java | |||
| @@ -54,6 +54,7 @@ import android.app.NotificationManager; | |||
| 54 | import android.app.PendingIntent; | 54 | import android.app.PendingIntent; |
| 55 | import android.app.Service; | 55 | import android.app.Service; |
| 56 | 56 | ||
| 57 | import android.content.ActivityNotFoundException; | ||
| 57 | import android.content.ClipboardManager; | 58 | import android.content.ClipboardManager; |
| 58 | import android.content.Context; | 59 | import android.content.Context; |
| 59 | import android.content.ContentResolver; | 60 | import android.content.ContentResolver; |
| @@ -2092,7 +2093,15 @@ public final class EmacsService extends Service | |||
| 2092 | 2093 | ||
| 2093 | /* Now request these permissions. */ | 2094 | /* Now request these permissions. */ |
| 2094 | 2095 | ||
| 2095 | activity.startActivity (intent); | 2096 | try |
| 2097 | { | ||
| 2098 | activity.startActivity (intent); | ||
| 2099 | } | ||
| 2100 | catch (ActivityNotFoundException exception) | ||
| 2101 | { | ||
| 2102 | Log.w (TAG, "Failed to request storage access permissions: "); | ||
| 2103 | exception.printStackTrace (); | ||
| 2104 | } | ||
| 2096 | } | 2105 | } |
| 2097 | }; | 2106 | }; |
| 2098 | 2107 | ||