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.telephony.data; 18 19 import android.annotation.NonNull; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 import java.util.Objects; 24 25 26 /** 27 * Class that stores information specific to NR QOS. 28 * 29 * @hide 30 */ 31 public final class EpsQos extends Qos implements Parcelable { 32 33 int qosClassId; 34 EpsQos()35 public EpsQos() { 36 super(Qos.QOS_TYPE_EPS, 37 new android.hardware.radio.V1_6.QosBandwidth(), 38 new android.hardware.radio.V1_6.QosBandwidth()); 39 } 40 EpsQos(@onNull android.hardware.radio.V1_6.EpsQos qos)41 public EpsQos(@NonNull android.hardware.radio.V1_6.EpsQos qos) { 42 super(Qos.QOS_TYPE_EPS, qos.downlink, qos.uplink); 43 qosClassId = qos.qci; 44 } 45 EpsQos(Parcel source)46 private EpsQos(Parcel source) { 47 super(source); 48 qosClassId = source.readInt(); 49 } 50 getQci()51 public int getQci() { 52 return qosClassId; 53 } 54 createFromParcelBody(@onNull Parcel in)55 public static @NonNull EpsQos createFromParcelBody(@NonNull Parcel in) { 56 return new EpsQos(in); 57 } 58 59 @Override writeToParcel(@onNull Parcel dest, int flags)60 public void writeToParcel(@NonNull Parcel dest, int flags) { 61 super.writeToParcel(Qos.QOS_TYPE_EPS, dest, flags); 62 dest.writeInt(qosClassId); 63 } 64 65 @Override describeContents()66 public int describeContents() { 67 return 0; 68 } 69 70 @Override hashCode()71 public int hashCode() { 72 return Objects.hash(super.hashCode(), qosClassId); 73 } 74 75 @Override equals(Object o)76 public boolean equals(Object o) { 77 if (this == o) return true; 78 79 if (o == null || !(o instanceof EpsQos)) { 80 return false; 81 } 82 83 EpsQos other = (EpsQos) o; 84 85 return this.qosClassId == other.qosClassId 86 && super.equals(other); 87 } 88 89 @Override toString()90 public String toString() { 91 return "EpsQos {" 92 + " qosClassId=" + qosClassId 93 + " downlink=" + downlink 94 + " uplink=" + uplink + "}"; 95 } 96 97 public static final @NonNull Parcelable.Creator<EpsQos> CREATOR = 98 new Parcelable.Creator<EpsQos>() { 99 @Override 100 public EpsQos createFromParcel(Parcel source) { 101 return new EpsQos(source); 102 } 103 104 @Override 105 public EpsQos[] newArray(int size) { 106 return new EpsQos[size]; 107 } 108 }; 109 } 110