1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-04 21:12:23 -08:00

Better align Emacs window management with Android task lifecycles

* java/org/gnu/emacs/EmacsActivity.java (onCreate): Permit
overriding by child classes.
(onDestroy): Minor stylistic adjustments.
(getAttachmentToken): New function.

* java/org/gnu/emacs/EmacsMultitaskActivity.java (onCreate)
(getAttachmentToken): New functions.

* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow):
<attachmentToken, preserve, previouslyAttached>: New variables.
(onActivityDetached): Remove redundant isFinishing argument.
(reparentTo): Reset the foregoing fields before registering with
the window manager.

* java/org/gnu/emacs/EmacsWindowManager.java
(EmacsWindowManager): Rename from EmacsWindowAttachmentManager.
(WindowConsumer): New function getAttachmentToken.
(isWindowEligible): New function.
(registerWindowConsumer, registerWindow, removeWindowConsumer)
(detachWindow): Implement a new window management strategy on
API 29 and subsequent releases where both varieties of toplevel
window are permanently, except when reparented, bound to the
activities to which they attach, and Emacs establishes at
strategic junctures whether those activities remain present.
(getTaskToken, pruneWindows): New functions.
This commit is contained in:
Po Lu 2024-04-03 20:29:10 +08:00
parent fa9791fe6a
commit 7df66b4762
7 changed files with 457 additions and 254 deletions

View file

@ -19,11 +19,39 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
package org.gnu.emacs;
/* This class only exists because EmacsActivity is already defined as
an activity, and the system wants a new class in order to define a
new activity. */
import android.content.Intent;
import android.os.Bundle;
/* In large measure, this class only exists because EmacsActivity is
already defined as an activity, and the system requires that every
new activity be defined by a new class. */
public final class EmacsMultitaskActivity extends EmacsActivity
{
/* Token provided by the creator. */
private long activityToken;
}
@Override
public final void
onCreate (Bundle savedInstanceState)
{
Intent intent;
String token;
intent = getIntent ();
token = EmacsWindowManager.ACTIVITY_TOKEN;
if (intent != null)
activityToken = intent.getLongExtra (token, -2);
super.onCreate (savedInstanceState);
}
@Override
public final long
getAttachmentToken ()
{
return activityToken;
}
};