Merge "Adding mustPlayShutterSound to break Cam2 dependency on Cam1"
This commit is contained in:
@@ -21542,6 +21542,7 @@ package android.media {
|
|||||||
public class MediaActionSound {
|
public class MediaActionSound {
|
||||||
ctor public MediaActionSound();
|
ctor public MediaActionSound();
|
||||||
method public void load(int);
|
method public void load(int);
|
||||||
|
method public static boolean mustPlayShutterSound();
|
||||||
method public void play(int);
|
method public void play(int);
|
||||||
method public void release();
|
method public void release();
|
||||||
field public static final int FOCUS_COMPLETE = 1; // 0x1
|
field public static final int FOCUS_COMPLETE = 1; // 0x1
|
||||||
|
|||||||
@@ -16,8 +16,11 @@
|
|||||||
|
|
||||||
package android.media;
|
package android.media;
|
||||||
|
|
||||||
import android.media.AudioManager;
|
import android.content.Context;
|
||||||
import android.media.SoundPool;
|
import android.media.SoundPool;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,6 +107,26 @@ public class MediaActionSound {
|
|||||||
private static final int STATE_LOADING_PLAY_REQUESTED = 2;
|
private static final int STATE_LOADING_PLAY_REQUESTED = 2;
|
||||||
private static final int STATE_LOADED = 3;
|
private static final int STATE_LOADED = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Returns true if the application must play the shutter sound in accordance
|
||||||
|
* to certain regional restrictions. </p>
|
||||||
|
*
|
||||||
|
* <p>If this method returns true, applications are strongly recommended to use
|
||||||
|
* MediaActionSound.play(SHUTTER_CLICK) or START_VIDEO_RECORDING whenever it captures
|
||||||
|
* images or video to storage or sends them over the network.</p>
|
||||||
|
*/
|
||||||
|
public static boolean mustPlayShutterSound() {
|
||||||
|
boolean result = false;
|
||||||
|
IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
|
||||||
|
IAudioService audioService = IAudioService.Stub.asInterface(b);
|
||||||
|
try {
|
||||||
|
result = audioService.isCameraSoundForced();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "audio service is unavailable for queries, defaulting to false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private class SoundState {
|
private class SoundState {
|
||||||
public final int name;
|
public final int name;
|
||||||
public int id;
|
public int id;
|
||||||
|
|||||||
Reference in New Issue
Block a user