Loading core/java/android/service/wallpaper/WallpaperService.java +20 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.wallpaper; import android.content.res.TypedArray; import android.graphics.Canvas; import android.os.SystemProperties; import android.view.WindowInsets; Loading Loading @@ -185,6 +186,7 @@ public abstract class WallpaperService extends Service { DisplayManager mDisplayManager; Display mDisplay; private int mDisplayState; final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { { Loading Loading @@ -229,6 +231,18 @@ public abstract class WallpaperService extends Service { "Wallpapers do not support keep screen on"); } @Override public Canvas lockCanvas() { if (mDisplayState == Display.STATE_DOZE || mDisplayState == Display.STATE_DOZE_SUSPEND) { try { mSession.pokeDrawLock(mWindow); } catch (RemoteException e) { // System server died, can be ignored. } } return super.lockCanvas(); } }; final class WallpaperInputEventReceiver extends InputEventReceiver { Loading Loading @@ -831,9 +845,12 @@ public abstract class WallpaperService extends Service { mWindow.setSession(mSession); mLayout.packageName = getPackageName(); mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler()); mDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY); mDisplayState = mDisplay.getState(); if (DEBUG) Log.v(TAG, "onCreate(): " + this); onCreate(mSurfaceHolder); Loading Loading @@ -873,8 +890,8 @@ public abstract class WallpaperService extends Service { void reportVisibility() { if (!mDestroyed) { boolean visible = mVisible & mDisplay != null && mDisplay.getState() != Display.STATE_OFF; mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState(); boolean visible = mVisible && mDisplayState != Display.STATE_OFF; if (mReportedVisible != visible) { mReportedVisible = visible; if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible Loading Loading
core/java/android/service/wallpaper/WallpaperService.java +20 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.wallpaper; import android.content.res.TypedArray; import android.graphics.Canvas; import android.os.SystemProperties; import android.view.WindowInsets; Loading Loading @@ -185,6 +186,7 @@ public abstract class WallpaperService extends Service { DisplayManager mDisplayManager; Display mDisplay; private int mDisplayState; final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { { Loading Loading @@ -229,6 +231,18 @@ public abstract class WallpaperService extends Service { "Wallpapers do not support keep screen on"); } @Override public Canvas lockCanvas() { if (mDisplayState == Display.STATE_DOZE || mDisplayState == Display.STATE_DOZE_SUSPEND) { try { mSession.pokeDrawLock(mWindow); } catch (RemoteException e) { // System server died, can be ignored. } } return super.lockCanvas(); } }; final class WallpaperInputEventReceiver extends InputEventReceiver { Loading Loading @@ -831,9 +845,12 @@ public abstract class WallpaperService extends Service { mWindow.setSession(mSession); mLayout.packageName = getPackageName(); mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler()); mDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY); mDisplayState = mDisplay.getState(); if (DEBUG) Log.v(TAG, "onCreate(): " + this); onCreate(mSurfaceHolder); Loading Loading @@ -873,8 +890,8 @@ public abstract class WallpaperService extends Service { void reportVisibility() { if (!mDestroyed) { boolean visible = mVisible & mDisplay != null && mDisplay.getState() != Display.STATE_OFF; mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState(); boolean visible = mVisible && mDisplayState != Display.STATE_OFF; if (mReportedVisible != visible) { mReportedVisible = visible; if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible Loading