/*
 * Copyright (C) 2021 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.camera.device@3.7;

import android.hardware.camera.common@1.0::Status;
import @3.2::BufferCache;
import @3.2::CameraMetadata;
import @3.5::StreamConfiguration;
import @3.6::HalStreamConfiguration;
import @3.7::ICameraDeviceSession;

/**
 * Injection camera device active session interface.
 *
 * Note that this is implemented on a special camera injection hal, if it is a
 * general camera hal, it is not necessary to implement this interface.
 *
 * When an external camera is injected to replace the internal camera session, the
 * injection session will be established in camera framework, and then
 * configureInjectionStreams() will be called to ask the external camera to
 * configure itself to match the stream configuration of the internal camera.
 *
 * Camera framework is responsible to close the injection session once the client
 * switch back to internal camera streaming.
 *
 * If the external camera cannot support the configuration ILLEGAL_ARGUMENT will
 * be returned.
 */
interface ICameraInjectionSession extends @3.7::ICameraDeviceSession {
    /**
     * configureInjectionStreams:
     *
     * Identical to @3.7::ICameraDeviceSession.configureStreams_3_7, except that:
     *
     * @param requestedConfiguration
     *     The current stream configuration of the internal camera session and
     *     the injection camera must follow the configuration without overriding
     *     any part of it.
     * @param characteristics
     *     The characteristics of internal camera contains a list of keys so that
     *     the stream continuity can be maintained after the external camera is
     *     injected.
     *
     * @return status Status code for the operation, one of:
     *     OK:
     *         On successful stream configuration.
     *     INTERNAL_ERROR:
     *         If there has been a fatal error and the device is no longer
     *         operational. Only close() can be called successfully by the
     *         framework after this error is returned.
     *     ILLEGAL_ARGUMENT:
     *         If the requested stream configuration is invalid. Some examples
     *         of invalid stream configurations include:
     *           - Not including any OUTPUT streams
     *           - Including streams with unsupported formats, or an unsupported
     *             size for that format.
     *           - Including too many output streams of a certain format.
     *           - Unsupported rotation configuration
     *           - Stream sizes/formats don't satisfy the
     *             StreamConfigurationMode requirements
     *             for non-NORMAL mode, or the requested operation_mode is not
     *             supported by the HAL.
     *           - Unsupported usage flag
     *         The camera service cannot filter out all possible illegal stream
     *         configurations, since some devices may support more simultaneous
     *         streams or larger stream resolutions than the minimum required
     *         for a given camera device hardware level. The HAL must return an
     *         ILLEGAL_ARGUMENT for any unsupported stream set, and then be
     *         ready to accept a future valid stream configuration in a later
     *         configureInjectionStreams call.
     */
    configureInjectionStreams(StreamConfiguration requestedConfiguration,
            CameraMetadata characteristics) generates (Status status);
};
