Commit Graph

4740 Commits

Author SHA1 Message Date
Alex Dale
1defd1c7fc Merge "Correctly handle local display only for SRM version." 2020-09-09 03:38:48 +00:00
Alex Dale
f22cd20466 Enabled log formatting warnings.
[ Merge of http://go/wvgerrit/105025 ]

Clang and GCC allow for warnings against the arguments for printf-like
functions (e.i. LOGx).  These validate that the format type specified
in the format string match the corresponding argument type.

Most of the time, format specifer errors are benign; hence why they
haven't been seen as an error so far.  However, with the enabling of
specifier warnings and the enabling of warnings as errors on certain
platforms, these existing errors need to be addressed.

This CL enables format specifier warnings for most of the Widevine
code, with the OEMCrypto L3 implementation which has a single error
which requires a fix in the haystack code before being fixed in the
Widevine branch.

Strict format string warnings are not enabled for non-LP64 systems.

Bug: 137583127
Test: Compiled for Linux and Android
Change-Id: I051398332d31a20457b86563a90ad8f6d428445f
2020-09-08 15:46:15 -07:00
Rahul Frias
4fa369ad34 Do not store information for kLicenseTypeTemporary am: 315bf42c4f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12535604

Change-Id: I6f0041edac73a6efd3a6cefecfbd0a685c7d7ab5
2020-09-08 22:18:29 +00:00
Rahul Frias
315bf42c4f Do not store information for kLicenseTypeTemporary
[ Merge of http://go/wvgerrit/105624 ]

Temporary licenses do not allow for license information to be stored
in any form, whether it is usage information or persisting license
information. Information should not be stored even if can_persist is
set to true and a PST is specified as those are suggestions rather than
a requirement.

Bug: 167684104
Test: WV unit/integration tests
Change-Id: I141a2bd5de4d86f0e5f31fc8f0ea9e20710d6469
2020-09-07 18:50:13 -07:00
Alex Dale
b96b58628c Correctly handle local display only for SRM version.
[ Merge of http://go/wvgerrit/105343 ]

If a device only supports local display (eliminating the need for an
SRM version), then the CDM should treat this as no SRM version.

Bug: 166009716
Test: License request integration test
Change-Id: I2d9c3f98735563df6d7c7a287abab41bf0a8c513
2020-09-02 21:36:37 -07:00
Ben Lin
2ffa7f3bb1 Remove mediadrm/test/Android.bp file. am: e929a5dcdd
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12426378

Change-Id: Ief311b61b6dc0c56ea589e0b2aa2b001b6af14e7
2020-08-21 23:54:24 +00:00
Ben Lin
e929a5dcdd Remove mediadrm/test/Android.bp file.
The Blueprint file doesn't seem to be compatible with some 64-bit
targets (namely bertha_x86_64) - remove for now to stop build breakage.

Test: make -j32 libwvdrmdrmplugin_test
Bug: 165933287
Change-Id: I36d8238cc1a78eefef2ba2a06a4360ea46080349
2020-08-21 15:29:29 -07:00
Edwin Wong
51302613f7 Merge "Convert Android.mk to Android.bp" am: c64903759d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12381118

Change-Id: Ib93c37a699e7910dd318a3234e1d013dd4bc96bb
2020-08-21 17:31:27 +00:00
Edwin Wong
c64903759d Merge "Convert Android.mk to Android.bp" 2020-08-21 17:13:00 +00:00
Edwin Wong
307cf378a9 Convert Android.mk to Android.bp
This CL builds the Widevine drm services and libraries.
Soong makefile conversion for unit and integration
tests will be in a different CL.

This doc may help with the review:
https://docs.google.com/document/d/1lK3X9RFPwbbwewLNlS4TfSMhxIlPuAkHRnGcgwWpChU/edit?usp=sharing

Test: build
Test: Play Movies and Netflix streaming
Test: unit tests
  build_and_run_all_tests.sh
Test: gts
  ANDROID_BUILD_TOP= ./android-gts/tools/gts-tradefed run gts -m GtsMediaTestCases -t com.google.android.media.gts.MediaDrmTest

  atest GtsExoPlayerTestCases:com.google.android.exoplayer.gts.DashTest

Test: vts
  ANDROID_BUILD_TOP= PATH="$PWD/android-vts/tools:$PATH" vts-tradefed run commandAndExit vts --module VtsHalDrmV1_3Target

Bug: 162321744
Change-Id: I50c0fb2e8f28dfe7901587e3d3203542943e23b1
2020-08-19 14:54:47 -07:00
TreeHugger Robot
3faf2d7024 Merge "Test renewal against same and different server" am: 9ca0979e7f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12380233

Change-Id: I2763019a0df0c143c664de7552cb266e26b51e0e
2020-08-19 20:54:33 +00:00
TreeHugger Robot
9ca0979e7f Merge "Test renewal against same and different server" 2020-08-19 20:47:27 +00:00
Fred Gylys-Colwell
7604158d6f Test renewal against same and different server
Merge from Widevine repo of http://go/wvgerrit/102843

The test WvCdmEngineTest.LicenseRenewal is split into two tests. One
test verifies that the renewal may be fetched from the server
specified in the license. The second test verifies that the renewal
may be fetched from the same server that the license was fetched from.

These might be the same server, but when we run against an
experimental server, a staging server, or UAT Nightly, these
will be different.

Test: ran the tests
Bug: 141438127
Change-Id: Ia11441bd2ba0c6ddb264ee38bfcb5060b9ddb476
2020-08-19 20:45:33 +00:00
John W. Bruce
af60c6b247 Fix Undefined Behavior Around Enums am: 7f028d25c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12404605

Change-Id: If5509b1909d499ba484e6697895458957a03c923
2020-08-19 19:11:33 +00:00
John W. Bruce
7f028d25c8 Fix Undefined Behavior Around Enums
(This is a cherry-pick of http://go/wvgerrit/104184.)

UBSan has detected several places where our code tripped over what is
technically Undefined Behavior when handling enums, although in practice
any compiler would still generate safe code.

Some of these were places a variable was not being initialized and thus
was filled with garbage data. These have been fixed.

Understanding the rest depends on a bit of C++ trivia I had certainly
never heard before: An enum that doesn't specify its backing type will
frequently have a gap between the range of values the compiler will let
it take (which is limited only by the size of the backing type assigned
by the C++ standard) and the range of values for which the C++ standard
defines the behavior. (which is limited by the minimum number of bits
needed to hold the largest valid enumeration entry) So, for example, an
enum containing ten entries numbered 0 through 9 would be stored in
memory as an int and could thus take any value in the range of an int.
But it only takes 4 bits to represent the numbers 0 through 9. The
largest number that can be represented in 4 bits is 15. So reading the
value of a variable of this enum type when its stored value is outside
the range 0 to 15 is undefined behavior.

An enum that specifies its backing type is not subject to this because
it is defined behavior to access any value representable in the backing
type if one was explicitly specified.

If you think this sounds a bit silly, you'll be happy to know it doesn't
apply from C++17 onwards and most compilers generate code that handles
the undefined behavior values correctly.

Nonetheless, to appease UBSan and protect us from any compilers that
actually rely on this undefined behavior for optimizations, I have
defined backing types for all our enums. I have defaulted to the type
the compiler was already using (int32) and have deviated only where an
enum exists to be compared to or filled from a protobuf field and that
field in the protobuf is unsigned, in which case I used a uint32.

In the case of the CE CDM exported API, this also required changing our
enums from C-style to C++-style.

Bug: 163080356
Test: CE CDM Build & Unit Tests Pass even with UBSan
Test: Android Build & Tests
Change-Id: Id7e0064129e7c4d2827bb4a94825d144eeaacec8
2020-08-18 18:02:36 -07:00
Alex Dale
e9a6b6981f [automerger skipped] DO NOT MERGE Handle unlimited usage table capacity. am: 99335a6aa8 am: 601d910d17 -s ours am: fe06541507
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12266132

Change-Id: I71b48a64f2efeed173e82a70cbdaf4dd1dd0705f
2020-08-17 19:45:25 +00:00
Alex Dale
fe06541507 [automerger skipped] DO NOT MERGE Handle unlimited usage table capacity. am: 99335a6aa8 am: 601d910d17 -s ours
am skip reason: subject contains skip directive

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12266132

Change-Id: I6629b3ea2434acc913109641f6d3272425287f79
2020-08-17 19:31:06 +00:00
Alex Dale
601d910d17 DO NOT MERGE Handle unlimited usage table capacity. am: 99335a6aa8
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12266132

Change-Id: I25cb6ad05f466357fa4e2485a093ae8598bd5b51
2020-08-17 19:19:36 +00:00
Rahul Frias
7f683d5621 Merge "Log OEMCrypto_CloseSession error" am: 17e0562098
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12264983

Change-Id: Iae3448695d72d3a243cd7867e6e26985f35440b9
2020-08-13 02:06:08 +00:00
Rahul Frias
17e0562098 Merge "Log OEMCrypto_CloseSession error" 2020-08-13 01:49:35 +00:00
Alex Dale
5d783210af Merge "Log X-Google fields on failed HTTP requests." am: aa7ed24123
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12253154

Change-Id: I9ffed9f32caf4191db61218ab57247b3c2207a5a
2020-08-10 20:47:14 +00:00
Alex Dale
aa7ed24123 Merge "Log X-Google fields on failed HTTP requests." 2020-08-10 20:34:12 +00:00
Alex Dale
02243a7712 Merge "Handle unlimited usage table capacity." am: be2e32d09e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12221244

Change-Id: Ia570cb4672d1b0b7a65030be49de0ceb97811b01
2020-08-07 20:51:41 +00:00
Alex Dale
be2e32d09e Merge "Handle unlimited usage table capacity." 2020-08-07 20:35:43 +00:00
Rahul Frias
e50c7d6ed1 Allow offline licenses to be loaded and restored in the same session am: 79eabb0989
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12309365

Change-Id: I04f37e6440e7f09ed40df3c3d65cd3ff3f31b83f
2020-08-07 09:46:25 +00:00
Rahul Frias
49e53ffdfe Log OEMCrypto_CloseSession error
[ Merge of http://go/wvgerrit/103643 ]

Bug: 161417560
Test: WV unit/integration test
Change-Id: I2d7e3b90e2e34e7854dea7aac865f8577d113aab
2020-08-05 02:20:28 -07:00
Rahul Frias
79eabb0989 Allow offline licenses to be loaded and restored in the same session
[ Merge of http://go/wvgerrit/103243 ]

Include review comments from wv gerrit CL.

Bug: 161551490
Test: WV unit integration tests, GtsMediaTestCases and
      WidevineConcurrentDrmCertificatesTest#testConcurrentDrmCertificates,
      MediaDrmTest#testMultipleLoadKeys on a redfin
Change-Id: Ie9b41a2e68b95692f9353578f6955637411d4dfc
2020-08-04 15:02:06 -07:00
Alex Dale
147c9e0afa Log X-Google fields on failed HTTP requests.
[ Merge of http://go/wvgerrit/103395 ]

To help with debugging failures in HTTP requests during unit tests,
this CL adds logging for Google's debugging response header fields.
These fields are of the type "X-Google-*" or "x-google-*" and provide
information such as the service name, server cell, error details, and
other details that can help isolate the cause of failure on the
server's end.

An additional unittest has been created to test the parser for the
header fields.

Tests that are known to exprience HTTP failures have been extended
to include logs for these fields should they be present.

Bug: 137619348
Test: Linux unit tests and Jenkins test
Change-Id: I69959af2ba91510f345bbb02cf7ca35c3f1119da
2020-07-30 17:24:11 -07:00
Alex Dale
99335a6aa8 DO NOT MERGE Handle unlimited usage table capacity.
[ Merge of http://go/wvgerrit/103684 ]
[ Cherry pick of http://ag/12221244 ]

The OEMCrypto method for usage table capacity can return zero to
indicate that the usage table size is not explicitly limited.  The
CDM must handle this case with regard to the CDM's usage table
management and information querying.

The usage table initialization tests are extended to include cases
where the table does not have a defined limit.

AddEntry() was missing call to update the usage table header after
creating a new usage entry.  This call is now included and required
additional changes to the usage table unit tests.

Bug: 160560364
Test: Android unit tests
Change-Id: Ica5d181092d2938d24deba5005a211ca883cb0f0
2020-07-29 17:45:21 -07:00
Alex Dale
def1a778b6 Handle unlimited usage table capacity.
[ Merge of http://go/wvgerrit/102945 ]

The OEMCrypto method for usage table capacity can return zero to
indicate that the usage table size is not explicitly limited.  The
CDM must handle this case with regard to the CDM's usage table
management and information querying.

The usage table initialization tests are extended to include cases
where the table does not have a defined limit.

AddEntry() was missing call to update the usage table header after
creating a new usage entry.  This call is now included and required
additional changes to the usage table unit tests.

Bug: 160560364
Test: Android unit tests
Change-Id: Ica5d181092d2938d24deba5005a211ca883cb0f0
2020-07-27 15:36:25 -07:00
Automerger Merge Worker
a5cbc48c85 Merge "Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 5cb846db83" into rvc-qpr-dev-plus-aosp am: 8de7e42545 am: df603cbaa1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: Ie4d3452bfcdc3053c572d56b0b533e78d292a01b
2020-07-26 19:07:30 +00:00
Rahul Frias
de75af70e8 Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 693d58e17d am: e37249c1de am: c8cff5274c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: If45bd3e4c858ee3c8225e4a9ab9f140b985ae3ac
2020-07-26 19:07:24 +00:00
Automerger Merge Worker
df603cbaa1 Merge "Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 5cb846db83" into rvc-qpr-dev-plus-aosp am: 8de7e42545
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: I71b44f173d7e3708104d1efe1a42ff54b25a382c
2020-07-26 18:48:46 +00:00
Rahul Frias
c8cff5274c Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 693d58e17d am: e37249c1de
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: I53f56740230c5e085f6210d5149cc4a77d475a8d
2020-07-26 18:48:36 +00:00
Automerger Merge Worker
8de7e42545 Merge "Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 5cb846db83" into rvc-qpr-dev-plus-aosp 2020-07-26 18:35:09 +00:00
Rahul Frias
f68b9d3575 Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 5cb846db83
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: Ifb7157752ab3cbfcd4e0a5b21136a43420947a4f
2020-07-26 18:35:02 +00:00
Rahul Frias
e37249c1de Allow offline licenses to be loaded and restored in the same session am: 3709a4f419 am: 693d58e17d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: If71a6573a618910478b3c0d9f8b9eb34d72fd9c0
2020-07-26 18:34:59 +00:00
Rahul Frias
5cb846db83 Allow offline licenses to be loaded and restored in the same session am: 3709a4f419
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: I105d1e1b88a554a3ef9cd2174b2210c15852b0e0
2020-07-26 18:11:50 +00:00
Rahul Frias
693d58e17d Allow offline licenses to be loaded and restored in the same session am: 3709a4f419
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12209028

Change-Id: I5911f1d09a15d8ec266d60c22314b21e20788a30
2020-07-26 18:11:39 +00:00
Rahul Frias
3709a4f419 Allow offline licenses to be loaded and restored in the same session
[ Merge of http://go/wvgerrit/103243 ]

In v16, OEMCrypto specifications required that an error be returned if
multiple attempts are made to load an offline license into a session.
This caused the GTS test testConcurrentDrmCertificates to fail. It was
introduced to verify that a license could retrieved and loaded into a
session and then restored. This was based on an app use case.

Ideally we would like to disallow a this behavior but need to make sure
it is not being used by apps.

For now this will be allowed. If detected, the CDM will reintialize the
OEMCrypto session and allow the license to be restored.

Bug: 161551490
Test: WV unit integration tests, GtsMediaTestCases and
      WidevineConcurrentDrmCertificatesTest#testConcurrentDrmCertificates,
      MediaDrmTest#testMultipleLoadKeys on a redfin
Change-Id: I0834e4419c3a6dccfd77aaea3afa3d65c2c0c742
2020-07-24 07:27:19 -07:00
Rahul Frias
47e210ca67 Merge "Correct WV log spam" am: d6c8348229
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12157508

Change-Id: If30b83beddb75e1a4d1c8e680284893927e55b84
2020-07-24 06:46:20 +00:00
Rahul Frias
d6c8348229 Merge "Correct WV log spam" 2020-07-24 06:33:23 +00:00
Robert Shih
6eea529919 PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 951877a8ec am: 0d3f31559a am: e9492a8ab1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: Ide2d4e02ed2b44aaa051e6e66d8a2794c538868a
2020-07-24 00:34:42 +00:00
Robert Shih
9ab50f5706 PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 035254e828 am: 6c6cbc95df am: 41c6222c49
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: Ic98c6015ebabc1fe65726d6ccdcc884621c1fc69
2020-07-24 00:34:37 +00:00
Robert Shih
e9492a8ab1 PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 951877a8ec am: 0d3f31559a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I4c35a5573842869f0514dda223fe87c4672b5e2e
2020-07-24 00:17:00 +00:00
Robert Shih
41c6222c49 PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 035254e828 am: 6c6cbc95df
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I183964f4454b2718623cfaf471bdd92a5394322e
2020-07-24 00:16:41 +00:00
Robert Shih
0d3f31559a PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 951877a8ec
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I3f291f5f0c200d7678999e0ed3552cb6d0a37706
2020-07-24 00:04:01 +00:00
Robert Shih
6c6cbc95df PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 035254e828
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I01a10b72bb3a803197a814c74bcc04e5eaac3948
2020-07-24 00:03:01 +00:00
Robert Shih
951877a8ec PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: Ic030fa19260c55a47686507abc7bec3b41253d77
2020-07-23 23:46:28 +00:00
Robert Shih
035254e828 PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I416235b868332a0a93ce9d2a8310350d9ffef733
2020-07-23 23:46:10 +00:00