Debian Codegraph @

core/java/android/hardware/CameraSessionStats.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 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 package android.hardware;
17 import android.os.Parcel;
18 import android.os.Parcelable;
19
20 import java.util.ArrayList;
21 import java.util.List;
22 /**
23 * The camera action state used for passing camera usage information from
24 * camera service to camera service proxy .
25 *
26 * Include camera id, facing, state, client apk name, apiLevel, isNdk,
27 * and session/stream statistics.
28 *
29 * @hide
30 */
31 public class CameraSessionStats implements Parcelable {
32 public static final int CAMERA_STATE_OPEN = 0;
33 public static final int CAMERA_STATE_ACTIVE = 1;
34 public static final int CAMERA_STATE_IDLE = 2;
35 public static final int CAMERA_STATE_CLOSED = 3;
36
37 /**
38 * Values for notifyCameraState facing
39 */
40 public static final int CAMERA_FACING_BACK = 0;
41 public static final int CAMERA_FACING_FRONT = 1;
42 public static final int CAMERA_FACING_EXTERNAL = 2;
43
44 /**
45 * Values for notifyCameraState api level
46 */
47 public static final int CAMERA_API_LEVEL_1 = 1;
48 public static final int CAMERA_API_LEVEL_2 = 2;
49
50 private String mCameraId;
51 private int mFacing;
52 private int mNewCameraState;
53 private String mClientName;
54 private int mApiLevel;
55 private boolean mIsNdk;
56 private int mLatencyMs;
57 private int mSessionType;
58 private int mInternalReconfigure;
59 private long mRequestCount;
60 private long mResultErrorCount;
61 private boolean mDeviceError;
62 private float mMaxPreviewFps;
63 private ArrayList<CameraStreamStats> mStreamStats;
64 private String mUserTag;
65 private int mVideoStabilizationMode;
66
67 public CameraSessionStats() {
68 mFacing = -1;
69 mNewCameraState = -1;
70 mApiLevel = -1;
71 mIsNdk = false;
72 mLatencyMs = -1;
73 mMaxPreviewFps = 0;
74 mSessionType = -1;
75 mInternalReconfigure = -1;
76 mRequestCount = 0;
77 mResultErrorCount = 0;
78 mDeviceError = false;
79 mStreamStats = new ArrayList<CameraStreamStats>();
80 mVideoStabilizationMode = -1;
81 }
82
83 public CameraSessionStats(String cameraId, int facing, int newCameraState,
84 String clientName, int apiLevel, boolean isNdk, int creationDuration,
85 float maxPreviewFps, int sessionType, int internalReconfigure) {
86 mCameraId = cameraId;
87 mFacing = facing;
88 mNewCameraState = newCameraState;
89 mClientName = clientName;
90 mApiLevel = apiLevel;
91 mIsNdk = isNdk;
92 mLatencyMs = creationDuration;
93 mMaxPreviewFps = maxPreviewFps;
94 mSessionType = sessionType;
95 mInternalReconfigure = internalReconfigure;
96 mStreamStats = new ArrayList<CameraStreamStats>();
97 }
98
99 public static final @android.annotation.NonNull Parcelable.Creator<CameraSessionStats> CREATOR =
100 new Parcelable.Creator<CameraSessionStats>() {
101 @Override
102 public CameraSessionStats createFromParcel(Parcel in) {
103 return new CameraSessionStats(in);
104 }
105
106 @Override
107 public CameraSessionStats[] newArray(int size) {
108 return new CameraSessionStats[size];
109 }
110 };
111
112 private CameraSessionStats(Parcel in) {
113 readFromParcel(in);
114 }
115
116 @Override
117 public int describeContents() {
118 return 0;
119 }
120
121 @Override
122 public void writeToParcel(Parcel dest, int flags) {
123 dest.writeString(mCameraId);
124 dest.writeInt(mFacing);
125 dest.writeInt(mNewCameraState);
126 dest.writeString(mClientName);
127 dest.writeInt(mApiLevel);
128 dest.writeBoolean(mIsNdk);
129 dest.writeInt(mLatencyMs);
130 dest.writeFloat(mMaxPreviewFps);
131 dest.writeInt(mSessionType);
132 dest.writeInt(mInternalReconfigure);
133 dest.writeLong(mRequestCount);
134 dest.writeLong(mResultErrorCount);
135 dest.writeBoolean(mDeviceError);
136 dest.writeTypedList(mStreamStats);
137 dest.writeString(mUserTag);
138 dest.writeInt(mVideoStabilizationMode);
139 }
140
141 public void readFromParcel(Parcel in) {
142 mCameraId = in.readString();
143 mFacing = in.readInt();
144 mNewCameraState = in.readInt();
145 mClientName = in.readString();
146 mApiLevel = in.readInt();
147 mIsNdk = in.readBoolean();
148 mLatencyMs = in.readInt();
149 mMaxPreviewFps = in.readFloat();
150 mSessionType = in.readInt();
151 mInternalReconfigure = in.readInt();
152 mRequestCount = in.readLong();
153 mResultErrorCount = in.readLong();
154 mDeviceError = in.readBoolean();
155
156 ArrayList<CameraStreamStats> streamStats = new ArrayList<CameraStreamStats>();
157 in.readTypedList(streamStats, CameraStreamStats.CREATOR);
158 mStreamStats = streamStats;
159
160 mUserTag = in.readString();
161 mVideoStabilizationMode = in.readInt();
162 }
163
164 public String getCameraId() {
165 return mCameraId;
166 }
167
168 public int getFacing() {
169 return mFacing;
170 }
171
172 public int getNewCameraState() {
173 return mNewCameraState;
174 }
175
176 public String getClientName() {
177 return mClientName;
178 }
179
180 public int getApiLevel() {
181 return mApiLevel;
182 }
183
184 public boolean isNdk() {
185 return mIsNdk;
186 }
187
188 public int getLatencyMs() {
189 return mLatencyMs;
190 }
191
192 public float getMaxPreviewFps() {
193 return mMaxPreviewFps;
194 }
195
196 public int getSessionType() {
197 return mSessionType;
198 }
199
200 public int getInternalReconfigureCount() {
201 return mInternalReconfigure;
202 }
203
204 public long getRequestCount() {
205 return mRequestCount;
206 }
207
208 public long getResultErrorCount() {
209 return mResultErrorCount;
210 }
211
212 public boolean getDeviceErrorFlag() {
213 return mDeviceError;
214 }
215
216 public List<CameraStreamStats> getStreamStats() {
217 return mStreamStats;
218 }
219
220 public String getUserTag() {
221 return mUserTag;
222 }
223
224 public int getVideoStabilizationMode() {
225 return mVideoStabilizationMode;
226 }
227 }