1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "wallpaper_data.h" 17 #include "file_ex.h" 18 19 namespace OHOS { 20 namespace WallpaperMgrService { WallpaperData(int userId,std::string wallpaperFileName,std::string cropFileName)21 WallpaperData::WallpaperData(int userId, std::string wallpaperFileName, std::string cropFileName) 22 : userId_(userId), wallpaperFile_(wallpaperFileName), cropFile_(cropFileName), wallpaperId_(0), 23 allowBackup(false) 24 { 25 } WallpaperData()26 WallpaperData::WallpaperData() : userId_(0), wallpaperId_(0), allowBackup(false) 27 { 28 } 29 // Called during initialization of a given user's wallpaper bookkeeping cropExists()30 bool WallpaperData::cropExists() 31 { 32 if (!OHOS::FileExists(cropFile_)) { 33 return false; 34 } else { 35 return true; 36 } 37 } 38 sourceExists()39 bool WallpaperData::sourceExists() 40 { 41 if (!OHOS::FileExists(wallpaperFile_)) { 42 return false; 43 } else { 44 return true; 45 } 46 } 47 } 48 } // namespace OHOS 49 50