Loading core/java/android/hardware/Camera.java +20 −0 Original line number Diff line number Diff line Loading @@ -1558,6 +1558,26 @@ public class Camera { return _enableShutterSound(enabled); } /** * Disable the shutter sound unconditionally. * * <p> * This is only guaranteed to work for legacy cameras * (i.e. initialized with {@link #cameraInitUnspecified}). Trying to call this on * a regular camera will force a conditional check in the camera service. * </p> * * @return {@code true} if the shutter sound state was successfully * changed. {@code false} if the shutter sound state could not be * changed. {@code true} is also returned if shutter sound playback * is already set to the requested state. * * @hide */ public final boolean disableShutterSound() { return _enableShutterSound(/*enabled*/false); } private native final boolean _enableShutterSound(boolean enabled); /** Loading core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java +5 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.util.List; * Keep up to date with ICameraDeviceUser.aidl. * </p> */ @SuppressWarnings("deprecation") public class CameraDeviceUserShim implements ICameraDeviceUser { private static final String TAG = "CameraDeviceUserShim"; Loading Loading @@ -259,6 +260,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser { super(l); } @Override public void handleMessage(Message msg) { try { switch (msg.what) { Loading Loading @@ -320,6 +322,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser { // Check errors old HAL initialization CameraBinderDecorator.throwOnError(initErrors); // Disable shutter sounds (this will work unconditionally) for api2 clients legacyCamera.disableShutterSound(); CameraInfo info = new CameraInfo(); Camera.getCameraInfo(cameraId, info); Loading Loading
core/java/android/hardware/Camera.java +20 −0 Original line number Diff line number Diff line Loading @@ -1558,6 +1558,26 @@ public class Camera { return _enableShutterSound(enabled); } /** * Disable the shutter sound unconditionally. * * <p> * This is only guaranteed to work for legacy cameras * (i.e. initialized with {@link #cameraInitUnspecified}). Trying to call this on * a regular camera will force a conditional check in the camera service. * </p> * * @return {@code true} if the shutter sound state was successfully * changed. {@code false} if the shutter sound state could not be * changed. {@code true} is also returned if shutter sound playback * is already set to the requested state. * * @hide */ public final boolean disableShutterSound() { return _enableShutterSound(/*enabled*/false); } private native final boolean _enableShutterSound(boolean enabled); /** Loading
core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java +5 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.util.List; * Keep up to date with ICameraDeviceUser.aidl. * </p> */ @SuppressWarnings("deprecation") public class CameraDeviceUserShim implements ICameraDeviceUser { private static final String TAG = "CameraDeviceUserShim"; Loading Loading @@ -259,6 +260,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser { super(l); } @Override public void handleMessage(Message msg) { try { switch (msg.what) { Loading Loading @@ -320,6 +322,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser { // Check errors old HAL initialization CameraBinderDecorator.throwOnError(initErrors); // Disable shutter sounds (this will work unconditionally) for api2 clients legacyCamera.disableShutterSound(); CameraInfo info = new CameraInfo(); Camera.getCameraInfo(cameraId, info); Loading