Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Remove unrelated pet persistence changes

laurensprieme0a8b5de6eb2
diff --git a/mobile/apps/photos/lib/db/ml/base.dart b/mobile/apps/photos/lib/db/ml/base.dart
index 35219442b8..0439b0287d 100644
--- a/mobile/apps/photos/lib/db/ml/base.dart
+++ b/mobile/apps/photos/lib/db/ml/base.dart
@@ -136,7 +136,6 @@ abstract class IMLDataDB<T> {
Future<Map<int, int>> petIndexedFileIds({int minimumMlVersion});
Future<int> getPetIndexedFileCount({int minimumMlVersion});
Future<void> deletePetDataForFiles(List<int> fileIDs);
- Future<void> markPetFileIndexed(int fileID, int mlVersion);
Future<Set<int>> getFullyIndexedFileIds({required bool includePets});
diff --git a/mobile/apps/photos/lib/db/ml/db.dart b/mobile/apps/photos/lib/db/ml/db.dart
index 99e73ce4ff..5aa5405076 100644
--- a/mobile/apps/photos/lib/db/ml/db.dart
+++ b/mobile/apps/photos/lib/db/ml/db.dart
@@ -206,15 +206,6 @@ class DartMLDataDB
}
}
- @override
- Future<void> markPetFileIndexed(int fileID, int mlVersion) async {
- final db = await asyncDB;
- await db.execute(
- 'UPDATE $petFacesTable SET $mlVersionColumn = ? WHERE $fileIDColumn = ?',
- [mlVersion, fileID],
- );
- }
-
@override
Future<void> bulkInsertPetBodies(List<DBPetBody> petBodies) async {
final db = await asyncDB;
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
index e91388b9f6..05feb84134 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart
@@ -1023,11 +1023,15 @@ class MLService {
faceScore: pf.detection.score,
imageHeight: result.decodedImageSize.height,
imageWidth: result.decodedImageSize.width,
- mlVersion: -1,
+ mlVersion: petMlVersion,
);
}).toList();
await mlDataDB.bulkInsertPetFaces(dbPetFaces);
await mlDataDB.storePetFaceEmbeddings(dbPetFaces, result.petFaces!);
+ } else if (instruction.shouldRunPets) {
+ // No pet faces detected; insert empty marker so the file is
+ // considered pet-indexed (mirrors Face.empty for human faces).
+ await mlDataDB.bulkInsertPetFaces([DBPetFace.empty(result.fileId)]);
}
if (result.petBodies != null && result.petBodies!.isNotEmpty) {
@@ -1057,11 +1061,6 @@ class MLService {
await mlDataDB.bulkInsertPetBodies(dbPetBodies);
await mlDataDB.storePetBodyEmbeddings(dbPetBodies, result.petBodies!);
}
- if (result.petFaces?.isNotEmpty ?? false) {
- await mlDataDB.markPetFileIndexed(result.fileId, petMlVersion);
- } else if (instruction.shouldRunPets) {
- await mlDataDB.bulkInsertPetFaces([DBPetFace.empty(result.fileId)]);
- }
}
_logger.info("ML result for fileID ${result.fileId} stored remote+local");
indexedOrSkipped = true;