Remove DemoUtil.ALLOW_CRONET_FOR_NETWORKING
This boolean only exists to be changed in source, but it is now used as part of a 3-way fallback logic (since adding `HttpEngine` integration), so it's not really more convenient or clearer to change this constant than just hack the code of `getHttpDataSourceFactory` directly. PiperOrigin-RevId: 677834348
This commit is contained in:
parent
b4436c523c
commit
869a91bba8
@ -50,16 +50,6 @@ public final class DemoUtil {
|
||||
|
||||
public static final String DOWNLOAD_NOTIFICATION_CHANNEL_ID = "download_channel";
|
||||
|
||||
/**
|
||||
* Whether the demo application uses Cronet for networking when {@link HttpEngine} is not
|
||||
* supported. Note that Cronet does not provide automatic support for cookies
|
||||
* (https://github.com/google/ExoPlayer/issues/5975).
|
||||
*
|
||||
* <p>If set to false, the {@link DefaultHttpDataSource} is used with a {@link CookieManager}
|
||||
* configured in {@link #getHttpDataSourceFactory} when {@link HttpEngine} is not supported.
|
||||
*/
|
||||
private static final boolean ALLOW_CRONET_FOR_NETWORKING = true;
|
||||
|
||||
private static final String TAG = "DemoUtil";
|
||||
private static final String DOWNLOAD_CONTENT_DIRECTORY = "downloads";
|
||||
|
||||
@ -114,16 +104,13 @@ public final class DemoUtil {
|
||||
new HttpEngineDataSource.Factory(httpEngine, Executors.newSingleThreadExecutor());
|
||||
return httpDataSourceFactory;
|
||||
}
|
||||
if (ALLOW_CRONET_FOR_NETWORKING) {
|
||||
@Nullable CronetEngine cronetEngine = CronetUtil.buildCronetEngine(context);
|
||||
if (cronetEngine != null) {
|
||||
httpDataSourceFactory =
|
||||
new CronetDataSource.Factory(cronetEngine, Executors.newSingleThreadExecutor());
|
||||
return httpDataSourceFactory;
|
||||
}
|
||||
}
|
||||
// The device doesn't support HttpEngine or we don't want to allow Cronet, or we failed to
|
||||
// instantiate a CronetEngine.
|
||||
// The device doesn't support HttpEngine and we failed to instantiate a CronetEngine.
|
||||
CookieManager cookieManager = new CookieManager();
|
||||
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
|
||||
CookieHandler.setDefault(cookieManager);
|
||||
|
Loading…
x
Reference in New Issue
Block a user