• 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 #ifndef SERVICES_INCLUDE_WALLPAPER_SERVICE_PROXY_H
17 #define SERVICES_INCLUDE_WALLPAPER_SERVICE_PROXY_H
18 
19 
20 #include <mutex>
21 #include "iremote_proxy.h"
22 #include "i_wallpaper_service.h"
23 
24 namespace OHOS {
25 namespace WallpaperMgrService {
26 class WallpaperServiceProxy : public IRemoteProxy<IWallpaperService> {
27 public:
WallpaperServiceProxy(const sptr<IRemoteObject> & object)28     explicit WallpaperServiceProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<IWallpaperService>(object) {}
~WallpaperServiceProxy()29     ~WallpaperServiceProxy() {}
30     DISALLOW_COPY_AND_MOVE(WallpaperServiceProxy);
31     int32_t SetWallpaperByFD(int32_t fd, int32_t wallpaperType, int32_t length) override;
32     int32_t SetWallpaperByMap(int32_t fd, int32_t wallpaperType, int32_t length) override;
33     int32_t GetPixelMap(int32_t wallpaperType, IWallpaperService::FdInfo &fdInfo) override;
34     int32_t GetColors(int32_t wallpaperType, std::vector<uint64_t> &colors) override;
35     int32_t GetFile(int32_t wallpaperType, int32_t &wallpaperFd) override;
36     int32_t GetWallpaperId(int32_t wallpaperType) override;
37     int32_t GetWallpaperMinHeight(int32_t &minHeight) override;
38     int32_t GetWallpaperMinWidth(int32_t &minWidth) override;
39     bool IsChangePermitted() override;
40     bool IsOperationAllowed() override;
41     int32_t ResetWallpaper(int wallpaperType) override;
42     bool On(sptr<IWallpaperColorChangeListener> listener) override;
43     bool Off(sptr<IWallpaperColorChangeListener> listener) override;
44     bool RegisterWallpaperCallback(const sptr<IWallpaperCallback> callback) override;
45     std::string getUrl();
46 
47     int32_t SetWallpaperByFDV9(int32_t fd, int32_t wallpaperType, int32_t length) override;
48     int32_t SetWallpaperByMapV9(int32_t fd, int32_t wallpaperType, int32_t length) override;
49     int32_t GetPixelMapV9(int32_t wallpaperType, IWallpaperService::FdInfo &fdInfo) override;
50     int32_t GetColorsV9(int32_t wallpaperType, std::vector<uint64_t> &colors) override;
51     int32_t GetWallpaperMinHeightV9(int32_t &minHeight) override;
52     int32_t GetWallpaperMinWidthV9(int32_t &minWidth) override;
53     int32_t ResetWallpaperV9(int wallpaperType) override;
54 
55 private:
56     bool StartSocket(std::string url, std::string name);
57     int32_t SetWallpaperByFDInner(int32_t fd, int32_t wallpaperType, int32_t length, uint32_t code);
58     int32_t SetWallpaperByMapInner(int32_t fd, int32_t wallpaperType, int32_t length, uint32_t code);
59     int32_t GetPixelMapInner(int32_t wallpaperType, uint32_t code, IWallpaperService::FdInfo &fdInfo);
60     int32_t GetColorsInner(int32_t wallpaperType, uint32_t code, std::vector<uint64_t> &colors);
61     int32_t GetWallpaperMinHeightInner(uint32_t code, int32_t &minHeight);
62     int32_t GetWallpaperMinWidthInner(uint32_t code, int32_t &minWidth);
63     int32_t ResetWallpaperInner(int wallpaperType, uint32_t code);
64     static inline BrokerDelegator<WallpaperServiceProxy> delegator_;
65     sptr<OHOS::Media::PixelMap> Pmdata_;
66     std::string FWReadUrl = "";
67     int32_t mapSize = 0;
68 };
69 }
70 } // namespace OHOS
71 #endif // SERVICES_INCLUDE_WALLPAPER_SERVICE_PROXY_H