Camera: Pass system health metrics to ServiceProxy
- Measure session statistics:
- Camera open, close, and session creation latency
- Session information such as camera id, is_ndk, operating mode,
and reconfiguration count.
- Measure stream statistics:
- width, height, format, dataspace, usage
- max buffer count
- buffer loss count
- startup latency.
Test: ./out/host/linux-x86/bin/statsd_testdrive 227
Test: Camera CTS, VNDK test
Bug: 154159000
Change-Id: I082ef26a312bddbfd4abcc2148728a4b7bf8a9f6
diff --git a/services/camera/libcameraservice/common/Camera2ClientBase.cpp b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
index 609698c..6fd8d45 100644
--- a/services/camera/libcameraservice/common/Camera2ClientBase.cpp
+++ b/services/camera/libcameraservice/common/Camera2ClientBase.cpp
@@ -27,12 +27,15 @@
#include <gui/Surface.h>
#include <gui/Surface.h>
+#include <camera/CameraSessionStats.h>
+
#include "common/Camera2ClientBase.h"
#include "api2/CameraDeviceClient.h"
#include "device3/Camera3Device.h"
#include "utils/CameraThreadState.h"
+#include "utils/CameraServiceProxyWrapper.h"
namespace android {
using namespace camera2;
@@ -194,7 +197,7 @@
CameraService::BasicClient::disconnect();
- ALOGV("Camera %s: Shut down complete complete", TClientBase::mCameraIdStr.string());
+ ALOGV("Camera %s: Shut down complete", TClientBase::mCameraIdStr.string());
return res;
}
@@ -245,13 +248,12 @@
}
template <typename TClientBase>
-void Camera2ClientBase<TClientBase>::notifyIdle() {
+void Camera2ClientBase<TClientBase>::notifyIdle(
+ int64_t requestCount, int64_t resultErrorCount, bool deviceError,
+ const std::vector<hardware::CameraStreamStats>& streamStats) {
if (mDeviceActive) {
- getCameraService()->updateProxyDeviceState(
- hardware::ICameraServiceProxy::CAMERA_STATE_IDLE, TClientBase::mCameraIdStr,
- TClientBase::mCameraFacing, TClientBase::mClientPackageName,
- ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 :
- hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1));
+ CameraServiceProxyWrapper::logIdle(TClientBase::mCameraIdStr,
+ requestCount, resultErrorCount, deviceError, streamStats);
}
mDeviceActive = false;
@@ -265,11 +267,7 @@
(void)timestamp;
if (!mDeviceActive) {
- getCameraService()->updateProxyDeviceState(
- hardware::ICameraServiceProxy::CAMERA_STATE_ACTIVE, TClientBase::mCameraIdStr,
- TClientBase::mCameraFacing, TClientBase::mClientPackageName,
- ((mApi1CameraId < 0) ? hardware::ICameraServiceProxy::CAMERA_API_LEVEL_2 :
- hardware::ICameraServiceProxy::CAMERA_API_LEVEL_1));
+ CameraServiceProxyWrapper::logActive(TClientBase::mCameraIdStr);
}
mDeviceActive = true;