summaryrefslogtreecommitdiff
path: root/libart
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2018-10-17 11:41:22 +0100
committerPaul Duffin <paulduffin@google.com>2018-10-18 16:00:16 +0100
commit3b0456bb88b60244366609bf2921a050274e3e87 (patch)
tree9904a43eda8e5bedda120d41232ad91ec8b160d5 /libart
parent4575d7ef920b231d7790823ed154fc27e7020586 (diff)
Add @UnsupportedAppUsage to non-ojluni classes
Test: ensured that generated light grey list did not change Bug: 117818301 Merged-In: Ifcdd4c815a2d8fc438290a5b3b9db669f5035145 Change-Id: I6bd92384b4c81d425961d0f9ef4b681271e36125
Diffstat (limited to 'libart')
-rw-r--r--libart/src/main/java/dalvik/system/VMRuntime.java23
-rw-r--r--libart/src/main/java/dalvik/system/VMStack.java5
-rw-r--r--libart/src/main/java/java/lang/Daemons.java13
3 files changed, 41 insertions, 0 deletions
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java
index 602d0f5a72..cd061b9e2c 100644
--- a/libart/src/main/java/dalvik/system/VMRuntime.java
+++ b/libart/src/main/java/dalvik/system/VMRuntime.java
@@ -16,6 +16,7 @@
package dalvik.system;
+import dalvik.annotation.compat.UnsupportedAppUsage;
import dalvik.annotation.optimization.FastNative;
import java.lang.ref.FinalizerReference;
import java.util.HashMap;
@@ -78,6 +79,7 @@ public final class VMRuntime {
*
* @return the runtime object
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public static VMRuntime getRuntime() {
return THE_ONE;
@@ -107,18 +109,21 @@ public final class VMRuntime {
/**
* Returns the name of the shared library providing the VM implementation.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public native String vmLibrary();
/**
* Returns the VM's instruction set.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public native String vmInstructionSet();
/**
* Returns whether the VM is running in 64-bit mode.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
@FastNative
public native boolean is64Bit();
@@ -154,6 +159,7 @@ public final class VMRuntime {
* @return the previous ideal heap utilization
* @throws IllegalArgumentException if newTarget is &lt;= 0.0 or &gt;= 1.0
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public float setTargetHeapUtilization(float newTarget) {
if (newTarget <= 0.0f || newTarget >= 1.0f) {
@@ -176,6 +182,7 @@ public final class VMRuntime {
* app starts to run, because it may change the VM's behavior in
* dangerous ways. Defaults to {@link #SDK_VERSION_CUR_DEVELOPMENT}.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public synchronized void setTargetSdkVersion(int targetSdkVersion) {
this.targetSdkVersion = targetSdkVersion;
@@ -197,6 +204,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It was part of a
* heap sizing API which was removed in Android 3.0 (Honeycomb).
*/
+ @UnsupportedAppUsage
@Deprecated
public long getMinimumHeapSize() {
return 0;
@@ -206,6 +214,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It was part of a
* heap sizing API which was removed in Android 3.0 (Honeycomb).
*/
+ @UnsupportedAppUsage
@Deprecated
public long setMinimumHeapSize(long size) {
return 0;
@@ -215,6 +224,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It used to
* perform a garbage collection that cleared SoftReferences.
*/
+ @UnsupportedAppUsage
@Deprecated
public void gcSoftReferences() {}
@@ -222,6 +232,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It is equivalent
* to {@link System#runFinalization}.
*/
+ @UnsupportedAppUsage
@Deprecated
public void runFinalizationSync() {
System.runFinalization();
@@ -239,6 +250,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It was part of
* the external allocation API which was removed in Android 3.0 (Honeycomb).
*/
+ @UnsupportedAppUsage
@Deprecated
public boolean trackExternalAllocation(long size) {
return true;
@@ -248,6 +260,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It was part of
* the external allocation API which was removed in Android 3.0 (Honeycomb).
*/
+ @UnsupportedAppUsage
@Deprecated
public void trackExternalFree(long size) {}
@@ -255,6 +268,7 @@ public final class VMRuntime {
* This method exists for binary compatibility. It was part of
* the external allocation API which was removed in Android 3.0 (Honeycomb).
*/
+ @UnsupportedAppUsage
@Deprecated
public long getExternalBytesAllocated() {
return 0;
@@ -306,6 +320,7 @@ public final class VMRuntime {
* This is used to implement native allocations on the Java heap, such as DirectByteBuffers
* and Bitmaps.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
@FastNative
public native Object newNonMovableArray(Class<?> componentType, int length);
@@ -323,6 +338,7 @@ public final class VMRuntime {
* Returns the address of array[0]. This differs from using JNI in that JNI might lie and
* give you the address of a copy of the array when in forcecopy mode.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
@FastNative
public native long addressOf(Object array);
@@ -331,6 +347,7 @@ public final class VMRuntime {
* Removes any growth limits, allowing the application to allocate
* up to the maximum heap size.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public native void clearGrowthLimit();
@@ -367,12 +384,14 @@ public final class VMRuntime {
* unusually high rate and a GC is performed inside of the function to prevent memory usage
* from excessively increasing.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public native void registerNativeAllocation(int bytes);
/**
* Registers a native free by reducing the number of native bytes accounted for.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public native void registerNativeFree(int bytes);
@@ -390,6 +409,7 @@ public final class VMRuntime {
* @see #Runtime.runFinalization()
* @see #wait(long,int)
*/
+ @UnsupportedAppUsage
public static void runFinalization(long timeout) {
try {
FinalizerReference.finalizeAllEnqueued(timeout);
@@ -438,6 +458,7 @@ public final class VMRuntime {
*
* This influences the compilation of the applications classes.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public static String getInstructionSet(String abi) {
final String instructionSet = ABI_TO_INSTRUCTION_SET_MAP.get(abi);
@@ -455,6 +476,7 @@ public final class VMRuntime {
"mips64".equals(instructionSet);
}
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public static boolean is64BitAbi(String abi) {
return is64BitInstructionSet(getInstructionSet(abi));
@@ -481,6 +503,7 @@ public final class VMRuntime {
/**
* Returns the instruction set of the current runtime.
*/
+ @UnsupportedAppUsage
@libcore.api.CorePlatformApi
public static native String getCurrentInstructionSet();
diff --git a/libart/src/main/java/dalvik/system/VMStack.java b/libart/src/main/java/dalvik/system/VMStack.java
index 45c664834a..a76ce09f39 100644
--- a/libart/src/main/java/dalvik/system/VMStack.java
+++ b/libart/src/main/java/dalvik/system/VMStack.java
@@ -16,6 +16,7 @@
package dalvik.system;
+import dalvik.annotation.compat.UnsupportedAppUsage;
import dalvik.annotation.optimization.FastNative;
/**
@@ -35,6 +36,7 @@ public final class VMStack {
* Note that that can return {@link BootClassLoader} on Android where the RI
* would have returned null.
*/
+ @UnsupportedAppUsage
@FastNative
@Deprecated
native public static ClassLoader getCallingClassLoader();
@@ -55,6 +57,7 @@ public final class VMStack {
*
* @return the requested class, or {@code null}.
*/
+ @UnsupportedAppUsage
@FastNative
native public static Class<?> getStackClass2();
@@ -73,6 +76,7 @@ public final class VMStack {
* @return an array of stack trace elements, or null if the thread
* doesn't have a stack trace (e.g. because it exited)
*/
+ @UnsupportedAppUsage
@FastNative
native public static StackTraceElement[] getThreadStackTrace(Thread t);
@@ -100,6 +104,7 @@ public final class VMStack {
* desired. Unused elements will be filled with null values.
* @return the number of elements filled
*/
+ @UnsupportedAppUsage
@FastNative
native public static int fillStackTraceElements(Thread t,
StackTraceElement[] stackTraceElements);
diff --git a/libart/src/main/java/java/lang/Daemons.java b/libart/src/main/java/java/lang/Daemons.java
index f25c78cf30..a04bee8267 100644
--- a/libart/src/main/java/java/lang/Daemons.java
+++ b/libart/src/main/java/java/lang/Daemons.java
@@ -18,6 +18,7 @@ package java.lang;
import android.system.Os;
import android.system.OsConstants;
+import dalvik.annotation.compat.UnsupportedAppUsage;
import dalvik.system.VMRuntime;
import java.lang.ref.FinalizerReference;
import java.lang.ref.Reference;
@@ -37,8 +38,10 @@ import libcore.util.EmptyArray;
public final class Daemons {
private static final int NANOS_PER_MILLI = 1000 * 1000;
private static final int NANOS_PER_SECOND = NANOS_PER_MILLI * 1000;
+ @UnsupportedAppUsage
private static final long MAX_FINALIZE_NANOS = 10L * NANOS_PER_SECOND;
+ @UnsupportedAppUsage
public static void start() {
ReferenceQueueDaemon.INSTANCE.start();
FinalizerDaemon.INSTANCE.start();
@@ -53,6 +56,7 @@ public final class Daemons {
HeapTaskDaemon.INSTANCE.startPostZygoteFork();
}
+ @UnsupportedAppUsage
public static void stop() {
HeapTaskDaemon.INSTANCE.stop();
ReferenceQueueDaemon.INSTANCE.stop();
@@ -66,6 +70,7 @@ public final class Daemons {
* single-threaded process when it forks.
*/
private static abstract class Daemon implements Runnable {
+ @UnsupportedAppUsage
private Thread thread;
private String name;
private boolean postZygoteFork;
@@ -74,6 +79,7 @@ public final class Daemons {
this.name = name;
}
+ @UnsupportedAppUsage
public synchronized void start() {
startInternal();
}
@@ -109,6 +115,7 @@ public final class Daemons {
* Returns true while the current thread should continue to run; false
* when it should return.
*/
+ @UnsupportedAppUsage
protected synchronized boolean isRunning() {
return thread != null;
}
@@ -128,6 +135,7 @@ public final class Daemons {
* Waits for the runtime thread to stop. This interrupts the thread
* currently running the runnable and then waits for it to exit.
*/
+ @UnsupportedAppUsage
public void stop() {
Thread threadToStop;
synchronized (this) {
@@ -163,6 +171,7 @@ public final class Daemons {
* pending list to the managed reference queue.
*/
private static class ReferenceQueueDaemon extends Daemon {
+ @UnsupportedAppUsage
private static final ReferenceQueueDaemon INSTANCE = new ReferenceQueueDaemon();
ReferenceQueueDaemon() {
@@ -191,10 +200,12 @@ public final class Daemons {
}
private static class FinalizerDaemon extends Daemon {
+ @UnsupportedAppUsage
private static final FinalizerDaemon INSTANCE = new FinalizerDaemon();
private final ReferenceQueue<Object> queue = FinalizerReference.queue;
private final AtomicInteger progressCounter = new AtomicInteger(0);
// Object (not reference!) being finalized. Accesses may race!
+ @UnsupportedAppUsage
private Object finalizingObject = null;
FinalizerDaemon() {
@@ -264,6 +275,7 @@ public final class Daemons {
* on one instance.
*/
private static class FinalizerWatchdogDaemon extends Daemon {
+ @UnsupportedAppUsage
private static final FinalizerWatchdogDaemon INSTANCE = new FinalizerWatchdogDaemon();
private boolean needToWork = true; // Only accessed in synchronized methods.
@@ -439,6 +451,7 @@ public final class Daemons {
// Adds a heap trim task to the heap event processor, not called from java. Left for
// compatibility purposes due to reflection.
+ @UnsupportedAppUsage
public static void requestHeapTrim() {
VMRuntime.getRuntime().requestHeapTrim();
}