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

am: e7f14ced54

Change-Id: I207593f69966048959b4ca150b355976cab9869d
This commit is contained in:
Jeff Sharkey
2016-07-06 20:59:40 +00:00
committed by android-build-merger

View File

@@ -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);
}