diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-03-06 19:59:46 +0100 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-03-09 19:15:17 +0100 |
commit | ff2270d53e97af14f11c31ea54d450f630eedc05 (patch) | |
tree | fc1adc48d6b6b35c5cbd1157785e767199cf4d8c /tools | |
parent | 2383257bfc2e01d3d559826df0fb15aff0d2c40f (diff) |
[Android] Main activity: onDestroy: Cancel all scheduled jobs.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/android/packaging/xbmc/src/Main.java.in | 2 | ||||
-rw-r--r-- | tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/android/packaging/xbmc/src/Main.java.in b/tools/android/packaging/xbmc/src/Main.java.in index 3080bef78b..a769488256 100644 --- a/tools/android/packaging/xbmc/src/Main.java.in +++ b/tools/android/packaging/xbmc/src/Main.java.in @@ -290,6 +290,8 @@ public class Main extends NativeActivity implements Choreographer.FrameCallback @Override public void onDestroy() { + TvUtil.cancelAllScheduledJobs(this); + // unregister the InputDeviceListener implementation InputManager manager = (InputManager) getSystemService(INPUT_SERVICE); manager.unregisterInputDeviceListener(mInputDeviceListener); diff --git a/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in b/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in index 0286b8dc13..ff7ccd0dc0 100644 --- a/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in +++ b/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in @@ -181,6 +181,18 @@ public class TvUtil } /** + * Cancel all jobs scheduled by this app via a {@link JobScheduler}. + * + * @param context for accessing the {@link JobScheduler}. + */ + public static void cancelAllScheduledJobs(Context context) + { + JobScheduler scheduler = + (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + scheduler.cancelAll(); + } + + /** * Schedules syncing channels via a {@link JobScheduler}. * * @param context for accessing the {@link JobScheduler}. |