OSDN Git Service

NULL previous background bitmap upon changing wallpaper
authorjshe32X <jianchunx.shen@intel.com>
Thu, 24 Oct 2013 04:57:09 +0000 (12:57 +0800)
committerGuobin Zhang <guobin.zhang@intel.com>
Fri, 14 Mar 2014 00:09:49 +0000 (08:09 +0800)
Step to reproduce it on Nexus 10 with 4.4.2(KOT49H):
1. Long press on home screen.
2. Choose wallpaper from Wallpapers.
3. Select new wallpaper and set it.
4. Repeat step 1-3 several times.
See black background instead of the wallpaper.

There are two binder objects who hold reference to the
ImageWallpaper$DrawableEngine, which keeps the big chunk
bitmap from being recycled.
One is WallpaperService$IWallpaperEngineWrapper. The client
references went away slowly, maybe several minutes after
changing wallpaper. Then the finalizer has to been executed
to GC it.
The other one is WallpaperService$Engine$BaseIWindow. Don't
know who still held reference to it even after the window
was removed.
Anyway, let the bitmap be GCed first.

Change-Id: I27f6971a3edd26472b69e59b542b27fd7c8e7b90
Signed-off-by: jshe32X<jianchunx.shen@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
packages/SystemUI/src/com/android/systemui/ImageWallpaper.java

index 4b0c2cb..d940406 100644 (file)
@@ -202,6 +202,7 @@ public class ImageWallpaper extends WallpaperService {
             if (mReceiver != null) {
                 unregisterReceiver(mReceiver);
             }
+            mBackground = null;
         }
 
         @Override