Test: N/A, no implementation yet Bug: 135142453 Change-Id: I497e42433d4d49466fe37467d4ff66e8583c55dfgugelfrei
parent
68e5e9a665
commit
b978c389e8
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* 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.camera2;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
interface ICameraOfflineSession
|
||||||
|
{
|
||||||
|
void disconnect();
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H
|
||||||
|
#define ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H
|
||||||
|
|
||||||
|
#include <android/hardware/camera2/BnCameraOfflineSession.h>
|
||||||
|
#include <android/hardware/camera2/ICameraDeviceCallbacks.h>
|
||||||
|
#include "CameraService.h"
|
||||||
|
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
using android::hardware::camera2::ICameraDeviceCallbacks;
|
||||||
|
|
||||||
|
class CameraOfflineSessionClient :
|
||||||
|
public CameraService::OfflineClient,
|
||||||
|
public hardware::camera2::BnCameraOfflineSession
|
||||||
|
// public camera2::FrameProcessorBase::FilteredListener?
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CameraOfflineSessionClient(
|
||||||
|
const sp<CameraService>& cameraService,
|
||||||
|
sp<CameraOfflineSessionBase> session,
|
||||||
|
const sp<ICameraDeviceCallbacks>& remoteCallback,
|
||||||
|
const String16& clientPackageName,
|
||||||
|
const String8& cameraIdStr,
|
||||||
|
int clientPid, uid_t clientUid, int servicePid) :
|
||||||
|
CameraService::OfflineClient(cameraService, clientPackageName,
|
||||||
|
cameraIdStr, clientPid, clientUid, servicePid),
|
||||||
|
mRemoteCallback(remoteCallback), mOfflineSession(session) {}
|
||||||
|
|
||||||
|
~CameraOfflineSessionClient() {}
|
||||||
|
|
||||||
|
virtual binder::Status disconnect() override { return binder::Status::ok(); }
|
||||||
|
|
||||||
|
virtual status_t dump(int /*fd*/, const Vector<String16>& /*args*/) override {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block the client form using the camera
|
||||||
|
virtual void block() override {};
|
||||||
|
|
||||||
|
// Return the package name for this client
|
||||||
|
virtual String16 getPackageName() const override { String16 ret; return ret; };
|
||||||
|
|
||||||
|
// Notify client about a fatal error
|
||||||
|
// TODO: maybe let impl notify within block?
|
||||||
|
virtual void notifyError(int32_t /*errorCode*/,
|
||||||
|
const CaptureResultExtras& /*resultExtras*/) override {}
|
||||||
|
|
||||||
|
// Get the UID of the application client using this
|
||||||
|
virtual uid_t getClientUid() const override { return 0; }
|
||||||
|
|
||||||
|
// Get the PID of the application client using this
|
||||||
|
virtual int getClientPid() const override { return 0; }
|
||||||
|
|
||||||
|
status_t initialize() {
|
||||||
|
// TODO: Talk to camera service to add the offline session client book keeping
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
sp<CameraOfflineSessionBase> mSession;
|
||||||
|
|
||||||
|
sp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback;
|
||||||
|
// This class is responsible to convert HAL callbacks to AIDL callbacks
|
||||||
|
|
||||||
|
sp<CameraOfflineSessionBase> mOfflineSession;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
|
|
||||||
|
#endif // ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERAOFFLINESESSIONCLIENT_H
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CameraOfflineSessionBase.h"
|
||||||
|
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class destructors
|
||||||
|
*/
|
||||||
|
CameraOfflineSessionBase::~CameraOfflineSessionBase() {
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H
|
||||||
|
#define ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H
|
||||||
|
|
||||||
|
#include <utils/RefBase.h>
|
||||||
|
#include <utils/String8.h>
|
||||||
|
#include <utils/Timers.h>
|
||||||
|
|
||||||
|
#include "camera/CaptureResult.h"
|
||||||
|
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
class CameraOfflineSessionBase : public virtual RefBase {
|
||||||
|
public:
|
||||||
|
virtual ~CameraOfflineSessionBase();
|
||||||
|
|
||||||
|
// The session's original camera ID
|
||||||
|
virtual const String8& getId() const = 0;
|
||||||
|
|
||||||
|
virtual status_t disconnect() = 0;
|
||||||
|
|
||||||
|
virtual status_t dump(int fd) = 0;
|
||||||
|
|
||||||
|
virtual status_t abort() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capture result passing
|
||||||
|
*/
|
||||||
|
virtual status_t waitForNextFrame(nsecs_t timeout) = 0;
|
||||||
|
|
||||||
|
virtual status_t getNextResult(CaptureResult *frame) = 0;
|
||||||
|
|
||||||
|
// TODO: notification passing path
|
||||||
|
}; // class CameraOfflineSessionBase
|
||||||
|
|
||||||
|
} // namespace android
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOG_TAG "Camera3-OffLnSsn"
|
||||||
|
#define ATRACE_TAG ATRACE_TAG_CAMERA
|
||||||
|
//#define LOG_NDEBUG 0
|
||||||
|
//#define LOG_NNDEBUG 0 // Per-frame verbose logging
|
||||||
|
|
||||||
|
#ifdef LOG_NNDEBUG
|
||||||
|
#define ALOGVV(...) ALOGV(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define ALOGVV(...) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include <utils/Trace.h>
|
||||||
|
|
||||||
|
#include "device3/Camera3OfflineSession.h"
|
||||||
|
#include "device3/Camera3OutputStream.h"
|
||||||
|
#include "device3/Camera3InputStream.h"
|
||||||
|
#include "device3/Camera3SharedOutputStream.h"
|
||||||
|
|
||||||
|
using namespace android::camera3;
|
||||||
|
using namespace android::hardware::camera;
|
||||||
|
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
Camera3OfflineSession::Camera3OfflineSession(const String8 &id):
|
||||||
|
mId(id)
|
||||||
|
{
|
||||||
|
ATRACE_CALL();
|
||||||
|
ALOGV("%s: Created offline session for camera %s", __FUNCTION__, mId.string());
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera3OfflineSession::~Camera3OfflineSession()
|
||||||
|
{
|
||||||
|
ATRACE_CALL();
|
||||||
|
ALOGV("%s: Tearing down offline session for camera id %s", __FUNCTION__, mId.string());
|
||||||
|
}
|
||||||
|
|
||||||
|
const String8& Camera3OfflineSession::getId() const {
|
||||||
|
return mId;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::initialize(
|
||||||
|
sp<hardware::camera::device::V3_6::ICameraOfflineSession> /*hidlSession*/) {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::dump(int /*fd*/) {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::abort() {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::disconnect() {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::waitForNextFrame(nsecs_t /*timeout*/) {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t Camera3OfflineSession::getNextResult(CaptureResult* /*frame*/) {
|
||||||
|
ATRACE_CALL();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
hardware::Return<void> Camera3OfflineSession::processCaptureResult_3_4(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_4::CaptureResult>& /*results*/) {
|
||||||
|
return hardware::Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
hardware::Return<void> Camera3OfflineSession::processCaptureResult(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_2::CaptureResult>& /*results*/) {
|
||||||
|
return hardware::Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
hardware::Return<void> Camera3OfflineSession::notify(
|
||||||
|
const hardware::hidl_vec<hardware::camera::device::V3_2::NotifyMsg>& /*msgs*/) {
|
||||||
|
return hardware::Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
hardware::Return<void> Camera3OfflineSession::requestStreamBuffers(
|
||||||
|
const hardware::hidl_vec<hardware::camera::device::V3_5::BufferRequest>& /*bufReqs*/,
|
||||||
|
requestStreamBuffers_cb /*_hidl_cb*/) {
|
||||||
|
return hardware::Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
hardware::Return<void> Camera3OfflineSession::returnStreamBuffers(
|
||||||
|
const hardware::hidl_vec<hardware::camera::device::V3_2::StreamBuffer>& /*buffers*/) {
|
||||||
|
return hardware::Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace android
|
@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ANDROID_SERVERS_CAMERA3OFFLINESESSION_H
|
||||||
|
#define ANDROID_SERVERS_CAMERA3OFFLINESESSION_H
|
||||||
|
|
||||||
|
#include <utils/String8.h>
|
||||||
|
#include <utils/String16.h>
|
||||||
|
|
||||||
|
#include <android/hardware/camera/device/3.6/ICameraOfflineSession.h>
|
||||||
|
#include <fmq/MessageQueue.h>
|
||||||
|
|
||||||
|
#include "common/CameraOfflineSessionBase.h"
|
||||||
|
|
||||||
|
#include "device3/Camera3BufferManager.h"
|
||||||
|
#include "device3/DistortionMapper.h"
|
||||||
|
#include "utils/TagMonitor.h"
|
||||||
|
#include "utils/LatencyHistogram.h"
|
||||||
|
#include <camera_metadata_hidden.h>
|
||||||
|
|
||||||
|
namespace android {
|
||||||
|
|
||||||
|
namespace camera3 {
|
||||||
|
|
||||||
|
class Camera3Stream;
|
||||||
|
class Camera3OutputStreamInterface;
|
||||||
|
class Camera3StreamInterface;
|
||||||
|
|
||||||
|
} // namespace camera3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Camera3OfflineSession for offline session defined in HIDL ICameraOfflineSession@3.6 or higher
|
||||||
|
*/
|
||||||
|
class Camera3OfflineSession :
|
||||||
|
public CameraOfflineSessionBase,
|
||||||
|
virtual public hardware::camera::device::V3_5::ICameraDeviceCallback {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// initialize by Camera3Device. Camera3Device must send all info in separate argument.
|
||||||
|
// monitored tags
|
||||||
|
// mUseHalBufManager
|
||||||
|
// mUsePartialResult
|
||||||
|
// mNumPartialResults
|
||||||
|
explicit Camera3OfflineSession(const String8& id);
|
||||||
|
|
||||||
|
virtual ~Camera3OfflineSession();
|
||||||
|
|
||||||
|
status_t initialize(
|
||||||
|
sp<hardware::camera::device::V3_6::ICameraOfflineSession> hidlSession);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CameraOfflineSessionBase interface
|
||||||
|
*/
|
||||||
|
const String8& getId() const override;
|
||||||
|
|
||||||
|
status_t disconnect() override;
|
||||||
|
|
||||||
|
status_t dump(int fd) override;
|
||||||
|
|
||||||
|
status_t abort() override;
|
||||||
|
|
||||||
|
// methods for capture result passing
|
||||||
|
status_t waitForNextFrame(nsecs_t timeout) override;
|
||||||
|
status_t getNextResult(CaptureResult *frame) override;
|
||||||
|
|
||||||
|
// TODO: methods for notification (error/idle/finished etc) passing
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End of CameraOfflineSessionBase interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HIDL ICameraDeviceCallback interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of android::hardware::camera::device::V3_5::ICameraDeviceCallback
|
||||||
|
*/
|
||||||
|
|
||||||
|
hardware::Return<void> processCaptureResult_3_4(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_4::CaptureResult>& results) override;
|
||||||
|
hardware::Return<void> processCaptureResult(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_2::CaptureResult>& results) override;
|
||||||
|
hardware::Return<void> notify(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_2::NotifyMsg>& msgs) override;
|
||||||
|
|
||||||
|
hardware::Return<void> requestStreamBuffers(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_5::BufferRequest>& bufReqs,
|
||||||
|
requestStreamBuffers_cb _hidl_cb) override;
|
||||||
|
|
||||||
|
hardware::Return<void> returnStreamBuffers(
|
||||||
|
const hardware::hidl_vec<
|
||||||
|
hardware::camera::device::V3_2::StreamBuffer>& buffers) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End of CameraOfflineSessionBase interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Camera device ID
|
||||||
|
const String8 mId;
|
||||||
|
|
||||||
|
}; // class Camera3OfflineSession
|
||||||
|
|
||||||
|
}; // namespace android
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue