1 /* 2 * Copyright (c) 2021-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_SAMGR_NATIVE_INCLUDE_SYSTEM_ABILITY_MANAGER_STUB_H_ 17 #define SERVICES_SAMGR_NATIVE_INCLUDE_SYSTEM_ABILITY_MANAGER_STUB_H_ 18 19 #include <map> 20 #include "if_system_ability_manager.h" 21 #include "iremote_object.h" 22 #include "iremote_stub.h" 23 24 namespace OHOS { 25 class SystemAbilityManagerStub : public IRemoteStub<ISystemAbilityManager> { 26 public: 27 SystemAbilityManagerStub(); 28 ~SystemAbilityManagerStub() = default; 29 int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption &option) override; 30 31 protected: 32 static bool CanRequest(); 33 static bool EnforceInterceToken(MessageParcel& data); 34 35 private: 36 int32_t ListSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 37 int32_t SubsSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 38 int32_t UnSubsSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 39 int32_t CheckRemtSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 40 int32_t AddOndemandSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 41 int32_t CheckSystemAbilityImmeInner(MessageParcel& data, MessageParcel& reply); 42 int32_t AddSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 43 int32_t GetSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 44 int32_t CheckSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 45 int32_t AddSystemProcessInner(MessageParcel& data, MessageParcel& reply); 46 int32_t RemoveSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 47 int32_t LoadSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 48 int32_t LoadRemoteSystemAbilityInner(MessageParcel& data, MessageParcel& reply); 49 int32_t UnmarshalingSaExtraProp(MessageParcel& data, SAExtraProp& extraProp); 50 static int32_t GetHapIdMultiuser(int32_t uid); 51 52 using SystemAbilityManagerStubFunc = 53 int32_t (SystemAbilityManagerStub::*)(MessageParcel& data, MessageParcel& reply); 54 std::map<uint32_t, SystemAbilityManagerStubFunc> memberFuncMap_; 55 }; 56 } // namespace OHOS 57 58 #endif // !defined(SERVICES_SAMGR_NATIVE_INCLUDE_SYSTEM_ABILITY_MANAGER_STUB_H_) 59