summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2022-04-26 23:25:22 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-04-26 23:25:22 +0000
commit55e86f55e09a09de184094e8e02dab349e00fd7e (patch)
treed715afc78550ec5b3b3b735637ce427f05bccca4 /cmds/bootanimation/BootAnimation.cpp
parent099e9cbfb8f5799d7c1354abfa48cf38ea459953 (diff)
parent51de64061bdf95778ad0955374629e789a7d19f9 (diff)
Merge "Try to load colors more frequently" into tm-dev am: af8e6e4eba am: 51de64061b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17944265 Change-Id: I33c9221a8143e363e7a98f822a4c0c954d916ed4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 8a7e598e27ab..3f6adefe5cf6 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1440,6 +1440,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {
int fadedFramesCount = 0;
int lastDisplayedProgress = 0;
+ int colorTransitionStart = animation.colorTransitionStart;
+ int colorTransitionEnd = animation.colorTransitionEnd;
for (size_t i=0 ; i<pcount ; i++) {
const Animation::Part& part(animation.parts[i]);
const size_t fcount = part.frames.size();
@@ -1452,15 +1454,27 @@ bool BootAnimation::playAnimation(const Animation& animation) {
continue; //to next part
}
- if (animation.dynamicColoringEnabled && part.useDynamicColoring && !mDynamicColorsApplied) {
- SLOGD("Trying to load dynamic color sysprops.");
- initDynamicColors();
- }
-
// 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, lastDisplayedProgress)) break;
+ // It's possible that the sysprops were not loaded yet at this boot phase.
+ // If that's the case, then we should keep trying until they are available.
+ if (animation.dynamicColoringEnabled && !mDynamicColorsApplied
+ && (part.useDynamicColoring || part.postDynamicColoring)) {
+ SLOGD("Trying to load dynamic color sysprops.");
+ initDynamicColors();
+ if (mDynamicColorsApplied) {
+ // Sysprops were loaded. Next step is to adjust the animation if we loaded
+ // the colors after the animation should have started.
+ const int transitionLength = colorTransitionEnd - colorTransitionStart;
+ if (part.postDynamicColoring) {
+ colorTransitionStart = 0;
+ colorTransitionEnd = fmin(transitionLength, fcount - 1);
+ }
+ }
+ }
+
mCallbacks->playPart(i, part, r);
glClearColor(
@@ -1490,9 +1504,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {
// - 1 for parts that come after.
float colorProgress = part.useDynamicColoring
? fmin(fmax(
- ((float)j - animation.colorTransitionStart) /
- fmax(animation.colorTransitionEnd -
- animation.colorTransitionStart, 1.0f), 0.0f), 1.0f)
+ ((float)j - colorTransitionStart) /
+ fmax(colorTransitionEnd - colorTransitionStart, 1.0f), 0.0f), 1.0f)
: (part.postDynamicColoring ? 1 : 0);
processDisplayEvents();