From 0c856817b8c07fca23269d68266b504c72e2be52 Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Wed, 3 Apr 2019 12:09:54 -0700 Subject: [PATCH] AudioService: add scheduleLoadSoundEffects Instead of instantly loading sound effects during onSystemReady(), move it to a protected method such that sub-classes can override it and schedule to load it at a later time. Bug: 129433717 Test: Build Taimen, sound effect still comes in at boot Change-Id: Ic0e4e963df23392fc9d5dd1b1fea9a62020530ac --- .../java/com/android/server/audio/AudioService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 32781a90348bf..3fc2d3712fed6 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -855,8 +855,7 @@ public class AudioService extends IAudioService.Stub public void onSystemReady() { mSystemReady = true; - sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE, - 0, 0, null, 0); + scheduleLoadSoundEffects(); mDeviceBroker.onSystemReady(); @@ -3224,6 +3223,14 @@ public class AudioService extends IAudioService.Stub return (reply.mStatus == 0); } + /** + * Schedule loading samples into the soundpool. + * This method can be overridden to schedule loading at a later time. + */ + protected void scheduleLoadSoundEffects() { + sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE, 0, 0, null, 0); + } + /** * Unloads samples from the sound pool. * This method can be called to free some memory when