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

This commit is contained in:
laurenspriem 2024-05-15 11:03:31 +05:30
parent 48e78d170d
commit b2c274e73b

View file

@ -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();
}