Merge "Fix dumpstate_test test config"
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc
index 032d072..f1426b6 100644
--- a/cmds/atrace/atrace.rc
+++ b/cmds/atrace/atrace.rc
@@ -47,6 +47,8 @@
chmod 0666 /sys/kernel/tracing/events/power/clock_set_rate/enable
chmod 0666 /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable
chmod 0666 /sys/kernel/tracing/events/power/cpu_frequency_limits/enable
+ chmod 0666 /sys/kernel/debug/tracing/events/power/gpu_frequency/enable
+ chmod 0666 /sys/kernel/tracing/events/power/gpu_frequency/enable
chmod 0666 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
chmod 0666 /sys/kernel/tracing/events/cpufreq_interactive/enable
chmod 0666 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable
diff --git a/cmds/dumpstate/Android.bp b/cmds/dumpstate/Android.bp
index ffad3b1..4020480 100644
--- a/cmds/dumpstate/Android.bp
+++ b/cmds/dumpstate/Android.bp
@@ -123,7 +123,6 @@
"lsmod",
"lsof",
"netstat",
- "parse_radio_log",
"printenv",
"procrank",
"screencap",
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 6e99f1d..1fc8107 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1285,8 +1285,6 @@
RunCommand("FILESYSTEMS & FREE SPACE", {"df"});
- RunCommand("LAST RADIO LOG", {"parse_radio_log", "/proc/last_radio_log"});
-
/* Binder state is expensive to look at as it uses a lot of memory. */
DumpFile("BINDER FAILED TRANSACTION LOG", "/sys/kernel/debug/binder/failed_transaction_log");
DumpFile("BINDER TRANSACTION LOG", "/sys/kernel/debug/binder/transaction_log");
@@ -2257,7 +2255,6 @@
}
}
- // TODO: use helper function to convert argv into a string
for (int i = 0; i < argc; i++) {
args += argv[i];
if (i < argc - 1) {
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index d02ec75..ae6a721 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -441,8 +441,7 @@
// Full path of the bugreport file, be it zip or text, inside bugreport_internal_dir_.
std::string path_;
- // TODO: If temporary this should be removed at the end.
- // Full path of the temporary file containing the screenshot (when requested).
+ // Full path of the file containing the screenshot (when requested).
std::string screenshot_path_;
// Pointer to the zipped file.
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 0bb80dc..4cbf577 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -733,6 +733,11 @@
struct sockaddr addr;
socklen_t alen = sizeof(addr);
int fd = accept(s, &addr, &alen);
+
+ // Close socket just after accept(), to make sure that connect() by client will get error
+ // when the socket is used by the other services.
+ close(s);
+
if (fd < 0) {
MYLOGE("accept(control socket): %s\n", strerror(errno));
return -1;
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index ae4ea78..47fdcc4 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2055,10 +2055,15 @@
CHECK_ARGUMENT_PATH(dexMetadataPath);
std::lock_guard<std::recursive_mutex> lock(mLock);
+ const char* oat_dir = getCStr(outputPath);
+ const char* instruction_set = instructionSet.c_str();
+ if (oat_dir != nullptr && !createOatDir(oat_dir, instruction_set).isOk()) {
+ // Can't create oat dir - let dexopt use cache dir.
+ oat_dir = nullptr;
+ }
+
const char* apk_path = apkPath.c_str();
const char* pkgname = getCStr(packageName, "*");
- const char* instruction_set = instructionSet.c_str();
- const char* oat_dir = getCStr(outputPath);
const char* compiler_filter = compilerFilter.c_str();
const char* volume_uuid = getCStr(uuid);
const char* class_loader_context = getCStr(classLoaderContext);
diff --git a/cmds/installd/art_helper/Android.bp b/cmds/installd/art_helper/Android.bp
deleted file mode 100644
index c47dd72..0000000
--- a/cmds/installd/art_helper/Android.bp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Inherit image values.
-art_global_defaults {
- name: "libartimagevalues_defaults",
-}
-
-cc_library_static {
- name: "libartimagevalues",
- defaults: ["libartimagevalues_defaults"],
- srcs: ["art_image_values.cpp"],
- export_include_dirs: ["."],
- cflags: ["-Wconversion"],
-}
diff --git a/cmds/installd/art_helper/art_image_values.cpp b/cmds/installd/art_helper/art_image_values.cpp
deleted file mode 100644
index a139049..0000000
--- a/cmds/installd/art_helper/art_image_values.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#include "art_image_values.h"
-
-namespace android {
-namespace installd {
-namespace art {
-
-uint32_t GetImageBaseAddress() {
- return ART_BASE_ADDRESS;
-}
-int32_t GetImageMinBaseAddressDelta() {
- return ART_BASE_ADDRESS_MIN_DELTA;
-}
-int32_t GetImageMaxBaseAddressDelta() {
- return ART_BASE_ADDRESS_MAX_DELTA;
-}
-
-static_assert(ART_BASE_ADDRESS_MIN_DELTA < ART_BASE_ADDRESS_MAX_DELTA, "Inconsistent setup");
-
-} // namespace art
-} // namespace installd
-} // namespace android
diff --git a/cmds/installd/art_helper/art_image_values.h b/cmds/installd/art_helper/art_image_values.h
deleted file mode 100644
index 20c44c9..0000000
--- a/cmds/installd/art_helper/art_image_values.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#ifndef FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
-#define FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
-
-#include <cstdint>
-
-namespace android {
-namespace installd {
-namespace art {
-
-uint32_t GetImageBaseAddress();
-int32_t GetImageMinBaseAddressDelta();
-int32_t GetImageMaxBaseAddressDelta();
-
-} // namespace art
-} // namespace installd
-} // namespace android
-
-#endif // FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index de7b249..db36ce3 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -445,9 +445,11 @@
}
cmd.push_back(StringPrintf("--oat-file=%s", oat_path.c_str()));
- int32_t base_offset = ChooseRelocationOffsetDelta(art::GetImageMinBaseAddressDelta(),
- art::GetImageMaxBaseAddressDelta());
- cmd.push_back(StringPrintf("--base=0x%x", art::GetImageBaseAddress() + base_offset));
+ int32_t base_offset = ChooseRelocationOffsetDelta(
+ art::imagevalues::GetImageMinBaseAddressDelta(),
+ art::imagevalues::GetImageMaxBaseAddressDelta());
+ cmd.push_back(StringPrintf("--base=0x%x",
+ art::imagevalues::GetImageBaseAddress() + base_offset));
cmd.push_back(StringPrintf("--instruction-set=%s", isa));
@@ -464,7 +466,7 @@
"--compiler-filter=",
false,
cmd);
- cmd.push_back("--image-classes=/system/etc/preloaded-classes");
+ cmd.push_back("--profile-file=/system/etc/boot-image.prof");
// TODO: Compiled-classes.
const std::string* extra_opts =
system_properties_.GetProperty("dalvik.vm.image-dex2oat-flags");
diff --git a/cmds/installd/tests/installd_dexopt_test.cpp b/cmds/installd/tests/installd_dexopt_test.cpp
index 13fd067..73780ec 100644
--- a/cmds/installd/tests/installd_dexopt_test.cpp
+++ b/cmds/installd/tests/installd_dexopt_test.cpp
@@ -241,18 +241,14 @@
}
::testing::AssertionResult create_mock_app() {
- // Create the oat dir.
- app_oat_dir_ = app_apk_dir_ + "/oat";
// For debug mode, the directory might already exist. Avoid erroring out.
if (mkdir(app_apk_dir_, kSystemUid, kSystemGid, 0755) != 0 && !kDebug) {
return ::testing::AssertionFailure() << "Could not create app dir " << app_apk_dir_
<< " : " << strerror(errno);
}
- binder::Status status = service_->createOatDir(app_oat_dir_, kRuntimeIsa);
- if (!status.isOk()) {
- return ::testing::AssertionFailure() << "Could not create oat dir: "
- << status.toString8().c_str();
- }
+
+ // Initialize the oat dir path.
+ app_oat_dir_ = app_apk_dir_ + "/oat";
// Copy the primary apk.
apk_path_ = app_apk_dir_ + "/base.jar";
@@ -283,7 +279,7 @@
}
// Create the app user data.
- status = service_->createAppData(
+ binder::Status status = service_->createAppData(
volume_uuid_,
package_name_,
kTestUserId,
@@ -647,6 +643,16 @@
DEX2OAT_FROM_SCRATCH);
}
+TEST_F(DexoptTest, DexoptPrimaryPublicCreateOatDir) {
+ LOG(INFO) << "DexoptPrimaryPublic";
+ ASSERT_BINDER_SUCCESS(service_->createOatDir(app_oat_dir_, kRuntimeIsa));
+ CompilePrimaryDexOk("verify",
+ DEXOPT_BOOTCOMPLETE | DEXOPT_PUBLIC,
+ app_oat_dir_.c_str(),
+ kTestAppGid,
+ DEX2OAT_FROM_SCRATCH);
+}
+
TEST_F(DexoptTest, DexoptPrimaryFailedInvalidFilter) {
LOG(INFO) << "DexoptPrimaryFailedInvalidFilter";
binder::Status status;