Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58e641b8 authored by Shai Barack's avatar Shai Barack
Browse files

Use @CriticalNative annotation on Process.getElapsedCpuTime()

This method runs in bounded time and doesn't need a JNI Env,
so it's safe to annotate it as such.

Bug: 374158990
Flag: EXEMPT annotation change can't be flagged
Test: presubmit

Change-Id: I903d71727f291f3f6b45d56d04f81373351836f2
parent 9a1f0592
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.webkit.WebViewZygote;

import com.android.sdksandbox.flags.Flags;

import dalvik.annotation.optimization.CriticalNative;
import dalvik.system.VMDebug;
import dalvik.system.VMRuntime;

@@ -790,6 +791,7 @@ public class Process {
     * Returns elapsed milliseconds of the time this process has run.
     * @return  Returns the number of milliseconds this process has return.
     */
    @CriticalNative
    public static final native long getElapsedCpuTime();

    /**
+1 −1
Original line number Diff line number Diff line
@@ -1200,7 +1200,7 @@ void android_os_Process_sendTgSignalThrows(JNIEnv* env, jobject clazz, jint tgid
    }
}

static jlong android_os_Process_getElapsedCpuTime(JNIEnv* env, jobject clazz)
static jlong android_os_Process_getElapsedCpuTime(CRITICAL_JNI_PARAMS)
{
    struct timespec ts;