Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Trim background ML comments

laurenspriem3e16f6bc2bd3
diff --git a/mobile/apps/photos/lib/app.dart b/mobile/apps/photos/lib/app.dart
index 16789f80b6..212b013fdc 100644
--- a/mobile/apps/photos/lib/app.dart
+++ b/mobile/apps/photos/lib/app.dart
@@ -270,8 +270,6 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
} else {
AppLifecycleService.instance.onAppInBackground(stateChangeReason);
if (Platform.isIOS && state == AppLifecycleState.paused) {
- // Stop before suspension freezes the run mid-flight, so the ML lock
- // is free for background-task engines while the app stays suspended.
MLService.instance.stopActiveRun(MlStopReason.appPaused);
}
}
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index b6e8e76347..c318817783 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -673,8 +673,7 @@ Future<void> _scheduleHeartBeat(
SharedPreferences prefs,
bool isBackground,
) async {
- // iOS launches the full app (running main) for background task wake-ups, so
- // the main engine being alive doesn't imply the app is actually in use.
+ // iOS background wakes run main() without resuming the app.
final bool skipFGWrite =
!isBackground &&
Platform.isIOS &&
diff --git a/mobile/apps/photos/lib/utils/bg_task_utils.dart b/mobile/apps/photos/lib/utils/bg_task_utils.dart
index 7f881d3936..74ba025d47 100644
--- a/mobile/apps/photos/lib/utils/bg_task_utils.dart
+++ b/mobile/apps/photos/lib/utils/bg_task_utils.dart
@@ -25,9 +25,6 @@ void callbackDispatcher() {
BgTaskUtils.$.info('Task started $tlog');
if (Platform.isIOS &&
taskName == BgTaskUtils.iOSBackgroundProcessingTask) {
- // Re-arm at task start, mirroring the plugin's native resubmit for
- // periodic tasks: a window that closes early never runs end-of-task
- // code, so rescheduling there would break the chain.
await BgTaskUtils.scheduleIOSBackgroundProcessingTask();
await BgTaskUtils.markProcessingTaskStart(prefs);
}
@@ -145,9 +142,7 @@ class BgTaskUtils {
await workmanager.Workmanager().initialize(callbackDispatcher);
if (Platform.isIOS) {
await reportUncleanProcessingTaskExit();
- // The processing task is scheduled regardless of the background
- // refresh setting: that setting reliably gates app refresh tasks,
- // while processing tasks may still be granted overnight windows.
+ // Background refresh permission does not reliably gate processing tasks.
await scheduleIOSBackgroundProcessingTask();
final status = await Permission.backgroundRefresh.status;
if (status != PermissionStatus.granted) {
@@ -194,9 +189,7 @@ class BgTaskUtils {
}
}
- // BGProcessingTask requests are one-shot: the plugin resubmits app refresh
- // tasks natively but not processing tasks, so each run schedules the next
- // one and every foreground launch re-arms the chain after a force-quit.
+ // Workmanager does not resubmit one-shot processing tasks.
static Future<void> scheduleIOSBackgroundProcessingTask() async {
try {
await workmanager.Workmanager().registerProcessingTask(