summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2016-09-28 17:30:23 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-09-28 17:30:23 +0000
commit2849ee8b75cfdb7510d2ad9e2cca9433291b2cb2 (patch)
tree3eed42aa3764f0653e7045c39dc820852ccecb43 /core/java
parent73f2e9b81216b86c612860c387789baed8586381 (diff)
parent90acbd86ac2e59756ba67eaef3a61877e2a2af08 (diff)
Merge "Adds static methods HwBlob.WrapArray(<scalar-type>[] scalarArray)"
am: 90acbd86ac Change-Id: Ia3013237296ccca46e3f4e0bc702b4ae90a7ea3a
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/HwBlob.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/core/java/android/os/HwBlob.java b/core/java/android/os/HwBlob.java
index 153c6e634ecb..88226f0a1665 100644
--- a/core/java/android/os/HwBlob.java
+++ b/core/java/android/os/HwBlob.java
@@ -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();