diff options
author | Xavier Ducrohet <xav@android.com> | 2011-02-09 17:17:49 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-02-09 17:29:29 -0800 |
commit | 9a4fe29c8d92014d2d9a848e9116b8cc9d0842f9 (patch) | |
tree | 97d83ce52c0a5cffaa82be0bae9919f112acd7c9 /tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java | |
parent | e18457fbef2ef8b74fb6d7a023b5a6fe4a707bed (diff) | |
download | frameworks_base-9a4fe29c8d92014d2d9a848e9116b8cc9d0842f9.zip frameworks_base-9a4fe29c8d92014d2d9a848e9116b8cc9d0842f9.tar.gz frameworks_base-9a4fe29c8d92014d2d9a848e9116b8cc9d0842f9.tar.bz2 |
LayoutLib: Annotate the custom delegate methods.
Every method implementing a delegate needed by the
layoutlib_create bytecode modification must now be
annotated with LayoutlibDelegate.
The methods in the original source code that are delegated
are already automatically annotated. Now with the implementations
being annotated we can do bi-directional tests and find not
only missing implementations but also dead obsolete code.
This will be useful when backporting to earlier versions of
Android, or when native (non public) method disappear. In fact,
the new test detected one such method in Shader.
Change-Id: I491708b68ac2736ca5669aa86cd5e930a00f9db3
Diffstat (limited to 'tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java')
-rw-r--r-- | tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java index c4fffc8..080b85f 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java @@ -21,6 +21,7 @@ import com.android.layoutlib.bridge.android.BridgeResources.NinePatchInputStream import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.ninepatch.NinePatchChunk; import com.android.resources.Density; +import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import android.graphics.BitmapFactory.Options; @@ -42,6 +43,7 @@ import java.io.InputStream; // ------ Java delegates ------ + @LayoutlibDelegate /*package*/ static Bitmap finishDecode(Bitmap bm, Rect outPadding, Options opts) { if (bm == null || opts == null) { return bm; @@ -82,10 +84,12 @@ import java.io.InputStream; // ------ Native Delegates ------ + @LayoutlibDelegate /*package*/ static void nativeSetDefaultConfig(int nativeConfig) { // pass } + @LayoutlibDelegate /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage, Rect padding, Options opts) { Bitmap bm = null; @@ -129,29 +133,34 @@ import java.io.InputStream; return bm; } + @LayoutlibDelegate /*package*/ static Bitmap nativeDecodeFileDescriptor(FileDescriptor fd, Rect padding, Options opts) { opts.inBitmap = null; return null; } + @LayoutlibDelegate /*package*/ static Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts) { opts.inBitmap = null; return null; } + @LayoutlibDelegate /*package*/ static Bitmap nativeDecodeByteArray(byte[] data, int offset, int length, Options opts) { opts.inBitmap = null; return null; } + @LayoutlibDelegate /*package*/ static byte[] nativeScaleNinePatch(byte[] chunk, float scale, Rect pad) { // don't scale for now. This should not be called anyway since we re-implement // BitmapFactory.finishDecode(); return chunk; } + @LayoutlibDelegate /*package*/ static boolean nativeIsSeekable(FileDescriptor fd) { return true; } |