π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Decouple model-download invalidation from runtime release
Amrithesh Kakkoth Ente5b25afc527ba
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dartindex f10eeadd3f..0bc8da674d 100644--- a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart+++ b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart@@ -133,11 +133,14 @@ class MLIndexingIsolate extends SuperIsolate {});}- Future<void> releaseRustRuntime() async {- // Reset so the next indexing run re-enters ensureDownloadedModels,- // which checks bandwidth and downloads any newly required models- // (e.g. pet models after toggling pet recognition on).+ /// Invalidate the download cache so the next indexing run re-enters+ /// [ensureDownloadedModels], which checks bandwidth and downloads any+ /// newly required models (e.g. pet models after toggling pet recognition).+ void invalidateModelDownloadCache() {areModelsDownloaded = false;+ }++ Future<void> releaseRustRuntime() async {if (!_shouldUseRustMl) {return;}diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dartindex 5ef45bce73..7c6a2a2e0f 100644--- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart+++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart@@ -337,6 +337,7 @@ class MLService {_logger.severe("indexAllImages failed", e, s);} finally {await MLIndexingIsolate.instance.releaseRustRuntime();+ MLIndexingIsolate.instance.invalidateModelDownloadCache();_isIndexingOrClusteringRunning = false;_cancelPauseIndexingAndClustering();}diff --git a/mobile/apps/photos/lib/ui/settings/debug/ml_debug_settings_page.dart b/mobile/apps/photos/lib/ui/settings/debug/ml_debug_settings_page.dartindex 2895167ca8..6ebf62dffa 100644--- a/mobile/apps/photos/lib/ui/settings/debug/ml_debug_settings_page.dart+++ b/mobile/apps/photos/lib/ui/settings/debug/ml_debug_settings_page.dart@@ -731,6 +731,7 @@ class _MLDebugSettingsPageState extends State<MLDebugSettingsPage> {// Invalidate cached runtime args so pet model paths are rebuilt// with the new toggle state on the next indexing run.await MLIndexingIsolate.instance.releaseRustRuntime();+ MLIndexingIsolate.instance.invalidateModelDownloadCache();logger.info('Pet recognition is turned ${localSettings.petRecognitionEnabled ? 'on' : 'off'}',);