Skip to content

Commit aa1d113

Browse files
toniheiicbaker
authored andcommitted
Rollback of 311f76d
PiperOrigin-RevId: 785381545 (cherry picked from commit 2345eab)
1 parent 17a982e commit aa1d113

File tree

4 files changed

+4
-76
lines changed

4 files changed

+4
-76
lines changed

RELEASENOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This release includes the following changes since the
1717
use a different instance than the one used for playback
1818
([#1191](https://github.com/androidx/media/issues/1191)).
1919
* Session:
20+
* Fix bug where connections from third-party non-priviledged Media3
21+
controllers are ignored.
2022
* Remove check for available commands when sending custom commands to a
2123
legacy `MediaBrowserServiceCompat`. This is in parity with the behavior
2224
of legacy controllers/browsers when connected to a legacy app.

libraries/session/src/main/java/androidx/media3/session/MediaSessionService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -844,16 +844,6 @@ public void connect(
844844
int uid = Binder.getCallingUid();
845845
long token = Binder.clearCallingIdentity();
846846
int pid = (callingPid != 0) ? callingPid : request.pid;
847-
if (!SessionUtil.isValidPackage(mediaSessionService, request.packageName, uid)) {
848-
Log.w(
849-
TAG,
850-
"Ignoring connection from invalid package name "
851-
+ request.packageName
852-
+ " (uid="
853-
+ uid
854-
+ ")");
855-
return;
856-
}
857847
MediaSessionManager.RemoteUserInfo remoteUserInfo =
858848
new MediaSessionManager.RemoteUserInfo(request.packageName, pid, uid);
859849
boolean isTrusted =

libraries/session/src/main/java/androidx/media3/session/MediaSessionStub.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -655,26 +655,15 @@ public void connect(
655655
}
656656
int uid = Binder.getCallingUid();
657657
int callingPid = Binder.getCallingPid();
658-
@Nullable MediaSessionImpl sessionImpl = this.sessionImpl.get();
659-
if (sessionImpl != null
660-
&& !SessionUtil.isValidPackage(sessionImpl.getContext(), request.packageName, uid)) {
661-
Log.w(
662-
TAG,
663-
"Ignoring connection from invalid package name "
664-
+ request.packageName
665-
+ " (uid="
666-
+ uid
667-
+ ")");
668-
return;
669-
}
670-
671658
long token = Binder.clearCallingIdentity();
672659
// Binder.getCallingPid() can be 0 for an oneway call from the remote process.
673660
// If it's the case, use PID from the ConnectionRequest.
674661
int pid = (callingPid != 0) ? callingPid : request.pid;
675662
try {
663+
676664
MediaSessionManager.RemoteUserInfo remoteUserInfo =
677665
new MediaSessionManager.RemoteUserInfo(request.packageName, pid, uid);
666+
@Nullable MediaSessionImpl sessionImpl = this.sessionImpl.get();
678667
boolean isTrustedForMediaControl =
679668
sessionImpl != null
680669
&& MediaSessionManager.getSessionManager(sessionImpl.getContext())

libraries/session/src/main/java/androidx/media3/session/SessionUtil.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)