1 /* 2 * Copyright (c) 2025-2025 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 #ifndef CAMERA_BEAUTY_NOTIFICATION_H 17 #define CAMERA_BEAUTY_NOTIFICATION_H 18 19 #include <atomic> 20 21 #include "camera_datashare_helper.h" 22 #include "camera_log.h" 23 #include "camera_util.h" 24 #include "image_source.h" 25 #include "int_wrapper.h" 26 #include "ipc_skeleton.h" 27 #include "locale_config.h" 28 #include "notification_helper.h" 29 #include "notification_normal_content.h" 30 #include "notification_request.h" 31 #include "os_account_manager.h" 32 #include "pixel_map.h" 33 #include "refbase.h" 34 #include "want_agent_helper.h" 35 #include "want_agent_info.h" 36 37 namespace OHOS { 38 namespace CameraStandard { 39 40 class CameraBeautyNotification : public RefBase { 41 public: 42 CameraBeautyNotification(); 43 ~CameraBeautyNotification(); 44 static sptr<CameraBeautyNotification> GetInstance(); 45 void PublishNotification(bool isRecordTimes); 46 void CancelNotification(); 47 void SetBeautyStatus(int32_t beautyStatus); 48 int32_t GetBeautyStatus(); 49 void SetBeautyTimes(int32_t beautyTimes); 50 int32_t GetBeautyTimes(); 51 int32_t GetBeautyStatusFromDataShareHelper(int32_t &beautyStatus); 52 int32_t SetBeautyStatusFromDataShareHelper(int32_t beautyStatus); 53 int32_t GetBeautyTimesFromDataShareHelper(int32_t ×); 54 int32_t SetBeautyTimesFromDataShareHelper(int32_t times); 55 56 private: 57 void InitBeautyStatus(); 58 std::string GetSystemStringByName(std::string name); 59 void GetPixelMap(); 60 std::shared_ptr<Notification::NotificationNormalContent> CreateNotificationNormalContent(int32_t beautyStatus); 61 void SetActionButton(const std::string& buttonName, Notification::NotificationRequest& request, 62 int32_t beautyStatus); 63 Global::Resource::RState GetMediaDataByName(std::string name, size_t& len, std::unique_ptr<uint8_t[]> &outValue, 64 uint32_t density = 0); 65 void InitResourceManager(); 66 void RefreshResConfig(); 67 68 static sptr<CameraBeautyNotification> instance_; 69 static std::mutex instanceMutex_; 70 71 std::mutex notificationMutex_; 72 std::atomic<int32_t> beautyTimes_ = 0; 73 std::atomic<int32_t> beautyStatus_ = 0; 74 std::shared_ptr<OHOS::Media::PixelMap> iconPixelMap_ = nullptr; 75 std::shared_ptr<CameraDataShareHelper> cameraDataShareHelper_ = nullptr; 76 Global::Resource::ResourceManager *resourceManager_ = nullptr; 77 Global::Resource::ResConfig *resConfig_ = nullptr; 78 bool isNotificationSuccess_ = false; 79 }; 80 81 } // namespace CameraStandard 82 } // namespace OHOS 83 #endif // CAMERA_BEAUTY_NOTIFICATION_H 84 85