compos_bench: Fix getLatestDex2oatSuccessTime

The function parses logcat to find the last invocation of dex2oat.
Unfortunately it throws an exception if no invocation is found. Remove
that assumption.

Test: reboot; atest ComposBenchmarkApp
Change-Id: Iaad003b7dc2253b8ffffda6a1e30f77eed224365
diff --git a/compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java b/compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java
index e4fb5ff..f4bc3b6 100644
--- a/compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java
+++ b/compos/benchmark/src/java/com/android/compos/benchmark/ComposBenchmark.java
@@ -133,7 +133,7 @@
 
         final String command = "logcat -d -e dex2oat";
         String output = executeCommand(command);
-        String latestTime = "";
+        String latestTime = null;
 
         for (String line : output.split("[\r\n]+")) {
             Pattern pattern = Pattern.compile("dex2oat64: dex2oat took");
@@ -143,6 +143,10 @@
             }
         }
 
+        if (latestTime == null) {
+            return null;
+        }
+
         DateFormat formatter = new SimpleDateFormat("MM-dd hh:mm:ss.SSS");
         Date date = formatter.parse(latestTime);
         Timestamp timeStampDate = new Timestamp(date.getTime());
@@ -166,7 +170,9 @@
             Long compileSec = Duration.ofNanos(compileEndTime - compileStartTime).getSeconds();
             Timestamp afterCompileLatestTime = getLatestDex2oatSuccessTime();
 
-            assertTrue(beforeCompileLatestTime.before(afterCompileLatestTime));
+            assertTrue(afterCompileLatestTime != null);
+            assertTrue(beforeCompileLatestTime == null
+                    || beforeCompileLatestTime.before(afterCompileLatestTime));
 
             compileSecArray[round] = compileSec;
         }