1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.jni.cts;
18 
19 import dalvik.annotation.optimization.CriticalNative;
20 import dalvik.annotation.optimization.FastNative;
21 
22 /**
23  * Class with a bunch of native static methods. These methods are called by
24  * the various tests in {@link JniStaticTest}.
25  */
26 public class StaticNonce {
27     static {
28         if (!JniTestCase.isCpuAbiNone()) {
29             System.loadLibrary("jnitest");
30         }
31     }
32 
33     /**
34      * Construct an instance.
35      */
StaticNonce()36     public StaticNonce() {
37         // This space intentionally left blank.
38     }
39 
40     // See JniStaticTest for the expected behavior of these methods.
41 
missing()42     public static native void missing();
43     @FastNative
missingFast()44     public static native void missingFast();
45     @CriticalNative
missingCritical()46     public static native void missingCritical();
47 
nop()48     public static native void nop();
nopDlsym()49     public static native void nopDlsym();
50     @FastNative
nopFast()51     public static native void nopFast();
52     @FastNative
nopFastDlsym()53     public static native void nopFastDlsym();
54     @CriticalNative
nopCritical()55     public static native void nopCritical();
56     @CriticalNative
nopCriticalDlsym()57     public static native void nopCriticalDlsym();
58 
returnBoolean()59     public static native boolean returnBoolean();
60     @FastNative
returnBooleanFast()61     public static native boolean returnBooleanFast();
62     @CriticalNative
returnBooleanCritical()63     public static native boolean returnBooleanCritical();
64 
returnByte()65     public static native byte returnByte();
66     @FastNative
returnByteFast()67     public static native byte returnByteFast();
68     @CriticalNative
returnByteCritical()69     public static native byte returnByteCritical();
70 
returnShort()71     public static native short returnShort();
72     @FastNative
returnShortFast()73     public static native short returnShortFast();
74     @CriticalNative
returnShortCritical()75     public static native short returnShortCritical();
76 
returnChar()77     public static native char returnChar();
78     @FastNative
returnCharFast()79     public static native char returnCharFast();
80     @CriticalNative
returnCharCritical()81     public static native char returnCharCritical();
82 
returnInt()83     public static native int returnInt();
84     @FastNative
returnIntFast()85     public static native int returnIntFast();
86     @CriticalNative
returnIntCritical()87     public static native int returnIntCritical();
88 
returnLong()89     public static native long returnLong();
90     @FastNative
returnLongFast()91     public static native long returnLongFast();
92     @CriticalNative
returnLongCritical()93     public static native long returnLongCritical();
94 
returnFloat()95     public static native float returnFloat();
96     @FastNative
returnFloatFast()97     public static native float returnFloatFast();
98     @CriticalNative
returnFloatCritical()99     public static native float returnFloatCritical();
100 
returnDouble()101     public static native double returnDouble();
102     @FastNative
returnDoubleFast()103     public static native double returnDoubleFast();
104     @CriticalNative
returnDoubleCritical()105     public static native double returnDoubleCritical();
106 
returnNull()107     public static native Object returnNull();
108     @FastNative
returnNullFast()109     public static native Object returnNullFast();
110 
returnString()111     public static native String returnString();
112     @FastNative
returnStringFast()113     public static native String returnStringFast();
114 
returnShortArray()115     public static native short[] returnShortArray();
116     @FastNative
returnShortArrayFast()117     public static native short[] returnShortArrayFast();
118 
returnStringArray()119     public static native String[] returnStringArray();
120     @FastNative
returnStringArrayFast()121     public static native String[] returnStringArrayFast();
122 
returnThisClass()123     public static native Class returnThisClass();
124     @FastNative
returnThisClassFast()125     public static native Class returnThisClassFast();
126 
returnInstance()127     public static native StaticNonce returnInstance();
128     @FastNative
returnInstanceFast()129     public static native StaticNonce returnInstanceFast();
130 
takeBoolean(boolean v)131     public static native boolean takeBoolean(boolean v);
132     @FastNative
takeBooleanFast(boolean v)133     public static native boolean takeBooleanFast(boolean v);
134     @CriticalNative
takeBooleanCritical(boolean v)135     public static native boolean takeBooleanCritical(boolean v);
136 
takeByte(byte v)137     public static native boolean takeByte(byte v);
138     @FastNative
takeByteFast(byte v)139     public static native boolean takeByteFast(byte v);
140     @CriticalNative
takeByteCritical(byte v)141     public static native boolean takeByteCritical(byte v);
142 
takeShort(short v)143     public static native boolean takeShort(short v);
144     @FastNative
takeShortFast(short v)145     public static native boolean takeShortFast(short v);
146     @CriticalNative
takeShortCritical(short v)147     public static native boolean takeShortCritical(short v);
148 
takeChar(char v)149     public static native boolean takeChar(char v);
150     @FastNative
takeCharFast(char v)151     public static native boolean takeCharFast(char v);
152     @CriticalNative
takeCharCritical(char v)153     public static native boolean takeCharCritical(char v);
154 
takeInt(int v)155     public static native boolean takeInt(int v);
156     @FastNative
takeIntFast(int v)157     public static native boolean takeIntFast(int v);
158     @CriticalNative
takeIntCritical(int v)159     public static native boolean takeIntCritical(int v);
160 
takeLong(long v)161     public static native boolean takeLong(long v);
162     @FastNative
takeLongFast(long v)163     public static native boolean takeLongFast(long v);
164     @CriticalNative
takeLongCritical(long v)165     public static native boolean takeLongCritical(long v);
166 
takeFloat(float v)167     public static native boolean takeFloat(float v);
168     @FastNative
takeFloatFast(float v)169     public static native boolean takeFloatFast(float v);
170     @CriticalNative
takeFloatCritical(float v)171     public static native boolean takeFloatCritical(float v);
172 
takeDouble(double v)173     public static native boolean takeDouble(double v);
174     @FastNative
takeDoubleFast(double v)175     public static native boolean takeDoubleFast(double v);
176     @CriticalNative
takeDoubleCritical(double v)177     public static native boolean takeDoubleCritical(double v);
178 
takeNull(Object v)179     public static native boolean takeNull(Object v);
180     @FastNative
takeNullFast(Object v)181     public static native boolean takeNullFast(Object v);
182 
takeString(String v)183     public static native boolean takeString(String v);
184     @FastNative
takeStringFast(String v)185     public static native boolean takeStringFast(String v);
186 
takeThisClass(Class v)187     public static native boolean takeThisClass(Class v);
188     @FastNative
takeThisClassFast(Class v)189     public static native boolean takeThisClassFast(Class v);
190 
takeIntLong(int v1, long v2)191     public static native boolean takeIntLong(int v1, long v2);
192     @FastNative
takeIntLongFast(int v1, long v2)193     public static native boolean takeIntLongFast(int v1, long v2);
194     @CriticalNative
takeIntLongCritical(int v1, long v2)195     public static native boolean takeIntLongCritical(int v1, long v2);
196 
takeLongInt(long v1, int v2)197     public static native boolean takeLongInt(long v1, int v2);
198     @FastNative
takeLongIntFast(long v1, int v2)199     public static native boolean takeLongIntFast(long v1, int v2);
200     @CriticalNative
takeLongIntCritical(long v1, int v2)201     public static native boolean takeLongIntCritical(long v1, int v2);
202 
takeOneOfEach(boolean v0, byte v1, short v2, char v3, int v4, long v5, String v6, float v7, double v8, int[] v9)203     public static native boolean takeOneOfEach(boolean v0, byte v1, short v2,
204             char v3, int v4, long v5, String v6, float v7, double v8,
205             int[] v9);
takeOneOfEachDlsym(boolean v0, byte v1, short v2, char v3, int v4, long v5, String v6, float v7, double v8, int[] v9)206     public static native boolean takeOneOfEachDlsym(boolean v0, byte v1,
207             short v2, char v3, int v4, long v5, String v6, float v7, double v8,
208             int[] v9);
209     @FastNative
takeOneOfEachFast(boolean v0, byte v1, short v2, char v3, int v4, long v5, String v6, float v7, double v8, int[] v9)210     public static native boolean takeOneOfEachFast(boolean v0, byte v1,
211             short v2, char v3, int v4, long v5, String v6, float v7, double v8,
212             int[] v9);
213     @FastNative
takeOneOfEachFastDlsym(boolean v0, byte v1, short v2, char v3, int v4, long v5, String v6, float v7, double v8, int[] v9)214     public static native boolean takeOneOfEachFastDlsym(boolean v0, byte v1,
215             short v2, char v3, int v4, long v5, String v6, float v7, double v8,
216             int[] v9);
217     @CriticalNative
takeOneOfEachCritical(boolean v0, byte v1, short v2, char v3, int v4, long v5, float v6, double v7)218     public static native boolean takeOneOfEachCritical(boolean v0, byte v1,
219             short v2, char v3, int v4, long v5, float v6, double v7);
220     @CriticalNative
takeOneOfEachCriticalDlsym(boolean v0, byte v1, short v2, char v3, int v4, long v5, float v6, double v7)221     public static native boolean takeOneOfEachCriticalDlsym(boolean v0,
222             byte v1, short v2, char v3, int v4, long v5, float v6, double v7);
223 
takeCoolHandLuke( int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15, int v16, int v17, int v18, int v19, int v20, int v21, int v22, int v23, int v24, int v25, int v26, int v27, int v28, int v29, int v30, int v31, int v32, int v33, int v34, int v35, int v36, int v37, int v38, int v39, int v40, int v41, int v42, int v43, int v44, int v45, int v46, int v47, int v48, int v49, int v50)224     public static native boolean takeCoolHandLuke(
225             int v1, int v2, int v3, int v4,
226             int v5, int v6, int v7, int v8, int v9,
227             int v10, int v11, int v12, int v13, int v14,
228             int v15, int v16, int v17, int v18, int v19,
229             int v20, int v21, int v22, int v23, int v24,
230             int v25, int v26, int v27, int v28, int v29,
231             int v30, int v31, int v32, int v33, int v34,
232             int v35, int v36, int v37, int v38, int v39,
233             int v40, int v41, int v42, int v43, int v44,
234             int v45, int v46, int v47, int v48, int v49,
235             int v50);
236     @FastNative
takeCoolHandLukeFast( int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15, int v16, int v17, int v18, int v19, int v20, int v21, int v22, int v23, int v24, int v25, int v26, int v27, int v28, int v29, int v30, int v31, int v32, int v33, int v34, int v35, int v36, int v37, int v38, int v39, int v40, int v41, int v42, int v43, int v44, int v45, int v46, int v47, int v48, int v49, int v50)237     public static native boolean takeCoolHandLukeFast(
238             int v1, int v2, int v3, int v4,
239             int v5, int v6, int v7, int v8, int v9,
240             int v10, int v11, int v12, int v13, int v14,
241             int v15, int v16, int v17, int v18, int v19,
242             int v20, int v21, int v22, int v23, int v24,
243             int v25, int v26, int v27, int v28, int v29,
244             int v30, int v31, int v32, int v33, int v34,
245             int v35, int v36, int v37, int v38, int v39,
246             int v40, int v41, int v42, int v43, int v44,
247             int v45, int v46, int v47, int v48, int v49,
248             int v50);
249     @CriticalNative
takeCoolHandLukeCritical( int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15, int v16, int v17, int v18, int v19, int v20, int v21, int v22, int v23, int v24, int v25, int v26, int v27, int v28, int v29, int v30, int v31, int v32, int v33, int v34, int v35, int v36, int v37, int v38, int v39, int v40, int v41, int v42, int v43, int v44, int v45, int v46, int v47, int v48, int v49, int v50)250     public static native boolean takeCoolHandLukeCritical(
251             int v1, int v2, int v3, int v4,
252             int v5, int v6, int v7, int v8, int v9,
253             int v10, int v11, int v12, int v13, int v14,
254             int v15, int v16, int v17, int v18, int v19,
255             int v20, int v21, int v22, int v23, int v24,
256             int v25, int v26, int v27, int v28, int v29,
257             int v30, int v31, int v32, int v33, int v34,
258             int v35, int v36, int v37, int v38, int v39,
259             int v40, int v41, int v42, int v43, int v44,
260             int v45, int v46, int v47, int v48, int v49,
261             int v50);
262 
263     @CriticalNative
takeCoolHandLukeWithFloatsCritical( int v1, int v2, int v3, int v4, int v5, double v6, double v7, double v8, double v9, double v10, double v11, double v12, double v13, double v14)264     public static native boolean takeCoolHandLukeWithFloatsCritical(
265             int v1, int v2, int v3, int v4, int v5,
266             double v6, double v7, double v8, double v9, double v10,
267             double v11, double v12, double v13, double v14);
268 
269 }
270