• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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_RUNTIME_START_OPTIONS_H
17 #define OHOS_ABILITY_RUNTIME_START_OPTIONS_H
18 
19 #include <string>
20 
21 #include "ability_info.h"
22 #include "ability_window_configuration.h"
23 #include "parcel.h"
24 
25 namespace OHOS {
26 namespace AAFwk {
27 class ProcessOptions;
28 class StartWindowOption;
29 
30 class StartOptions final : public Parcelable, public std::enable_shared_from_this<StartOptions> {
31 public:
32     const int32_t DEFAULT_DISPLAY_ID {0};
33     bool windowLeftUsed_ = false;
34     bool windowTopUsed_ = false;
35     bool windowWidthUsed_ = false;
36     bool windowHeightUsed_ = false;
37     bool minWindowWidthUsed_ = false;
38     bool minWindowHeightUsed_ = false;
39     bool maxWindowWidthUsed_ = false;
40     bool maxWindowHeightUsed_ = false;
41     std::shared_ptr<ProcessOptions> processOptions = nullptr;
42     std::shared_ptr<StartWindowOption> startWindowOption = nullptr;
43     std::vector<AppExecFwk::SupportWindowMode> supportWindowModes_;
44 
45     StartOptions() = default;
46     ~StartOptions() = default;
47     StartOptions(const StartOptions &other);
48     StartOptions &operator=(const StartOptions &other);
49 
50     bool ReadFromParcel(Parcel &parcel);
51     virtual bool Marshalling(Parcel &parcel) const override;
52     static StartOptions *Unmarshalling(Parcel &parcel);
53 
54     void SetWindowMode(int32_t windowMode);
55     int32_t GetWindowMode() const;
56 
57     void SetDisplayID(int32_t displayId);
58     int32_t GetDisplayID() const;
59 
60     void SetWithAnimation(bool withAnimation);
61     bool GetWithAnimation() const;
62 
63     void SetWindowFocused(bool windowFocused);
64     int32_t GetWindowFocused() const;
65 
66     void SetWindowLeft(int32_t windowLeft);
67     int32_t GetWindowLeft() const;
68 
69     void SetWindowTop(int32_t windowTop);
70     int32_t GetWindowTop() const;
71 
72     void SetWindowWidth(int32_t windowWidth);
73     int32_t GetWindowWidth() const;
74 
75     void SetWindowHeight(int32_t windowHeight);
76     int32_t GetWindowHeight() const;
77 
78     void SetMinWindowWidth(int32_t minWindowWidth);
79     int32_t GetMinWindowWidth() const;
80 
81     void SetMinWindowHeight(int32_t minWindowHeight);
82     int32_t GetMinWindowHeight() const;
83 
84     void SetMaxWindowWidth(int32_t maxWindowWidth);
85     int32_t GetMaxWindowWidth() const;
86 
87     void SetMaxWindowHeight(int32_t maxWindowHeight);
88     int32_t GetMaxWindowHeight() const;
89 private:
90     bool withAnimation_ = true;
91     bool windowFocused_ = true;
92     int32_t windowMode_ = AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED;
93     int32_t displayId_ = -1;
94     int32_t windowLeft_ = 0;
95     int32_t windowTop_ = 0;
96     int32_t windowWidth_ = 0;
97     int32_t windowHeight_ = 0;
98     int32_t minWindowWidth_ = 0;
99     int32_t minWindowHeight_ = 0;
100     int32_t maxWindowWidth_ = 0;
101     int32_t maxWindowHeight_ = 0;
102 };
103 }  // namespace AAFwk
104 }  // namespace OHOS
105 #endif  // OHOS_ABILITY_RUNTIME_START_OPTIONS_H
106