summaryrefslogtreecommitdiff
path: root/luni
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 /luni
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
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/java/nio/NIOAccess.java10
1 files changed, 7 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;
}
}