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 /** 20 * Class with a bunch of static methods that get called from native 21 * code. See {@code macroized_tests.c} in {@code libjnitest} for more 22 * details. 23 */ 24 public class StaticFromNative { 25 /** 26 * This class is uninstantiable. 27 */ StaticFromNative()28 private StaticFromNative() { 29 // This space intentionally left blank. 30 } 31 nop()32 public static void nop() { 33 // This space intentionally left blank. 34 } 35 returnBoolean()36 public static boolean returnBoolean() { 37 return true; 38 } 39 returnByte()40 public static byte returnByte() { 41 return (byte) 14; 42 } 43 returnShort()44 public static short returnShort() { 45 return (short) -608; 46 } 47 returnChar()48 public static char returnChar() { 49 return (char) 9000; 50 } 51 returnInt()52 public static int returnInt() { 53 return 4004004; 54 } 55 returnLong()56 public static long returnLong() { 57 return -80080080087L; 58 } 59 returnFloat()60 public static float returnFloat() { 61 return 2.5e22f; 62 } 63 returnDouble()64 public static double returnDouble() { 65 return 7.503e100; 66 } 67 returnString()68 public static String returnString() { 69 return "muffins"; 70 } 71 takeOneOfEach(double v0, float v1, long v2, int v3, char v4, short v5, byte v6, boolean v7, String v8)72 public static boolean takeOneOfEach(double v0, float v1, long v2, int v3, 73 char v4, short v5, byte v6, boolean v7, String v8) { 74 return (v0 == 0.0) && (v1 == 1.0f) && (v2 == 2L) && (v3 == 3) 75 && (v4 == 4) && (v5 == 5) && (v6 == 6) && v7 && 76 v8.equals("biscuits"); 77 } 78 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)79 public static boolean takeCoolHandLuke( 80 int v1, int v2, int v3, int v4, 81 int v5, int v6, int v7, int v8, int v9, 82 int v10, int v11, int v12, int v13, int v14, 83 int v15, int v16, int v17, int v18, int v19, 84 int v20, int v21, int v22, int v23, int v24, 85 int v25, int v26, int v27, int v28, int v29, 86 int v30, int v31, int v32, int v33, int v34, 87 int v35, int v36, int v37, int v38, int v39, 88 int v40, int v41, int v42, int v43, int v44, 89 int v45, int v46, int v47, int v48, int v49, 90 int v50) { 91 return (v1 == 1) && (v2 == 2) && (v3 == 3) && 92 (v4 == 4) && (v5 == 5) && (v6 == 6) && (v7 == 7) && 93 (v8 == 8) && (v9 == 9) && 94 (v10 == 10) && (v11 == 11) && (v12 == 12) && (v13 == 13) && 95 (v14 == 14) && (v15 == 15) && (v16 == 16) && (v17 == 17) && 96 (v18 == 18) && (v19 == 19) && 97 (v20 == 20) && (v21 == 21) && (v22 == 22) && (v23 == 23) && 98 (v24 == 24) && (v25 == 25) && (v26 == 26) && (v27 == 27) && 99 (v28 == 28) && (v29 == 29) && 100 (v30 == 30) && (v31 == 31) && (v32 == 32) && (v33 == 33) && 101 (v34 == 34) && (v35 == 35) && (v36 == 36) && (v37 == 37) && 102 (v38 == 38) && (v39 == 39) && 103 (v40 == 40) && (v41 == 41) && (v42 == 42) && (v43 == 43) && 104 (v44 == 44) && (v45 == 45) && (v46 == 46) && (v47 == 47) && 105 (v48 == 48) && (v49 == 49) && 106 (v50 == 50); 107 } 108 } 109