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
16#ifndef OHOS_ABILITY_RUNTIME_STARTUP_UTIL_H
17#define OHOS_ABILITY_RUNTIME_STARTUP_UTIL_H
18
19#include <cstdint>
20
21#include "ability_info.h"
22#include "extension_ability_info.h"
23
24namespace OHOS {
25namespace AAFwk {
26class Want;
27}  // namespace AAFwk
28namespace AppExecFwk {
29enum class ExtensionAbilityType;
30}  // namespace AppExecFwk
31namespace AbilityRuntime {
32
33struct CallerRequestInfo {
34    int32_t requestCode = 0;
35    int32_t pid = 0;
36    bool backFlag = false;
37};
38
39class StartupUtil {
40public:
41    static bool GetAppIndex(const AAFwk::Want &want, int32_t &appIndex);
42    static int32_t BuildAbilityInfoFlag();
43    static bool IsSupportAppClone(AppExecFwk::ExtensionAbilityType type);
44    static void InitAbilityInfoFromExtension(AppExecFwk::ExtensionAbilityInfo &extensionInfo,
45        AppExecFwk::AbilityInfo &abilityInfo);
46    static int64_t GenerateFullRequestCode(int32_t pid, bool backFlag, int32_t requestCode);
47    static CallerRequestInfo ParseFullRequestCode(int64_t fullRequestCode);
48};
49}  // namespace AbilityRuntime
50}  // namespace OHOS
51#endif  // OHOS_ABILITY_RUNTIME_STARTUP_UTIL_H