• 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 #include "wallpaper_service_stub.h"
17 
18 #include <unistd.h>
19 
20 #include "ashmem.h"
21 #include "hilog_wrapper.h"
22 #include "ipc_skeleton.h"
23 #include "memory_guard.h"
24 #include "parcel.h"
25 #include "pixel_map.h"
26 #include "wallpaper_common.h"
27 
28 namespace OHOS {
29 namespace WallpaperMgrService {
30 using namespace OHOS::HiviewDFX;
31 using namespace OHOS::Media;
32 
WallpaperServiceStub()33 WallpaperServiceStub::WallpaperServiceStub()
34 {
35     memberFuncMap_[SET_WALLPAPER_URI_FD] = &WallpaperServiceStub::OnSetWallpaperUriByFD;
36     memberFuncMap_[SET_WALLPAPER_MAP] = &WallpaperServiceStub::OnSetWallpaperByMap;
37     memberFuncMap_[GET_PIXELMAP] = &WallpaperServiceStub::OnGetPixelMap;
38     memberFuncMap_[GET_COLORS] = &WallpaperServiceStub::OnGetColors;
39     memberFuncMap_[GET_WALLPAPER_ID] = &WallpaperServiceStub::OnGetWallpaperId;
40     memberFuncMap_[GET_FILE] = &WallpaperServiceStub::OnGetFile;
41     memberFuncMap_[GET_WALLPAPER_MIN_HEIGHT] = &WallpaperServiceStub::OnGetWallpaperMinHeight;
42     memberFuncMap_[GET_WALLPAPER_MIN_WIDTH] = &WallpaperServiceStub::OnGetWallpaperMinWidth;
43     memberFuncMap_[ON] = &WallpaperServiceStub::OnWallpaperOn;
44     memberFuncMap_[OFF] = &WallpaperServiceStub::OnWallpaperOff;
45     memberFuncMap_[IS_CHANGE_PERMITTED] = &WallpaperServiceStub::OnIsChangePermitted;
46     memberFuncMap_[IS_OPERATION_ALLOWED] = &WallpaperServiceStub::OnIsOperationAllowed;
47     memberFuncMap_[RESET_WALLPAPER] = &WallpaperServiceStub::OnResetWallpaper;
48     memberFuncMap_[REGISTER_CALLBACK] = &WallpaperServiceStub::OnRegisterWallpaperCallback;
49     memberFuncMap_[SET_WALLPAPER_URI_FD_V9] = &WallpaperServiceStub::OnSetWallpaperUriByFDV9;
50     memberFuncMap_[SET_WALLPAPER_MAP_V9] = &WallpaperServiceStub::OnSetWallpaperByMapV9;
51     memberFuncMap_[GET_PIXELMAP_V9] = &WallpaperServiceStub::OnGetPixelMapV9;
52     memberFuncMap_[GET_COLORS_V9] = &WallpaperServiceStub::OnGetColorsV9;
53     memberFuncMap_[GET_WALLPAPER_MIN_HEIGHT_V9] = &WallpaperServiceStub::OnGetWallpaperMinHeightV9;
54     memberFuncMap_[GET_WALLPAPER_MIN_WIDTH_V9] = &WallpaperServiceStub::OnGetWallpaperMinWidthV9;
55     memberFuncMap_[RESET_WALLPAPER_V9] = &WallpaperServiceStub::OnResetWallpaperV9;
56 }
57 
~WallpaperServiceStub()58 WallpaperServiceStub::~WallpaperServiceStub()
59 {
60     memberFuncMap_.clear();
61 }
62 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)63 int32_t WallpaperServiceStub::OnRemoteRequest(
64     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
65 {
66     MemoryGuard cacheGuard;
67     HILOG_INFO(" start##ret = %{public}u", code);
68     std::u16string myDescripter = WallpaperServiceStub::GetDescriptor();
69     std::u16string remoteDescripter = data.ReadInterfaceToken();
70     if (myDescripter != remoteDescripter) {
71         HILOG_ERROR(" end##descriptor checked fail");
72         return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
73     }
74     pid_t p = IPCSkeleton::GetCallingPid();
75     pid_t p1 = IPCSkeleton::GetCallingUid();
76     HILOG_INFO("CallingPid = %{public}d, CallingUid = %{public}d, code = %{public}u", p, p1, code);
77     auto itFunc = memberFuncMap_.find(code);
78     if (itFunc != memberFuncMap_.end()) {
79         auto memberFunc = itFunc->second;
80         if (memberFunc != nullptr) {
81             return (this->*memberFunc)(data, reply);
82         }
83     }
84     int ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option);
85     HILOG_INFO(" end##ret = %{public}d", ret);
86     return ret;
87 }
88 
OnSetWallpaperByMap(MessageParcel & data,MessageParcel & reply)89 int32_t WallpaperServiceStub::OnSetWallpaperByMap(MessageParcel &data, MessageParcel &reply)
90 {
91     return OnSetWallpaperByMapInner(data, reply, false);
92 }
93 
OnSetWallpaperByMapV9(MessageParcel & data,MessageParcel & reply)94 int32_t WallpaperServiceStub::OnSetWallpaperByMapV9(MessageParcel &data, MessageParcel &reply)
95 {
96     return OnSetWallpaperByMapInner(data, reply, true);
97 }
98 
OnSetWallpaperByMapInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)99 int32_t WallpaperServiceStub::OnSetWallpaperByMapInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
100 {
101     HILOG_INFO("WallpaperServiceStub::SetWallpaper start.");
102 
103     int32_t fd = data.ReadFileDescriptor();
104     int32_t wallpaperType = data.ReadInt32();
105     int32_t length = data.ReadInt32();
106     int32_t wallpaperErrorCode = 0;
107     if (isSystemApi) {
108         wallpaperErrorCode = SetWallpaperByMapV9(fd, wallpaperType, length);
109     } else {
110         wallpaperErrorCode = SetWallpaperByMap(fd, wallpaperType, length);
111     }
112     close(fd);
113     if (!reply.WriteInt32(wallpaperErrorCode)) {
114         HILOG_ERROR("WriteInt32 fail");
115         return IPC_STUB_WRITE_PARCEL_ERR;
116     }
117     return ERR_NONE;
118 }
119 
OnSetWallpaperUriByFD(MessageParcel & data,MessageParcel & reply)120 int32_t WallpaperServiceStub::OnSetWallpaperUriByFD(MessageParcel &data, MessageParcel &reply)
121 {
122     return OnSetWallpaperUriByFDInner(data, reply, false);
123 }
124 
OnSetWallpaperUriByFDV9(MessageParcel & data,MessageParcel & reply)125 int32_t WallpaperServiceStub::OnSetWallpaperUriByFDV9(MessageParcel &data, MessageParcel &reply)
126 {
127     return OnSetWallpaperUriByFDInner(data, reply, true);
128 }
129 
OnSetWallpaperUriByFDInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)130 int32_t WallpaperServiceStub::OnSetWallpaperUriByFDInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
131 {
132     HILOG_INFO("WallpaperServiceStub::SetWallpaperUri start.");
133 
134     int fd = data.ReadFileDescriptor();
135     if (fd < 0) {
136         HILOG_INFO("ReadFileDescriptor fail. fd[%{public}d]", fd);
137         return IPC_STUB_INVALID_DATA_ERR;
138     }
139     int wallpaperType = data.ReadInt32();
140     HILOG_INFO("wallpaperType= %{public}d", wallpaperType);
141     int length = data.ReadInt32();
142     HILOG_INFO("SetWallpaperByFD start");
143     int32_t wallpaperErrorCode = 0;
144     if (isSystemApi) {
145         wallpaperErrorCode = SetWallpaperByFDV9(fd, wallpaperType, length);
146     } else {
147         wallpaperErrorCode = SetWallpaperByFD(fd, wallpaperType, length);
148     }
149     close(fd);
150     if (!reply.WriteInt32(wallpaperErrorCode)) {
151         HILOG_ERROR("WriteInt32 fail");
152         return IPC_STUB_WRITE_PARCEL_ERR;
153     }
154     return ERR_NONE;
155 }
156 
OnGetPixelMap(MessageParcel & data,MessageParcel & reply)157 int32_t WallpaperServiceStub::OnGetPixelMap(MessageParcel &data, MessageParcel &reply)
158 {
159     return OnGetPixelMapInner(data, reply, false);
160 }
161 
OnGetPixelMapV9(MessageParcel & data,MessageParcel & reply)162 int32_t WallpaperServiceStub::OnGetPixelMapV9(MessageParcel &data, MessageParcel &reply)
163 {
164     return OnGetPixelMapInner(data, reply, true);
165 }
166 
OnGetPixelMapInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)167 int32_t WallpaperServiceStub::OnGetPixelMapInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
168 {
169     HILOG_INFO("WallpaperServiceStub::GetPixelMap start.");
170 
171     int wallpaperType = data.ReadInt32();
172     IWallpaperService::FdInfo fdInfo;
173     int wallpaperErrorCode = 0;
174     if (isSystemApi) {
175         wallpaperErrorCode = GetPixelMapV9(wallpaperType, fdInfo);
176     } else {
177         wallpaperErrorCode = GetPixelMap(wallpaperType, fdInfo);
178     }
179     HILOG_INFO(" OnGetPixelMap wallpaperErrorCode = %{public}d", wallpaperErrorCode);
180     if (!reply.WriteInt32(wallpaperErrorCode)) {
181         HILOG_ERROR("WriteInt32 fail");
182         return IPC_STUB_WRITE_PARCEL_ERR;
183     }
184     if (wallpaperErrorCode == static_cast<int32_t>(E_OK)) {
185         if (!reply.WriteInt32(fdInfo.size)) {
186             HILOG_ERROR("WriteInt32 fail");
187             return IPC_STUB_WRITE_PARCEL_ERR;
188         }
189         if (!reply.WriteFileDescriptor(fdInfo.fd)) {
190             HILOG_ERROR("WriteFileDescriptor fail");
191             close(fdInfo.fd);
192             return IPC_STUB_WRITE_PARCEL_ERR;
193         }
194         close(fdInfo.fd);
195     }
196     return ERR_NONE;
197 }
198 
OnGetColors(MessageParcel & data,MessageParcel & reply)199 int32_t WallpaperServiceStub::OnGetColors(MessageParcel &data, MessageParcel &reply)
200 {
201     return OnGetColorsInner(data, reply, false);
202 }
203 
OnGetColorsV9(MessageParcel & data,MessageParcel & reply)204 int32_t WallpaperServiceStub::OnGetColorsV9(MessageParcel &data, MessageParcel &reply)
205 {
206     return OnGetColorsInner(data, reply, true);
207 }
208 
OnGetColorsInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)209 int32_t WallpaperServiceStub::OnGetColorsInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
210 {
211     HILOG_INFO("WallpaperServiceStub::OnGetColors start.");
212     int32_t wallpaperType = data.ReadInt32();
213     std::vector<uint64_t> vecWallpaperColors;
214     int32_t wallpaperErrorCode = 0;
215     if (isSystemApi) {
216         wallpaperErrorCode = GetColorsV9(wallpaperType, vecWallpaperColors);
217     } else {
218         wallpaperErrorCode = GetColors(wallpaperType, vecWallpaperColors);
219     }
220     auto size = vecWallpaperColors.size();
221     if (!reply.WriteInt32(static_cast<int32_t>(wallpaperErrorCode))) {
222         HILOG_ERROR("WriteInt32 fail");
223         return IPC_STUB_WRITE_PARCEL_ERR;
224     }
225     if (wallpaperErrorCode == E_OK) {
226         if (!reply.WriteUInt64Vector(vecWallpaperColors)) {
227             HILOG_ERROR("WallpaperServiceStub::OnGetColors WriteUInt64Vector error.");
228             return IPC_STUB_WRITE_PARCEL_ERR;
229         }
230     }
231     return (size == 0) ? IPC_STUB_INVALID_DATA_ERR : ERR_NONE;
232 }
233 
OnGetFile(MessageParcel & data,MessageParcel & reply)234 int32_t WallpaperServiceStub::OnGetFile(MessageParcel &data, MessageParcel &reply)
235 {
236     HILOG_INFO("WallpaperServiceStub::OnGetFile start.");
237 
238     int32_t wallpaperType = data.ReadInt32();
239     int32_t wallpaperFd = INVALID_FD;
240     int32_t wallpaperErrorCode = GetFile(wallpaperType, wallpaperFd);
241     if (!reply.WriteInt32(wallpaperErrorCode)) {
242         HILOG_ERROR("WriteInt32 fail");
243         if (wallpaperFd > INVALID_FD) {
244             close(wallpaperFd);
245         }
246         return IPC_STUB_WRITE_PARCEL_ERR;
247     }
248     if (wallpaperErrorCode == static_cast<int32_t>(E_OK) && !reply.WriteFileDescriptor(wallpaperFd)) {
249         HILOG_ERROR("WriteFileDescriptor fail");
250         close(wallpaperFd);
251         return IPC_STUB_WRITE_PARCEL_ERR;
252     }
253     if (wallpaperFd > INVALID_FD) {
254         close(wallpaperFd);
255     }
256     return ERR_NONE;
257 }
258 
OnGetWallpaperId(MessageParcel & data,MessageParcel & reply)259 int32_t WallpaperServiceStub::OnGetWallpaperId(MessageParcel &data, MessageParcel &reply)
260 {
261     HILOG_INFO("WallpaperServiceStub::OnGetWallpaperId start.");
262 
263     int wallpaperType = data.ReadInt32();
264     int wallpaerid = GetWallpaperId(wallpaperType);
265     if (!reply.WriteInt32(wallpaerid)) {
266         HILOG_ERROR("Write result data failed");
267         return IPC_STUB_WRITE_PARCEL_ERR;
268     }
269     HILOG_INFO("End. Id[%{public}d]", wallpaerid);
270     return ERR_NONE;
271 }
272 
OnGetWallpaperMinHeight(MessageParcel & data,MessageParcel & reply)273 int32_t WallpaperServiceStub::OnGetWallpaperMinHeight(MessageParcel &data, MessageParcel &reply)
274 {
275     return OnGetWallpaperMinHeightInner(data, reply, false);
276 }
277 
OnGetWallpaperMinHeightV9(MessageParcel & data,MessageParcel & reply)278 int32_t WallpaperServiceStub::OnGetWallpaperMinHeightV9(MessageParcel &data, MessageParcel &reply)
279 {
280     return OnGetWallpaperMinHeightInner(data, reply, true);
281 }
282 
OnGetWallpaperMinHeightInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)283 int32_t WallpaperServiceStub::OnGetWallpaperMinHeightInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
284 {
285     HILOG_INFO("WallpaperServiceStub::OnGetWallpaperMinHeight start.");
286     int32_t wallpaperMinHeight = 0;
287     int32_t wallpaperErrorCode = 0;
288     if (isSystemApi) {
289         wallpaperErrorCode = GetWallpaperMinHeightV9(wallpaperMinHeight);
290     } else {
291         wallpaperErrorCode = GetWallpaperMinHeight(wallpaperMinHeight);
292     }
293     if (!reply.WriteInt32(static_cast<int32_t>(wallpaperErrorCode))) {
294         HILOG_ERROR("WriteInt32 fail");
295         return IPC_STUB_WRITE_PARCEL_ERR;
296     }
297     if (wallpaperErrorCode == E_OK) {
298         if (!reply.WriteInt32(wallpaperMinHeight)) {
299             HILOG_ERROR("Write result data failed");
300             return IPC_STUB_WRITE_PARCEL_ERR;
301         }
302     }
303     HILOG_INFO("End. height[%{public}d]", wallpaperMinHeight);
304     return ERR_NONE;
305 }
306 
OnGetWallpaperMinWidth(MessageParcel & data,MessageParcel & reply)307 int32_t WallpaperServiceStub::OnGetWallpaperMinWidth(MessageParcel &data, MessageParcel &reply)
308 {
309     return OnGetWallpaperMinWidthInner(data, reply, false);
310 }
311 
OnGetWallpaperMinWidthV9(MessageParcel & data,MessageParcel & reply)312 int32_t WallpaperServiceStub::OnGetWallpaperMinWidthV9(MessageParcel &data, MessageParcel &reply)
313 {
314     return OnGetWallpaperMinWidthInner(data, reply, true);
315 }
316 
OnGetWallpaperMinWidthInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)317 int32_t WallpaperServiceStub::OnGetWallpaperMinWidthInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
318 {
319     HILOG_INFO("WallpaperServiceStub::OnGetWallpaperMinWidth start.");
320     int32_t wallpaperMinWidth = 0;
321     int32_t wallpaperErrorCode = 0;
322     if (isSystemApi) {
323         wallpaperErrorCode = GetWallpaperMinWidthV9(wallpaperMinWidth);
324     } else {
325         wallpaperErrorCode = GetWallpaperMinWidth(wallpaperMinWidth);
326     }
327     if (!reply.WriteInt32(static_cast<int32_t>(wallpaperErrorCode))) {
328         HILOG_ERROR("WriteInt32 fail");
329         return IPC_STUB_WRITE_PARCEL_ERR;
330     }
331     if (wallpaperErrorCode == E_OK) {
332         if (!reply.WriteInt32(wallpaperMinWidth)) {
333             HILOG_ERROR("Write result data failed");
334             return IPC_STUB_WRITE_PARCEL_ERR;
335         }
336     }
337     HILOG_INFO("End. width[%{public}d]", wallpaperMinWidth);
338     return ERR_NONE;
339 }
340 
OnIsChangePermitted(MessageParcel & data,MessageParcel & reply)341 int32_t WallpaperServiceStub::OnIsChangePermitted(MessageParcel &data, MessageParcel &reply)
342 {
343     HILOG_INFO("WallpaperServiceStub::OnIsChangePermitted start.");
344     auto bResult = IsChangePermitted();
345     if (!reply.WriteBool(bResult)) {
346         HILOG_ERROR("Write result data failed");
347         return IPC_STUB_WRITE_PARCEL_ERR;
348     }
349     return ERR_NONE;
350 }
351 
OnIsOperationAllowed(MessageParcel & data,MessageParcel & reply)352 int32_t WallpaperServiceStub::OnIsOperationAllowed(MessageParcel &data, MessageParcel &reply)
353 {
354     HILOG_INFO("WallpaperServiceStub::OnIsOperationAllowed start.");
355     auto bResult = IsOperationAllowed();
356     if (!reply.WriteBool(bResult)) {
357         HILOG_ERROR("Write result data failed");
358         return IPC_STUB_WRITE_PARCEL_ERR;
359     }
360     return ERR_NONE;
361 }
362 
OnResetWallpaper(MessageParcel & data,MessageParcel & reply)363 int32_t WallpaperServiceStub::OnResetWallpaper(MessageParcel &data, MessageParcel &reply)
364 {
365     return OnResetWallpaperInner(data, reply, false);
366 }
367 
OnResetWallpaperV9(MessageParcel & data,MessageParcel & reply)368 int32_t WallpaperServiceStub::OnResetWallpaperV9(MessageParcel &data, MessageParcel &reply)
369 {
370     return OnResetWallpaperInner(data, reply, true);
371 }
372 
OnResetWallpaperInner(MessageParcel & data,MessageParcel & reply,bool isSystemApi)373 int32_t WallpaperServiceStub::OnResetWallpaperInner(MessageParcel &data, MessageParcel &reply, bool isSystemApi)
374 {
375     HILOG_INFO("WallpaperServiceStub::OnResetWallpaper start.");
376     int32_t wallpaperType = data.ReadInt32();
377     int32_t wallpaperErrorCode = 0;
378     if (isSystemApi) {
379         wallpaperErrorCode = ResetWallpaperV9(wallpaperType);
380     } else {
381         wallpaperErrorCode = ResetWallpaper(wallpaperType);
382     }
383     if (!reply.WriteInt32(static_cast<int32_t>(wallpaperErrorCode))) {
384         HILOG_ERROR("Write result data failed");
385         return IPC_STUB_WRITE_PARCEL_ERR;
386     }
387     return ERR_NONE;
388 }
389 
OnWallpaperOn(MessageParcel & data,MessageParcel & reply)390 int32_t WallpaperServiceStub::OnWallpaperOn(MessageParcel &data, MessageParcel &reply)
391 {
392     HILOG_DEBUG("WallpaperServiceStub::OnWallpaperOn in");
393     sptr<IRemoteObject> remote = data.ReadRemoteObject();
394     if (remote == nullptr) {
395         HILOG_ERROR("OnWallpaperOn nullptr after ipc");
396         if (!reply.WriteInt32(static_cast<int32_t>(E_READ_PARCEL_ERROR))) {
397             return IPC_STUB_WRITE_PARCEL_ERR;
398         }
399         return IPC_STUB_INVALID_DATA_ERR;
400     }
401     sptr<IWallpaperColorChangeListener> WallpaperListenerProxy = iface_cast<IWallpaperColorChangeListener>(remote);
402 
403     bool status = On(std::move(WallpaperListenerProxy));
404     int32_t ret = status ? static_cast<int32_t>(E_OK) : static_cast<int32_t>(E_DEAL_FAILED);
405     if (!reply.WriteInt32(ret)) {
406         HILOG_ERROR("WriteInt32 failed");
407         return IPC_STUB_WRITE_PARCEL_ERR;
408     }
409     HILOG_DEBUG("WallpaperServiceStub::OnWallpaperOn out");
410     return ERR_NONE;
411 }
412 
OnWallpaperOff(MessageParcel & data,MessageParcel & reply)413 int32_t WallpaperServiceStub::OnWallpaperOff(MessageParcel &data, MessageParcel &reply)
414 {
415     HILOG_DEBUG("WallpaperServiceStub::OnWallpaperOff in");
416     sptr<IRemoteObject> remote = data.ReadRemoteObject();
417     bool status = false;
418     if (remote == nullptr) {
419         status = Off(nullptr);
420     } else {
421         sptr<IWallpaperColorChangeListener> WallpaperListenerProxy = iface_cast<IWallpaperColorChangeListener>(remote);
422         status = Off(std::move(WallpaperListenerProxy));
423     }
424     int32_t ret = status ? static_cast<int32_t>(E_OK) : static_cast<int32_t>(E_DEAL_FAILED);
425     if (!reply.WriteInt32(ret)) {
426         HILOG_ERROR("WriteInt32 failed");
427         return IPC_STUB_WRITE_PARCEL_ERR;
428     }
429     HILOG_DEBUG("WallpaperServiceStub::OnWallpaperOff out");
430     return ERR_NONE;
431 }
432 
OnRegisterWallpaperCallback(MessageParcel & data,MessageParcel & reply)433 int32_t WallpaperServiceStub::OnRegisterWallpaperCallback(MessageParcel &data, MessageParcel &reply)
434 {
435     HILOG_INFO("  WallpaperServiceStub::OnRegisterWallpaperCallback start");
436     sptr<IRemoteObject> object = data.ReadRemoteObject();
437     if (object == nullptr) {
438         HILOG_ERROR("RegisterWallpaperCallback failed");
439         reply.WriteInt32(static_cast<int32_t>(E_READ_PARCEL_ERROR));
440         return IPC_STUB_INVALID_DATA_ERR;
441     }
442     sptr<IWallpaperCallback> callbackProxy = iface_cast<IWallpaperCallback>(object);
443 
444     RegisterWallpaperCallback(callbackProxy);
445     if (!reply.WriteInt32(static_cast<int32_t>(E_OK))) {
446         HILOG_ERROR("WriteInt32 failed");
447         return IPC_STUB_WRITE_PARCEL_ERR;
448     }
449     return ERR_NONE;
450 }
451 } // namespace WallpaperMgrService
452 } // namespace OHOS