1 /*
2  * Copyright (C) 2014 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.camera2.impl;
17 
18 import android.os.Parcel;
19 import android.os.Parcelable;
20 
21 /**
22  * @hide
23  */
24 public class CaptureResultExtras implements Parcelable {
25     private int requestId;
26     private int subsequenceId;
27     private int afTriggerId;
28     private int precaptureTriggerId;
29     private long frameNumber;
30     private int partialResultCount;
31     private int errorStreamId;
32     private String errorPhysicalCameraId;
33 
34     public static final @android.annotation.NonNull Parcelable.Creator<CaptureResultExtras> CREATOR =
35             new Parcelable.Creator<CaptureResultExtras>() {
36         @Override
37         public CaptureResultExtras createFromParcel(Parcel in) {
38             return new CaptureResultExtras(in);
39         }
40 
41         @Override
42         public CaptureResultExtras[] newArray(int size) {
43             return new CaptureResultExtras[size];
44         }
45     };
46 
CaptureResultExtras(Parcel in)47     private CaptureResultExtras(Parcel in) {
48         readFromParcel(in);
49     }
50 
CaptureResultExtras(int requestId, int subsequenceId, int afTriggerId, int precaptureTriggerId, long frameNumber, int partialResultCount, int errorStreamId, String errorPhysicalCameraId)51     public CaptureResultExtras(int requestId, int subsequenceId, int afTriggerId,
52                                int precaptureTriggerId, long frameNumber,
53                                int partialResultCount, int errorStreamId,
54                                String errorPhysicalCameraId) {
55         this.requestId = requestId;
56         this.subsequenceId = subsequenceId;
57         this.afTriggerId = afTriggerId;
58         this.precaptureTriggerId = precaptureTriggerId;
59         this.frameNumber = frameNumber;
60         this.partialResultCount = partialResultCount;
61         this.errorStreamId = errorStreamId;
62         this.errorPhysicalCameraId = errorPhysicalCameraId;
63     }
64 
65     @Override
describeContents()66     public int describeContents() {
67         return 0;
68     }
69 
70     @Override
writeToParcel(Parcel dest, int flags)71     public void writeToParcel(Parcel dest, int flags) {
72         dest.writeInt(requestId);
73         dest.writeInt(subsequenceId);
74         dest.writeInt(afTriggerId);
75         dest.writeInt(precaptureTriggerId);
76         dest.writeLong(frameNumber);
77         dest.writeInt(partialResultCount);
78         dest.writeInt(errorStreamId);
79         if ((errorPhysicalCameraId != null) && !errorPhysicalCameraId.isEmpty()) {
80             dest.writeBoolean(true);
81             dest.writeString(errorPhysicalCameraId);
82         } else {
83             dest.writeBoolean(false);
84         }
85     }
86 
readFromParcel(Parcel in)87     public void readFromParcel(Parcel in) {
88         requestId = in.readInt();
89         subsequenceId = in.readInt();
90         afTriggerId = in.readInt();
91         precaptureTriggerId = in.readInt();
92         frameNumber = in.readLong();
93         partialResultCount = in.readInt();
94         errorStreamId = in.readInt();
95         boolean errorPhysicalCameraIdPresent = in.readBoolean();
96         if (errorPhysicalCameraIdPresent) {
97             errorPhysicalCameraId = in.readString();
98         }
99     }
100 
getErrorPhysicalCameraId()101     public String getErrorPhysicalCameraId() {
102         return errorPhysicalCameraId;
103     }
104 
getRequestId()105     public int getRequestId() {
106         return requestId;
107     }
108 
getSubsequenceId()109     public int getSubsequenceId() {
110         return subsequenceId;
111     }
112 
getAfTriggerId()113     public int getAfTriggerId() {
114         return afTriggerId;
115     }
116 
getPrecaptureTriggerId()117     public int getPrecaptureTriggerId() {
118         return precaptureTriggerId;
119     }
120 
getFrameNumber()121     public long getFrameNumber() {
122         return frameNumber;
123     }
124 
getPartialResultCount()125     public int getPartialResultCount() {
126         return partialResultCount;
127     }
128 
getErrorStreamId()129     public int getErrorStreamId() {
130         return errorStreamId;
131     }
132 }
133