• 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_ABILITY_SESSION_INFO_H
17 #define OHOS_ABILITY_SESSION_INFO_H
18 
19 #include <typeinfo>
20 #include <unistd.h>
21 
22 #include "iremote_object.h"
23 #include "parcel.h"
24 #include "session_info_constants.h"
25 #include "want.h"
26 
27 namespace OHOS {
28 namespace AAFwk {
29 class AbilityStartSetting;
30 class ProcessOptions;
31 
32 class SessionInfo : public Parcelable {
33 public:
34     SessionInfo() = default;
35     virtual ~SessionInfo() = default;
36     bool Marshalling(Parcel& parcel) const override;
37     static SessionInfo* Unmarshalling(Parcel& parcel);
38 
39     sptr<IRemoteObject> sessionToken = nullptr;
40     sptr<IRemoteObject> callerSession = nullptr;
41     sptr<IRemoteObject> callerToken = nullptr;
42     sptr<IRemoteObject> parentToken = nullptr;
43     std::string identityToken;
44     int32_t persistentId = 0;
45     uint32_t hostWindowId = 0;
46     uint32_t parentWindowType = 1;
47     int32_t realHostWindowId = 0;
48     // Status of the UIAbility invoked by the StartABilityByCall
49     CallToState state = CallToState::UNKNOW;
50     // Returned resultCode of terminateSelfWithResult
51     int32_t resultCode = -1;
52     // requestCode of StartAbilityForResult
53     int32_t requestCode = -1;
54     std::string errorReason;
55     int32_t errorCode = -1;
56     int64_t uiAbilityId = 0;
57     std::shared_ptr<AbilityStartSetting> startSetting = nullptr;
58     std::shared_ptr<ProcessOptions> processOptions = nullptr;
59     Want want;
60     int32_t userId = -1;
61     bool isNewWant = true;
62     bool isClearSession = false;
63     uint32_t callingTokenId = 0;
64     bool reuse = false;
65     bool canStartAbilityFromBackground = false;
66     int32_t collaboratorType = 0;
67     std::string sessionName = "";
68     uint64_t uiExtensionComponentId = 0;
69     bool isAsyncModalBinding = false;
70     // To ensure security, this attribute must be rewritten on the server-side.
71     UIExtensionUsage uiExtensionUsage = UIExtensionUsage::MODAL;
72     bool isAtomicService = false;
73     bool isBackTransition = false;
74     bool needClearInNotShowRecent = false;
75     bool isMinimizedDuringFreeInstall = false;
76     bool isFromIcon = false;
77 
78 private:
79     bool DoMarshallingOne(Parcel& parcel) const;
80     bool DoMarshallingTwo(Parcel& parcel) const;
81     bool DoMarshallingThree(Parcel& parcel) const;
82     bool DoMarshallingFour(Parcel& parcel) const;
83     bool DoMarshallingFive(Parcel& parcel) const;
84 };
85 } // namespace AAFwk
86 } // namespace OHOS
87 #endif // OHOS_ABILITY_SESSION_INFO_H
88