Files
android/libwvdrmengine/include_hidl/WVDrmFactory.h
John W. Bruce 19947dfe6f Move SPOID Enable/Disable Logic Out of WVDrmPlugin
(This is a merge of http://go/wvgerrit/25580)

While writing fixes for b/36660726, b/34716264, and b/36065223, it
became clear that having the logic that checks whether the device
supports SPOIDs embedded inside WVDrmPlugin was complicating its code
and inhibiting testing of the class. By moving this check into the code
that instantiates WVDrmPlugin, the result of the calculation can be
independently tested while the tests for WVDrmPlugin can put it in
whatever state they need for the sake of unit testing.

As a consequence of this, the check on retrieving the "deviceUniqueId"
byte array property, which was removed when SPOIDs were implemented, can
be reinstated.

Bug: 36660726
Bug: 34716264
Bug: 36065223
Test: libwvdrmdrmplugin_hidl_test & libwvdrmengine_hidl_test
Change-Id: I961d2ee42bbdc42f0c324e36d9a74ac92205a437
2017-04-18 09:56:58 -07:00

59 lines
1.4 KiB
C++

//
// Copyright 2017 Google Inc. All Rights Reserved.
//
#ifndef WV_DRM_FACTORY_H_
#define WV_DRM_FACTORY_H_
#include <android/hardware/drm/1.0/IDrmFactory.h>
#include "WVGenericCryptoInterface.h"
#include "WVTypes.h"
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_0 {
namespace widevine {
using ::android::hardware::drm::V1_0::IDrmFactory;
using ::android::hardware::drm::V1_0::IDrmPlugin;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::Return;
struct WVDrmFactory : public IDrmFactory {
WVDrmFactory() {}
virtual ~WVDrmFactory() {}
Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
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();
friend class WVDrmFactoryTest_CalculatesSpoidUseCorrectly_Test;
};
extern "C" IDrmFactory* HIDL_FETCH_IDrmFactory(const char* name);
} // namespace widevine
} // namespace V1_0
} // namespace drm
} // namespace hardware
} // namespace wvdrm
#endif // WV_DRM_FACTORY_H_