Merge "SF: Prevent non-sync transactions from syncing" into nyc-dev
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 6520e3b..b183289 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -576,7 +576,7 @@
return true;
}
-static void dumpstate(const std::string& screenshot_path) {
+static void dumpstate(const std::string& screenshot_path, const std::string& version) {
DurationReporter duration_reporter("DUMPSTATE");
unsigned long timeout;
@@ -847,7 +847,12 @@
/* the full dumpsys is starting to take a long time, so we need
to increase its timeout. we really need to do the timeouts in
dumpsys itself... */
- run_command("DUMPSYS", 60, "dumpsys", NULL);
+ if (version == VERSION_DUMPSYS_SPLIT) {
+ // Skipping meminfo and cpuinfo services.
+ run_command("DUMPSYS", 60, "dumpsys", "--skip", "meminfo,cpuinfo", NULL);
+ } else {
+ run_command("DUMPSYS", 60, "dumpsys", NULL);
+ }
printf("========================================================\n");
printf("== Checkins\n");
@@ -1173,7 +1178,7 @@
if (do_update_progress) {
std::vector<std::string> am_args = {
- "--receiver-permission", "android.permission.DUMP",
+ "--receiver-permission", "android.permission.DUMP", "--receiver-foreground",
"--es", "android.intent.extra.NAME", suffix,
"--ei", "android.intent.extra.PID", std::to_string(getpid()),
"--ei", "android.intent.extra.MAX", std::to_string(WEIGHT_TOTAL),
@@ -1219,18 +1224,6 @@
}
}
- /* collect stack traces from Dalvik and native processes (needs root) */
- dump_traces_path = dump_traces();
-
- /* Get the tombstone fds, recovery files, and mount info here while we are running as root. */
- get_tombstone_fds(tombstone_data);
- add_dir(RECOVERY_DIR, true);
- add_mountinfo();
-
- if (!drop_root()) {
- return -1;
- }
-
if (is_redirecting) {
redirect_to_file(stderr, const_cast<char*>(log_path.c_str()));
/* TODO: rather than generating a text file now and zipping it later,
@@ -1243,7 +1236,26 @@
// duration is logged into MYLOG instead.
print_header(version);
- dumpstate(do_early_screenshot ? "": screenshot_path);
+ if (version == VERSION_DUMPSYS_SPLIT) {
+ // Invoking the following dumpsys calls before dump_traces() to try and
+ // keep the system stats as close to its initial state as possible.
+ run_command("DUMPSYS MEMINFO", 30, SU_PATH, "shell", "dumpsys", "meminfo", "-a", NULL);
+ run_command("DUMPSYS CPUINFO", 30, SU_PATH, "shell", "dumpsys", "cpuinfo", "-a", NULL);
+ }
+
+ /* collect stack traces from Dalvik and native processes (needs root) */
+ dump_traces_path = dump_traces();
+
+ /* Get the tombstone fds, recovery files, and mount info here while we are running as root. */
+ get_tombstone_fds(tombstone_data);
+ add_dir(RECOVERY_DIR, true);
+ add_mountinfo();
+
+ if (!drop_root()) {
+ return -1;
+ }
+
+ dumpstate(do_early_screenshot ? "": screenshot_path, version);
/* done */
if (vibrator) {
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 6dfd7a8..9d42939 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -705,9 +705,9 @@
fprintf(stderr, "send_broadcast: too many arguments (%d)\n", (int) args.size());
return;
}
- const char *am_args[1024] = { "/system/bin/am", "broadcast",
+ const char *am_args[1024] = { SU_PATH, "shell", "/system/bin/am", "broadcast",
"--user", "0", "-a", action.c_str() };
- size_t am_index = 5; // Starts at the index of last initial value above.
+ size_t am_index = 7; // Starts at the index of last initial value above.
for (const std::string& arg : args) {
am_args[++am_index] = arg.c_str();
}
@@ -777,7 +777,7 @@
}
void create_parent_dirs(const char *path) {
- char *chp = (char*) path;
+ char *chp = const_cast<char *> (path);
/* skip initial slash */
if (chp[0] == '/')
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 9d42464..136a14a 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -222,9 +222,9 @@
if (mCore->mFreeSlots.empty()) {
return BufferQueueCore::INVALID_BUFFER_SLOT;
}
- auto slot = mCore->mFreeSlots.begin();
+ int slot = *(mCore->mFreeSlots.begin());
mCore->mFreeSlots.erase(slot);
- return *slot;
+ return slot;
}
status_t BufferQueueProducer::waitForFreeSlotThenRelock(FreeSlotCaller caller,