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 #include "ability_manager_access_loader.h" 16 17 #include "ability_manager_adapter.h" 18 19 namespace OHOS { 20 namespace Security { 21 namespace AccessToken { StartAbility(const InnerWant & innerWant,const sptr<IRemoteObject> & callerToken)22int32_t AbilityManagerAccessLoader::StartAbility( 23 const InnerWant &innerWant, const sptr<IRemoteObject> &callerToken) 24 { 25 #ifdef ABILITY_RUNTIME_ENABLE 26 return AbilityManagerAdapter::GetInstance().StartAbility(innerWant, callerToken); 27 #else 28 return 0; 29 #endif 30 } 31 KillProcessForPermissionUpdate(uint32_t accessTokenId)32int32_t AbilityManagerAccessLoader::KillProcessForPermissionUpdate(uint32_t accessTokenId) 33 { 34 return AbilityManagerAdapter::GetInstance().KillProcessForPermissionUpdate(accessTokenId); 35 } 36 Create()37void* Create() 38 { 39 return reinterpret_cast<void*>(new AbilityManagerAccessLoader); 40 } 41 Destroy(void * loaderPtr)42void Destroy(void* loaderPtr) 43 { 44 AbilityManagerAccessLoaderInterface* loader = reinterpret_cast<AbilityManagerAccessLoaderInterface*>(loaderPtr); 45 if (loader != nullptr) { 46 delete loader; 47 } 48 } 49 } // namespace AccessToken 50 } // namespace Security 51 } // namespace OHOS 52