Commit 0beff724 by tonihei Committed by Oliver Woodman

Remove onNetworkTypeChanged from AnalyticsListener.

It doesn't really serve a purpose and is not automatically triggered.
Apps need to trigger it manually through
AnalyticsCollector.notifyNetworkTypeChanged which is easy to forget.
Moreover, the current network type can be obtained by Util.getNetworkType
at any time when it's needed without the need for a listener.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199790033
parent f02788af
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package com.google.android.exoplayer2.analytics; package com.google.android.exoplayer2.analytics;
import android.net.NetworkInfo;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
...@@ -160,18 +159,6 @@ public class AnalyticsCollector ...@@ -160,18 +159,6 @@ public class AnalyticsCollector
} }
/** /**
* Notify analytics collector that the network type or connectivity changed.
*
* @param networkInfo The new network info, or null if no network connection exists.
*/
public final void notifyNetworkTypeChanged(@Nullable NetworkInfo networkInfo) {
EventTime eventTime = generatePlayingMediaPeriodEventTime();
for (AnalyticsListener listener : listeners) {
listener.onNetworkTypeChanged(eventTime, networkInfo);
}
}
/**
* Resets the analytics collector for a new media source. Should be called before the player is * Resets the analytics collector for a new media source. Should be called before the player is
* prepared with a new media source. * prepared with a new media source.
*/ */
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package com.google.android.exoplayer2.analytics; package com.google.android.exoplayer2.analytics;
import android.net.NetworkInfo;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
...@@ -314,14 +313,6 @@ public interface AnalyticsListener { ...@@ -314,14 +313,6 @@ public interface AnalyticsListener {
void onViewportSizeChange(EventTime eventTime, int width, int height); void onViewportSizeChange(EventTime eventTime, int width, int height);
/** /**
* Called when the type of the network connection changed.
*
* @param eventTime The event time.
* @param networkInfo The network info for the current connection, or null if disconnected.
*/
void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo);
/**
* Called when there is {@link Metadata} associated with the current playback time. * Called when there is {@link Metadata} associated with the current playback time.
* *
* @param eventTime The event time. * @param eventTime The event time.
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
*/ */
package com.google.android.exoplayer2.analytics; package com.google.android.exoplayer2.analytics;
import android.net.NetworkInfo;
import android.support.annotation.Nullable;
import android.view.Surface; import android.view.Surface;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -112,9 +110,6 @@ public abstract class DefaultAnalyticsListener implements AnalyticsListener { ...@@ -112,9 +110,6 @@ public abstract class DefaultAnalyticsListener implements AnalyticsListener {
public void onViewportSizeChange(EventTime eventTime, int width, int height) {} public void onViewportSizeChange(EventTime eventTime, int width, int height) {}
@Override @Override
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {}
@Override
public void onMetadata(EventTime eventTime, Metadata metadata) {} public void onMetadata(EventTime eventTime, Metadata metadata) {}
@Override @Override
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package com.google.android.exoplayer2.util; package com.google.android.exoplayer2.util;
import android.net.NetworkInfo;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
...@@ -369,11 +368,6 @@ public class EventLogger implements AnalyticsListener { ...@@ -369,11 +368,6 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {
logd(eventTime, "networkTypeChanged", networkInfo == null ? "none" : networkInfo.toString());
}
@Override
public void onUpstreamDiscarded(EventTime eventTime, MediaLoadData mediaLoadData) { public void onUpstreamDiscarded(EventTime eventTime, MediaLoadData mediaLoadData) {
logd(eventTime, "upstreamDiscarded", Format.toLogString(mediaLoadData.trackFormat)); logd(eventTime, "upstreamDiscarded", Format.toLogString(mediaLoadData.trackFormat));
} }
......
...@@ -94,7 +94,6 @@ public final class AnalyticsCollectorTest { ...@@ -94,7 +94,6 @@ public final class AnalyticsCollectorTest {
private static final int EVENT_READING_STARTED = 19; private static final int EVENT_READING_STARTED = 19;
private static final int EVENT_BANDWIDTH_ESTIMATE = 20; private static final int EVENT_BANDWIDTH_ESTIMATE = 20;
private static final int EVENT_VIEWPORT_SIZE_CHANGED = 21; private static final int EVENT_VIEWPORT_SIZE_CHANGED = 21;
private static final int EVENT_NETWORK_TYPE_CHANGED = 22;
private static final int EVENT_METADATA = 23; private static final int EVENT_METADATA = 23;
private static final int EVENT_DECODER_ENABLED = 24; private static final int EVENT_DECODER_ENABLED = 24;
private static final int EVENT_DECODER_INIT = 25; private static final int EVENT_DECODER_INIT = 25;
...@@ -671,7 +670,6 @@ public final class AnalyticsCollectorTest { ...@@ -671,7 +670,6 @@ public final class AnalyticsCollectorTest {
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
public void run(SimpleExoPlayer player) { public void run(SimpleExoPlayer player) {
player.getAnalyticsCollector().notifyNetworkTypeChanged(networkInfo);
player player
.getAnalyticsCollector() .getAnalyticsCollector()
.notifyViewportSizeChanged(/* width= */ 320, /* height= */ 240); .notifyViewportSizeChanged(/* width= */ 320, /* height= */ 240);
...@@ -686,7 +684,6 @@ public final class AnalyticsCollectorTest { ...@@ -686,7 +684,6 @@ public final class AnalyticsCollectorTest {
assertThat(listener.getEvents(EVENT_SEEK_STARTED)).containsExactly(PERIOD_0); assertThat(listener.getEvents(EVENT_SEEK_STARTED)).containsExactly(PERIOD_0);
assertThat(listener.getEvents(EVENT_SEEK_PROCESSED)).containsExactly(PERIOD_0); assertThat(listener.getEvents(EVENT_SEEK_PROCESSED)).containsExactly(PERIOD_0);
assertThat(listener.getEvents(EVENT_VIEWPORT_SIZE_CHANGED)).containsExactly(PERIOD_0); assertThat(listener.getEvents(EVENT_VIEWPORT_SIZE_CHANGED)).containsExactly(PERIOD_0);
assertThat(listener.getEvents(EVENT_NETWORK_TYPE_CHANGED)).containsExactly(PERIOD_0);
} }
private static TestAnalyticsListener runAnalyticsTest(MediaSource mediaSource) throws Exception { private static TestAnalyticsListener runAnalyticsTest(MediaSource mediaSource) throws Exception {
...@@ -1022,11 +1019,6 @@ public final class AnalyticsCollectorTest { ...@@ -1022,11 +1019,6 @@ public final class AnalyticsCollectorTest {
} }
@Override @Override
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {
reportedEvents.add(new ReportedEvent(EVENT_NETWORK_TYPE_CHANGED, eventTime));
}
@Override
public void onMetadata(EventTime eventTime, Metadata metadata) { public void onMetadata(EventTime eventTime, Metadata metadata) {
reportedEvents.add(new ReportedEvent(EVENT_METADATA, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_METADATA, eventTime));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment