Merge "Use a randomly generated UUID as the TvInputSessionId" am: 4249ba1059
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536949 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I94143aae2d5e78dd99e349a929f9622eae946792
This commit is contained in:
@@ -97,6 +97,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -1176,7 +1177,8 @@ public final class TvInputManagerService extends SystemService {
|
|||||||
final int resolvedUserId = resolveCallingUserId(callingPid, callingUid,
|
final int resolvedUserId = resolveCallingUserId(callingPid, callingUid,
|
||||||
userId, "createSession");
|
userId, "createSession");
|
||||||
final long identity = Binder.clearCallingIdentity();
|
final long identity = Binder.clearCallingIdentity();
|
||||||
StringBuilder sessionId = new StringBuilder();
|
// Generate a unique session id with a random UUID.
|
||||||
|
String uniqueSessionId = UUID.randomUUID().toString();
|
||||||
try {
|
try {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (userId != mCurrentUserId && !isRecordingSession) {
|
if (userId != mCurrentUserId && !isRecordingSession) {
|
||||||
@@ -1205,20 +1207,17 @@ public final class TvInputManagerService extends SystemService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a unique session id with pid, uid and resolved user id
|
|
||||||
sessionId.append(callingUid).append(callingPid).append(resolvedUserId);
|
|
||||||
|
|
||||||
// Create a new session token and a session state.
|
// Create a new session token and a session state.
|
||||||
IBinder sessionToken = new Binder();
|
IBinder sessionToken = new Binder();
|
||||||
SessionState sessionState = new SessionState(sessionToken, info.getId(),
|
SessionState sessionState = new SessionState(sessionToken, info.getId(),
|
||||||
info.getComponent(), isRecordingSession, client, seq, callingUid,
|
info.getComponent(), isRecordingSession, client, seq, callingUid,
|
||||||
callingPid, resolvedUserId, sessionId.toString());
|
callingPid, resolvedUserId, uniqueSessionId);
|
||||||
|
|
||||||
// Add them to the global session state map of the current user.
|
// Add them to the global session state map of the current user.
|
||||||
userState.sessionStateMap.put(sessionToken, sessionState);
|
userState.sessionStateMap.put(sessionToken, sessionState);
|
||||||
|
|
||||||
// Map the session id to the sessionStateMap in the user state
|
// Map the session id to the sessionStateMap in the user state
|
||||||
mSessionIdToSessionStateMap.put(sessionId.toString(), sessionState);
|
mSessionIdToSessionStateMap.put(uniqueSessionId, sessionState);
|
||||||
|
|
||||||
// Also, add them to the session state map of the current service.
|
// Also, add them to the session state map of the current service.
|
||||||
serviceState.sessionTokens.add(sessionToken);
|
serviceState.sessionTokens.add(sessionToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user