summaryrefslogtreecommitdiff
path: root/runtime/native/dalvik_system_DexFile.cc
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-12-03 08:32:55 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-12-03 08:32:55 +0000
commitc90dfb6d83f6b51da9d5f2e7816d5d2de1ce3ecc (patch)
treeae55d22c73af57ff516bec440ce9a28a3320b7eb /runtime/native/dalvik_system_DexFile.cc
parent2ff6bd7ad049e2003342aaf60898fdfc68130908 (diff)
parentf630f1f7781529cc2dd1151faf7523a53d45d6e2 (diff)
Snap for 4481641 from f630f1f7781529cc2dd1151faf7523a53d45d6e2 to pi-release
Change-Id: Ib4edfa41e843d78fecf3371fb671479342411aa5
Diffstat (limited to 'runtime/native/dalvik_system_DexFile.cc')
-rw-r--r--runtime/native/dalvik_system_DexFile.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 22355638cdb..c0de3749040 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -744,6 +744,23 @@ static jobjectArray DexFile_getDexFileOutputPaths(JNIEnv* env,
return result;
}
+static jlong DexFile_getStaticSizeOfDexFile(JNIEnv* env, jclass, jobject cookie) {
+ const OatFile* oat_file = nullptr;
+ std::vector<const DexFile*> dex_files;
+ if (!ConvertJavaArrayToDexFiles(env, cookie, /*out */ dex_files, /* out */ oat_file)) {
+ DCHECK(env->ExceptionCheck());
+ return 0;
+ }
+
+ uint64_t file_size = 0;
+ for (auto& dex_file : dex_files) {
+ if (dex_file) {
+ file_size += dex_file->GetHeader().file_size_;
+ }
+ }
+ return static_cast<jlong>(file_size);
+}
+
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(DexFile, closeDexFile, "(Ljava/lang/Object;)Z"),
NATIVE_METHOD(DexFile,
@@ -779,7 +796,8 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(DexFile, getDexFileStatus,
"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(DexFile, getDexFileOutputPaths,
- "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;")
+ "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;"),
+ NATIVE_METHOD(DexFile, getStaticSizeOfDexFile, "(Ljava/lang/Object;)J")
};
void register_dalvik_system_DexFile(JNIEnv* env) {