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

Commit 932cd755 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge \"Skip screenshots when user storage is locked.\" into nyc-mr1-dev

am: e7f14ced

Change-Id: I207593f69966048959b4ca150b355976cab9869d
parents fd607121 e7f14ced
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.os.UserManager;
import android.util.Log;
import android.view.WindowManager;

public class TakeScreenshotService extends Service {
@@ -44,6 +46,16 @@ public class TakeScreenshotService extends Service {
                    }
                }
            };

            // If the storage for this user is locked, we have no place to store
            // the screenshot, so skip taking it instead of showing a misleading
            // animation and error notification.
            if (!getSystemService(UserManager.class).isUserUnlocked()) {
                Log.w(TAG, "Skipping screenshot because storage is locked!");
                post(finisher);
                return;
            }

            if (mScreenshot == null) {
                mScreenshot = new GlobalScreenshot(TakeScreenshotService.this);
            }