(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
[ 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
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
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
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
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
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
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
[ 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
[ 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
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
[ 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)
(This is a merge of http://go/wvgerrit/139632.)
While fixing a compiler error about shadowed variables in CdmSession, I
noticed that this function had two result variables with different names
as well. This patch consolidates down to one result variable.
Bug: 207684988
Test: x86-64
Change-Id: Iaf6d742ef3409d85a1c364b486909d2497093112
(This is a merge of http://go/wvgerrit/139630.)
This patch fixes a few places that were using NULL or 0 instead of
nullptr.
Bug: 207702482
Test: x86-64 build
Change-Id: I10e19febebd093fe4445208a082216002d9a4482
(This is a merge of http://go/wvgerrit/139629.)
This patch fixes several places where the override keyword was missing.
These were found when future patches that enable stricter checking of
the override keyword were enabled. There are two basic categories of
missing override:
* Destructors found to be overriding a virtual destructor without using
the override keyword.
* Test methods overriding methods on test-only or mock objects.
Some of these were previously marked as virtual, following our pre-C++11
style guidelines, but this is not necessary now that we have override.
Bug: 207684988
Test: x86-64 build
Change-Id: I09aa499bd3ea80d925e2fc422290d61eb005a769
(This is a merge of http://go/wvgerrit/139569.)
The unit test for DeviceFiles previously had to work around googlemock's
lack of support for move-only types. Now that we have upgraded to
googletest 1.10, we can use move-only types directly via the ByMove()
utility, removing the need for this workaround.
Bug: 207693599
Test: x86-64
Change-Id: Ib4dcc5ec367ef413465a3e8a8f45f9187976ed5e
Merge from Widevine repo of http://go/wvgerrit/139498
If L1 OEMCrypto fails to initialize, we won't try again.
Bug: 206670307
Change-Id: I89084476ae01d9c98291392c2ce703ebc6326322
Merge from Widevine repo of http://go/wvgerrit/139336
When pretending we have no keybox, we should also have no system id or
device id. This should reproduce our problem with the test app.
Bug: 206570220
Test: reproduced problem using TestOPK app
Change-Id: I893336ce8e1fd2272f5b511676e1da28654639a7
Merge from Widevine repo of http://go/wvgerrit/139333
This is a workaround for devices that don't have a
keybox installed.
Bug: 206570220
Bug: 205896558
Bug: 205041153
Test: verified device falls back to L3 using TestOKP app
Change-Id: Id929b48ddaa7114a81765095aac536705f69e68c