summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CaptureModule.java
diff options
context:
space:
mode:
authorAbhijit Trivedi <abhijitt@quicinc.com>2018-12-19 13:47:22 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-12-19 13:47:22 -0800
commite7de18b5475d38edc0e09a724be84faffac1bb58 (patch)
tree6976da538588e766893dd2bf1f82c9d290f9a2bd /src/com/android/camera/CaptureModule.java
parentfeeb471e9850cffa26445f18dc794dcb3b27c241 (diff)
parentffdc7cc3ad81d93cf117e0ed432d0e0dff2c7aa8 (diff)
downloadandroid_packages_apps_Snap-e7de18b5475d38edc0e09a724be84faffac1bb58.tar.gz
android_packages_apps_Snap-e7de18b5475d38edc0e09a724be84faffac1bb58.tar.bz2
android_packages_apps_Snap-e7de18b5475d38edc0e09a724be84faffac1bb58.zip
Merge "SnapdragonCamera: Add sound.load when init SoundPlayer" into camera-SnapdragonCamera.lnx.2.0
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index d819634fb..0c4106675 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -590,7 +590,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private static final int SELFIE_FLASH_DURATION = 680;
private static final int SESSION_CONFIGURE_TIMEOUT_MS = 3000;
- private MediaActionSound mSound;
+ private SoundClips.Player mSoundPlayer;
private Size mSupportedMaxPictureSize;
private Size mSupportedRawPictureSize;
@@ -3270,9 +3270,9 @@ public class CaptureModule implements CameraModule, PhotoController,
if (mIsRecordingVideo) {
stopRecordingVideo(getMainCameraId());
}
- if (mSound != null) {
- mSound.release();
- mSound = null;
+ if (mSoundPlayer != null) {
+ mSoundPlayer.release();
+ mSoundPlayer = null;
}
if (selfieThread != null) {
selfieThread.interrupt();
@@ -3517,8 +3517,9 @@ public class CaptureModule implements CameraModule, PhotoController,
updatePreviewSize();
mCameraIdList = new ArrayList<>();
- if (mSound == null) {
- mSound = new MediaActionSound();
+ // Set up sound playback for shutter button, video record and video stop
+ if (mSoundPlayer == null) {
+ mSoundPlayer = SoundClips.getPlayer(mActivity);
}
updateSaveStorageState();
@@ -6509,9 +6510,9 @@ public class CaptureModule implements CameraModule, PhotoController,
private void checkAndPlayRecordSound(int id, boolean isStarted) {
if (id == getMainCameraId()) {
String value = mSettingsManager.getValue(SettingsManager.KEY_SHUTTER_SOUND);
- if (value != null && value.equals("on") && mSound != null) {
- mSound.play(isStarted? MediaActionSound.START_VIDEO_RECORDING
- : MediaActionSound.STOP_VIDEO_RECORDING);
+ if (value != null && value.equals("on") && mSoundPlayer != null) {
+ mSoundPlayer.play(isStarted? SoundClips.START_VIDEO_RECORDING
+ : SoundClips.STOP_VIDEO_RECORDING);
}
}
}
@@ -6519,8 +6520,8 @@ public class CaptureModule implements CameraModule, PhotoController,
public void checkAndPlayShutterSound(int id) {
if (id == getMainCameraId()) {
String value = mSettingsManager.getValue(SettingsManager.KEY_SHUTTER_SOUND);
- if (value != null && value.equals("on") && mSound != null) {
- mSound.play(MediaActionSound.SHUTTER_CLICK);
+ if (value != null && value.equals("on") && mSoundPlayer != null) {
+ mSoundPlayer.play(SoundClips.SHUTTER_CLICK);
}
}
}