Merge "Take a screenshot as soon as the phone unlocks" into sc-dev am: 900834f728

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14889011

Change-Id: I1232018866198dceab5696914bf9f600b27eae08
This commit is contained in:
TreeHugger Robot
2021-06-09 17:05:43 +00:00
committed by Automerger Merge Worker

View File

@@ -1511,9 +1511,12 @@ public abstract class WallpaperService extends Service {
void updatePage(EngineWindowPage currentPage, int pageIndx, int numPages, void updatePage(EngineWindowPage currentPage, int pageIndx, int numPages,
float xOffsetStep) { float xOffsetStep) {
// to save creating a runnable, check twice // to save creating a runnable, check twice
long current = System.nanoTime() / 1_000_000; long current = SystemClock.elapsedRealtime();
long lapsed = current - currentPage.getLastUpdateTime(); long lapsed = current - currentPage.getLastUpdateTime();
if (lapsed < DEFAULT_UPDATE_SCREENSHOT_DURATION) { // Always update the page when the last update time is <= 0
// This is important especially when the device first boots
if (lapsed < DEFAULT_UPDATE_SCREENSHOT_DURATION
&& currentPage.getLastUpdateTime() > 0) {
return; return;
} }
Surface surface = mSurfaceHolder.getSurface(); Surface surface = mSurfaceHolder.getSurface();