!17225 开机动画增加包扫描进度

Merge pull request !17225 from weimingjin/master
This commit is contained in:
openharmony_ci 2024-11-22 08:55:17 +00:00 committed by Gitee
commit 2d61ac2123
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 112 additions and 15 deletions

View File

@ -31,6 +31,7 @@ public:
bool CheckExitAnimation();
bool CheckNeedOtaCompile() const;
bool CheckNeedBundleScan() const;
public:
std::shared_ptr<BootCompileProgress> bootCompileProgress_;

View File

@ -32,7 +32,7 @@
namespace OHOS {
class BootCompileProgress {
public:
void Init(const BootAnimationConfig& config);
void Init(const BootAnimationConfig& config, bool needOtaCompile, bool needBundleScan);
private:
void OnVsync();
@ -42,6 +42,11 @@ private:
bool CreateCanvasNode();
bool RegisterVsyncCallback();
Rosen::Drawing::Brush DrawProgressPoint(int32_t idx, int32_t frameNum);
bool WaitParamsIfNeeded();
bool WaitBundleScanIfNeeded();
bool CheckParams();
bool CheckBundleScanParam();
bool CheckBmsStartParam();
int32_t windowWidth_ = 0;
int32_t windowHeight_ = 0;
@ -55,7 +60,6 @@ private:
Rosen::ScreenId screenId_;
std::string displayInfo_ = "";
bool isBmsCompileDone_ = false;
volatile bool isUpdateOptEnd_ = false;
std::shared_ptr<Rosen::RSSurfaceNode> rsSurfaceNode_;
@ -65,6 +69,10 @@ private:
std::shared_ptr<OHOS::AppExecFwk::EventHandler> compileHandler_;
std::shared_ptr<OHOS::AppExecFwk::EventRunner> compileRunner_;
std::shared_ptr<Rosen::RSInterpolator> sharpCurve_;
bool needOtaCompile_ = false;
bool needBundleScan_ = false;
std::set<std::string> paramNeeded_;
};
} // namespace OHOS

View File

@ -98,4 +98,14 @@ bool BootAnimationStrategy::CheckNeedOtaCompile() const
}
return false;
}
bool BootAnimationStrategy::CheckNeedBundleScan() const
{
LOGI("CheckNeedBundleScan");
if (system::GetParameter("bms.scanning_apps.status", "-1") == "1") {
LOGI("bundle scan is already done.");
return false;
}
return true;
}
} // namespace OHOS

View File

@ -56,9 +56,11 @@ void BootAssociativeDisplayStrategy::Display(int32_t duration, std::vector<BootA
operator_->Init(config, screenWidth, screenHeight, duration);
operator_->GetThread().join();
if (CheckNeedOtaCompile()) {
bool needOtaCompile = CheckNeedOtaCompile();
bool needBundleScan = CheckNeedBundleScan();
if (needOtaCompile || needBundleScan) {
bootCompileProgress_ = std::make_shared<BootCompileProgress>();
bootCompileProgress_->Init(config);
bootCompileProgress_->Init(config, needOtaCompile, needBundleScan);
}
while (!CheckExitAnimation()) {

View File

@ -50,9 +50,11 @@ void BootCompatibleDisplayStrategy::Display(int32_t duration, std::vector<BootAn
operator_->Init(config, screenWidth, screenHeight, duration);
operator_->GetThread().join();
if (CheckNeedOtaCompile()) {
bool needOtaCompile = CheckNeedOtaCompile();
bool needBundleScan = CheckNeedBundleScan();
if (needOtaCompile || needBundleScan) {
bootCompileProgress_ = std::make_shared<BootCompileProgress>();
bootCompileProgress_->Init(config);
bootCompileProgress_->Init(config, needOtaCompile, needBundleScan);
}
}

View File

@ -59,11 +59,22 @@ namespace {
{ { 0.5f, 0.2f }, { 0.2f, 1.0f }, { 1.0f, 0.5f } },
{ { 1.0f, 0.5f }, { 0.5f, 0.2f }, { 0.2f, 1.0f } },
};
constexpr const char* BUNDLE_SCAN_PARAM_NAME = "bms.scanning_apps.status";
constexpr const int BUNDLE_SCAN_WAITING_TIMEOUT = 3;
}
void BootCompileProgress::Init(const BootAnimationConfig& config)
void BootCompileProgress::Init(const BootAnimationConfig& config, bool needOtaCompile, bool needBundleScan)
{
LOGI("ota compile, screenId: " BPUBU64 "", config.screenId);
needOtaCompile_ = needOtaCompile;
needBundleScan_ = needBundleScan;
paramNeeded_.clear();
if (needOtaCompile_) {
paramNeeded_.insert(BMS_COMPILE_STATUS);
}
if (needBundleScan_) {
paramNeeded_.insert(BUNDLE_SCAN_PARAM_NAME);
}
screenId_ = config.screenId;
rotateDegree_ = config.rotateDegree;
Rosen::RSInterfaces& interface = Rosen::RSInterfaces::GetInstance();
@ -121,13 +132,13 @@ bool BootCompileProgress::CreateCanvasNode()
bool BootCompileProgress::RegisterVsyncCallback()
{
if (system::GetParameter(BMS_COMPILE_STATUS, "-1") == BMS_COMPILE_STATUS_END) {
LOGI("bms compile is already done.");
if (CheckParams()) {
LOGI("all param status are COMPLETED");
compileRunner_->Stop();
return false;
}
if (!WaitBmsStartIfNeeded()) {
if (!WaitParamsIfNeeded()) {
LOGI("no param is ready, progress bar stop");
compileRunner_->Stop();
return false;
}
@ -170,9 +181,70 @@ bool BootCompileProgress::RegisterVsyncCallback()
return true;
}
bool BootCompileProgress::CheckParams()
{
bool check1 = CheckBmsStartParam();
bool check2 = CheckBundleScanParam();
if (check1 && check2) {
return true;
}
return false;
}
bool BootCompileProgress::CheckBundleScanParam()
{
if (!needBundleScan_) {
return true;
}
if (system::GetParameter(BUNDLE_SCAN_PARAM_NAME, "-1") == "1") {
paramNeeded_.erase(BUNDLE_SCAN_PARAM_NAME);
return true;
}
return false;
}
bool BootCompileProgress::CheckBmsStartParam()
{
if (!needOtaCompile_) {
return true;
}
if (system::GetParameter(BMS_COMPILE_STATUS, "-1") == BMS_COMPILE_STATUS_END) {
paramNeeded_.erase(BMS_COMPILE_STATUS);
return true;
}
return false;
}
bool BootCompileProgress::WaitParamsIfNeeded()
{
bool wait1 = WaitBmsStartIfNeeded();
bool wait2 = WaitBundleScanIfNeeded();
if (!wait1 && !wait2) {
return false;
}
return true;
}
bool BootCompileProgress::WaitBundleScanIfNeeded()
{
if (!needBundleScan_) {
return true;
}
if (WaitParameter(BUNDLE_SCAN_PARAM_NAME, "0", BUNDLE_SCAN_WAITING_TIMEOUT) != 0) {
paramNeeded_.erase(BUNDLE_SCAN_PARAM_NAME);
LOGE("waiting bundle scan failed.");
return false;
}
return true;
}
bool BootCompileProgress::WaitBmsStartIfNeeded()
{
if (!needOtaCompile_) {
return true;
}
if (WaitParameter(BMS_COMPILE_STATUS, BMS_COMPILE_STATUS_BEGIN.c_str(), WAITING_BMS_TIMEOUT) != 0) {
paramNeeded_.erase(BMS_COMPILE_STATUS);
LOGE("waiting bms start oat compile failed.");
return false;
}
@ -250,8 +322,8 @@ void BootCompileProgress::DrawCompileProgress()
void BootCompileProgress::UpdateCompileProgress()
{
if (!isBmsCompileDone_) {
isBmsCompileDone_ = system::GetParameter(BMS_COMPILE_STATUS, "-1") == BMS_COMPILE_STATUS_END;
(void)CheckParams();
if (paramNeeded_.size() > 0) {
int64_t now =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch())
.count();

View File

@ -44,9 +44,11 @@ void BootIndependentDisplayStrategy::Display(int32_t duration, std::vector<BootA
op->GetThread().join();
}
if (CheckNeedOtaCompile()) {
bool needOtaCompile = CheckNeedOtaCompile();
bool needBundleScan = CheckNeedBundleScan();
if (needOtaCompile || needBundleScan) {
bootCompileProgress_ = std::make_shared<BootCompileProgress>();
bootCompileProgress_->Init(screenConfig);
bootCompileProgress_->Init(screenConfig, needOtaCompile, needBundleScan);
}
while (!CheckExitAnimation()) {