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