π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Limit iOS background image indexing to processing tasks
laurenspriemb11b4c9aa329
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex 6db253462e..7b008a91f1 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -65,6 +65,7 @@ import "package:photos/services/sync/sync_service.dart";import "package:photos/services/video_preview_service.dart";import "package:photos/src/rust/api/log.dart" as photos_rust_log;import "package:photos/src/rust/frb_generated.dart";+import "package:photos/utils/bg_task_utils.dart";import "package:photos/utils/device_info.dart";import "package:photos/utils/email_util.dart";import "package:photos/utils/intent_util.dart";@@ -398,6 +399,9 @@ Future<void> _runMinimally(await MLService.instance.init();final disposition = await MLService.instance.runAllML(force: false,+ allowImageIndexing:+ !Platform.isIOS ||+ taskId == BgTaskUtils.iOSBackgroundProcessingTask,control: mlRunControl,lockWait: mlLockWait,);diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dartindex cfdada6a0a..100c6a1780 100644--- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart+++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart@@ -340,6 +340,7 @@ class MLService {Future<MlRunDisposition> runAllML({bool force = false,+ bool allowImageIndexing = true,MlRunControl? control,Duration? lockWait,}) async {@@ -391,6 +392,7 @@ class MLService {disposition = await _runAllMLProtected(mode: mode,force: force,+ allowImageIndexing: allowImageIndexing,control: runControl,);},@@ -431,6 +433,7 @@ class MLService {Future<MlRunDisposition> _runAllMLProtected({required MLMode mode,required bool force,+ required bool allowImageIndexing,required MlRunControl control,}) async {assert(MlProcessLock.instance.isBusy, "ml funnel must be held");@@ -463,7 +466,11 @@ class MLService {return MlRunDisposition.stopped;}if (canFetch()) {- await _fetchAndIndexAllImages(mode: mode, control: control);+ await _fetchAndIndexAllImages(+ mode: mode,+ control: control,+ allowImageIndexing: allowImageIndexing,+ );}if (control.stopRequested) {_logRunStopped(control, "before final clustering");@@ -580,6 +587,7 @@ class MLService {Future<void> _fetchAndIndexAllImages({required MLMode mode,required MlRunControl control,+ bool allowImageIndexing = true,}) async {assert(MlProcessLock.instance.isBusy, "ml funnel must be held");if (control.stopRequested) {@@ -591,7 +599,7 @@ class MLService {bool rustRuntimePrepared = false;try {_logger.info('starting image indexing');- if (localSettings.isMLLocalIndexingEnabled) {+ if (allowImageIndexing && localSettings.isMLLocalIndexingEnabled) {await MLModelDownloadService.instance.ensureModelsDownloaded(onlyIndexingModels: true,);@@ -608,7 +616,7 @@ class MLService {_logRunStopped(control, "between indexing chunks");break;}- if (!localSettings.isMLLocalIndexingEnabled) {+ if (!allowImageIndexing || !localSettings.isMLLocalIndexingEnabled) {if (rustRuntimePrepared) {await MLIndexingIsolate.instance.releaseRustRuntime();rustRuntimePrepared = false;