1/*
2 * Copyright 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
17#include <ui/HdrCapabilities.h>
18
19#include <binder/Parcel.h>
20
21namespace android {
22
23status_t HdrCapabilities::writeToParcel(Parcel* parcel) const
24{
25    status_t result = parcel->writeInt32Vector(mSupportedHdrTypes);
26    if (result != OK) {
27        return result;
28    }
29    result = parcel->writeFloat(mMaxLuminance);
30    if (result != OK) {
31        return result;
32    }
33    result = parcel->writeFloat(mMaxAverageLuminance);
34    if (result != OK) {
35        return result;
36    }
37    result = parcel->writeFloat(mMinLuminance);
38    return result;
39}
40
41status_t HdrCapabilities::readFromParcel(const Parcel* parcel)
42{
43    status_t result = parcel->readInt32Vector(&mSupportedHdrTypes);
44    if (result != OK) {
45        return result;
46    }
47    result = parcel->readFloat(&mMaxLuminance);
48    if (result != OK) {
49        return result;
50    }
51    result = parcel->readFloat(&mMaxAverageLuminance);
52    if (result != OK) {
53        return result;
54    }
55    result = parcel->readFloat(&mMinLuminance);
56    return result;
57}
58
59} // namespace android
60