π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
final fixes
Prateek Sunal0b21dc40c64d
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dartindex a8fbee5f91..a2834c12c6 100644--- a/mobile/apps/photos/lib/main.dart+++ b/mobile/apps/photos/lib/main.dart@@ -188,6 +188,9 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {NetworkClient.instance.getDio(),packageInfo,);+ // Initialize ComputeController early in background run so health listeners+ // and checks begin before MLService wiring.+ ensureComputeControllerInitialized();_logger.info("(for debugging) CollectionsService init $tlog");await CollectionsService.instance.init(prefs);@@ -224,8 +227,8 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {if (flagService.enableMLInBackground) {await MLService.instance.init();await PersonService.init(entityService, MLDataDB.instance, prefs);- // Refresh health in background and emit ComputeControlEvent.- await computeController.isDeviceHealthyFuture();+ // Trigger ML via ComputeControlEvent from current controller state.+ computeController.emitCurrentComputeControlEvent();}_logger.info("[BG TASK] smart albums sync");await smartAlbumsService.syncSmartAlbums();diff --git a/mobile/apps/photos/lib/service_locator.dart b/mobile/apps/photos/lib/service_locator.dartindex eafb4e5d3c..06c83f1f91 100644--- a/mobile/apps/photos/lib/service_locator.dart+++ b/mobile/apps/photos/lib/service_locator.dart@@ -217,6 +217,10 @@ ComputeController get computeController {return _computeController!;}+void ensureComputeControllerInitialized() {+ _computeController ??= ComputeController(localSettings);+}+FaceRecognitionService? _faceRecognitionService;FaceRecognitionService get faceRecognitionService {_faceRecognitionService ??= FaceRecognitionService();diff --git a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dartindex a3dd36c291..38ae6f8b11 100644--- a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart+++ b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart@@ -55,6 +55,12 @@ class ComputeController {bool get isDeviceHealthy => _isDeviceHealthy;+ /// Replays the latest compute eligibility state to listeners.+ /// Useful when listeners are attached after initial health checks completed.+ void emitCurrentComputeControlEvent() {+ _fireControlEvent();+ }+void _setDeviceHealth(bool healthy) {if (_isDeviceHealthy == healthy) return;_isDeviceHealthy = healthy;@@ -288,29 +294,6 @@ class ComputeController {_startInteractionTimer(kDefaultInteractionTimeout);}- Future<bool> isDeviceHealthyFuture() async {- if (!isProcessBg) return isDeviceHealthy;-- // Update Thermal status- _lastThermalStatus = await _thermal.thermalStatus;-- // Update Battery info and device health- if (Platform.isIOS) {- _iosLastBatteryInfo = await BatteryInfoPlugin().iosBatteryInfo;- _setDeviceHealth(_computeIsiOSDeviceHealthy());- } else {- _androidLastBatteryInfo = await BatteryInfoPlugin().androidBatteryInfo;- _setDeviceHealth(_computeIsAndroidDeviceHealthy());- }-- // In background we need this call-site to be self-sufficient so MLService- // listeners can react immediately without waiting on init races.- _hasCompletedInitialHealthChecks = true;- _fireControlEvent();- _logger.info("Device health status: $_isDeviceHealthy");- return _isDeviceHealthy;- }-void _onAndroidBatteryStateUpdate(AndroidBatteryInfo? batteryInfo) {_androidLastBatteryInfo = batteryInfo;_logger.info("Battery info: ${batteryInfo!.toJson()}");