1 /* 2 * Copyright (c) 2022 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_ROSEN_WINDOW_TRANSITION_INFO_H 17 #define OHOS_ROSEN_WINDOW_TRANSITION_INFO_H 18 #include <iremote_object.h> 19 #include <string> 20 21 #include "ability_info.h" 22 #include "window_info.h" 23 #include "wm_common.h" 24 #include "wm_common_inner.h" 25 26 namespace OHOS::AAFwk { 27 struct AbilityTransitionInfo; 28 } // namespace OHOS::AAFwk 29 30 namespace OHOS { 31 namespace Rosen { 32 enum class TransitionReason : uint32_t { 33 MINIMIZE = 0, 34 CLOSE, // BACK when only close self 35 ABILITY_TRANSITION, 36 BACK_TRANSITION, // BACK need start last one 37 CLOSE_BUTTON, // close button on decor 38 BACKGROUND_TRANSITION, 39 }; 40 41 class WindowTransitionInfo : public Parcelable { 42 public: 43 WindowTransitionInfo() = default; 44 ~WindowTransitionInfo() = default; 45 explicit WindowTransitionInfo(sptr<AAFwk::AbilityTransitionInfo> info); 46 47 virtual bool Marshalling(Parcel& parcel) const override; 48 static WindowTransitionInfo* Unmarshalling(Parcel& parcel); 49 void SetBundleName(std::string name); 50 std::string GetBundleName(); 51 void SetAbilityName(std::string name); 52 std::string GetAbilityName(); 53 void SetWindowMode(WindowMode mode); 54 WindowMode GetWindowMode(); 55 void SetWindowRect(Rect rect); 56 Rect GetWindowRect(); 57 void SetAbilityToken(sptr<IRemoteObject> abilityToken); 58 sptr<IRemoteObject> GetAbilityToken(); 59 void SetDisplayId(DisplayId displayId); 60 DisplayId GetDisplayId(); 61 void SetWindowType(WindowType windowType); 62 WindowType GetWindowType(); 63 void SetShowFlagWhenLocked(bool isShow); 64 void SetWindowSupportModes(const std::vector<AppExecFwk::SupportWindowMode> supportModes); 65 std::vector<AppExecFwk::SupportWindowMode> GetWindowSupportModes(); 66 bool GetShowFlagWhenLocked(); 67 void SetTransitionReason(TransitionReason reason); 68 TransitionReason GetTransitionReason(); 69 void SetIsRecent(bool isRecent); 70 bool GetIsRecent() const; 71 WindowLimits GetWindowSizeLimits() const; 72 void SetMissionId(int32_t missionId); 73 int32_t GetMissionId() const; 74 void SetOrientation(AppExecFwk::DisplayOrientation orientation); 75 AppExecFwk::DisplayOrientation GetOrientation() const; 76 void SetApiCompatibleVersion(uint32_t apiCompatibleVersion); 77 uint32_t GetApiCompatibleVersion() const; 78 bool isSystemCalling_ = false; 79 private: 80 std::string bundleName_; 81 std::string abilityName_; 82 WindowMode mode_ = WindowMode::WINDOW_MODE_FULLSCREEN; 83 Rect windowRect_ = {0, 0, 0, 0}; 84 sptr<IRemoteObject> abilityToken_ = nullptr; 85 DisplayId displayId_ = 0; 86 WindowType windowType_ = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW; 87 bool isShowWhenLocked_ = false; 88 bool isRecent_ = false; 89 TransitionReason reason_ = TransitionReason::ABILITY_TRANSITION; 90 std::vector<AppExecFwk::SupportWindowMode> supportWindowModes_; 91 WindowLimits sizeLimits_; 92 int32_t missionId_ = -1; 93 AppExecFwk::DisplayOrientation orientation_ = AppExecFwk::DisplayOrientation::UNSPECIFIED; 94 uint32_t apiCompatibleVersion_ = 0; 95 }; 96 } // Rosen 97 } // OHOS 98 #endif