mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
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.
This commit is contained in:
parent
511acc2ed8
commit
253f1aff1a
7 changed files with 42 additions and 14 deletions
14
configure.ac
14
configure.ac
|
|
@ -941,7 +941,7 @@ a valid path to android.jar. See config.log for more details.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether android.jar is new enough],
|
AC_CACHE_CHECK([whether android.jar is new enough],
|
||||||
[emacs_cv_android_s_or_later],
|
[emacs_cv_android_u_or_later],
|
||||||
AS_IF([rm -f conftest.class
|
AS_IF([rm -f conftest.class
|
||||||
cat << EOF > conftest.java
|
cat << EOF > conftest.java
|
||||||
|
|
||||||
|
|
@ -949,18 +949,18 @@ import android.os.Build;
|
||||||
|
|
||||||
class conftest
|
class conftest
|
||||||
{
|
{
|
||||||
private static int test = Build.VERSION_CODES.TIRAMISU;
|
private static int test = Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
|
("$JAVAC" -classpath "$with_android" -target 1.7 -source 1.7 conftest.java \
|
||||||
-d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
|
-d . >&AS_MESSAGE_LOG_FD 2>&1) && test -s conftest.class && rm -f conftest.class],
|
||||||
[emacs_cv_android_s_or_later=yes],
|
[emacs_cv_android_u_or_later=yes],
|
||||||
[emacs_cv_android_s_or_later=no]))
|
[emacs_cv_android_u_or_later=no]))
|
||||||
|
|
||||||
if test "$emacs_cv_android_s_or_later" = "no"; then
|
if test "$emacs_cv_android_u_or_later" = "no"; then
|
||||||
AC_MSG_ERROR([Emacs must be built with an android.jar file produced for \
|
AC_MSG_ERROR([Emacs must be built with an android.jar file produced for \
|
||||||
Android 13 (Tiramisu) or later.])
|
Android 14 (Upside Down Cake) or later.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl See if the Java compiler supports the `--release' option which
|
dnl See if the Java compiler supports the `--release' option which
|
||||||
|
|
@ -1152,6 +1152,8 @@ main (void)
|
||||||
foo = "emacs_api_32";
|
foo = "emacs_api_32";
|
||||||
#elif __ANDROID_API__ < 34
|
#elif __ANDROID_API__ < 34
|
||||||
foo = "emacs_api_33";
|
foo = "emacs_api_33";
|
||||||
|
#elif __ANDROID_API__ < 35
|
||||||
|
foo = "emacs_api_34";
|
||||||
#else
|
#else
|
||||||
foo = "emacs_api_future";
|
foo = "emacs_api_future";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,10 @@ installation:
|
||||||
@code{android.permission.TRANSMIT_IR}
|
@code{android.permission.TRANSMIT_IR}
|
||||||
@item
|
@item
|
||||||
@code{android.permission.WAKE_LOCK}
|
@code{android.permission.WAKE_LOCK}
|
||||||
|
@item
|
||||||
|
@code{android.permission.FOREGROUND_SERVICE}
|
||||||
|
@item
|
||||||
|
@code{android.permission.FOREGROUND_SERVICE_SPECIAL_USE}
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
Other permissions must be granted by the user through the system
|
Other permissions must be granted by the user through the system
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,12 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
|
|
||||||
|
<!-- Under Android 14 or later to run within the background. -->
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@"
|
<uses-sdk android:minSdkVersion="@ANDROID_MIN_SDK@"
|
||||||
android:targetSdkVersion="33"/>
|
android:targetSdkVersion="34"/>
|
||||||
|
|
||||||
<application android:name="org.gnu.emacs.EmacsApplication"
|
<application android:name="org.gnu.emacs.EmacsApplication"
|
||||||
android:label="Emacs"
|
android:label="Emacs"
|
||||||
|
|
@ -190,6 +194,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -->
|
||||||
android:directBootAware="false"
|
android:directBootAware="false"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
android:foregroundServiceType="specialUse"
|
||||||
android:label="GNU Emacs service"/>
|
android:label="GNU Emacs service"/>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
||||||
10
java/INSTALL
10
java/INSTALL
|
|
@ -39,7 +39,7 @@ script like so:
|
||||||
Replacing the paths in the command line above with:
|
Replacing the paths in the command line above with:
|
||||||
|
|
||||||
- the path to the `android.jar' headers which come with the Android
|
- the path to the `android.jar' headers which come with the Android
|
||||||
SDK. They must correspond to Android version 13 (API level 33).
|
SDK. They must correspond to Android version 14 (API level 34).
|
||||||
|
|
||||||
- the path to the C compiler in the Android NDK, for the kind of CPU
|
- the path to the C compiler in the Android NDK, for the kind of CPU
|
||||||
you are building Emacs to run on.
|
you are building Emacs to run on.
|
||||||
|
|
@ -87,13 +87,13 @@ necessary for compiling Emacs.
|
||||||
|
|
||||||
It is imperative that Emacs is compiled using the headers for the
|
It is imperative that Emacs is compiled using the headers for the
|
||||||
exact API level that it is written for. This is currently API level
|
exact API level that it is written for. This is currently API level
|
||||||
33, so the correct android.jar archive is located within a directory
|
34, so the correct android.jar archive is located within a directory
|
||||||
whose name begins with `android-33'. Minor revisions to the headers
|
whose name begins with `android-34'. Minor revisions to the headers
|
||||||
are inconsequential towards the Emacs compilation process; if there is
|
are inconsequential towards the Emacs compilation process; if there is
|
||||||
a directory named `android-33-extN' (where N represents a revision to
|
a directory named `android-34-extN' (where N represents a revision to
|
||||||
the Android SDK), whether you provide `configure' with that
|
the Android SDK), whether you provide `configure' with that
|
||||||
directory's android.jar or the android.jar contained within the
|
directory's android.jar or the android.jar contained within the
|
||||||
directory named `android-33' is of no special importance.
|
directory named `android-34' is of no special importance.
|
||||||
|
|
||||||
The ndk directory contains one subdirectory for each version of the
|
The ndk directory contains one subdirectory for each version of the
|
||||||
Android NDK installed. This directory in turn contains the C and C++
|
Android NDK installed. This directory in turn contains the C and C++
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
|
||||||
/* The typeface. */
|
/* The typeface. */
|
||||||
public Sdk7Typeface typeface;
|
public Sdk7Typeface typeface;
|
||||||
|
|
||||||
|
@SuppressWarnings ("deprecation")
|
||||||
public
|
public
|
||||||
Sdk7FontEntity (Sdk7Typeface typeface)
|
Sdk7FontEntity (Sdk7Typeface typeface)
|
||||||
{
|
{
|
||||||
|
|
@ -120,6 +121,7 @@ public class EmacsSdk7FontDriver extends EmacsFontDriver
|
||||||
/* The typeface. */
|
/* The typeface. */
|
||||||
public Sdk7Typeface typeface;
|
public Sdk7Typeface typeface;
|
||||||
|
|
||||||
|
@SuppressWarnings ("deprecation")
|
||||||
public
|
public
|
||||||
Sdk7FontObject (Sdk7Typeface typeface, int pixelSize)
|
Sdk7FontObject (Sdk7Typeface typeface, int pixelSize)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,21 @@ public final class EmacsService extends Service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the display density, adjusted in accord with the user's
|
||||||
|
text scaling preferences. */
|
||||||
|
|
||||||
|
@SuppressWarnings ("deprecation")
|
||||||
|
private static float
|
||||||
|
getScaledDensity (DisplayMetrics metrics)
|
||||||
|
{
|
||||||
|
/* The scaled density has been made obsolete by the introduction
|
||||||
|
of non-linear text scaling in Android 34, where there is no
|
||||||
|
longer a fixed relation between point and pixel sizes, but
|
||||||
|
remains useful, considering that Emacs does not support
|
||||||
|
non-linear text scaling. */
|
||||||
|
return metrics.scaledDensity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void
|
public void
|
||||||
onCreate ()
|
onCreate ()
|
||||||
|
|
@ -242,7 +257,7 @@ public final class EmacsService extends Service
|
||||||
metrics = getResources ().getDisplayMetrics ();
|
metrics = getResources ().getDisplayMetrics ();
|
||||||
pixelDensityX = metrics.xdpi;
|
pixelDensityX = metrics.xdpi;
|
||||||
pixelDensityY = metrics.ydpi;
|
pixelDensityY = metrics.ydpi;
|
||||||
tempScaledDensity = ((metrics.scaledDensity
|
tempScaledDensity = ((getScaledDensity (metrics)
|
||||||
/ metrics.density)
|
/ metrics.density)
|
||||||
* pixelDensityX);
|
* pixelDensityX);
|
||||||
resolver = getContentResolver ();
|
resolver = getContentResolver ();
|
||||||
|
|
|
||||||
|
|
@ -6238,7 +6238,7 @@ android_restart_emacs (void)
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a number from 1 to 33 describing the version of Android
|
/* Return a number from 1 to 34 describing the version of Android
|
||||||
Emacs is running on.
|
Emacs is running on.
|
||||||
|
|
||||||
This is different from __ANDROID_API__, as that describes the
|
This is different from __ANDROID_API__, as that describes the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue