ADB security logging
Log adb shell, pull and push operations to the security log.
Bug: 22860162
Change-Id: I5d24e9d51040ae05a41d9fcb079e84351a217bd3
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp
index e092dc4..c3b9044 100644
--- a/adb/shell_service.cpp
+++ b/adb/shell_service.cpp
@@ -95,11 +95,13 @@
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <paths.h>
+#include <log/log.h>
#include "adb.h"
#include "adb_io.h"
#include "adb_trace.h"
#include "adb_utils.h"
+#include "security_log_tags.h"
namespace {
@@ -240,6 +242,12 @@
ScopedFd parent_error_sfd, child_error_sfd;
char pts_name[PATH_MAX];
+ if (command_.empty()) {
+ __android_log_security_bswrite(SEC_TAG_ADB_SHELL_INTERACTIVE, "");
+ } else {
+ __android_log_security_bswrite(SEC_TAG_ADB_SHELL_CMD, command_.c_str());
+ }
+
// Create a socketpair for the fork() child to report any errors back to the parent. Since we
// use threads, logging directly from the child might deadlock due to locks held in another
// thread during the fork.