summaryrefslogtreecommitdiff
path: root/cmds
diff options
context:
space:
mode:
author The Android Open Source Project <initial-contribution@android.com> 2021-08-12 12:03:37 -0700
committer Xin Li <delphij@google.com> 2021-08-12 22:41:41 +0000
commit2e1a9d88a58fac889f13b18a9e6c181a8459feab (patch)
treef9ac849149b67c3a82bb1b881f6af42f7fe7fd4f /cmds
parenta8f9cdbc77fee0bd5a1527342af4e2ceb9487b50 (diff)
parent810d19378edc7bbd87d738d96c4bb49ed45b3d0c (diff)
Merge ab/7633965
Bug: 169893837 Merged-In: I2a2d02a0d7e67ee9577857a210cb6157683e5598 Change-Id: Iecdf0a17afe650483461978b42161940ce002101
Diffstat (limited to 'cmds')
-rw-r--r--cmds/atrace/atrace.cpp1
-rw-r--r--cmds/atrace/atrace.rc13
-rw-r--r--cmds/dumpstate/dumpstate.cpp15
-rw-r--r--cmds/installd/InstalldNativeService.cpp3
-rw-r--r--cmds/installd/dexopt.cpp20
-rw-r--r--cmds/installd/run_dex2oat.cpp7
-rw-r--r--cmds/surfacereplayer/proto/src/trace.proto5
7 files changed, 53 insertions, 11 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 79419d3ae6..783a475829 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -126,7 +126,6 @@ static const TracingCategory k_categories[] = {
{ "aidl", "AIDL calls", ATRACE_TAG_AIDL, { } },
{ "nnapi", "NNAPI", ATRACE_TAG_NNAPI, { } },
{ "rro", "Runtime Resource Overlay", ATRACE_TAG_RRO, { } },
- { "sysprop", "System Property", ATRACE_TAG_SYSPROP, { } },
{ k_coreServiceCategory, "Core services", 0, { } },
{ k_pdxServiceCategory, "PDX services", 0, { } },
{ "sched", "CPU Scheduling", 0, {
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc
index 37fc9a9356..e3c4edebbd 100644
--- a/cmds/atrace/atrace.rc
+++ b/cmds/atrace/atrace.rc
@@ -266,7 +266,10 @@ on late-init
chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu15/trace
chmod 0666 /sys/kernel/tracing/per_cpu/cpu15/trace
-on post-fs-data
+# Only create the tracing instance if persist.mm_events.enabled
+# Attempting to remove the tracing instance after it has been created
+# will likely fail with EBUSY as it would be in use by traced_probes.
+on post-fs-data && property:persist.mm_events.enabled=true
# Create MM Events Tracing Instance for Kmem Activity Trigger
mkdir /sys/kernel/debug/tracing/instances/mm_events 0755 system system
mkdir /sys/kernel/tracing/instances/mm_events 0755 system system
@@ -275,10 +278,18 @@ on post-fs-data
chmod 0666 /sys/kernel/debug/tracing/instances/mm_events/buffer_size_kb
chmod 0666 /sys/kernel/tracing/instances/mm_events/buffer_size_kb
+# Set the default buffer size to the minimum
+ write /sys/kernel/debug/tracing/instances/mm_events/buffer_size_kb 1
+ write /sys/kernel/tracing/instances/mm_events/buffer_size_kb 1
+
# Read and enable tracing
chmod 0666 /sys/kernel/debug/tracing/instances/mm_events/tracing_on
chmod 0666 /sys/kernel/tracing/instances/mm_events/tracing_on
+# Tracing disabled by default
+ write /sys/kernel/debug/tracing/instances/mm_events/tracing_on 0
+ write /sys/kernel/tracing/instances/mm_events/tracing_on 0
+
# Read and truncate kernel trace
chmod 0666 /sys/kernel/debug/tracing/instances/mm_events/trace
chmod 0666 /sys/kernel/tracing/instances/mm_events/trace
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 25e6dc95c7..2d11b908c2 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -176,6 +176,7 @@ void add_mountinfo();
#define LINKERCONFIG_DIR "/linkerconfig"
#define PACKAGE_DEX_USE_LIST "/data/system/package-dex-usage.list"
#define SYSTEM_TRACE_SNAPSHOT "/data/misc/perfetto-traces/bugreport/systrace.pftrace"
+#define CGROUPFS_DIR "/sys/fs/cgroup"
// TODO(narayan): Since this information has to be kept in sync
// with tombstoned, we should just put it in a common header.
@@ -1240,8 +1241,15 @@ static Dumpstate::RunStatus RunDumpsysTextByPriority(const std::string& title, i
if (status == OK) {
dumpsys.writeDumpHeader(STDOUT_FILENO, service, priority);
std::chrono::duration<double> elapsed_seconds;
- status = dumpsys.writeDump(STDOUT_FILENO, service, service_timeout,
- /* as_proto = */ false, elapsed_seconds, bytes_written);
+ if (priority == IServiceManager::DUMP_FLAG_PRIORITY_HIGH &&
+ service == String16("meminfo")) {
+ // Use a longer timeout for meminfo, since 30s is not always enough.
+ status = dumpsys.writeDump(STDOUT_FILENO, service, 60s,
+ /* as_proto = */ false, elapsed_seconds, bytes_written);
+ } else {
+ status = dumpsys.writeDump(STDOUT_FILENO, service, service_timeout,
+ /* as_proto = */ false, elapsed_seconds, bytes_written);
+ }
dumpsys.writeDumpFooter(STDOUT_FILENO, service, elapsed_seconds);
bool dump_complete = (status == OK);
dumpsys.stopDumpThread(dump_complete);
@@ -1785,6 +1793,9 @@ static Dumpstate::RunStatus dumpstate() {
// Add linker configuration directory
ds.AddDir(LINKERCONFIG_DIR, true);
+ /* Dump cgroupfs */
+ ds.AddDir(CGROUPFS_DIR, true);
+
if (ds.dump_pool_) {
WAIT_TASK_WITH_CONSENT_CHECK(DUMP_INCIDENT_REPORT_TASK, ds.dump_pool_);
} else {
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 59311a012a..74be7cedc7 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -342,8 +342,7 @@ static int restorecon_app_data_lazy(const std::string& path, const std::string&
// If the initial top-level restorecon above changed the label, then go
// back and restorecon everything recursively
- // TODO(b/190567190, b/188141923) Remove recursive fixup of com.google.android.gsf.
- if (strcmp(before, after) || (path.find("com.google.android.gsf") != std::string::npos)) {
+ if (strcmp(before, after)) {
if (existing) {
LOG(DEBUG) << "Detected label change from " << before << " to " << after << " at "
<< path << "; running recursive restorecon";
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 15f0c5b75c..d678281b6e 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -43,7 +43,7 @@
#include <log/log.h> // TODO: Move everything to base/logging.
#include <openssl/sha.h>
#include <private/android_filesystem_config.h>
-#include <processgroup/sched_policy.h>
+#include <processgroup/processgroup.h>
#include <selinux/android.h>
#include <server_configurable_flags/get_flags.h>
#include <system/thread_defs.h>
@@ -282,8 +282,8 @@ static bool ShouldUseSwapFileForDexopt() {
static void SetDex2OatScheduling(bool set_to_bg) {
if (set_to_bg) {
- if (set_sched_policy(0, SP_BACKGROUND) < 0) {
- PLOG(ERROR) << "set_sched_policy failed";
+ if (!SetTaskProfiles(0, {"Dex2OatBootComplete"})) {
+ LOG(ERROR) << "Failed to set dex2oat task profile";
exit(DexoptReturnCodes::kSetSchedPolicy);
}
if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
@@ -1231,6 +1231,14 @@ class RunDexoptAnalyzer : public ExecVHelper {
}
}
+ // On-device signing related. odsign sets the system property odsign.verification.success if
+ // AOT artifacts have the expected signatures.
+ const bool trust_art_apex_data_files =
+ ::android::base::GetBoolProperty("odsign.verification.success", false);
+ if (!trust_art_apex_data_files) {
+ AddRuntimeArg("-Xdeny-art-apex-data-files");
+ }
+
PrepareArgs(dexoptanalyzer_bin);
}
@@ -1363,10 +1371,12 @@ static SecondaryDexAccess check_secondary_dex_access(const std::string& dex_path
return kSecondaryDexAccessReadOk;
} else {
if (errno == ENOENT) {
- LOG(INFO) << "Secondary dex does not exist: " << dex_path;
+ async_safe_format_log(ANDROID_LOG_INFO, LOG_TAG,
+ "Secondary dex does not exist: %s", dex_path.c_str());
return kSecondaryDexAccessDoesNotExist;
} else {
- PLOG(ERROR) << "Could not access secondary dex " << dex_path;
+ async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG,
+ "Could not access secondary dex: %s (%d)", dex_path.c_str(), errno);
return errno == EACCES
? kSecondaryDexAccessPermissionError
: kSecondaryDexAccessIOError;
diff --git a/cmds/installd/run_dex2oat.cpp b/cmds/installd/run_dex2oat.cpp
index e847626a14..b6616841f0 100644
--- a/cmds/installd/run_dex2oat.cpp
+++ b/cmds/installd/run_dex2oat.cpp
@@ -283,6 +283,13 @@ void RunDex2Oat::PrepareCompilerConfigFlags(const UniqueFile& input_vdex,
}
}
+ // On-device signing related. odsign sets the system property odsign.verification.success if
+ // AOT artifacts have the expected signatures.
+ const bool trust_art_apex_data_files = GetBoolProperty("odsign.verification.success", false);
+ if (!trust_art_apex_data_files) {
+ AddRuntimeArg("-Xdeny-art-apex-data-files");
+ }
+
if (target_sdk_version != 0) {
AddRuntimeArg(StringPrintf("-Xtarget-sdk-version:%d", target_sdk_version));
}
diff --git a/cmds/surfacereplayer/proto/src/trace.proto b/cmds/surfacereplayer/proto/src/trace.proto
index 3798ba73a4..03a2709075 100644
--- a/cmds/surfacereplayer/proto/src/trace.proto
+++ b/cmds/surfacereplayer/proto/src/trace.proto
@@ -52,6 +52,7 @@ message SurfaceChange {
BackgroundBlurRadiusChange background_blur_radius = 20;
ShadowRadiusChange shadow_radius = 21;
BlurRegionsChange blur_regions = 22;
+ TrustedOverlayChange trusted_overlay = 23;
}
}
@@ -192,6 +193,10 @@ message ShadowRadiusChange {
required float radius = 1;
}
+message TrustedOverlayChange {
+ required float is_trusted_overlay = 1;
+}
+
message BlurRegionsChange {
repeated BlurRegionChange blur_regions = 1;
}