• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
20 #include <vector>
21 
22 #include <utils/RefBase.h>
23 #include <utils/String8.h>
24 #include <utils/Timers.h>
25 
26 #include "camera/CaptureResult.h"
27 #include "camera/CameraSessionStats.h"
28 #include "FrameProducer.h"
29 
30 namespace android {
31 
32 /**
33  * Abstract class for HAL notification listeners
34  */
35 class 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;
43 
44     // Optional for API 1 and 2
notifyPhysicalCameraChange(const std::string &)45     virtual void notifyPhysicalCameraChange(const std::string &/*physicalId*/) {}
46 
47     // May return an error since it checks appops
48     virtual status_t notifyActive(float maxPreviewFps) = 0;
49     virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError,
50             const std::vector<hardware::CameraStreamStats>& streamStats) = 0;
51 
52     // Required only for API2
53     virtual void notifyShutter(const CaptureResultExtras &resultExtras,
54             nsecs_t timestamp) = 0;
55     virtual void notifyPrepared(int streamId) = 0;
56     virtual void notifyRequestQueueEmpty() = 0;
57 
58     // Required only for API1
59     virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0;
60     virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0;
61     virtual void notifyAutoWhitebalance(uint8_t newState,
62             int triggerId) = 0;
63     virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0;
64   protected:
~NotificationListener()65     virtual ~NotificationListener() {}
66 };
67 
68 class CameraOfflineSessionBase : public virtual FrameProducer {
69   public:
70     virtual ~CameraOfflineSessionBase();
71 
72     virtual status_t initialize(
73             wp<NotificationListener> listener) = 0;
74 
75     virtual status_t disconnect() = 0;
76 
77     virtual status_t dump(int fd) = 0;
78 
79     // TODO: notification passing path
80 }; // class CameraOfflineSessionBase
81 
82 } // namespace android
83 
84 #endif
85