From 0840175d6fc0f006174f7357d70b2da28346f34b Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 3 Oct 2018 18:11:50 -0700 Subject: [PATCH] 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. --- .../securesms/camera/Camera1Fragment.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/org/thoughtcrime/securesms/camera/Camera1Fragment.java b/src/org/thoughtcrime/securesms/camera/Camera1Fragment.java index bc53462c1c..c8000088e4 100644 --- a/src/org/thoughtcrime/securesms/camera/Camera1Fragment.java +++ b/src/org/thoughtcrime/securesms/camera/Camera1Fragment.java @@ -46,7 +46,6 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText private Camera1Controller camera; private Controller controller; private OrderEnforcer 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() { } - } }