Merge "Adds static methods HwBlob.WrapArray(<scalar-type>[] scalarArray)"

am: 90acbd86ac

Change-Id: Ia3013237296ccca46e3f4e0bc702b4ae90a7ea3a
This commit is contained in:
Andreas Huber
2016-09-28 17:30:23 +00:00
committed by android-build-merger

View File

@@ -16,6 +16,8 @@
package android.os;
import android.annotation.NonNull;
import libcore.util.NativeAllocationRegistry;
/** @hide */
@@ -54,6 +56,69 @@ public class HwBlob {
public native final long handle();
public static Boolean[] wrapArray(@NonNull boolean[] array) {
final int n = array.length;
Boolean[] wrappedArray = new Boolean[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Long[] wrapArray(@NonNull long[] array) {
final int n = array.length;
Long[] wrappedArray = new Long[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Byte[] wrapArray(@NonNull byte[] array) {
final int n = array.length;
Byte[] wrappedArray = new Byte[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Short[] wrapArray(@NonNull short[] array) {
final int n = array.length;
Short[] wrappedArray = new Short[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Integer[] wrapArray(@NonNull int[] array) {
final int n = array.length;
Integer[] wrappedArray = new Integer[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Float[] wrapArray(@NonNull float[] array) {
final int n = array.length;
Float[] wrappedArray = new Float[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
public static Double[] wrapArray(@NonNull double[] array) {
final int n = array.length;
Double[] wrappedArray = new Double[n];
for (int i = 0; i < n; ++i) {
wrappedArray[i] = array[i];
}
return wrappedArray;
}
// Returns address of the "freeFunction".
private static native final long native_init();