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.bluetooth;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22import java.util.Random;
23
24/** @hide */
25public final class BluetoothHidDeviceAppConfiguration implements Parcelable {
26    private final long mHash;
27
28    BluetoothHidDeviceAppConfiguration() {
29        Random rnd = new Random();
30        mHash = rnd.nextLong();
31    }
32
33    BluetoothHidDeviceAppConfiguration(long hash) {
34        mHash = hash;
35    }
36
37    @Override
38    public boolean equals(Object o) {
39        if (o instanceof BluetoothHidDeviceAppConfiguration) {
40            BluetoothHidDeviceAppConfiguration config = (BluetoothHidDeviceAppConfiguration) o;
41            return mHash == config.mHash;
42        }
43        return false;
44    }
45
46    @Override
47    public int describeContents() {
48        return 0;
49    }
50
51    public static final Parcelable.Creator<BluetoothHidDeviceAppConfiguration> CREATOR =
52        new Parcelable.Creator<BluetoothHidDeviceAppConfiguration>() {
53
54        @Override
55        public BluetoothHidDeviceAppConfiguration createFromParcel(Parcel in) {
56            long hash = in.readLong();
57            return new BluetoothHidDeviceAppConfiguration(hash);
58        }
59
60        @Override
61        public BluetoothHidDeviceAppConfiguration[] newArray(int size) {
62            return new BluetoothHidDeviceAppConfiguration[size];
63        }
64    };
65
66    @Override
67    public void writeToParcel(Parcel out, int flags) {
68        out.writeLong(mHash);
69    }
70}
71