Adds dependency androidx.lifecycle:lifecycle-service:2.7.0 since SystemForegroundService relies on it (possible this was the problematic oversight)
Removes some unused imports
Adds PythonProvider class which implements AutoCloseable for use with try-with-resources, to provider the android context to the python side, and automatically ensure we don't create context memory leaks
Updates ContextUtil to utilize the PythonProvider if it's active
Refactors work manager worker logic into abstract base class and makes foreground worker a regular Worker instead of RemoteListenableWorker
Re-adds setForegroundAsync that was mistakenly deleted, but does not call it repeatedly-- calling it repeatedly seemed to have no benefit against the issue but to spam the logs
Goes back to having a single android notification for tasks, and since foreground tasks require an integer ID, it converts the task request UUID to an integer using CRC32
Removes WorkerService which was a RemoteWorkerService for running RemoteListenableWorkers
Adds observer pattern to task worker implementation so task update calls go through it, which is a Java object that should only exist in the same task's thread
Adds onProgressUpdate hook method to worker base class which is called when the task's progress is updated, and by default calls setProgressAsync and updates the notification (this may be the true fix)
Adds android.permission.POST_NOTIFICATIONS permission and check for it since Android Studio was complaining about it missing (I don't recall this happening previously)
Goes back to having a single android notification for tasks, and since foreground tasks require an integer ID, it converts the task request UUID to an integer using CRC32
Summary
androidx.lifecycle:lifecycle-service:2.7.0
sinceSystemForegroundService
relies on it (possible this was the problematic oversight)PythonProvider
class which implementsAutoCloseable
for use with try-with-resources, to provider the android context to the python side, and automatically ensure we don't create context memory leaksContextUtil
to utilize thePythonProvider
if it's activeWorker
instead ofRemoteListenableWorker
setForegroundAsync
that was mistakenly deleted, but does not call it repeatedly-- calling it repeatedly seemed to have no benefit against the issue but to spam the logsWorkerService
which was aRemoteWorkerService
for runningRemoteListenableWorker
sonProgressUpdate
hook method to worker base class which is called when the task's progress is updated, and by default callssetProgressAsync
and updates the notification (this may be the true fix)//
division instead of usingmath.floor(...)
changed in https://github.com/learningequality/kolibri-installer-android/issues/204android.permission.POST_NOTIFICATIONS
permission and check for it since Android Studio was complaining about it missing (I don't recall this happening previously)References
Fixes https://github.com/learningequality/kolibri-installer-android/issues/205