diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2021-04-21 09:54:52 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-04-21 09:54:52 +0000 |
commit | db45defb94a53e63c12a800df1983b6a4da35c18 (patch) | |
tree | e4aba76f06bbcdba6678fe370c9fb1208145c3f3 | |
parent | a9b3e555a8e238f2c0dd3c83009c3d486bc4e881 (diff) | |
parent | 55b2ba298c378e350f32e7351ff6a3fb4a960105 (diff) |
Merge "bootanimation: ensure that if a percent is shown, we'll get to 100." am: 87c254de0e am: 10e844df41 am: 55b2ba298c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1681127
Change-Id: I1ee402945af4207affb77d61eb76a21c175ac1fc
-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 be82b2230183..3109c5c1e075 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -1210,9 +1210,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) { @@ -1239,7 +1242,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); @@ -1256,7 +1259,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(); @@ -1355,6 +1358,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 07432a2168b1..f8a31c6d8790 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); |