• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_UI_EXTENSION_UTILS_H
17 #define OHOS_AAFwk_UI_EXTENSION_UTILS_H
18 
19 #include <unordered_set>
20 #include "extension_ability_info.h"
21 
22 namespace OHOS {
23 namespace AAFwk {
24 namespace UIExtensionUtils {
25 // ui extension type list
26 const std::unordered_set<AppExecFwk::ExtensionAbilityType> UI_EXTENSION_SET = {
27     AppExecFwk::ExtensionAbilityType::SHARE,
28     AppExecFwk::ExtensionAbilityType::ACTION,
29     AppExecFwk::ExtensionAbilityType::UI,
30     AppExecFwk::ExtensionAbilityType::SYSPICKER_MEDIACONTROL,
31     AppExecFwk::ExtensionAbilityType::SYSDIALOG_USERAUTH,
32     AppExecFwk::ExtensionAbilityType::SYSDIALOG_COMMON,
33     AppExecFwk::ExtensionAbilityType::SYSDIALOG_ATOMICSERVICEPANEL,
34     AppExecFwk::ExtensionAbilityType::SYSDIALOG_POWER,
35     AppExecFwk::ExtensionAbilityType::SYSPICKER_SHARE,
36     AppExecFwk::ExtensionAbilityType::HMS_ACCOUNT,
37     AppExecFwk::ExtensionAbilityType::SYS_COMMON_UI
38 };
39 
IsUIExtension(const AppExecFwk::ExtensionAbilityType type)40 inline bool IsUIExtension(const AppExecFwk::ExtensionAbilityType type)
41 {
42     return UI_EXTENSION_SET.find(type) != UI_EXTENSION_SET.end();
43 }
44 
IsWindowExtension(const AppExecFwk::ExtensionAbilityType type)45 inline bool IsWindowExtension(const AppExecFwk::ExtensionAbilityType type)
46 {
47     return type == AppExecFwk::ExtensionAbilityType::WINDOW;
48 }
49 
ConvertType(const AppExecFwk::ExtensionAbilityType type)50 inline AppExecFwk::ExtensionAbilityType ConvertType(const AppExecFwk::ExtensionAbilityType type)
51 {
52     return IsUIExtension(type) ? AppExecFwk::ExtensionAbilityType::UI : type;
53 }
54 } // namespace UIExtensionUtils
55 } // namespace AAFwk
56 } // namespace OHOS
57 #endif // OHOS_AAFwk_UI_EXTENSION_UTILS_H