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

Commit ecf55282 authored by Dongwon Kang's avatar Dongwon Kang Committed by Android (Google) Code Review
Browse files

Merge "Enable MediaComponents for development."

parents 9e2376eb 12bab67a
Loading
Loading
Loading
Loading
+54 −56
Original line number Diff line number Diff line
@@ -14,59 +14,57 @@
# limitations under the License.
#

# This package is excluded from build for now since APIs using this apk became hidden.
#
#LOCAL_PATH := $(call my-dir)
#ifneq ($(TARGET_BUILD_PDK),true) # Build MediaComponents only if this is not a PDK build.  MediaComponents won't
## build in PDK builds because frameworks/base/core/java is not available but
## IMediaSession2.aidl and IMediaController2.aidl are using classes from
## frameworks/base/core/java.
#
#include $(CLEAR_VARS)
#
#LOCAL_PACKAGE_NAME := MediaComponents
#LOCAL_MODULE_OWNER := google
#
## TODO: create a separate key for this package.
#LOCAL_CERTIFICATE := platform
#
## TODO: Use System SDK once public APIs are approved
## LOCAL_SDK_VERSION := system_current
#LOCAL_PRIVATE_PLATFORM_APIS := true
#
#LOCAL_SRC_FILES := \
#    $(call all-java-files-under, src) \
#    $(call all-Iaidl-files-under, src)
#
#LOCAL_PROGUARD_FLAG_FILES := proguard.cfg
#
#LOCAL_MULTILIB := first
#
#LOCAL_JAVA_LIBRARIES += androidx.annotation_annotation
#
## To embed native libraries in package, uncomment the lines below.
##LOCAL_MODULE_TAGS := samples
##LOCAL_JNI_SHARED_LIBRARIES := \
##    libaacextractor \
##    libamrextractor \
##    libflacextractor \
##    libmidiextractor \
##    libmkvextractor \
##    libmp3extractor \
##    libmp4extractor \
##    libmpeg2extractor \
##    liboggextractor \
##    libwavextractor \
#
## TODO: Remove dependency with other support libraries.
#LOCAL_STATIC_ANDROID_LIBRARIES += \
#    androidx.legacy_legacy-support-v4 \
#    androidx.appcompat_appcompat \
#    androidx.palette_palette
#LOCAL_USE_AAPT2 := true
#
#include $(BUILD_PACKAGE)
#
#endif  # ifneq ($(TARGET_BUILD_PDK),true)
#
#include $(call all-makefiles-under,$(LOCAL_PATH))
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_BUILD_PDK),true) # Build MediaComponents only if this is not a PDK build.  MediaComponents won't
# build in PDK builds because frameworks/base/core/java is not available but
# IMediaSession2.aidl and IMediaController2.aidl are using classes from
# frameworks/base/core/java.

include $(CLEAR_VARS)

LOCAL_PACKAGE_NAME := MediaComponents
LOCAL_MODULE_OWNER := google

# TODO: create a separate key for this package.
LOCAL_CERTIFICATE := platform

# TODO: Use System SDK once public APIs are approved
# LOCAL_SDK_VERSION := system_current
LOCAL_PRIVATE_PLATFORM_APIS := true

LOCAL_SRC_FILES := \
    $(call all-java-files-under, src) \
    $(call all-Iaidl-files-under, src)

LOCAL_PROGUARD_FLAG_FILES := proguard.cfg

LOCAL_MULTILIB := first

LOCAL_JAVA_LIBRARIES += androidx.annotation_annotation

# To embed native libraries in package, uncomment the lines below.
#LOCAL_MODULE_TAGS := samples
#LOCAL_JNI_SHARED_LIBRARIES := \
#    libaacextractor \
#    libamrextractor \
#    libflacextractor \
#    libmidiextractor \
#    libmkvextractor \
#    libmp3extractor \
#    libmp4extractor \
#    libmpeg2extractor \
#    liboggextractor \
#    libwavextractor \

# TODO: Remove dependency with other support libraries.
LOCAL_STATIC_ANDROID_LIBRARIES += \
    androidx.legacy_legacy-support-v4 \
    androidx.appcompat_appcompat \
    androidx.palette_palette
LOCAL_USE_AAPT2 := true

include $(BUILD_PACKAGE)

endif  # ifneq ($(TARGET_BUILD_PDK),true)

include $(call all-makefiles-under,$(LOCAL_PATH))
+6 −11
Original line number Diff line number Diff line
@@ -33,8 +33,7 @@ import android.media.MediaMetadata;
import android.media.MediaMetadata2;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer2;
import android.media.MediaPlayer2.MediaPlayer2EventCallback;
import android.media.MediaPlayer2.OnSubtitleDataListener;
import android.media.MediaPlayer2.EventCallback;
import android.media.MediaPlayer2Impl;
import android.media.Metadata;
import android.media.PlaybackParams;
@@ -733,12 +732,11 @@ public class VideoView2Impl extends BaseLayout
                    runnable.run();
                }
            };
            mMediaPlayer.setMediaPlayer2EventCallback(executor, mMediaPlayer2Callback);
            mMediaPlayer.registerEventCallback(executor, mMediaPlayer2Callback);

            mCurrentBufferPercentage = -1;
            mMediaPlayer.setDataSource(dsd);
            mMediaPlayer.setAudioAttributes(mAudioAttributes);
            mMediaPlayer.setOnSubtitleDataListener(mSubtitleListener);
            // we don't set the target state here either, but preserve the
            // target state that was there before.
            mCurrentState = STATE_PREPARING;
@@ -1106,10 +1104,10 @@ public class VideoView2Impl extends BaseLayout
        mInstance.addView(mMusicView, 0);
    }

    OnSubtitleDataListener mSubtitleListener =
            new OnSubtitleDataListener() {
    EventCallback mMediaPlayer2Callback =
            new EventCallback() {
                @Override
                public void onSubtitleData(MediaPlayer2 mp, SubtitleData data) {
                public void onSubtitleData(MediaPlayer2 mp, DataSourceDesc dsd, SubtitleData data) {
                    if (DEBUG) {
                        Log.d(TAG, "onSubtitleData(): getTrackIndex: " + data.getTrackIndex()
                                + ", getCurrentPosition: " + mp.getCurrentPosition()
@@ -1133,10 +1131,7 @@ public class VideoView2Impl extends BaseLayout
                        }
                    }
                }
            };

    MediaPlayer2EventCallback mMediaPlayer2Callback =
            new MediaPlayer2EventCallback() {
                @Override
                public void onVideoSizeChanged(
                        MediaPlayer2 mp, DataSourceDesc dsd, int width, int height) {
@@ -1169,7 +1164,7 @@ public class VideoView2Impl extends BaseLayout
                        extractTracks();
                    } else if (what == MediaPlayer2.MEDIA_INFO_PREPARED) {
                        this.onPrepared(mp, dsd);
                    } else if (what == MediaPlayer2.MEDIA_INFO_PLAYBACK_COMPLETE) {
                    } else if (what == MediaPlayer2.MEDIA_INFO_DATA_SOURCE_END) {
                        this.onCompletion(mp, dsd);
                    } else if (what == MediaPlayer2.MEDIA_INFO_BUFFERING_UPDATE) {
                        this.onBufferingUpdate(mp, dsd, extra);