Permalink
Browse files

Add Camera sound toggle [1/3]

Change-Id: I9e90f606d528eea08a41c35e75cd189e765c5d97
  • Loading branch information...
mnm9994u authored and akhilnarang committed Mar 31, 2013
1 parent 3411a42 commit 861e44584beb882918315968061468028072e0a5
Showing with 9 additions and 0 deletions.
  1. +9 −0 media/java/android/media/MediaActionSound.java
@@ -18,6 +18,7 @@
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.SystemProperties;
import android.util.Log;
/**
@@ -99,6 +100,11 @@
private static final int STATE_LOADING_PLAY_REQUESTED = 2;
private static final int STATE_LOADED = 3;
/**
* Disable camera sound
*/
private static final String PROP_CAMERA_SOUND = "persist.sys.camera-sound";
private class SoundState {
public final int name;
public int id;
@@ -110,6 +116,7 @@ public SoundState(int name) {
state = STATE_NOT_LOADED;
}
}
/**
* Construct a new MediaActionSound instance. Only a single instance is
* needed for playing any platform media action sound; you do not need a
@@ -203,6 +210,7 @@ public void load(int soundName) {
* @see #STOP_VIDEO_RECORDING
*/
public void play(int soundName) {
if (SystemProperties.getBoolean(PROP_CAMERA_SOUND, true)) {
if (soundName < 0 || soundName >= SOUND_FILES.length) {
throw new RuntimeException("Unknown sound requested: " + soundName);
}
@@ -226,6 +234,7 @@ public void play(int soundName) {
default:
Log.e(TAG, "play() called in wrong state: " + sound.state + " for sound: "+ soundName);
break;
}
}
}
}

0 comments on commit 861e445

Please sign in to comment.