Skip binder call if it's the same target

Bug: 349632685
Flag: EXEMPT NDK
Test: atest PerformanceHintTest
Change-Id: I0b3bd63da15ec8690cd86806cbe86fce31b299bd
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp
index 7e5bef1..e91c7a9 100644
--- a/native/android/performance_hint.cpp
+++ b/native/android/performance_hint.cpp
@@ -244,6 +244,12 @@
         ALOGE("%s: targetDurationNanos must be positive", __FUNCTION__);
         return EINVAL;
     }
+    {
+        std::scoped_lock lock(sHintMutex);
+        if (mTargetDurationNanos == targetDurationNanos) {
+            return 0;
+        }
+    }
     ndk::ScopedAStatus ret = mHintSession->updateTargetWorkDuration(targetDurationNanos);
     if (!ret.isOk()) {
         ALOGE("%s: HintSession updateTargetWorkDuration failed: %s", __FUNCTION__,