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 #define LOG_TAG "WallpaperEventListenerClient"
17 
18 #include "hilog_wrapper.h"
19 #include "wallpaper_event_listener_client.h"
20 
21 namespace OHOS {
22 namespace WallpaperMgrService {
WallpaperEventListenerClient(std::shared_ptr<WallpaperMgrService::WallpaperEventListener> wallpaperEventListener)23 WallpaperEventListenerClient::WallpaperEventListenerClient(
24     std::shared_ptr<WallpaperMgrService::WallpaperEventListener> wallpaperEventListener)
25     : wallpaperEventListener_(wallpaperEventListener)
26 {
27 }
28 
~WallpaperEventListenerClient()29 WallpaperEventListenerClient::~WallpaperEventListenerClient()
30 {
31 }
32 
OnColorsChange(const std::vector<uint64_t> & color,int32_t wallpaperType)33 void WallpaperEventListenerClient::OnColorsChange(const std::vector<uint64_t> &color, int32_t wallpaperType)
34 {
35     HILOG_INFO("OnColorsChange start.");
36     if (wallpaperEventListener_ != nullptr) {
37         wallpaperEventListener_->OnColorsChange(color, wallpaperType);
38     }
39 }
40 
OnWallpaperChange(WallpaperType wallpaperType,WallpaperResourceType resourceType,const std::string & uri)41 void WallpaperEventListenerClient::OnWallpaperChange(
42     WallpaperType wallpaperType, WallpaperResourceType resourceType, const std::string &uri)
43 {
44     if (wallpaperEventListener_ != nullptr) {
45         wallpaperEventListener_->OnWallpaperChange(wallpaperType, resourceType, uri);
46     }
47 }
48 
GetEventListener() const49 const std::shared_ptr<WallpaperEventListener> WallpaperEventListenerClient::GetEventListener() const
50 {
51     return wallpaperEventListener_;
52 }
53 } // namespace WallpaperMgrService
54 } // namespace OHOS
55