Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

[eDrive][feature changes]Make periodic file scan to be triggered on any network type

Description

eDrive periodic file scanning worker had a network constraint to "UNMETERED" network; Consequently, periodic sync only happened on WiFi connection or other network tagged as UNMETERED by the user.

There is an option in account settings that let user define if he wants to allow file sync on metered network; This is value is always check, but the unmetered network is required to trigger the worker.

This MR try to change the network constraint from unmetered to "Connected" which allow all. Then the worker will continue to check the settings to decide to continue or not.

BY DEFAULT, the settings to allow sync on mobile data is enabled!

There is a potential risk of big mobile data consumption as already encountered in the past.

I will run many test. But if at one time we realize it happens and too hard to understand and fix, then we will have get back to unmetered condition and to remove the option from settings. According to @aude

Gael indicated that the sync over mobile data is the target goal. So removing the option and limit to wifi only is probably not the best solution.

Technical details

I used this issue & MR, to also convert one more java class to kotlin. Less code, easier to read and so to maintain.

I would like to limit refactoring to this. And would prefer to open further MR for other points.

Tests

  • no regression due to refactoring: all workers are correctly scheduled and started (periodic sync is run, getting user info also, account setup, etc.)
  • periodic sync happens on mobile data according to user's settings
  • periodic sync happens on wifi
  • periodic sync doesn't happens on mobile data if option is disabled

Logs & test details.

Flows:

  • ~15:00 account setup & first sync on wifi

  • ~15:30 normal periodic sync over wifi

  • ~16:00 normal periodic sync over mobile data with mobile data enabled

  • ~16:30 failed periodic sync over mobile data with mobile data disabled.

04-10 16:36:56.119  7375  7415 I WM-DiagnosticsWrkr:  Id 	 Class Name	 Job Id	 State	 Unique Name	 Tags	
04-10 16:36:56.119  7375  7415 I WM-DiagnosticsWrkr: 3d559264-4318-4b9d-9e71-7a89fc5b4ff9	 foundation.e.drive.periodicScan.FullScanWorker	 null	 FAILED	 fullScan	 foundation.e.drive.periodicScan.FullScanWorker,eDrive	
04-10 16:36:56.119  7375  7415 I WM-DiagnosticsWrkr: 0c9980e9-1853-4d2a-aa73-7e242034278b	 foundation.e.drive.periodicScan.ListAppsWorker	 23	 SUCCEEDED	 fullScan	 foundation.e.drive.periodicScan.ListAppsWorker,eDrive	

The FAILED full scan refer to the one started when device was connected to mobile data only and that usage of mobile data was disabled.

To check it, I used the following command:

adb shell am broadcast -a "androidx.work.diagnostics.REQUEST_DIAGNOSTICS" -p "foundation.e.drive

Then

adb logcat | grep 'WM-DiagnosticsWrkr'

Issues

https://gitlab.e.foundation/e/os/backlog/-/issues/2032

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Edited by Vincent Bourgmayer

Merge request reports

Loading