1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMFACTORY_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMFACTORY_H
3 
4 #include <android/hardware/drm/1.3/IDrmFactory.h>
5 
6 #include <android/hidl/manager/1.0/IServiceNotification.h>
7 
8 #include <hidl/HidlSupport.h>
9 #include <hidl/MQDescriptor.h>
10 #include <hidl/Status.h>
11 #include <utils/NativeHandle.h>
12 #include <utils/misc.h>
13 
14 namespace android {
15 namespace hardware {
16 namespace drm {
17 namespace V1_4 {
18 
19 /**
20  * IDrmFactory is the main entry point for interacting with a vendor's
21  * drm HAL to create drm plugin instances. A drm plugin instance
22  * creates drm sessions which are used to obtain keys for a crypto
23  * session so it can decrypt protected video content.
24  *
25  * The 1.4 factory must always create 1.4 IDrmPlugin interfaces, which are
26  * returned via the 1.0 createPlugin method.
27  *
28  * To use 1.4 features the caller must cast the returned interface to a
29  * 1.4 HAL, using V1_4::IDrmPlugin::castFrom().
30  */
31 struct IDrmFactory : public ::android::hardware::drm::V1_3::IDrmFactory {
32     /**
33      * Type tag for use in template logic that indicates this is a 'pure' class.
34      */
35     typedef ::android::hardware::details::i_tag _hidl_tag;
36 
37     /**
38      * Fully qualified interface name: "[email protected]::IDrmFactory"
39      */
40     static const char* descriptor;
41 
42     /**
43      * Returns whether this object's implementation is outside of the current process.
44      */
isRemoteIDrmFactory45     virtual bool isRemote() const override { return false; }
46 
47     /**
48      * Determine if a crypto scheme is supported by this HAL
49      *
50      * @param uuid identifies the crypto scheme in question
51      * @return isSupported must be true only if the scheme is supported
52      */
53     virtual ::android::hardware::Return<bool> isCryptoSchemeSupported(const ::android::hardware::hidl_array<uint8_t, 16>& uuid) override = 0;
54 
55     /**
56      * Determine if the HAL factory is able to construct plugins that support a
57      * given media container format specified by mimeType
58      *
59      * @param mimeType identifies the mime type in question
60      * @return isSupported must be true only if the scheme is supported
61      */
62     virtual ::android::hardware::Return<bool> isContentTypeSupported(const ::android::hardware::hidl_string& mimeType) override = 0;
63 
64     /**
65      * Return callback for createPlugin
66      */
67     using createPlugin_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::sp<::android::hardware::drm::V1_0::IDrmPlugin>& drmPlugin)>;
68     /**
69      * Create a drm plugin instance for the specified uuid and scheme-specific
70      * initialization data.
71      *
72      * @param uuid uniquely identifies the drm scheme. See
73      * http://dashif.org/identifiers/protection for uuid assignments
74      * @param appPackageName identifies the package name of the calling
75      * application.
76      * @return status the status of the call. The HAL implementation must return
77      * OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
78      * cannot be created.
79      */
80     virtual ::android::hardware::Return<void> createPlugin(const ::android::hardware::hidl_array<uint8_t, 16>& uuid, const ::android::hardware::hidl_string& appPackageName, createPlugin_cb _hidl_cb) override = 0;
81 
82     /**
83      * Determine if a specific security level is supported by the device.
84      * This method only differs from @1.0 isCryptoSchemeSupported
85      * by the addition of a security level.
86      *
87      * @param uuid identifies the crypto scheme in question
88      * @param mimeType identifies the mime type in question
89      * @param securityLevel specifies the security level required
90      * @return isSupported must be true only if the scheme is supported
91      */
92     virtual ::android::hardware::Return<bool> isCryptoSchemeSupported_1_2(const ::android::hardware::hidl_array<uint8_t, 16>& uuid, const ::android::hardware::hidl_string& mimeType, ::android::hardware::drm::V1_1::SecurityLevel securityLevel) override = 0;
93 
94     /**
95      * Return callback for getSupportedCryptoSchemes
96      */
97     using getSupportedCryptoSchemes_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 16>>& schemes)>;
98     /**
99      * Return vector of uuids identifying crypto schemes supported by this HAL.
100      *
101      * @return schemes Vector of uuids for which isCryptoSchemeSupported is true;
102      *                 each uuid can be used as input to createPlugin.
103      */
104     virtual ::android::hardware::Return<void> getSupportedCryptoSchemes(getSupportedCryptoSchemes_cb _hidl_cb) override = 0;
105 
106     /**
107      * Return callback for interfaceChain
108      */
109     using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
110     /*
111      * Provides run-time type information for this object.
112      * For example, for the following interface definition:
113      *     package [email protected];
114      *     interface IParent {};
115      *     interface IChild extends IParent {};
116      * Calling interfaceChain on an IChild object must yield the following:
117      *     ["[email protected]::IChild",
118      *      "[email protected]::IParent"
119      *      "[email protected]::IBase"]
120      *
121      * @return descriptors a vector of descriptors of the run-time type of the
122      *         object.
123      */
124     virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
125 
126     /*
127      * Emit diagnostic information to the given file.
128      *
129      * Optionally overriden.
130      *
131      * @param fd      File descriptor to dump data to.
132      *                Must only be used for the duration of this call.
133      * @param options Arguments for debugging.
134      *                Must support empty for default debug information.
135      */
136     virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
137 
138     /**
139      * Return callback for interfaceDescriptor
140      */
141     using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
142     /*
143      * Provides run-time type information for this object.
144      * For example, for the following interface definition:
145      *     package [email protected];
146      *     interface IParent {};
147      *     interface IChild extends IParent {};
148      * Calling interfaceDescriptor on an IChild object must yield
149      *     "[email protected]::IChild"
150      *
151      * @return descriptor a descriptor of the run-time type of the
152      *         object (the first element of the vector returned by
153      *         interfaceChain())
154      */
155     virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
156 
157     /**
158      * Return callback for getHashChain
159      */
160     using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
161     /*
162      * Returns hashes of the source HAL files that define the interfaces of the
163      * runtime type information on the object.
164      * For example, for the following interface definition:
165      *     package [email protected];
166      *     interface IParent {};
167      *     interface IChild extends IParent {};
168      * Calling interfaceChain on an IChild object must yield the following:
169      *     [(hash of IChild.hal),
170      *      (hash of IParent.hal)
171      *      (hash of IBase.hal)].
172      *
173      * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
174      * according to SHA-256 standard.
175      *
176      * @return hashchain a vector of SHA-1 digests
177      */
178     virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
179 
180     /*
181      * This method trigger the interface to enable/disable instrumentation based
182      * on system property hal.instrumentation.enable.
183      */
184     virtual ::android::hardware::Return<void> setHALInstrumentation() override;
185 
186     /*
187      * Registers a death recipient, to be called when the process hosting this
188      * interface dies.
189      *
190      * @param recipient a hidl_death_recipient callback object
191      * @param cookie a cookie that must be returned with the callback
192      * @return success whether the death recipient was registered successfully.
193      */
194     virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
195 
196     /*
197      * Provides way to determine if interface is running without requesting
198      * any functionality.
199      */
200     virtual ::android::hardware::Return<void> ping() override;
201 
202     /**
203      * Return callback for getDebugInfo
204      */
205     using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
206     /*
207      * Get debug information on references on this interface.
208      * @return info debugging information. See comments of DebugInfo.
209      */
210     virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
211 
212     /*
213      * This method notifies the interface that one or more system properties
214      * have changed. The default implementation calls
215      * (C++)  report_sysprop_change() in libcutils or
216      * (Java) android.os.SystemProperties.reportSyspropChanged,
217      * which in turn calls a set of registered callbacks (eg to update trace
218      * tags).
219      */
220     virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
221 
222     /*
223      * Unregisters the registered death recipient. If this service was registered
224      * multiple times with the same exact death recipient, this unlinks the most
225      * recently registered one.
226      *
227      * @param recipient a previously registered hidl_death_recipient callback
228      * @return success whether the death recipient was unregistered successfully.
229      */
230     virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
231 
232     // cast static functions
233     /**
234      * This performs a checked cast based on what the underlying implementation actually is.
235      */
236     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hardware::drm::V1_4::IDrmFactory>& parent, bool emitError = false);
237     /**
238      * This performs a checked cast based on what the underlying implementation actually is.
239      */
240     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hardware::drm::V1_3::IDrmFactory>& parent, bool emitError = false);
241     /**
242      * This performs a checked cast based on what the underlying implementation actually is.
243      */
244     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hardware::drm::V1_2::IDrmFactory>& parent, bool emitError = false);
245     /**
246      * This performs a checked cast based on what the underlying implementation actually is.
247      */
248     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hardware::drm::V1_1::IDrmFactory>& parent, bool emitError = false);
249     /**
250      * This performs a checked cast based on what the underlying implementation actually is.
251      */
252     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hardware::drm::V1_0::IDrmFactory>& parent, bool emitError = false);
253     /**
254      * This performs a checked cast based on what the underlying implementation actually is.
255      */
256     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmFactory>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
257 
258     // helper methods for interactions with the hwservicemanager
259     /**
260      * This gets the service of this type with the specified instance name. If the
261      * service is currently not available or not in the VINTF manifest on a Trebilized
262      * device, this will return nullptr. This is useful when you don't want to block
263      * during device boot. If getStub is true, this will try to return an unwrapped
264      * passthrough implementation in the same process. This is useful when getting an
265      * implementation from the same partition/compilation group.
266      *
267      * In general, prefer getService(std::string,bool)
268      */
269     static ::android::sp<IDrmFactory> tryGetService(const std::string &serviceName="default", bool getStub=false);
270     /**
271      * Deprecated. See tryGetService(std::string, bool)
272      */
273     static ::android::sp<IDrmFactory> tryGetService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return tryGetService(str, getStub); }
274     /**
275      * Deprecated. See tryGetService(std::string, bool)
276      */
277     static ::android::sp<IDrmFactory> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return tryGetService(str, getStub); }
278     /**
279      * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
280      */
tryGetServiceIDrmFactory281     static ::android::sp<IDrmFactory> tryGetService(bool getStub) { return tryGetService("default", getStub); }
282     /**
283      * This gets the service of this type with the specified instance name. If the
284      * service is not in the VINTF manifest on a Trebilized device, this will return
285      * nullptr. If the service is not available, this will wait for the service to
286      * become available. If the service is a lazy service, this will start the service
287      * and return when it becomes available. If getStub is true, this will try to
288      * return an unwrapped passthrough implementation in the same process. This is
289      * useful when getting an implementation from the same partition/compilation group.
290      */
291     static ::android::sp<IDrmFactory> getService(const std::string &serviceName="default", bool getStub=false);
292     /**
293      * Deprecated. See getService(std::string, bool)
294      */
295     static ::android::sp<IDrmFactory> getService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return getService(str, getStub); }
296     /**
297      * Deprecated. See getService(std::string, bool)
298      */
299     static ::android::sp<IDrmFactory> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return getService(str, getStub); }
300     /**
301      * Calls getService("default", bool). This is the recommended instance name for singleton services.
302      */
getServiceIDrmFactory303     static ::android::sp<IDrmFactory> getService(bool getStub) { return getService("default", getStub); }
304     /**
305      * Registers a service with the service manager. For Trebilized devices, the service
306      * must also be in the VINTF manifest.
307      */
308     __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
309     /**
310      * Registers for notifications for when a service is registered.
311      */
312     static bool registerForNotifications(
313             const std::string &serviceName,
314             const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> &notification);
315 };
316 
317 //
318 // type declarations for package
319 //
320 
321 static inline std::string toString(const ::android::sp<::android::hardware::drm::V1_4::IDrmFactory>& o);
322 
323 //
324 // type header definitions for package
325 //
326 
toString(const::android::sp<::android::hardware::drm::V1_4::IDrmFactory> & o)327 static inline std::string toString(const ::android::sp<::android::hardware::drm::V1_4::IDrmFactory>& o) {
328     std::string os = "[class or subclass of ";
329     os += ::android::hardware::drm::V1_4::IDrmFactory::descriptor;
330     os += "]";
331     os += o->isRemote() ? "@remote" : "@local";
332     return os;
333 }
334 
335 
336 }  // namespace V1_4
337 }  // namespace drm
338 }  // namespace hardware
339 }  // namespace android
340 
341 //
342 // global type declarations for package
343 //
344 
345 
346 #endif  // HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMFACTORY_H
347