Fdroid automatic updates on RPI

edited May 2019 in Supported devices

When attempting to get Fdroid to automatically refresh its repositories and automatically update an application I noticed that the UpdateServer job inside fdroid never executed.

I set the periodic interval to 1h (as per fdroid settings) and allowed fdroid to update on any network connectivity. The screen has a 30 second timeout. We are using a raspberry pi 3 model B+ with the official 7 inch screen. The device is licensed under a Business license. Fdroid has root access and the privileged extension is installed.

When using the dumpsys jobscheduler adb commnd to list jobs I can see the fdroid UpdateService job exists.
It has an Unsatisfied constraints with IDLE.
I can force run the job with: cmd jobscheduler run -f org.fdroid.fdroid 16702650 in the adb shell and it updates the application correctly.

From what I understand, the job is waiting for when Android signifies that the device is IDLE.
What conditions need to be met for the raspberry pi to be recognized as IDLE by Android. Is there a specific setting we need to set?

Tagged:

Comments

  • Does F-Droid support it? I know it can notify about available updates and it is even capable of downloading them automatically. But enforced update? You should probably double check this with F-Droid's maintainers.

  • edited May 2019

    Yes fdroid supports auto update if the device goes idle. We modified the source code of fdroid and removed the idle constraint for fdroid since emteria doesn't seem to go idle like other android devices. The auto update process worked correctly with the modified source.

    I believe that android phones/tablets are marked idle sometime after the screen turns off. From the android documentation it's device specific.

    What conditions need to be met for emteria on the raspberry pi to be recognized as IDLE by the job scheduler?

  • Thats a good question. If you have a desktop-like system where the screeb is always on, when should it go idle? I will do some research.

    Can you please point me to the F-Droid's source code where it applies auto-updates and checks for device's idle state?

  • We removed the following line from fdroid and compiled it.
    https://gitlab.com/fdroid/fdroidclient/blob/master/app/src/main/java/org/fdroid/fdroid/UpdateService.java#L170

    We also had to compile the fdroid privileged extension with our signature but there were no changes made.

    When the automatic update runs, the screen goes black and returns to the Kiosk mode launcher. To reopen the application on update we had to modify our application.

    We added a Broadcast receiver for intent for "MY_PACKAGE_REPLACED".

    After all the changes, the application will automatically check for updates, then update, then reboot the application, all while staying in Kiosk mode.

    We are not very keen on maintaining our own compiled versions of Fdroid and the privileged extension.

    We assumed that the device would go IDLE after the Android sleep setting (In settings) dimmed the display. We left it over night and it didn't seem to go IDLE.

  • Thanks for providing all the information. I will look into it and reply in the next days. We definitely should try to make it possible with emteria.OS, so you don't have to rebuild F-Droid.

  • After some research, it seems that Android doesn't enter the idle state as long as the screen is on: https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-7.1.2_r36/services/core/java/com/android/server/job/controllers/IdleController.java#178

    This brings me back to my original question: what should we do with always-on systems? I would argue that the setRequiresDeviceIdle call in F-Droid should be removed or replaced by something different, as it obviously doesn't fit here.

  • I did some further tests and it turns out that the idle state does also depend on other factors like power supply and system settings. It is only activated if the idle mode is activated and the battery is unplugged. More information here: https://stackoverflow.com/questions/31533972/how-to-shift-device-in-doze-mode-android-preview-m-marshmallow

    It seems once again, that waiting for the idle mode on devices like RPi isn't very useful. Maybe you can create a corresponding F-Droid issue and explain this problem to F-Droid developers.

Sign In or Register to comment.