diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsService.java | 12 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsWindowManager.java | 41 | ||||
| -rw-r--r-- | java/proguard.conf | 32 |
3 files changed, 66 insertions, 19 deletions
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index b8ff98e79a7..fd052653087 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java | |||
| @@ -234,6 +234,8 @@ public final class EmacsService extends Service | |||
| 234 | final double scaledDensity; | 234 | final double scaledDensity; |
| 235 | double tempScaledDensity; | 235 | double tempScaledDensity; |
| 236 | 236 | ||
| 237 | super.onCreate (); | ||
| 238 | |||
| 237 | SERVICE = this; | 239 | SERVICE = this; |
| 238 | handler = new Handler (Looper.getMainLooper ()); | 240 | handler = new Handler (Looper.getMainLooper ()); |
| 239 | manager = getAssets (); | 241 | manager = getAssets (); |
| @@ -247,9 +249,9 @@ public final class EmacsService extends Service | |||
| 247 | resolver = getContentResolver (); | 249 | resolver = getContentResolver (); |
| 248 | mainThread = Thread.currentThread (); | 250 | mainThread = Thread.currentThread (); |
| 249 | 251 | ||
| 250 | /* If the density used to compute the text size is lesser than | 252 | /* If the density used to compute the text size is smaller than 160, |
| 251 | 160, there's likely a bug with display density computation. | 253 | there's likely a bug with display density computation. Reset it |
| 252 | Reset it to 160 in that case. | 254 | to 160 in that case. |
| 253 | 255 | ||
| 254 | Note that Android uses 160 ``dpi'' as the density where 1 point | 256 | Note that Android uses 160 ``dpi'' as the density where 1 point |
| 255 | corresponds to 1 pixel, not 72 or 96 as used elsewhere. This | 257 | corresponds to 1 pixel, not 72 or 96 as used elsewhere. This |
| @@ -262,6 +264,10 @@ public final class EmacsService extends Service | |||
| 262 | the nested function below. */ | 264 | the nested function below. */ |
| 263 | scaledDensity = tempScaledDensity; | 265 | scaledDensity = tempScaledDensity; |
| 264 | 266 | ||
| 267 | /* Remove all tasks from previous Emacs sessions but the task | ||
| 268 | created by the system at startup. */ | ||
| 269 | EmacsWindowManager.MANAGER.removeOldTasks (this); | ||
| 270 | |||
| 265 | try | 271 | try |
| 266 | { | 272 | { |
| 267 | /* Configure Emacs with the asset manager and other necessary | 273 | /* Configure Emacs with the asset manager and other necessary |
diff --git a/java/org/gnu/emacs/EmacsWindowManager.java b/java/org/gnu/emacs/EmacsWindowManager.java index a193d49d0ec..49f0ebd5841 100644 --- a/java/org/gnu/emacs/EmacsWindowManager.java +++ b/java/org/gnu/emacs/EmacsWindowManager.java | |||
| @@ -27,6 +27,7 @@ import android.app.ActivityManager.RecentTaskInfo; | |||
| 27 | import android.app.ActivityManager; | 27 | import android.app.ActivityManager; |
| 28 | import android.app.ActivityOptions; | 28 | import android.app.ActivityOptions; |
| 29 | 29 | ||
| 30 | import android.content.ComponentName; | ||
| 30 | import android.content.Context; | 31 | import android.content.Context; |
| 31 | import android.content.Intent; | 32 | import android.content.Intent; |
| 32 | 33 | ||
| @@ -385,4 +386,44 @@ public final class EmacsWindowManager | |||
| 385 | window.onActivityDetached (); | 386 | window.onActivityDetached (); |
| 386 | } | 387 | } |
| 387 | } | 388 | } |
| 389 | |||
| 390 | /* Iterate over each of Emacs's tasks to delete such as belong to a | ||
| 391 | previous Emacs session, i.e., tasks created for a previous | ||
| 392 | session's non-initial frames. CONTEXT should be a context from | ||
| 393 | which to obtain a reference to the activity manager. */ | ||
| 394 | |||
| 395 | public void | ||
| 396 | removeOldTasks (Context context) | ||
| 397 | { | ||
| 398 | List<AppTask> appTasks; | ||
| 399 | RecentTaskInfo info; | ||
| 400 | ComponentName name; | ||
| 401 | String target; | ||
| 402 | Object object; | ||
| 403 | |||
| 404 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) | ||
| 405 | return; | ||
| 406 | |||
| 407 | if (activityManager == null) | ||
| 408 | { | ||
| 409 | object = context.getSystemService (Context.ACTIVITY_SERVICE); | ||
| 410 | activityManager = (ActivityManager) object; | ||
| 411 | } | ||
| 412 | |||
| 413 | appTasks = activityManager.getAppTasks (); | ||
| 414 | target = ".EmacsMultitaskActivity"; | ||
| 415 | |||
| 416 | for (AppTask task : appTasks) | ||
| 417 | { | ||
| 418 | info = task.getTaskInfo (); | ||
| 419 | |||
| 420 | /* Test whether info is a reference to | ||
| 421 | EmacsMultitaskActivity. */ | ||
| 422 | if (info.baseIntent != null | ||
| 423 | && (name = info.baseIntent.getComponent ()) != null | ||
| 424 | && name.getShortClassName ().equals (target)) | ||
| 425 | /* Delete the task. */ | ||
| 426 | task.finishAndRemoveTask (); | ||
| 427 | } | ||
| 428 | } | ||
| 388 | }; | 429 | }; |
diff --git a/java/proguard.conf b/java/proguard.conf index e6b08f76fe4..5da402946bb 100644 --- a/java/proguard.conf +++ b/java/proguard.conf | |||
| @@ -20,22 +20,22 @@ | |||
| 20 | # The effect of the following lines is to inhibit the removal of variable or | 20 | # The effect of the following lines is to inhibit the removal of variable or |
| 21 | # method symbol names from symbols referenced from C. | 21 | # method symbol names from symbols referenced from C. |
| 22 | 22 | ||
| 23 | -keep,allowoptimization class org.gnu.emacs.EmacsClipboard { <methods>; } | 23 | -keep,allowoptimization class org.gnu.emacs.EmacsClipboard { public <methods>; } |
| 24 | -keep,allowoptimization class org.gnu.emacs.EmacsContextMenu { <methods>; } | 24 | -keep,allowoptimization class org.gnu.emacs.EmacsContextMenu { public <methods>; } |
| 25 | -keep,allowoptimization class org.gnu.emacs.EmacsCursor { <methods>; } | 25 | -keep,allowoptimization class org.gnu.emacs.EmacsCursor { public <methods>; } |
| 26 | -keep,allowoptimization class org.gnu.emacs.EmacsDesktopNotification { <methods>; } | 26 | -keep,allowoptimization class org.gnu.emacs.EmacsDesktopNotification { public <methods>; } |
| 27 | -keep,allowoptimization class org.gnu.emacs.EmacsDialog { <methods>; } | 27 | -keep,allowoptimization class org.gnu.emacs.EmacsDialog { public <methods>; } |
| 28 | -keep,allowoptimization class org.gnu.emacs.EmacsDirectoryEntry { <fields>; } | 28 | -keep,allowoptimization class org.gnu.emacs.EmacsDirectoryEntry { public <fields>; } |
| 29 | -keep,allowoptimization class org.gnu.emacs.EmacsFontDriver { <methods>; } | 29 | -keep,allowoptimization class org.gnu.emacs.EmacsFontDriver { public <methods>; } |
| 30 | -keep,allowoptimization class org.gnu.emacs.EmacsFontDriver$* { <fields>; } | 30 | -keep,allowoptimization class org.gnu.emacs.EmacsFontDriver$* { public <fields>; } |
| 31 | -keep,allowoptimization class org.gnu.emacs.EmacsGC { <methods>; <fields>; } | 31 | -keep,allowoptimization class org.gnu.emacs.EmacsGC { public <methods>; public <fields>; } |
| 32 | -keep,allowoptimization class org.gnu.emacs.EmacsHandleObject { <methods>; } | 32 | -keep,allowoptimization class org.gnu.emacs.EmacsHandleObject { public <methods>; } |
| 33 | -keep,allowoptimization class org.gnu.emacs.EmacsPixmap { <methods>; } | 33 | -keep,allowoptimization class org.gnu.emacs.EmacsPixmap { public <methods>; } |
| 34 | -keep,allowoptimization class org.gnu.emacs.EmacsService { <methods>; } | 34 | -keep,allowoptimization class org.gnu.emacs.EmacsService { public <methods>; } |
| 35 | -keep,allowoptimization class org.gnu.emacs.EmacsWindow { <methods>; } | 35 | -keep,allowoptimization class org.gnu.emacs.EmacsWindow { public <methods>; } |
| 36 | -keep,allowoptimization class org.gnu.emacs.EmacsNative { <methods>; } | 36 | -keep,allowoptimization class org.gnu.emacs.EmacsNative { public <methods>; } |
| 37 | -keep,allowoptimization class org.gnu.emacs.EmacsNoninteractive { <methods>; } | 37 | -keep,allowoptimization class org.gnu.emacs.EmacsNoninteractive { public <methods>; } |
| 38 | -keep,allowoptimization interface org.gnu.emacs.EmacsDrawable { <methods>; } | 38 | -keep,allowoptimization interface org.gnu.emacs.EmacsDrawable { public <methods>; } |
| 39 | 39 | ||
| 40 | # And these lines inhibit the deletion of symbols that are referenced by | 40 | # And these lines inhibit the deletion of symbols that are referenced by |
| 41 | # the operating system while enabling the compiler to minify or delete | 41 | # the operating system while enabling the compiler to minify or delete |