Skip to content
Snippets Groups Projects
Commit b5edf2ab authored by Xiang Wang's avatar Xiang Wang Committed by Android (Google) Code Review
Browse files

Revert "Set max number of sessions to 20 for non-system process"

This reverts commit 883ee642.

Reason for revert: b/296971803

Change-Id: Ia35e165d2aabba382b9a4e1757d8fc3c02d842e6
parent 883ee642
No related branches found
No related tags found
No related merge requests found
......@@ -144,8 +144,6 @@ APerformanceHintSession* APerformanceHintManager::createSession(
binder::Status ret =
mHintManager->createHintSession(mToken, tids, initialTargetWorkDurationNanos, &session);
if (!ret.isOk() || !session) {
ALOGE("%s: PerformanceHint cannot create hint session. %s", __FUNCTION__,
ret.exceptionMessage().c_str());
return nullptr;
}
return new APerformanceHintSession(mHintManager, std::move(session), mPreferredRateNanos,
......
......@@ -56,7 +56,6 @@ import java.util.Objects;
public final class HintManagerService extends SystemService {
private static final String TAG = "HintManagerService";
private static final boolean DEBUG = false;
private static final int MAX_HINT_SESSION_COUNT_PER_UID = 20;
@VisibleForTesting final long mHintSessionPreferredRate;
// Multi-level map storing all active AppHintSessions.
......@@ -368,23 +367,6 @@ public final class HintManagerService extends SystemService {
+ " not be empty.");
final int callingUid = Binder.getCallingUid();
if (callingUid != Process.SYSTEM_UID) {
int sessionCount = 0;
synchronized (mLock) {
ArrayMap<IBinder, ArraySet<AppHintSession>> tokenMap =
mActiveSessions.get(callingUid);
if (tokenMap != null) {
for (ArraySet<AppHintSession> arr : tokenMap.values()) {
sessionCount += arr.size();
}
}
}
if (sessionCount >= MAX_HINT_SESSION_COUNT_PER_UID) {
throw new IllegalStateException(
"Max session count limit reached: " + sessionCount);
}
}
final int callingTgid = Process.getThreadGroupLeader(Binder.getCallingPid());
final long identity = Binder.clearCallingIdentity();
try {
......
......@@ -148,32 +148,6 @@ public class HintManagerServiceTest {
assertNotNull(c);
}
@Test
public void testCreateHintSession_exceedsLimit() throws Exception {
HintManagerService service = createService();
IBinder token1 = new Binder();
IBinder token2 = new Binder();
for (int i = 0; i < 10; i++) {
IHintSession a = service.getBinderServiceInstance().createHintSession(token1,
SESSION_TIDS_A, DEFAULT_TARGET_DURATION);
assertNotNull(a);
}
for (int i = 0; i < 10; i++) {
IHintSession b = service.getBinderServiceInstance().createHintSession(token2,
SESSION_TIDS_B, DEFAULT_TARGET_DURATION);
assertNotNull(b);
}
assertThrows(IllegalStateException.class,
() -> service.getBinderServiceInstance().createHintSession(token1, SESSION_TIDS_A,
DEFAULT_TARGET_DURATION));
assertThrows(IllegalStateException.class,
() -> service.getBinderServiceInstance().createHintSession(token2, SESSION_TIDS_B,
DEFAULT_TARGET_DURATION));
}
@Test
public void testPauseResumeHintSession() throws Exception {
HintManagerService service = createService();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment