summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2022-03-29 15:46:36 -0700
committer Lucas Dupin <dupin@google.com> 2022-03-29 23:38:50 +0000
commitcd25684a0cdd0f44312013527171002e0f104f7c (patch)
tree8fbdc218778c6f28075f24c8ab38074cd78a5ec4
parent74807869b8683085778b456d477faf3e37be0b13 (diff)
Reload color sysprops after failing
During OTA, sysprops aren't load as fast as during regular boot. This causes the animation to not be able to pick up the dynamic colors. We can mitigate this issue by trying to reload the sysprops at the beginning of each animation part. Test: manual Bug: 227381265 Change-Id: I4397079aacc52acb5cda54a925f70e4f5c745b3f
-rw-r--r--cmds/bootanimation/BootAnimation.cpp16
-rw-r--r--cmds/bootanimation/BootAnimation.h1
2 files changed, 14 insertions, 3 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index f9317eba4e27..968be3e20791 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1425,12 +1425,17 @@ void BootAnimation::drawTexturedQuad(float xStart, float yStart, float width, fl
void BootAnimation::initDynamicColors() {
for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) {
- parseColorDecimalString(
- android::base::GetProperty("persist.bootanim.color" + std::to_string(i + 1), ""),
+ const auto syspropName = "persist.bootanim.color" + std::to_string(i + 1);
+ const auto syspropValue = android::base::GetProperty(syspropName, "");
+ if (syspropValue != "") {
+ SLOGI("Loaded dynamic color: %s -> %s", syspropName.c_str(), syspropValue.c_str());
+ mDynamicColorsApplied = true;
+ }
+ parseColorDecimalString(syspropValue,
mAnimation->endColors[i], mAnimation->startColors[i]);
}
glUseProgram(mImageShader);
- SLOGI("[BootAnimation] Dynamically coloring boot animation.");
+ SLOGI("Dynamically coloring boot animation. Sysprops loaded? %i", mDynamicColorsApplied);
for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) {
float *startColor = mAnimation->startColors[i];
float *endColor = mAnimation->endColors[i];
@@ -1465,6 +1470,11 @@ 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;
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 4c378cbc48bd..a136ad0a90f2 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -228,6 +228,7 @@ private:
bool mTimeIsAccurate;
bool mTimeFormat12Hour;
bool mShuttingDown;
+ bool mDynamicColorsApplied = false;
String8 mZipFileName;
SortedVector<String8> mLoadedFiles;
sp<TimeCheckThread> mTimeCheckThread = nullptr;