• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef OHOS_ABILITY_RUNTIME_IMPLICIT_START_PROCESSOR_H
16 #define OHOS_ABILITY_RUNTIME_IMPLICIT_START_PROCESSOR_H
17 
18 #include <vector>
19 #include <string>
20 #include <unordered_set>
21 
22 #include "ability_record.h"
23 #include "bundle_mgr_interface.h"
24 #include "system_dialog_scheduler.h"
25 
26 namespace OHOS {
27 namespace AAFwk {
28 /**
29  * @class ImplicitStartProcessor
30  * ImplicitStartProcessor.
31  */
32 class ImplicitStartProcessor : public std::enable_shared_from_this<ImplicitStartProcessor> {
33 public:
34     explicit ImplicitStartProcessor() = default;
35     virtual ~ImplicitStartProcessor() = default;
36 
37     static bool IsImplicitStartAction(const Want &want);
38 
39     int ImplicitStartAbility(AbilityRequest &request, int32_t userId);
40 
41 private:
42     int GenerateAbilityRequestByAction(int32_t userId,
43         AbilityRequest &request, std::vector<DialogAppInfo> &dialogAppInfos);
44 
45     sptr<AppExecFwk::IBundleMgr> GetBundleManager();
46 
47     using StartAbilityClosure = std::function<int32_t()>;
48     int CallStartAbilityInner(int32_t userId, const Want &want, const StartAbilityClosure &callBack,
49         const AbilityCallType &callType);
50 
51     int32_t ImplicitStartAbilityInner(const Want &targetWant, const AbilityRequest &request, int32_t userId);
52 
53     bool CheckImplicitStartExtensionIsValid(const AbilityRequest &request,
54         const AppExecFwk::ExtensionAbilityInfo &extensionInfo);
55 
56 private:
57     const static std::vector<std::string> blackList;
58     const static std::unordered_set<AppExecFwk::ExtensionAbilityType> extensionWhiteList;
59     sptr<AppExecFwk::IBundleMgr> iBundleManager_;
60 };
61 }  // namespace AAFwk
62 }  // namespace OHOS
63 #endif  // OHOS_ABILITY_RUNTIME_IMPLICIT_START_PROCESSOR_H