Avoid using UserHandle.isSameApp in package check

SDK sandbox processes created from the sandbox package do not have the
uid of the package - they use a separate uid range instead. The current
check in MediaServer does not take this into account, which causes
MediaSession APIs to fail in the sandbox.

Instead, use the API PackageManagerService.isSameApp() that takes into
account the differences between sandbox package uid and sandbox process
uid.

Bug: 335660723
Test: atest SdkSandboxRestrictionsTest#testSandboxCanCreateMediaSession
Change-Id: I75d57721ba191f186e7c6a0bc4bc245dfaac86ea
1 file changed