| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.telephony; |
| 18 |
|
| 19 |
import android.annotation.Nullable; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public class DataConnectionRealTimeInfo implements Parcelable { |
| 30 |
private long mTime; |
| 31 |
|
| 32 |
public static final int DC_POWER_STATE_LOW |
| 33 |
= TelephonyProtoEnums.DATA_CONNECTION_POWER_STATE_LOW ; |
| 34 |
public static final int DC_POWER_STATE_MEDIUM |
| 35 |
= TelephonyProtoEnums.DATA_CONNECTION_POWER_STATE_MEDIUM; |
| 36 |
public static final int DC_POWER_STATE_HIGH |
| 37 |
= TelephonyProtoEnums.DATA_CONNECTION_POWER_STATE_HIGH; |
| 38 |
public static final int DC_POWER_STATE_UNKNOWN |
| 39 |
= TelephonyProtoEnums.DATA_CONNECTION_POWER_STATE_UNKNOWN; |
| 40 |
|
| 41 |
private int mDcPowerState; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public DataConnectionRealTimeInfo(long time, int dcPowerState) { |
| 49 |
mTime = time; |
| 50 |
mDcPowerState = dcPowerState; |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public DataConnectionRealTimeInfo() { |
| 59 |
mTime = Long.MAX_VALUE; |
| 60 |
mDcPowerState = DC_POWER_STATE_UNKNOWN; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
private DataConnectionRealTimeInfo(Parcel in) { |
| 67 |
mTime = in.readLong(); |
| 68 |
mDcPowerState = in.readInt(); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
public long getTime() { |
| 75 |
return mTime; |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public int getDcPowerState() { |
| 82 |
return mDcPowerState; |
| 83 |
} |
| 84 |
|
| 85 |
@Override |
| 86 |
public int describeContents() { |
| 87 |
return 0; |
| 88 |
} |
| 89 |
|
| 90 |
@Override |
| 91 |
public void writeToParcel(Parcel out, int flags) { |
| 92 |
out.writeLong(mTime); |
| 93 |
out.writeInt(mDcPowerState); |
| 94 |
} |
| 95 |
|
| 96 |
public static final @android.annotation.NonNull Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR |
| 97 |
= new Parcelable.Creator<DataConnectionRealTimeInfo>() { |
| 98 |
|
| 99 |
@Override |
| 100 |
public DataConnectionRealTimeInfo createFromParcel(Parcel in) { |
| 101 |
return new DataConnectionRealTimeInfo(in); |
| 102 |
} |
| 103 |
|
| 104 |
@Override |
| 105 |
public DataConnectionRealTimeInfo[] newArray(int size) { |
| 106 |
return new DataConnectionRealTimeInfo[size]; |
| 107 |
} |
| 108 |
}; |
| 109 |
|
| 110 |
@Override |
| 111 |
public int hashCode() { |
| 112 |
final long prime = 17; |
| 113 |
long result = 1; |
| 114 |
result = (prime * result) + mTime; |
| 115 |
result += (prime * result) + mDcPowerState; |
| 116 |
return (int)result; |
| 117 |
} |
| 118 |
|
| 119 |
@Override |
| 120 |
public boolean equals(@Nullable Object obj) { |
| 121 |
if (this == obj) { |
| 122 |
return true; |
| 123 |
} |
| 124 |
if (obj == null) { |
| 125 |
return false; |
| 126 |
} |
| 127 |
if (getClass() != obj.getClass()) { |
| 128 |
return false; |
| 129 |
} |
| 130 |
DataConnectionRealTimeInfo other = (DataConnectionRealTimeInfo) obj; |
| 131 |
return (mTime == other.mTime) |
| 132 |
&& (mDcPowerState == other.mDcPowerState); |
| 133 |
} |
| 134 |
|
| 135 |
@Override |
| 136 |
public String toString() { |
| 137 |
StringBuffer sb = new StringBuffer(); |
| 138 |
|
| 139 |
sb.append("mTime=").append(mTime); |
| 140 |
sb.append(" mDcPowerState=").append(mDcPowerState); |
| 141 |
|
| 142 |
return sb.toString(); |
| 143 |
} |
| 144 |
} |