• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 OHOS_AAFWK_SA_MGR_CLIENT_H
17 #define OHOS_AAFWK_SA_MGR_CLIENT_H
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <unordered_map>
23 
24 #include "if_system_ability_manager.h"
25 #include "iremote_object.h"
26 #include "singleton.h"
27 
28 namespace OHOS {
29 namespace AAFwk {
30 /**
31  * @class SaMgrClient
32  * SaMgrClient.
33  */
34 class SaMgrClient {
35     DECLARE_DELAYED_SINGLETON(SaMgrClient)
36 public:
37     sptr<IRemoteObject> GetSystemAbility(const int32_t systemAbilityId);
38     void RegisterSystemAbility(const int32_t systemAbilityId, sptr<IRemoteObject> broker);
39 
40 private:
41     OHOS::sptr<ISystemAbilityManager> saMgr_;
42     std::mutex saMutex_;
43     std::unordered_map<int32_t, sptr<IRemoteObject>> servicesMap_;
44 };
45 }  // namespace AAFwk
46 }  // namespace OHOS
47 #endif  // OHOS_AAFWK_SA_MGR_CLIENT_H
48