Disallow Blank App Package Name on Q and Later

(This is a merge of http://go/wvgerrit/78105)

The Widevine Android CDM should not allow itself to be instantiated
without an app package name, as this breaks SPOID protection.
Unfortunately, pathways exist prior to Android Q that allow this to
happen, and we cannot break these devices by changing the behavior now.
As such, we will only refuse to allow instantiation without an app
package name on devices first launched with Q and later.

This change also migrates the WVDrmFactory and its tests away from
explicitly naming friend classes for individual test, in favor of the
now-recommended "test peer" pattern.

Bug: 65680731
Test: libwvdrmengine_hidl_test
Test: CTS NativeMediaDrmClearkeyTest
Change-Id: Icccd1d8b9972ef6ad7e5b0dbf2d37ec987656385
This commit is contained in:
John W. Bruce
2019-05-03 20:32:52 -07:00
committed by John Bruce
parent a1e94e2eb1
commit edccc13510
3 changed files with 43 additions and 3 deletions

View File

@@ -43,8 +43,10 @@ struct WVDrmFactory : public IDrmFactory {
static WVGenericCryptoInterface sOemCryptoInterface;
static bool areSpoidsEnabled();
static bool isBlankAppPackageNameAllowed();
static int32_t firstApiLevel();
friend class WVDrmFactoryTest_CalculatesSpoidUseCorrectly_Test;
friend class WVDrmFactoryTestPeer;
};
extern "C" IDrmFactory* HIDL_FETCH_IDrmFactory(const char* name);