Merge "logcat: test: tail_# occasional failures"
diff --git a/.clang-format-2 b/.clang-format-2
index fb967d8..aab4665 100644
--- a/.clang-format-2
+++ b/.clang-format-2
@@ -1,8 +1,4 @@
BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: true
-
-AccessModifierOffset: -1
ColumnLimit: 100
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
diff --git a/.clang-format-4 b/.clang-format-4
index fc4eb1b..1497447 100644
--- a/.clang-format-4
+++ b/.clang-format-4
@@ -1,7 +1,4 @@
BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
AccessModifierOffset: -2
ColumnLimit: 100
CommentPragmas: NOLINT:.*
diff --git a/adb/.clang-format b/adb/.clang-format
deleted file mode 100644
index fc4eb1b..0000000
--- a/adb/.clang-format
+++ /dev/null
@@ -1,13 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
-AccessModifierOffset: -2
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 4
-PointerAlignment: Left
-TabWidth: 4
-UseTab: Never
-PenaltyExcessCharacter: 32
diff --git a/adb/.clang-format b/adb/.clang-format
new file mode 120000
index 0000000..1af4f51
--- /dev/null
+++ b/adb/.clang-format
@@ -0,0 +1 @@
+../.clang-format-4
\ No newline at end of file
diff --git a/base/.clang-format b/base/.clang-format
deleted file mode 100644
index 2b83a1f..0000000
--- a/base/.clang-format
+++ /dev/null
@@ -1,11 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 2
-PointerAlignment: Left
-TabWidth: 2
-UseTab: Never
-PenaltyExcessCharacter: 32
diff --git a/base/.clang-format b/base/.clang-format
new file mode 120000
index 0000000..fd0645f
--- /dev/null
+++ b/base/.clang-format
@@ -0,0 +1 @@
+../.clang-format-2
\ No newline at end of file
diff --git a/debuggerd/.clang-format b/debuggerd/.clang-format
deleted file mode 100644
index 9b7478c..0000000
--- a/debuggerd/.clang-format
+++ /dev/null
@@ -1,15 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 2
-ContinuationIndentWidth: 2
-PointerAlignment: Left
-TabWidth: 2
-UseTab: Never
-PenaltyExcessCharacter: 32
-
-Cpp11BracedListStyle: false
diff --git a/debuggerd/.clang-format b/debuggerd/.clang-format
new file mode 120000
index 0000000..fd0645f
--- /dev/null
+++ b/debuggerd/.clang-format
@@ -0,0 +1 @@
+../.clang-format-2
\ No newline at end of file
diff --git a/fastboot/.clang-format b/fastboot/.clang-format
deleted file mode 100644
index bcb8d8a..0000000
--- a/fastboot/.clang-format
+++ /dev/null
@@ -1,15 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: Inline
-
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 4
-ContinuationIndentWidth: 8
-ConstructorInitializerIndentWidth: 8
-AccessModifierOffset: -2
-PointerAlignment: Left
-TabWidth: 4
-UseTab: Never
-PenaltyExcessCharacter: 32
diff --git a/fastboot/.clang-format b/fastboot/.clang-format
new file mode 120000
index 0000000..1af4f51
--- /dev/null
+++ b/fastboot/.clang-format
@@ -0,0 +1 @@
+../.clang-format-4
\ No newline at end of file
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index a4a0b52..2927b16 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1245,20 +1245,17 @@
return 0;
}
-static int do_oem_command(int argc, char **argv)
-{
- char command[256];
+static int do_oem_command(int argc, char** argv) {
if (argc <= 1) return 0;
- command[0] = 0;
- while(1) {
- strcat(command,*argv);
+ std::string command;
+ while (argc > 0) {
+ command += *argv;
skip(1);
- if(argc == 0) break;
- strcat(command," ");
+ if (argc != 0) command += " ";
}
- fb_queue_command(command,"");
+ fb_queue_command(command.c_str(), "");
return 0;
}
diff --git a/libcutils/android_reboot.c b/libcutils/android_reboot.c
index 159a9d4..6bdcc13 100644
--- a/libcutils/android_reboot.c
+++ b/libcutils/android_reboot.c
@@ -209,6 +209,10 @@
LINUX_REBOOT_CMD_RESTART2, arg);
break;
+ case ANDROID_RB_THERMOFF:
+ ret = reboot(RB_POWER_OFF);
+ break;
+
default:
ret = -1;
}
diff --git a/libcutils/include/cutils/android_reboot.h b/libcutils/include/cutils/android_reboot.h
index a3861a0..549f258 100644
--- a/libcutils/include/cutils/android_reboot.h
+++ b/libcutils/include/cutils/android_reboot.h
@@ -25,6 +25,7 @@
#define ANDROID_RB_RESTART 0xDEAD0001
#define ANDROID_RB_POWEROFF 0xDEAD0002
#define ANDROID_RB_RESTART2 0xDEAD0003
+#define ANDROID_RB_THERMOFF 0xDEAD0004
/* Properties */
#define ANDROID_RB_PROPERTY "sys.powerctl"
diff --git a/libprocinfo/.clang-format b/libprocinfo/.clang-format
deleted file mode 100644
index b8c6428..0000000
--- a/libprocinfo/.clang-format
+++ /dev/null
@@ -1,14 +0,0 @@
-BasedOnStyle: Google
-AllowShortBlocksOnASingleLine: false
-AllowShortFunctionsOnASingleLine: false
-
-ColumnLimit: 100
-CommentPragmas: NOLINT:.*
-DerivePointerAlignment: false
-IndentWidth: 2
-PointerAlignment: Left
-TabWidth: 2
-UseTab: Never
-PenaltyExcessCharacter: 32
-
-Cpp11BracedListStyle: false
diff --git a/libprocinfo/.clang-format b/libprocinfo/.clang-format
new file mode 120000
index 0000000..fd0645f
--- /dev/null
+++ b/libprocinfo/.clang-format
@@ -0,0 +1 @@
+../.clang-format-2
\ No newline at end of file
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index 9c634f6..2b6c276 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -180,8 +180,13 @@
if (!avcr) return DIFFERENT;
lenr -= avcr - msgr;
if (lenl != lenr) return DIFFERENT;
- if (fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc), lenl))
+ // TODO: After b/35468874 is addressed, revisit "lenl > strlen(avc)"
+ // condition, it might become superflous.
+ if (lenl > strlen(avc) &&
+ fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc),
+ lenl - strlen(avc))) {
return DIFFERENT;
+ }
return SAME;
}
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index 9ae95f9..9dfa14e 100644
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -754,7 +754,7 @@
// eg: [143:healthd]healthd -> [143:healthd]
taglen = etag - tag;
// Mediatek-special printk induced stutter
- const char* mp = strnrchr(tag, ']', taglen);
+ const char* mp = strnrchr(tag, taglen, ']');
if (mp && (++mp < etag)) {
size_t s = etag - mp;
if (((s + s) < taglen) && !fastcmp<memcmp>(mp, mp - 1 - s, s)) {