Commit Graph

2690 Commits

Author SHA1 Message Date
Robert Shih
c5aa870dbd wv aidl: fix native handle memory leak 2
[ Merge of go/wvgerrit/146369 ]

Bug: 219754570
Test: atest GtsMediaTestCases
Change-Id: Id3e443d5e39ae416d6e566a129ebed423e19e98d
2022-02-23 09:40:15 +00:00
Robert Shih
3fa23b250b Merge "aidl drm: independent min/max SecurityLevel for each supported mime" into tm-dev 2022-02-23 02:08:46 +00:00
Robert Shih
06587fd100 Merge "wv aidl: fix native handle memory leak" into tm-dev 2022-02-22 20:23:44 +00:00
Robert Shih
7b3a37fa2f Merge "Update cipher mode enumeration in AIDL WvDrmPlugin" into tm-dev 2022-02-22 20:22:11 +00:00
Robert Shih
f2d89aaf77 aidl drm: independent min/max SecurityLevel for each supported mime
Interface change 16873294

[Merge of go/wvgerrit/145969]

Bug: 219528925
Test: atest MediaDrmTest.testIsCryptoSchemeSupportedForSecurityLevels
Change-Id: I5c0d511358c394aff6885135de851395f199dac0
Merged-In: I5c0d511358c394aff6885135de851395f199dac0
2022-02-20 19:36:07 +00:00
Robert Shih
0684df3b6c Update cipher mode enumeration in AIDL WvDrmPlugin
To match the v17 change.

[ Merge of go/wvgerrit/146231 ]

Bug: 216585596
Test: atset WidevineGenericOpsTests
Change-Id: I7eb25a5db30a82cf8015e3c19af419c02a1d5002
Merged-In: I7eb25a5db30a82cf8015e3c19af419c02a1d5002
2022-02-20 16:04:11 +00:00
Robert Shih
ea1d5d6891 wv aidl: no set security level opening default session
Bug: 219538389
Test: atest WidevineDashPolicyTests#testL3ValidateKeyOutputProtection
Change-Id: I5912a93fd0b7a144694ec3b251a129d839b8b149
2022-02-20 16:02:24 +00:00
Robert Shih
c6d7d6e69b wv aidl: fix native handle memory leak
[ Merge of go/wvgerrit/145971 ]

Bug: 219754570
Test: atest GtsMediaTestCases
Change-Id: Id4705d5bc10ba6dfbe878f2d95fdd9ae9d2e9f1d
Merged-In: Id4705d5bc10ba6dfbe878f2d95fdd9ae9d2e9f1d
2022-02-20 15:59:51 +00:00
Edwin
93b5514a27 Fix gts issues.
Fix the conversion from in_args.keyId to Cdm format
which causes nullptr dereference signal 11 faults.

Test: atest
  atest-dev GtsMediaTestCases:com.google.android.media.gts.WidevineGenericOpsTests

Bug: 214410088
Change-Id: If84863e2501d4ccae7b8b38dceb707bb4bfa12fb
2022-02-14 10:42:52 -08:00
Edwin
9654d29be6 Widevine drm aidl: address API review
Interface update in change 16810770

Bug: 214410088
Test: atest VtsAidlHalDrmTargetTest
Change-Id: I19da51ef75952f5ff6c7c02e0393f574e69ee30b
2022-02-09 22:19:36 -08:00
Edwin
6112060529 Ran google3 clang-format on cdm source.
Merge from http://go/wvgerrit/144969

Test: build
  m android.hardware.drm-service.widevine -j128

Test: atest VtsAidlHalDrmTargetTest

Bug: 216720425
Change-Id: Ie1872d2a48e3b3645853e9831816afecffac747f
2022-02-03 20:33:05 -08:00
Robert Shih
f1bfd6f202 misc wv aidl bug fix to pass vts
* handle default security level
* init ScopedAStatus before sending events

Bug: 205845199
Test: atest VtsAidlHalDrmTargetTest
Change-Id: Ie72d837bb2b7caa1da2721262b76bd47d5bdab03
2022-02-01 23:26:15 -08:00
Edwin
3c3da01d58 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Test:   atest vts_treble_vintf_vendor_test:vts_treble_vintf_vendor_test.DeviceManifest/SingleManifestTest#ManifestAidlHalsServed/0 -- --abi x86_64

Bug: 200055138
Bug: 170964303
Change-Id: I5654d90d8a4b0bae4b4a78e79b27c1cafec36be7
2022-02-01 22:20:04 -08:00
Kyle Zhang
627c8d6855 Merge "Fix files mis-synced from cdm repo to Android" 2022-02-02 06:07:45 +00:00
Kyle Zhang
fdc585a55d Fix files mis-synced from cdm repo to Android
Test: build
Bug: 161477208
Change-Id: I2d48dff987fe37a54ffdfc47a7896fba975a0e20
2022-02-01 18:08:38 +00:00
Cong Lin
efbe13ea36 Update Android L3 after cipher mode fix
This is a merge of
https://widevine-internal-review.googlesource.com/c/cdm/+/144790

Updated cipher mode to allow playback in v17;
Added check for key selection before decrypting.

Merge from Widevine repo of http://go/wvgerrit/144779
Fix allow_null for key control iv in L3 v17

Merge from Widevine repo of http://go/wvgerrit/144792
Fix api version check in L3 v17

Test: L3 unit tests
Bug: 217145027
Change-Id: I584bd57e26407cbf4d4b94eb1bc5cf80839377be
2022-02-01 10:00:40 -08:00
Yohei Yukawa
a4d835af3a Revert "Use aidl interface for Widevine service."
This reverts commit 96a8ccd4a1.

Reason for revert:
Could break DeviceManifest/SingleManifestTest#ManifestAidlHalsServed

Bug: 200055138
Bug: 170964303
Bug: 217241995
Change-Id: I9c42df15defec428c9ef8c62439c63d4a603fee6
2022-01-31 22:01:25 +00:00
Edwin
96a8ccd4a1 Use aidl interface for Widevine service.
The interface is defined in
hardware/interfaces/drm/aidl(http://go/ag/15329852).

Test: build
  m android.hardware.drm-service.widevine -j128

Test: build_and_run_all_unit_tests.sh
  for hidl tests

Test: atest VtsAidlHalDrmTargetTest

Bug: 200055138
Bug: 170964303
Change-Id: If2f2a129914436ba5cef1c46f6cb9415e12c3d1c
2022-01-28 20:29:14 -08:00
Kyle Zhang
642965c678 Merge latest oemcrypto-v17 change
No-Typo-Check: Not related to this change.

Bug: 161477208
Change-Id: I99e4780f6855b7045aa0cd5a49c13d2d0d51ed64
2022-01-27 20:07:15 -08:00
Bob Badour
c924960962 [LSC] Add LOCAL_LICENSE_KINDS to vendor/widevine
Added legacy_by_exception_only to:
  libwvdrmengine/cdm/test/coverage-test.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I245a84bb0ef081a4faedde51f0e815478172db51
2022-01-27 12:14:56 -08:00
Rahul Frias
8500365f8c Merge "Protect against race conditions when adding a license" 2022-01-24 22:33:48 +00:00
Rahul Frias
af99d774d4 Merge "Protect against race conditions when removing keys" 2022-01-24 22:31:58 +00:00
TreeHugger Robot
2e738c2989 Merge "Fix errors being hidden by Protobuf warning-disabling" 2022-01-22 00:02:03 +00:00
TreeHugger Robot
38832ed40e Merge "Upgrade MOCK_METHOD to googletest 1.10" 2022-01-22 00:01:43 +00:00
John "Juce" Bruce
df23c7da03 Fix errors being hidden by Protobuf warning-disabling
(This is a merge of http://go/wvgerrit/140850.)

This patch fixes a number of minor issues in the codebase (mostly
instances of 0-as-nullptr, but also some member shadowing and a missing
override) that were being hidden by the fact that depending on Protobuf
disables these diagnostics. And which will be unhidden when a later
patch removes that behavior from Protobuf.

Bug: 208304830
Test: x86-64
Change-Id: I4b0b1264748880b3726a6388d589868d898f949e
2022-01-21 01:49:40 +00:00
John "Juce" Bruce
5606e7dae3 Upgrade MOCK_METHOD to googletest 1.10
(This is a merge of http://go/wvgerrit/139989.)

Googletest added a new, more powerful MOCK_METHOD() macro in 1.10. This
patch updates all our usage of the old MOCK_METHOD family to the new
macro. Full details can be found at
https://github.com/google/googletest/blob/release-1.10.0/googlemock/docs/cook_book.md#creating-mock-classes
but in brief, the new MOCK_METHOD() replaces the entire old MOCK_METHOD
family and has the following advantages:

1) No need to count parameters or update the macro name when changing
   parameters.
2) No need for a different macro for const methods.
3) The ability to specify override, noexcept, and other function
   qualifiers.
4) The macro order is now the same as C++ method definition order:
   Return Type -> Name -> Arguments -> Qualifiers

In addition to upgrading all our usage sites to the new macro, the
addition of the override qualifier to our MOCK_METHODs helped uncover
several cases where we were using MOCK_METHOD to override methods that
didn't exist. This is a great example of why the override qualifier is
so useful. These places have been updated, by removing the invalid and
unused mock method.

Bug: 207693687
Test: build_and_run_all_unit_tests
Change-Id: Iaad4a22c7f72bb48b1356fe01a41eb0a2f555244
2022-01-21 01:49:28 +00:00
Alex Dale
4c6e10f7d6 Created a unified Android test for coverage.
[ Merge of http://go/wvgerrit/143889 ]

New test binary for generating code coverage information.  Run several
reliable, short runnning unit tests.  Actual test failures do not
affect the result of this test.

Bug: 138941105
Bug: 191681397
Test: Android cdm_coverage_test
Change-Id: I6b74d361a8a0e2896e0489acaa64d264158ecaa4
2022-01-20 13:57:40 -08:00
Alex Dale
e5822def1d Better error code checking for missing device ID. am: b77a30bf3d am: 4d9d13db34
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16624955

Change-Id: Iae13e720334cc30f98e2faa9bf7810d65e174c76
2022-01-14 23:10:59 +00:00
Alex Dale
b77a30bf3d Better error code checking for missing device ID.
[ Merge of http://go/wvgerrit/143370 ]
[ Cherry-pick off http://ag/16624952 ]

Devices without a keybox may not have access to a device ID if the OEM
uses the device ID from the keybox as its source of truth.  For
devices which have lost their keybox, OEMCrypto_GetDeviceID() was
assumed to return ERROR_KEYBOX_INVALID if that was the case; however,
Qualcomm's implementation was returning ERROR_NO_DEVICEID.  Given that
both error codes are appropriate, the CDM has been updated to accept
both as an indication that the device ID cannot be retrieved, and that
the null device ID should be returned.

Bug: 190504842
Bug: 214113125
Test: Manual test
Change-Id: I8fb8a1bddfe895062b707b51fcadffd983adb40e
2022-01-13 16:03:45 -08:00
Fred Gylys-Colwell
b0878cae62 Fallback to L3 if provisioning lost am: df0cfa2daa am: f3b26aaf2c
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16523000

Change-Id: Ibd8c4d27c23086d1fe8ee7d286a00787e8704464
2022-01-07 06:08:39 +00:00
Fred Gylys-Colwell
2897ed2ed5 Fall back to L3 if L1 has test keybox am: 31faf51933 am: cbb5bd0f7a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16507243

Change-Id: I4159f77db5748bde567466157ce5f07be7f64e55
2022-01-07 06:08:39 +00:00
Fred Gylys-Colwell
2f964df424 Test session should continue with no keybox am: 75b87c7f59 am: 78d0b73964
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16507242

Change-Id: I448766407f548908468143aa2ca2e45b8362c10d
2022-01-07 06:08:37 +00:00
Fred Gylys-Colwell
0b0b1abdb4 Skip OTA test if not supported am: 2f57079f6a am: 76bbdba1e5
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16507241

Change-Id: Ib62bd5f289d770dbcc865ae4b77fd30e8d1ea461
2022-01-07 06:08:37 +00:00
Fred Gylys-Colwell
41835c7f24 Handle nonce flood in OTA test am: 3c7528de62 am: 5e5913818d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16507240

Change-Id: I688bcc9f5e41cb56a83ae48fd549a3a9c4ec5bc2
2022-01-07 06:08:36 +00:00
Alex Dale
57837fcc35 Open session when checking for OTA keybox support. am: 2d1372fbec am: 25098c88e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16496630

Change-Id: I25487f3154eff003f043fada11ef4637ab1a324a
2022-01-07 06:08:35 +00:00
Alex Dale
7e8a8d6a90 Return failure if ignore keybox debug count is non-zero. am: 1b35b915b5 am: d2c1aec4a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16496629

Change-Id: I541c6134f8c01612b9fb6b91f7217aad45d558e3
2022-01-07 06:08:34 +00:00
Fred Gylys-Colwell
1373c554a8 Fix System ID problem for devices with no keybox am: f6d682b182 am: bf776ef27d
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16408945

Change-Id: I5e1965104ff03a6d973ecf3727121d9f91dc1e26
2022-01-07 03:56:14 +00:00
Fred Gylys-Colwell
df0cfa2daa Fallback to L3 if provisioning lost
Merge from Widevine repo of http://go/wvgerrit/142349

If a provisioning request is sent, but no response is loaded, we
should fall back to L3. This covers the case where the OTA request is
malformed and the provisioning server ignores it.

This might happen if the device has a bad KM key.

Test: manual testing
Bug: 210823889
Bug: 210807585
Change-Id: I951241539ace97b668868d5abf8a9811d874fb28
2021-12-23 20:19:27 +00:00
Fred Gylys-Colwell
31faf51933 Fall back to L3 if L1 has test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 2)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

Bug: 210807585
Bug: 210823889
Change-Id: I30c35134239db35bb39f11f75220063181987763
2021-12-23 20:19:26 +00:00
Fred Gylys-Colwell
df04f3f0f8 Add MediaDrm property to allow test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 1)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

This CL modifes the HIDL and non-HIDL plugin, so it was hand merged to
downstream branches.

Bug: 210807585
Merged-In: I85b96f127abe30f8f061b242f7580fa8f6c01776
Change-Id: I85b96f127abe30f8f061b242f7580fa8f6c01776
2021-12-23 20:18:44 +00:00
Rahul Frias
84abb87fd8 Protect against race conditions when adding a license
[ Merge of http://go/wvgerrit/142249 and http://go/ag/16307264 ]

This adds concurrency protection to a session when policy
timers are reset to from v15 to v16. The v15 policy timer may still be
in use by the decryption thread.

Bug: 204282907
Bug: 207304220
Test: Unit/Integration tests, GtsMediaTestCases
Change-Id: I4967b3927e47733fb23a1a12b6094d1cd2072918
2021-12-21 16:27:36 -08:00
Rahul Frias
a4756e2a7f Protect against race conditions when removing keys
[ Merge of http://go/wvgerrit/142229 and http://go/ag/16147655 ]

This adds concurrency protection to a session when keys or a
license is removed from a session.

Bug: 195625322
Test: GtsMediaTestCases, unit/integration tests, YT EME conformance test
Change-Id: I38601a58dc593ce053cb5457b9d42d2c35f3f041
2021-12-21 16:25:52 -08:00
Fred Gylys-Colwell
04e1d8efbc Add MediaDrm property to allow test keybox
Merge from Widevine repo of http://go/wvgerrit/142150 (part 1)

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

The original CL modified the HIDL and non-HIDL plugin, so this is the
hand cherry-pick.

Bug: 210807585
Change-Id: I85b96f127abe30f8f061b242f7580fa8f6c01776
2021-12-19 20:04:02 +00:00
Fred Gylys-Colwell
75b87c7f59 Test session should continue with no keybox
Merge from Widevine repo of http://go/wvgerrit/142149

This CL updates the TestCryptoSession so that it will recover from
initializing without a keybox. This allows unit and integration tests
to be run using a test keybox on a device that does not have any
keybox.

Bug: 210807585
Bug: 161925952
Change-Id: I8639bd733a50ae5af3a7c786347b5a06a9d783ce
2021-12-19 17:58:58 +00:00
Fred Gylys-Colwell
2f57079f6a Skip OTA test if not supported
Merge from Widevine repo of http://go/wvgerrit/142050

This is test only code.

Bug: 210690170
Change-Id: Ic982cc1ed801325146918bd6153e7f34faf31196
2021-12-19 17:58:26 +00:00
Fred Gylys-Colwell
3c7528de62 Handle nonce flood in OTA test
Merge from Widevine repo of http://go/wvgerrit/142049

This CL is test only code. A nonce flood was causing the OTA test to
be a little flaky when run on the automatic testing platform Luci.

Bug: 205889158
Change-Id: I4f3e5d8469b899e565c430bd46994e098c5d94e6
2021-12-19 17:56:57 +00:00
Alex Dale
2d1372fbec Open session when checking for OTA keybox support.
[ Merge of http://go/wvgerrit/142089 ]
[ Cherry-pick of http://ag/16496425 ]

Qualcomm's implementation of GenerateOTARequest requires an open
session before attempting to generate an OTA keybox request.  When
checking for OTA keybox support, the dynamic layer was not opening
a session, getting a different error than expected.  Coincidentally,
this would trick the dynamic layer to thinking it was supported, but
hides useful error information.

Bug: 210823889
Test: Android manual testing
Change-Id: I60662d2d9d411c0f999b619d6088aabdba55e2c3
2021-12-17 04:31:31 +00:00
Alex Dale
1b35b915b5 Return failure if ignore keybox debug count is non-zero.
[ Merge of http://go/wvgerrit/141949 ]
[ Cherry-pick of http://ag/16496424 ]

If the debug count for ignoring an L1 keybox is still non-zero after
successfully processing an OTA keybox request, the dynamic layer MUST
return a failure to the CDM to keep the CDM and dynamic layer in
agreement that the L1 keybox should continue be treated as invalid.

This will trigger a fallback; but the fallback can be canceled via
the debugging app.

Bug: 210823889
Test: Android manual testing
Change-Id: I75f50ba605d17872c0e8abffc1eee13ff539f01c
2021-12-17 04:30:43 +00:00
Fred Gylys-Colwell
f6d682b182 Fix System ID problem for devices with no keybox
Merge from Widevine repo of http://go/wvgerrit/139372
Revert workaround for falling back to L3
(Partially merged previously)

Merge from Widevine repo of http://go/wvgerrit/139498
Guard against double initialize
(Partially merged previously)

Merge from Widevine repo of http://go/wvgerrit/139343
Use a placeholder ID for devices missing a system ID

Merge from Widevine repo of http://go/wvgerrit/140934
Check security-level during OpenSession.

Merge from Widevine repo of https://go/wvgerrit/141469
Make OTAKeyboxSupported handle the short buffer return
code

Bug: 187646550
Bug: 206670307
Bug: 206570220
Bug: 205896558
Bug: 205041153
Test: Manual test on flame
Change-Id: I71f5faf6b611337b82d8b6179251f6b0224780e6
2021-12-14 19:36:41 -08:00
Alex Dale
8aabf20134 Correctly record license service version in metrics.
[ Cherry-pick of http://ag/15245767 ]
[ Merge of http://go/wvgerrit/128624 ]

The CDM session was incorrectly recording the "license SDK version" as
the "license service version" in the session metrics.  This
discrepancy reduces the quality of devices' metrics and limits
debugging capabilities for the Widevine metric monitoring services.

Bug: 193177333
Test: Linux unit tests
Change-Id: Ic58cf7bc4fde777bb590c05777b76f5ff5c2f1ea
(cherry picked from commit 78278c3eb4)
2021-12-08 02:23:43 +00:00