Camera: Lazy load sound files to speed up camera startup
Lazy loading of sound files can speed up camera startup more than 60ms,
it gives users a great experience. Many apps do not playSound when camera
open or they may use their own audio files. so we load audio files as needed.
Bug: 128432959
Test: install wechat app,open camera,use systrace to see the uiThread wait time.
Change-Id: I3b3697cf9d0d919b88276f6d8e7fdd84578f4fcd
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 624d1ca..991c770 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -177,10 +177,10 @@
NUM_SOUNDS
};
- void loadSound();
void playSound(sound_kind kind);
- void releaseSound();
-
+ void loadSoundLocked(sound_kind kind);
+ void decreaseSoundRef();
+ void increaseSoundRef();
/**
* Update the state of a given camera device (open/close/active/idle) with
* the camera proxy service in the system service