1 /* 2 * Copyright (c) 2024 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 ABILITY_MANAGER_ACCESS_LOADER_H 17 #define ABILITY_MANAGER_ACCESS_LOADER_H 18 19 #include <iremote_proxy.h> 20 21 #include "want.h" 22 23 namespace OHOS { 24 namespace Security { 25 namespace AccessToken { 26 namespace { 27 const int32_t DEFAULT_VALUE = -1; 28 } 29 const static std::string ABILITY_MANAGER_LIBPATH = "libaccesstoken_ability_manager_adapter.z.so"; 30 31 class AbilityManagerAccessLoaderInterface { 32 public: AbilityManagerAccessLoaderInterface()33 AbilityManagerAccessLoaderInterface() {} ~AbilityManagerAccessLoaderInterface()34 virtual ~AbilityManagerAccessLoaderInterface() {} 35 virtual int32_t StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 36 int32_t requestCode = DEFAULT_VALUE, int32_t userId = DEFAULT_VALUE); 37 }; 38 39 class AbilityManagerAccessLoader final: public AbilityManagerAccessLoaderInterface { 40 int32_t StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 41 int32_t requestCode = DEFAULT_VALUE, int32_t userId = DEFAULT_VALUE) override; 42 }; 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 void* Create(); 48 void Destroy(void* loaderPtr); 49 #ifdef __cplusplus 50 } 51 #endif 52 } // namespace AccessToken 53 } // namespace Security 54 } // namespace OHOS 55 #endif // ABILITY_MANAGER_ACCESS_LOADER_H