From ed5de31075cac2c2d375a57ebb925c4e83110318 Mon Sep 17 00:00:00 2001 From: Geoffrey Pitsch Date: Tue, 27 Jun 2017 11:42:12 -0400 Subject: [PATCH] Show a toast when a screenshot is taken and power saver is on. Improvements to the power save policy for OC eliminated some errant frames of the full animation when a screenshot is taken. However, this resulted in no on-screen indication, which the toast addresses. Test: manual Change-Id: I5bf0b534e9e848f1bbfdefec2ac637e39b7b75e4 Fixes: 37775089 --- .../android/systemui/screenshot/GlobalScreenshot.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 7b574833cd47f..a35310fc7d598 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -46,6 +46,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; +import android.os.PowerManager; import android.os.Process; import android.os.UserHandle; import android.provider.MediaStore; @@ -61,6 +62,7 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.Interpolator; import android.widget.ImageView; +import android.widget.Toast; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.systemui.R; @@ -678,6 +680,13 @@ class GlobalScreenshot { */ private void startAnimation(final Runnable finisher, int w, int h, boolean statusBarVisible, boolean navBarVisible) { + // If power save is on, show a toast so there is some visual indication that a screenshot + // has been taken. + PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); + if (powerManager.isPowerSaveMode()) { + Toast.makeText(mContext, R.string.screenshot_saved_title, Toast.LENGTH_SHORT).show(); + } + // Add the view for the animation mScreenshotView.setImageBitmap(mScreenBitmap); mScreenshotLayout.requestFocus();