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

Commit c83a23a7 authored by Orion Hodson's avatar Orion Hodson Committed by Android (Google) Code Review
Browse files

Merge "Revert "MediaSession2 API set for audio focus handling""

parents d4842c1d 44fe611a
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.media.AudioAttributes;
import android.media.IMediaSession2Callback;
import android.media.MediaItem2;
import android.media.MediaPlayerInterface;
@@ -179,18 +180,20 @@ public class MediaSession2Impl implements MediaSession2Provider {
        return mSessionStub.getControllers();
    }

    @Override
    public void setAudioAttributes_impl(AudioAttributes attributes) {
        // implement
    }

    @Override
    public void setAudioFocusRequest_impl(int focusGain) {
        mAudioFocusType = focusGain;
        // implement
    }

    @Override
    public void play_impl() {
        ensureCallingThread();
        ensurePlayer();
        if (!gainAudioFocus()) {
           // TODO: implement
        }
        mPlayer.play();
    }

@@ -349,13 +352,6 @@ public class MediaSession2Impl implements MediaSession2Provider {
        mSessionStub.notifyPlaybackStateChangedNotLocked(state);
    }

    private boolean gainAudioFocus() {
        // implement
        // int res = mAudioManager.requestAudioFocus(mFocusRequest.build());
        // return res == AUDIOFOCUS_REQUEST_GRANTED;
        return false;
    }

    Context getContext() {
        return mContext;
    }