Adding app package name to license request.

[ Merge of http://go/wvgerrit/94323 ]

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

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

Bug: 148689078
Test: manual
Change-Id: I6b65f2ab9845dbea37aaaab76ecea25c228bde5b
This commit is contained in:
Alex Dale
2020-02-19 22:16:09 -08:00
parent f13cbff0cd
commit 9c60d1e1ae
2 changed files with 9 additions and 1 deletions

View File

@@ -425,6 +425,8 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
wvcdm::CdmSessionId mDecryptHashSessionId; wvcdm::CdmSessionId mDecryptHashSessionId;
std::string mAppPackageName;
Status queryProperty(const std::string& property, Status queryProperty(const std::string& property,
std::string& stringValue) const; std::string& stringValue) const;

View File

@@ -33,6 +33,7 @@ static const char* const kEnable = "enable";
static const char* const kDisable = "disable"; static const char* const kDisable = "disable";
static const std::string kPsshTag = "pssh"; static const std::string kPsshTag = "pssh";
static const char* const kSpecialUnprovisionResponse = "unprovision"; static const char* const kSpecialUnprovisionResponse = "unprovision";
static const std::string kKeyAppPackageName = "application_name";
} // namespace } // namespace
@@ -192,7 +193,8 @@ WVDrmPlugin::WVDrmPlugin(const sp<WvContentDecryptionModule>& cdm,
: mCdmIdentifierBuilder(useSpoid, *this, appPackageName), : mCdmIdentifierBuilder(useSpoid, *this, appPackageName),
mCDM(cdm), mCDM(cdm),
mCrypto(crypto), mCrypto(crypto),
mCryptoSessions() {} mCryptoSessions(),
mAppPackageName(appPackageName) {}
WVDrmPlugin::~WVDrmPlugin() { WVDrmPlugin::~WVDrmPlugin() {
typedef map<CdmSessionId, CryptoSession>::iterator mapIterator; typedef map<CdmSessionId, CryptoSession>::iterator mapIterator;
@@ -515,6 +517,10 @@ Return<void> WVDrmPlugin::getKeyRequest_1_2(
cdmParameters[cdmKey] = cdmValue; cdmParameters[cdmKey] = cdmValue;
} }
// Inserting application name into parameters. This will overwrite user
// parameters of the same key.
cdmParameters[kKeyAppPackageName] = mAppPackageName;
CdmKeyRequest keyRequest; CdmKeyRequest keyRequest;
CdmResponseType res = mCDM->GenerateKeyRequest( CdmResponseType res = mCDM->GenerateKeyRequest(
cdmSessionId, cdmKeySetId, cdmInitDataType, processedInitData, cdmSessionId, cdmKeySetId, cdmInitDataType, processedInitData,