diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2021-04-20 15:15:06 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2021-04-20 15:15:06 +0100 |
commit | a12987512cd5712411a3279c14f173abdd55ad49 (patch) | |
tree | 86ad014fc6d3dbe18c3df3f48e47bed14a2145f6 /cmds | |
parent | 1b06ec2530df3fac09dea019976377b7f9060653 (diff) |
bootanimation: ensure that if a percent is shown, we'll get to 100.
Seeing 100 while booting is not finished, or seeing eg 90 while booting
is not finished isn't user-friendly.
Test: update ART module, see percent progress
Change-Id: I5509c83f661f937f00a7d28c789df509e3528a37
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 15 | ||||
-rw-r--r-- | cmds/bootanimation/BootAnimation.h | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 854982f825dc..57f0e0c93b05 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -1185,9 +1185,12 @@ bool BootAnimation::movie() { return false; } -bool BootAnimation::shouldStopPlayingPart(const Animation::Part& part, const int fadedFramesCount) { +bool BootAnimation::shouldStopPlayingPart(const Animation::Part& part, + const int fadedFramesCount, + const int lastDisplayedProgress) { // stop playing only if it is time to exit and it's a partial part which has been faded out - return exitPending() && !part.playUntilComplete && fadedFramesCount >= part.framesToFadeCount; + return exitPending() && !part.playUntilComplete && fadedFramesCount >= part.framesToFadeCount && + (lastDisplayedProgress == 0 || lastDisplayedProgress == 100); } bool BootAnimation::playAnimation(const Animation& animation) { @@ -1214,7 +1217,7 @@ bool BootAnimation::playAnimation(const Animation& animation) { // process the part not only while the count allows but also if already fading for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) { - if (shouldStopPlayingPart(part, fadedFramesCount)) break; + if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break; mCallbacks->playPart(i, part, r); @@ -1231,7 +1234,7 @@ bool BootAnimation::playAnimation(const Animation& animation) { (i == (pcount -1)) && currentProgress != 0; for (size_t j=0 ; j<fcount ; j++) { - if (shouldStopPlayingPart(part, fadedFramesCount)) break; + if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break; processDisplayEvents(); @@ -1330,6 +1333,10 @@ bool BootAnimation::playAnimation(const Animation& animation) { if (exitPending() && !part.count && mCurrentInset >= mTargetInset && !part.hasFadingPhase()) { + if (lastDisplayedProgress != 0 && lastDisplayedProgress != 100) { + android::base::SetProperty(PROGRESS_PROP_NAME, "100"); + continue; + } break; // exit the infinite non-fading part when it has been played at least once } } diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h index b52222c799b0..1b47fefc6866 100644 --- a/cmds/bootanimation/BootAnimation.h +++ b/cmds/bootanimation/BootAnimation.h @@ -187,7 +187,8 @@ private: void resizeSurface(int newWidth, int newHeight); void projectSceneToWindow(); - bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount); + bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount, + int lastDisplayedProgress); void checkExit(); void handleViewport(nsecs_t timestep); |