Modify/Custom Android Camera Sound

文件./frameworks/base/services/audioflinger/AudioPolicyService.cpp

 1 AudioPolicyService::AudioPolicyService()
2 : BnAudioPolicyService() , mpPolicyManager(NULL)
3 {
4 char value[PROPERTY_VALUE_MAX];
5
6 // start tone playback thread
7 mTonePlaybackThread = new AudioCommandThread(String8(""));
8 // start audio commands thread
9 mAudioCommandThread = new AudioCommandThread(String8("ApmCommandThread"));
10
11 #if (defined GENERIC_AUDIO) || (defined AUDIO_POLICY_TEST)
12 mpPolicyManager = new AudioPolicyManagerBase(this);
13 LOGV("build for GENERIC_AUDIO - using generic audio policy");
14 #else
15 // if running in emulation - use the emulator driver
16 if (property_get("ro.kernel.qemu", value, 0)) {
17 LOGV("Running in emulation - using generic audio policy");
18 mpPolicyManager = new AudioPolicyManagerBase(this);
19 }
20 else {
21 LOGV("Using hardware specific audio policy");
22 //mpPolicyManager = createAudioPolicyManager(this);
23 mpPolicyManager = new AudioYusuPolicyManager(this);
24 }
25 #endif
26
27 // load properties
28 //property_get("ro.camera.sound.forced", value, "0");
29 //mpPolicyManager->setSystemProperty("ro.camera.sound.forced", value);
30 #ifdef FORCE_CAMERA_SHUTTER_SOUND_AUDIBLE
31 mpPolicyManager->setSystemProperty("ro.camera.sound.forced", "1");
32 #endif
33 }

#define FORCE_CAMERA_SHUTTER_SOUND_AUDIBLE

//Define this will enable camera shutter sound audible
//even if in silent mode      

就是说value = 1 将会打开Camera拍照声音,如果value = 0 将会关闭Camera拍照声音

1 mpPolicyManager->setSystemProperty("ro.camera.sound.forced", value);

 

找到文件./frameworks/base/services/camera/libcameraservice/CameraService.cpp

1 void CameraService::Client::handleShutter(image_rect_type *size) {
2 //mCameraService->playSound(SOUND_SHUTTER);
3 ....
4 }





posted on 2012-02-29 17:32  RTFSC  阅读(1063)  评论(0编辑  收藏  举报

导航