blob: f39b92a48ce2dca89f3c07e44772a0295026c1e8 [file] [log] [blame]
Yin-Chia Yehb978c382019-10-30 00:22:37 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H
18#define ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H
19
Shuzhen Wang316781a2020-08-18 18:11:01 -070020#include <vector>
21
Yin-Chia Yehb978c382019-10-30 00:22:37 -070022#include <utils/RefBase.h>
23#include <utils/String8.h>
24#include <utils/Timers.h>
25
26#include "camera/CaptureResult.h"
Shuzhen Wang316781a2020-08-18 18:11:01 -070027#include "camera/CameraSessionStats.h"
Emilian Peevfaa4bde2020-01-23 12:19:37 -080028#include "FrameProducer.h"
Yin-Chia Yehb978c382019-10-30 00:22:37 -070029
30namespace android {
31
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080032/**
33 * Abstract class for HAL notification listeners
34 */
35class NotificationListener : public virtual RefBase {
36 public:
37 // The set of notifications is a merge of the notifications required for
38 // API1 and API2.
39
40 // Required for API 1 and 2
41 virtual void notifyError(int32_t errorCode,
42 const CaptureResultExtras &resultExtras) = 0;
Austin Borger4a870a32022-02-25 01:48:41 +000043 // May return an error since it checks appops
44 virtual status_t notifyActive(float maxPreviewFps) = 0;
Shuzhen Wang316781a2020-08-18 18:11:01 -070045 virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError,
46 const std::vector<hardware::CameraStreamStats>& streamStats) = 0;
Eino-Ville Talvala178e8232021-04-16 18:41:39 -070047
48 // Required only for API2
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080049 virtual void notifyShutter(const CaptureResultExtras &resultExtras,
50 nsecs_t timestamp) = 0;
51 virtual void notifyPrepared(int streamId) = 0;
52 virtual void notifyRequestQueueEmpty() = 0;
53
54 // Required only for API1
55 virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0;
56 virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0;
57 virtual void notifyAutoWhitebalance(uint8_t newState,
58 int triggerId) = 0;
59 virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0;
60 protected:
61 virtual ~NotificationListener() {}
62};
63
Emilian Peevfaa4bde2020-01-23 12:19:37 -080064class CameraOfflineSessionBase : public virtual FrameProducer {
Yin-Chia Yehb978c382019-10-30 00:22:37 -070065 public:
66 virtual ~CameraOfflineSessionBase();
67
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080068 virtual status_t initialize(
69 wp<NotificationListener> listener) = 0;
70
Yin-Chia Yehb978c382019-10-30 00:22:37 -070071 virtual status_t disconnect() = 0;
72
73 virtual status_t dump(int fd) = 0;
74
Yin-Chia Yehb978c382019-10-30 00:22:37 -070075 // TODO: notification passing path
76}; // class CameraOfflineSessionBase
77
78} // namespace android
79
80#endif