Merge "PhysicalChannelConfig.Builder change IAE to error logs" am: 64eae25b91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2032085 Change-Id: I2a7f4f86e4b696fc038b97aacd08d8da62f6065c
This commit is contained in:
@@ -23,12 +23,15 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.telephony.Annotation.NetworkType;
|
import android.telephony.Annotation.NetworkType;
|
||||||
|
|
||||||
|
import com.android.telephony.Rlog;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class PhysicalChannelConfig implements Parcelable {
|
public final class PhysicalChannelConfig implements Parcelable {
|
||||||
|
static final String TAG = "PhysicalChannelConfig";
|
||||||
|
|
||||||
// TODO(b/72993578) consolidate these enums in a central location.
|
// TODO(b/72993578) consolidate these enums in a central location.
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -568,19 +571,21 @@ public final class PhysicalChannelConfig implements Parcelable {
|
|||||||
|
|
||||||
public @NonNull Builder setNetworkType(@NetworkType int networkType) {
|
public @NonNull Builder setNetworkType(@NetworkType int networkType) {
|
||||||
if (!TelephonyManager.isNetworkTypeValid(networkType)) {
|
if (!TelephonyManager.isNetworkTypeValid(networkType)) {
|
||||||
throw new IllegalArgumentException("Network type: " + networkType + " is invalid.");
|
Rlog.e(TAG, "Builder.setNetworkType: Network type " + networkType + " is invalid.");
|
||||||
|
} else {
|
||||||
|
mNetworkType = networkType;
|
||||||
}
|
}
|
||||||
mNetworkType = networkType;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Builder setFrequencyRange(int frequencyRange) {
|
public @NonNull Builder setFrequencyRange(int frequencyRange) {
|
||||||
if (!ServiceState.isFrequencyRangeValid(frequencyRange)
|
if (!ServiceState.isFrequencyRangeValid(frequencyRange)
|
||||||
&& frequencyRange != ServiceState.FREQUENCY_RANGE_UNKNOWN) {
|
&& frequencyRange != ServiceState.FREQUENCY_RANGE_UNKNOWN) {
|
||||||
throw new IllegalArgumentException("Frequency range: " + frequencyRange +
|
Rlog.e(TAG, "Builder.setFrequencyRange: Frequency range " + frequencyRange
|
||||||
" is invalid.");
|
+ " is invalid.");
|
||||||
|
} else {
|
||||||
|
mFrequencyRange = frequencyRange;
|
||||||
}
|
}
|
||||||
mFrequencyRange = frequencyRange;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,19 +601,21 @@ public final class PhysicalChannelConfig implements Parcelable {
|
|||||||
|
|
||||||
public @NonNull Builder setCellBandwidthDownlinkKhz(int cellBandwidthDownlinkKhz) {
|
public @NonNull Builder setCellBandwidthDownlinkKhz(int cellBandwidthDownlinkKhz) {
|
||||||
if (cellBandwidthDownlinkKhz < CELL_BANDWIDTH_UNKNOWN) {
|
if (cellBandwidthDownlinkKhz < CELL_BANDWIDTH_UNKNOWN) {
|
||||||
throw new IllegalArgumentException("Cell downlink bandwidth(kHz): " +
|
Rlog.e(TAG, "Builder.setCellBandwidthDownlinkKhz: Cell downlink bandwidth(kHz) "
|
||||||
cellBandwidthDownlinkKhz + " is invalid.");
|
+ cellBandwidthDownlinkKhz + " is invalid.");
|
||||||
|
} else {
|
||||||
|
mCellBandwidthDownlinkKhz = cellBandwidthDownlinkKhz;
|
||||||
}
|
}
|
||||||
mCellBandwidthDownlinkKhz = cellBandwidthDownlinkKhz;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Builder setCellBandwidthUplinkKhz(int cellBandwidthUplinkKhz) {
|
public @NonNull Builder setCellBandwidthUplinkKhz(int cellBandwidthUplinkKhz) {
|
||||||
if (cellBandwidthUplinkKhz < CELL_BANDWIDTH_UNKNOWN) {
|
if (cellBandwidthUplinkKhz < CELL_BANDWIDTH_UNKNOWN) {
|
||||||
throw new IllegalArgumentException("Cell uplink bandwidth(kHz): "+
|
Rlog.e(TAG, "Builder.setCellBandwidthUplinkKhz: Cell uplink bandwidth(kHz) "
|
||||||
cellBandwidthUplinkKhz +" is invalid.");
|
+ cellBandwidthUplinkKhz + " is invalid.");
|
||||||
|
} else {
|
||||||
|
mCellBandwidthUplinkKhz = cellBandwidthUplinkKhz;
|
||||||
}
|
}
|
||||||
mCellBandwidthUplinkKhz = cellBandwidthUplinkKhz;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,19 +632,20 @@ public final class PhysicalChannelConfig implements Parcelable {
|
|||||||
|
|
||||||
public @NonNull Builder setPhysicalCellId(int physicalCellId) {
|
public @NonNull Builder setPhysicalCellId(int physicalCellId) {
|
||||||
if (physicalCellId > PHYSICAL_CELL_ID_MAXIMUM_VALUE) {
|
if (physicalCellId > PHYSICAL_CELL_ID_MAXIMUM_VALUE) {
|
||||||
throw new IllegalArgumentException("Physical cell Id: " + physicalCellId +
|
Rlog.e(TAG, "Builder.setPhysicalCellId: Physical cell ID " + physicalCellId
|
||||||
" is over limit.");
|
+ " is over limit.");
|
||||||
|
} else {
|
||||||
|
mPhysicalCellId = physicalCellId;
|
||||||
}
|
}
|
||||||
mPhysicalCellId = physicalCellId;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Builder setBand(int band) {
|
public @NonNull Builder setBand(int band) {
|
||||||
if (band <= BAND_UNKNOWN) {
|
if (band <= BAND_UNKNOWN) {
|
||||||
throw new IllegalArgumentException("Band: " + band +
|
Rlog.e(TAG, "Builder.setBand: Band " + band + " is invalid.");
|
||||||
" is invalid.");
|
} else {
|
||||||
|
mBand = band;
|
||||||
}
|
}
|
||||||
mBand = band;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user