blob: 0bb14008ab9bfbb9c2c548e4f7a576d31ba02f30 [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_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H
18#define ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H
19
20#include <android/hardware/camera2/BnCameraOfflineSession.h>
21#include <android/hardware/camera2/ICameraDeviceCallbacks.h>
22#include "CameraService.h"
23
24namespace android {
25
26using android::hardware::camera2::ICameraDeviceCallbacks;
27
Emilian Peevb2bc5a42019-11-20 16:02:14 -080028// Client for offline session. Note that offline session client does not affect camera service's
29// client arbitration logic. It is camera HAL's decision to decide whether a normal camera
30// client is conflicting with existing offline client(s).
31// The other distinctive difference between offline clients and normal clients is that normal
32// clients are created through ICameraService binder calls, while the offline session client
33// is created through ICameraDeviceUser::switchToOffline call.
Yin-Chia Yehb978c382019-10-30 00:22:37 -070034class CameraOfflineSessionClient :
Emilian Peevb2bc5a42019-11-20 16:02:14 -080035 public CameraService::BasicClient,
Yin-Chia Yehb978c382019-10-30 00:22:37 -070036 public hardware::camera2::BnCameraOfflineSession
37 // public camera2::FrameProcessorBase::FilteredListener?
38{
39public:
40 CameraOfflineSessionClient(
41 const sp<CameraService>& cameraService,
42 sp<CameraOfflineSessionBase> session,
43 const sp<ICameraDeviceCallbacks>& remoteCallback,
44 const String16& clientPackageName,
Emilian Peevb2bc5a42019-11-20 16:02:14 -080045 const std::unique_ptr<String16>& clientFeatureId,
46 const String8& cameraIdStr, int cameraFacing,
Yin-Chia Yehb978c382019-10-30 00:22:37 -070047 int clientPid, uid_t clientUid, int servicePid) :
Emilian Peevb2bc5a42019-11-20 16:02:14 -080048 CameraService::BasicClient(
49 cameraService,
50 IInterface::asBinder(remoteCallback),
51 clientPackageName, clientFeatureId,
52 cameraIdStr, cameraFacing, clientPid, clientUid, servicePid),
53 mRemoteCallback(remoteCallback), mOfflineSession(session) {}
Yin-Chia Yehb978c382019-10-30 00:22:37 -070054
Emilian Peevb2bc5a42019-11-20 16:02:14 -080055 virtual ~CameraOfflineSessionClient() {}
Yin-Chia Yehb978c382019-10-30 00:22:37 -070056
Emilian Peevb2bc5a42019-11-20 16:02:14 -080057 virtual sp<IBinder> asBinderWrapper() override {
58 return IInterface::asBinder(this);
Yin-Chia Yehb978c382019-10-30 00:22:37 -070059 }
60
Emilian Peevb2bc5a42019-11-20 16:02:14 -080061 virtual binder::Status disconnect() override;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070062
Emilian Peevb2bc5a42019-11-20 16:02:14 -080063 virtual status_t dump(int /*fd*/, const Vector<String16>& /*args*/) override;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070064
Emilian Peevb2bc5a42019-11-20 16:02:14 -080065 virtual status_t dumpClient(int /*fd*/, const Vector<String16>& /*args*/) override;
66
Yin-Chia Yehb978c382019-10-30 00:22:37 -070067 virtual void notifyError(int32_t /*errorCode*/,
Emilian Peevb2bc5a42019-11-20 16:02:14 -080068 const CaptureResultExtras& /*resultExtras*/) override;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070069
Emilian Peevb2bc5a42019-11-20 16:02:14 -080070 virtual status_t initialize(sp<CameraProviderManager> /*manager*/,
71 const String8& /*monitorTags*/) override;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070072
Emilian Peevb2bc5a42019-11-20 16:02:14 -080073 // permissions management
74 virtual status_t startCameraOps() override;
75 virtual status_t finishCameraOps() override;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070076
Yin-Chia Yehb978c382019-10-30 00:22:37 -070077private:
Emilian Peevb2bc5a42019-11-20 16:02:14 -080078
79 const sp<hardware::camera2::ICameraDeviceCallbacks>& getRemoteCallback() {
80 return mRemoteCallback;
81 }
Yin-Chia Yehb978c382019-10-30 00:22:37 -070082
83 sp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback;
Yin-Chia Yehb978c382019-10-30 00:22:37 -070084
85 sp<CameraOfflineSessionBase> mOfflineSession;
86};
87
88} // namespace android
89
90#endif // ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H