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(int fd, int wallpaperType, int length) override; 32 int32_t SetWallpaperByMap(int fd, int wallpaperType, int length) override; 33 int32_t GetPixelMap(int wallpaperType, IWallpaperService::FdInfo &fdInfo) override; 34 std::vector<uint64_t> GetColors(int wallpaperType) override; 35 int32_t GetFile(int wallpaperType, int32_t &wallpaperFd) override; 36 int GetWallpaperId(int wallpaperType) override; 37 int GetWallpaperMinHeight() override; 38 int GetWallpaperMinWidth() 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 private: 48 bool StartSocket(std::string url, std::string name); 49 static inline BrokerDelegator<WallpaperServiceProxy> delegator_; 50 sptr<OHOS::Media::PixelMap> Pmdata_; 51 std::string FWReadUrl = ""; 52 int32_t mapSize = 0; 53 }; 54 } 55 } // namespace OHOS 56 #endif // SERVICES_INCLUDE_WALLPAPER_SERVICE_PROXY_H