summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hoa Hoang <hoax@google.com> 2021-11-15 13:42:57 +0000
committer Mike McCreavy <mccreavy@google.com> 2023-03-07 02:00:24 +0000
commit1cd98769c1a330fe41c8289c048d0b103a115e4f (patch)
tree0360ee823192d935eb01beb1891000cd7f0e76c4
parent0eb9f5862ef21d01c27cdafe3cb914b9f9e1bcbb (diff)
bootanim: audioplay: do not start audio thread if it is not allowed
If playSoundsAllowed() returns false, then no need to start new audio thread. Bug: 232955344 Test: Manual - applied this wear-dev change to a local main and verified in an emulator that when launching bootanimation (as root), init() early exits with no negative consequences when BootAnimationUtil.cpp's playSoundsAllowed() returns false. Also tested when playSoundsAllowed() returns true, init() continues (but exits when partWithAudio is null checked). Change-Id: Ia3ff397ab004b09e60acca1b4ad23c5e76d698cb (cherry picked from commit 61b667b5bce33ee857a19688a23eef79bdf66a99) (cherry picked from commit 226331c3b20571fd3dc38bb5da7e0455c4a34f13)
-rw-r--r--cmds/bootanimation/audioplay.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmds/bootanimation/audioplay.cpp b/cmds/bootanimation/audioplay.cpp
index c5e16c6b7deb..da85a1c572a5 100644
--- a/cmds/bootanimation/audioplay.cpp
+++ b/cmds/bootanimation/audioplay.cpp
@@ -334,6 +334,11 @@ class AudioAnimationCallbacks : public android::BootAnimation::Callbacks {
public:
void init(const Vector<Animation::Part>& parts) override {
const Animation::Part* partWithAudio = nullptr;
+
+ if (!playSoundsAllowed()) {
+ return;
+ }
+
for (const Animation::Part& part : parts) {
if (part.audioData != nullptr) {
partWithAudio = &part;