Snap for 6233321 from 618afdc057b897383c3ca16b68cc4e8b9a4c7ed0 to qt-d4-release

Change-Id: Ie1face5dc820f55780eceb47b7c99acb91934e22
diff --git a/perfetto.rc b/perfetto.rc
index 8d07713..a33bd03 100644
--- a/perfetto.rc
+++ b/perfetto.rc
@@ -62,3 +62,7 @@
 on property:persist.traced.enable=0
     stop traced
     stop traced_probes
+
+# Reset the Perfetto guard rail state on boot:
+on post-fs-data
+    rm /data/misc/perfetto-traces/.guardraildata
diff --git a/src/perfetto_cmd/rate_limiter.cc b/src/perfetto_cmd/rate_limiter.cc
index 3b018bc..56f34c4 100644
--- a/src/perfetto_cmd/rate_limiter.cc
+++ b/src/perfetto_cmd/rate_limiter.cc
@@ -106,7 +106,8 @@
   }
 
   // If we've uploaded in the last 5mins we shouldn't trace now.
-  if ((now_in_s - state_.last_trace_timestamp()) < kCooldownInSeconds) {
+  if (state_.last_trace_timestamp() != 0 &&
+      (now_in_s - state_.last_trace_timestamp()) < kCooldownInSeconds) {
     PERFETTO_ELOG("Guardrail: Uploaded to DropBox in the last 5mins.");
     if (!args.ignore_guardrails)
       return false;