• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_COMPILE_PROGRESS_H
17 #define FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_COMPILE_PROGRESS_H
18 
19 #ifdef RS_ENABLE_GPU
20 #include <render_context/render_context.h>
21 #endif
22 #include <ui/rs_canvas_node.h>
23 #include <ui/rs_display_node.h>
24 #include <ui/rs_surface_extractor.h>
25 #include "ui/rs_ui_director.h"
26 
27 #include "draw/canvas.h"
28 #include "event_handler.h"
29 #include "log.h"
30 #include "util.h"
31 #include "vsync_receiver.h"
32 
33 namespace OHOS {
34 class BootCompileProgress {
35 public:
36     void Init(const BootAnimationConfig& config, bool needOtaCompile, bool needBundleScan);
37 
38 private:
39     void OnVsync();
40     void DrawCompileProgress();
41     void UpdateCompileProgress();
42     bool WaitBmsStartIfNeeded();
43     bool CreateCanvasNode();
44     bool RegisterVsyncCallback();
45     Rosen::Drawing::Brush DrawProgressPoint(int32_t idx, int32_t frameNum);
46     bool WaitParamsIfNeeded();
47     bool WaitBundleScanIfNeeded();
48     bool CheckParams();
49     bool CheckBundleScanParam();
50     bool CheckBmsStartParam();
51 
52     int32_t windowWidth_ = 0;
53     int32_t windowHeight_ = 0;
54     int32_t times_ = 0;
55     int32_t rotateDegree_ = 0;
56     int32_t progress_ = 0;
57     int32_t timeLimitSec_ = -1;
58     int64_t startTimeMs_ = -1;
59     int64_t endTimePredictMs_ = -1;
60     int32_t fontSize_ = 0;
61     Rosen::ScreenId screenId_;
62     std::string displayInfo_ = "";
63 
64     volatile bool isUpdateOptEnd_ = false;
65 
66     std::shared_ptr<Rosen::RSSurfaceNode> rsSurfaceNode_;
67     std::shared_ptr<Rosen::RSCanvasNode> rsCanvasNode_;
68     std::shared_ptr<Rosen::RSUIDirector> rsUIDirector_;
69     std::shared_ptr<Rosen::Drawing::Typeface> tf_;
70     std::shared_ptr<Rosen::VSyncReceiver> receiver_;
71     std::shared_ptr<OHOS::AppExecFwk::EventHandler> compileHandler_;
72     std::shared_ptr<OHOS::AppExecFwk::EventRunner> compileRunner_;
73     std::shared_ptr<Rosen::RSInterpolator> sharpCurve_;
74 
75     bool needOtaCompile_ = false;
76     bool needBundleScan_ = false;
77     std::set<std::string> paramNeeded_;
78 };
79 } // namespace OHOS
80 
81 #endif //FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_COMPILEPROGRESS_H
82