Skip to content

Commit

Permalink
Revert "base: Allow disabling screenshot shutter sound [1/2]"
Browse files Browse the repository at this point in the history
This reverts commit 2e57676.
  • Loading branch information
Pulkit077 committed Jun 10, 2021
1 parent 2ebb504 commit 8e2e803
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
6 changes: 0 additions & 6 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -5034,12 +5034,6 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String[] LEGACY_RESTORE_SETTINGS = {
};

/**
* Whether to enable screenshot sound
* @hide
*/
public static final String SCREENSHOT_SOUND = "screenshot_sound";

/**
* These are all public system settings
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ public class SystemSettings {
Settings.System.VOLUME_ROCKER_WAKE,
Settings.System.VOLUME_BUTTON_MUSIC_CONTROL,
Settings.System.LOCKSCREEN_MEDIA_ART,
Settings.System.SCREENSHOT_SOUND,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,5 @@ public boolean validate(@Nullable String value) {
VALIDATORS.put(System.KEY_APP_SWITCH_ACTION, new InclusiveIntegerRangeValidator(0, 9));
VALIDATORS.put(System.KEY_APP_SWITCH_LONG_PRESS_ACTION, new InclusiveIntegerRangeValidator(0, 9));
VALIDATORS.put(System.LOCKSCREEN_MEDIA_ART, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.SCREENSHOT_SOUND, BOOLEAN_VALIDATOR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.media.MediaActionSound;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
Expand Down Expand Up @@ -223,7 +221,7 @@ abstract static class ActionsReadyListener {
private float mCornerSizeX;
private float mDismissDeltaY;

private Ringtone mScreenshotSound;
private MediaActionSound mCameraSound;

private int mNavMode;
private int mLeftInset;
Expand Down Expand Up @@ -317,9 +315,9 @@ public GlobalScreenshot(
mFastOutSlowIn =
AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_slow_in);

// Setup the Screenshot sound
mScreenshotSound = RingtoneManager.getRingtone(mContext,
Uri.parse("file://" + "/product/media/audio/ui/camera_click.ogg"));
// Setup the Camera shutter sound
mCameraSound = new MediaActionSound();
mCameraSound.load(MediaActionSound.SHUTTER_CLICK);

// Store UI background executor
mUiBgExecutor = uiBgExecutor;
Expand Down Expand Up @@ -684,11 +682,7 @@ private void saveScreenshot(Bitmap screenshot, Consumer<Uri> finisher, Rect scre
private void saveScreenshotAndToast(Consumer<Uri> finisher) {
// Play the shutter sound to notify that we've taken a screenshot
mScreenshotHandler.post(() -> {
if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.SCREENSHOT_SOUND, 1, UserHandle.USER_CURRENT) == 1) {
if (mScreenshotSound != null) {
mScreenshotSound.play();
}
}
mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
});

saveScreenshotInWorkerThread(finisher, new ActionsReadyListener() {
Expand Down Expand Up @@ -744,11 +738,7 @@ void onActionsReady(SavedImageData imageData) {
});

// Play the shutter sound to notify that we've taken a screenshot
if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.SCREENSHOT_SOUND, 1, UserHandle.USER_CURRENT) == 1) {
if (mScreenshotSound != null) {
mScreenshotSound.play();
}
}
mCameraSound.play(MediaActionSound.SHUTTER_CLICK);

mScreenshotPreview.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mScreenshotPreview.buildLayer();
Expand Down

0 comments on commit 8e2e803

Please sign in to comment.