• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {
27 namespace Rosen {
28 enum class TransitionReason : uint32_t {
29     MINIMIZE = 0,
30     CLOSE,
31     ABILITY_TRANSITION,
32     BACK_TRANSITION,
33 };
34 
35 class WindowTransitionInfo : public Parcelable {
36 public:
37     WindowTransitionInfo() = default;
38     ~WindowTransitionInfo() = default;
39     WindowTransitionInfo(sptr<AAFwk::AbilityTransitionInfo> info);
40 
41     virtual bool Marshalling(Parcel& parcel) const override;
42     static WindowTransitionInfo* Unmarshalling(Parcel& parcel);
43     void SetBundleName(std::string name);
44     std::string GetBundleName();
45     void SetAbilityName(std::string name);
46     std::string GetAbilityName();
47     void SetWindowMode(WindowMode mode);
48     WindowMode GetWindowMode();
49     void SetWindowRect(Rect rect);
50     Rect GetWindowRect();
51     void SetAbilityToken(sptr<IRemoteObject> abilityToken);
52     sptr<IRemoteObject> GetAbilityToken();
53     void SetDisplayId(DisplayId displayId);
54     DisplayId GetDisplayId();
55     void SetWindowType(WindowType windowType);
56     WindowType GetWindowType();
57     void SetShowFlagWhenLocked(bool isShow);
58     void SetWindowSupportModes(const std::vector<AppExecFwk::SupportWindowMode> supportModes);
59     std::vector<AppExecFwk::SupportWindowMode> GetWindowSupportModes();
60     bool GetShowFlagWhenLocked();
61     void SetTransitionReason(TransitionReason reason);
62     TransitionReason GetTransitionReason();
63     void SetIsRecent(bool isRecent);
64     bool GetIsRecent() const;
65     WindowSizeLimits GetWindowSizeLimits() const;
66     void SetMissionId(int32_t missionId);
67     int32_t GetMissionId() const;
68 private:
69     std::string bundleName_;
70     std::string abilityName_;
71     WindowMode mode_ = WindowMode::WINDOW_MODE_FULLSCREEN;
72     Rect windowRect_ = {0, 0, 0, 0};
73     sptr<IRemoteObject> abilityToken_ = nullptr;
74     DisplayId displayId_ = 0;
75     WindowType windowType_ = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW;
76     bool isShowWhenLocked_ = false;
77     bool isRecent_ = false;
78     TransitionReason reason_ = TransitionReason::ABILITY_TRANSITION;
79     std::vector<AppExecFwk::SupportWindowMode> supportWindowModes_;
80     WindowSizeLimits sizeLimits_;
81     int32_t missionId_ = -1;
82 };
83 } // Rosen
84 } // OHOS
85 #endif