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 sptr<IRemoteObject> parentToken = nullptr; 47 int32_t persistentId = 0; 48 uint32_t hostWindowId = 0; 49 // Status of the UIAbility invoked by the StartABilityByCall 50 CallToState state = CallToState::UNKNOW; 51 // Returned resultCode of terminateSelfWithResult 52 int32_t resultCode = -1; 53 // requestCode of StartAbilityForResult 54 int32_t requestCode = -1; 55 std::string errorReason; 56 int32_t errorCode = -1; 57 int64_t uiAbilityId = 0; 58 std::shared_ptr<AbilityStartSetting> startSetting = 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 int32_t collaboratorType = 0; 66 std::string sessionName = ""; 67 uint64_t uiExtensionComponentId = 0; 68 bool isAsyncModalBinding = false; 69 70 private: 71 bool DoMarshallingOne(Parcel& parcel) const; 72 bool DoMarshallingTwo(Parcel& parcel) const; 73 bool DoMarshallingThree(Parcel& parcel) const; 74 }; 75 } // namespace AAFwk 76 } // namespace OHOS 77 #endif // OHOS_ABILITY_SESSION_INFO_H 78