• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 package android.uwb;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 import java.util.Objects;
23 
24 /**
25  * @hide
26  */
27 public final class SessionHandle implements Parcelable  {
28     private final int mId;
29 
SessionHandle(int id)30     public SessionHandle(int id) {
31         mId = id;
32     }
33 
SessionHandle(Parcel in)34     protected SessionHandle(Parcel in) {
35         mId = in.readInt();
36     }
37 
38     public static final Creator<SessionHandle> CREATOR = new Creator<SessionHandle>() {
39         @Override
40         public SessionHandle createFromParcel(Parcel in) {
41             return new SessionHandle(in);
42         }
43 
44         @Override
45         public SessionHandle[] newArray(int size) {
46             return new SessionHandle[size];
47         }
48     };
49 
getId()50     public int getId() {
51         return mId;
52     }
53 
54     @Override
describeContents()55     public int describeContents() {
56         return 0;
57     }
58 
59     @Override
writeToParcel(Parcel dest, int flags)60     public void writeToParcel(Parcel dest, int flags) {
61         dest.writeInt(mId);
62     }
63 
64     @Override
equals(Object obj)65     public boolean equals(Object obj) {
66         if (this == obj) {
67             return true;
68         }
69 
70         if (obj instanceof SessionHandle) {
71             SessionHandle other = (SessionHandle) obj;
72             return mId == other.mId;
73         }
74         return false;
75     }
76 
77     @Override
hashCode()78     public int hashCode() {
79         return Objects.hashCode(mId);
80     }
81 
82     @Override
toString()83     public String toString() {
84         return "SessionHandle [id=" + mId + "]";
85     }
86 }
87