Files
android/libwvdrmengine/include_hidl/WVDrmFactory.h
John W. Bruce edccc13510 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
2019-05-08 01:08:11 +00:00

61 lines
1.5 KiB
C++

//
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine Master
// License Agreement.
//
#ifndef WV_DRM_FACTORY_H_
#define WV_DRM_FACTORY_H_
#include "HidlTypes.h"
#include "WVGenericCryptoInterface.h"
#include "WVTypes.h"
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_2 {
namespace widevine {
struct WVDrmFactory : public IDrmFactory {
WVDrmFactory() {}
virtual ~WVDrmFactory() {}
Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
override;
Return<bool> isCryptoSchemeSupported_1_2(const hidl_array<uint8_t, 16>& uuid,
const hidl_string& mimeType,
SecurityLevel level)
override;
Return<bool> isContentTypeSupported(const hidl_string &mimeType)
override;
Return<void> createPlugin(
const hidl_array<uint8_t, 16>& uuid,
const hidl_string& appPackageName,
createPlugin_cb _hidl_cb) override;
private:
WVDRM_DISALLOW_COPY_AND_ASSIGN(WVDrmFactory);
static WVGenericCryptoInterface sOemCryptoInterface;
static bool areSpoidsEnabled();
static bool isBlankAppPackageNameAllowed();
static int32_t firstApiLevel();
friend class WVDrmFactoryTestPeer;
};
extern "C" IDrmFactory* HIDL_FETCH_IDrmFactory(const char* name);
} // namespace widevine
} // namespace V1_2
} // namespace drm
} // namespace hardware
} // namespace wvdrm
#endif // WV_DRM_FACTORY_H_