From e56e9c19545f43c35dec85fa650f3799c6e9c308 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 12 Nov 2023 11:44:58 +0800 Subject: Adjust dump file location under Android * java/org/gnu/emacs/EmacsApplication.java (EmacsApplication) : New field. (getApkFile): Move from EmacsService.java. (findDumpFile): If the dump file is older than the APK, delete it irrespective of whether the checksums agree. (onCreate): Initialize apkFileName. * java/org/gnu/emacs/EmacsService.java (onCreate): Use EmacsApplication.apkFileName. * src/android.c (android_on_low_memory): Correct arguments to Fclear_image_cache. * src/image.c (Fclear_image_cache): Check that animation_cache is always a cons. --- java/org/gnu/emacs/EmacsService.java | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'java/org/gnu/emacs/EmacsService.java') diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index 1aac1a6c4dd..5bd1dcc5a88 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java @@ -53,8 +53,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.UriPermission; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager.ApplicationInfoFlags; import android.content.pm.PackageManager; import android.content.res.AssetManager; @@ -193,36 +191,6 @@ public final class EmacsService extends Service return null; } - @SuppressWarnings ("deprecation") - private String - getApkFile () - { - PackageManager manager; - ApplicationInfo info; - - manager = getPackageManager (); - - try - { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) - info = manager.getApplicationInfo ("org.gnu.emacs", 0); - else - info = manager.getApplicationInfo ("org.gnu.emacs", - ApplicationInfoFlags.of (0)); - - /* Return an empty string upon failure. */ - - if (info.sourceDir != null) - return info.sourceDir; - - return ""; - } - catch (Exception e) - { - return ""; - } - } - /* Return the display density, adjusted in accord with the user's text scaling preferences. */ @@ -288,7 +256,7 @@ public final class EmacsService extends Service /* Now provide this application's apk file, so a recursive invocation of app_process (through android-emacs) can find EmacsNoninteractive. */ - classPath = getApkFile (); + classPath = EmacsApplication.apkFileName; Log.d (TAG, "Initializing Emacs, where filesDir = " + filesDir + ", libDir = " + libDir + ", and classPath = " + classPath -- cgit v1.3