Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e29cefe8 authored by Xiang Wang's avatar Xiang Wang Committed by Android (Google) Code Review
Browse files

Merge "Skip binder call if it's the same target" into main

parents 184c23fe e16ad281
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -244,6 +244,12 @@ int APerformanceHintSession::updateTargetWorkDuration(int64_t targetDurationNano
        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__,
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ TEST_F(PerformanceHintTest, TestSession) {
    int result = APerformanceHint_updateTargetWorkDuration(session, targetDurationNanos);
    EXPECT_EQ(0, result);

    // subsequent call with same target should be ignored but return no error
    result = APerformanceHint_updateTargetWorkDuration(session, targetDurationNanos);
    EXPECT_EQ(0, result);

    usleep(2); // Sleep for longer than preferredUpdateRateNanos.
    int64_t actualDurationNanos = 20;
    std::vector<int64_t> actualDurations;