Adds all tombstone files when writing to zipped file.

Currently, a bugreport simply cats any tombstone file modified in the
last half an hour into the bugreport. This is a problem since the
tombstones contain a lot of really valuable information, and sometimes
users don't get a bugreport in this time frame. In addition, some of our
monkey testing has the same problem.

Since now dumpstate can create a zip file, we can include all  directly
on it, although still using the old mechanism when it's creating it (for example, when invoked through 'adb bugreport').

BUG: 25974224
Change-Id: Ie29fd7d91953d91232b0db1c9588043aee13f93e
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index da5632d..78bab81 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -71,7 +71,7 @@
         uint64_t elapsed = DurationReporter::nanotime() - started_;
         // Use "Yoda grammar" to make it easier to grep|sort sections.
         printf("------ %.3fs was the duration of '%s' ------\n",
-                (float) elapsed / NANOS_PER_SEC, title_);
+               (float) elapsed / NANOS_PER_SEC, title_);
     }
 }
 
@@ -912,6 +912,27 @@
     run_command_always(NULL, 10, args);
 }
 
+void vibrate(FILE* vibrator, int ms) {
+    fprintf(vibrator, "%d\n", ms);
+    fflush(vibrator);
+}
+
+bool is_dir(const char* pathname) {
+    struct stat info;
+    if (stat(pathname, &info) == -1) {
+        return false;
+    }
+    return S_ISDIR(info.st_mode);
+}
+
+time_t get_mtime(int fd, time_t default_mtime) {
+    struct stat info;
+    if (fstat(fd, &info) == -1) {
+        return default_mtime;
+    }
+    return info.st_mtime;
+}
+
 void dump_emmc_ecsd(const char *ext_csd_path) {
     static const size_t EXT_CSD_REV = 192;
     static const size_t EXT_PRE_EOL_INFO = 267;