Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Extra safety checks for hooking MLController

laurenspriemb2c274e73bce
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
index 50c0e117c4..d4c1a891f0 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart
@@ -257,7 +257,7 @@ class FaceMlService {
return _functionLock.synchronized(() async {
_resetInactivityTimer();
- if (isImageIndexRunning == false) {
+ if (isImageIndexRunning == false || MachineLearningController.instance.canRunML == false) {
return null;
}
@@ -1339,8 +1339,12 @@ class FaceMlService {
/// Checks if the ente file to be analyzed actually can be analyzed: it must be uploaded and in the correct format.
void _checkEnteFileForID(EnteFile enteFile) {
if (_skipAnalysisEnteFile(enteFile, <int, int>{})) {
- _logger.severe(
- "Skipped analysis of image with enteFile ${enteFile.toString()} because it is the wrong format or has no uploadedFileID",
+ _logger.warning(
+ '''Skipped analysis of image with enteFile, it might be the wrong format or has no uploadedFileID, or MLController doesn't allow it to run.
+ enteFile: ${enteFile.toString()}
+ isImageIndexRunning: $isImageIndexRunning
+ canRunML: ${MachineLearningController.instance.canRunML}
+ ''',
);
throw CouldNotRetrieveAnyFileData();
}