/*
 * Copyright (C) 2018 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.2;

import @1.0::IDrmPluginListener;
import @1.0::SessionId;

/**
 * IDrmPluginListener is a listener interface for Drm events sent from an
 * IDrmPlugin instance.
 */
interface IDrmPluginListener extends @1.0::IDrmPluginListener {
    /**
     * Some device crypto hardware is incapable of retaining crypto
     * session state across suspend and resume cycles. A
     * SessionLostState event must be signaled when a session has
     * become invalid for this reason. This event must not be used to
     * indicate a failure in the crypto system. Closing the session
     * and opening a new one must allow the application to resume
     * normal use of the drm hal module.
     *
     * @param sessionId identifies the session that has been invalidated
     */
     oneway sendSessionLostState(SessionId sessionId);

    /**
     * Send a keys change event to the listener. The keys change event
     * indicates the status of each key in the session. Keys can be
     * indicated as being usable, expired, outputnotallowed or statuspending.
     *
     * This method only differs from @1.0 version by the addition of new
     * KeyStatusType(s) in keyStatusList.
     *
     * @param sessionId identifies the session the event originated from
     * @param keyStatusList indicates the status for each key ID in the
     * session.
     * @param hasNewUsableKey indicates if the event includes at least one
     * key that has become usable.
     */
    oneway sendKeysChange_1_2(SessionId sessionId, vec<KeyStatus> keyStatusList,
            bool hasNewUsableKey);

};
