mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
In DemoUtil, don't set cookie handler when using HttpEngineDataSource.
HttpEngine does not support cookie storage. #cherrypick PiperOrigin-RevId: 646084702
This commit is contained in:
parent
938fac4161
commit
bb568b5150
@ -106,7 +106,6 @@ public final class DemoUtil {
|
|||||||
}
|
}
|
||||||
context = context.getApplicationContext();
|
context = context.getApplicationContext();
|
||||||
if (Build.VERSION.SDK_INT >= 34) {
|
if (Build.VERSION.SDK_INT >= 34) {
|
||||||
setCookieHandler();
|
|
||||||
HttpEngine httpEngine = new HttpEngine.Builder(context).build();
|
HttpEngine httpEngine = new HttpEngine.Builder(context).build();
|
||||||
httpDataSourceFactory =
|
httpDataSourceFactory =
|
||||||
new HttpEngineDataSource.Factory(httpEngine, Executors.newSingleThreadExecutor());
|
new HttpEngineDataSource.Factory(httpEngine, Executors.newSingleThreadExecutor());
|
||||||
@ -122,15 +121,11 @@ public final class DemoUtil {
|
|||||||
}
|
}
|
||||||
// The device doesn't support HttpEngine or we don't want to allow Cronet, or we failed to
|
// The device doesn't support HttpEngine or we don't want to allow Cronet, or we failed to
|
||||||
// instantiate a CronetEngine.
|
// instantiate a CronetEngine.
|
||||||
setCookieHandler();
|
|
||||||
httpDataSourceFactory = new DefaultHttpDataSource.Factory();
|
|
||||||
return httpDataSourceFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setCookieHandler() {
|
|
||||||
CookieManager cookieManager = new CookieManager();
|
CookieManager cookieManager = new CookieManager();
|
||||||
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
|
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
|
||||||
CookieHandler.setDefault(cookieManager);
|
CookieHandler.setDefault(cookieManager);
|
||||||
|
httpDataSourceFactory = new DefaultHttpDataSource.Factory();
|
||||||
|
return httpDataSourceFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a {@link DataSource.Factory}. */
|
/** Returns a {@link DataSource.Factory}. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user