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

Commit d859fa39 authored by Winson Chung's avatar Winson Chung
Browse files

Preventing screenshots when waking from sleep.

- Fixing crash in SystemUI when trying to access external storage while it is not mounted

Change-Id: I3d9a05c155b83a2cc39915caebad4b7016025d09
parent 895de926
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@
    <!-- toast message displayed when a screenshot is saved to the Gallery. -->
    <string name="screenshot_saving_toast">Screenshot saved to Gallery</string>
    <!-- toast message displayed when we fail to take a screenshot. -->
    <string name="screenshot_failed_toast">Could not save screenshot</string>
    <string name="screenshot_failed_toast">Could not save screenshot. External storage may be in use.</string>

    <!-- Title for the USB function chooser in UsbPreferenceActivity. [CHAR LIMIT=30] -->
    <string name="usb_preference_title">USB file transfer options</string>
@@ -299,5 +299,4 @@

    <!-- Content description of the ringer silent icon in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_ringer_silent">Ringer silent.</string>

</resources>
+4 −2
Original line number Diff line number Diff line
@@ -114,7 +114,9 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi
            out.close();

            params[0].result = 0;
        }catch(IOException e){
        } catch (Exception e) {
            // IOException/UnsupportedOperationException may be thrown if external storage is not
            // mounted
            params[0].result = 1;
        }

+26 −23
Original line number Diff line number Diff line
@@ -2444,6 +2444,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        switch (keyCode) {
            case KeyEvent.KEYCODE_VOLUME_DOWN:
                if (down) {
                    if (isScreenOn) {
                        // If the power key down was already triggered, take the screenshot
                        if (mPowerDownTriggered) {
                            // Dismiss the power-key longpress
@@ -2458,6 +2459,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            break;
                        }
                        mVolumeDownTriggered = true;
                    }
                } else {
                    mVolumeDownTriggered = false;
                }
@@ -2541,6 +2543,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case KeyEvent.KEYCODE_POWER: {
                result &= ~ACTION_PASS_TO_USER;
                if (down) {
                    if (isScreenOn) {
                        // If the volume down key has been triggered, then just take the screenshot
                        if (mVolumeDownTriggered) {
                            // Take the screenshot
@@ -2551,7 +2554,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            break;
                        }
                        mPowerDownTriggered = true;

                    }

                    ITelephony telephonyService = getTelephonyService();
                    boolean hungUp = false;