• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "hidden_start_observer_stub.h"
17 #include "appexecfwk_errors.h"
18 #include "hilog_tag_wrapper.h"
19 #include "ipc_types.h"
20 #include "iremote_object.h"
21 
22 namespace OHOS {
23 namespace AAFwk {
24 std::mutex HiddenStartObserverStub::callbackMutex_;
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)25 int HiddenStartObserverStub::OnRemoteRequest(
26     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
27 {
28     std::u16string descriptor = HiddenStartObserverStub::GetDescriptor();
29     std::u16string remoteDescriptor = data.ReadInterfaceToken();
30     if (descriptor != remoteDescriptor) {
31         TAG_LOGE(AAFwkTag::ABILITYMGR, "local descriptor is not equal to remote.");
32         return ERR_INVALID_STATE;
33     }
34 
35     if (static_cast<Message>(code) == Message::TRANSACT_ON_IS_HIDDEN_START) {
36         return HandleIsHiddenStart(data, reply);
37     }
38     TAG_LOGW(AAFwkTag::ABILITYMGR, "HiddenStartObserverStub::OnRemoteRequest, default case, need check");
39     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
40 }
41 
HandleIsHiddenStart(MessageParcel & data,MessageParcel & reply)42 int32_t HiddenStartObserverStub::HandleIsHiddenStart(MessageParcel &data, MessageParcel &reply)
43 {
44     int32_t uid = data.ReadInt32();
45     bool result = IsHiddenStart(uid);
46     reply.WriteBool(result);
47     return NO_ERROR;
48 }
49 } // namespace AAFwk
50 } // namespace OHOS