summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-09-28 17:16:52 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-09-28 17:16:52 +0000
commit90acbd86ac2e59756ba67eaef3a61877e2a2af08 (patch)
tree0cb01cb8ac7ca21998a950a54bed554f5b7dd6f2
parentfaf945a773d2b62a932e3f59a4de92ef604f2359 (diff)
parent906a679aa869c892081c79d4b5d393e408368be0 (diff)
Merge "Adds static methods HwBlob.WrapArray(<scalar-type>[] scalarArray)"
-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();