In the onTransact DECRYPT case, the allocated subSamples
are not freed when we encounter an error. Use unique_ptr
to manage memory instead.
Test: Play Movies & TV, Netflix
Test: Gts
bug: 73628269
Change-Id: I36b7deeff0380ee3be31ad5f93a5598cfe02e381
When passing an invalid security level to
DrmPlugin::setSecurityLevel, an incorrect error code
was being returned, based on the drm@1.1 DrmPlugin.hal
documentation. This CL corrects the error code.
Change-Id: If560be07f3945320d28c42cb2cf18d8f8c718229
related-to-bug:73330999
bug:77308498
Test:VtsHalDrmV1_1Target
Uses an updated proto model that's more efficient for serialization.
Test: Unit tests, google play and CTS tests.
Bug: 73724218
Change-Id: I936bc18216c0c67de580424b4c62344d94be6b38
Some drm HAL methods were not properly checking
their hidl Return<Status> values which would cause
aborts in some cases. This CL adds checks as needed
Test: GTS media tests
bug:73500808
Change-Id: I47ae0f82d4e614b1e78923ed48fbe4c024df5d71
Adds support to fetch metrics from vendor and convert them to a proto
bundle returned from a call to getMetrics.
Bug: 64001676
Test: CTS test for metrics and GPlay test
Change-Id: I05634dd1bf092e64e2d0e77c4c0e243340af48e3
Relocate drm and crypto headers from media
to mediadrm to have finer grained ownership
bug:73556221
Change-Id: I7d1b5944f261f9b1fdeed7605e4c0b4b4ca43e1a
closeAllSessions() was calling into the hidl interface closeSession
directly, and neglected to check the return status which resulted in
an abort. Instead, call the DrmHal::closeSession() method which handles
the hidl return status correctly.
Test: gts media tests
bug:72400509
Change-Id: I697997eb73ef6d8746fe695509671c4695124cee
Adds proto serialization and logging support for media drm framework metrics.
Bug: 64001676
Test: Ran CTS tests, unit tests and Google Play.
Change-Id: Ie350ac93caa6b35610eb63e4acc860c8e8a5cf5b
getKeyRequest_1_1 was using 1.0 callback.
This fix creates a common function for both 1.0 and 1.1
getKeyRequest to call. The function now calls the version
appropriate callback to return key request data, key type
and default url.
Test: CTS ClearKeySystemTest#testClearKeyPlaybackCenc
Test: CTS ClearKeySystemTest#testGetProperties
Test: CTS ClearKeySystemTest#testSetProperties
Test: Verify getKeyRequest_1_1 is called
bug: 73085826
Change-Id: Id70a92862473540f5a4eb815892a69dfe1601b92
Some metrics required a conversion to using PersistableBundle to support
slightly richer structure (lists, and nested PBs).
BUG: 64001676
Test: Ran updated CTS test and verified Google Play works.
Change-Id: I8f8d67ba04b234f2ac5ac348a8945e20837f98d6
This reverts commit a3c77911df.
Reason for revert: build cop here. The original CL broke build git_master / walleye_asan, hence I'm reverting.
https://android-build.googleplex.com/builds/submitted/4597721/walleye_asan-userdebug/latest/view/logs/build_error.log
In file included from vendor/google/tools/security/fuzzers/libFuzzer/ICrypto_fuzzer/ICrypto_fuzzer.cpp:24:
frameworks/av/include/media/CryptoHal.h:23:10: fatal error: 'android/hardware/drm/1.1/ICryptoFactory.h' file not found
Change-Id: I185d5310cadb9990b864d71e42bba94f4740160c
This change in DrmHal allows us to transfer a PersistableBundle containing
previously unavailable metrics.
Bug: 64001676
Test: CTS test for metrics and GPlay test
Change-Id: I1fa87c76dd980a3f91b4e2d02b37329f6c0a88ec
kVersionValue should return 1.1. Also change getPropertyString
to get value from mStringProperties[] instead of using hard coded
values.
Test: CTS ClearKeySystemTest#testGetProperties
bug: 73031837
Change-Id: I9d108a42a75ac3685d2c6ef58697efffe6152284
Vendors implementing the newly added MediaDrm.setSecurityLevel
HAL found that it was difficult to implement properly. Also the
semantics are somewhat ambiguous from the Java platform API
level. This CL binds the security level assignment to openSession
which clarifies the API for apps as well as making it more
natural to implement in HAL modules.
bug:72831697
bug:64001680
test: VtsHalDrmV1_1TargetTest, GTS media tests
Change-Id: Iaa07727be86ec2bc92be907d5a48c92136dc2014
Adds an implementation of getMetrics to the ClearKey implementation.
BUG: 69635855
Test: VtsHalDrmV1_1TargetTest
Change-Id: I3e01037081e8855e1dc9ff332c27edb8c79040df
Create clearkey HIDL service to support new APIs for drm 1.1 HAL.
The directories are organized into common, default and hidl.
The old shared library source is in common and default.
The new clearkey service source is in common and hidl.
Test: VtsHalDrmV1_1TargetTest
bug: 69635855
Change-Id: I2e8e0e1a39b622aa274ecd32c873d81b95bdc4f8
Also check for NULL mDrmPlugin before casting to V1_1.
Test: Play Movies and NetFlix
bug: 72687425
Change-Id: I47aa18730332a17860b7e27440d417ffd612810f
This reverts commit 09a90ab544.
Fix for regressed b/72666743
Test: manual test to confirm problem is fixed.
See bug for repro steps.
Change-Id: Ifac9a2c3a3a92063d544e39ace48ab14c90b8050
the 'finalized' concept didn't pan out -- remove references to it.
Simplifies the code flow.
Also purged some uses of generateSessionID().
Bug: 71874686
Test: logcat/dumpsys
Change-Id: I39e48526a5696158d8195f47154881ca6ecda266
Methods are needed to release a secure stop by ID and
return a list of secure stops.
Tests: gts media tests
bug:67361434
bug:64001680
Change-Id: If6cb180cb4d2e3b655028955d105aee0cb8d70b6
The metric names need to be consistent with related APIs (e.g.
MediaCodec#getMetrics). Those APIs use dot separators rather than
slashes.
Bug 64001676
Test: Re-ran CTS, unit tests. Smoke with GPlay Movies.
Change-Id: I606e4c4bcbf630d584b9dea80471ad256764a42b
Adds nearly all of the remaining specified framework level metrics.
Also adds a basic unit test to verify that metrics are exported
correctly. A follow-up CL will update the CTS test to touch all metric
values in DrmHal.
BUG: 64001676
Test: New unit test. Smoke tested with GPlay/Walleye.
Change-Id: I4df90675ae304d3c62b7886537328b3d848fd77c
Adds an EventMetric class, associated unit tests, and an instance of the
EventMetric to DrmHal. Also added a unit test for CounterMetric and
created a class to hold all of the future metric instances.
BUG: 64001676
Test: Added and ran unit tests. Also added a CTS test case.
Change-Id: Ic94bedd5f8293a58a939613a4ae69ce656a772be
closeAllSessions() was calling into the hidl interface closeSession
directly, and neglected to check the return status which resulted in
an abort. Instead, call the DrmHal::closeSession() method which handles
the hidl return status correctly.
Test: gts media tests
bug:72400509
Change-Id: I444be998702aeaca2905ddf560a5138d5775a316
This adds a new class CounterMetric which is used to hold metric
information. It also adds a single use case for recording and
reporting a counter metric.
BUG: 64001676
Test: Added and ran a new test for the specific CounterMetric use case.
Change-Id: I39cab8328f135e579f80b6c2fab721da5f569795
Two additional KeyRequestTypes have been added, None and Update. None
indicates that no key request is needed as keys have already been
loaded. Update indicates that while keys have previously been loaded,
an additional (non-renewal) license request is needed.
Bug: 70335058
Test: GtsMediaTestCases
Change-Id: I36a8b334c70140098a01e4a3bea3159fc0a4584f
Methods for querying HDCP, security levels and
number of sessions
bug:64001680
bug:33657579
Test: cts: MediaDrmMockTest, ClearKeySystemTest
gts: GtsMediaTestCases
Change-Id: I7c84df02ec33d305b6bd5ac7479922f87aa64863
Adds support for the new getMetrics call to the IDrm interface and the
DrmHal implementation. The implementation currently returns a dummy
metric collection. Follow-up CLs will flesh out the implementation.
Bug: 64001676
Test: Ran the new unit test created in a related CL; ran Google Play.
Change-Id: Ia6a3af5b59a30ca55267f7e3ba278a510fc8c81e
change from AString to std::string for how media.metrics handles
strings. This severs the dependency on libstagefright_foundation,
where AString is implemented, so we can integrate into places
which do not want to introduce a dependency on libstagefright_foundation.
Bug: 70805723
Test: compilation/linking, CTS subset
Change-Id: I66de971b6ec354444e06112607a2d7614084cef8
Changes to the clearkey plugin broke existing vts
tests, and those tests can't be changed due to
backward compatibility requirements. This CL
reverts the parts of ag/3125606 that caused the
test failures, while retaining most of those
changes.
bug:70660219
Test: vts-tradefed run commandAndExit vts -m VtsHalDrmV1_0Target
Change-Id: Iab54b0917cc2e1edafc98bd97390bf9937b3d2ca
Calculating index sometimes causes an unsigned integer overflow. This
throws a runtime error on integer sanitized builds.
runtime error: unsigned integer overflow: 0 - 1 cannot be represented
in type 'unsigned int'
Since this gets implicitly converted to ssize_t anyhow, make the
conversion explicit before decrementing to avoid the overflow.
Bug: 30969751
Test: Compiles.
Change-Id: Ibd39c1ba0dc64673743672ffc70c22c09f8e828a
Merged-In: Ibd39c1ba0dc64673743672ffc70c22c09f8e828a
* Comment out unused parameters.
* Remove unused local constants.
* Use both unsigned/signed values for EXPECT_EQ.
Bug: 66996870
Test: normal build.
Change-Id: Ia396e5ba1f57e547ac731bd7cdb3e6ff4290b52a
MockCasPlugin.cpp: These are printing out `size_t`s, so we should be
using %zu.
ClearKeyFetcher.cpp: asset_.id() is an `unsigned long long`, so we
can't use PRIu64 for it.
Bug: None
Test: mma. Warnings are gone.
Merged-In: Ie34acb274696dea999f6309fb914b39ef00f4d77
(cherry picked from commit 843328ff13)
Change-Id: I7be4fff7d3fd603b7ab64397a6a05c28f7a34ace
Calculating index sometimes causes an unsigned integer overflow. This
throws a runtime error on integer sanitized builds.
runtime error: unsigned integer overflow: 0 - 1 cannot be represented
in type 'unsigned int'
Since this gets implicitly converted to ssize_t anyhow, make the
conversion explicit before decrementing to avoid the overflow.
Bug: 30969751
Test: Compiles.
Change-Id: Ibd39c1ba0dc64673743672ffc70c22c09f8e828a
Cherry picked from http://go/ag/3038278.
AesCtrDecryptor::decrypt() doesn't check whether the size of "key"
is equal to 16 bytes, which may lead to an OOB read problem in the
context of mediadrmserver.
Add DecryptsWithEmptyKey and DecryptsWithKeyTooLong unit tests.
Test: ClearKeyDrmUnitTest
adb shell LD_LIBRARY_PATH="/vendor/lib/mediadrm"
/data/nativetest/ClearKeyDrmUnitTest/ClearKeyDrmUnitTest
bug: 63982768
Change-Id: I1f22c9df2b051972b2c532608b7f203e3ce77926
This turns on signed and unsigned integer overflow sanitization in the
libdrmclearkey library.
Bug: 67706062
Bug: 62343822
Test: Ran CtsMediaTestCases and CtsDrmMediaCases
Change-Id: If74850fe73f2cca13ad27d58458d559dd26953ee
Now that this API is available.
This keeps the implementation details of hidl's
ashmem allocator in libhidl itself (it should be
opaque).
Test: try and succeed watching (part of a) DRM protected movie
Bug: 34234561
Change-Id: Ied9beddace2ccfc859833ac55f4e3837db5f495e
The app package name was not previously reported in drm metrics. This
change reports the app package name as returned from the vendor metrics.
This is part of the fix. The other change will go into another project.
Bug: 64584568
Test: Unit tests, GTS tests, and Google Play.
Change-Id: Iee36d5203364c5f80a8b0fe9d9bbf5c167abefd1
Implement queryKeyStatus in Clearkey plugin for testing.
Add CTS testQueryKeyStatus in ClearKeySystemTest and
NativeClearKeySystemTest in a separate CL.
Test: CTS - ClearSystemTests
ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m
CtsMediaTestCases --test android.media.cts.ClearKeySystemTest
Test: CTS - NativeClearSystemTests
ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m
CtsMediaTestCases --test android.media.cts.NativeClearKeySystemTest
bug: 64938501
Change-Id: I8371a3b871e90762f1e7c8453dd6002c31f7eb13
Rather than having a lib called libstagefright_foundation and one
called libstagefright_foundation_vendor, we now just have one library
and the build system keeps track of the vendor APIs that are exposed.
Test: (sanity) boot device, watch (part of) DRM protected movie.
Change-Id: I49f1c557ae8f93092bad5314e0630583cc7dc710
Merged-In: I49f1c557ae8f93092bad5314e0630583cc7dc710
MockCasPlugin.cpp: These are printing out `size_t`s, so we should be
using %zu.
ClearKeyFetcher.cpp: asset_.id() is an `unsigned long long`, so we
can't use PRIu64 for it.
Bug: None
Test: mma. Warnings are gone.
Change-Id: Ie34acb274696dea999f6309fb914b39ef00f4d77
If addValue does not succeed, there will be memory leak on
decodeSession. Fixed it by checking if addValue returns true first.
Plus fixed a small indentation error.
Test: mmm with static analyzer and warning disappears.
Change-Id: Ibf9b85e4c416e8fea8b80a3ba47f87f88573c54c
HIDL transaction status wasn't being checked
resulting in a SIGABRT from createPlugin when the
remote process dies.
bug: 64441780
test: run Play Movies and repeat killing
android.hardware.drm@1.0-service.widevine, check
log for transaction failed messages.
Change-Id: I0ea70578d60bb84cf693f158963181781d7e35c3
Test: run Play Movies and repeat killing
android.hardware.drm@1.0-service.widevine, check
log for transaction failed messages. This uncovered
a related problem in closeSession which is also fixed
in this CL.
bug: 64022042
Change-Id: I4e86414aa1625c35689339389391e9fa6d377b1c
Merged-In: I4e86414aa1625c35689339389391e9fa6d377b1c
Test: run Play Movies and repeat killing
android.hardware.drm@1.0-service.widevine, check
log for transaction failed messages. This uncovered
a related problem in closeSession which is also fixed
in this CL.
bug: 64022042
Change-Id: I4e86414aa1625c35689339389391e9fa6d377b1c
Because DRM Plugins will not be allowed to call the AMI API under
Treble, the mediadrmservice will need to marshal the metrics out of the
plugin in protobuf format and report them to the AMI API instead. This
patch implements the pulling and interpreting of metrics from DRM
Plugins.
Bug: 36497276
Test: Played Google Play Movies, verified that playback still worked and
Widevine metrics appeared in a dump of the system media metrics.
Change-Id: If07717c1b87022bc1fcdedfbc62b9193899742d5
MediaDrm relies on each plugin to close its open sessions
when the plugin is destroyed. This change ensures that all
sessions will be closed even if the plugin does not do it.
b/38323088
Change-Id: I8b6e36182f3b3bc765963819101868fc46001527
When the vndk is enabled (BOARD_VNDK_VERSION=current),
vendor libraries must only link against vendor variants
in the build system. This also means that they receive
restricted sets of headers and that automatic global
headers are restricted.
Test: build ClearKeyDrmUnitTest with BOARD_VNDK_VERSION=current
Bug: 37342627
Change-Id: I5e95a19700522d3ec03e457d6779a34e9be99139
When the vndk is enabled (BOARD_VNDK_VERSION=current),
vendor libraries must only link against vendor variants
in the build system. This also means that they receive
restricted sets of headers and that automatic global
headers are restricted.
Test: build ClearKeyFetcherTest with BOARD_VNDK_VERSION=current
Bug: 37342627
Change-Id: If4a6b78f515a29c0af13ca1db8c75a06d10369eb
When the vndk is enabled (BOARD_VNDK_VERSION=current),
vendor libraries must only link against vendor variants
in the build system. This also means that they receive
restricted sets of headers and that automatic global
headers are restricted.
Test: BOARD_VNDK_VERSION=current m -j k libmockcasplugin
Bug: 37342627
Change-Id: I6129ae91458216f537f6fb4065ecd9f26739851c
Instead of relying on the global include paths, use the new headers lib
'media_plugin_headers'.
Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j libclearkeycasplugin
Change-Id: Ic6b5230bc9b674e21ccd36ce6ad117c687200599