Take a screenshot as soon as the phone unlocks

Fixes: b/190443665
Test: visual
Change-Id: Iddbf3fb46deb8760aeecd0ea22a04eff5b51f834
This commit is contained in:
Jay Aliomer
2021-06-07 22:03:12 -04:00
parent 79ce03a8de
commit 2ac2d0f7bc

View File

@@ -1466,9 +1466,12 @@ public abstract class WallpaperService extends Service {
void updatePage(EngineWindowPage currentPage, int pageIndx, int numPages,
float xOffsetStep) {
// to save creating a runnable, check twice
long current = System.nanoTime() / 1_000_000;
long current = SystemClock.elapsedRealtime();
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;
}
Surface surface = mSurfaceHolder.getSurface();