Convert utils fastjni -> @FastNative
Test: builds & boots, refactor no behavior change
Change-Id: Ieb569a70fd05b88a8d2bd7b285099c1fc1888a75
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index 4ad86f7..b0d0d79 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -27,6 +27,8 @@
import android.util.SparseArray;
import android.util.TypedValue;
+import dalvik.annotation.optimization.FastNative;
+
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -752,6 +754,7 @@
* applications.
* {@hide}
*/
+ @FastNative
public native final void setConfiguration(int mcc, int mnc, String locale,
int orientation, int touchscreen, int density, int keyboard,
int keyboardHidden, int navigation, int screenWidth, int screenHeight,
@@ -761,13 +764,18 @@
/**
* Retrieve the resource identifier for the given resource name.
*/
+ @FastNative
/*package*/ native final int getResourceIdentifier(String type,
String name,
String defPackage);
+ @FastNative
/*package*/ native final String getResourceName(int resid);
+ @FastNative
/*package*/ native final String getResourcePackageName(int resid);
+ @FastNative
/*package*/ native final String getResourceTypeName(int resid);
+ @FastNative
/*package*/ native final String getResourceEntryName(int resid);
private native final long openAsset(String fileName, int accessMode);
@@ -781,15 +789,19 @@
private native final int readAssetChar(long asset);
private native final int readAsset(long asset, byte[] b, int off, int len);
private native final long seekAsset(long asset, long offset, int whence);
+ @FastNative
private native final long getAssetLength(long asset);
+ @FastNative
private native final long getAssetRemainingLength(long asset);
/** Returns true if the resource was found, filling in mRetStringBlock and
* mRetData. */
+ @FastNative
private native final int loadResourceValue(int ident, short density, TypedValue outValue,
boolean resolve);
/** Returns true if the resource was found, filling in mRetStringBlock and
* mRetData. */
+ @FastNative
private native final int loadResourceBagValue(int ident, int bagEntryId, TypedValue outValue,
boolean resolve);
/*package*/ static final int STYLE_NUM_ENTRIES = 6;
@@ -802,17 +814,24 @@
static final int STYLE_CHANGING_CONFIGURATIONS = 4;
/*package*/ static final int STYLE_DENSITY = 5;
+ @FastNative
/*package*/ native static final boolean applyStyle(long theme,
int defStyleAttr, int defStyleRes, long xmlParser,
int[] inAttrs, int[] outValues, int[] outIndices);
+ @FastNative
/*package*/ native static final boolean resolveAttrs(long theme,
int defStyleAttr, int defStyleRes, int[] inValues,
int[] inAttrs, int[] outValues, int[] outIndices);
+ @FastNative
/*package*/ native final boolean retrieveAttributes(
long xmlParser, int[] inAttrs, int[] outValues, int[] outIndices);
+ @FastNative
/*package*/ native final int getArraySize(int resource);
+ @FastNative
/*package*/ native final int retrieveArray(int resource, int[] outValues);
+ @FastNative
private native final int getStringBlockCount();
+ @FastNative
private native final long getNativeStringBlock(int block);
/**
@@ -845,17 +864,22 @@
/*package*/ native static final void applyThemeStyle(long theme, int styleRes, boolean force);
/*package*/ native static final void copyTheme(long dest, long source);
/*package*/ native static final void clearTheme(long theme);
+ @FastNative
/*package*/ native static final int loadThemeAttributeValue(long theme, int ident,
TypedValue outValue,
boolean resolve);
/*package*/ native static final void dumpTheme(long theme, int priority, String tag, String prefix);
+ @FastNative
/*package*/ native static final @NativeConfig int getThemeChangingConfigurations(long theme);
private native final long openXmlAssetNative(int cookie, String fileName);
private native final String[] getArrayStringResource(int arrayRes);
+ @FastNative
private native final int[] getArrayStringInfo(int arrayRes);
+ @FastNative
/*package*/ native final int[] getArrayIntResource(int arrayRes);
+ @FastNative
/*package*/ native final int[] getStyleAttributes(int themeRes);
private native final void init(boolean isSystem);
diff --git a/core/java/android/content/res/XmlBlock.java b/core/java/android/content/res/XmlBlock.java
index 2f4d69b0..e6b95741 100644
--- a/core/java/android/content/res/XmlBlock.java
+++ b/core/java/android/content/res/XmlBlock.java
@@ -20,6 +20,8 @@
import com.android.internal.util.XmlUtils;
+import dalvik.annotation.optimization.FastNative;
+
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
@@ -492,25 +494,42 @@
int offset,
int size);
private static final native long nativeGetStringBlock(long obj);
-
private static final native long nativeCreateParseState(long obj);
- /*package*/ static final native int nativeNext(long state);
- private static final native int nativeGetNamespace(long state);
- /*package*/ static final native int nativeGetName(long state);
- private static final native int nativeGetText(long state);
- private static final native int nativeGetLineNumber(long state);
- private static final native int nativeGetAttributeCount(long state);
- private static final native int nativeGetAttributeNamespace(long state, int idx);
- private static final native int nativeGetAttributeName(long state, int idx);
- private static final native int nativeGetAttributeResource(long state, int idx);
- private static final native int nativeGetAttributeDataType(long state, int idx);
- private static final native int nativeGetAttributeData(long state, int idx);
- private static final native int nativeGetAttributeStringValue(long state, int idx);
- private static final native int nativeGetIdAttribute(long state);
- private static final native int nativeGetClassAttribute(long state);
- private static final native int nativeGetStyleAttribute(long state);
- private static final native int nativeGetAttributeIndex(long state, String namespace, String name);
private static final native void nativeDestroyParseState(long state);
-
private static final native void nativeDestroy(long obj);
+
+ // ----------- @FastNative ------------------
+
+ @FastNative
+ /*package*/ static final native int nativeNext(long state);
+ @FastNative
+ private static final native int nativeGetNamespace(long state);
+ @FastNative
+ /*package*/ static final native int nativeGetName(long state);
+ @FastNative
+ private static final native int nativeGetText(long state);
+ @FastNative
+ private static final native int nativeGetLineNumber(long state);
+ @FastNative
+ private static final native int nativeGetAttributeCount(long state);
+ @FastNative
+ private static final native int nativeGetAttributeNamespace(long state, int idx);
+ @FastNative
+ private static final native int nativeGetAttributeName(long state, int idx);
+ @FastNative
+ private static final native int nativeGetAttributeResource(long state, int idx);
+ @FastNative
+ private static final native int nativeGetAttributeDataType(long state, int idx);
+ @FastNative
+ private static final native int nativeGetAttributeData(long state, int idx);
+ @FastNative
+ private static final native int nativeGetAttributeStringValue(long state, int idx);
+ @FastNative
+ private static final native int nativeGetIdAttribute(long state);
+ @FastNative
+ private static final native int nativeGetClassAttribute(long state);
+ @FastNative
+ private static final native int nativeGetStyleAttribute(long state);
+ @FastNative
+ private static final native int nativeGetAttributeIndex(long state, String namespace, String name);
}
diff --git a/core/java/android/util/PathParser.java b/core/java/android/util/PathParser.java
index f1c8c7d..6f314d0 100644
--- a/core/java/android/util/PathParser.java
+++ b/core/java/android/util/PathParser.java
@@ -16,6 +16,8 @@
import android.graphics.Path;
+import dalvik.annotation.optimization.FastNative;
+
/**
* @hide
*/
@@ -119,14 +121,24 @@
// Native functions are defined below.
private static native void nParseStringForPath(long pathPtr, String pathString,
int stringLength);
- private static native void nCreatePathFromPathData(long outPathPtr, long pathData);
- private static native long nCreateEmptyPathData();
- private static native long nCreatePathData(long nativePtr);
private static native long nCreatePathDataFromString(String pathString, int stringLength);
+
+ // ----------------- @FastNative -----------------------
+
+ @FastNative
+ private static native void nCreatePathFromPathData(long outPathPtr, long pathData);
+ @FastNative
+ private static native long nCreateEmptyPathData();
+ @FastNative
+ private static native long nCreatePathData(long nativePtr);
+ @FastNative
private static native boolean nInterpolatePathData(long outDataPtr, long fromDataPtr,
long toDataPtr, float fraction);
+ @FastNative
private static native void nFinalize(long nativePtr);
+ @FastNative
private static native boolean nCanMorph(long fromDataPtr, long toDataPtr);
+ @FastNative
private static native void nSetPathData(long outDataPtr, long fromDataPtr);
}
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 428159a..ef32afee 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -2161,9 +2161,11 @@
(void*) android_content_AssetManager_readAsset },
{ "seekAsset", "(JJI)J",
(void*) android_content_AssetManager_seekAsset },
- { "getAssetLength", "!(J)J",
+ // @FastNative
+ { "getAssetLength", "(J)J",
(void*) android_content_AssetManager_getAssetLength },
- { "getAssetRemainingLength", "!(J)J",
+ // @FastNative
+ { "getAssetRemainingLength", "(J)J",
(void*) android_content_AssetManager_getAssetRemainingLength },
{ "addAssetPathNative", "(Ljava/lang/String;Z)I",
(void*) android_content_AssetManager_addAssetPath },
@@ -2179,25 +2181,35 @@
(void*) android_content_AssetManager_getNonSystemLocales },
{ "getSizeConfigurations", "()[Landroid/content/res/Configuration;",
(void*) android_content_AssetManager_getSizeConfigurations },
- { "setConfiguration", "!(IILjava/lang/String;IIIIIIIIIIIIII)V",
+ // @FastNative
+ { "setConfiguration", "(IILjava/lang/String;IIIIIIIIIIIIII)V",
(void*) android_content_AssetManager_setConfiguration },
- { "getResourceIdentifier","!(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
+ // @FastNative
+ { "getResourceIdentifier","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
(void*) android_content_AssetManager_getResourceIdentifier },
- { "getResourceName","!(I)Ljava/lang/String;",
+ // @FastNative
+ { "getResourceName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getResourceName },
- { "getResourcePackageName","!(I)Ljava/lang/String;",
+ // @FastNative
+ { "getResourcePackageName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getResourcePackageName },
- { "getResourceTypeName","!(I)Ljava/lang/String;",
+ // @FastNative
+ { "getResourceTypeName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getResourceTypeName },
- { "getResourceEntryName","!(I)Ljava/lang/String;",
+ // @FastNative
+ { "getResourceEntryName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getResourceEntryName },
- { "loadResourceValue","!(ISLandroid/util/TypedValue;Z)I",
+ // @FastNative
+ { "loadResourceValue","(ISLandroid/util/TypedValue;Z)I",
(void*) android_content_AssetManager_loadResourceValue },
- { "loadResourceBagValue","!(IILandroid/util/TypedValue;Z)I",
+ // @FastNative
+ { "loadResourceBagValue","(IILandroid/util/TypedValue;Z)I",
(void*) android_content_AssetManager_loadResourceBagValue },
- { "getStringBlockCount","!()I",
+ // @FastNative
+ { "getStringBlockCount","()I",
(void*) android_content_AssetManager_getStringBlockCount },
- { "getNativeStringBlock","!(I)J",
+ // @FastNative
+ { "getNativeStringBlock","(I)J",
(void*) android_content_AssetManager_getNativeStringBlock },
{ "getCookieName","(I)Ljava/lang/String;",
(void*) android_content_AssetManager_getCookieName },
@@ -2215,21 +2227,28 @@
(void*) android_content_AssetManager_copyTheme },
{ "clearTheme", "(J)V",
(void*) android_content_AssetManager_clearTheme },
- { "loadThemeAttributeValue", "!(JILandroid/util/TypedValue;Z)I",
+ // @FastNative
+ { "loadThemeAttributeValue", "(JILandroid/util/TypedValue;Z)I",
(void*) android_content_AssetManager_loadThemeAttributeValue },
- { "getThemeChangingConfigurations", "!(J)I",
+ // @FastNative
+ { "getThemeChangingConfigurations", "(J)I",
(void*) android_content_AssetManager_getThemeChangingConfigurations },
{ "dumpTheme", "(JILjava/lang/String;Ljava/lang/String;)V",
(void*) android_content_AssetManager_dumpTheme },
- { "applyStyle","!(JIIJ[I[I[I)Z",
+ // @FastNative
+ { "applyStyle","(JIIJ[I[I[I)Z",
(void*) android_content_AssetManager_applyStyle },
- { "resolveAttrs","!(JII[I[I[I[I)Z",
+ // @FastNative
+ { "resolveAttrs","(JII[I[I[I[I)Z",
(void*) android_content_AssetManager_resolveAttrs },
- { "retrieveAttributes","!(J[I[I[I)Z",
+ // @FastNative
+ { "retrieveAttributes","(J[I[I[I)Z",
(void*) android_content_AssetManager_retrieveAttributes },
- { "getArraySize","!(I)I",
+ // @FastNative
+ { "getArraySize","(I)I",
(void*) android_content_AssetManager_getArraySize },
- { "retrieveArray","!(I[I)I",
+ // @FastNative
+ { "retrieveArray","(I[I)I",
(void*) android_content_AssetManager_retrieveArray },
// XML files.
@@ -2239,11 +2258,14 @@
// Arrays.
{ "getArrayStringResource","(I)[Ljava/lang/String;",
(void*) android_content_AssetManager_getArrayStringResource },
- { "getArrayStringInfo","!(I)[I",
+ // @FastNative
+ { "getArrayStringInfo","(I)[I",
(void*) android_content_AssetManager_getArrayStringInfo },
- { "getArrayIntResource","!(I)[I",
+ // @FastNative
+ { "getArrayIntResource","(I)[I",
(void*) android_content_AssetManager_getArrayIntResource },
- { "getStyleAttributes","!(I)[I",
+ // @FastNative
+ { "getStyleAttributes","(I)[I",
(void*) android_content_AssetManager_getStyleAttributes },
// Bookkeeping.
diff --git a/core/jni/android_util_PathParser.cpp b/core/jni/android_util_PathParser.cpp
index 53669a8..10efb95 100644
--- a/core/jni/android_util_PathParser.cpp
+++ b/core/jni/android_util_PathParser.cpp
@@ -101,14 +101,17 @@
static const JNINativeMethod gMethods[] = {
{"nParseStringForPath", "(JLjava/lang/String;I)V", (void*)parseStringForPath},
- {"nCreateEmptyPathData", "!()J", (void*)createEmptyPathData},
- {"nCreatePathData", "!(J)J", (void*)createPathData},
{"nCreatePathDataFromString", "(Ljava/lang/String;I)J", (void*)createPathDataFromStringPath},
- {"nInterpolatePathData", "!(JJJF)Z", (void*)interpolatePathData},
- {"nFinalize", "!(J)V", (void*)deletePathData},
- {"nCanMorph", "!(JJ)Z", (void*)canMorphPathData},
- {"nSetPathData", "!(JJ)V", (void*)setPathData},
- {"nCreatePathFromPathData", "!(JJ)V", (void*)setSkPathFromPathData},
+
+ // ---------------- @FastNative -----------------
+
+ {"nCreateEmptyPathData", "()J", (void*)createEmptyPathData},
+ {"nCreatePathData", "(J)J", (void*)createPathData},
+ {"nInterpolatePathData", "(JJJF)Z", (void*)interpolatePathData},
+ {"nFinalize", "(J)V", (void*)deletePathData},
+ {"nCanMorph", "(JJ)Z", (void*)canMorphPathData},
+ {"nSetPathData", "(JJ)V", (void*)setPathData},
+ {"nCreatePathFromPathData", "(JJ)V", (void*)setSkPathFromPathData},
};
int register_android_util_PathParser(JNIEnv* env) {
diff --git a/core/jni/android_util_XmlBlock.cpp b/core/jni/android_util_XmlBlock.cpp
index a15c23c..99882cc 100644
--- a/core/jni/android_util_XmlBlock.cpp
+++ b/core/jni/android_util_XmlBlock.cpp
@@ -372,42 +372,45 @@
(void*) android_content_XmlBlock_nativeGetStringBlock },
{ "nativeCreateParseState", "(J)J",
(void*) android_content_XmlBlock_nativeCreateParseState },
- { "nativeNext", "!(J)I",
- (void*) android_content_XmlBlock_nativeNext },
- { "nativeGetNamespace", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetNamespace },
- { "nativeGetName", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetName },
- { "nativeGetText", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetText },
- { "nativeGetLineNumber", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetLineNumber },
- { "nativeGetAttributeCount", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetAttributeCount },
- { "nativeGetAttributeNamespace","!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeNamespace },
- { "nativeGetAttributeName", "!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeName },
- { "nativeGetAttributeResource", "!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeResource },
- { "nativeGetAttributeDataType", "!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeDataType },
- { "nativeGetAttributeData", "!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeData },
- { "nativeGetAttributeStringValue", "!(JI)I",
- (void*) android_content_XmlBlock_nativeGetAttributeStringValue },
- { "nativeGetAttributeIndex", "!(JLjava/lang/String;Ljava/lang/String;)I",
- (void*) android_content_XmlBlock_nativeGetAttributeIndex },
- { "nativeGetIdAttribute", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetIdAttribute },
- { "nativeGetClassAttribute", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetClassAttribute },
- { "nativeGetStyleAttribute", "!(J)I",
- (void*) android_content_XmlBlock_nativeGetStyleAttribute },
{ "nativeDestroyParseState", "(J)V",
(void*) android_content_XmlBlock_nativeDestroyParseState },
{ "nativeDestroy", "(J)V",
(void*) android_content_XmlBlock_nativeDestroy },
+
+ // ------------------- @FastNative ----------------------
+
+ { "nativeNext", "(J)I",
+ (void*) android_content_XmlBlock_nativeNext },
+ { "nativeGetNamespace", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetNamespace },
+ { "nativeGetName", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetName },
+ { "nativeGetText", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetText },
+ { "nativeGetLineNumber", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetLineNumber },
+ { "nativeGetAttributeCount", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeCount },
+ { "nativeGetAttributeNamespace","(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeNamespace },
+ { "nativeGetAttributeName", "(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeName },
+ { "nativeGetAttributeResource", "(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeResource },
+ { "nativeGetAttributeDataType", "(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeDataType },
+ { "nativeGetAttributeData", "(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeData },
+ { "nativeGetAttributeStringValue", "(JI)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeStringValue },
+ { "nativeGetAttributeIndex", "(JLjava/lang/String;Ljava/lang/String;)I",
+ (void*) android_content_XmlBlock_nativeGetAttributeIndex },
+ { "nativeGetIdAttribute", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetIdAttribute },
+ { "nativeGetClassAttribute", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetClassAttribute },
+ { "nativeGetStyleAttribute", "(J)I",
+ (void*) android_content_XmlBlock_nativeGetStyleAttribute },
};
int register_android_content_XmlBlock(JNIEnv* env)