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

Commit a1d5e0e9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaPlayer2: add Context to create MediaPlayer2"

parents c4cfbf48 ae4ff743
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -242,8 +242,8 @@ public abstract class MediaPlayer2 implements SubtitleController.Listener
     *
     *
     * @return A MediaPlayer2 object created
     * @return A MediaPlayer2 object created
     */
     */
    public static final MediaPlayer2 create() {
    public static final MediaPlayer2 create(Context context) {
        return new MediaPlayer2Impl();
        return new MediaPlayer2Impl(context);
    }
    }


    private static final String[] decodeMediaPlayer2Uri(String location) {
    private static final String[] decodeMediaPlayer2Uri(String location) {
+4 −1
Original line number Original line Diff line number Diff line
@@ -93,6 +93,8 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {


    private final static String TAG = "MediaPlayer2Impl";
    private final static String TAG = "MediaPlayer2Impl";


    private Context mContext;

    private long mNativeContext; // accessed by native methods
    private long mNativeContext; // accessed by native methods
    private long mNativeSurfaceTexture;  // accessed by native methods
    private long mNativeSurfaceTexture;  // accessed by native methods
    private int mListenerContext; // accessed by native methods
    private int mListenerContext; // accessed by native methods
@@ -149,7 +151,8 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
     * to free the resources. If not released, too many MediaPlayer2Impl instances may
     * to free the resources. If not released, too many MediaPlayer2Impl instances may
     * result in an exception.</p>
     * result in an exception.</p>
     */
     */
    public MediaPlayer2Impl() {
    public MediaPlayer2Impl(Context context) {
        mContext = context;
        mHandlerThread = new HandlerThread("MediaPlayer2TaskThread");
        mHandlerThread = new HandlerThread("MediaPlayer2TaskThread");
        mHandlerThread.start();
        mHandlerThread.start();
        Looper looper = mHandlerThread.getLooper();
        Looper looper = mHandlerThread.getLooper();