Merge "Add additional logs for session creation" into main
diff --git a/media/java/android/media/MediaRouter2.java b/media/java/android/media/MediaRouter2.java
index 94a061a..d6921c8 100644
--- a/media/java/android/media/MediaRouter2.java
+++ b/media/java/android/media/MediaRouter2.java
@@ -985,6 +985,11 @@
void onRequestCreateControllerByManagerOnHandler(
RoutingSessionInfo oldSession, MediaRoute2Info route, long managerRequestId) {
+ Log.i(
+ TAG,
+ TextUtils.formatSimple(
+ "requestCreateSessionByManager | requestId: %d, oldSession: %s, route: %s",
+ managerRequestId, oldSession, route));
RoutingController controller;
if (oldSession.isSystemSession()) {
controller = getSystemController();
diff --git a/services/core/java/com/android/server/media/MediaRouter2ServiceImpl.java b/services/core/java/com/android/server/media/MediaRouter2ServiceImpl.java
index 63dc59c..37bcfbb 100644
--- a/services/core/java/com/android/server/media/MediaRouter2ServiceImpl.java
+++ b/services/core/java/com/android/server/media/MediaRouter2ServiceImpl.java
@@ -1291,13 +1291,18 @@
}
long uniqueRequestId = toUniqueRequestId(managerRecord.mManagerId, requestId);
- if (managerRecord.mLastSessionCreationRequest != null) {
+ SessionCreationRequest lastRequest = managerRecord.mLastSessionCreationRequest;
+ if (lastRequest != null) {
+ Slog.i(
+ TAG,
+ TextUtils.formatSimple(
+ "requestCreateSessionWithManagerLocked: Notifying failure for pending"
+ + " session creation request - oldSession: %s, route: %s",
+ lastRequest.mOldSession, lastRequest.mRoute));
managerRecord.mUserRecord.mHandler.notifyRequestFailedToManager(
managerRecord.mManager,
- toOriginalRequestId(managerRecord.mLastSessionCreationRequest
- .mManagerRequestId),
+ toOriginalRequestId(lastRequest.mManagerRequestId),
REASON_UNKNOWN_ERROR);
- managerRecord.mLastSessionCreationRequest = null;
}
managerRecord.mLastSessionCreationRequest = new SessionCreationRequest(routerRecord,
MediaRoute2ProviderService.REQUEST_ID_NONE, uniqueRequestId,