blob: 03cea64a0cd7be7bbfb779e98cfa6465374c28e0 [file] [log] [blame]
/*
* Copyright (C) 2019 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.6;
import @3.5::ICameraDeviceCallback;
/**
* Camera device offline session interface.
*
* Obtained via ICameraDeviceSession::switchToOffline(), this interface contains
* the methods and callback interfaces that define how camera service interacts
* with an offline session.
*
* An offline session contains some unfinished capture requests that were submitted
* to the parent ICameraDeviceSession before calling switchToOffline, and is
* responsible for delivering these capture results back to camera service regardless
* of whether the parent camera device is still opened or not. An offline session must
* not have access to the camera device's image sensor. During switchToOffline
* call, camera HAL must capture all necessary frames from the image sensor that
* is needed for completing the requests offline later.
*/
interface ICameraOfflineSession {
/**
* Set the callbacks for offline session to communicate with camera service.
*
* Offline session is responsible to store all callbacks the camera HAL
* generated after the return of ICameraDeviceSession::switchToOffline, and
* send them to camera service once this method is called.
*
* Camera service must not call this method more than once, so these
* callbacks can be assumed to be constant after the first setCallback call.
*/
setCallback(ICameraDeviceCallback cb);
/**
* getCaptureResultMetadataQueue:
*
* Retrieves the queue used along with
* ICameraDeviceCallback#processCaptureResult.
*
* Clients to ICameraOfflineSession must:
* - Call getCaptureRequestMetadataQueue to retrieve the fast message queue;
* - In implementation of ICameraDeviceCallback, test whether
* .fmqResultSize field is zero.
* - If .fmqResultSize != 0, read result metadata from the fast message
* queue;
* - otherwise, read result metadata in CaptureResult.result.
*
* @return queue the queue that implementation writes result metadata to.
*/
getCaptureResultMetadataQueue() generates (fmq_sync<uint8_t> queue);
/**
* Close the offline session and release all resources.
*
* Camera service may call this method before or after the offline session
* has finished all requests it needs to handle. If there are still unfinished
* requests when close is called, camera HAL must send ERROR_REQUEST for
* all unfinished requests and return all buffers via
* ICameraDeviceCallback#processCaptureResult or
* ICameraDeviceCallback#returnStreamBuffers.
* Also, all buffer caches maintained by the offline session must be erased
* before the close call returns.
*/
close();
};