xref: /aosp_15_r20/hardware/interfaces/camera/device/3.6/ICameraOfflineSession.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2019 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport @3.5::ICameraDeviceCallback;
20*4d7e907cSAndroid Build Coastguard Worker
21*4d7e907cSAndroid Build Coastguard Worker/**
22*4d7e907cSAndroid Build Coastguard Worker * Camera device offline session interface.
23*4d7e907cSAndroid Build Coastguard Worker *
24*4d7e907cSAndroid Build Coastguard Worker * Obtained via ICameraDeviceSession::switchToOffline(), this interface contains
25*4d7e907cSAndroid Build Coastguard Worker * the methods and callback interfaces that define how camera service interacts
26*4d7e907cSAndroid Build Coastguard Worker * with an offline session.
27*4d7e907cSAndroid Build Coastguard Worker *
28*4d7e907cSAndroid Build Coastguard Worker * An offline session contains some unfinished capture requests that were submitted
29*4d7e907cSAndroid Build Coastguard Worker * to the parent ICameraDeviceSession before calling switchToOffline, and is
30*4d7e907cSAndroid Build Coastguard Worker * responsible for delivering these capture results back to camera service regardless
31*4d7e907cSAndroid Build Coastguard Worker * of whether the parent camera device is still opened or not. An offline session must
32*4d7e907cSAndroid Build Coastguard Worker * not have access to the camera device's image sensor. During switchToOffline
33*4d7e907cSAndroid Build Coastguard Worker * call, camera HAL must capture all necessary frames from the image sensor that
34*4d7e907cSAndroid Build Coastguard Worker * is needed for completing the requests offline later.
35*4d7e907cSAndroid Build Coastguard Worker */
36*4d7e907cSAndroid Build Coastguard Workerinterface ICameraOfflineSession {
37*4d7e907cSAndroid Build Coastguard Worker    /**
38*4d7e907cSAndroid Build Coastguard Worker     * Set the callbacks for offline session to communicate with camera service.
39*4d7e907cSAndroid Build Coastguard Worker     *
40*4d7e907cSAndroid Build Coastguard Worker     * Offline session is responsible to store all callbacks the camera HAL
41*4d7e907cSAndroid Build Coastguard Worker     * generated after the return of ICameraDeviceSession::switchToOffline, and
42*4d7e907cSAndroid Build Coastguard Worker     * send them to camera service once this method is called.
43*4d7e907cSAndroid Build Coastguard Worker     *
44*4d7e907cSAndroid Build Coastguard Worker     * Camera service must not call this method more than once, so these
45*4d7e907cSAndroid Build Coastguard Worker     * callbacks can be assumed to be constant after the first setCallback call.
46*4d7e907cSAndroid Build Coastguard Worker     */
47*4d7e907cSAndroid Build Coastguard Worker    setCallback(ICameraDeviceCallback cb);
48*4d7e907cSAndroid Build Coastguard Worker
49*4d7e907cSAndroid Build Coastguard Worker    /**
50*4d7e907cSAndroid Build Coastguard Worker     * getCaptureResultMetadataQueue:
51*4d7e907cSAndroid Build Coastguard Worker     *
52*4d7e907cSAndroid Build Coastguard Worker     * Retrieves the queue used along with
53*4d7e907cSAndroid Build Coastguard Worker     * ICameraDeviceCallback#processCaptureResult.
54*4d7e907cSAndroid Build Coastguard Worker     *
55*4d7e907cSAndroid Build Coastguard Worker     * Clients to ICameraOfflineSession must:
56*4d7e907cSAndroid Build Coastguard Worker     * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue;
57*4d7e907cSAndroid Build Coastguard Worker     * - In implementation of ICameraDeviceCallback, test whether
58*4d7e907cSAndroid Build Coastguard Worker     *   .fmqResultSize field is zero.
59*4d7e907cSAndroid Build Coastguard Worker     *     - If .fmqResultSize != 0, read result metadata from the fast message
60*4d7e907cSAndroid Build Coastguard Worker     *       queue;
61*4d7e907cSAndroid Build Coastguard Worker     *     - otherwise, read result metadata in CaptureResult.result.
62*4d7e907cSAndroid Build Coastguard Worker     *
63*4d7e907cSAndroid Build Coastguard Worker     * @return queue the queue that implementation writes result metadata to.
64*4d7e907cSAndroid Build Coastguard Worker     */
65*4d7e907cSAndroid Build Coastguard Worker    getCaptureResultMetadataQueue() generates (fmq_sync<uint8_t> queue);
66*4d7e907cSAndroid Build Coastguard Worker
67*4d7e907cSAndroid Build Coastguard Worker    /**
68*4d7e907cSAndroid Build Coastguard Worker     * Close the offline session and release all resources.
69*4d7e907cSAndroid Build Coastguard Worker     *
70*4d7e907cSAndroid Build Coastguard Worker     * Camera service may call this method before or after the offline session
71*4d7e907cSAndroid Build Coastguard Worker     * has finished all requests it needs to handle. If there are still unfinished
72*4d7e907cSAndroid Build Coastguard Worker     * requests when close is called, camera HAL must send ERROR_REQUEST for
73*4d7e907cSAndroid Build Coastguard Worker     * all unfinished requests and return all buffers via
74*4d7e907cSAndroid Build Coastguard Worker     * ICameraDeviceCallback#processCaptureResult or
75*4d7e907cSAndroid Build Coastguard Worker     * ICameraDeviceCallback#returnStreamBuffers.
76*4d7e907cSAndroid Build Coastguard Worker     * Also, all buffer caches maintained by the offline session must be erased
77*4d7e907cSAndroid Build Coastguard Worker     * before the close call returns.
78*4d7e907cSAndroid Build Coastguard Worker     */
79*4d7e907cSAndroid Build Coastguard Worker    close();
80*4d7e907cSAndroid Build Coastguard Worker};
81