You need to rebuild Termux packages and sign them with Emacs's key.

`apktool b <termux-directory> -o <termux-emacs_unsigned.apk>`

Zipalign the apk:

`zipalign -pf 4 <termux-emacs.unsigned.apk> <termux-emacs.unsigned.aligned.apk>>`

Sign the apk with Emacs key, using “Emacs keystore” as alias and “emacs1” as password:

`apksigner sign -v —ks ~/git/emacs/java/emacs.keystore —ks-key-alias "Emacs keystore" —ks-pass pass:emacs1 —key-pass pass:emacs1 —out <termux-emacs.apk> <termux-emacs.unsigned.aligned.apk>`

Old, v1, from somewhere else

-verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/git/emacs/java/emacs.keystore -storepass emacs1 -signedjar <termux-emacs.unaligned.apk> <termux-emacs.unsigned.apk> "Emacs keystore"

The first filename above is the “unaligned” one (only to be created in this step), the second one only the “unsigned” one (already existing prior to this step)!

Verify apk will install

apksigner verify <termux-emacs.apk>

Modify another APK (Emacs or whatever) to have the same shared user as Termux:

On the phone, decode its AndroidManifest.xml binary file with:

https://github.com/AbdurazaaqMohammed/AXML-Editor

Run AXML Editor
Select Decode
Pick the AndroidManifest.xml file
It'll prompt you immediately to save a "decoded" file in the same directory
Edit this saved file in a text editor - and add the text as per the point below
in the beginning of the file, add Termux ID, as per
add:

android:sharedUserId="com.termux" android:sharedUserLabel="@7F070007"

Then, again in AXML Editor, select Encode
Pick the edited file
It'll prompt you to save the AndroidManifest.xml somewhere - this'll be the modified manifest file

Then build a new apk starting from step 2 as above, including the edited AndroidManifest.xml

Both APKs will then be able to access each other's /data/data directories.

I was able to build DroidFS this way and Termux could access its files.
Useless anyway, as DraidFS doesn't mount anything, so nothing in its dirs… :@)

The final <termux-emacs.apk> can be installed alongside GNU Emacs.

First, install Termux.
Only then install Emacs - this way Emacs will take Termux's UUID.

References

[ https://lemmy.world/post/8864280 ] [ https://marek-g.github.io/posts/tips_and_tricks/emacs_on_android/ ] [ https://marek-g.github.io/posts/tips_and_tricks/emacs_on_android/ ] [ https://github.com/AbdurazaaqMohammed/AXML-Editor ] [ https://marek-g.github.io/posts/tips_and_tricks/emacs_on_android/ ]