Merge "simpleperf: enable two options by default." am: 7386d10cce am: 848d294253 am: d2f70f60c5
am: 753e534226

Change-Id: I2ab4432bf6bccf0f73b03ba3e1e3ca1cab0fd973
diff --git a/cppreopts/cppreopts.sh b/cppreopts/cppreopts.sh
index 9f21ac7..76f25d1 100644
--- a/cppreopts/cppreopts.sh
+++ b/cppreopts/cppreopts.sh
@@ -50,7 +50,7 @@
   # For each odex and vdex file do the copy task
   # NOTE: this implementation will break in any path with spaces to favor
   # background copy tasks
-  for file in $(find ${mountpoint} -type f -name "*.odex" -o -type f -name "*.vdex"); do
+  for file in $(find ${mountpoint} -type f -name "*.odex" -o -type f -name "*.vdex" -o -type f -name "*.art"); do
     real_name=${file/${mountpoint}/\/system}
     dest_name=$(preopt2cachename ${real_name})
     if ! test $? -eq 0 ; then
diff --git a/preopt2cachename/preopt2cachename.cpp b/preopt2cachename/preopt2cachename.cpp
index f9a12ff..3fb887b 100644
--- a/preopt2cachename/preopt2cachename.cpp
+++ b/preopt2cachename/preopt2cachename.cpp
@@ -26,6 +26,7 @@
 static const char* kDalvikCacheDir = "/data/dalvik-cache/";
 static const char* kOdexCacheSuffix = "@classes.dex";
 static const char* kVdexCacheSuffix = "@classes.vdex";
+static const char* kArtCacheSuffix = "@classes.art";
 
 // Returns the ISA extracted from the file_location.
 // file_location is formatted like /system/app/<app_name>/oat/<isa>/<app_name>.{odex,vdex}
@@ -88,10 +89,17 @@
     LOG(ERROR) << "Unable to determine apk name from file name '" << file_location << "'";
     return false;
   }
+  std::string::size_type pos = file_location.find_last_of(".");
+  if (pos == std::string::npos) {
+    LOG(ERROR) << "Invalid file location '" << file_location << "'";
+    return false;
+  }
   cache_file += apk_name;
-  if (file_location.size() >= 5 &&
-      file_location.substr(file_location.size() - 5) == std::string(".vdex")) {
+  std::string extension(file_location.substr(pos));
+  if (extension == ".vdex") {
     cache_file += kVdexCacheSuffix;
+  } else if (extension == ".art") {
+    cache_file += kArtCacheSuffix;
   } else {
     cache_file += kOdexCacheSuffix;
   }
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..1e0d8c8
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,3 @@
+subdirs = [
+    "lib",
+]
diff --git a/tests/lib/Android.bp b/tests/lib/Android.bp
new file mode 100644
index 0000000..7a8ee5d
--- /dev/null
+++ b/tests/lib/Android.bp
@@ -0,0 +1 @@
+subdirs = [ "*" ]
diff --git a/tests/lib/Android.mk b/tests/lib/Android.mk
deleted file mode 100644
index db16ed2..0000000
--- a/tests/lib/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(call all-subdir-makefiles)
diff --git a/tests/lib/testUtil/Android.bp b/tests/lib/testUtil/Android.bp
new file mode 100644
index 0000000..35678d4
--- /dev/null
+++ b/tests/lib/testUtil/Android.bp
@@ -0,0 +1,25 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+    name: "libtestUtil",
+    srcs: ["testUtil.c"],
+    export_include_dirs: ["include"],
+    shared_libs: [
+        "libcutils",
+        "libutils",
+    ],
+}
diff --git a/tests/lib/testUtil/Android.mk b/tests/lib/testUtil/Android.mk
deleted file mode 100644
index c5ae26d..0000000
--- a/tests/lib/testUtil/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE:= libtestUtil
-LOCAL_SRC_FILES:= testUtil.c
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include
-LOCAL_SHARED_LIBRARIES += libcutils libutils
-
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/include/testUtil.h b/tests/lib/testUtil/include/testUtil.h
similarity index 100%
rename from tests/include/testUtil.h
rename to tests/lib/testUtil/include/testUtil.h