diff options
| author | 2017-12-08 20:22:03 +0000 | |
|---|---|---|
| committer | 2017-12-08 20:22:03 +0000 | |
| commit | 1a8fb13d2ece9cfcc348559f6e80dca2200ecee1 (patch) | |
| tree | 0347796fdbf6d06974fe568876d86386e0d605f5 | |
| parent | f189fbc969579c71bd192f00c67ca704e9d4a9f4 (diff) | |
| parent | e7120f505651500098eae89b5816b724106c248d (diff) | |
Merge "Remove empty ScopedArray constructor."
am: e7120f5056
Change-Id: I451928750550a4b29c6637bb351e5d18f16d04d2
| -rw-r--r-- | core/jni/eventlog_helper.h | 6 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_GraphicsStatsService.cpp | 14 |
2 files changed, 7 insertions, 13 deletions
diff --git a/core/jni/eventlog_helper.h b/core/jni/eventlog_helper.h index 3a05195ebc9e..19628e5a4b56 100644 --- a/core/jni/eventlog_helper.h +++ b/core/jni/eventlog_helper.h @@ -155,11 +155,6 @@ public: return; } - ScopedIntArrayRO tags(env); - if (jTags != nullptr) { - tags.reset(jTags); - } - while (1) { log_msg log_msg; int ret = android_logger_list_read(logger_list.get(), &log_msg); @@ -187,6 +182,7 @@ public: if (jTags != nullptr) { bool found = false; + ScopedIntArrayRO tags(env, jTags); for (size_t i = 0; !found && i < tags.size(); ++i) { found = (tag == tags[i]); } diff --git a/services/core/jni/com_android_server_GraphicsStatsService.cpp b/services/core/jni/com_android_server_GraphicsStatsService.cpp index 8385020844bb..44e27a526183 100644 --- a/services/core/jni/com_android_server_GraphicsStatsService.cpp +++ b/services/core/jni/com_android_server_GraphicsStatsService.cpp @@ -41,14 +41,11 @@ static jlong createDump(JNIEnv*, jobject, jint fd, jboolean isProto) { static void addToDump(JNIEnv* env, jobject, jlong dumpPtr, jstring jpath, jstring jpackage, jint versionCode, jlong startTime, jlong endTime, jbyteArray jdata) { std::string path; - const ProfileData* data = nullptr; LOG_ALWAYS_FATAL_IF(jdata == nullptr && jpath == nullptr, "Path and data can't both be null"); - ScopedByteArrayRO buffer{env}; - if (jdata != nullptr) { - buffer.reset(jdata); + ScopedNullableByteArrayRO buffer(env, jdata); + if (buffer.size() != -1) { LOG_ALWAYS_FATAL_IF(buffer.size() != sizeof(ProfileData), - "Buffer size %zu doesn't match expected %zu!", buffer.size(), sizeof(ProfileData)); - data = reinterpret_cast<const ProfileData*>(buffer.get()); + "Buffer size %zd doesn't match expected %zu!", buffer.size(), sizeof(ProfileData)); } if (jpath != nullptr) { ScopedUtfChars pathChars(env, jpath); @@ -61,7 +58,8 @@ static void addToDump(JNIEnv* env, jobject, jlong dumpPtr, jstring jpath, jstrin LOG_ALWAYS_FATAL_IF(!dump, "null passed for dump pointer"); const std::string package(packageChars.c_str(), packageChars.size()); - GraphicsStatsService::addToDump(dump, path, package, versionCode, startTime, endTime, data); + GraphicsStatsService::addToDump(dump, path, package, versionCode, startTime, endTime, + reinterpret_cast<const ProfileData*>(buffer.get())); } static void addFileToDump(JNIEnv* env, jobject, jlong dumpPtr, jstring jpath) { @@ -108,4 +106,4 @@ int register_android_server_GraphicsStatsService(JNIEnv* env) sMethods, NELEM(sMethods)); } -} // namespace android
\ No newline at end of file +} // namespace android |