mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-12 14:30:42 -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:
parent
fa9791fe6a
commit
7df66b4762
7 changed files with 457 additions and 254 deletions
|
|
@ -50,7 +50,7 @@ import android.view.WindowInsetsController;
|
|||
import android.widget.FrameLayout;
|
||||
|
||||
public class EmacsActivity extends Activity
|
||||
implements EmacsWindowAttachmentManager.WindowConsumer,
|
||||
implements EmacsWindowManager.WindowConsumer,
|
||||
ViewTreeObserver.OnGlobalLayoutListener
|
||||
{
|
||||
public static final String TAG = "EmacsActivity";
|
||||
|
|
@ -218,7 +218,7 @@ public class EmacsActivity extends Activity
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void
|
||||
public void
|
||||
onCreate (Bundle savedInstanceState)
|
||||
{
|
||||
FrameLayout.LayoutParams params;
|
||||
|
|
@ -249,7 +249,7 @@ public class EmacsActivity extends Activity
|
|||
EmacsService.startEmacsService (this);
|
||||
|
||||
/* Add this activity to the list of available activities. */
|
||||
EmacsWindowAttachmentManager.MANAGER.registerWindowConsumer (this);
|
||||
EmacsWindowManager.MANAGER.registerWindowConsumer (this);
|
||||
|
||||
/* Start observing global layout changes between Jelly Bean and Q.
|
||||
This is required to restore the fullscreen state whenever the
|
||||
|
|
@ -326,16 +326,16 @@ public class EmacsActivity extends Activity
|
|||
public final void
|
||||
onDestroy ()
|
||||
{
|
||||
EmacsWindowAttachmentManager manager;
|
||||
boolean isMultitask;
|
||||
EmacsWindowManager manager;
|
||||
boolean isMultitask, reallyFinishing;
|
||||
|
||||
manager = EmacsWindowAttachmentManager.MANAGER;
|
||||
manager = EmacsWindowManager.MANAGER;
|
||||
|
||||
/* The activity will die shortly hereafter. If there is a window
|
||||
attached, close it now. */
|
||||
isMultitask = this instanceof EmacsMultitaskActivity;
|
||||
manager.removeWindowConsumer (this, (isMultitask
|
||||
|| isReallyFinishing ()));
|
||||
reallyFinishing = isReallyFinishing ();
|
||||
manager.removeWindowConsumer (this, isMultitask || reallyFinishing);
|
||||
focusedActivities.remove (this);
|
||||
invalidateFocus (2);
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ public class EmacsActivity extends Activity
|
|||
{
|
||||
isPaused = true;
|
||||
|
||||
EmacsWindowAttachmentManager.MANAGER.noticeIconified (this);
|
||||
EmacsWindowManager.MANAGER.noticeIconified (this);
|
||||
super.onPause ();
|
||||
}
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ public class EmacsActivity extends Activity
|
|||
isPaused = false;
|
||||
timeOfLastInteraction = 0;
|
||||
|
||||
EmacsWindowAttachmentManager.MANAGER.noticeDeiconified (this);
|
||||
EmacsWindowManager.MANAGER.noticeDeiconified (this);
|
||||
super.onResume ();
|
||||
}
|
||||
|
||||
|
|
@ -538,6 +538,14 @@ public class EmacsActivity extends Activity
|
|||
|
||||
EmacsNative.sendNotificationAction (tag, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long
|
||||
getAttachmentToken ()
|
||||
{
|
||||
return -1; /* This is overridden by EmacsMultitaskActivity. */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue