Remove shutter sound on camera capture.

This sound isn't supposed to play when you have notification sound off,
but apparently some Huawei phones will play it anyway. Until we can
figure out a better way to handle it, we're just removing it.
This commit is contained in:
Greyson Parrelli 2018-10-03 18:11:50 -07:00
parent b6e40ea812
commit 0840175d6f

View File

@ -46,7 +46,6 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
private Camera1Controller camera;
private Controller controller;
private OrderEnforcer<Stage> orderEnforcer;
private ShutterSound shutterSound;
private Camera1Controller.Properties properties;
public static Camera1Fragment newInstance() {
@ -63,7 +62,6 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
controller = (Controller) getActivity();
camera = new Camera1Controller(TextSecurePreferences.getDirectCaptureCameraId(getContext()), this);
orderEnforcer = new OrderEnforcer<>(Stage.SURFACE_AVAILABLE, Stage.CAMERA_PROPERTIES_AVAILABLE);
shutterSound = Build.VERSION.SDK_INT >= 16 ? new MediaActionShutterSound() : new NoopShutterSound();
}
@Nullable
@ -190,7 +188,6 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
}
private void onCaptureClicked() {
shutterSound.play();
orderEnforcer.reset();
Stopwatch fastCaptureTimer = new Stopwatch("Fast Capture");
@ -293,29 +290,4 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
private enum Stage {
SURFACE_AVAILABLE, CAMERA_PROPERTIES_AVAILABLE
}
private interface ShutterSound {
void play();
}
@TargetApi(16)
private static class MediaActionShutterSound implements ShutterSound {
private final MediaActionSound mediaActionSound;
public MediaActionShutterSound() {
mediaActionSound = new MediaActionSound();
mediaActionSound.load(MediaActionSound.SHUTTER_CLICK);
}
@Override
public void play() {
mediaActionSound.play(MediaActionSound.SHUTTER_CLICK);
}
}
private static class NoopShutterSound implements ShutterSound {
@Override
public void play() { }
}
}