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 "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 uint32_t parentWindowType = 1; 49 int32_t realHostWindowId = 0; 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 uint64_t uiExtensionComponentId = 0; 73 bool isAsyncModalBinding = false; 74 // To ensure security, this attribute must be rewritten on the server-side. 75 UIExtensionUsage uiExtensionUsage = UIExtensionUsage::MODAL; 76 bool isAtomicService = false; 77 bool isBackTransition = false; 78 bool needClearInNotShowRecent = false; 79 bool isMinimizedDuringFreeInstall = false; 80 bool isFromIcon = false; 81 82 private: 83 bool DoMarshallingOne(Parcel& parcel) const; 84 bool DoMarshallingTwo(Parcel& parcel) const; 85 bool DoMarshallingThree(Parcel& parcel) const; 86 bool DoMarshallingFour(Parcel& parcel) const; 87 bool DoMarshallingFive(Parcel& parcel) const; 88 }; 89 } // namespace AAFwk 90 } // namespace OHOS 91 #endif // OHOS_ABILITY_SESSION_INFO_H 92