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