VendorTagDescriptor.java revision 5d2d7788f1759b0f3d2c057af0b3ea61b0354fee
1/*
2 * Copyright (C) 2016 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
17package android.hardware.camera2.params;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21import android.util.Log;
22
23/**
24 * A class for describing the vendor tags declared by a camera HAL module.
25 * Generally only used by the native side of
26 * android.hardware.camera2.impl.CameraMetadataNative
27 *
28 * @hide
29 */
30public final class VendorTagDescriptor implements Parcelable {
31
32    private VendorTagDescriptor(Parcel source) {
33    }
34
35    public static final Parcelable.Creator<VendorTagDescriptor> CREATOR =
36            new Parcelable.Creator<VendorTagDescriptor>() {
37        @Override
38        public VendorTagDescriptor createFromParcel(Parcel source) {
39            try {
40                VendorTagDescriptor vendorDescriptor = new VendorTagDescriptor(source);
41                return vendorDescriptor;
42            } catch (Exception e) {
43                Log.e(TAG, "Exception creating VendorTagDescriptor from parcel", e);
44                return null;
45            }
46        }
47
48        @Override
49        public VendorTagDescriptor[] newArray(int size) {
50            return new VendorTagDescriptor[size];
51        }
52    };
53
54    @Override
55    public int describeContents() {
56        return 0;
57    }
58
59    @Override
60    public void writeToParcel(Parcel dest, int flags) {
61        if (dest == null) {
62            throw new IllegalArgumentException("dest must not be null");
63        }
64    }
65
66    private static final String TAG = "VendorTagDescriptor";
67}
68