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

Commit b46d691c authored by Eino-Ville Talvala (Eddy)'s avatar Eino-Ville Talvala (Eddy) Committed by Android (Google) Code Review
Browse files

Merge "Camera: Add metrics for ultrawide-angle usage" into main

parents a9730092 1b649822
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public class CameraSessionStats implements Parcelable {
    private ArrayList<CameraStreamStats> mStreamStats;
    private String mUserTag;
    private int mVideoStabilizationMode;
    private boolean mUsedUltraWide;
    private int mSessionIndex;
    private CameraExtensionSessionStats mCameraExtensionSessionStats;

@@ -82,6 +83,7 @@ public class CameraSessionStats implements Parcelable {
        mDeviceError = false;
        mStreamStats = new ArrayList<CameraStreamStats>();
        mVideoStabilizationMode = -1;
        mUsedUltraWide = false;
        mSessionIndex = 0;
        mCameraExtensionSessionStats = new CameraExtensionSessionStats();
    }
@@ -102,6 +104,8 @@ public class CameraSessionStats implements Parcelable {
        mSessionType = sessionType;
        mInternalReconfigure = internalReconfigure;
        mStreamStats = new ArrayList<CameraStreamStats>();
        mVideoStabilizationMode = -1;
        mUsedUltraWide = false;
        mSessionIndex = sessionIdx;
        mCameraExtensionSessionStats = new CameraExtensionSessionStats();
    }
@@ -147,6 +151,7 @@ public class CameraSessionStats implements Parcelable {
        dest.writeTypedList(mStreamStats);
        dest.writeString(mUserTag);
        dest.writeInt(mVideoStabilizationMode);
        dest.writeBoolean(mUsedUltraWide);
        dest.writeInt(mSessionIndex);
        mCameraExtensionSessionStats.writeToParcel(dest, 0);
    }
@@ -173,6 +178,9 @@ public class CameraSessionStats implements Parcelable {

        mUserTag = in.readString();
        mVideoStabilizationMode = in.readInt();

        mUsedUltraWide = in.readBoolean();

        mSessionIndex = in.readInt();
        mCameraExtensionSessionStats = CameraExtensionSessionStats.CREATOR.createFromParcel(in);
    }
@@ -245,6 +253,10 @@ public class CameraSessionStats implements Parcelable {
        return mVideoStabilizationMode;
    }

    public boolean getUsedUltraWide() {
        return mUsedUltraWide;
    }

    public int getSessionIndex() {
        return mSessionIndex;
    }
+16 −5
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import android.view.WindowManagerGlobal;
import com.android.framework.protobuf.nano.MessageNano;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.camera.flags.Flags;
import com.android.internal.util.FrameworkStatsLog;
import com.android.server.LocalServices;
import com.android.server.ServiceThread;
@@ -244,6 +245,7 @@ public class CameraServiceProxy extends SystemService
        public List<CameraStreamStats> mStreamStats;
        public String mUserTag;
        public int mVideoStabilizationMode;
        public boolean mUsedUltraWide;
        public final long mLogId;
        public final int mSessionIndex;

@@ -271,7 +273,8 @@ public class CameraServiceProxy extends SystemService
        public void markCompleted(int internalReconfigure, long requestCount,
                long resultErrorCount, boolean deviceError,
                List<CameraStreamStats>  streamStats, String userTag,
                int videoStabilizationMode, CameraExtensionSessionStats extStats) {
                int videoStabilizationMode, boolean usedUltraWide,
                CameraExtensionSessionStats extStats) {
            if (mCompleted) {
                return;
            }
@@ -284,6 +287,7 @@ public class CameraServiceProxy extends SystemService
            mStreamStats = streamStats;
            mUserTag = userTag;
            mVideoStabilizationMode = videoStabilizationMode;
            mUsedUltraWide = usedUltraWide;
            mExtSessionStats = extStats;
            if (CameraServiceProxy.DEBUG) {
                Slog.v(TAG, "A camera facing " + cameraFacingToString(mCameraFacing) +
@@ -873,6 +877,10 @@ public class CameraServiceProxy extends SystemService
                streamCount = e.mStreamStats.size();
            }
            if (CameraServiceProxy.DEBUG) {
                String ultrawideDebug = Flags.logUltrawideUsage()
                        ? ", wideAngleUsage " + e.mUsedUltraWide
                        : "";

                Slog.v(TAG, "CAMERA_ACTION_EVENT: action " + e.mAction
                        + " clientName " + e.mClientName
                        + ", duration " + e.getDuration()
@@ -889,6 +897,7 @@ public class CameraServiceProxy extends SystemService
                        + ", streamCount is " + streamCount
                        + ", userTag is " + e.mUserTag
                        + ", videoStabilizationMode " + e.mVideoStabilizationMode
                        + ultrawideDebug
                        + ", logId " + e.mLogId
                        + ", sessionIndex " + e.mSessionIndex
                        + ", mExtSessionStats {type " + extensionType
@@ -952,8 +961,9 @@ public class CameraServiceProxy extends SystemService
                    MessageNano.toByteArray(streamProtos[2]),
                    MessageNano.toByteArray(streamProtos[3]),
                    MessageNano.toByteArray(streamProtos[4]),
                    e.mUserTag, e.mVideoStabilizationMode, e.mLogId, e.mSessionIndex,
                    extensionType, extensionIsAdvanced);
                    e.mUserTag, e.mVideoStabilizationMode,
                    e.mLogId, e.mSessionIndex,
                    extensionType, extensionIsAdvanced, e.mUsedUltraWide);
        }
    }

@@ -1148,6 +1158,7 @@ public class CameraServiceProxy extends SystemService
        List<CameraStreamStats> streamStats = cameraState.getStreamStats();
        String userTag = cameraState.getUserTag();
        int videoStabilizationMode = cameraState.getVideoStabilizationMode();
        boolean usedUltraWide = Flags.logUltrawideUsage() ? cameraState.getUsedUltraWide() : false;
        long logId = cameraState.getLogId();
        int sessionIdx = cameraState.getSessionIndex();
        CameraExtensionSessionStats extSessionStats = cameraState.getExtensionSessionStats();
@@ -1205,7 +1216,7 @@ public class CameraServiceProxy extends SystemService
                        Slog.w(TAG, "Camera " + cameraId + " was already marked as active");
                        oldEvent.markCompleted(/*internalReconfigure*/0, /*requestCount*/0,
                                /*resultErrorCount*/0, /*deviceError*/false, streamStats,
                                /*userTag*/"", /*videoStabilizationMode*/-1,
                                /*userTag*/"", /*videoStabilizationMode*/-1, /*usedUltraWide*/false,
                                new CameraExtensionSessionStats());
                        mCameraUsageHistory.add(oldEvent);
                    }
@@ -1217,7 +1228,7 @@ public class CameraServiceProxy extends SystemService

                        doneEvent.markCompleted(internalReconfigureCount, requestCount,
                                resultErrorCount, deviceError, streamStats, userTag,
                                videoStabilizationMode, extSessionStats);
                                videoStabilizationMode, usedUltraWide, extSessionStats);
                        mCameraUsageHistory.add(doneEvent);
                        // Do not double count device error
                        deviceError = false;