Commit Graph

263 Commits

Author SHA1 Message Date
Cong Lin
0f32446ee7 Upgrade L3 to v16 and update Android.bp files
Merging CL:
* http://go/wvgerrit/108203
* http://go/wvgerrit/103904 (changes to L3 source files excluded)

Also added ODK dependency which is required by L3 v16.
Do not replace constant sizeof() with a hard-coded value in L3 library because it is target-specific.

Test: Unit tests on gLinux
    jenkins/linux_unit_tests
    jenkins/ce_cdm_tests
Test: Unit tests on Pixel 4(flame-userdebug, rvc-qpr-dev)
    vendor/widevine/libwvdrmengine/build_and_run_all_unit_tests.sh
Test: Manual ExoPlayer L1/L3 playback tests (flame-userdebug)
    WV: Secure HD/SD (cenc,MP4,H264)
    WV: Secure HD/SD (cbc1,MP4,H264)
    WV: Secure HD/SD (cbcs,MP4,H264)
Test: Widevine GTS tests(bramble-userdebug, master)
    http://ab/I23800006571451275
Bug: 136317881
Bug: 139814713
Bug: 173331251
Change-Id: I1656e83a74a0eaf650f55f5e2388819bf5020c0d
2020-11-17 23:28:51 +00:00
Alex Dale
cbb1d11a72 Merge "Include "origin" in license request client ID" 2020-11-03 00:52:45 +00:00
Alex Dale
4028784836 Include "origin" in license request client ID
[ Merge of http://go/wvgerrit/108823 ]

Android CDM will include the session origin in the client info
component of the client ID of a license request.

The "origin" is only to be included on Android CDM, and not the CE
CDM.  The origin is provided to the license request via the app
parameters in the WVDrmPlugin.

A separate GTS test is in development and will be submitted to the
Android media GTS test set.

Bug: 164549928
Test: Manual test and GTS test
Change-Id: I67f8b064b2aefdc08328ea14551d4aa4cb57023d
2020-10-28 17:29:18 -07:00
Rahul Frias
42ecc6404b Address test failures
[ Merge of http://go/wvgerrit/104584 ]

This corrects failures in
* WVDrmPluginTest.ReturnsL3SpoidsWhenL3ProvisionedUsingL3Spoid
* WVDrmPluginTest.ReturnsL3SpoidsWhenL3Unprovisioned
* WVDrmPluginTest.ReturnsL1SpoidsWhenL3ProvisionedUsingL1Spoid

and a warning in
* PolicyEngineTest.PlaybackOk_RentalAndLicense0_WithPlaybackBeforeLicense_V15

Bug: 163542905
Test: WVDrmPluginTest and PolicyEngineTest
Change-Id: I3e7799175b7b289fafd2caf88bd5df4123b88973
2020-10-27 02:23:59 -07:00
Rahul Frias
ec8bed38f4 Update Widevine Copyright header for android
[ Merge of http://go/wvgerrit/108084 ]

The Widevine License Agreement has been renamed to use inclusive
language. This covers files in the android directory.

Bug: 168562298
Test: verified compilation (comment only change)
Change-Id: I0f9e6445e0168ebe85425baeb81371e182e5a39c
2020-10-21 02:49:05 -07:00
Alex Dale
fb847c4704 Query analog output capabilities.
[ Merge of http://go/wvgerrit/107763 ]

This CL enables the ability to query the CDM for the analog output
capabilites of the device.  Due to the number of possibilities that
OEMCrypto can report, two queries are exposed:
- Output capabilities: None, Supported, CGMS-C, Unknown
- Can disable: True, False, Unknown

Bug: 168322023
Test: Android integration test
Change-Id: I8036a89237d698f170d2c1901c41d1d6b708c917
2020-10-15 17:46:13 -07:00
Edwin Wong
051e879438 Rename metrics.proto to wv_metrics.proto.
Merge from http://go/wvgerrit/105767

To avoid conflict with metrics.proto in
frameworks/av/drm/libmediadrm/proto.
This is in preparation of moving metrics_dump tool
to build under Android.

bug: 161783052
Test: unit test
Test: Play Movies & Tv and Netflix streaming
Change-Id: I2406b66db4d61cca7c6260ea8847a555d96c8d42
2020-09-10 12:26:28 -07: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
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
Rahul Frias
7e689a1828 Handle SPOID calculation for L3
[ Merge of http://go/wvgerrit/101443 ]

The WVDrmPlugin has a single CdmIdentifier. The CdmIdentifier contains
a SPOID that is calculated from the device ID (keybox or OEM cert),
an application reverse domain name and possibly an origin.

The CdmIdentifier is set and SPOID calculated on certain calls into
WVDrmPlugin. Once it is set, it will not be recalculated. We prevent
certain operations such as modifying the origin once the CdmIdentifier
has been set as this will require recalculating the SPOID.
Recalculating the SPOID may affect open sessions or calls in progress.

In a similar way, modifying the security level, will affect the
Device ID value and in turn the SPOID. The security level cannot be modified
if any sessions are open. This does leave open the possibility that the
SPOID may be calculated at one security level, sessions are then closed,
and the security level is then changed without an error being flagged.

The provisioning certificate file name is based on the SPOID. When
the SPOID does not match the security level, either the provisioning
information may not be found even though that security level has
been provisionined or the provisioning information may be stored
in an incorrect location if provisioning occurs.

The correct solution is to prevent modifications to the security level
once the CdmIdentifier is set. This is a behavior change and might
impact apps. We will reevaluate this for the next release.

For now, we will work around this. When the CdmIdentifier is set for L3,
we will calculate SPOIDs with both L1 and L3 device IDs and check if
provisioning previously occurred with SPOIDs calculated for that level.
If so, use that level, otherwise use L3.

Bug: 147703382
Test: Android unit/integration tests, GtsMediaDrmTests
Change-Id: Ia64adfc5848e431ee3876af03eebdb4b6eb83116
2020-06-17 00:50:14 -07:00
Rahul Frias
bbe9f6afc4 Add ATSC support - part 1
[ Merge of http://go/wvgerrit/100864 and http://go/ag/10704773 ]

ATSC 3.0 allows for licenses to be downloaded OTA and are tied to
a DRM certificate that may be shared across apps. The provisioning
process for ATSC may happen at the factory or during an OS update.

This contrasts from the regular OTT model, which requires that
provisioning and license download have an uplink as well as a
downlink connection.

This adds support for the ATSC mode property. ATSC mode can only be
set (or unset) before sessions are opened. Once the CDM identifier is
set/sealed, requests to modify the ATSC mode will be rejected.

If one needs to open sessions with both ATSC mode and regular (non-ATSC)
mode, separate MediaDrm objects will need to be created. The default
mode is to not use ATSC.

Enable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "enable")

Disable ATSC mode by calling
  mediaDrm.setPropertyString("atscMode", "disable")

Provisioning and unprovisioning requests for ATSC will be rejected as
certificates will be retrieved by the ATSC service.

Bug: 139730600
Test: WV unit/integration test, GtsMediaTestCases
Change-Id: I142f286c711fe007ff42125c3c8cdc6450b6ea36
2020-06-08 14:56:48 -07:00
Rahul Frias
e27bc4ba6a Accept a security level to be specified during provisioning
[ Merge of http://go/wvgerrit/97267 ]

In earlier releases, provisioning would occur based on a cached
security level. If an open session call returned a NotProvisionedException
the security level would be cached for use with any future provisioning
call.

An app would have to set the security level, then call openSession,
have it fail and then request provisioning. This fits the normal flow of
most apps. Still on occasion, an app might change requested security level
after an openSession call failed. Using the cached security level
would result in unexpected behavior.

This change allows provisioning to occur at the last security level that
was set.

Bug: 129356527
Test: wv unit/integration tests, GTS tests (GtsMediaTestCases)
Merged-In: I8d9234eec2b23a9c913e77a709943b431e25e43e
Change-Id: I8d9234eec2b23a9c913e77a709943b431e25e43e
2020-04-28 11:58:59 -07:00
Rahul Frias
3df8bc5133 Correct OpenSessions_1_1 test failure
[ Merge of http://go/wvgerrit/98025 ]

This adds mocking for WvContentDecryptionModule::QuerySessionStatus
to WvDrmPluginTest which was missing. This corrects the failure in
WVDrmPluginTest.OpensSessions_1_1 from libwvdrmdrmplugin_hidl_test

Bug: 154011452
Test: wv unit/integration tests
Change-Id: I9904595a62a71541ab534aca7d7dfbf95f3225c9
2020-04-20 15:48:20 -07:00
Rahul Frias
d260c2cf2d Merge "Correct reporting of KeyStatus usable in future" into rvc-dev 2020-04-20 19:06:18 +00:00
Rahul Frias
6404b42fb2 Correct reporting of KeyStatus usable in future
[ Merge of http://go/wvgerrit/98004 ]

This corrects mapping for KeyStatus event kKeyStatusUsableInFuture in
the legacy WVDrmPlugin. It earlier reported DrmPlugin KeyStatusType
kKeyStatusType_StatusPending and now reports kKeyStatusType_UsableInFuture.

This fixes the test failure WVDrmPluginTest.MarshalsEvents

Bug: 153509007
Bug: 116738851
Test: WV unit/integration tests
Change-Id: I4b2c74f5a0757975861ef41fa575a749ff9da391
2020-04-20 10:23:27 -07:00
Robert Shih
2278917116 WVDrmPlugin signRSA: check arguments before caller
Merge of http://go/wvgerrit/97444

Bug: 153356263
Test: VtsHalDrmV1_0Target
Test: VtsHalDrmV1_3Target
Change-Id: Ic27056d86804972859a85c0eb2a0e79a0563d040
2020-04-06 16:13:40 -07:00
Fred Gylys-Colwell
56b836bda3 Replace OEMCrypto_LoadDeviceRSAKey with OEMCrypto_LoadDRMPrivateKey
Merge from Widevine repo of http://go/wvgerrit/96783

This CL updates the reference code, unit tests, and adapter to use the
new v16 function OEMCrypto_LoadDRMPrivateKey. This is just an API
change to allow ECC support in the future. The reference code does not
yet support ECC certificates, and the CDM code assumes that all
certificates have an RSA key.

Bug: 152558018
Test: unit tests on taimen and w/v16 mod mock.
Change-Id: I0793b416513b81b3d74849f0b58dbdc91f075ac6
2020-03-29 10:43:54 -07:00
Robert Shih
18fec07897 hidl WVDrmPlugin: check for listener transport errors
Transport errors usually happen when hidl client crashes in DRM event
handler.

Merged from http://go/wvgerrit/95963

Bug: 150204874
Test: artificial crashes in client DRM event listener
Change-Id: I8037374550357d003e302f2a25fbb2305ae5a5e7
2020-03-18 00:56:55 -07:00
Edwin Wong
a66d2b392e Clear sessionId regardless of what closeSession returns
After succeeding openSessionCommon(), when the call to
getSecurityLevel() fails, the code calls closeSession()
and only clears the sessionId if closeSession() fails.
We should always clear sessionId in this case.

Also, make it clearer that the status returned by
getSecurityLevel() does not overwrite the value from
openSessionCommon().

Merged from http://go/wvgerrit/95845

Test: unit test
adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 151364587
Change-Id: I3a9106ffa44c654d3e072a0b0597398d410fc84f
2020-03-13 11:40:20 -07:00
Edwin Wong
bdb69f73e8 openSession_1_1 should return error for wrong security level
Currently, if requestedLevel is not the same as the
current security level, openSession_1_1 still returns
Status::OK, we should return an error status.

Merged from http://go/wvgerrit/95507

Test: unit test
  adb shell LD_LIBRARY_PATH="/vendor/lib64" /data/nativetest/libwvdrmdrmplugin_hidl_test

Bug: 150407669

Change-Id: I5673ac7bbe7a234ddd07bb9c145135486fb9e583
2020-03-11 17:39:44 -07:00
Automerger Merge Worker
23c1be8cee hidl WVDrmPlugin openSession: set securityLevel correctly am: 9a530b7f1e
Change-Id: I7dbc26be06ae0fdfa0013dd65a57c169b21f4bdc
2020-03-04 19:33:38 +00:00
Robert Shih
9a530b7f1e hidl WVDrmPlugin openSession: set securityLevel correctly
Merge of http://go/wvgerrit/94827

Bug: 149035295
Bug: 150103154
Bug: 150407639
Test: VtsHalDrmV1_2TargetTest
Change-Id: I3687b2305eb413112f7fbd0d5127d2168cdf376d
2020-03-04 18:44:44 +00:00
Alex Dale
9c60d1e1ae Adding app package name to license request.
[ Merge of http://go/wvgerrit/94323 ]

Content providers wish to know the application package name that is
requesting a license from the content server.  The app package name that
is provided to the CDM during initialization is provided to the client
identification message as a key-value pair during license request
generation.  App packages names are keyed under 'application_name'.

This feature was tested manually by scraping the content of the license
request for YouTube TV.

Bug: 148689078
Test: manual
Change-Id: I6b65f2ab9845dbea37aaaab76ecea25c228bde5b
2020-02-20 13:23:16 -08:00
Robert Shih
be7b89e155 wv hidl: only mediashell/mediadrmserver can call signRSA
Merge of go/wvgerrit/93524

Bug: 134787536
Bug: 148895349
Test: VtsHalDrmV1_3TargetTest
Change-Id: I48fb63d044271243fa1d290443d437f0697994d3
2020-02-19 13:38:23 -08:00
Fred Gylys-Colwell
7665614b2e OEMCrypto v16.1
Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
2020-02-03 14:45:32 -08:00
Marco Nelissen
13a2504840 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: I5981593697229c1f3314a4a8a4d0c447d7cbe808
2020-01-07 15:26:14 -08:00
Marco Nelissen
8af30972b2 Link with actual headers instead of symlinks
Bug: 143245419
Test: build
Change-Id: Iff096c2d3568f2db4260a1d2a86d2746ea4824ed
2020-01-07 13:21:05 -08:00
Robert Shih
8fce3e316b wv hidl: upgrade Drm/Crypto factories to v1.3
Bug: 139134043
Test: MediaDrmTest
Change-Id: I94d1cc8a323c144805d74d5568944dd48ae80e60
2019-12-16 01:19:49 -08:00
Rahul Frias
b8a6035298 Address compilation warnings
[ Merge of http://go/wvgerrit/90350 ]

Bug: 145244554
Test: wv android unit/integration tests
Change-Id: I5cd8a132836ce097a7b539fffdcef574f64cbdcf
2019-12-02 17:44:56 -08:00
Steven Moreland
6f556199db Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Ie7052b17c1d468f63250755f3ffa5099760c9602
2019-10-02 12:53:59 -07:00
Edwin Wong
0c7dfda7e1 Link dynamic libcrypto.so to resolve FIPS cert breakage.
Switch Widevine service to link dynamic libcrypto.so.

Merge from http://go/wvgerrit/86323

Test: Play Movies & TV, Netflix, ExoPlayer, GTS
bug: 141082724
Change-Id: I16a7de4dab69bf3b4b550bb2ee202f4600682837
2019-09-16 14:38:00 -07:00
Rahul Frias
6c9c4697f0 Merge "Return key request type none after key rotation" into qt-dev am: 999a466275 am: 4690da2bcb
am: 4c9a3a6f02

Change-Id: Iddcac699401f64d920fcb8ff73053410019ec028
2019-05-31 09:55:31 -07:00
Rahul Frias
4c9a3a6f02 Merge "Return key request type none after key rotation" into qt-dev am: 999a466275
am: 4690da2bcb

Change-Id: I45387edbb83f05dcadec53e4514cb97c68eae6c7
2019-05-31 09:33:36 -07:00
Rahul Frias
3c9175fec5 Return key request type none after key rotation
[ Merge of http://go/wvgerrit/80084 ]

Corrected the key type being returned after entitled keys from
init data are loaded. Made test changes to validate.

Bug: 133903028
Test: WV unit/integration tests
Change-Id: Icb44587f5c3aba3b0facae6d83dc9344d6b60833
2019-05-29 19:03:43 -07:00
Haibo Huang
c70771dd20 Using ::testing::DoAll
[ Merge of ag/7620084 ]

Without this statement, compilation failed with new googletest.

Test: build
Bug: 129498355
Change-Id: I5e3f5310617e00821f70079fc700bc3f87c3d0ab
(cherry picked from commit 5764d3f801)
2019-05-22 17:27:03 +00:00
Haibo Huang
5764d3f801 Using ::testing::DoAll
Without this statement, compilation failed with new googletest.

Test: build
Bug: 129498355
Change-Id: I5e3f5310617e00821f70079fc700bc3f87c3d0ab
2019-05-20 11:19:06 -07:00
Robert Shih
fe8924f814 Add CdmKeyStatus kKeyStatusUsableInFuture am: 69c8f488ca am: 6a329e6c9a
am: e6ba3ec747

Change-Id: Iee17c92d9a3f3fd390e05bb0324ba04861236210
2019-05-16 20:07:33 -07:00
Robert Shih
69c8f488ca Add CdmKeyStatus kKeyStatusUsableInFuture
Bug: 116738851
Test: unit tests
Change-Id: I49728788e57905806b72e891f3654fbf0c8b1bc0
2019-05-15 15:16:05 -07:00
Jeff Tinker
fabf6f5311 Merge "hidl plugin: add sendKeysChange_1_2" into qt-dev am: 83068b97c8
am: 3caf992795

Change-Id: Ie49ca006a87f6071618c407b52a7d52992f0060c
2019-05-08 11:20:47 -07:00
Robert Shih
a1d9094721 hidl plugin: add sendKeysChange_1_2
Bug: 116738851
Test: vts
Change-Id: Ifdf537ff2f4922741eba5abdd37dd2dd5e37e161
2019-05-06 20:23:06 -07:00
John W. Bruce
5ea429ee2b Don't Use StringStream When It's Overkill
(This is a merge of http://go/wvgerrit/76063)

Now that we have C++11, many places that do string formatting or parsing
can be replaced with std::to_string() or one of the std::sto*() family
of functions. This patch updates places that do simple stringifying or
parsing to use these functions. Some parts of the code are left
untouched because they were using StringStream to do more complex
actions, such as constructing more complex output or checking the status
of the parsing.

Bug: 120599938
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I482dc234ecd7c6014fa9b6874387ff51e04b772f
2019-04-17 17:46:31 -07:00
Robert Shih
d54634baa4 hidl: return BAD_VALUE from RemoveOfflineLicense when keyset is not found
Bug: 127828539
Test: VtsHalDrmV1_2TargetTest
Change-Id: Ia567be076a9460546c59c2a38231e18bb0549ce3
2019-03-18 15:24:22 -07:00
Adam Stone
c891824a7a Adds a VersionInfo message to SignedMessage
[ Merge from http://go/wvgerrit/72724 ]

This adds a message that contains SDK and service version information
useful for debugging problems that occur because of different services.

BUG: 80536436

Test: Unit tests and manual GPlay testing.
Change-Id: I095f893b907ea7c2cd149155fb2cd4c7181e7bb2
2019-02-25 17:09:46 -08:00
Adam Stone
741645a4be Add UsageTableHeader metrics
[ Merge from http://go/wvgerrit/72183 ]

Adds basic metrics for the usage table header.

Bug: http://b/112919252
Test: Unit tests. Manual GPlay
Change-Id: I14d406766d8b2aba3b6e4f1a02c75eedc674b011
2019-02-25 17:09:31 -08:00
Rahul Frias
088c5afa02 Move WV unit/integration tests to /data/nativetest
[ Merge of http://go/wvgerrit/73044 ]

The tests currently get copied to /data/bin. Changes in location
of system libraries causes test failures when tests are unable to
find dependent dynamic libraries.

Bug: 123879070
Test: WV unit/integration tests
Change-Id: I86edbe33b4753238fcf8b84243ac6e6c058ea145
2019-02-21 09:53:06 -08:00
Edwin Wong
54104c7a22 Implement MediaDrm offline license support in Widevine hidl service.
Merged from http://go/wvgerrit/69723.

The new APIs are getOfflineLicenseIds, getOfflineLicenseState and
removeOfflineLicense. These methods are currently stubbed out in
Widevine hidl service. This CL completes the implementation.

Test: unit tests - libwvdrmdrmplugin_hidl_test

Test: GTS
  --test com.google.android.media.gts.MediaDrmTest#testWidevineApi29

bug: 117570686
Change-Id: I96ffb75f453e36e931effefd3664b5faa8d69d30
2019-01-29 13:41:08 -08:00
Jeff Tinker
81e77bda58 Merge "Add support for HDCP 2.3" 2019-01-19 05:48:02 +00:00
Jeff Tinker
7c0cd2582b Add support for HDCP 2.3
bug:120040804
Change-Id: I51e0d173edc36d518e12b821ccb3a7b1e7e8d217
2019-01-15 10:12:55 -08:00
Rahul Frias
ef00d6ffa5 Update property retrival method
[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
2019-01-15 00:24:52 -08:00
Jeff Tinker
a00b50095c Add additional error conditions to MediaDrm
Merge of http://go/wvgerrit/70163

New codes are being added to handle resource
contention, lost session state, frame size too
large and insufficient security level for
decryption. Also cleans up inconsistent use of
tamper detected error where invalid state error
should have been used.

bug:111504510
bug:111505796
test: cts and gts media tests, widevine integration tests

Change-Id: I96ee441717d32ccbcabaa85c8f6a0013055ce16e
2019-01-10 15:17:48 -08:00