/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.exoplayer2.demo;

import android.app.Application;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.util.Util;

/**
 * Placeholder application to facilitate overriding Application methods for debugging and testing.
 */
public class DemoApplication extends Application {

  protected String userAgent;

  @Override
  public void onCreate() {
    super.onCreate();
    userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
  }

  public DataSource.Factory buildDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultDataSourceFactory(this, bandwidthMeter,
        buildHttpDataSourceFactory(bandwidthMeter));
  }

  public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
  }

  public boolean useExtensionRenderers() {
    return BuildConfig.FLAVOR.equals("withExtensions");
  }

}

@@ -752,77 +752,8 @@
 ce;%0A
-import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;%0A
 impo
@@ -950,32 +950,96 @@
 HttpDataSource;%0A
+import com.google.android.exoplayer2.upstream.TransferListener;%0A
 import com.googl
@@ -1377,32 +1377,79 @@
 yerDemo%22);%0A  %7D%0A%0A
+  /** Returns a %7B@link DataSource.Factory%7D. */%0A
   public DataSou
@@ -1487,42 +1487,51 @@
 ory(
-DefaultBandwidthMeter bandwidthMet
+TransferListener%3C? super DataSource%3E listen
 er) 
@@ -1582,31 +1582,17 @@
 is, 
-bandwidthMeter,%0A       
+listener,
  bui
@@ -1615,28 +1615,22 @@
 Factory(
-bandwidthMet
+listen
 er));%0A  
@@ -1624,32 +1624,83 @@
 istener));%0A  %7D%0A%0A
+  /** Returns a %7B@link HttpDataSource.Factory%7D. */%0A
   public HttpDat
@@ -1746,42 +1746,58 @@
 ory(
-DefaultBandwidthMeter bandwidthMet
+%0A      TransferListener%3C? super DataSource%3E listen
 er) 
@@ -1857,20 +1857,14 @@
 nt, 
-bandwidthMet
+listen
 er);

Generalize parameter type in DemoApplication build methods