Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9673f5fb authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Myles Watson
Browse files

Compare Session tokens for MediaControllers

Remove call to controlsSameSession in mocked MediaController and replace
them with a comparison of their session token to avoid hidden api usage.
Use AudioPlaybackConfiguration toString over hidden toLogFriendlyString.

Bug: 141947725
Test: Manual
Change-Id: I5701b6c54fdc4db64c289f0b9a61e69ad0584cee
parent 3ef429e2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -694,13 +694,13 @@ public class MediaPlayerList {
            boolean isActive = false;
            Log.v(TAG, "onPlaybackConfigChanged(): Configs list size=" + configs.size());
            for (AudioPlaybackConfiguration config : configs) {
                if (config.isActive() && (config.getAudioAttributes().getUsage()
                if (config.getPlayerState() == AudioPlaybackConfiguration.PLAYER_STATE_STARTED
                        && (config.getAudioAttributes().getUsage()
                            == AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE)
                        && (config.getAudioAttributes().getContentType()
                            == AudioAttributes.CONTENT_TYPE_SPEECH)) {
                    if (DEBUG) {
                        Log.d(TAG, "onPlaybackConfigChanged(): config="
                                 + AudioPlaybackConfiguration.toLogFriendlyString(config));
                        Log.d(TAG, "onPlaybackConfigChanged(): config=" + config);
                    }
                    isActive = true;
                }
+2 −2
Original line number Diff line number Diff line
@@ -215,14 +215,14 @@ public class MediaController {
     * Wrapper for MediaController.controlsSameSession(MediaController other)
     */
    public boolean controlsSameSession(MediaController other) {
        return mDelegate.controlsSameSession(other.getWrappedInstance());
        return mDelegate.getSessionToken().equals(other.getWrappedInstance().getSessionToken());
    }

    /**
     * Wrapper for MediaController.controlsSameSession(MediaController other)
     */
    public boolean controlsSameSession(android.media.session.MediaController other) {
        return mDelegate.controlsSameSession(other);
        return mDelegate.getSessionToken().equals(other.getSessionToken());
    }

    /**