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