summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2020-02-24 10:58:20 +0000
committerOrion Hodson <oth@google.com>2020-03-03 20:42:33 +0000
commit7874371ffd74fc16c730dcebc9301f4c7e9bc48e (patch)
tree1fd88e4b1c857d9a552b2890d0416174bfc3086a
parentf285371e04b5b1c85bef00e64cffd4fb855601ab (diff)
Add methods in NIOAccess to Core Platform API
These are used in frameworks, particularly in generated OpenGL JNI code. (cherry picked from commit 6cb0ae710a03f94b023ce4054c63d6eb612c7e33) Bug: 144502743 Test: boot device, grep for "Core platform.*NIOAccess" Change-Id: I854de6be3b1d9841d961bc116e459f2c9e9154b8
-rw-r--r--luni/src/main/java/java/nio/NIOAccess.java10
-rw-r--r--mmodules/core_platform_api/api/platform/current-api.txt5
2 files changed, 12 insertions, 3 deletions
diff --git a/luni/src/main/java/java/nio/NIOAccess.java b/luni/src/main/java/java/nio/NIOAccess.java
index 81b205d3fb..734537980f 100644
--- a/luni/src/main/java/java/nio/NIOAccess.java
+++ b/luni/src/main/java/java/nio/NIOAccess.java
@@ -19,10 +19,12 @@ package java.nio;
import android.compat.annotation.UnsupportedAppUsage;
/**
- * This class is used via JNI by code in frameworks/base/.
+ * This class is used via JNI by code in frameworks/base/ and
+ * by the JniConstants cache in libnativehelper/.
* @hide
*/
// @VisibleForTesting : was default
+@libcore.api.CorePlatformApi
public final class NIOAccess {
/**
@@ -46,7 +48,8 @@ public final class NIOAccess {
* given Buffer, or null if the Buffer is not backed by a Java array.
*/
@UnsupportedAppUsage
- static Object getBaseArray(Buffer b) {
+ @libcore.api.CorePlatformApi
+ public static Object getBaseArray(Buffer b) {
return b.hasArray() ? b.array() : null;
}
@@ -58,7 +61,8 @@ public final class NIOAccess {
* meaningful if getBaseArray() returns non-null.
*/
@UnsupportedAppUsage
- static int getBaseArrayOffset(Buffer b) {
+ @libcore.api.CorePlatformApi
+ public static int getBaseArrayOffset(Buffer b) {
return b.hasArray() ? ((b.arrayOffset() + b.position) << b._elementSizeShift) : 0;
}
}
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index 1ca16bc169..2b3e77d346 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -850,6 +850,11 @@ package java.nio {
method public final void setAccessible(boolean);
}
+ public final class NIOAccess {
+ method public static Object getBaseArray(java.nio.Buffer);
+ method public static int getBaseArrayOffset(java.nio.Buffer);
+ }
+
public final class NioUtils {
method public static void freeDirectBuffer(java.nio.ByteBuffer);
method public static byte[] unsafeArray(java.nio.ByteBuffer);