• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-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 #ifndef OHOS_ABILITY_SESSION_INFO_H
17 #define OHOS_ABILITY_SESSION_INFO_H
18 
19 #include <typeinfo>
20 #include <unistd.h>
21 
22 #include "ability_info.h"
23 #include "iremote_object.h"
24 #include "parcel.h"
25 #include "session_info_constants.h"
26 #include "want.h"
27 
28 namespace OHOS {
29 namespace Rosen {
30 struct WindowCreateParams;
31 }
32 
33 namespace AAFwk {
34 class AbilityStartSetting;
35 class ProcessOptions;
36 class StartWindowOption;
37 
38 class SessionInfo : public Parcelable {
39 public:
40     SessionInfo() = default;
41     virtual ~SessionInfo() = default;
42     bool Marshalling(Parcel& parcel) const override;
43     static SessionInfo* Unmarshalling(Parcel& parcel);
44 
45     sptr<IRemoteObject> sessionToken = nullptr;
46     sptr<IRemoteObject> callerSession = nullptr;
47     sptr<IRemoteObject> callerToken = nullptr;
48     sptr<IRemoteObject> parentToken = nullptr;
49     std::string identityToken;
50     int32_t persistentId = 0;
51     uint32_t hostWindowId = 0;
52     int32_t realHostWindowId = 0;
53     uint32_t parentWindowType = 1;
54     bool hideStartWindow = false;
55     bool shouldSkipKillInStartup = false;
56     // Status of the UIAbility invoked by the StartABilityByCall
57     CallToState state = CallToState::UNKNOW;
58     // Returned resultCode of terminateSelfWithResult
59     int32_t resultCode = -1;
60     // requestCode of StartAbilityForResult
61     int32_t requestCode = -1;
62     std::string errorReason;
63     int32_t errorCode = -1;
64     int64_t uiAbilityId = 0;
65     std::shared_ptr<AbilityStartSetting> startSetting = nullptr;
66     std::shared_ptr<ProcessOptions> processOptions = nullptr;
67     std::shared_ptr<StartWindowOption> startWindowOption = nullptr;
68     std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
69     Want want;
70     int32_t userId = -1;
71     bool isNewWant = true;
72     bool isClearSession = false;
73     uint32_t callingTokenId = 0;
74     bool reuse = false;
75     bool canStartAbilityFromBackground = false;
76     int32_t collaboratorType = 0;
77     std::string sessionName = "";
78     bool isAsyncModalBinding = false;
79     bool isAtomicService = false;
80     bool isBackTransition = false;
81     bool isSkipErms = false;
82     // The following attributes are used for UIExtension
83     // To ensure security, this attribute must be rewritten on the server-side.
84     UIExtensionUsage uiExtensionUsage = UIExtensionUsage::MODAL;
85     uint64_t uiExtensionComponentId = 0;
86     uint64_t displayId = 0;
87     float density = 0.0f;
88     int32_t orientation = 0;
89     bool needClearInNotShowRecent = false;
90     std::string instanceKey = "";
91     bool isMinimizedDuringFreeInstall = false;
92     bool isFromIcon = false;
93     int32_t requestId = 0;
94     bool isDensityFollowHost = false;
95     std::string specifiedFlag = "";
96     bool reuseDelegatorWindow = false;
97     int32_t scenarios = 0;
98     std::shared_ptr<Rosen::WindowCreateParams> windowCreateParams = nullptr;
99 
100 private:
101     bool DoMarshallingOne(Parcel& parcel) const;
102     bool DoMarshallingTwo(Parcel& parcel) const;
103     bool DoMarshallingThree(Parcel& parcel) const;
104     bool DoMarshallingFour(Parcel& parcel) const;
105     bool DoMarshallingFive(Parcel& parcel) const;
106     bool DoMarshallingSix(Parcel& parcel) const;
107     static SessionInfo* ReadParcelOne(SessionInfo* info, Parcel& parcel);
108     static SessionInfo* ReadParcelTwo(SessionInfo* info, Parcel& parcel);
109 };
110 } // namespace AAFwk
111 } // namespace OHOS
112 #endif // OHOS_ABILITY_SESSION_INFO_H
113