diff --git a/RELEASENOTES.md b/RELEASENOTES.md index bcf4aa524c..3f5a7e28ec 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -43,15 +43,6 @@ * Rename `DecoderCounters#inputBufferCount` to `queuedInputBufferCount`. * Make `SimpleExoPlayer.renderers` private. Renderers can be accessed via `ExoPlayer.getRenderer`. - * Enable support for Android platform diagnostics via - `MediaMetricsManager`. ExoPlayer will forward playback events and - performance data to the platform, which helps to provide system - performance and debugging information on the device. This data may also - be collected by Google - [if sharing usage and diagnostics data is enabled](https://support.google.com/accounts/answer/6078260) - by the user of the device. Apps can opt-out of contributing to platform - diagnostics for ExoPlayer with - `ExoPlayer.Builder.setUsePlatformDiagnostics(false)`. * Updated some `AnalyticsListener.EventFlags` constant values to match values in `Player.EventFlags`. * Split `AnalyticsCollector` into an interface and default implementation diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java index 0415488b1e..c8d1387962 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java @@ -456,7 +456,6 @@ public interface ExoPlayer extends Player { /* package */ long releaseTimeoutMs; /* package */ long detachSurfaceTimeoutMs; /* package */ boolean pauseAtEndOfMediaItems; - /* package */ boolean usePlatformDiagnostics; /* package */ boolean buildCalled; /** @@ -497,7 +496,6 @@ public interface ExoPlayer extends Player { *
If enabled, the player will use the {@link android.media.metrics.MediaMetricsManager} to - * create a {@link android.media.metrics.PlaybackSession} and forward playback events and - * performance data to this session. This helps to provide system performance and debugging - * information for media playback on the device. This data may also be collected by Google if sharing usage and diagnostics - * data is enabled by the user of the device. - * - * @param usePlatformDiagnostics Whether the player reports diagnostics data to the Android - * platform. - * @return This builder. - * @throws IllegalStateException If {@link #build()} has already been called. - */ - public Builder setUsePlatformDiagnostics(boolean usePlatformDiagnostics) { - checkState(!buildCalled); - this.usePlatformDiagnostics = usePlatformDiagnostics; - return this; - } - /** * Sets the {@link Clock} that will be used by the player. Should only be set for testing * purposes. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index 38e7da309c..d8edb6f1be 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -56,7 +56,6 @@ import com.google.android.exoplayer2.PlayerMessage.Target; import com.google.android.exoplayer2.Renderer.MessageType; import com.google.android.exoplayer2.analytics.AnalyticsCollector; import com.google.android.exoplayer2.analytics.AnalyticsListener; -import com.google.android.exoplayer2.analytics.MediaMetricsListener; import com.google.android.exoplayer2.analytics.PlayerId; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.audio.AudioRendererEventListener; @@ -307,11 +306,7 @@ import java.util.concurrent.TimeoutException; playbackInfoUpdateHandler.post(() -> handlePlaybackInfo(playbackInfoUpdate)); playbackInfo = PlaybackInfo.createDummy(emptyTrackSelectorResult); analyticsCollector.setPlayer(this.wrappingPlayer, applicationLooper); - PlayerId playerId = - Util.SDK_INT < 31 - ? new PlayerId() - : Api31.registerMediaMetricsListener( - applicationContext, /* player= */ this, builder.usePlatformDiagnostics); + PlayerId playerId = Util.SDK_INT < 31 ? new PlayerId() : Api31.createPlayerId(); internalPlayer = new ExoPlayerImplInternal( renderers, @@ -3073,17 +3068,9 @@ import java.util.concurrent.TimeoutException; private Api31() {} @DoNotInline - public static PlayerId registerMediaMetricsListener( - Context context, ExoPlayerImpl player, boolean usePlatformDiagnostics) { - @Nullable MediaMetricsListener listener = MediaMetricsListener.create(context); - if (listener == null) { - Log.w(TAG, "MediaMetricsService unavailable."); - return new PlayerId(LogSessionId.LOG_SESSION_ID_NONE); - } - if (usePlatformDiagnostics) { - player.addAnalyticsListener(listener); - } - return new PlayerId(listener.getLogSessionId()); + public static PlayerId createPlayerId() { + // TODO: Create a MediaMetricsListener and obtain LogSessionId from it. + return new PlayerId(LogSessionId.LOG_SESSION_ID_NONE); } } }