Sets dumpstate version using system properties.

Android N introduced a '-V' argument to change dumpstate's version, but
such argument can only be used when running dumpstate directly (as
root).
This CL uses a system property instead (dumpstate.version), so different
versions can be used while taking bugreports.

It also introduces a '-v' argument line to display the dumpstate header,
and removes the redundant dry_run check from _dump_file_from_fd().

Test: DumpstateTest passes
Change-Id: I46ec4bca133d16d8431358bb9f16eb89bb082be1
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 29d3c0b..568256a 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -197,7 +197,12 @@
  *
  * See bugreport-format.md for more info.
  */
-static std::string VERSION_DEFAULT = "1.0";
+static std::string VERSION_CURRENT = "1.0";
+
+/*
+ * "Alias" for the current version.
+ */
+static std::string VERSION_DEFAULT = "default";
 
 /*
  * Main class driving a bugreport generation.
@@ -332,7 +337,7 @@
     int control_socket_fd_ = -1;
 
     // Bugreport format version;
-    std::string version_ = VERSION_DEFAULT;
+    std::string version_ = VERSION_CURRENT;
 
     // Command-line arguments as string
     std::string args_;
@@ -370,7 +375,8 @@
 
   private:
     // Used by GetInstance() only.
-    Dumpstate(bool dry_run = false, const std::string& build_type = "user");
+    Dumpstate(const std::string& version = VERSION_CURRENT, bool dry_run = false,
+              const std::string& build_type = "user");
 
     // Internal version of RunCommand that just runs it, without updating progress.
     int JustRunCommand(const char* command, const char* path, std::vector<const char*>& args,