From fcb9807767b05d7433c7ce86b105eb48e8322a55 Mon Sep 17 00:00:00 2001 From: shanchengding Date: Tue, 26 Nov 2024 23:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=A2=9E=E5=BC=BA=E7=9B=B8=E5=86=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=8C=E5=8D=87=E5=8D=95=E3=80=81=E5=8F=8C?= =?UTF-8?q?=E5=85=8B=E9=9A=86=E5=8D=95=E8=81=9A=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shanchengding Change-Id: I8acac8280863fe3c4210d1cebfd7215221bc3a38 --- .../include/restore/photos_restore.h | 5 +++++ .../src/restore/photos_restore.cpp | 22 +++++++++++++++++++ .../src/upgrade_restore.cpp | 2 ++ 3 files changed, 29 insertions(+) diff --git a/frameworks/services/media_backup_extension/include/restore/photos_restore.h b/frameworks/services/media_backup_extension/include/restore/photos_restore.h index 1da87731b..3d10acdd9 100644 --- a/frameworks/services/media_backup_extension/include/restore/photos_restore.h +++ b/frameworks/services/media_backup_extension/include/restore/photos_restore.h @@ -70,6 +70,8 @@ public: int32_t FindPhotoQuality(const FileInfo &fileInfo); int32_t FindMediaType(const FileInfo &fileInfo); std::string FindSourcePath(const FileInfo &fileInfo); + int32_t FindStrongAssociation(const FileInfo &fileInfo); + int32_t FindCeAvailable(const FileInfo &fileInfo); private: PhotosRestore &SetMediaLibraryRdb(std::shared_ptr mediaLibraryRdb) @@ -126,6 +128,9 @@ private: HAVING count(1) > 1 \ LIMIT ?, ?;"; const std::string SOURCE_PATH_PREFIX = "/storage/emulated/0"; + const int32_t CLOUD_ENHANCEMENT_ALBUM = 1; + const int32_t DUAL_ENHANCEMENT_PHOTO_QUALITY = 120; + const int32_t SINGLE_CLOUD_ENHANCEMENT_PHOTO = 120; }; } // namespace OHOS::Media diff --git a/frameworks/services/media_backup_extension/src/restore/photos_restore.cpp b/frameworks/services/media_backup_extension/src/restore/photos_restore.cpp index d1f837e3f..9142d3eb9 100644 --- a/frameworks/services/media_backup_extension/src/restore/photos_restore.cpp +++ b/frameworks/services/media_backup_extension/src/restore/photos_restore.cpp @@ -307,4 +307,26 @@ std::string PhotosRestore::FindSourcePath(const FileInfo &fileInfo) } return this->SOURCE_PATH_PREFIX + lPath + "/" + fileInfo.displayName; } + +/** + * @brief Find enhancement photo quality for the target device by FileInfo. + */ +int32_t PhotosRestore::FindStrongAssociation(const FileInfo &fileInfo) +{ + if (fileInfo.photoQuality == DUAL_ENHANCEMENT_PHOTO_QUALITY) { + return CLOUD_ENHANCEMENT_ALBUM; + } + return 0; +} + +/** + * @brief Find cloud enhancement available for the target device by FileInfo. + */ +int32_t PhotosRestore::FindCeAvailable(const FileInfo &fileInfo) +{ + if (fileInfo.photoQuality == DUAL_ENHANCEMENT_PHOTO_QUALITY) { + return SINGLE_CLOUD_ENHANCEMENT_PHOTO; + } + return 0; +} } // namespace OHOS::Media \ No newline at end of file diff --git a/frameworks/services/media_backup_extension/src/upgrade_restore.cpp b/frameworks/services/media_backup_extension/src/upgrade_restore.cpp index e6839d4f1..42ac8a165 100644 --- a/frameworks/services/media_backup_extension/src/upgrade_restore.cpp +++ b/frameworks/services/media_backup_extension/src/upgrade_restore.cpp @@ -774,6 +774,8 @@ NativeRdb::ValuesBucket UpgradeRestore::GetInsertValue(const FileInfo &fileInfo, values.PutInt(PhotoColumn::PHOTO_OWNER_ALBUM_ID, this->photosRestore_.FindAlbumId(fileInfo)); // fill the source_path at last. values.PutString(PhotoColumn::PHOTO_SOURCE_PATH, this->photosRestore_.FindSourcePath(fileInfo)); + values.PutInt(PhotoColumn::PHOTO_STRONG_ASSOCIATION, this->photosRestore_.FindStrongAssociation(fileInfo)); + values.PutInt(PhotoColumn::PHOTO_CE_AVAILABLE, this->photosRestore_.FindCeAvailable(fileInfo)); return values; } -- Gitee