Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 573287b0 authored by Avichal Rakesh's avatar Avichal Rakesh Committed by Automerger Merge Worker
Browse files

Merge "cameraservice: Correlate various CameraActionEvents" into udc-dev am: 851106c8

parents 224afa4f 851106c8
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public class CameraSessionStats implements Parcelable {
    private int mApiLevel;
    private boolean mIsNdk;
    private int mLatencyMs;
    private long mLogId;
    private int mSessionType;
    private int mInternalReconfigure;
    private long mRequestCount;
@@ -70,6 +71,7 @@ public class CameraSessionStats implements Parcelable {
        mApiLevel = -1;
        mIsNdk = false;
        mLatencyMs = -1;
        mLogId = 0;
        mMaxPreviewFps = 0;
        mSessionType = -1;
        mInternalReconfigure = -1;
@@ -82,7 +84,7 @@ public class CameraSessionStats implements Parcelable {

    public CameraSessionStats(String cameraId, int facing, int newCameraState,
            String clientName, int apiLevel, boolean isNdk, int creationDuration,
            float maxPreviewFps, int sessionType, int internalReconfigure) {
            float maxPreviewFps, int sessionType, int internalReconfigure, long logId) {
        mCameraId = cameraId;
        mFacing = facing;
        mNewCameraState = newCameraState;
@@ -90,6 +92,7 @@ public class CameraSessionStats implements Parcelable {
        mApiLevel = apiLevel;
        mIsNdk = isNdk;
        mLatencyMs = creationDuration;
        mLogId = logId;
        mMaxPreviewFps = maxPreviewFps;
        mSessionType = sessionType;
        mInternalReconfigure = internalReconfigure;
@@ -127,6 +130,7 @@ public class CameraSessionStats implements Parcelable {
        dest.writeInt(mApiLevel);
        dest.writeBoolean(mIsNdk);
        dest.writeInt(mLatencyMs);
        dest.writeLong(mLogId);
        dest.writeFloat(mMaxPreviewFps);
        dest.writeInt(mSessionType);
        dest.writeInt(mInternalReconfigure);
@@ -146,6 +150,7 @@ public class CameraSessionStats implements Parcelable {
        mApiLevel = in.readInt();
        mIsNdk = in.readBoolean();
        mLatencyMs = in.readInt();
        mLogId = in.readLong();
        mMaxPreviewFps = in.readFloat();
        mSessionType = in.readInt();
        mInternalReconfigure = in.readInt();
@@ -189,6 +194,10 @@ public class CameraSessionStats implements Parcelable {
        return mLatencyMs;
    }

    public long getLogId() {
        return mLogId;
    }

    public float getMaxPreviewFps() {
        return mMaxPreviewFps;
    }
+11 −6
Original line number Diff line number Diff line
@@ -243,11 +243,13 @@ public class CameraServiceProxy extends SystemService
        public List<CameraStreamStats> mStreamStats;
        public String mUserTag;
        public int mVideoStabilizationMode;
        public final long mLogId;

        private long mDurationOrStartTimeMs;  // Either start time, or duration once completed

        CameraUsageEvent(String cameraId, int facing, String clientName, int apiLevel,
                boolean isNdk, int action, int latencyMs, int operatingMode, boolean deviceError) {
                boolean isNdk, int action, int latencyMs, int operatingMode, boolean deviceError,
                long logId) {
            mCameraId = cameraId;
            mCameraFacing = facing;
            mClientName = clientName;
@@ -259,6 +261,7 @@ public class CameraServiceProxy extends SystemService
            mLatencyMs = latencyMs;
            mOperatingMode = operatingMode;
            mDeviceError = deviceError;
            mLogId = logId;
        }

        public void markCompleted(int internalReconfigure, long requestCount,
@@ -840,7 +843,8 @@ public class CameraServiceProxy extends SystemService
                        + ", deviceError " + e.mDeviceError
                        + ", streamCount is " + streamCount
                        + ", userTag is " + e.mUserTag
                        + ", videoStabilizationMode " + e.mVideoStabilizationMode);
                        + ", videoStabilizationMode " + e.mVideoStabilizationMode
                        + ", logId " + e.mLogId);
            }
            // Convert from CameraStreamStats to CameraStreamProto
            CameraStreamProto[] streamProtos = new CameraStreamProto[MAX_STREAM_STATISTICS];
@@ -900,7 +904,7 @@ public class CameraServiceProxy extends SystemService
                    MessageNano.toByteArray(streamProtos[2]),
                    MessageNano.toByteArray(streamProtos[3]),
                    MessageNano.toByteArray(streamProtos[4]),
                    e.mUserTag, e.mVideoStabilizationMode);
                    e.mUserTag, e.mVideoStabilizationMode, e.mLogId);
        }
    }

@@ -1089,6 +1093,7 @@ public class CameraServiceProxy extends SystemService
        List<CameraStreamStats> streamStats = cameraState.getStreamStats();
        String userTag = cameraState.getUserTag();
        int videoStabilizationMode = cameraState.getVideoStabilizationMode();
        long logId = cameraState.getLogId();
        synchronized(mLock) {
            // Update active camera list and notify NFC if necessary
            boolean wasEmpty = mActiveCameraUsage.isEmpty();
@@ -1110,7 +1115,7 @@ public class CameraServiceProxy extends SystemService
                    CameraUsageEvent openEvent = new CameraUsageEvent(
                            cameraId, facing, clientName, apiLevel, isNdk,
                            FrameworkStatsLog.CAMERA_ACTION_EVENT__ACTION__OPEN,
                            latencyMs, sessionType, deviceError);
                            latencyMs, sessionType, deviceError, logId);
                    mCameraUsageHistory.add(openEvent);
                    break;
                case CameraSessionStats.CAMERA_STATE_ACTIVE:
@@ -1137,7 +1142,7 @@ public class CameraServiceProxy extends SystemService
                    CameraUsageEvent newEvent = new CameraUsageEvent(
                            cameraId, facing, clientName, apiLevel, isNdk,
                            FrameworkStatsLog.CAMERA_ACTION_EVENT__ACTION__SESSION,
                            latencyMs, sessionType, deviceError);
                            latencyMs, sessionType, deviceError, logId);
                    CameraUsageEvent oldEvent = mActiveCameraUsage.put(cameraId, newEvent);
                    if (oldEvent != null) {
                        Slog.w(TAG, "Camera " + cameraId + " was already marked as active");
@@ -1181,7 +1186,7 @@ public class CameraServiceProxy extends SystemService
                        CameraUsageEvent closeEvent = new CameraUsageEvent(
                                cameraId, facing, clientName, apiLevel, isNdk,
                                FrameworkStatsLog.CAMERA_ACTION_EVENT__ACTION__CLOSE,
                                latencyMs, sessionType, deviceError);
                                latencyMs, sessionType, deviceError, logId);
                        mCameraUsageHistory.add(closeEvent);
                    }