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

Commit 0369a4ca authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Fix logs when screenshot fails to save

We currently incorrectly show the failed-to-capture string rather than
the failed-to-save string, when a screenshot fails to save. This is
confusing and makes it more difficult to track down problems.

Bug: 170310033
Test: manual
Change-Id: Iea30b670cf083ab2ea061ed5e4ae1ee928d06e15
parent e2b1b3b9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
        public Bitmap image;
        public Consumer<Uri> finisher;
        public GlobalScreenshot.ActionsReadyListener mActionsReadyListener;
        public int errorMsgResId;

        void clearImage() {
            image = null;
@@ -632,7 +631,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
                if (imageData.uri == null) {
                    mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_NOT_SAVED);
                    mNotificationsController.notifyScreenshotError(
                            R.string.screenshot_failed_to_capture_text);
                            R.string.screenshot_failed_to_save_text);
                } else {
                    mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_SAVED);

@@ -752,7 +751,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
        if (imageData.uri == null) {
            mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_NOT_SAVED);
            mNotificationsController.notifyScreenshotError(
                    R.string.screenshot_failed_to_capture_text);
                    R.string.screenshot_failed_to_save_text);
        } else {
            mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_SAVED);
        }
+0 −2
Original line number Diff line number Diff line
@@ -217,13 +217,11 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
            mParams.mActionsReadyListener.onActionsReady(mImageData);
            mParams.finisher.accept(mImageData.uri);
            mParams.image = null;
            mParams.errorMsgResId = 0;
        } catch (Exception e) {
            // IOException/UnsupportedOperationException may be thrown if external storage is
            // not mounted
            Slog.e(TAG, "unable to save screenshot", e);
            mParams.clearImage();
            mParams.errorMsgResId = R.string.screenshot_failed_to_save_text;
            mImageData.reset();
            mParams.mActionsReadyListener.onActionsReady(mImageData);
            mParams.finisher.accept(null);