emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4fc37710788: Fix task-switching failures on Android 2.3


From: Po Lu
Subject: master 4fc37710788: Fix task-switching failures on Android 2.3
Date: Fri, 12 Apr 2024 23:29:04 -0400 (EDT)

branch: master
commit 4fc37710788cdab9ebf4264636999ba999a59547
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix task-switching failures on Android 2.3
    
    * java/org/gnu/emacs/EmacsWindowManager.java (registerWindow):
    Don't specify F_A_MULTIPLE_TASK on Android 4.4 and earlier.
---
 java/org/gnu/emacs/EmacsWindowManager.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/java/org/gnu/emacs/EmacsWindowManager.java 
b/java/org/gnu/emacs/EmacsWindowManager.java
index e41b4e068a7..a193d49d0ec 100644
--- a/java/org/gnu/emacs/EmacsWindowManager.java
+++ b/java/org/gnu/emacs/EmacsWindowManager.java
@@ -176,14 +176,20 @@ public final class EmacsWindowManager
     intent = new Intent (EmacsService.SERVICE,
                         EmacsMultitaskActivity.class);
 
-    intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK
-                    | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+    /* FLAG_ACTIVITY_MULTIPLE_TASK would appear appropriate, but that
+       is not so: on Android 2.3 and earlier, this flag combined with
+       FLAG_ACTIVITY_NEW_TASK prompts the task switcher to create a
+       new instance of EmacsMultitaskActivity, rather than return to
+       an existing instance, and is entirely redundant, inasmuch as
+       only one multitasking task can exist at any given moment.  */
+    intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
 
     /* Intent.FLAG_ACTIVITY_NEW_DOCUMENT is lamentably unavailable on
        older systems than Lolipop.  */
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
       {
-       intent.addFlags (Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
+       intent.addFlags (Intent.FLAG_ACTIVITY_NEW_DOCUMENT
+                        | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
 
        /* Bind this window to the activity in advance, i.e., before its
           creation, so that its ID will be recorded in the RecentTasks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]