• 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 "want.h"
25 
26 namespace OHOS {
27 namespace AAFwk {
28 class AbilityStartSetting;
29 
30 enum class CallToState : uint32_t {
31     UNKNOW = 0,
32     FOREGROUND,
33     BACKGROUND
34 };
35 
36 class SessionInfo : public Parcelable {
37 public:
38     SessionInfo() = default;
39     virtual ~SessionInfo() = default;
40     bool Marshalling(Parcel& parcel) const override;
41     static SessionInfo* Unmarshalling(Parcel& parcel);
42 
43     sptr<IRemoteObject> sessionToken = nullptr;
44     sptr<IRemoteObject> callerSession = nullptr;
45     sptr<IRemoteObject> callerToken = nullptr;
46     int32_t persistentId = 0;
47     uint32_t hostWindowId = 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     Want want;
59     int32_t userId = -1;
60     bool isNewWant = true;
61     bool isClearSession = false;
62     uint32_t callingTokenId = 0;
63     bool reuse = false;
64     int32_t collaboratorType = 0;
65 };
66 } // namespace AAFwk
67 } // namespace OHOS
68 #endif // OHOS_ABILITY_SESSION_INFO_H
69