| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.ims; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.os.IBinder; |
| 22 |
import android.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
import android.telephony.ims.ImsService; |
| 25 |
import android.telephony.ims.aidl.IImsConfig; |
| 26 |
import android.telephony.ims.aidl.IImsRegistration; |
| 27 |
import android.telephony.ims.aidl.ISipTransport; |
| 28 |
import android.telephony.ims.feature.ImsFeature; |
| 29 |
|
| 30 |
import java.util.Objects; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public final class ImsFeatureContainer implements Parcelable { |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public final IBinder imsFeature; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public final android.telephony.ims.aidl.IImsConfig imsConfig; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public final IImsRegistration imsRegistration; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public final ISipTransport sipTransport; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
private @ImsFeature.ImsState int mState = ImsFeature.STATE_UNAVAILABLE; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
private @ImsService.ImsServiceCapability long mCapabilities; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public ImsFeatureContainer(@NonNull IBinder iFace, @NonNull IImsConfig iConfig, |
| 76 |
@NonNull IImsRegistration iReg, @Nullable ISipTransport transport, long initialCaps) { |
| 77 |
imsFeature = iFace; |
| 78 |
imsConfig = iConfig; |
| 79 |
imsRegistration = iReg; |
| 80 |
sipTransport = transport; |
| 81 |
mCapabilities = initialCaps; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
private ImsFeatureContainer(Parcel in) { |
| 88 |
imsFeature = in.readStrongBinder(); |
| 89 |
imsConfig = IImsConfig.Stub.asInterface(in.readStrongBinder()); |
| 90 |
imsRegistration = IImsRegistration.Stub.asInterface(in.readStrongBinder()); |
| 91 |
sipTransport = ISipTransport.Stub.asInterface(in.readStrongBinder()); |
| 92 |
mState = in.readInt(); |
| 93 |
mCapabilities = in.readLong(); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
public @ImsService.ImsServiceCapability long getCapabilities() { |
| 101 |
return mCapabilities; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public void setCapabilities(@ImsService.ImsServiceCapability long caps) { |
| 109 |
mCapabilities = caps; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
public @ImsFeature.ImsState int getState() { |
| 116 |
return mState; |
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
public void setState(@ImsFeature.ImsState int state) { |
| 124 |
mState = state; |
| 125 |
} |
| 126 |
|
| 127 |
@Override |
| 128 |
public boolean equals(Object o) { |
| 129 |
if (this == o) return true; |
| 130 |
if (o == null || getClass() != o.getClass()) return false; |
| 131 |
ImsFeatureContainer that = (ImsFeatureContainer) o; |
| 132 |
return imsFeature.equals(that.imsFeature) && |
| 133 |
imsConfig.equals(that.imsConfig) && |
| 134 |
imsRegistration.equals(that.imsRegistration) && |
| 135 |
sipTransport.equals(that.sipTransport) && |
| 136 |
mState == that.getState() && |
| 137 |
mCapabilities == that.getCapabilities(); |
| 138 |
} |
| 139 |
|
| 140 |
@Override |
| 141 |
public int hashCode() { |
| 142 |
return Objects.hash(imsFeature, imsConfig, imsRegistration, sipTransport, mState, |
| 143 |
mCapabilities); |
| 144 |
} |
| 145 |
|
| 146 |
@Override |
| 147 |
public String toString() { |
| 148 |
return "FeatureContainer{" + |
| 149 |
"imsFeature=" + imsFeature + |
| 150 |
", imsConfig=" + imsConfig + |
| 151 |
", imsRegistration=" + imsRegistration + |
| 152 |
", sipTransport=" + sipTransport + |
| 153 |
", state=" + ImsFeature.STATE_LOG_MAP.get(mState) + |
| 154 |
", capabilities = " + ImsService.getCapabilitiesString(mCapabilities) + |
| 155 |
'}'; |
| 156 |
} |
| 157 |
|
| 158 |
@Override |
| 159 |
public int describeContents() { |
| 160 |
return 0; |
| 161 |
} |
| 162 |
|
| 163 |
@Override |
| 164 |
public void writeToParcel(Parcel dest, int flags) { |
| 165 |
dest.writeStrongBinder(imsFeature); |
| 166 |
dest.writeStrongInterface(imsConfig); |
| 167 |
dest.writeStrongInterface(imsRegistration); |
| 168 |
dest.writeStrongInterface(sipTransport); |
| 169 |
dest.writeInt(mState); |
| 170 |
dest.writeLong(mCapabilities); |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
public static final Creator<ImsFeatureContainer> CREATOR = new Creator<ImsFeatureContainer>() { |
| 175 |
@Override |
| 176 |
public ImsFeatureContainer createFromParcel(Parcel source) { |
| 177 |
return new ImsFeatureContainer(source); |
| 178 |
} |
| 179 |
|
| 180 |
@Override |
| 181 |
public ImsFeatureContainer[] newArray(int size) { |
| 182 |
return new ImsFeatureContainer[size]; |
| 183 |
} |
| 184 |
}; |
| 185 |
} |