Send the hint immediately when actual > target

Send the hint immediately when actual duration is longer than target
duration.

Test: boot
Bug: 198379880
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I6c80940b27d65a1e34e40f61eef3f81990957711
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index 65428de..d627984 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -184,13 +184,13 @@
     mTimestampsNanos.push_back(now);
 
     /**
-     * Use current sample to determine the rate limit. We can pick a shorter rate limit
-     * if any sample underperformed, however, it could be the lower level system is slow
-     * to react. So here we explicitly choose the rate limit with the latest sample.
+     * Cache the hint if the hint is not overtime and the mLastUpdateTimestamp is
+     * still in the mPreferredRateNanos duration.
      */
-    int64_t rateLimit = actualDurationNanos > mTargetDurationNanos ? mPreferredRateNanos
-                                                                   : 10 * mPreferredRateNanos;
-    if (now - mLastUpdateTimestamp <= rateLimit) return 0;
+    if (actualDurationNanos < mTargetDurationNanos &&
+        now - mLastUpdateTimestamp <= mPreferredRateNanos) {
+        return 0;
+    }
 
     binder::Status ret =
             mHintSession->reportActualWorkDuration(mActualDurationsNanos, mTimestampsNanos);