File: CameraSessionStats.java

package info (click to toggle)
android-platform-frameworks-base 1%3A14~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 326,092 kB
  • sloc: java: 2,032,373; xml: 343,016; cpp: 304,181; python: 3,683; ansic: 2,090; sh: 1,871; makefile: 117; sed: 19
file content (227 lines) | stat: -rw-r--r-- 6,586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*
 * Copyright (C) 2020 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;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;
/**
 * The camera action state used for passing camera usage information from
 * camera service to camera service proxy .
 *
 * Include camera id, facing, state, client apk name, apiLevel, isNdk,
 * and session/stream statistics.
 *
 * @hide
 */
public class CameraSessionStats implements Parcelable {
    public static final int CAMERA_STATE_OPEN = 0;
    public static final int CAMERA_STATE_ACTIVE = 1;
    public static final int CAMERA_STATE_IDLE = 2;
    public static final int CAMERA_STATE_CLOSED = 3;

    /**
     * Values for notifyCameraState facing
     */
    public static final int CAMERA_FACING_BACK = 0;
    public static final int CAMERA_FACING_FRONT = 1;
    public static final int CAMERA_FACING_EXTERNAL = 2;

    /**
     * Values for notifyCameraState api level
     */
    public static final int CAMERA_API_LEVEL_1 = 1;
    public static final int CAMERA_API_LEVEL_2 = 2;

    private String mCameraId;
    private int mFacing;
    private int mNewCameraState;
    private String mClientName;
    private int mApiLevel;
    private boolean mIsNdk;
    private int mLatencyMs;
    private int mSessionType;
    private int mInternalReconfigure;
    private long mRequestCount;
    private long mResultErrorCount;
    private boolean mDeviceError;
    private float mMaxPreviewFps;
    private ArrayList<CameraStreamStats> mStreamStats;
    private String mUserTag;
    private int mVideoStabilizationMode;

    public CameraSessionStats() {
        mFacing = -1;
        mNewCameraState = -1;
        mApiLevel = -1;
        mIsNdk = false;
        mLatencyMs = -1;
        mMaxPreviewFps = 0;
        mSessionType = -1;
        mInternalReconfigure = -1;
        mRequestCount = 0;
        mResultErrorCount = 0;
        mDeviceError = false;
        mStreamStats = new ArrayList<CameraStreamStats>();
        mVideoStabilizationMode = -1;
    }

    public CameraSessionStats(String cameraId, int facing, int newCameraState,
            String clientName, int apiLevel, boolean isNdk, int creationDuration,
            float maxPreviewFps, int sessionType, int internalReconfigure) {
        mCameraId = cameraId;
        mFacing = facing;
        mNewCameraState = newCameraState;
        mClientName = clientName;
        mApiLevel = apiLevel;
        mIsNdk = isNdk;
        mLatencyMs = creationDuration;
        mMaxPreviewFps = maxPreviewFps;
        mSessionType = sessionType;
        mInternalReconfigure = internalReconfigure;
        mStreamStats = new ArrayList<CameraStreamStats>();
    }

    public static final @android.annotation.NonNull Parcelable.Creator<CameraSessionStats> CREATOR =
            new Parcelable.Creator<CameraSessionStats>() {
        @Override
        public CameraSessionStats createFromParcel(Parcel in) {
            return new CameraSessionStats(in);
        }

        @Override
        public CameraSessionStats[] newArray(int size) {
            return new CameraSessionStats[size];
        }
    };

    private CameraSessionStats(Parcel in) {
        readFromParcel(in);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mCameraId);
        dest.writeInt(mFacing);
        dest.writeInt(mNewCameraState);
        dest.writeString(mClientName);
        dest.writeInt(mApiLevel);
        dest.writeBoolean(mIsNdk);
        dest.writeInt(mLatencyMs);
        dest.writeFloat(mMaxPreviewFps);
        dest.writeInt(mSessionType);
        dest.writeInt(mInternalReconfigure);
        dest.writeLong(mRequestCount);
        dest.writeLong(mResultErrorCount);
        dest.writeBoolean(mDeviceError);
        dest.writeTypedList(mStreamStats);
        dest.writeString(mUserTag);
        dest.writeInt(mVideoStabilizationMode);
    }

    public void readFromParcel(Parcel in) {
        mCameraId = in.readString();
        mFacing = in.readInt();
        mNewCameraState = in.readInt();
        mClientName = in.readString();
        mApiLevel = in.readInt();
        mIsNdk = in.readBoolean();
        mLatencyMs = in.readInt();
        mMaxPreviewFps = in.readFloat();
        mSessionType = in.readInt();
        mInternalReconfigure = in.readInt();
        mRequestCount = in.readLong();
        mResultErrorCount = in.readLong();
        mDeviceError = in.readBoolean();

        ArrayList<CameraStreamStats> streamStats = new ArrayList<CameraStreamStats>();
        in.readTypedList(streamStats, CameraStreamStats.CREATOR);
        mStreamStats = streamStats;

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

    public String getCameraId() {
        return mCameraId;
    }

    public int getFacing() {
        return mFacing;
    }

    public int getNewCameraState() {
        return mNewCameraState;
    }

    public String getClientName() {
        return mClientName;
    }

    public int getApiLevel() {
        return mApiLevel;
    }

    public boolean isNdk() {
        return mIsNdk;
    }

    public int getLatencyMs() {
        return mLatencyMs;
    }

    public float getMaxPreviewFps() {
        return mMaxPreviewFps;
    }

    public int getSessionType() {
        return mSessionType;
    }

    public int getInternalReconfigureCount() {
        return mInternalReconfigure;
    }

    public long getRequestCount() {
        return mRequestCount;
    }

    public long getResultErrorCount() {
        return mResultErrorCount;
    }

    public boolean getDeviceErrorFlag() {
        return mDeviceError;
    }

    public List<CameraStreamStats> getStreamStats() {
        return mStreamStats;
    }

    public String getUserTag() {
        return mUserTag;
    }

    public int getVideoStabilizationMode() {
        return mVideoStabilizationMode;
    }
}