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 "screenlock_system_ability_stub.h"
17
18 #include "sclock_log.h"
19 #include "screenlock_common.h"
20
21 namespace OHOS {
22 namespace ScreenLock {
OnCallBack(const SystemEvent & systemEvent)23 void ScreenLockSystemAbilityStub::OnCallBack(const SystemEvent &systemEvent)
24 {
25 }
SetErrorInfo(const ErrorInfo & errorInfo)26 void ScreenLockSystemAbilityStub::SetErrorInfo(const ErrorInfo &errorInfo)
27 {
28 }
29
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)30 int32_t ScreenLockSystemAbilityStub::OnRemoteRequest(
31 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
32 {
33 auto descriptorToken = data.ReadInterfaceToken();
34 if (descriptorToken != GetDescriptor()) {
35 SCLOCK_HILOGE("Remote descriptor not the same as local descriptor.");
36 return E_SCREENLOCK_TRANSACT_ERROR;
37 }
38 SCLOCK_HILOGD("ScreenLockSystemAbilityStub code----》%{public}u", code);
39 switch (code) {
40 case ONCALLBACK: {
41 SystemEvent systemEvent(data.ReadString(), data.ReadString());
42 OnCallBack(systemEvent);
43 break;
44 }
45 default: {
46 return OHOS::UNKNOWN_TRANSACTION;
47 }
48 }
49 return OHOS::NO_ERROR;
50 }
51 } // namespace ScreenLock
52 } // namespace OHOS
53