From dfdede5c440ea72d67be31ad317387d7f57d78ca Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Fri, 16 Aug 2013 12:05:56 +0800 Subject: Gallery2: Fix screen freeze when switch language several times The size of thread pool is 4, when change language, the activity will be recreate. All of activitystate in state stack also be recreate. But it only call oncreate, don't call onresume and onpause. All of threads is submmited at onresume except TileImageView. TileDecoder of TileImageView will submmited at oncreate. and it will not be release as it didn't call onpause. So it will submmit a new thread every time change language. The thread pool will full after switch several times language. It will lead other thread can't be submmited, such as slideshow load thread, it will block the slideshow. When user touch screen or click back key, it will exit slideshow it will release the thread, but the thread is not running, so it will wait the thread complete. So the UI will be block and the screen is freeze. Remove TileImageView submit thread at constructor. Only submit in prepareTextures(). CRs-Fixed: 529641 Change-Id: I5e22f43747460f7f796d96bf6fd3f6f66103adb4 --- src/com/android/gallery3d/ui/TileImageView.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java index 3185c7598..0727f689f 100644 --- a/src/com/android/gallery3d/ui/TileImageView.java +++ b/src/com/android/gallery3d/ui/TileImageView.java @@ -153,7 +153,6 @@ public class TileImageView extends GLView { public TileImageView(GalleryContext context) { mThreadPool = context.getThreadPool(); - mTileDecoder = mThreadPool.submit(new TileDecoder()); if (sTileSize == 0) { if (isHighResolution(context.getAndroidContext())) { sTileSize = 512 ; -- cgit v1.2.3