Merge "Remove unnecessary calls to JNIEnv::GetArrayLength" am: da21df3a17 am: fffec9a0e0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1584521
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I7213469d10ff16139055498e7229c7019fa38d7c
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index b5373f7..c4caef2 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -520,14 +520,15 @@
}
if (outUssSwapPssRss != NULL) {
- if (env->GetArrayLength(outUssSwapPssRss) >= 1) {
+ int outLen = env->GetArrayLength(outUssSwapPssRss);
+ if (outLen >= 1) {
jlong* outUssSwapPssRssArray = env->GetLongArrayElements(outUssSwapPssRss, 0);
if (outUssSwapPssRssArray != NULL) {
outUssSwapPssRssArray[0] = uss;
- if (env->GetArrayLength(outUssSwapPssRss) >= 2) {
+ if (outLen >= 2) {
outUssSwapPssRssArray[1] = swapPss;
}
- if (env->GetArrayLength(outUssSwapPssRss) >= 3) {
+ if (outLen >= 3) {
outUssSwapPssRssArray[2] = rss;
}
}
@@ -536,17 +537,18 @@
}
if (outMemtrack != NULL) {
- if (env->GetArrayLength(outMemtrack) >= 1) {
+ int outLen = env->GetArrayLength(outMemtrack);
+ if (outLen >= 1) {
jlong* outMemtrackArray = env->GetLongArrayElements(outMemtrack, 0);
if (outMemtrackArray != NULL) {
outMemtrackArray[0] = memtrack;
- if (env->GetArrayLength(outMemtrack) >= 2) {
+ if (outLen >= 2) {
outMemtrackArray[1] = graphics_mem.graphics;
}
- if (env->GetArrayLength(outMemtrack) >= 3) {
+ if (outLen >= 3) {
outMemtrackArray[2] = graphics_mem.gl;
}
- if (env->GetArrayLength(outMemtrack) >= 4) {
+ if (outLen >= 4) {
outMemtrackArray[3] = graphics_mem.other;
}
}