160 Commits

Author SHA1 Message Date
olly
e98f5f34ce Fix gradle conflict resolution for Cronet tests
This resolves the following constraint resolution issue when running our release script:

> Cannot find a version of 'org.chromium.net:cronet-api' that satisfies the version constraints:
    Dependency path 'com.google.android.exoplayer:extension-cronet:unspecified' --> 'com.google.android.gms:play-services-cronet:17.0.0' --> 'org.chromium.net:cronet-api:72.3626.96'
    Constraint path 'com.google.android.exoplayer:extension-cronet:unspecified' --> 'org.chromium.net:cronet-api:{strictly 72.3626.96}' because of the following reason: debugRuntimeClasspath uses version 72.3626.96
    Dependency path 'com.google.android.exoplayer:extension-cronet:unspecified' --> 'org.chromium.net:cronet-embedded:76.3809.111' --> 'org.chromium.net:cronet-common:76.3809.111' --> 'org.chromium.net:cronet-api:76.3809.111'

#minor-release

PiperOrigin-RevId: 355414968
2021-02-04 00:23:55 +00:00
olly
35b99d634f Make Cronet extension depend only on common
This also moves DefaultHttpDataSource to common, which seems
sensible, else non-player components that need a DataSource
don't have any useful concrete implementations. We should
think about moving some of the other concrete implementations
to common as well.

PiperOrigin-RevId: 354738925
2021-02-01 18:11:23 +00:00
christosts
3b08a792bb Fix bug in CronetDataSource
This change fixes a bug in CronetDataSource when it makes a Range
request but the server does not support Range requests and returns the
entire resource. Before the fix, the CronetDataSource would read more
bytes than the intended range.

PiperOrigin-RevId: 353614477
2021-01-25 15:37:08 +00:00
olly
bfc736986e Migrate CronetDataSourceFactory to DefaultHttpDataSource.Factory
We normally wouldn't do this kind of thing, given CronetDataSourceFactory is
deprecated, but it's needed to change the cronet --> core dependency to a
cronet --> common dependency.

PiperOrigin-RevId: 353609198
2021-01-25 15:36:49 +00:00
christosts
0a3542e50e Add contract test for CronetDataSource
PiperOrigin-RevId: 353290124
2021-01-25 15:35:59 +00:00
olly
2a5f6d8f62 Improve user-agent configuration
- Support setting the user-agent in CronetDataSource
- Support setting the default user-agent in CronetEngineWrapper
- Use the underlying network stack's default user-agent by
  default. Many applications will configure the underlying
  CronetEngine or OkHttpClient with a user-agent that they
  expect to be used throughout their app, so always overriding
  this with our own default, on reflection, is not the best
  thing to do!

Issue: #8395
PiperOrigin-RevId: 350921963
2021-01-11 18:04:43 +00:00
Oliver Woodman
953e4e89e2 Merge pull request #8414 from tidoemanuele:tidoemanuele-improve-non-2xx-message
PiperOrigin-RevId: 350797551
2021-01-08 19:09:15 +00:00
bachinger
62720858ed Make CronetDataSourceFactory an inner class of CronetDataSource
#exofixit

PiperOrigin-RevId: 348444280
2020-12-23 22:51:38 +00:00
bachinger
a335c96450 Deprecate HttpDataSource.Factory.getDefaultRequestProperties
#exofixit

PiperOrigin-RevId: 347375323
2020-12-17 11:25:52 +00:00
olly
104ad64b76 Change CronetDataSource.buildRequestBuilder method to protected.
This allows overriding the implementation of building the UrlRequest
from dataSpec when necessary

PiperOrigin-RevId: 345149165
2020-12-03 17:10:35 +00:00
olly
2fbad2105e Make special exception for cleartext-not-permitted
#exofixit

PiperOrigin-RevId: 344246408
2020-11-27 11:07:07 +00:00
olly
4ff7eb4905 Fix CronetDataSource handling of 200 response for range request
Issue: #8090
#minor-release
PiperOrigin-RevId: 342638922
2020-11-16 16:50:58 +00:00
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
olly
5a009ab476 Remove references to cross-protocol redirects for Cronet
There's no option to enable them. This is probably a copy/paste error
from DefaultHttpDataSourceFactory.

PiperOrigin-RevId: 331334263
2020-09-12 21:05:18 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
478f59fd08 Replace ExoPlayer's functional types with Guava alternatives
This removes Supplier, Function and Predicate. Consumer is kept because
Guava doesn't have an equivalent (Java 8 does, but we can't use that
yet).

#exofixit

PiperOrigin-RevId: 323324392
2020-07-27 23:59:25 +01:00
olly
576ef82191 Remove explicit use of Robolectric PAUSED looper mode
It's now the default everywhere, so there's no need to specify it
explicitly.

PiperOrigin-RevId: 322153319
2020-07-24 10:41:00 +01:00
ibaker
23d680a4b4 Suppress deprecation warnings in deprecated places
PiperOrigin-RevId: 320970814
2020-07-24 10:30:53 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
Ian Baker
8b89a5ed6d Merge pull request #6861 from chrisfillmore:feature/responseBodyForInvalidResponseCodeException_6853
PiperOrigin-RevId: 314105612
2020-06-01 15:00:08 +01:00
Oliver Woodman
b1b93069a9 Merge pull request #7324 from tpiDev:cronet/migrate-to-play-services-17-0-0
PiperOrigin-RevId: 310115628
2020-05-06 20:57:06 +01:00
olly
dcae3c2609 CronetDataSource: Use standard InterruptedIOException
PiperOrigin-RevId: 309710359
2020-05-05 18:37:03 +01:00
Tomasz Pieszko
2cae3b3905 [MOD] Use Cronet from Play Services, as default instead of using embedded one. It lets to reduce APK size ~8MB. 2020-05-04 11:18:43 +02:00
Tomasz Pieszko
e4f6666cb2 [MOD] Use Cronet from Play Services, as default instead of using embedded one. It lets to reduce APK size ~8MB. 2020-05-04 11:12:13 +02:00
ibaker
ece8d22357 Remove a suppression introduced by the checker-framework 3.3.0 upgrade
Update the comment on a suppression of Field.get(null) which is safe
but blocked by the checker.

These suppressions were introduced in d1e0572448

PiperOrigin-RevId: 307036441
2020-04-20 13:28:07 +01:00
olly
d1e0572448 Suppress warnings in preparation for Checker Framework 3.3.0 upgrade.
PiperOrigin-RevId: 305810757
2020-04-15 17:36:11 +01:00
ibaker
8df6a4b301 Remove nullness warning suppressions from Matcher.group
These were introduced in c7164a30a0

In each case I checked that the groups are not optional,
so if they match they must be non-null.

PiperOrigin-RevId: 305213293
2020-04-07 13:39:13 +01:00
ibaker
c7164a30a0 Suppress go/nullness warnings caused by Matcher#group(String) and Matcher#group(int)
This is required to align google3's stub (currently marked non-null) with Checker Framework's.

More information: go/matcher-nullness-lsc

Tested:
    TAP train for global presubmit queue
    http://test/OCL:303344687:BASE:303326748:1585344475427:29edc250
PiperOrigin-RevId: 303709053
2020-03-30 17:17:00 +01:00
olly
2f91c12f56 Drop prefix test- from test methods under v2/extensions
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300530329
2020-03-19 00:46:24 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
tonihei
ffdc5805bd Remove dependency on legacy Robolectric Looper mode
The default will soon change to Looper mode PAUSED. Some parts of our code
relies on the legacy behaviour when setting set SystemClock and expecting
pending messages to be delivered. With the new mode, we need to explicitly
request to idle the main looper so that pending messages can be delivered.

PiperOrigin-RevId: 297814964
2020-02-28 18:42:22 +00:00
Fillmore, Christopher
f288b3e6a8 Read response body in CronetDataSource for error response
Issue #6853
2020-02-21 11:27:11 -05:00
olly
1cbe3f72e6 DataSpec: Deprecate most constructors
Keeping (Uri) and (Uri, position, length) to avoid needing
Builder for the trivial case.

PiperOrigin-RevId: 294530226
2020-02-13 15:43:54 +00:00
olly
14d3ed09d5 Add DataSpec.Builder
PiperOrigin-RevId: 294518763
2020-02-13 15:43:35 +00:00
olly
719b34a9f8 Migrate static imports of org.mockito.Matchers to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2.

For more information see go/mockito-2-lsc

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:292555754:BASE:292543534:1580490509580:bfdfdd31
PiperOrigin-RevId: 292881633
2020-02-03 11:21:46 +00:00
christosts
5695bae9d8 Remove DataSpec.FLAG_ALLOW_ICY_METADATA
Remove the flag DataSpec.FLAG_ALLOW_ICY_METADATA. Instead, set the
header IcyHeaders.REQUEST_HEADER_ENABLE_METADATA_NAME in the DataSpec
httpRequestHeaders.

BUG:134034248
PiperOrigin-RevId: 270662676
2019-10-02 21:25:07 +01:00
christosts
260db03167 Use DataSpec request params in HttpDataSource impls
Include Dataspec.httpRequestHeaders in CronetDataSource,
and OkHttpDataSource. Updated documentation of
HttpDataSource.open() to suggest that it should set request
headers (in decreasing priority) from (1) the passed DataSpec,
(2) parameters set with setRequestProperty() and (3) default
parameters set in the HttpDataSource.Factory. No mechanism
has been put in place to enforce this.

PiperOrigin-RevId: 266895574
2019-09-05 10:48:45 +01:00
olly
52edbaa9a3 Update cronet and workmanager dependencies
PiperOrigin-RevId: 266803888
2019-09-05 10:48:45 +01:00
olly
2d0b10a73a Use constant to define androidx annotation version
PiperOrigin-RevId: 266801762
2019-09-05 10:45:08 +01:00
olly
a02237de20 Fix imports
PiperOrigin-RevId: 266676413
2019-09-01 22:03:52 +01:00
olly
f5c1e8b5e3 Add HttpDataSource.getResponseCode to provide the status code associated with the most recent HTTP response.
PiperOrigin-RevId: 266218104
2019-08-30 14:42:21 +01:00
tonihei
389eca6e07 Merge robolectric_testutils into testutils.
We no longer need two modules as AndroidX-Test takes care of the system
abstraction and we no longer have Robolectric Handler/Looper workarounds.

PiperOrigin-RevId: 262363201
2019-08-09 18:36:32 +01:00
tonihei
346f8e670a Turn on non-null-by-default for most extensions.
PiperOrigin-RevId: 261700729
2019-08-05 20:27:43 +01:00
olly
fb0481c520 Bump annotations dependency + update release notes
PiperOrigin-RevId: 261353271
2019-08-02 19:04:56 +01:00
olly
6f014749b3 Upgrade dependency versions
PiperOrigin-RevId: 261341256
2019-08-02 18:55:09 +01:00
olly
6606a4ff01 CronetDataSource: Fix invalid Javadoc tag
PiperOrigin-RevId: 257456890
2019-07-14 16:21:24 +01:00
olly
2f8bd42b0e Remove Utils.equals() check for object equality that is fragile.
PiperOrigin-RevId: 254046126
2019-06-21 18:21:22 +01:00
andrewlewis
b449269552 Remove Objects.equals use from CronetDataSource
Objects was added in API 19.

PiperOrigin-RevId: 253567490
2019-06-18 17:46:18 +01:00