Skip to content

Commit cea32ec

Browse files
Winson ChungAndroid (Google) Code Review
authored andcommitted
Merge "Adding a sound when you take a screenshot. (Bug 5617734)" into ics-mr1
2 parents 5a7c917 + 8d513ea commit cea32ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import android.graphics.Matrix;
3535
import android.graphics.PixelFormat;
3636
import android.graphics.PointF;
37+
import android.hardware.CameraSound;
3738
import android.net.Uri;
3839
import android.os.AsyncTask;
3940
import android.os.Environment;
@@ -49,6 +50,7 @@
4950
import android.view.WindowManager;
5051
import android.view.animation.Interpolator;
5152
import android.widget.ImageView;
53+
5254
import com.android.systemui.R;
5355

5456
import java.io.File;
@@ -254,6 +256,8 @@ class GlobalScreenshot {
254256
private float mBgPadding;
255257
private float mBgPaddingScale;
256258

259+
private CameraSound mCameraSound;
260+
257261

258262
/**
259263
* @param context everything needs a context :(
@@ -303,6 +307,9 @@ public boolean onTouch(View v, MotionEvent event) {
303307
// Scale has to account for both sides of the bg
304308
mBgPadding = (float) r.getDimensionPixelSize(R.dimen.global_screenshot_bg_padding);
305309
mBgPaddingScale = mBgPadding / mDisplayMetrics.widthPixels;
310+
311+
// Setup the Camera shutter sound
312+
mCameraSound = new CameraSound();
306313
}
307314

308315
/**
@@ -413,6 +420,9 @@ public void onAnimationEnd(Animator animation) {
413420
mScreenshotLayout.post(new Runnable() {
414421
@Override
415422
public void run() {
423+
// Play the shutter sound to notify that we've taken a screenshot
424+
mCameraSound.playSound(CameraSound.SHUTTER_CLICK);
425+
416426
mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
417427
mScreenshotView.buildLayer();
418428
mScreenshotAnimation.start();

0 commit comments

Comments
 (0)