Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed5de310 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

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
parent 52ec4283
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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();