38 Commits

Author SHA1 Message Date
tonihei
edbc2046e2 Clean-up manifest merge attributes.
1. Remove tools:replace in manifest files. This attribute is only needed to establish priority when two manifests are merged and have the same attribute with different values.
As this is not happening here, the attributes can be removed.

2. Some BUILD files also define a deprecated manifest merge strategy different from the android default merge strategy. For consistency these are set to "android'.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158075128
2017-06-06 16:38:45 +01:00
tonihei
4359d44331 Rename CronetEngineFactory to CronetEngineWrapper
In addition, the class now accepts available Cronet instances and returns the
source of the current CronetEngine.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156185701
2017-05-17 16:48:07 +01:00
ojw28
785fc76124 Delete gcore_versions.bzl 2017-05-10 22:17:39 -07:00
tonihei
d33a6b49f0 User-defined fallback if Cronet is not available
When using the CronetEngine.Builder class, it automatically selects the
Cronet version preferring higher version codes and falling back to a Java
Http implementation if no native or GMSCore version is available.

This version selection has now been moved into the CronetEngineFactory
class to always prefer GMSCore over natively bundled versions. We also
ignore the Cronet internal Java implementation. Instead, users of
CronetDataSourceFactory can provide their own fallback factory. If none is
provided, we use DefaultHttpDataSourceFactory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154821040
2017-05-04 20:48:59 +01:00
tonihei
94ffbb2b6a Support for Cronet from GMSCore (Blaze only)
The blaze BUILD file for the Cronet extension now has three options:
Using native bundled Cronet libs, using GMSCore, or using whichever is newer.
The GMSCore version is preselected (as it is the smallest), but other variants
may be used by uncommenting the respective lines.

The API is the same for all cases and the CronetEngine.Builder automatically
selects the newest option or falls back to default http.

To avoid that apps using this extension need to add a dependency to Cronet
themselves, I added a CronetEngineFactory to the Exoplayer extension.

Gradle builds can't be supported (as far as I can see), as the GMSCore Cronet
version is first party only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154812029
2017-05-04 20:46:44 +01:00
tonihei
da1b55ed4c NullPointerException in CronetDataSource constructor
When calling CronetDataSourceFactory.createDataSourceInteral, a null pointer
is passed as clock to the CronetDataSource constructor which in turn throws a
NullPointerException. Can be prevented by using other constructor without
clock parameter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153470874
2017-04-18 19:45:50 +01:00
olly
8be85d4d2f Consolidate version codes in root gradle file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153453768
2017-04-18 19:42:27 +01:00
olly
382ba7ecf0 Generate combined Javadoc
Notes:
- Now only generating a single module Javadoc task for the
  release variant.
- Combined Javadoc now includes extensions. VP9 is excluded
  for now since it's failing for an unknown reason.

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150865589
2017-03-22 19:11:28 +00:00
olly
88e74ef381 Generate Javadoc for each module individually
Notes:
- The VP9 one is failing claiming that the util package
  doesn't exist and that LibraryLoader cannot be found.
  Unsure why, since it appears to be setup exactly like
  other extensions (e.g. Opus) that does work.
- @link across modules will not work when generating
  Javadoc for a single module. This is WAI. I subsequent
  change will add an aggregated Javadoc generator that
  will generate Javadoc for all modules together and
  apply cross module @link correctly.

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150864273
2017-03-22 19:10:15 +00:00
olly
ce55d1a712 Modularize ExoPlayer steps 1 + 2.
1. Move entire library from v2/library/ to v2/library/core
2. Add v2/library/all that depends on v2/library/core

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150455693
2017-03-22 18:49:30 +00:00
olly
204537ed40 Pre-modularization cleanup
- Use a variable for the (default) minSdkVersion. There will
  be more modules that need it, and it'll be easier to manage
  if it's in one place.

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150050663
2017-03-15 15:44:46 +00:00
bachinger
aede0f894d Propagate updates of default header fields of the HttpDataSource.BaseFactory to HttpDataSource instances.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149780233
2017-03-13 15:54:10 +00:00
olly
1eede5d5bb Fix gradle/proguard setup
- Add proguard rules for libraries/extensions into .aar files
- Add proguard rules to retain CEA608/708 decoder constructors
- Remove lots of default config from gradle files
- Remove disabling of abort on lint error
- Enable optimizations on release builds of demo app

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144350233
2017-01-13 17:27:25 +00:00
olly
9d48d4e486 Support setting default headers on HttpDataSource.Factory's
Issue: #2166

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143703258
2017-01-05 21:57:36 +00:00
mef
dbfb187b6a [Cronet] Replace usage of deprecated UrlRequestException with CronetException.
- Errors reported by native stack use org.chromium.net.NetworkException class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143475649
2017-01-04 23:07:45 +00:00
mgersh
cbf5988803 Switch to Cronet 56_0_2924_0
This is the second CL in the 3 CL process to switch Cronet versions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140074017
2016-11-25 20:18:32 +00:00
cchiappini
ba49f51380 Cronet README fix
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140043801
2016-11-25 20:18:32 +00:00
andrewlewis
77715fbfbe Fix some analysis warnings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139901449
2016-11-25 20:18:32 +00:00
olly
4846146827 Fix internal build to use new Cronet jars
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139803684
2016-11-21 19:14:06 +00:00
olly
aa1002a0d6 Rollback "Add REQUIRE_HTTPS flag"
*** Reason for rollback ***

Flag doesn't enforce what it says it enforces, due to redirects

*** Original change description ***

Add REQUIRE_HTTPS flag

Note that it's not possible for the library to enforce that
the flag is adhered to, since it's possible for applications
to inject custom implementations of DataSource (there's no
requirement they even extend HttpDataSource for network
requesting implementations). It's possible for applications
to replace pretty much anything in the library, so there's
no other place we could put the flag where we could make
this guarantee. Hence this is a best-effort that will work
when...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136583459
2016-10-19 17:00:03 +01:00
olly
1cfc432bb8 Add REQUIRE_HTTPS flag
Note that it's not possible for the library to enforce that
the flag is adhered to, since it's possible for applications
to inject custom implementations of DataSource (there's no
requirement they even extend HttpDataSource for network
requesting implementations). It's possible for applications
to replace pretty much anything in the library, so there's
no other place we could put the flag where we could make
this guarantee. Hence this is a best-effort that will work
when using HttpDataSource implementations that we provide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136500947
2016-10-19 17:00:03 +01:00
kapishnikov
d3f78e4808 Deprecate call to new UrlRequest.Builder(...)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136399474
2016-10-19 16:59:38 +01:00
olly
6acf59c4fc Fix Widevine L3 provisioning in V2
1. HttpMediaDrmCallback.executeProvisionRequest needs to specify
   an empty byte[], else we do a GET instead of a POST.
2. Content-Type should not be set when making the provision
   request, since there's no body.
3. DataSource implementations must correctly handle a non-null
   body with zero length. CronetDataSource was not handling this
   case. DefaultHttpDataSource was, but made a code modification
   to make it a little clearer. OkHttpDataSource seems to handle
   the case correctly, and it doens't look like the code can be
   made clearer.

Issue #1925

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136042641
2016-10-14 10:42:43 +01:00
olly
94c7ee7252 Cronet - Skip if server doesn't support range requests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135819142
2016-10-14 10:42:43 +01:00
olly
907b9bf4f6 Sanitize threading in CronetDataSource
- Move nearly all logic onto the calling thread (i.e. the thread
  calling open/read/close), to make threading correctness more
  obvious.
- Document which variables are read/written from which thread, and
  why the call sequences are safe.
- Fix thread safety issue that I think could probably cause data
  corruption in the case of a read timeout followed by another
  request into the DataSource.

Also:

- Relaxed content length checking to be consistent with the other
  http DataSource implementations, and avoided parsing the headers
  where they're not used.
- Fixed missing generics in CronetDataSourceFactory.
- Added TODO to work with servers that don't support partial range
  requests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135702217
2016-10-11 18:16:28 +01:00
olly
97020e0bab CronetDataSource: Fix getContentLength logging
This is a minor cleanup. The main thing it fixes is that
the "Inconsistent headers" and "Unexpected Content-Range"
log messages were printing List<String> objects, rather
than the actual headers they are supposed to print.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135378074
2016-10-11 18:16:28 +01:00
olly
d95baa3ee9 CronetDataSource: Fix thread safety issue with requestProperties
The access in fillCurrentRequestPostBody wasn't protected with
synchronization. Furthermore, just synchronizing it wouldn't be
sufficient, since what we really need to check is whether the
Content-Type header has been added to the UrlRequest.Builder.
The contents of requestProperties may have changed between the
headers being added to UrlRequest.Builder and the call to
fillCurrentRequestPostBody.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135376904
2016-10-11 18:16:28 +01:00
olly
661b14020e Partial cleanup of CronetDataSource II
- Allow null Content-Type in response headers.
- Inline validateResponse, just because it makes it clearer
  what thread it's being executed on when inlined.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135375063
2016-10-11 18:16:28 +01:00
olly
ba56f9165c Partial cleanup of CronetDataSource
- Fix bug in getCurrentRequestStatus where we weren't
  blocking on the condition variable.
- Make methods static where possible.
- Clean up getUri implementation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135373586
2016-10-11 18:16:28 +01:00
olly
5803b2538d No-op reorder of CronetDataSource methods
This change is a no-op reodering, as a precursor to
further cleanup. The public methods are grouped by
the class/interface they implement. The private methods
are ordered with things that will become static in
a subsequent change at the bottom.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135372629
2016-10-11 18:16:28 +01:00
olly
b3c6f1caae Finish cleaning DataSource implementations.
- Enfroce read returns 0 if readLength==0 everywhere.
- Fixes and simplifications for CronetDataSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135138232
2016-10-04 23:42:55 +01:00
falhassen
f2cf086d76 Fix content length calculation for gzipped files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134011959
2016-09-28 11:25:34 +01:00
mgersh
e20d7034c7 Switch to Cronet 55_0_2860_0
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133850026
2016-09-28 11:24:55 +01:00
eguven
06a644eccd DataSourceException: Used to specify a DataSource error.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132053698
2016-09-02 16:20:06 +01:00
eguven
860c6588c0 created DefaultHttpDataSourceFactory
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131931668
2016-09-02 16:15:18 +01:00
olly
a779eabdc5 Update SDK / Tools.
- Centralise compileSdkVersion, targetSdkVersion and
  buildToolsVersion in a single place for gradle.
- Bump compileSdkVersion and targetSdkVersion to 24.
- Bump com.android.tools.build version to re-enable
  instant start.
- Bump targetSdkVersion in manifests (needed for
  internal builds).
- Use standard expandable_list_item from Android in
  the demo app, since ours doesn't look right when
  targeting API level 24. We were also setting the
  theme on the wrong element in the manifest, so I'm
  removing that line.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131929216
2016-09-02 16:12:55 +01:00
olly
9adce6b007 Make sure Cronet extension/tests are pushed to GitHub
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131825185
2016-09-02 16:08:00 +01:00
cchiappini
4df63314d4 Create Cronet extension in v2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131393395
2016-08-31 15:25:31 +01:00