1 /*
2  * Copyright (c) 2024 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 FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_FACTORY_H
17 #define FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_FACTORY_H
18 
19 #include "boot_associative_display_strategy.h"
20 #include "boot_compatible_display_strategy.h"
21 #include "boot_independent_display_strategy.h"
22 #include "util.h"
23 
24 namespace OHOS {
25 class BootAnimationFactory {
26 public:
GetBootStrategy(BootStrategyType type)27     static std::shared_ptr<BootAnimationStrategy> GetBootStrategy(BootStrategyType type)
28     {
29         std::shared_ptr<BootAnimationStrategy> strategy;
30         switch (type) {
31             case BootStrategyType::ASSOCIATIVE:
32                 strategy = std::make_shared<BootAssociativeDisplayStrategy>();
33                 break;
34             case BootStrategyType::COMPATIBLE:
35                 strategy = std::make_shared<BootCompatibleDisplayStrategy>();
36                 break;
37             case BootStrategyType::INDEPENDENT:
38                 strategy = std::make_shared<BootIndependentDisplayStrategy>();
39                 break;
40             default:
41                 strategy = nullptr;
42                 break;
43         }
44         return strategy;
45     }
46 };
47 } // namespace OHOS
48 
49 #endif // FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_ANIMATION_FACTORY_H
50