Replace toStatus indirection.
CdmResponseType are mapped to android::status_t, then map to hidl android::hardware::drm::V1_0::Status. This CL removes the indirection by mapping cdm errors to hidl Status. Test: Play Movies (pin and streaming) Test: Netflix (download and streaming) Test: libwvdrmmediacrypto_hidl_test and libwvdrmdrmplugin_hidl_test Test: GtsMediaTestCases module Test: Vts - VtsHalDrmV1_0Target bug: 34682447 Change-Id: I0b04f47871f5e4898e7297831d5fceab52e0f7f9
This commit is contained in:
@@ -109,30 +109,6 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
|||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# Builds libwidevinehidl_utils.a
|
|
||||||
#
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
LOCAL_MODULE := libwidevinehidl_utils
|
|
||||||
LOCAL_PROPRIETARY_MODULE := true
|
|
||||||
|
|
||||||
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := \
|
|
||||||
vendor/widevine/libwvdrmengine/include_hidl
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
|
||||||
src_hidl/TypeConvert.cpp
|
|
||||||
|
|
||||||
LOCAL_HEADER_LIBRARIES := \
|
|
||||||
libstagefright_headers
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
|
||||||
android.hardware.drm@1.0
|
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Builds libwvdrmengine.so
|
# Builds libwvdrmengine.so
|
||||||
#
|
#
|
||||||
@@ -226,11 +202,6 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
libwvdrmdrmplugin_hidl \
|
libwvdrmdrmplugin_hidl \
|
||||||
libwvlevel3 \
|
libwvlevel3 \
|
||||||
|
|
||||||
# When the GNU linker sees a library, it discards all symbols that it doesn't
|
|
||||||
# need. libwidevinehidl_utils must come after both libwvdrmcryptoplugin and
|
|
||||||
# libwvdrmdrmplugin.
|
|
||||||
LOCAL_STATIC_LIBRARIES += libwidevinehidl_utils
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
android.hardware.drm@1.0 \
|
android.hardware.drm@1.0 \
|
||||||
android.hidl.memory@1.0 \
|
android.hidl.memory@1.0 \
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ template<typename T, size_t SIZE> std::vector<T> toVector(
|
|||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status toStatus(status_t mediaError);
|
|
||||||
|
|
||||||
} // namespace widevine
|
} // namespace widevine
|
||||||
} // namespace V1_0
|
} // namespace V1_0
|
||||||
} // namespace drm
|
} // namespace drm
|
||||||
|
|||||||
330
libwvdrmengine/include_hidl/mapErrors-inl.h
Normal file
330
libwvdrmengine/include_hidl/mapErrors-inl.h
Normal file
@@ -0,0 +1,330 @@
|
|||||||
|
//
|
||||||
|
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef WV_MAP_ERRORS_H_
|
||||||
|
#define WV_MAP_ERRORS_H_
|
||||||
|
|
||||||
|
#include "media/stagefright/MediaErrors.h"
|
||||||
|
#include "utils/Errors.h"
|
||||||
|
#include "wv_cdm_types.h"
|
||||||
|
#include "WVErrors.h"
|
||||||
|
|
||||||
|
namespace wvdrm {
|
||||||
|
|
||||||
|
using ::android::hardware::drm::V1_0::Status;
|
||||||
|
|
||||||
|
static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
|
||||||
|
switch (res) {
|
||||||
|
case wvcdm::KEY_ADDED:
|
||||||
|
case wvcdm::KEY_MESSAGE:
|
||||||
|
case wvcdm::KEY_CANCELED:
|
||||||
|
// KEY_ADDED, KEY_MESSAGE, and KEY_CANCELLED are all alternative
|
||||||
|
// success messages for certain CDM methods instead of NO_ERROR.
|
||||||
|
case wvcdm::NO_ERROR:
|
||||||
|
return Status::OK;
|
||||||
|
|
||||||
|
case wvcdm::DECRYPT_NOT_READY:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_IN_SESSION:
|
||||||
|
case wvcdm::NEED_KEY:
|
||||||
|
return Status::ERROR_DRM_NO_LICENSE;
|
||||||
|
|
||||||
|
case wvcdm::NEED_PROVISIONING:
|
||||||
|
return Status::ERROR_DRM_NOT_PROVISIONED;
|
||||||
|
|
||||||
|
case wvcdm::DEVICE_REVOKED:
|
||||||
|
return Status::ERROR_DRM_DEVICE_REVOKED;
|
||||||
|
|
||||||
|
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
|
||||||
|
return Status::ERROR_DRM_RESOURCE_BUSY;
|
||||||
|
|
||||||
|
case wvcdm::RELEASE_USAGE_INFO_ERROR:
|
||||||
|
case wvcdm::RELEASE_USAGE_INFO_FAILED:
|
||||||
|
return Status::ERROR_DRM_INVALID_STATE;
|
||||||
|
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_1:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_2:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_3:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_4:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_5:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_6:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_7:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_8:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_9:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_10:
|
||||||
|
return Status::ERROR_DRM_SESSION_NOT_OPENED;
|
||||||
|
|
||||||
|
case wvcdm::DECRYPT_ERROR:
|
||||||
|
case wvcdm::SECURE_BUFFER_REQUIRED:
|
||||||
|
return Status::ERROR_DRM_CANNOT_HANDLE;
|
||||||
|
|
||||||
|
case wvcdm::ANALOG_OUTPUT_ERROR:
|
||||||
|
case wvcdm::KEY_PROHIBITED_FOR_SECURITY_LEVEL:
|
||||||
|
case wvcdm::INSUFFICIENT_OUTPUT_PROTECTION:
|
||||||
|
return Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
|
||||||
|
|
||||||
|
// The following cases follow the order in wv_cdm_types.h
|
||||||
|
// to make it easier to keep track of newly defined errors.
|
||||||
|
case wvcdm::KEY_ERROR:
|
||||||
|
case wvcdm::ADD_KEY_ERROR:
|
||||||
|
case wvcdm::CERT_PROVISIONING_GET_KEYBOX_ERROR_1:
|
||||||
|
case wvcdm::CERT_PROVISIONING_GET_KEYBOX_ERROR_2:
|
||||||
|
case wvcdm::CERT_PROVISIONING_INVALID_CERT_TYPE:
|
||||||
|
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_1:
|
||||||
|
case wvcdm::CERT_PROVISIONING_NONCE_GENERATION_ERROR:
|
||||||
|
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_3:
|
||||||
|
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_4:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_1:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_2:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_3:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_4:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_5:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_6:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_7:
|
||||||
|
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_8:
|
||||||
|
case wvcdm::CRYPTO_SESSION_OPEN_ERROR_1:
|
||||||
|
case wvcdm::CRYPTO_SESSION_OPEN_ERROR_2:
|
||||||
|
case wvcdm::CRYPTO_SESSION_OPEN_ERROR_3:
|
||||||
|
case wvcdm::CRYPTO_SESSION_OPEN_ERROR_4:
|
||||||
|
case wvcdm::CRYPTO_SESSION_OPEN_ERROR_5:
|
||||||
|
case wvcdm::DEVICE_CERTIFICATE_ERROR_1:
|
||||||
|
case wvcdm::DEVICE_CERTIFICATE_ERROR_2:
|
||||||
|
case wvcdm::DEVICE_CERTIFICATE_ERROR_3:
|
||||||
|
case wvcdm::DEVICE_CERTIFICATE_ERROR_4:
|
||||||
|
case wvcdm::EMPTY_KEY_DATA_1:
|
||||||
|
case wvcdm::EMPTY_KEY_DATA_2:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID_ENG_1:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID_ENG_2:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID_ENG_3:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID_ENG_4:
|
||||||
|
case wvcdm::EMPTY_LICENSE_RENEWAL:
|
||||||
|
case wvcdm::EMPTY_LICENSE_RESPONSE_1:
|
||||||
|
case wvcdm::EMPTY_LICENSE_RESPONSE_2:
|
||||||
|
case wvcdm::EMPTY_PROVISIONING_CERTIFICATE_1:
|
||||||
|
case wvcdm::EMPTY_PROVISIONING_RESPONSE:
|
||||||
|
case wvcdm::EMPTY_SESSION_ID:
|
||||||
|
case wvcdm::GENERATE_DERIVED_KEYS_ERROR:
|
||||||
|
case wvcdm::LICENSE_RENEWAL_NONCE_GENERATION_ERROR:
|
||||||
|
case wvcdm::GENERATE_USAGE_REPORT_ERROR:
|
||||||
|
case wvcdm::GET_LICENSE_ERROR:
|
||||||
|
case wvcdm::GET_RELEASED_LICENSE_ERROR:
|
||||||
|
case wvcdm::GET_USAGE_INFO_ERROR_1:
|
||||||
|
case wvcdm::GET_USAGE_INFO_ERROR_2:
|
||||||
|
case wvcdm::GET_USAGE_INFO_ERROR_3:
|
||||||
|
case wvcdm::GET_USAGE_INFO_ERROR_4:
|
||||||
|
case wvcdm::INIT_DATA_NOT_FOUND:
|
||||||
|
case wvcdm::INVALID_CRYPTO_SESSION_1:
|
||||||
|
case wvcdm::INVALID_CRYPTO_SESSION_2:
|
||||||
|
case wvcdm::INVALID_CRYPTO_SESSION_3:
|
||||||
|
case wvcdm::INVALID_CRYPTO_SESSION_4:
|
||||||
|
case wvcdm::INVALID_CRYPTO_SESSION_5:
|
||||||
|
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_1:
|
||||||
|
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_2:
|
||||||
|
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_3:
|
||||||
|
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_4:
|
||||||
|
case wvcdm::INVALID_DEVICE_CERTIFICATE_TYPE:
|
||||||
|
case wvcdm::INVALID_KEY_SYSTEM:
|
||||||
|
case wvcdm::INVALID_LICENSE_RESPONSE:
|
||||||
|
case wvcdm::INVALID_LICENSE_TYPE:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_1:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_2:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_3:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_4:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_1:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_2:
|
||||||
|
case wvcdm::INVALID_PROVISIONING_PARAMETERS_1:
|
||||||
|
case wvcdm::INVALID_PROVISIONING_PARAMETERS_2:
|
||||||
|
case wvcdm::INVALID_PROVISIONING_REQUEST_PARAM_1:
|
||||||
|
case wvcdm::INVALID_PROVISIONING_REQUEST_PARAM_2:
|
||||||
|
case wvcdm::INVALID_QUERY_KEY:
|
||||||
|
case wvcdm::INVALID_SESSION_ID:
|
||||||
|
case wvcdm::KEY_REQUEST_ERROR_1:
|
||||||
|
case wvcdm::KEY_SIZE_ERROR:
|
||||||
|
case wvcdm::KEYSET_ID_NOT_FOUND_1:
|
||||||
|
case wvcdm::KEYSET_ID_NOT_FOUND_2:
|
||||||
|
case wvcdm::KEYSET_ID_NOT_FOUND_3:
|
||||||
|
case wvcdm::LICENSE_ID_NOT_FOUND:
|
||||||
|
case wvcdm::LICENSE_PARSER_INIT_ERROR:
|
||||||
|
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_1:
|
||||||
|
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_2:
|
||||||
|
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_3:
|
||||||
|
case wvcdm::LICENSE_RESPONSE_NOT_SIGNED:
|
||||||
|
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_1:
|
||||||
|
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_2:
|
||||||
|
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_3:
|
||||||
|
case wvcdm::LOAD_KEY_ERROR:
|
||||||
|
case wvcdm::NO_CONTENT_KEY:
|
||||||
|
case wvcdm::REFRESH_KEYS_ERROR:
|
||||||
|
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_1:
|
||||||
|
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_2:
|
||||||
|
case wvcdm::RELEASE_KEY_ERROR:
|
||||||
|
case wvcdm::RELEASE_KEY_REQUEST_ERROR:
|
||||||
|
case wvcdm::RELEASE_LICENSE_ERROR_1:
|
||||||
|
case wvcdm::RELEASE_LICENSE_ERROR_2:
|
||||||
|
case wvcdm::RENEW_KEY_ERROR_1:
|
||||||
|
case wvcdm::RENEW_KEY_ERROR_2:
|
||||||
|
case wvcdm::LICENSE_RENEWAL_SIGNING_ERROR:
|
||||||
|
case wvcdm::RESTORE_OFFLINE_LICENSE_ERROR_2:
|
||||||
|
case wvcdm::SESSION_INIT_ERROR_1:
|
||||||
|
case wvcdm::SESSION_INIT_ERROR_2:
|
||||||
|
case wvcdm::SESSION_KEYS_NOT_FOUND:
|
||||||
|
case wvcdm::SIGNATURE_NOT_FOUND:
|
||||||
|
case wvcdm::STORE_LICENSE_ERROR_1:
|
||||||
|
case wvcdm::STORE_LICENSE_ERROR_2:
|
||||||
|
case wvcdm::STORE_USAGE_INFO_ERROR:
|
||||||
|
case wvcdm::UNPROVISION_ERROR_1:
|
||||||
|
case wvcdm::UNPROVISION_ERROR_2:
|
||||||
|
case wvcdm::UNPROVISION_ERROR_3:
|
||||||
|
case wvcdm::UNPROVISION_ERROR_4:
|
||||||
|
case wvcdm::UNSUPPORTED_INIT_DATA:
|
||||||
|
case wvcdm::USAGE_INFO_NOT_FOUND:
|
||||||
|
case wvcdm::LICENSE_RENEWAL_SERVICE_CERTIFICATE_GENERATION_ERROR:
|
||||||
|
case wvcdm::PARSE_SERVICE_CERTIFICATE_ERROR:
|
||||||
|
case wvcdm::SERVICE_CERTIFICATE_TYPE_ERROR:
|
||||||
|
case wvcdm::CLIENT_ID_GENERATE_RANDOM_ERROR:
|
||||||
|
case wvcdm::CLIENT_ID_AES_INIT_ERROR:
|
||||||
|
case wvcdm::CLIENT_ID_AES_ENCRYPT_ERROR:
|
||||||
|
case wvcdm::CLIENT_ID_RSA_INIT_ERROR:
|
||||||
|
case wvcdm::CLIENT_ID_RSA_ENCRYPT_ERROR:
|
||||||
|
case wvcdm::INVALID_QUERY_STATUS:
|
||||||
|
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_4:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_3:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_4:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_6:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_LIC_7:
|
||||||
|
case wvcdm::LICENSE_REQUEST_SERVICE_CERTIFICATE_GENERATION_ERROR:
|
||||||
|
case wvcdm::CENC_INIT_DATA_UNAVAILABLE:
|
||||||
|
case wvcdm::PREPARE_CENC_CONTENT_ID_FAILED:
|
||||||
|
case wvcdm::WEBM_INIT_DATA_UNAVAILABLE:
|
||||||
|
case wvcdm::PREPARE_WEBM_CONTENT_ID_FAILED:
|
||||||
|
case wvcdm::UNSUPPORTED_INIT_DATA_FORMAT:
|
||||||
|
case wvcdm::LICENSE_REQUEST_NONCE_GENERATION_ERROR:
|
||||||
|
case wvcdm::LICENSE_REQUEST_SIGNING_ERROR:
|
||||||
|
case wvcdm::EMPTY_LICENSE_REQUEST:
|
||||||
|
case wvcdm::DUPLICATE_SESSION_ID_SPECIFIED:
|
||||||
|
case wvcdm::LICENSE_RENEWAL_PROHIBITED:
|
||||||
|
case wvcdm::EMPTY_PROVISIONING_CERTIFICATE_2:
|
||||||
|
case wvcdm::OFFLINE_LICENSE_PROHIBITED:
|
||||||
|
case wvcdm::STORAGE_PROHIBITED:
|
||||||
|
case wvcdm::EMPTY_KEYSET_ID_ENG_5:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_11:
|
||||||
|
case wvcdm::LOAD_USAGE_INFO_FILE_ERROR:
|
||||||
|
case wvcdm::LOAD_USAGE_INFO_MISSING:
|
||||||
|
case wvcdm::SESSION_FILE_HANDLE_INIT_ERROR:
|
||||||
|
case wvcdm::INCORRECT_CRYPTO_MODE:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_5:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_12:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_1:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_2:
|
||||||
|
case wvcdm::KEY_CONFLICT_1:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_6:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_7:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_8:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_9:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_10:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_11:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_12:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_13:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_14:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_15:
|
||||||
|
case wvcdm::SESSION_NOT_FOUND_16:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_3:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_4:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_5:
|
||||||
|
case wvcdm::KEY_NOT_FOUND_6:
|
||||||
|
case wvcdm::INVALID_SESSION_1:
|
||||||
|
case wvcdm::NO_DEVICE_KEY_1:
|
||||||
|
case wvcdm::NO_CONTENT_KEY_2:
|
||||||
|
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_2:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_13:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_14:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_15:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_16:
|
||||||
|
case wvcdm::DEVICE_CERTIFICATE_ERROR_5:
|
||||||
|
case wvcdm::CERT_PROVISIONING_CLIENT_TOKEN_ERROR_1:
|
||||||
|
case wvcdm::CERT_PROVISIONING_CLIENT_TOKEN_ERROR_2:
|
||||||
|
case wvcdm::LICENSING_CLIENT_TOKEN_ERROR_1:
|
||||||
|
case wvcdm::UNKNOWN_SELECT_KEY_ERROR_1:
|
||||||
|
case wvcdm::UNKNOWN_SELECT_KEY_ERROR_2:
|
||||||
|
case wvcdm::CREATE_USAGE_TABLE_ERROR:
|
||||||
|
case wvcdm::LOAD_USAGE_HEADER_GENERATION_SKEW:
|
||||||
|
case wvcdm::LOAD_USAGE_HEADER_SIGNATURE_FAILURE:
|
||||||
|
case wvcdm::LOAD_USAGE_HEADER_BAD_MAGIC:
|
||||||
|
case wvcdm::LOAD_USAGE_HEADER_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_17:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_18:
|
||||||
|
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_3:
|
||||||
|
case wvcdm::CREATE_USAGE_ENTRY_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::LOAD_USAGE_ENTRY_GENERATION_SKEW:
|
||||||
|
case wvcdm::LOAD_USAGE_ENTRY_SIGNATURE_FAILURE:
|
||||||
|
case wvcdm::LOAD_USAGE_ENTRY_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_19:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_20:
|
||||||
|
case wvcdm::UPDATE_USAGE_ENTRY_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_21:
|
||||||
|
case wvcdm::SHRINK_USAGE_TABLER_HEADER_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::MOVE_USAGE_ENTRY_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::COPY_OLD_USAGE_ENTRY_UNKNOWN_ERROR:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_22:
|
||||||
|
case wvcdm::STORE_LICENSE_ERROR_4:
|
||||||
|
case wvcdm::LIST_LICENSES_ERROR:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_23:
|
||||||
|
case wvcdm::USAGE_INFORMATION_SUPPORT_FAILED:
|
||||||
|
case wvcdm::USAGE_SUPPORT_GET_API_FAILED:
|
||||||
|
case wvcdm::UNEXPECTED_EMPTY_USAGE_ENTRY:
|
||||||
|
case wvcdm::INVALID_USAGE_ENTRY_NUMBER_MODIFICATION:
|
||||||
|
case wvcdm::USAGE_INVALID_NEW_ENTRY:
|
||||||
|
case wvcdm::USAGE_INVALID_PARAMETERS_1:
|
||||||
|
case wvcdm::USAGE_RETRIEVE_LICENSE_FAILED:
|
||||||
|
case wvcdm::USAGE_RETRIEVE_USAGE_INFO_FAILED:
|
||||||
|
case wvcdm::USAGE_RETRIEVE_INVALID_STORAGE_TYPE:
|
||||||
|
case wvcdm::USAGE_ENTRY_NUMBER_MISMATCH:
|
||||||
|
case wvcdm::USAGE_STORE_LICENSE_FAILED:
|
||||||
|
case wvcdm::USAGE_STORE_USAGE_INFO_FAILED:
|
||||||
|
case wvcdm::USAGE_INVALID_LOAD_ENTRY:
|
||||||
|
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_4:
|
||||||
|
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5:
|
||||||
|
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1:
|
||||||
|
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_2:
|
||||||
|
case wvcdm::NO_USAGE_ENTRIES:
|
||||||
|
case wvcdm::LIST_USAGE_ERROR_1:
|
||||||
|
case wvcdm::LIST_USAGE_ERROR_2:
|
||||||
|
case wvcdm::DELETE_USAGE_ERROR_1:
|
||||||
|
case wvcdm::DELETE_USAGE_ERROR_2:
|
||||||
|
case wvcdm::DELETE_USAGE_ERROR_3:
|
||||||
|
case wvcdm::PRIVACY_MODE_ERROR_1:
|
||||||
|
case wvcdm::PRIVACY_MODE_ERROR_2:
|
||||||
|
case wvcdm::PRIVACY_MODE_ERROR_3:
|
||||||
|
case wvcdm::EMPTY_RESPONSE_ERROR_1:
|
||||||
|
case wvcdm::INVALID_PARAMETERS_ENG_24:
|
||||||
|
case wvcdm::PARSE_RESPONSE_ERROR_1:
|
||||||
|
case wvcdm::PARSE_RESPONSE_ERROR_2:
|
||||||
|
case wvcdm::PARSE_RESPONSE_ERROR_3:
|
||||||
|
case wvcdm::PARSE_RESPONSE_ERROR_4:
|
||||||
|
ALOGW("Returns UNKNOWN error for legacy status: %d", res);
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
|
|
||||||
|
case wvcdm::UNKNOWN_ERROR:
|
||||||
|
case wvcdm::UNUSED_1:
|
||||||
|
case wvcdm::UNUSED_2:
|
||||||
|
case wvcdm::UNUSED_3:
|
||||||
|
case wvcdm::UNUSED_4:
|
||||||
|
case wvcdm::UNUSED_5:
|
||||||
|
case wvcdm::UNUSED_6:
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return here instead of as a default case so that the compiler will warn
|
||||||
|
// us if we forget to include an enum member in the switch statement.
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool isCdmResponseTypeSuccess(wvcdm::CdmResponseType res) {
|
||||||
|
return mapCdmResponseType(res) == Status::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace wvdrm
|
||||||
|
|
||||||
|
#endif // WV_MAP_ERRORS_H_
|
||||||
@@ -60,8 +60,7 @@ LOCAL_HEADER_LIBRARIES := \
|
|||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libcdm_protos \
|
libcdm_protos \
|
||||||
libcrypto \
|
libcrypto
|
||||||
libwidevinehidl_utils \
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
android.hardware.drm@1.0 \
|
android.hardware.drm@1.0 \
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ struct WVCryptoPlugin : public ICryptoPlugin {
|
|||||||
|
|
||||||
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
||||||
|
|
||||||
android::status_t attemptDecrypt(
|
Status attemptDecrypt(
|
||||||
const wvcdm::CdmDecryptionParameters& params,
|
const wvcdm::CdmDecryptionParameters& params,
|
||||||
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
|
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
|
||||||
static wvcdm::CdmResponseType countEncryptedBlocksInPatternedRange(
|
static wvcdm::CdmResponseType countEncryptedBlocksInPatternedRange(
|
||||||
|
|||||||
@@ -30,12 +30,9 @@ namespace V1_0 {
|
|||||||
namespace widevine {
|
namespace widevine {
|
||||||
|
|
||||||
using ::android::hardware::drm::V1_0::BufferType;
|
using ::android::hardware::drm::V1_0::BufferType;
|
||||||
using ::android::hardware::drm::V1_0::widevine::toStatus;
|
|
||||||
using ::android::hardware::drm::V1_0::widevine::toVector;
|
using ::android::hardware::drm::V1_0::widevine::toVector;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
using android::status_t;
|
|
||||||
|
|
||||||
using wvcdm::CdmDecryptionParameters;
|
using wvcdm::CdmDecryptionParameters;
|
||||||
using wvcdm::CdmQueryMap;
|
using wvcdm::CdmQueryMap;
|
||||||
using wvcdm::CdmResponseType;
|
using wvcdm::CdmResponseType;
|
||||||
@@ -258,10 +255,10 @@ Return<void> WVCryptoPlugin::decrypt(
|
|||||||
params.decrypt_buffer_offset = bufferOffset;
|
params.decrypt_buffer_offset = bufferOffset;
|
||||||
params.subsample_flags = clearFlags;
|
params.subsample_flags = clearFlags;
|
||||||
|
|
||||||
status_t res = attemptDecrypt(params, haveEncryptedSubsamples,
|
Status res = attemptDecrypt(params, haveEncryptedSubsamples,
|
||||||
&errorDetailMsg);
|
&errorDetailMsg);
|
||||||
if (res != android::OK) {
|
if (res != Status::OK) {
|
||||||
_hidl_cb(toStatus(res), 0, errorDetailMsg.c_str());
|
_hidl_cb(res, 0, errorDetailMsg.c_str());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
bufferOffset += subSample.numBytesOfClearData;
|
bufferOffset += subSample.numBytesOfClearData;
|
||||||
@@ -277,10 +274,10 @@ Return<void> WVCryptoPlugin::decrypt(
|
|||||||
params.decrypt_buffer_offset = bufferOffset;
|
params.decrypt_buffer_offset = bufferOffset;
|
||||||
params.subsample_flags = encryptedFlags;
|
params.subsample_flags = encryptedFlags;
|
||||||
|
|
||||||
status_t res = attemptDecrypt(params, haveEncryptedSubsamples,
|
Status res = attemptDecrypt(params, haveEncryptedSubsamples,
|
||||||
&errorDetailMsg);
|
&errorDetailMsg);
|
||||||
if (res != android::OK) {
|
if (res != Status::OK) {
|
||||||
_hidl_cb(toStatus(res), 0, errorDetailMsg.c_str());
|
_hidl_cb(res, 0, errorDetailMsg.c_str());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,14 +328,14 @@ Return<void> WVCryptoPlugin::decrypt(
|
|||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
|
Status WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
|
||||||
bool haveEncryptedSubsamples,
|
bool haveEncryptedSubsamples,
|
||||||
std::string* errorDetailMsg) {
|
std::string* errorDetailMsg) {
|
||||||
CdmResponseType res = mCDM->Decrypt(mSessionId, haveEncryptedSubsamples,
|
CdmResponseType res = mCDM->Decrypt(mSessionId, haveEncryptedSubsamples,
|
||||||
params);
|
params);
|
||||||
|
|
||||||
if (isCdmResponseTypeSuccess(res)) {
|
if (isCdmResponseTypeSuccess(res)) {
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
} else {
|
} else {
|
||||||
ALOGE("Decrypt error result in session %s during %s block: %d",
|
ALOGE("Decrypt error result in session %s during %s block: %d",
|
||||||
mSessionId.c_str(),
|
mSessionId.c_str(),
|
||||||
@@ -381,7 +378,7 @@ status_t WVCryptoPlugin::attemptDecrypt(const CdmDecryptionParameters& params,
|
|||||||
return mapCdmResponseType(res);
|
return mapCdmResponseType(res);
|
||||||
} else {
|
} else {
|
||||||
// Swallow the specifics of other errors to obscure decrypt internals.
|
// Swallow the specifics of other errors to obscure decrypt internals.
|
||||||
return kErrorCDMGeneric;
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,10 +86,6 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
libwvlevel3 \
|
libwvlevel3 \
|
||||||
libwvdrmcryptoplugin_hidl \
|
libwvdrmcryptoplugin_hidl \
|
||||||
|
|
||||||
# When the GNU linker sees a library, it discards all symbols that it doesn't
|
|
||||||
# need. libwidevinehidl_utils must come after libwvdrmcryptoplugin.
|
|
||||||
LOCAL_STATIC_LIBRARIES += libwidevinehidl_utils
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
android.hardware.drm@1.0 \
|
android.hardware.drm@1.0 \
|
||||||
android.hidl.memory@1.0 \
|
android.hidl.memory@1.0 \
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ using ::android::hardware::hidl_vec;
|
|||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
|
||||||
using android::status_t;
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using wvcdm::CdmIdentifier;
|
using wvcdm::CdmIdentifier;
|
||||||
using wvcdm::CdmKeyStatusMap;
|
using wvcdm::CdmKeyStatusMap;
|
||||||
@@ -180,7 +179,7 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
|
|||||||
bool hasNewUsableKey) override;
|
bool hasNewUsableKey) override;
|
||||||
|
|
||||||
// The following methods do not use hidl interface, it is used internally.
|
// The following methods do not use hidl interface, it is used internally.
|
||||||
virtual status_t unprovisionDevice();
|
virtual Status unprovisionDevice();
|
||||||
|
|
||||||
virtual void OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId);
|
virtual void OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId);
|
||||||
|
|
||||||
@@ -316,14 +315,14 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
|
|||||||
// calls into the CDM in order to identify which CDM instance should receive
|
// calls into the CDM in order to identify which CDM instance should receive
|
||||||
// the call. Calling this will seal the CDM Identifier Builder, thus making
|
// the call. Calling this will seal the CDM Identifier Builder, thus making
|
||||||
// it an error to change the origin.
|
// it an error to change the origin.
|
||||||
status_t getCdmIdentifier(CdmIdentifier* identifier);
|
Status getCdmIdentifier(CdmIdentifier* identifier);
|
||||||
|
|
||||||
// Gets the application-safe device-unique ID. On non-SPOID devices, this is
|
// Gets the application-safe device-unique ID. On non-SPOID devices, this is
|
||||||
// the device-unique ID from OEMCrypto. On SPOID devices, this is the SPOID.
|
// the device-unique ID from OEMCrypto. On SPOID devices, this is the SPOID.
|
||||||
// On SPOID devices, calling this will seal the CDM Identifier Builder, thus
|
// On SPOID devices, calling this will seal the CDM Identifier Builder, thus
|
||||||
// making it an error to change the origin.
|
// making it an error to change the origin.
|
||||||
status_t getDeviceUniqueId(std::string* id);
|
Status getDeviceUniqueId(std::string* id);
|
||||||
status_t getProvisioningUniqueId(std::string* id);
|
Status getProvisioningUniqueId(std::string* id);
|
||||||
|
|
||||||
const std::string& origin() const { return mCdmIdentifier.origin; }
|
const std::string& origin() const { return mCdmIdentifier.origin; }
|
||||||
bool set_origin(const std::string& id);
|
bool set_origin(const std::string& id);
|
||||||
@@ -338,13 +337,13 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
|
|||||||
std::string mAppPackageName;
|
std::string mAppPackageName;
|
||||||
const WVDrmPlugin& mParent;
|
const WVDrmPlugin& mParent;
|
||||||
|
|
||||||
status_t calculateSpoid();
|
Status calculateSpoid();
|
||||||
|
|
||||||
// Gets the device-unique ID from OEMCrypto. This must be private, since
|
// Gets the device-unique ID from OEMCrypto. This must be private, since
|
||||||
// this value must not be exposed to applications on SPOID devices. Code
|
// this value must not be exposed to applications on SPOID devices. Code
|
||||||
// outside this class should use getDeviceUniqueId() to get the
|
// outside this class should use getDeviceUniqueId() to get the
|
||||||
// application-safe device-unique ID.
|
// application-safe device-unique ID.
|
||||||
status_t getOemcryptoDeviceId(std::string* id);
|
Status getOemcryptoDeviceId(std::string* id);
|
||||||
} mCdmIdentifierBuilder;
|
} mCdmIdentifierBuilder;
|
||||||
|
|
||||||
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
||||||
@@ -352,27 +351,27 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
|
|||||||
map<CdmSessionId, CryptoSession> mCryptoSessions;
|
map<CdmSessionId, CryptoSession> mCryptoSessions;
|
||||||
sp<IDrmPluginListener> mListener;
|
sp<IDrmPluginListener> mListener;
|
||||||
|
|
||||||
status_t queryProperty(const std::string& property,
|
Status queryProperty(const std::string& property,
|
||||||
std::string& stringValue) const;
|
std::string& stringValue) const;
|
||||||
|
|
||||||
status_t queryProperty(wvcdm::SecurityLevel securityLevel,
|
Status queryProperty(wvcdm::SecurityLevel securityLevel,
|
||||||
const std::string& property,
|
const std::string& property,
|
||||||
std::string& stringValue) const;
|
std::string& stringValue) const;
|
||||||
|
|
||||||
status_t queryProperty(const std::string& property,
|
Status queryProperty(const std::string& property,
|
||||||
std::vector<uint8_t>& vector_value) const;
|
std::vector<uint8_t>& vector_value) const;
|
||||||
|
|
||||||
status_t mapAndNotifyOfCdmResponseType(const std::vector<uint8_t>& sessionId,
|
Status mapAndNotifyOfCdmResponseType(const std::vector<uint8_t>& sessionId,
|
||||||
CdmResponseType res);
|
CdmResponseType res);
|
||||||
|
|
||||||
status_t mapAndNotifyOfOEMCryptoResult(const std::vector<uint8_t>& sessionId,
|
Status mapAndNotifyOfOEMCryptoResult(const std::vector<uint8_t>& sessionId,
|
||||||
OEMCryptoResult res);
|
OEMCryptoResult res);
|
||||||
|
|
||||||
status_t mapOEMCryptoResult(OEMCryptoResult res);
|
Status mapOEMCryptoResult(OEMCryptoResult res);
|
||||||
|
|
||||||
bool initDataResemblesPSSH(const std::vector<uint8_t>& initData);
|
bool initDataResemblesPSSH(const std::vector<uint8_t>& initData);
|
||||||
|
|
||||||
status_t unprovision(const CdmIdentifier& identifier);
|
Status unprovision(const CdmIdentifier& identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widevine
|
} // namespace widevine
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ using ::android::hardware::drm::V1_0::KeyStatusType;
|
|||||||
using ::android::hardware::drm::V1_0::KeyType;
|
using ::android::hardware::drm::V1_0::KeyType;
|
||||||
using ::android::hardware::drm::V1_0::Status;
|
using ::android::hardware::drm::V1_0::Status;
|
||||||
using ::android::hardware::drm::V1_0::widevine::toHidlVec;
|
using ::android::hardware::drm::V1_0::widevine::toHidlVec;
|
||||||
using ::android::hardware::drm::V1_0::widevine::toStatus;
|
|
||||||
using ::android::hardware::drm::V1_0::widevine::toVector;
|
using ::android::hardware::drm::V1_0::widevine::toVector;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
@@ -123,13 +123,13 @@ WVDrmPlugin::~WVDrmPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Return<void> WVDrmPlugin::openSession(openSession_cb _hidl_cb) {
|
Return<void> WVDrmPlugin::openSession(openSession_cb _hidl_cb) {
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
std::vector<uint8_t> sessionId;
|
std::vector<uint8_t> sessionId;
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), toHidlVec(sessionId));
|
_hidl_cb(status, toHidlVec(sessionId));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ Return<void> WVDrmPlugin::openSession(openSession_cb _hidl_cb) {
|
|||||||
|
|
||||||
if (!isCdmResponseTypeSuccess(res)) {
|
if (!isCdmResponseTypeSuccess(res)) {
|
||||||
status = mapAndNotifyOfCdmResponseType(sessionId, res);
|
status = mapAndNotifyOfCdmResponseType(sessionId, res);
|
||||||
_hidl_cb(toStatus(status), toHidlVec(sessionId));
|
_hidl_cb(status, toHidlVec(sessionId));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +175,11 @@ Return<void> WVDrmPlugin::openSession(openSession_cb _hidl_cb) {
|
|||||||
} else {
|
} else {
|
||||||
// We got a failure that did not give us an error code, such as a failure
|
// We got a failure that did not give us an error code, such as a failure
|
||||||
// of AttachEventListener() or the key being missing from the map.
|
// of AttachEventListener() or the key being missing from the map.
|
||||||
status = kErrorCDMGeneric;
|
ALOGW("Returns UNKNOWN error for legacy status kErrorCDMGeneric");
|
||||||
|
status = Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_hidl_cb(toStatus(status), toHidlVec(sessionId));
|
_hidl_cb(status, toHidlVec(sessionId));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,15 +211,15 @@ Return<void> WVDrmPlugin::getKeyRequest(
|
|||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
KeyRequestType requestType = KeyRequestType::UNKNOWN;
|
KeyRequestType requestType = KeyRequestType::UNKNOWN;
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
std::string defaultUrl;
|
std::string defaultUrl;
|
||||||
std::vector<uint8_t> request;
|
std::vector<uint8_t> request;
|
||||||
const std::vector<uint8_t> scopeId = toVector(scope);
|
const std::vector<uint8_t> scopeId = toVector(scope);
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), toHidlVec(request), requestType,
|
_hidl_cb(status, toHidlVec(request), requestType,
|
||||||
defaultUrl.c_str());
|
defaultUrl.c_str());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -313,7 +314,7 @@ Return<void> WVDrmPlugin::getKeyRequest(
|
|||||||
// For all other requests, we have a session ID.
|
// For all other requests, we have a session ID.
|
||||||
status = mapAndNotifyOfCdmResponseType(scopeId, res);
|
status = mapAndNotifyOfCdmResponseType(scopeId, res);
|
||||||
}
|
}
|
||||||
_hidl_cb(toStatus(status), toHidlVec(request), requestType,
|
_hidl_cb(status, toHidlVec(request), requestType,
|
||||||
defaultUrl.c_str());
|
defaultUrl.c_str());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -356,7 +357,7 @@ Return<void> WVDrmPlugin::provideKeyResponse(
|
|||||||
keySetId = StrToVector(cdmKeySetId);
|
keySetId = StrToVector(cdmKeySetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
if (isRelease) {
|
if (isRelease) {
|
||||||
// When releasing keys, we do not have a session ID.
|
// When releasing keys, we do not have a session ID.
|
||||||
status = mapCdmResponseType(res);
|
status = mapCdmResponseType(res);
|
||||||
@@ -367,10 +368,10 @@ Return<void> WVDrmPlugin::provideKeyResponse(
|
|||||||
// return the error. This is because "NEED_KEY" from AddKey() is an
|
// return the error. This is because "NEED_KEY" from AddKey() is an
|
||||||
// expected behavior when sending a privacy certificate.
|
// expected behavior when sending a privacy certificate.
|
||||||
if (res == wvcdm::NEED_KEY && mPropertySet.use_privacy_mode()) {
|
if (res == wvcdm::NEED_KEY && mPropertySet.use_privacy_mode()) {
|
||||||
status = android::OK;
|
status = Status::OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_hidl_cb(toStatus(status), toHidlVec(keySetId));
|
_hidl_cb(status, toHidlVec(keySetId));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +385,7 @@ Return<Status> WVDrmPlugin::removeKeys(const hidl_vec<uint8_t>& sessionId) {
|
|||||||
|
|
||||||
CdmResponseType res = mCDM->RemoveKeys(cdmSessionId);
|
CdmResponseType res = mCDM->RemoveKeys(cdmSessionId);
|
||||||
|
|
||||||
return toStatus(mapAndNotifyOfCdmResponseType(sId, res));
|
return mapAndNotifyOfCdmResponseType(sId, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
||||||
@@ -400,16 +401,16 @@ Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
|||||||
|
|
||||||
CdmResponseType res = mCDM->RestoreKey(cdmSessionId, cdmKeySetId);
|
CdmResponseType res = mCDM->RestoreKey(cdmSessionId, cdmKeySetId);
|
||||||
|
|
||||||
return toStatus(mapAndNotifyOfCdmResponseType(sId, res));
|
return mapAndNotifyOfCdmResponseType(sId, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> WVDrmPlugin::queryKeyStatus(const hidl_vec<uint8_t>& sessionId,
|
Return<void> WVDrmPlugin::queryKeyStatus(const hidl_vec<uint8_t>& sessionId,
|
||||||
queryKeyStatus_cb _hidl_cb) {
|
queryKeyStatus_cb _hidl_cb) {
|
||||||
|
|
||||||
if (sessionId.size() == 0) {
|
if (sessionId.size() == 0) {
|
||||||
_hidl_cb(Status::BAD_VALUE, hidl_vec<KeyValue>());
|
_hidl_cb(Status::BAD_VALUE, hidl_vec<KeyValue>());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
const std::vector<uint8_t> sId = toVector(sessionId);
|
const std::vector<uint8_t> sId = toVector(sessionId);
|
||||||
CdmSessionId cdmSessionId(sId.begin(), sId.end());
|
CdmSessionId cdmSessionId(sId.begin(), sId.end());
|
||||||
CdmQueryMap cdmLicenseInfo;
|
CdmQueryMap cdmLicenseInfo;
|
||||||
@@ -432,7 +433,7 @@ Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(mapCdmResponseType(res)), toHidlVec(infoMapVec));
|
_hidl_cb(mapCdmResponseType(res), toHidlVec(infoMapVec));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,14 +441,14 @@ Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
|||||||
const hidl_string& certificateType,
|
const hidl_string& certificateType,
|
||||||
const hidl_string& certificateAuthority,
|
const hidl_string& certificateAuthority,
|
||||||
getProvisionRequest_cb _hidl_cb) {
|
getProvisionRequest_cb _hidl_cb) {
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
std::string defaultUrl;
|
std::string defaultUrl;
|
||||||
std::vector<uint8_t> request;
|
std::vector<uint8_t> request;
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), toHidlVec(request), hidl_string(defaultUrl));
|
_hidl_cb(status, toHidlVec(request), hidl_string(defaultUrl));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +471,7 @@ Return<Status> WVDrmPlugin::restoreKeys(const hidl_vec<uint8_t>& sessionId,
|
|||||||
defaultUrl.assign(cdmDefaultUrl.data(), cdmDefaultUrl.size());
|
defaultUrl.assign(cdmDefaultUrl.data(), cdmDefaultUrl.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(mapCdmResponseType(res)), toHidlVec(request),
|
_hidl_cb(mapCdmResponseType(res), toHidlVec(request),
|
||||||
hidl_string(defaultUrl));
|
hidl_string(defaultUrl));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -488,19 +489,20 @@ Return<void> WVDrmPlugin::provideProvisionResponse(
|
|||||||
std::vector<uint8_t> wrappedKey;
|
std::vector<uint8_t> wrappedKey;
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
Status status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), toHidlVec(certificate), toHidlVec(wrappedKey));
|
_hidl_cb(status, toHidlVec(certificate), toHidlVec(wrappedKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmProvisioningResponse cdmResponse(resp.begin(), resp.end());
|
CdmProvisioningResponse cdmResponse(resp.begin(), resp.end());
|
||||||
if (cdmResponse == kSpecialUnprovisionResponse) {
|
if (cdmResponse == kSpecialUnprovisionResponse) {
|
||||||
if (identifier == kDefaultCdmIdentifier) {
|
if (identifier == kDefaultCdmIdentifier) {
|
||||||
_hidl_cb(toStatus(kErrorNoOriginSpecified), toHidlVec(certificate),
|
ALOGW("Returns UNKNOWN error for legacy status kErrorNoOriginSpecified");
|
||||||
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(certificate),
|
||||||
toHidlVec(wrappedKey));
|
toHidlVec(wrappedKey));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
_hidl_cb(toStatus(unprovision(identifier)),
|
_hidl_cb(unprovision(identifier),
|
||||||
toHidlVec(certificate),
|
toHidlVec(certificate),
|
||||||
toHidlVec(wrappedKey));
|
toHidlVec(wrappedKey));
|
||||||
return Void();
|
return Void();
|
||||||
@@ -514,13 +516,13 @@ Return<void> WVDrmPlugin::provideProvisionResponse(
|
|||||||
wrappedKey = StrToVector(cdmWrappedKey);
|
wrappedKey = StrToVector(cdmWrappedKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(mapCdmResponseType(res)), toHidlVec(certificate),
|
_hidl_cb(mapCdmResponseType(res), toHidlVec(certificate),
|
||||||
toHidlVec(wrappedKey));
|
toHidlVec(wrappedKey));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::unprovisionDevice() {
|
Status WVDrmPlugin::unprovisionDevice() {
|
||||||
return unprovision(kDefaultCdmIdentifier);
|
return unprovision(kDefaultCdmIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,9 +538,9 @@ Return<void> WVDrmPlugin::getSecureStop(
|
|||||||
SecureStop secureStop;
|
SecureStop secureStop;
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
Status status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), secureStop);
|
_hidl_cb(status, secureStop);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +560,7 @@ Return<void> WVDrmPlugin::getSecureStop(
|
|||||||
secureStop.opaqueData = toHidlVec(cdmStopVec);
|
secureStop.opaqueData = toHidlVec(cdmStopVec);
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(mapCdmResponseType(res)), secureStop);
|
_hidl_cb(mapCdmResponseType(res), secureStop);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,9 +570,9 @@ Return<void> WVDrmPlugin::getSecureStops(getSecureStops_cb _hidl_cb) {
|
|||||||
std::vector<SecureStop> secureStopsVec;
|
std::vector<SecureStop> secureStopsVec;
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
Status status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
_hidl_cb(toStatus(status), toHidlVec(secureStopsVec));
|
_hidl_cb(status, toHidlVec(secureStopsVec));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,21 +597,21 @@ Return<void> WVDrmPlugin::getSecureStops(getSecureStops_cb _hidl_cb) {
|
|||||||
secureStopsVec.push_back(secureStop);
|
secureStopsVec.push_back(secureStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(mapCdmResponseType(res)), toHidlVec(secureStopsVec));
|
_hidl_cb(mapCdmResponseType(res), toHidlVec(secureStopsVec));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<Status> WVDrmPlugin::releaseAllSecureStops() {
|
Return<Status> WVDrmPlugin::releaseAllSecureStops() {
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
Status status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
return toStatus(status);
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType res = mCDM->ReleaseAllUsageInfo(mPropertySet.app_id(),
|
CdmResponseType res = mCDM->ReleaseAllUsageInfo(mPropertySet.app_id(),
|
||||||
identifier);
|
identifier);
|
||||||
return toStatus(mapCdmResponseType(res));
|
return mapCdmResponseType(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<Status> WVDrmPlugin::releaseSecureStop(
|
Return<Status> WVDrmPlugin::releaseSecureStop(
|
||||||
@@ -620,20 +622,20 @@ Return<Status> WVDrmPlugin::releaseSecureStop(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
Status status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
return toStatus(status);
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<uint8_t> ssRelease = toVector(secureStopId);
|
const std::vector<uint8_t> ssRelease = toVector(secureStopId);
|
||||||
CdmUsageInfoReleaseMessage cdmMessage(ssRelease.begin(), ssRelease.end());
|
CdmUsageInfoReleaseMessage cdmMessage(ssRelease.begin(), ssRelease.end());
|
||||||
CdmResponseType res = mCDM->ReleaseUsageInfo(cdmMessage, identifier);
|
CdmResponseType res = mCDM->ReleaseUsageInfo(cdmMessage, identifier);
|
||||||
return toStatus(mapCdmResponseType(res));
|
return mapCdmResponseType(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> WVDrmPlugin::getPropertyString(const hidl_string& propertyName,
|
Return<void> WVDrmPlugin::getPropertyString(const hidl_string& propertyName,
|
||||||
getPropertyString_cb _hidl_cb) {
|
getPropertyString_cb _hidl_cb) {
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
std::string name(propertyName.c_str());
|
std::string name(propertyName.c_str());
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|
||||||
@@ -689,10 +691,10 @@ Return<void> WVDrmPlugin::getPropertyString(const hidl_string& propertyName,
|
|||||||
status = queryProperty(wvcdm::QUERY_KEY_SRM_UPDATE_SUPPORT, value);
|
status = queryProperty(wvcdm::QUERY_KEY_SRM_UPDATE_SUPPORT, value);
|
||||||
} else {
|
} else {
|
||||||
ALOGE("App requested unknown string property %s", name.c_str());
|
ALOGE("App requested unknown string property %s", name.c_str());
|
||||||
status = android::ERROR_DRM_CANNOT_HANDLE;
|
status = Status::ERROR_DRM_CANNOT_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(status), value.c_str());
|
_hidl_cb(status, value.c_str());
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,20 +702,20 @@ Return<void> WVDrmPlugin::getPropertyByteArray(
|
|||||||
const hidl_string& propertyName,
|
const hidl_string& propertyName,
|
||||||
getPropertyByteArray_cb _hidl_cb) {
|
getPropertyByteArray_cb _hidl_cb) {
|
||||||
|
|
||||||
status_t status = android::OK;
|
Status status = Status::OK;
|
||||||
std::string name(propertyName.c_str());
|
std::string name(propertyName.c_str());
|
||||||
std::vector<uint8_t> value;
|
std::vector<uint8_t> value;
|
||||||
|
|
||||||
if (name == "deviceUniqueId") {
|
if (name == "deviceUniqueId") {
|
||||||
std::string id;
|
std::string id;
|
||||||
status = mCdmIdentifierBuilder.getDeviceUniqueId(&id);
|
status = mCdmIdentifierBuilder.getDeviceUniqueId(&id);
|
||||||
if (status == android::OK) {
|
if (status == Status::OK) {
|
||||||
value = StrToVector(id);
|
value = StrToVector(id);
|
||||||
}
|
}
|
||||||
} else if (name == "provisioningUniqueId") {
|
} else if (name == "provisioningUniqueId") {
|
||||||
std::string id;
|
std::string id;
|
||||||
status = mCdmIdentifierBuilder.getProvisioningUniqueId(&id);
|
status = mCdmIdentifierBuilder.getProvisioningUniqueId(&id);
|
||||||
if (status == android::OK) {
|
if (status == Status::OK) {
|
||||||
value = StrToVector(id);
|
value = StrToVector(id);
|
||||||
}
|
}
|
||||||
} else if (name == "serviceCertificate") {
|
} else if (name == "serviceCertificate") {
|
||||||
@@ -724,10 +726,10 @@ Return<void> WVDrmPlugin::getPropertyByteArray(
|
|||||||
value = StrToVector(metrics_value);
|
value = StrToVector(metrics_value);
|
||||||
} else {
|
} else {
|
||||||
ALOGE("App requested unknown byte array property %s", name.c_str());
|
ALOGE("App requested unknown byte array property %s", name.c_str());
|
||||||
status = android::ERROR_DRM_CANNOT_HANDLE;
|
status = Status::ERROR_DRM_CANNOT_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hidl_cb(toStatus(status), toHidlVec(value));
|
_hidl_cb(status, toHidlVec(value));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,11 +745,11 @@ Return<Status> WVDrmPlugin::setPropertyString(const hidl_string& propertyName,
|
|||||||
} else if (_value == wvcdm::QUERY_VALUE_SECURITY_LEVEL_L1.c_str()) {
|
} else if (_value == wvcdm::QUERY_VALUE_SECURITY_LEVEL_L1.c_str()) {
|
||||||
// We must be sure we CAN set the security level to L1.
|
// We must be sure we CAN set the security level to L1.
|
||||||
std::string current_security_level;
|
std::string current_security_level;
|
||||||
status_t status = queryProperty(
|
Status status = queryProperty(
|
||||||
wvcdm::kLevelDefault, wvcdm::QUERY_KEY_SECURITY_LEVEL,
|
wvcdm::kLevelDefault, wvcdm::QUERY_KEY_SECURITY_LEVEL,
|
||||||
current_security_level);
|
current_security_level);
|
||||||
if (status != android::OK) {
|
if (status != Status::OK) {
|
||||||
return toStatus(status);
|
return status;
|
||||||
}
|
}
|
||||||
if (current_security_level != wvcdm::QUERY_VALUE_SECURITY_LEVEL_L1) {
|
if (current_security_level != wvcdm::QUERY_VALUE_SECURITY_LEVEL_L1) {
|
||||||
ALOGE("App requested L1 security on a non-L1 device.");
|
ALOGE("App requested L1 security on a non-L1 device.");
|
||||||
@@ -763,7 +765,8 @@ Return<Status> WVDrmPlugin::setPropertyString(const hidl_string& propertyName,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ALOGE("App tried to change security level while sessions are open.");
|
ALOGE("App tried to change security level while sessions are open.");
|
||||||
return toStatus(kErrorSessionIsOpen);
|
ALOGW("Returns UNKNOWN error for legacy status kErrorSessionIsOpen");
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
} else if (name == "privacyMode") {
|
} else if (name == "privacyMode") {
|
||||||
if (_value == kEnable) {
|
if (_value == kEnable) {
|
||||||
@@ -786,19 +789,22 @@ Return<Status> WVDrmPlugin::setPropertyString(const hidl_string& propertyName,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ALOGE("App tried to change key sharing while sessions are open.");
|
ALOGE("App tried to change key sharing while sessions are open.");
|
||||||
return toStatus(kErrorSessionIsOpen);
|
ALOGW("Returns UNKNOWN error for legacy status kErrorSessionIsOpen");
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
} else if (name == "appId") {
|
} else if (name == "appId") {
|
||||||
if (mCryptoSessions.size() == 0) {
|
if (mCryptoSessions.size() == 0) {
|
||||||
mPropertySet.set_app_id(_value.c_str());
|
mPropertySet.set_app_id(_value.c_str());
|
||||||
} else {
|
} else {
|
||||||
ALOGE("App tried to set the application id while sessions are opened.");
|
ALOGE("App tried to set the application id while sessions are opened.");
|
||||||
return toStatus(kErrorSessionIsOpen);
|
ALOGW("Returns UNKNOWN error for legacy status kErrorSessionIsOpen");
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
} else if (name == "origin") {
|
} else if (name == "origin") {
|
||||||
if (mCryptoSessions.size() != 0) {
|
if (mCryptoSessions.size() != 0) {
|
||||||
ALOGE("App tried to set the origin while sessions are opened.");
|
ALOGE("App tried to set the origin while sessions are opened.");
|
||||||
return toStatus(kErrorSessionIsOpen);
|
ALOGW("Returns UNKNOWN error for legacy status kErrorSessionIsOpen");
|
||||||
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
if (!mCdmIdentifierBuilder.set_origin(_value.c_str())) {
|
if (!mCdmIdentifierBuilder.set_origin(_value.c_str())) {
|
||||||
return Status::BAD_VALUE;
|
return Status::BAD_VALUE;
|
||||||
@@ -902,7 +908,8 @@ Return<void> WVDrmPlugin::encrypt(
|
|||||||
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
||||||
|
|
||||||
if (cryptoSession.cipherAlgorithm() == kInvalidCryptoAlgorithm) {
|
if (cryptoSession.cipherAlgorithm() == kInvalidCryptoAlgorithm) {
|
||||||
_hidl_cb(toStatus(android::NO_INIT), toHidlVec(output));
|
ALOGW("Returns UNKNOWN error for legacy status NO_INIT");
|
||||||
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(output));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,7 +919,7 @@ Return<void> WVDrmPlugin::encrypt(
|
|||||||
|
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(output));
|
toHidlVec(output));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -929,7 +936,7 @@ Return<void> WVDrmPlugin::encrypt(
|
|||||||
_hidl_cb(Status::OK, toHidlVec(output));
|
_hidl_cb(Status::OK, toHidlVec(output));
|
||||||
} else {
|
} else {
|
||||||
ALOGE("OEMCrypto_Generic_Encrypt failed with %u", res);
|
ALOGE("OEMCrypto_Generic_Encrypt failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(output));
|
toHidlVec(output));
|
||||||
}
|
}
|
||||||
return Void();
|
return Void();
|
||||||
@@ -954,7 +961,8 @@ Return<void> WVDrmPlugin::decrypt(
|
|||||||
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
||||||
|
|
||||||
if (cryptoSession.cipherAlgorithm() == kInvalidCryptoAlgorithm) {
|
if (cryptoSession.cipherAlgorithm() == kInvalidCryptoAlgorithm) {
|
||||||
_hidl_cb(toStatus(android::NO_INIT), toHidlVec(output));
|
ALOGW("Returns UNKNOWN error for legacy status NO_INIT");
|
||||||
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(output));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,7 +972,7 @@ Return<void> WVDrmPlugin::decrypt(
|
|||||||
|
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(output));
|
toHidlVec(output));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -981,7 +989,7 @@ Return<void> WVDrmPlugin::decrypt(
|
|||||||
_hidl_cb(Status::OK, toHidlVec(output));
|
_hidl_cb(Status::OK, toHidlVec(output));
|
||||||
} else {
|
} else {
|
||||||
ALOGE("OEMCrypto_Generic_Decrypt failed with %u", res);
|
ALOGE("OEMCrypto_Generic_Decrypt failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(output));
|
toHidlVec(output));
|
||||||
}
|
}
|
||||||
return Void();
|
return Void();
|
||||||
@@ -1005,7 +1013,8 @@ Return<void> WVDrmPlugin::sign(
|
|||||||
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
||||||
|
|
||||||
if (cryptoSession.macAlgorithm() == kInvalidCryptoAlgorithm) {
|
if (cryptoSession.macAlgorithm() == kInvalidCryptoAlgorithm) {
|
||||||
_hidl_cb(toStatus(android::NO_INIT), toHidlVec(signature));
|
ALOGW("Returns UNKNOWN error for legacy status NO_INIT");
|
||||||
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(signature));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1015,7 +1024,7 @@ Return<void> WVDrmPlugin::sign(
|
|||||||
|
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(signature));
|
toHidlVec(signature));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -1031,7 +1040,7 @@ Return<void> WVDrmPlugin::sign(
|
|||||||
ALOGE("OEMCrypto_Generic_Sign failed with %u when requesting signature "
|
ALOGE("OEMCrypto_Generic_Sign failed with %u when requesting signature "
|
||||||
"size", res);
|
"size", res);
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(signature));
|
toHidlVec(signature));
|
||||||
} else {
|
} else {
|
||||||
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(signature));
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, toHidlVec(signature));
|
||||||
@@ -1049,7 +1058,7 @@ Return<void> WVDrmPlugin::sign(
|
|||||||
_hidl_cb(Status::OK, toHidlVec(signature));
|
_hidl_cb(Status::OK, toHidlVec(signature));
|
||||||
} else {
|
} else {
|
||||||
ALOGE("OEMCrypto_Generic_Sign failed with %u", res);
|
ALOGE("OEMCrypto_Generic_Sign failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)),
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res),
|
||||||
toHidlVec(signature));
|
toHidlVec(signature));
|
||||||
}
|
}
|
||||||
return Void();
|
return Void();
|
||||||
@@ -1074,7 +1083,8 @@ Return<void> WVDrmPlugin::verify(
|
|||||||
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
const CryptoSession& cryptoSession = mCryptoSessions[cdmSessionId];
|
||||||
|
|
||||||
if (cryptoSession.macAlgorithm() == kInvalidCryptoAlgorithm) {
|
if (cryptoSession.macAlgorithm() == kInvalidCryptoAlgorithm) {
|
||||||
_hidl_cb(toStatus(android::NO_INIT), match);
|
ALOGW("Returns UNKNOWN error for legacy status NO_INIT");
|
||||||
|
_hidl_cb(Status::ERROR_DRM_UNKNOWN, match);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,7 +1094,7 @@ Return<void> WVDrmPlugin::verify(
|
|||||||
|
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
ALOGE("OEMCrypto_SelectKey failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)), match);
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res), match);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1102,7 +1112,7 @@ Return<void> WVDrmPlugin::verify(
|
|||||||
_hidl_cb(Status::OK, match);
|
_hidl_cb(Status::OK, match);
|
||||||
} else {
|
} else {
|
||||||
ALOGE("OEMCrypto_Generic_Verify failed with %u", res);
|
ALOGE("OEMCrypto_Generic_Verify failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapAndNotifyOfOEMCryptoResult(sId, res)), match);
|
_hidl_cb(mapAndNotifyOfOEMCryptoResult(sId, res), match);
|
||||||
}
|
}
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
@@ -1143,7 +1153,7 @@ Return<void> WVDrmPlugin::signRSA(
|
|||||||
|
|
||||||
if (res != OEMCrypto_SUCCESS) {
|
if (res != OEMCrypto_SUCCESS) {
|
||||||
ALOGE("OEMCrypto_GenerateRSASignature failed with %u", res);
|
ALOGE("OEMCrypto_GenerateRSASignature failed with %u", res);
|
||||||
_hidl_cb(toStatus(mapOEMCryptoResult(res)), toHidlVec(signature));
|
_hidl_cb(mapOEMCryptoResult(res), toHidlVec(signature));
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1233,7 +1243,7 @@ void WVDrmPlugin::OnExpirationUpdate(const CdmSessionId& cdmSessionId,
|
|||||||
sendExpirationUpdate(toHidlVec(sessionId), newExpiryTimeMilliseconds);
|
sendExpirationUpdate(toHidlVec(sessionId), newExpiryTimeMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::queryProperty(const std::string& property,
|
Status WVDrmPlugin::queryProperty(const std::string& property,
|
||||||
std::string& stringValue) const {
|
std::string& stringValue) const {
|
||||||
SecurityLevel securityLevel =
|
SecurityLevel securityLevel =
|
||||||
mPropertySet.security_level().compare(
|
mPropertySet.security_level().compare(
|
||||||
@@ -1243,7 +1253,7 @@ status_t WVDrmPlugin::queryProperty(const std::string& property,
|
|||||||
return queryProperty(securityLevel, property, stringValue);
|
return queryProperty(securityLevel, property, stringValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::queryProperty(SecurityLevel securityLevel,
|
Status WVDrmPlugin::queryProperty(SecurityLevel securityLevel,
|
||||||
const std::string& property,
|
const std::string& property,
|
||||||
std::string& stringValue) const {
|
std::string& stringValue) const {
|
||||||
CdmResponseType res =
|
CdmResponseType res =
|
||||||
@@ -1255,16 +1265,16 @@ status_t WVDrmPlugin::queryProperty(SecurityLevel securityLevel,
|
|||||||
return mapCdmResponseType(res);
|
return mapCdmResponseType(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::queryProperty(const std::string& property,
|
Status WVDrmPlugin::queryProperty(const std::string& property,
|
||||||
std::vector<uint8_t>& vector_value) const {
|
std::vector<uint8_t>& vector_value) const {
|
||||||
std::string string_value;
|
std::string string_value;
|
||||||
status_t status = queryProperty(property, string_value);
|
Status status = queryProperty(property, string_value);
|
||||||
if (status != android::OK) return status;
|
if (status != Status::OK) return status;
|
||||||
vector_value = StrToVector(string_value);
|
vector_value = StrToVector(string_value);
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::mapAndNotifyOfCdmResponseType(
|
Status WVDrmPlugin::mapAndNotifyOfCdmResponseType(
|
||||||
const std::vector<uint8_t>& sessionId,
|
const std::vector<uint8_t>& sessionId,
|
||||||
CdmResponseType res) {
|
CdmResponseType res) {
|
||||||
|
|
||||||
@@ -1278,7 +1288,7 @@ status_t WVDrmPlugin::mapAndNotifyOfCdmResponseType(
|
|||||||
return mapCdmResponseType(res);
|
return mapCdmResponseType(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::mapAndNotifyOfOEMCryptoResult(
|
Status WVDrmPlugin::mapAndNotifyOfOEMCryptoResult(
|
||||||
const std::vector<uint8_t>& sessionId,
|
const std::vector<uint8_t>& sessionId,
|
||||||
OEMCryptoResult res) {
|
OEMCryptoResult res) {
|
||||||
|
|
||||||
@@ -1289,31 +1299,34 @@ status_t WVDrmPlugin::mapAndNotifyOfOEMCryptoResult(
|
|||||||
return mapOEMCryptoResult(res);
|
return mapOEMCryptoResult(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::mapOEMCryptoResult(OEMCryptoResult res) {
|
Status WVDrmPlugin::mapOEMCryptoResult(OEMCryptoResult res) {
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case OEMCrypto_SUCCESS:
|
case OEMCrypto_SUCCESS:
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
|
|
||||||
case OEMCrypto_ERROR_SIGNATURE_FAILURE:
|
case OEMCrypto_ERROR_SIGNATURE_FAILURE:
|
||||||
return android::ERROR_DRM_TAMPER_DETECTED;
|
return Status::ERROR_DRM_INVALID_STATE;
|
||||||
case OEMCrypto_ERROR_SHORT_BUFFER:
|
|
||||||
return kErrorIncorrectBufferSize;
|
|
||||||
case OEMCrypto_ERROR_NO_DEVICE_KEY:
|
case OEMCrypto_ERROR_NO_DEVICE_KEY:
|
||||||
return android::ERROR_DRM_NOT_PROVISIONED;
|
return Status::ERROR_DRM_NOT_PROVISIONED;
|
||||||
|
|
||||||
case OEMCrypto_ERROR_INVALID_SESSION:
|
case OEMCrypto_ERROR_INVALID_SESSION:
|
||||||
return android::ERROR_DRM_SESSION_NOT_OPENED;
|
return Status::ERROR_DRM_SESSION_NOT_OPENED;
|
||||||
|
|
||||||
case OEMCrypto_ERROR_TOO_MANY_SESSIONS:
|
case OEMCrypto_ERROR_TOO_MANY_SESSIONS:
|
||||||
return android::ERROR_DRM_RESOURCE_BUSY;
|
|
||||||
case OEMCrypto_ERROR_INVALID_RSA_KEY:
|
|
||||||
return kErrorInvalidKey;
|
|
||||||
case OEMCrypto_ERROR_INSUFFICIENT_RESOURCES:
|
case OEMCrypto_ERROR_INSUFFICIENT_RESOURCES:
|
||||||
return android::ERROR_DRM_RESOURCE_BUSY;
|
return Status::ERROR_DRM_RESOURCE_BUSY;
|
||||||
|
|
||||||
case OEMCrypto_ERROR_NOT_IMPLEMENTED:
|
case OEMCrypto_ERROR_NOT_IMPLEMENTED:
|
||||||
return android::ERROR_DRM_CANNOT_HANDLE;
|
return Status::ERROR_DRM_CANNOT_HANDLE;
|
||||||
|
|
||||||
|
case OEMCrypto_ERROR_INVALID_RSA_KEY:
|
||||||
|
case OEMCrypto_ERROR_SHORT_BUFFER:
|
||||||
|
ALOGW("Returns UNKNOWN error for legacy status: %d", res);
|
||||||
case OEMCrypto_ERROR_UNKNOWN_FAILURE:
|
case OEMCrypto_ERROR_UNKNOWN_FAILURE:
|
||||||
case OEMCrypto_ERROR_OPEN_SESSION_FAILED:
|
case OEMCrypto_ERROR_OPEN_SESSION_FAILED:
|
||||||
return android::ERROR_DRM_UNKNOWN;
|
|
||||||
default:
|
default:
|
||||||
return android::UNKNOWN_ERROR;
|
return Status::ERROR_DRM_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1342,7 +1355,7 @@ bool WVDrmPlugin::initDataResemblesPSSH(const std::vector<uint8_t>& initData) {
|
|||||||
return id == kPsshTag;
|
return id == kPsshTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::unprovision(const CdmIdentifier& identifier) {
|
Status WVDrmPlugin::unprovision(const CdmIdentifier& identifier) {
|
||||||
CdmResponseType res1 = mCDM->Unprovision(wvcdm::kSecurityLevelL1, identifier);
|
CdmResponseType res1 = mCDM->Unprovision(wvcdm::kSecurityLevelL1, identifier);
|
||||||
CdmResponseType res3 = mCDM->Unprovision(wvcdm::kSecurityLevelL3, identifier);
|
CdmResponseType res3 = mCDM->Unprovision(wvcdm::kSecurityLevelL3, identifier);
|
||||||
if (!isCdmResponseTypeSuccess(res1))
|
if (!isCdmResponseTypeSuccess(res1))
|
||||||
@@ -1364,44 +1377,44 @@ WVDrmPlugin::CdmIdentifierBuilder::CdmIdentifierBuilder(
|
|||||||
mAppPackageName(appPackageName),
|
mAppPackageName(appPackageName),
|
||||||
mParent(parent) {}
|
mParent(parent) {}
|
||||||
|
|
||||||
status_t WVDrmPlugin::CdmIdentifierBuilder::getCdmIdentifier(
|
Status WVDrmPlugin::CdmIdentifierBuilder::getCdmIdentifier(
|
||||||
CdmIdentifier* identifier) {
|
CdmIdentifier* identifier) {
|
||||||
if (!mIsIdentifierSealed) {
|
if (!mIsIdentifierSealed) {
|
||||||
status_t res = calculateSpoid();
|
Status res = calculateSpoid();
|
||||||
if (res != android::OK) return res;
|
if (res != Status::OK) return res;
|
||||||
|
|
||||||
mIsIdentifierSealed = true;
|
mIsIdentifierSealed = true;
|
||||||
}
|
}
|
||||||
*identifier = mCdmIdentifier;
|
*identifier = mCdmIdentifier;
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::CdmIdentifierBuilder::getDeviceUniqueId(std::string* id) {
|
Status WVDrmPlugin::CdmIdentifierBuilder::getDeviceUniqueId(std::string* id) {
|
||||||
if (mUseSpoid) {
|
if (mUseSpoid) {
|
||||||
CdmIdentifier identifier;
|
CdmIdentifier identifier;
|
||||||
status_t res = getCdmIdentifier(&identifier);
|
Status res = getCdmIdentifier(&identifier);
|
||||||
if (res != android::OK) return res;
|
if (res != Status::OK) return res;
|
||||||
|
|
||||||
*id = identifier.spoid;
|
*id = identifier.spoid;
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
} else {
|
} else {
|
||||||
return getOemcryptoDeviceId(id);
|
return getOemcryptoDeviceId(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::CdmIdentifierBuilder::getProvisioningUniqueId(std::string* id) {
|
Status WVDrmPlugin::CdmIdentifierBuilder::getProvisioningUniqueId(std::string* id) {
|
||||||
if (mUseSpoid) {
|
if (mUseSpoid) {
|
||||||
// To fake a provisioning-unique ID on SPOID devices where we can't expose
|
// To fake a provisioning-unique ID on SPOID devices where we can't expose
|
||||||
// the real provisioning-unique ID, we just use the SPOID and invert all the
|
// the real provisioning-unique ID, we just use the SPOID and invert all the
|
||||||
// bits.
|
// bits.
|
||||||
status_t res = getDeviceUniqueId(id);
|
Status res = getDeviceUniqueId(id);
|
||||||
if (res != android::OK) return res;
|
if (res != Status::OK) return res;
|
||||||
|
|
||||||
for (char& c : *id) {
|
for (char& c : *id) {
|
||||||
c = ~c;
|
c = ~c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
} else {
|
} else {
|
||||||
return mParent.queryProperty(wvcdm::QUERY_KEY_PROVISIONING_ID, *id);
|
return mParent.queryProperty(wvcdm::QUERY_KEY_PROVISIONING_ID, *id);
|
||||||
}
|
}
|
||||||
@@ -1413,11 +1426,11 @@ bool WVDrmPlugin::CdmIdentifierBuilder::set_origin(const std::string& id) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::CdmIdentifierBuilder::calculateSpoid() {
|
Status WVDrmPlugin::CdmIdentifierBuilder::calculateSpoid() {
|
||||||
if (mUseSpoid) {
|
if (mUseSpoid) {
|
||||||
std::string deviceId;
|
std::string deviceId;
|
||||||
status_t res = getOemcryptoDeviceId(&deviceId);
|
Status res = getOemcryptoDeviceId(&deviceId);
|
||||||
if (res != android::OK) return res;
|
if (res != Status::OK) return res;
|
||||||
|
|
||||||
uint8_t hash[SHA256_DIGEST_LENGTH];
|
uint8_t hash[SHA256_DIGEST_LENGTH];
|
||||||
SHA256_CTX ctx;
|
SHA256_CTX ctx;
|
||||||
@@ -1430,10 +1443,10 @@ status_t WVDrmPlugin::CdmIdentifierBuilder::calculateSpoid() {
|
|||||||
mCdmIdentifier.spoid =
|
mCdmIdentifier.spoid =
|
||||||
std::string(reinterpret_cast<char*>(hash), SHA256_DIGEST_LENGTH);
|
std::string(reinterpret_cast<char*>(hash), SHA256_DIGEST_LENGTH);
|
||||||
}
|
}
|
||||||
return android::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::CdmIdentifierBuilder::getOemcryptoDeviceId(
|
Status WVDrmPlugin::CdmIdentifierBuilder::getOemcryptoDeviceId(
|
||||||
std::string* id) {
|
std::string* id) {
|
||||||
return mParent.queryProperty(wvcdm::QUERY_KEY_DEVICE_ID, *id);
|
return mParent.queryProperty(wvcdm::QUERY_KEY_DEVICE_ID, *id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,10 +87,6 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
libwvlevel3 \
|
libwvlevel3 \
|
||||||
libwvdrmdrmplugin_hidl \
|
libwvdrmdrmplugin_hidl \
|
||||||
|
|
||||||
# When the GNU linker sees a library, it discards all symbols that it doesn't
|
|
||||||
# need. libwidevinehidl_utils must come after libwvdrmdrmplugin.
|
|
||||||
LOCAL_STATIC_LIBRARIES += libwidevinehidl_utils
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
android.hardware.drm@1.0 \
|
android.hardware.drm@1.0 \
|
||||||
android.hidl.memory@1.0 \
|
android.hidl.memory@1.0 \
|
||||||
|
|||||||
@@ -813,8 +813,8 @@ TEST_F(WVDrmPluginTest, UnprovisionsDevice) {
|
|||||||
.Times(1);
|
.Times(1);
|
||||||
|
|
||||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||||
status_t res = plugin.unprovisionDevice();
|
Status res = plugin.unprovisionDevice();
|
||||||
ASSERT_EQ(android::OK, res);
|
ASSERT_EQ(Status::OK, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WVDrmPluginTest, MuxesUnprovisioningErrors) {
|
TEST_F(WVDrmPluginTest, MuxesUnprovisioningErrors) {
|
||||||
@@ -834,12 +834,12 @@ TEST_F(WVDrmPluginTest, MuxesUnprovisioningErrors) {
|
|||||||
.WillOnce(testing::Return(wvcdm::UNKNOWN_ERROR));
|
.WillOnce(testing::Return(wvcdm::UNKNOWN_ERROR));
|
||||||
|
|
||||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||||
status_t res = plugin.unprovisionDevice();
|
Status res = plugin.unprovisionDevice();
|
||||||
ASSERT_NE(android::OK, res);
|
ASSERT_NE(Status::OK, res);
|
||||||
res = plugin.unprovisionDevice();
|
res = plugin.unprovisionDevice();
|
||||||
ASSERT_NE(android::OK, res);
|
ASSERT_NE(Status::OK, res);
|
||||||
res = plugin.unprovisionDevice();
|
res = plugin.unprovisionDevice();
|
||||||
ASSERT_NE(android::OK, res);
|
ASSERT_NE(Status::OK, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WVDrmPluginTest, UnprovisionsOrigin) {
|
TEST_F(WVDrmPluginTest, UnprovisionsOrigin) {
|
||||||
@@ -2364,7 +2364,7 @@ TEST_F(WVDrmPluginTest, CanSetSessionSharing) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
|
||||||
status_t res;
|
Status res;
|
||||||
|
|
||||||
// Test turning on session sharing
|
// Test turning on session sharing
|
||||||
Status status = plugin.setPropertyString(hidl_string("sessionSharing"),
|
Status status = plugin.setPropertyString(hidl_string("sessionSharing"),
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "TypeConvert.h"
|
|
||||||
|
|
||||||
#include <log/log.h>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace drm {
|
|
||||||
namespace V1_0 {
|
|
||||||
namespace widevine {
|
|
||||||
|
|
||||||
Status toStatus(status_t mediaError) {
|
|
||||||
Status status;
|
|
||||||
switch(mediaError) {
|
|
||||||
case android::OK:
|
|
||||||
status = Status::OK;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_NO_LICENSE:
|
|
||||||
status = Status::ERROR_DRM_NO_LICENSE;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_LICENSE_EXPIRED:
|
|
||||||
status = Status::ERROR_DRM_LICENSE_EXPIRED;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_SESSION_NOT_OPENED:
|
|
||||||
status = Status::ERROR_DRM_SESSION_NOT_OPENED;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_CANNOT_HANDLE:
|
|
||||||
status = Status::ERROR_DRM_CANNOT_HANDLE;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_TAMPER_DETECTED:
|
|
||||||
status = Status::ERROR_DRM_INVALID_STATE;
|
|
||||||
break;
|
|
||||||
case android::BAD_VALUE:
|
|
||||||
status = Status::BAD_VALUE;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_NOT_PROVISIONED:
|
|
||||||
status = Status::ERROR_DRM_NOT_PROVISIONED;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_RESOURCE_BUSY:
|
|
||||||
status = Status::ERROR_DRM_RESOURCE_BUSY;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
|
|
||||||
status = Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_DEVICE_REVOKED:
|
|
||||||
status = Status::ERROR_DRM_DEVICE_REVOKED;
|
|
||||||
break;
|
|
||||||
case android::ERROR_DRM_DECRYPT:
|
|
||||||
status = Status::ERROR_DRM_DECRYPT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ALOGW("Unable to convert legacy status: %d, defaulting to UNKNOWN",
|
|
||||||
mediaError);
|
|
||||||
status = Status::ERROR_DRM_UNKNOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace widevine
|
|
||||||
} // namespace V1_0
|
|
||||||
} // namespace drm
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
||||||
Reference in New Issue
Block a user