Loading core/java/android/app/WallpaperManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,9 @@ public class WallpaperManager { synchronized (this) { mCachedWallpaper = null; mCachedWallpaperUserId = 0; if (mDefaultWallpaper != null) { mDefaultWallpaper.recycle(); } mDefaultWallpaper = null; } } Loading core/java/android/view/Surface.java +12 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,18 @@ public class Surface implements Parcelable { release(); } /** * Destroys the HwuiContext without completely * releasing the Surface. * @hide */ public void hwuiDestroy() { if (mHwuiContext != null) { mHwuiContext.destroy(); mHwuiContext = null; } } /** * Returns true if this object holds a valid surface. * Loading packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +17 −0 Original line number Diff line number Diff line Loading @@ -24,11 +24,13 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region.Op; import android.os.AsyncTask; import android.os.Handler; import android.os.Trace; import android.service.wallpaper.WallpaperService; import android.util.Log; import android.view.Display; import android.view.DisplayInfo; import android.view.Surface; import android.view.SurfaceHolder; import android.view.WindowManager; Loading @@ -45,6 +47,7 @@ public class ImageWallpaper extends WallpaperService { private static final String GL_LOG_TAG = "ImageWallpaperGL"; private static final boolean DEBUG = false; private static final String PROPERTY_KERNEL_QEMU = "ro.kernel.qemu"; private static final long DELAY_FORGET_WALLPAPER = 5000; private WallpaperManager mWallpaperManager; private DrawableEngine mEngine; Loading @@ -69,6 +72,10 @@ public class ImageWallpaper extends WallpaperService { } class DrawableEngine extends Engine { private final Runnable mUnloadWallpaperCallback = () -> { unloadWallpaper(false /* forgetSize */); }; Bitmap mBackground; int mBackgroundWidth = -1, mBackgroundHeight = -1; int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1; Loading Loading @@ -331,6 +338,7 @@ public class ImageWallpaper extends WallpaperService { } drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); scheduleUnloadWallpaper(); } finally { Trace.traceEnd(Trace.TRACE_TAG_VIEW); } Loading Loading @@ -433,6 +441,9 @@ public class ImageWallpaper extends WallpaperService { mBackgroundHeight = -1; } final Surface surface = getSurfaceHolder().getSurface(); surface.hwuiDestroy(); mLoader = new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... params) { Loading @@ -442,6 +453,12 @@ public class ImageWallpaper extends WallpaperService { }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void scheduleUnloadWallpaper() { Handler handler = getMainThreadHandler(); handler.removeCallbacks(mUnloadWallpaperCallback); handler.postDelayed(mUnloadWallpaperCallback, DELAY_FORGET_WALLPAPER); } @Override protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args) { super.dump(prefix, fd, out, args); Loading Loading
core/java/android/app/WallpaperManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,9 @@ public class WallpaperManager { synchronized (this) { mCachedWallpaper = null; mCachedWallpaperUserId = 0; if (mDefaultWallpaper != null) { mDefaultWallpaper.recycle(); } mDefaultWallpaper = null; } } Loading
core/java/android/view/Surface.java +12 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,18 @@ public class Surface implements Parcelable { release(); } /** * Destroys the HwuiContext without completely * releasing the Surface. * @hide */ public void hwuiDestroy() { if (mHwuiContext != null) { mHwuiContext.destroy(); mHwuiContext = null; } } /** * Returns true if this object holds a valid surface. * Loading
packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +17 −0 Original line number Diff line number Diff line Loading @@ -24,11 +24,13 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region.Op; import android.os.AsyncTask; import android.os.Handler; import android.os.Trace; import android.service.wallpaper.WallpaperService; import android.util.Log; import android.view.Display; import android.view.DisplayInfo; import android.view.Surface; import android.view.SurfaceHolder; import android.view.WindowManager; Loading @@ -45,6 +47,7 @@ public class ImageWallpaper extends WallpaperService { private static final String GL_LOG_TAG = "ImageWallpaperGL"; private static final boolean DEBUG = false; private static final String PROPERTY_KERNEL_QEMU = "ro.kernel.qemu"; private static final long DELAY_FORGET_WALLPAPER = 5000; private WallpaperManager mWallpaperManager; private DrawableEngine mEngine; Loading @@ -69,6 +72,10 @@ public class ImageWallpaper extends WallpaperService { } class DrawableEngine extends Engine { private final Runnable mUnloadWallpaperCallback = () -> { unloadWallpaper(false /* forgetSize */); }; Bitmap mBackground; int mBackgroundWidth = -1, mBackgroundHeight = -1; int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1; Loading Loading @@ -331,6 +338,7 @@ public class ImageWallpaper extends WallpaperService { } drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); scheduleUnloadWallpaper(); } finally { Trace.traceEnd(Trace.TRACE_TAG_VIEW); } Loading Loading @@ -433,6 +441,9 @@ public class ImageWallpaper extends WallpaperService { mBackgroundHeight = -1; } final Surface surface = getSurfaceHolder().getSurface(); surface.hwuiDestroy(); mLoader = new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... params) { Loading @@ -442,6 +453,12 @@ public class ImageWallpaper extends WallpaperService { }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void scheduleUnloadWallpaper() { Handler handler = getMainThreadHandler(); handler.removeCallbacks(mUnloadWallpaperCallback); handler.postDelayed(mUnloadWallpaperCallback, DELAY_FORGET_WALLPAPER); } @Override protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args) { super.dump(prefix, fd, out, args); Loading