summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker/src/com/android
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2015-03-18 14:16:05 -0700
committerAdam Cohen <adamcohen@google.com>2015-03-20 11:15:54 -0700
commit091440a9cb9d4f42406631004aa484cbb79214ca (patch)
tree828aaa4033c73fe84a2e7e567c9cc4909c5a014f /WallpaperPicker/src/com/android
parentf846b9054c90e73cb824310e75ea904b5a459c01 (diff)
downloadandroid_packages_apps_Trebuchet-091440a9cb9d4f42406631004aa484cbb79214ca.tar.gz
android_packages_apps_Trebuchet-091440a9cb9d4f42406631004aa484cbb79214ca.tar.bz2
android_packages_apps_Trebuchet-091440a9cb9d4f42406631004aa484cbb79214ca.zip
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
Diffstat (limited to 'WallpaperPicker/src/com/android')
-rw-r--r--WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java4
-rw-r--r--WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java8
-rw-r--r--WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java4
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java7
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java35
-rw-r--r--WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java21
-rw-r--r--WallpaperPicker/src/com/android/photos/views/TiledImageView.java7
7 files changed, 48 insertions, 38 deletions
diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java
index f41a979b7..67abf6564 100644
--- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java
+++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java
@@ -20,6 +20,8 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
+import com.android.launcher3.util.Thunk;
+
import junit.framework.Assert;
import java.util.HashMap;
@@ -82,7 +84,7 @@ public abstract class UploadedTexture extends BasicTexture {
return mIsUploading;
}
- private static class BorderKey implements Cloneable {
+ @Thunk static class BorderKey implements Cloneable {
public boolean vertical;
public Config config;
public int length;
diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
index 72f2d7e49..a5e951ce4 100644
--- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
+++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
@@ -35,6 +35,8 @@ import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
+import com.android.launcher3.util.Thunk;
+
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
@@ -50,7 +52,7 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter
private final LayoutInflater mInflater;
private final PackageManager mPackageManager;
- private List<LiveWallpaperTile> mWallpapers;
+ @Thunk List<LiveWallpaperTile> mWallpapers;
@SuppressWarnings("unchecked")
public LiveWallpaperListAdapter(Context context) {
@@ -109,8 +111,8 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter
}
public static class LiveWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo {
- private Drawable mThumbnail;
- private WallpaperInfo mInfo;
+ @Thunk Drawable mThumbnail;
+ @Thunk WallpaperInfo mInfo;
public LiveWallpaperTile(Drawable thumbnail, WallpaperInfo info, Intent intent) {
mThumbnail = thumbnail;
mInfo = info;
diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
index 27e65aa31..16bde3300 100644
--- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
+++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
@@ -32,6 +32,8 @@ import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
+import com.android.launcher3.util.Thunk;
+
import java.util.ArrayList;
import java.util.List;
@@ -46,7 +48,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements
new ArrayList<ThirdPartyWallpaperTile>();
public static class ThirdPartyWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo {
- private ResolveInfo mResolveInfo;
+ @Thunk ResolveInfo mResolveInfo;
public ThirdPartyWallpaperTile(ResolveInfo resolveInfo) {
mResolveInfo = resolveInfo;
}
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
index a3a3c537b..5b2943a65 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
@@ -44,6 +44,7 @@ import android.widget.Toast;
import com.android.gallery3d.common.BitmapCropTask;
import com.android.gallery3d.common.BitmapUtils;
import com.android.gallery3d.common.Utils;
+import com.android.launcher3.util.Thunk;
import com.android.photos.BitmapRegionTileSource;
import com.android.photos.BitmapRegionTileSource.BitmapSource;
import com.android.photos.BitmapRegionTileSource.BitmapSource.InBitmapProvider;
@@ -78,10 +79,10 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback
private HandlerThread mLoaderThread;
private Handler mLoaderHandler;
- private LoadRequest mCurrentLoadRequest;
+ @Thunk LoadRequest mCurrentLoadRequest;
private byte[] mTempStorageForDecoding = new byte[16 * 1024];
// A weak-set of reusable bitmaps
- private Set<Bitmap> mReusableBitmaps =
+ @Thunk Set<Bitmap> mReusableBitmaps =
Collections.newSetFromMap(new WeakHashMap<Bitmap, Boolean>());
@Override
@@ -220,7 +221,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback
return false;
}
- private void addReusableBitmap(TileSource src) {
+ @Thunk void addReusableBitmap(TileSource src) {
synchronized (mReusableBitmaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
&& src instanceof BitmapRegionTileSource) {
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index d16fc31e5..1364df3ed 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -70,6 +70,7 @@ import android.widget.Toast;
import com.android.gallery3d.common.BitmapCropTask;
import com.android.gallery3d.common.BitmapUtils;
import com.android.gallery3d.common.Utils;
+import com.android.launcher3.util.Thunk;
import com.android.photos.BitmapRegionTileSource;
import com.android.photos.BitmapRegionTileSource.BitmapSource;
import com.android.photos.views.TiledImageRenderer.TileSource;
@@ -88,21 +89,21 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private static final String SELECTED_INDEX = "SELECTED_INDEX";
private static final int FLAG_POST_DELAY_MILLIS = 200;
- private View mSelectedTile;
- private boolean mIgnoreNextTap;
- private OnClickListener mThumbnailOnClickListener;
+ @Thunk View mSelectedTile;
+ @Thunk boolean mIgnoreNextTap;
+ @Thunk OnClickListener mThumbnailOnClickListener;
- private LinearLayout mWallpapersView;
- private HorizontalScrollView mWallpaperScrollContainer;
+ @Thunk LinearLayout mWallpapersView;
+ @Thunk HorizontalScrollView mWallpaperScrollContainer;
- private ActionMode.Callback mActionModeCallback;
- private ActionMode mActionMode;
+ @Thunk ActionMode.Callback mActionModeCallback;
+ @Thunk ActionMode mActionMode;
- private View.OnLongClickListener mLongClickListener;
+ @Thunk View.OnLongClickListener mLongClickListener;
ArrayList<Uri> mTempWallpaperTiles = new ArrayList<Uri>();
private SavedWallpaperImages mSavedImages;
- private int mSelectedIndex = -1;
+ @Thunk int mSelectedIndex = -1;
public static abstract class WallpaperTileInfo {
protected View mView;
@@ -135,7 +136,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
public static class UriWallpaperInfo extends WallpaperTileInfo {
private Uri mUri;
private boolean mFirstClick = true;
- private BitmapRegionTileSource.UriBitmapSource mBitmapSource;
+ @Thunk BitmapRegionTileSource.UriBitmapSource mBitmapSource;
public UriWallpaperInfo(Uri uri) {
mUri = uri;
}
@@ -337,7 +338,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}, FLAG_POST_DELAY_MILLIS);
}
- private void changeWallpaperFlags(boolean visible) {
+ @Thunk void changeWallpaperFlags(boolean visible) {
int desiredWallpaperFlag = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0;
int currentWallpaperFlag = getWindow().getAttributes().flags
& WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
@@ -635,7 +636,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
};
}
- private void selectTile(View v) {
+ @Thunk void selectTile(View v) {
if (mSelectedTile != null) {
mSelectedTile.setSelected(false);
mSelectedTile = null;
@@ -649,7 +650,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
getString(R.string.announce_selection, v.getContentDescription()));
}
- private void initializeScrollForRtl() {
+ @Thunk void initializeScrollForRtl() {
if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@@ -704,7 +705,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
mSelectedIndex = savedInstanceState.getInt(SELECTED_INDEX, -1);
}
- private void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter,
+ @Thunk void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter,
boolean addLongPressHandler) {
for (int i = 0; i < adapter.getCount(); i++) {
FrameLayout thumbnail = (FrameLayout) adapter.getView(i, null, parent);
@@ -719,7 +720,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
}
- private void updateTileIndices() {
+ @Thunk void updateTileIndices() {
LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list);
final int childCount = masterWallpaperList.getChildCount();
final Resources res = getResources();
@@ -760,13 +761,13 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
}
- private static Point getDefaultThumbnailSize(Resources res) {
+ @Thunk static Point getDefaultThumbnailSize(Resources res) {
return new Point(res.getDimensionPixelSize(R.dimen.wallpaperThumbnailWidth),
res.getDimensionPixelSize(R.dimen.wallpaperThumbnailHeight));
}
- private static Bitmap createThumbnail(Point size, Context context, Uri uri, byte[] imageBytes,
+ @Thunk static Bitmap createThumbnail(Point size, Context context, Uri uri, byte[] imageBytes,
Resources res, int resId, int rotation, boolean leftAligned) {
int width = size.x;
int height = size.y;
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<Bitmap> sTilePool = new SynchronizedPool<Bitmap>(64);
+ @Thunk static Pool<Bitmap> sTilePool = new SynchronizedPool<Bitmap>(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<Tile> mActiveTiles = new LongSparseArray<Tile>();
// 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;