Skip to content

Commit d9c4078

Browse files
LiangliangSuiDennySPB
authored andcommitted
Reduce the number of binders
In the APerformanceHintManager.createSession method, the binder will be sent to the peer HintManagerService.BinderService.createSession. In the HintManagerService.BinderService.createSession, it will be judged whether |mPreferredRateNanos| is equal to -1. If it is equal to -1, null will be returned. In order to prevent binder waste, Early judgment in APerformanceHintManager.createSession function Bug: b/269397293 Change-Id: I7a1ff3d796894600d8c59dcf7a475711b5dc987a Signed-off-by: DennySPb <[email protected]>
1 parent 1ceb290 commit d9c4078

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

native/android/performance_hint.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ APerformanceHintManager* APerformanceHintManager::create(sp<IHintManager> manage
120120

121121
APerformanceHintSession* APerformanceHintManager::createSession(
122122
const int32_t* threadIds, size_t size, int64_t initialTargetWorkDurationNanos) {
123+
// If |mPreferredRateNanos| is -1, it means hint session is not supported.
124+
// Hence no need to attempt to create hint session.
125+
if (mPreferredRateNanos == -1L) {
126+
return nullptr;
127+
}
123128
std::vector<int32_t> tids(threadIds, threadIds + size);
124129
sp<IHintSession> session;
125130
binder::Status ret =

0 commit comments

Comments
 (0)