Make shell bugreport file names consistent with dumpstate

Since bugreport API workflow will be replacing old workflow of directly
starting dumpstate, we aim that the resulting file names be the same as
the users are used to the old file names (that dumpstate used to decide).

Bug:126862297
Test: * Build and flash to the device
      * Turn on Settings feature flag to use the bugreport API
      * Take interactive and full bugreports
      * Output file names same as before

Change-Id: I24d800e26a8cc4f739038ac0f27da13bd83f7f47
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index c9bb83c..39d0a0a 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -539,12 +539,17 @@
         }
     }
 
+    private String getBugreportName() {
+        String buildId = SystemProperties.get("ro.build.id", "UNKNOWN_BUILD");
+        String deviceName = SystemProperties.get("ro.product.name", "UNKNOWN_DEVICE");
+        String currentTimestamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
+        return String.format("bugreport-%s-%s-%s", deviceName, buildId, currentTimestamp);
+    }
+
     private void startBugreportAPI(Intent intent) {
         mUsingBugreportApi = true;
-        String bugreportName = "bugreport-" + new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(
-                new Date());
+        String bugreportName = getBugreportName();
 
-        // TODO(b/126862297): Make file naming same as dumpstate triggered bugreports
         ParcelFileDescriptor bugreportFd = createReadWriteFile(BUGREPORT_DIR,
                 bugreportName + ".zip");
         if (bugreportFd == null) {