F-Droid installed as system app does not see active Internet connection

I installed F-Droid client and privileged extension into the /system partition. My device has currently stock recovery, though, and I cannot sideload OTA zip. I extracted it instead and copied the files from there via adb.

adb root
adb remount
adb shell mkdir /system/app/F-Droid /system/priv-app/F-DroidPrivilegedExtension
adb push F-Droid.apk /system/app/F-Droid/
adb push F-DroidPrivilegedExtension.apk /system/priv-app/F-DroidPrivilegedExtension/
adb push permissions_org.fdroid.fdroid.privileged.xml /system/etc/permissions/
adb push 80-fdroid.sh /system/addon.d/
adb reboot

After rebooting, the app can start but complains “No Internet connection”. Of course, the device is connected over Wi-Fi and the F-Droid repository is reachable from browser. And there are no interesting errors related to the Internet connection in adb logcat. dpaste: F5LAL75Y7

I looked at other pre-installed system apps and noticed their directories contain the oat subdirectory. So I installed both APKs into the /data partition via simple adb install and copied this subdirectory back to /system. But this step did not help. Eventually, I ended up with the following content on /system.

generic_arm64:/ $ find /system/*app/F-Droid* -print0 | xargs -0 ls -ld
drwxr-xr-x 3 root root     4096 2023-02-12 19:39 /system/app/F-Droid
-rw-r--r-- 1 root root  8010257 2022-01-22 20:32 /system/app/F-Droid/F-Droid.apk
drwxr-xr-x 3 root root     4096 2023-02-12 19:39 /system/app/F-Droid/oat
drwxr-xr-x 2 root root     4096 2023-02-12 19:39 /system/app/F-Droid/oat/arm64
-rw-r--r-- 1 root root    91024 2023-02-12 19:39 /system/app/F-Droid/oat/arm64/F-Droid.odex
-rw-r--r-- 1 root root 10042232 2023-02-12 19:39 /system/app/F-Droid/oat/arm64/F-Droid.vdex
drwxr-xr-x 3 root root     4096 2023-02-12 19:46 /system/priv-app/F-DroidPrivilegedExtension
-rw-r--r-- 1 root root    45943 2022-01-22 20:32 /system/priv-app/F-DroidPrivilegedExtension/F-DroidPrivilegedExtension.apk
drwxr-xr-x 3 root root     4096 2023-02-12 19:39 /system/priv-app/F-DroidPrivilegedExtension/oat
drwxr-xr-x 2 root root     4096 2023-02-12 19:39 /system/priv-app/F-DroidPrivilegedExtension/oat/arm64
-rw-r--r-- 1 root root    17296 2023-02-12 19:39 /system/priv-app/F-DroidPrivilegedExtension/oat/arm64/F-DroidPrivilegedExtension.odex
-rw-r--r-- 1 root root    22980 2023-02-12 19:39 /system/priv-app/F-DroidPrivilegedExtension/oat/arm64/F-DroidPrivilegedExtension.vdex
generic_arm64:/ $ ls -l /system/etc/permissions/permissions_org.fdroid.fdroid.privileged.xml /system/addon.d/80-fdroid.sh
-rw-r--r-- 1 root root 915 2022-01-22 20:32 /system/addon.d/80-fdroid.sh
-rw-r--r-- 1 root root 289 2022-01-22 20:32 /system/etc/permissions/permissions_org.fdroid.fdroid.privileged.xml

This is under LineageOS 20 (based on Android 13). F-Droid as a regular app (without .apk in /system) works okay except for the privileged extension.

Does the app have data blocked? Settings > Apps > F-Droid > Mobile data & Wi-fi > Allow network access

Also that is a unofficial LineageOS GSI image, where did you get it from?

That’s what it was, network access was disabled. What a stupid mistake! Sorry! :sweat_smile:

I built it on my own by the guide at Building for Emulator/AVD | LineageOS Wiki.

There is still a problem with the privileged extension. It does not seem to be working. But it is apparently other issue.

It is a weird bug where system apps may end up with network blocked by default for some reason.

Regardless, if you’re compiling your own image you should just compile F-Droid directly in.
My repo doesn’t have the privext in it, but this one does: GitHub - MSe1969/android_prebuilts_prebuiltapks

It has the steps on how to use it as well.

Have fun!