Skip to content

Commit

Permalink
Reduce the number of binders
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
LiangliangSui authored and DennySPB committed May 12, 2023
1 parent 1ceb290 commit d9c4078
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions native/android/performance_hint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ APerformanceHintManager* APerformanceHintManager::create(sp<IHintManager> manage

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

0 comments on commit d9c4078

Please sign in to comment.