aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-10-05 11:57:26 +0800
committerPo Lu2023-10-05 11:57:26 +0800
commit253f1aff1ab00e9794f3cfcf50e86e335f411242 (patch)
tree8a232f9683100875bac890832ee7c3af5ec07a3d /java
parent511acc2ed827dd039eee1c6d70c77153825d5c67 (diff)
downloademacs-253f1aff1ab00e9794f3cfcf50e86e335f411242.tar.gz
emacs-253f1aff1ab00e9794f3cfcf50e86e335f411242.zip
Port Emacs to Android 34
* configure.ac: Detect and require Android 34 headers. * doc/emacs/android.texi (Android Environment): Mention new permissions mandated by Android 34. * java/AndroidManifest.xml.in: Introduce new permissions and foreground service types prerequisite for background execution under Android 34. * java/INSTALL: Update installation documentation. * java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity) (Sdk7FontObject): * java/org/gnu/emacs/EmacsService.java (onCreate): Silence deprecation warnings. * src/android.c: Update documentation.
Diffstat (limited to 'java')
-rw-r--r--java/AndroidManifest.xml.in7
-rw-r--r--java/INSTALL10
-rw-r--r--java/org/gnu/emacs/EmacsSdk7FontDriver.java2
-rw-r--r--java/org/gnu/emacs/EmacsService.java17
4 files changed, 29 insertions, 7 deletions
diff --git a/java/AndroidManifest.xml.in b/java/AndroidManifest.xml.in
index 9ba9dabde81..2749f43c245 100644
--- a/java/AndroidManifest.xml.in
+++ b/java/AndroidManifest.xml.in
@@ -73,8 +73,12 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
73 73
74 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> 74 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
75 75
76 <!-- Under Android 14 or later to run within the background. -->
77
78 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
79
76 <uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@" 80 <uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@"
77 android:targetSdkVersion="33"/> 81 android:targetSdkVersion="34"/>
78 82
79 <application android:name="org.gnu.emacs.EmacsApplication" 83 <application android:name="org.gnu.emacs.EmacsApplication"
80 android:label="Emacs" 84 android:label="Emacs"
@@ -190,6 +194,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
190 android:directBootAware="false" 194 android:directBootAware="false"
191 android:enabled="true" 195 android:enabled="true"
192 android:exported="false" 196 android:exported="false"
197 android:foregroundServiceType="specialUse"
193 android:label="GNU Emacs service"/> 198 android:label="GNU Emacs service"/>
194 </application> 199 </application>
195</manifest> 200</manifest>
diff --git a/java/INSTALL b/java/INSTALL
index fb235af1346..b6c31483dd3 100644
--- a/java/INSTALL
+++ b/java/INSTALL
@@ -39,7 +39,7 @@ script like so:
39Replacing the paths in the command line above with: 39Replacing the paths in the command line above with:
40 40
41 - the path to the `android.jar' headers which come with the Android 41 - the path to the `android.jar' headers which come with the Android
42 SDK. They must correspond to Android version 13 (API level 33). 42 SDK. They must correspond to Android version 14 (API level 34).
43 43
44 - the path to the C compiler in the Android NDK, for the kind of CPU 44 - the path to the C compiler in the Android NDK, for the kind of CPU
45 you are building Emacs to run on. 45 you are building Emacs to run on.
@@ -87,13 +87,13 @@ necessary for compiling Emacs.
87 87
88It is imperative that Emacs is compiled using the headers for the 88It is imperative that Emacs is compiled using the headers for the
89exact API level that it is written for. This is currently API level 89exact API level that it is written for. This is currently API level
9033, so the correct android.jar archive is located within a directory 9034, so the correct android.jar archive is located within a directory
91whose name begins with `android-33'. Minor revisions to the headers 91whose name begins with `android-34'. Minor revisions to the headers
92are inconsequential towards the Emacs compilation process; if there is 92are inconsequential towards the Emacs compilation process; if there is
93a directory named `android-33-extN' (where N represents a revision to 93a directory named `android-34-extN' (where N represents a revision to
94the Android SDK), whether you provide `configure' with that 94the Android SDK), whether you provide `configure' with that
95directory's android.jar or the android.jar contained within the 95directory's android.jar or the android.jar contained within the
96directory named `android-33' is of no special importance. 96directory named `android-34' is of no special importance.
97 97
98The ndk directory contains one subdirectory for each version of the 98The ndk directory contains one subdirectory for each version of the
99Android NDK installed. This directory in turn contains the C and C++ 99Android NDK installed. This directory in turn contains the C and C++
diff --git a/java/org/gnu/emacs/EmacsSdk7FontDriver.java b/java/org/gnu/emacs/EmacsSdk7FontDriver.java
index 21ae159d5bd..33d6ee34fa4 100644
--- a/java/org/gnu/emacs/EmacsSdk7FontDriver.java
+++ b/java/org/gnu/emacs/EmacsSdk7FontDriver.java
@@ -99,6 +99,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
99 /* The typeface. */ 99 /* The typeface. */
100 public Sdk7Typeface typeface; 100 public Sdk7Typeface typeface;
101 101
102 @SuppressWarnings ("deprecation")
102 public 103 public
103 Sdk7FontEntity (Sdk7Typeface typeface) 104 Sdk7FontEntity (Sdk7Typeface typeface)
104 { 105 {
@@ -120,6 +121,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
120 /* The typeface. */ 121 /* The typeface. */
121 public Sdk7Typeface typeface; 122 public Sdk7Typeface typeface;
122 123
124 @SuppressWarnings ("deprecation")
123 public 125 public
124 Sdk7FontObject (Sdk7Typeface typeface, int pixelSize) 126 Sdk7FontObject (Sdk7Typeface typeface, int pixelSize)
125 { 127 {
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 997c6923fcc..28b725d0cd0 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -223,6 +223,21 @@ public final class EmacsService extends Service
223 } 223 }
224 } 224 }
225 225
226 /* Return the display density, adjusted in accord with the user's
227 text scaling preferences. */
228
229 @SuppressWarnings ("deprecation")
230 private static float
231 getScaledDensity (DisplayMetrics metrics)
232 {
233 /* The scaled density has been made obsolete by the introduction
234 of non-linear text scaling in Android 34, where there is no
235 longer a fixed relation between point and pixel sizes, but
236 remains useful, considering that Emacs does not support
237 non-linear text scaling. */
238 return metrics.scaledDensity;
239 }
240
226 @Override 241 @Override
227 public void 242 public void
228 onCreate () 243 onCreate ()
@@ -242,7 +257,7 @@ public final class EmacsService extends Service
242 metrics = getResources ().getDisplayMetrics (); 257 metrics = getResources ().getDisplayMetrics ();
243 pixelDensityX = metrics.xdpi; 258 pixelDensityX = metrics.xdpi;
244 pixelDensityY = metrics.ydpi; 259 pixelDensityY = metrics.ydpi;
245 tempScaledDensity = ((metrics.scaledDensity 260 tempScaledDensity = ((getScaledDensity (metrics)
246 / metrics.density) 261 / metrics.density)
247 * pixelDensityX); 262 * pixelDensityX);
248 resolver = getContentResolver (); 263 resolver = getContentResolver ();