1 /*
2 * Copyright (c) 2023 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 "standby_service_proxy.h"
17
18 #include <message_parcel.h>
19
20 #include "standby_service_errors.h"
21 #include "standby_service_log.h"
22 #include "istandby_ipc_inteface_code.h"
23
24 namespace OHOS {
25 namespace DevStandbyMgr {
StandbyServiceProxy(const sptr<IRemoteObject> & impl)26 StandbyServiceProxy::StandbyServiceProxy(const sptr<IRemoteObject>& impl)
27 :IRemoteProxy<IStandbyService>(impl) {}
~StandbyServiceProxy()28 StandbyServiceProxy::~StandbyServiceProxy() {}
29
SubscribeStandbyCallback(const sptr<IStandbyServiceSubscriber> & subscriber)30 ErrCode StandbyServiceProxy::SubscribeStandbyCallback(const sptr<IStandbyServiceSubscriber>& subscriber)
31 {
32 if (subscriber == nullptr) {
33 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent subscriber is null");
34 return ERR_STANDBY_PARCELABLE_FAILED;
35 }
36
37 MessageParcel data;
38 MessageParcel reply;
39 MessageOption option = {MessageOption::TF_SYNC};
40 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
41 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent write descriptor failed");
42 return ERR_STANDBY_PARCELABLE_FAILED;
43 }
44 if (!data.WriteRemoteObject(subscriber->AsObject())) {
45 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent write subscriber failed");
46 return ERR_STANDBY_PARCELABLE_FAILED;
47 }
48 if (!data.WriteString(subscriber->GetSubscriberName())) {
49 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent write SubscriberName failed");
50 return ERR_STANDBY_PARCELABLE_FAILED;
51 }
52 if (!data.WriteString(subscriber->GetModuleName())) {
53 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent write ModuleName failed");
54 return ERR_STANDBY_PARCELABLE_FAILED;
55 }
56
57 ErrCode result = InnerTransact(
58 static_cast<uint32_t>(IStandbyInterfaceCode::SUBSCRIBE_STANDBY_CALLBACK), option, data, reply);
59 if (result != ERR_OK) {
60 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent fail: transact ErrCode=%{public}d", result);
61 return ERR_STANDBY_TRANSACT_FAILED;
62 }
63 if (!reply.ReadInt32(result)) {
64 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent fail: read result failed");
65 return ERR_STANDBY_PARCELABLE_FAILED;
66 }
67 if (result != ERR_OK) {
68 STANDBYSERVICE_LOGW("SubscribeSleepStateEvent failed");
69 }
70 return result;
71 }
72
UnsubscribeStandbyCallback(const sptr<IStandbyServiceSubscriber> & subscriber)73 ErrCode StandbyServiceProxy::UnsubscribeStandbyCallback(const sptr<IStandbyServiceSubscriber>& subscriber)
74 {
75 if (subscriber == nullptr) {
76 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent subscriber is null");
77 return ERR_STANDBY_PARCELABLE_FAILED;
78 }
79
80 MessageParcel data;
81 MessageParcel reply;
82 MessageOption option = {MessageOption::TF_SYNC};
83 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
84 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent write descriptor failed");
85 return ERR_STANDBY_PARCELABLE_FAILED;
86 }
87 if (!data.WriteRemoteObject(subscriber->AsObject())) {
88 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent write subscriber failed");
89 return ERR_STANDBY_PARCELABLE_FAILED;
90 }
91
92 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::UNSUBSCRIBE_STANDBY_CALLBACK),
93 option, data, reply);
94 if (result != ERR_OK) {
95 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent fail: transact ErrCode=%{public}d", result);
96 return ERR_STANDBY_TRANSACT_FAILED;
97 }
98 if (!reply.ReadInt32(result)) {
99 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent fail: read result failed");
100 return ERR_STANDBY_PARCELABLE_FAILED;
101 }
102 if (result != ERR_OK) {
103 STANDBYSERVICE_LOGW("UnsubscribeSleepStateEvent failed");
104 return result;
105 }
106 return result;
107 }
108
ApplyAllowResource(const sptr<ResourceRequest> & resourceRequest)109 ErrCode StandbyServiceProxy::ApplyAllowResource(const sptr<ResourceRequest>& resourceRequest)
110 {
111 MessageParcel data;
112 MessageParcel reply;
113 MessageOption option = {MessageOption::TF_SYNC};
114 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
115 STANDBYSERVICE_LOGW("ApplyAllowResource write descriptor failed");
116 return ERR_STANDBY_PARCELABLE_FAILED;
117 }
118 if (!resourceRequest->Marshalling(data)) {
119 STANDBYSERVICE_LOGW("ApplyAllowResource write parameter failed");
120 return ERR_STANDBY_PARCELABLE_FAILED;
121 }
122
123 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::APPLY_ALLOW_RESOURCE),
124 option, data, reply);
125 if (result != ERR_OK) {
126 STANDBYSERVICE_LOGW("ApplyAllowResource fail: transact ErrCode=%{public}d", result);
127 return ERR_STANDBY_TRANSACT_FAILED;
128 }
129 if (!reply.ReadInt32(result)) {
130 STANDBYSERVICE_LOGW("ApplyAllowResource fail: read result failed");
131 return ERR_STANDBY_PARCELABLE_FAILED;
132 }
133 if (result != ERR_OK) {
134 STANDBYSERVICE_LOGW("ApplyAllowResource failed");
135 return result;
136 }
137 return result;
138 }
139
UnapplyAllowResource(const sptr<ResourceRequest> & resourceRequest)140 ErrCode StandbyServiceProxy::UnapplyAllowResource(const sptr<ResourceRequest>& resourceRequest)
141 {
142 MessageParcel data;
143 MessageParcel reply;
144 MessageOption option = {MessageOption::TF_SYNC};
145 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
146 STANDBYSERVICE_LOGW("RemoveAllowList write descriptor failed");
147 return ERR_STANDBY_PARCELABLE_FAILED;
148 }
149 if (!resourceRequest->Marshalling(data)) {
150 STANDBYSERVICE_LOGW("RemoveAllowList write parameter failed");
151 return ERR_STANDBY_PARCELABLE_FAILED;
152 }
153
154 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::UNAPPLY_ALLOW_RESOURCE),
155 option, data, reply);
156 if (result != ERR_OK) {
157 STANDBYSERVICE_LOGW("RemoveAllowList fail: transact ErrCode=%{public}d", result);
158 return ERR_STANDBY_TRANSACT_FAILED;
159 }
160 if (!reply.ReadInt32(result)) {
161 STANDBYSERVICE_LOGW("RemoveAllowList fail: read result failed");
162 return ERR_STANDBY_PARCELABLE_FAILED;
163 }
164 if (result != ERR_OK) {
165 STANDBYSERVICE_LOGW("RemoveAllowList failed");
166 return result;
167 }
168 return result;
169 }
170
GetAllowList(uint32_t allowType,std::vector<AllowInfo> & allowInfoList,uint32_t reasonCode)171 ErrCode StandbyServiceProxy::GetAllowList(uint32_t allowType, std::vector<AllowInfo>& allowInfoList,
172 uint32_t reasonCode)
173 {
174 MessageParcel data;
175 MessageParcel reply;
176 MessageOption option = {MessageOption::TF_SYNC};
177 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
178 STANDBYSERVICE_LOGW("GetAllowList write descriptor failed");
179 return ERR_STANDBY_PARCELABLE_FAILED;
180 }
181 if (!data.WriteUint32(allowType) || !data.WriteUint32(reasonCode)) {
182 STANDBYSERVICE_LOGW("GetAllowList write parameter failed");
183 return ERR_STANDBY_PARCELABLE_FAILED;
184 }
185
186 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::GET_ALLOW_LIST),
187 option, data, reply);
188 if (result != ERR_OK) {
189 STANDBYSERVICE_LOGW("GetAllowList fail: transact ErrCode=%{public}d", result);
190 return ERR_STANDBY_TRANSACT_FAILED;
191 }
192 if (!reply.ReadInt32(result)) {
193 STANDBYSERVICE_LOGW("GetAllowList fail: read result failed.");
194 return ERR_STANDBY_PARCELABLE_FAILED;
195 }
196 if (result != ERR_OK) {
197 STANDBYSERVICE_LOGW("GetAllowList failed");
198 return result;
199 }
200 uint32_t infoSize = reply.ReadUint32();
201 for (uint32_t i = 0; i < infoSize; i++) {
202 auto info = AllowInfo::Unmarshalling(reply);
203 if (info == nullptr) {
204 STANDBYSERVICE_LOGW("GetAllowList Read Parcelable infos failed.");
205 return ERR_STANDBY_PARCELABLE_FAILED;
206 }
207 allowInfoList.emplace_back(*info);
208 }
209
210 return result;
211 }
212
IsDeviceInStandby(bool & isStandby)213 ErrCode StandbyServiceProxy::IsDeviceInStandby(bool& isStandby)
214 {
215 MessageParcel data;
216 MessageParcel reply;
217 MessageOption option = {MessageOption::TF_SYNC};
218 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
219 STANDBYSERVICE_LOGW("IsDeviceInStandby write descriptor failed");
220 return ERR_STANDBY_PARCELABLE_FAILED;
221 }
222
223 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::IS_DEVICE_IN_STANDBY),
224 option, data, reply);
225 if (result != ERR_OK) {
226 STANDBYSERVICE_LOGW("IsDeviceInStandby fail: transact ErrCode=%{public}d", result);
227 return ERR_STANDBY_TRANSACT_FAILED;
228 }
229 if (!reply.ReadInt32(result)) {
230 STANDBYSERVICE_LOGW("IsDeviceInStandby fail: read result failed.");
231 return ERR_STANDBY_PARCELABLE_FAILED;
232 }
233 if (result != ERR_OK) {
234 STANDBYSERVICE_LOGW("IsDeviceInStandby failed");
235 return result;
236 }
237 if (!reply.ReadBool(isStandby)) {
238 STANDBYSERVICE_LOGW("IsDeviceInStandby fail: read result failed.");
239 return ERR_STANDBY_PARCELABLE_FAILED;
240 }
241 return result;
242 }
243
SetNatInterval(uint32_t & type,bool & enable,uint32_t & interval)244 ErrCode StandbyServiceProxy::SetNatInterval(uint32_t& type, bool& enable, uint32_t& interval)
245 {
246 MessageParcel data;
247 MessageParcel reply;
248 MessageOption option;
249 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
250 STANDBYSERVICE_LOGW("SetNatInterval write descriptor failed");
251 return ERR_STANDBY_PARCELABLE_FAILED;
252 }
253
254 if (!data.WriteUint32(type) || !data.WriteBool(enable) || !data.WriteUint32(interval)) {
255 STANDBYSERVICE_LOGW("SetNatInterval write parameter failed");
256 return ERR_STANDBY_PARCELABLE_FAILED;
257 }
258
259 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::SET_NAT_INTERVAL),
260 option, data, reply);
261 if (result != ERR_OK) {
262 STANDBYSERVICE_LOGW("SetNatInterval fail: transact ErrCode=%{public}d", result);
263 return ERR_STANDBY_TRANSACT_FAILED;
264 }
265 if (!reply.ReadInt32(result)) {
266 STANDBYSERVICE_LOGW("SetNatInterval fail: read result failed.");
267 return ERR_STANDBY_PARCELABLE_FAILED;
268 }
269 if (result != ERR_OK) {
270 STANDBYSERVICE_LOGW("SetNatInterval failed");
271 return result;
272 }
273 return result;
274 }
275
ReportWorkSchedulerStatus(bool started,int32_t uid,const std::string & bundleName)276 ErrCode StandbyServiceProxy::ReportWorkSchedulerStatus(bool started, int32_t uid, const std::string& bundleName)
277 {
278 MessageParcel data;
279 MessageParcel reply;
280 MessageOption option = {MessageOption::TF_SYNC};
281 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
282 STANDBYSERVICE_LOGW("IsDeviceInStandby write descriptor failed");
283 return ERR_STANDBY_PARCELABLE_FAILED;
284 }
285
286 if (!data.WriteBool(started) || !data.WriteInt32(uid) || !data.WriteString(bundleName)) {
287 STANDBYSERVICE_LOGW("ReportWorkSchedulerStatus write parameter failed");
288 return ERR_STANDBY_PARCELABLE_FAILED;
289 }
290 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::REPORT_WORK_SCHEDULER_STATUS),
291 option, data, reply);
292 if (result != ERR_OK) {
293 STANDBYSERVICE_LOGW("ReportWorkSchedulerStatus fail: transact ErrCode=%{public}d", result);
294 return ERR_STANDBY_TRANSACT_FAILED;
295 }
296 if (!reply.ReadInt32(result)) {
297 STANDBYSERVICE_LOGW("ReportWorkSchedulerStatus fail: read result failed.");
298 return ERR_STANDBY_PARCELABLE_FAILED;
299 }
300 if (result != ERR_OK) {
301 STANDBYSERVICE_LOGW("ReportWorkSchedulerStatus failed");
302 return result;
303 }
304 return result;
305 }
306
GetRestrictList(uint32_t restrictType,std::vector<AllowInfo> & restrictInfoList,uint32_t reasonCode)307 ErrCode StandbyServiceProxy::GetRestrictList(uint32_t restrictType, std::vector<AllowInfo>& restrictInfoList,
308 uint32_t reasonCode)
309 {
310 MessageParcel data;
311 MessageParcel reply;
312 MessageOption option = {MessageOption::TF_SYNC};
313 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
314 STANDBYSERVICE_LOGW("GetRestrictList write descriptor failed");
315 return ERR_STANDBY_PARCELABLE_FAILED;
316 }
317 if (!data.WriteUint32(restrictType) || !data.WriteUint32(reasonCode)) {
318 STANDBYSERVICE_LOGW("GetRestrictList write parameter failed");
319 return ERR_STANDBY_PARCELABLE_FAILED;
320 }
321
322 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::GET_RESTRICT_LIST),
323 option, data, reply);
324 if (result != ERR_OK) {
325 STANDBYSERVICE_LOGW("GetRestrictList fail: transact ErrCode=%{public}d", result);
326 return ERR_STANDBY_TRANSACT_FAILED;
327 }
328 if (!reply.ReadInt32(result)) {
329 STANDBYSERVICE_LOGW("GetRestrictList fail: read result failed.");
330 return ERR_STANDBY_PARCELABLE_FAILED;
331 }
332 if (result != ERR_OK) {
333 STANDBYSERVICE_LOGW("GetRestrictList failed");
334 return result;
335 }
336 uint32_t infoSize = reply.ReadUint32();
337 for (uint32_t i = 0; i < infoSize; i++) {
338 auto info = AllowInfo::Unmarshalling(reply);
339 if (info == nullptr) {
340 STANDBYSERVICE_LOGW("GetRestrictList Read Parcelable infos failed.");
341 return ERR_STANDBY_PARCELABLE_FAILED;
342 }
343 restrictInfoList.emplace_back(*info);
344 }
345
346 return result;
347 }
348
IsStrategyEnabled(const std::string & strategyName,bool & enabled)349 ErrCode StandbyServiceProxy::IsStrategyEnabled(const std::string& strategyName, bool& enabled)
350 {
351 MessageParcel data;
352 MessageParcel reply;
353 MessageOption option = {MessageOption::TF_SYNC};
354 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
355 STANDBYSERVICE_LOGW("IsStrategyEnabled write descriptor failed");
356 return ERR_STANDBY_PARCELABLE_FAILED;
357 }
358 if (!data.WriteString(strategyName)) {
359 STANDBYSERVICE_LOGW("IsStrategyEnabled write parameter failed");
360 return ERR_STANDBY_PARCELABLE_FAILED;
361 }
362
363 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::IS_STRATEGY_ENABLED),
364 option, data, reply);
365 if (result != ERR_OK) {
366 STANDBYSERVICE_LOGW("IsStrategyEnabled fail: transact ErrCode=%{public}d", result);
367 return ERR_STANDBY_TRANSACT_FAILED;
368 }
369 if (!reply.ReadInt32(result)) {
370 STANDBYSERVICE_LOGW("IsStrategyEnabled fail: read result failed.");
371 return ERR_STANDBY_PARCELABLE_FAILED;
372 }
373 if (result != ERR_OK) {
374 STANDBYSERVICE_LOGW("IsStrategyEnabled failed");
375 return result;
376 }
377 if (!reply.ReadBool(enabled)) {
378 STANDBYSERVICE_LOGW("IsStrategyEnabled fail: read result failed.");
379 return ERR_STANDBY_PARCELABLE_FAILED;
380 }
381 return result;
382 }
383
ReportPowerOverused(const std::string & module,uint32_t level)384 ErrCode StandbyServiceProxy::ReportPowerOverused(const std::string &module, uint32_t level)
385 {
386 MessageParcel data;
387 MessageParcel reply;
388 MessageOption option = {MessageOption::TF_SYNC};
389 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
390 STANDBYSERVICE_LOGW("IsDeviceInStandby write descriptor failed");
391 return ERR_STANDBY_PARCELABLE_FAILED;
392 }
393
394 if (!data.WriteString(module) || !data.WriteUint32(level)) {
395 STANDBYSERVICE_LOGW("ReportPowerOverused write parameter failed");
396 return ERR_STANDBY_PARCELABLE_FAILED;
397 }
398
399 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::POWER_OVERUSED),
400 option, data, reply);
401 if (result != ERR_OK) {
402 STANDBYSERVICE_LOGW("ReportPowerOverused fail: transact ErrCode=%{public}d", result);
403 return ERR_STANDBY_TRANSACT_FAILED;
404 }
405 if (!reply.ReadInt32(result)) {
406 STANDBYSERVICE_LOGW("ReportPowerOverused fail: read result failed.");
407 return ERR_STANDBY_PARCELABLE_FAILED;
408 }
409 if (result != ERR_OK) {
410 STANDBYSERVICE_LOGW("ReportPowerOverused failed");
411 return result;
412 }
413 return result;
414 }
415
ReportDeviceStateChanged(DeviceStateType type,bool enabled)416 ErrCode StandbyServiceProxy::ReportDeviceStateChanged(DeviceStateType type, bool enabled)
417 {
418 MessageParcel data;
419 MessageParcel reply;
420 MessageOption option = {MessageOption::TF_SYNC};
421 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
422 STANDBYSERVICE_LOGW("IsDeviceInStandby write descriptor failed");
423 return ERR_STANDBY_PARCELABLE_FAILED;
424 }
425
426 if (!data.WriteInt32(static_cast<int32_t>(type)) || !data.WriteBool(enabled)) {
427 STANDBYSERVICE_LOGW("ReportDeviceStateChanged write parameter failed");
428 return ERR_STANDBY_PARCELABLE_FAILED;
429 }
430 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::REPORT_DEVICE_STATE_CHANGED),
431 option, data, reply);
432 if (result != ERR_OK) {
433 STANDBYSERVICE_LOGW("ReportDeviceStateChanged fail: transact ErrCode=%{public}d", result);
434 return ERR_STANDBY_TRANSACT_FAILED;
435 }
436 if (!reply.ReadInt32(result)) {
437 STANDBYSERVICE_LOGW("ReportDeviceStateChanged fail: read result failed.");
438 return ERR_STANDBY_PARCELABLE_FAILED;
439 }
440 if (result != ERR_OK) {
441 STANDBYSERVICE_LOGW("ReportDeviceStateChanged failed");
442 return result;
443 }
444 return result;
445 }
446
InnerTransact(uint32_t code,MessageOption & flags,MessageParcel & data,MessageParcel & reply)447 ErrCode StandbyServiceProxy::InnerTransact(uint32_t code, MessageOption& flags,
448 MessageParcel& data, MessageParcel& reply)
449 {
450 auto remote = Remote();
451 if (remote == nullptr) {
452 STANDBYSERVICE_LOGE("InnerTransact get Remote fail code %{public}d", code);
453 return ERR_DEAD_OBJECT;
454 }
455 int32_t err = remote->SendRequest(code, data, reply, flags);
456 switch (err) {
457 case NO_ERROR: {
458 return ERR_OK;
459 }
460 case DEAD_OBJECT: {
461 STANDBYSERVICE_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}u", err, code);
462 return ERR_DEAD_OBJECT;
463 }
464 default: {
465 STANDBYSERVICE_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}u", err, code);
466 return ERR_STANDBY_TRANSACT_FAILED;
467 }
468 }
469 }
470
HandleEvent(const uint32_t resType,const int64_t value,const std::string & sceneInfo)471 ErrCode StandbyServiceProxy::HandleEvent(const uint32_t resType, const int64_t value, const std::string &sceneInfo)
472 {
473 MessageParcel data;
474 MessageParcel reply;
475 MessageOption option = {MessageOption::TF_SYNC};
476 if (!data.WriteInterfaceToken(StandbyServiceProxy::GetDescriptor())) {
477 STANDBYSERVICE_LOGW("HandleEvent write descriptor failed");
478 return ERR_STANDBY_PARCELABLE_FAILED;
479 }
480
481 if (!data.WriteUint32(resType) || !data.WriteInt64(value) || !data.WriteString(sceneInfo)) {
482 STANDBYSERVICE_LOGW("ReportDeviceStateChanged wirte parameter failed");
483 return ERR_STANDBY_PARCELABLE_FAILED;
484 }
485 ErrCode result = InnerTransact(static_cast<uint32_t>(IStandbyInterfaceCode::HANDLE_EVENT),
486 option, data, reply);
487 if (result != ERR_OK) {
488 STANDBYSERVICE_LOGW("HandleEvent fail: transact ErrCode=%{public}d", result);
489 return ERR_STANDBY_TRANSACT_FAILED;
490 }
491 if (!reply.ReadInt32(result)) {
492 STANDBYSERVICE_LOGW("HandleEvent fail: read result dailed.");
493 return ERR_STANDBY_PARCELABLE_FAILED;
494 }
495 if (result != ERR_OK) {
496 STANDBYSERVICE_LOGW("HandleEvent failed");
497 return result;
498 }
499 return result;
500 }
501 } // namespace DevStandbyMgr
502 } // namespace OHOS