• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-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 "app_manager_mock.h"
17 
18 #include "gtest/gtest.h"
19 
20 namespace OHOS {
21 namespace DistributedHardware {
22 DM_IMPLEMENT_SINGLE_INSTANCE(AppManager);
GetAppId()23 const std::string AppManager::GetAppId()
24 {
25     return DmAppManager::dmAppManager->GetAppId();
26 }
27 
IsSystemSA()28 bool AppManager::IsSystemSA()
29 {
30     return DmAppManager::dmAppManager->IsSystemSA();
31 }
32 
GetNativeTokenIdByName(std::string & processName,int64_t & tokenId)33 int32_t AppManager::GetNativeTokenIdByName(std::string &processName, int64_t &tokenId)
34 {
35     return DmAppManager::dmAppManager->GetNativeTokenIdByName(processName, tokenId);
36 }
37 
GetHapTokenIdByName(int32_t userId,std::string & bundleName,int32_t instIndex,int64_t & tokenId)38 int32_t AppManager::GetHapTokenIdByName(int32_t userId, std::string &bundleName, int32_t instIndex, int64_t &tokenId)
39 {
40     return DmAppManager::dmAppManager->GetHapTokenIdByName(userId, bundleName, instIndex, tokenId);
41 }
42 
GetAppIdByPkgName(const std::string & pkgName,std::string & appId)43 int32_t AppManager::GetAppIdByPkgName(const std::string &pkgName, std::string &appId)
44 {
45     return DmAppManager::dmAppManager->GetAppIdByPkgName(pkgName, appId);
46 }
47 
GetBundleNameForSelf(std::string & bundleName)48 int32_t AppManager::GetBundleNameForSelf(std::string &bundleName)
49 {
50     return DmAppManager::dmAppManager->GetBundleNameForSelf(bundleName);
51 }
52 } // namespace DistributedHardware
53 } // namespace OHOS