Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbe08bfd authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Add build id as part of bugreport name." into nyc-dev

parents 14e034a0 9385b176
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -26,16 +26,16 @@ On _Android N (TBD)_, `dumpstate` generates a zip file directly (unless there
is a failure, in which case it reverts to the flat file that is zipped by
**Shell** and hence the end result is the _v0_ format).

The zip file is by default called _bugreport-DATE.zip_ and it contains a
_bugreport-DATE.txt_ entry, although the end user can change the name (through
**Shell**), in which case they would be called _bugreport-NEW_NAME.zip_ and
_bugreport-NEW_NAME.txt_ respectively.
The zip file is by default called _bugreport-BUILD_ID-DATE.zip_ and it contains a
_bugreport-BUILD_ID-DATE.txt_ entry, although the end user can change the name (through
**Shell**), in which case they would be called _bugreport-BUILD_ID-NEW_NAME.zip_ and
_bugreport-BUILD_ID-NEW_NAME.txt_ respectively.

The zip file also contains 2 metadata entries generated by `dumpstate`:

- `version.txt`:  whose value is **v1**.
- `main-entry.txt`: whose value is the name of the flat text entry (i.e.,
  _bugreport-DATE.txt_ or _bugreport-NEW_NAME.txt_).
  _bugreport-BUILD_ID-DATE.txt_ or _bugreport-NEW_NAME.txt_).

`dumpstate` can also copy files from the device’s filesystem into the zip file
under the `FS` folder. For example, a `/dirA/dirB/fileC` file in the device
@@ -62,9 +62,9 @@ changes become stable.

For example, the initial version during _Android N_ development was
**v1-dev1**. When `dumpsys` was split in 2 sections but not all tools were
ready to parse that format, the version was named **v1-dev1-dumpsys-split**,
ready to parse that format, the version was named **v1-dev2**,
which had to be passed do `dumpsys` explicitly (i.e., trhough a
`-V v1-dev1-dumpsys-split` argument). Once that format became stable and tools
`-V v1-dev2` argument). Once that format became stable and tools
knew how to parse it, the default version became **v1-dev2**.

Similarly, if changes in the file format are made after the initial release of
+9 −3
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ const std::string& ZIP_ROOT_DIR = "FS";
 */
// TODO: change to "v1" before final N build
static std::string VERSION_DEFAULT = "v1-dev3";
static std::string VERSION_BUILD_ON_NAME = "v1-dev4";

/* gets the tombstone data, according to the bugreport type: if zipped gets all tombstones,
 * otherwise gets just those modified in the last half an hour. */
@@ -939,8 +940,8 @@ static void usage() {
            "  -B: send broadcast when finished (requires -o)\n"
            "  -P: send broadcast when started and update system properties on progress (requires -o and -B)\n"
            "  -R: take bugreport in remote mode (requires -o, -z, -d and -B, shouldn't be used with -P)\n"
            "  -V: sets the bugreport format version (valid values: %s)\n",
            VERSION_DEFAULT.c_str());
            "  -V: sets the bugreport format version (valid values: %s, %s)\n",
            VERSION_DEFAULT.c_str(), VERSION_BUILD_ON_NAME.c_str());
}

static void sigpipe_handler(int n) {
@@ -1092,7 +1093,7 @@ int main(int argc, char *argv[]) {
        exit(1);
    }

    if (version != VERSION_DEFAULT) {
    if (version != VERSION_DEFAULT && version != VERSION_BUILD_ON_NAME) {
        usage();
        exit(1);
    }
@@ -1148,6 +1149,11 @@ int main(int argc, char *argv[]) {
        } else {
            suffix = "undated";
        }
        if (version == VERSION_BUILD_ON_NAME) {
            char build_id[PROPERTY_VALUE_MAX];
            property_get("ro.build.id", build_id, "UNKNOWN_BUILD");
            base_name = base_name + "-" + build_id;
        }
        if (do_fb) {
            // TODO: if dumpstate was an object, the paths could be internal variables and then
            // we could have a function to calculate the derived values, such as: