/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.hardware.drm@1.0;

import IDrmPlugin;

/**
 * Ref: frameworks/native/include/media/drm/DrmAPI.h:DrmFactory
 *
 * IDrmFactory is the main entry point for interacting with a vendor's
 * drm HAL to create drm plugin instances. A drm plugin instance
 * creates drm sessions which are used to obtain keys for a crypto
 * session so it can decrypt* protected video content.
 */

interface IDrmFactory {
    /**
     * Determine if a crypto scheme is supported by this HAL
     *
     * @param uuid identifies the crypto scheme in question
     * @return isSupported must be true only if the scheme is supported
     */
    isCryptoSchemeSupported(uint8_t[16] uuid) generates(bool isSupported);

    /**
     * Determine if the HAL factory is able to construct plugins that support a
     * given media container format specified by mimeType
     *
     * @param mimeType identifies the mime type in question
     * @return isSupported must be true only if the scheme is supported
     */
    isContentTypeSupported(string mimeType) generates(bool isSupported);

    /**
     * Create a drm plugin instance for the specified uuid and scheme-specific
     * initialization data.
     *
     * @param uuid uniquely identifies the drm scheme. See
     * http://dashif.org/identifiers/protection for uuid assignments
     * @param appPackageName identifies the package name of the calling
     * application.
     * @return status the status of the call. The HAL implementation must return
     * OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
     * cannot be created.
     */
    createPlugin(uint8_t[16] uuid, string appPackageName)
            generates (Status status, IDrmPlugin drmPlugin);
};
