Skip to content

Commit 8e2e803

Browse files
committed
Revert "base: Allow disabling screenshot shutter sound [1/2]"
This reverts commit 2e57676.
1 parent 2ebb504 commit 8e2e803

4 files changed

Lines changed: 6 additions & 24 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5034,12 +5034,6 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
50345034
public static final String[] LEGACY_RESTORE_SETTINGS = {
50355035
};
50365036

5037-
/**
5038-
* Whether to enable screenshot sound
5039-
* @hide
5040-
*/
5041-
public static final String SCREENSHOT_SOUND = "screenshot_sound";
5042-
50435037
/**
50445038
* These are all public system settings
50455039
*

packages/SettingsProvider/src/android/provider/settings/backup/SystemSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,5 @@ public class SystemSettings {
8989
Settings.System.VOLUME_ROCKER_WAKE,
9090
Settings.System.VOLUME_BUTTON_MUSIC_CONTROL,
9191
Settings.System.LOCKSCREEN_MEDIA_ART,
92-
Settings.System.SCREENSHOT_SOUND,
9392
};
9493
}

packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,5 @@ public boolean validate(@Nullable String value) {
221221
VALIDATORS.put(System.KEY_APP_SWITCH_ACTION, new InclusiveIntegerRangeValidator(0, 9));
222222
VALIDATORS.put(System.KEY_APP_SWITCH_LONG_PRESS_ACTION, new InclusiveIntegerRangeValidator(0, 9));
223223
VALIDATORS.put(System.LOCKSCREEN_MEDIA_ART, BOOLEAN_VALIDATOR);
224-
VALIDATORS.put(System.SCREENSHOT_SOUND, BOOLEAN_VALIDATOR);
225224
}
226225
}

packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
import android.graphics.drawable.InsetDrawable;
5252
import android.graphics.drawable.LayerDrawable;
5353
import android.media.MediaActionSound;
54-
import android.media.Ringtone;
55-
import android.media.RingtoneManager;
5654
import android.net.Uri;
5755
import android.os.Handler;
5856
import android.os.Looper;
@@ -223,7 +221,7 @@ abstract static class ActionsReadyListener {
223221
private float mCornerSizeX;
224222
private float mDismissDeltaY;
225223

226-
private Ringtone mScreenshotSound;
224+
private MediaActionSound mCameraSound;
227225

228226
private int mNavMode;
229227
private int mLeftInset;
@@ -317,9 +315,9 @@ public GlobalScreenshot(
317315
mFastOutSlowIn =
318316
AnimationUtils.loadInterpolator(mContext, android.R.interpolator.fast_out_slow_in);
319317

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

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

694688
saveScreenshotInWorkerThread(finisher, new ActionsReadyListener() {
@@ -744,11 +738,7 @@ void onActionsReady(SavedImageData imageData) {
744738
});
745739

746740
// Play the shutter sound to notify that we've taken a screenshot
747-
if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.SCREENSHOT_SOUND, 1, UserHandle.USER_CURRENT) == 1) {
748-
if (mScreenshotSound != null) {
749-
mScreenshotSound.play();
750-
}
751-
}
741+
mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
752742

753743
mScreenshotPreview.setLayerType(View.LAYER_TYPE_HARDWARE, null);
754744
mScreenshotPreview.buildLayer();

0 commit comments

Comments
 (0)