From 091440a9cb9d4f42406631004aa484cbb79214ca Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 18 Mar 2015 14:16:05 -0700 Subject: Reducing method count by eliminating synthetic accessors Elimates 304 methods based on dex analysis The java compiler generates sythetic accessor methods for all private fields, methods and contructors accessed from inner classes. By marking them package-private and @Thunk instead, sythentic accessor methods are no longer needeed. These annotated elements should be treated as private. Change-Id: Id0dc2c92733474250d8ff12fa793d3a8adeb1f26 --- .../android/photos/views/TiledImageRenderer.java | 21 +++++++++++---------- .../com/android/photos/views/TiledImageView.java | 7 ++++--- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'WallpaperPicker/src/com/android/photos') diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java index f9b7ab473..39a73b9d5 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java @@ -30,6 +30,7 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.UploadedTexture; +import com.android.launcher3.util.Thunk; import com.android.photos.views.Pools.Pool; import com.android.photos.views.Pools.SynchronizedPool; @@ -67,12 +68,12 @@ public class TiledImageRenderer { private static final int STATE_RECYCLING = 0x20; private static final int STATE_RECYCLED = 0x40; - private static Pool sTilePool = new SynchronizedPool(64); + @Thunk static Pool sTilePool = new SynchronizedPool(64); // TILE_SIZE must be 2^N - private int mTileSize; + @Thunk int mTileSize; - private TileSource mModel; + @Thunk TileSource mModel; private BasicTexture mPreview; protected int mLevelCount; // cache the value of mScaledBitmaps.length @@ -82,7 +83,7 @@ public class TiledImageRenderer { // half size of the previous one). If the value is in [0, mLevelCount), we // use the bitmap in mScaledBitmaps[mLevel] for display, otherwise the value // is mLevelCount - private int mLevel = 0; + @Thunk int mLevel = 0; private int mOffsetX; private int mOffsetY; @@ -96,10 +97,10 @@ public class TiledImageRenderer { private final LongSparseArray mActiveTiles = new LongSparseArray(); // The following three queue are guarded by mQueueLock - private final Object mQueueLock = new Object(); + @Thunk final Object mQueueLock = new Object(); private final TileQueue mRecycledQueue = new TileQueue(); private final TileQueue mUploadQueue = new TileQueue(); - private final TileQueue mDecodeQueue = new TileQueue(); + @Thunk final TileQueue mDecodeQueue = new TileQueue(); // The width and height of the full-sized bitmap protected int mImageWidth = SIZE_UNKNOWN; @@ -489,7 +490,7 @@ public class TiledImageRenderer { } } - private void decodeTile(Tile tile) { + @Thunk void decodeTile(Tile tile) { synchronized (mQueueLock) { if (tile.mTileState != STATE_IN_QUEUE) { return; @@ -556,7 +557,7 @@ public class TiledImageRenderer { mActiveTiles.put(key, tile); } - private Tile getTile(int x, int y, int level) { + @Thunk Tile getTile(int x, int y, int level) { return mActiveTiles.get(makeTileKey(x, y, level)); } @@ -748,7 +749,7 @@ public class TiledImageRenderer { } } - private static class TileQueue { + @Thunk static class TileQueue { private Tile mHead; public Tile pop() { @@ -786,7 +787,7 @@ public class TiledImageRenderer { } } - private class TileDecoder extends Thread { + @Thunk class TileDecoder extends Thread { public void finishAndWait() { interrupt(); diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java index 56ee7a658..7e3e1a936 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java @@ -33,6 +33,7 @@ import android.widget.FrameLayout; import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLES20Canvas; +import com.android.launcher3.util.Thunk; import com.android.photos.views.TiledImageRenderer.TileSource; import javax.microedition.khronos.egl.EGLConfig; @@ -43,8 +44,8 @@ import javax.microedition.khronos.opengles.GL10; */ public class TiledImageView extends FrameLayout { - private GLSurfaceView mGLSurfaceView; - private boolean mInvalPending = false; + @Thunk GLSurfaceView mGLSurfaceView; + @Thunk boolean mInvalPending = false; private FrameCallback mFrameCallback; protected static class ImageRendererWrapper { @@ -203,7 +204,7 @@ public class TiledImageView extends FrameLayout { } } - private class TileRenderer implements Renderer { + @Thunk class TileRenderer implements Renderer { private GLES20Canvas mCanvas; -- cgit v1.2.3