diff options
author | 2022-10-15 21:33:29 -0700 | |
---|---|---|
committer | 2022-11-14 17:57:30 -0800 | |
commit | 7da659bb6cfb38697828c27ab1b47aa0f51c7a2d (patch) | |
tree | 8301f4711c53e4b2e84526c7a2d9bf915e258878 /telephony | |
parent | 81c4fd80412d1e76d6f942fa9a12efbe6c52c404 (diff) |
Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:
BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower
See https://errorprone.info/bugpatterns for more
information on the checks.
Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
Diffstat (limited to 'telephony')
5 files changed, 47 insertions, 58 deletions
diff --git a/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java index 8b01cb3c4405..2787d83a99a3 100644 --- a/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java +++ b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java @@ -199,7 +199,6 @@ public class EncodedStringValue implements Cloneable { */ @Override public Object clone() throws CloneNotSupportedException { - super.clone(); int len = mData.length; byte[] dstBytes = new byte[len]; System.arraycopy(mData, 0, dstBytes, 0, len); diff --git a/telephony/java/android/telephony/DataFailCause.java b/telephony/java/android/telephony/DataFailCause.java index 5f7cfd109ec9..5186c7268cb6 100644 --- a/telephony/java/android/telephony/DataFailCause.java +++ b/telephony/java/android/telephony/DataFailCause.java @@ -1613,29 +1613,26 @@ public final class DataFailCause { // If we are not able to find the configuration from carrier config, use the default // ones. if (permanentFailureSet == null) { - permanentFailureSet = new HashSet<Integer>() { - { - add(OPERATOR_BARRED); - add(MISSING_UNKNOWN_APN); - add(UNKNOWN_PDP_ADDRESS_TYPE); - add(USER_AUTHENTICATION); - add(ACTIVATION_REJECT_GGSN); - add(SERVICE_OPTION_NOT_SUPPORTED); - add(SERVICE_OPTION_NOT_SUBSCRIBED); - add(NSAPI_IN_USE); - add(ONLY_IPV4_ALLOWED); - add(ONLY_IPV6_ALLOWED); - add(PROTOCOL_ERRORS); - add(RADIO_POWER_OFF); - add(TETHERED_CALL_ACTIVE); - add(RADIO_NOT_AVAILABLE); - add(UNACCEPTABLE_NETWORK_PARAMETER); - add(SIGNAL_LOST); - add(DUPLICATE_CID); - add(MATCH_ALL_RULE_NOT_ALLOWED); - add(ALL_MATCHING_RULES_FAILED); - } - }; + permanentFailureSet = new HashSet<Integer>(); + permanentFailureSet.add(OPERATOR_BARRED); + permanentFailureSet.add(MISSING_UNKNOWN_APN); + permanentFailureSet.add(UNKNOWN_PDP_ADDRESS_TYPE); + permanentFailureSet.add(USER_AUTHENTICATION); + permanentFailureSet.add(ACTIVATION_REJECT_GGSN); + permanentFailureSet.add(SERVICE_OPTION_NOT_SUPPORTED); + permanentFailureSet.add(SERVICE_OPTION_NOT_SUBSCRIBED); + permanentFailureSet.add(NSAPI_IN_USE); + permanentFailureSet.add(ONLY_IPV4_ALLOWED); + permanentFailureSet.add(ONLY_IPV6_ALLOWED); + permanentFailureSet.add(PROTOCOL_ERRORS); + permanentFailureSet.add(RADIO_POWER_OFF); + permanentFailureSet.add(TETHERED_CALL_ACTIVE); + permanentFailureSet.add(RADIO_NOT_AVAILABLE); + permanentFailureSet.add(UNACCEPTABLE_NETWORK_PARAMETER); + permanentFailureSet.add(SIGNAL_LOST); + permanentFailureSet.add(DUPLICATE_CID); + permanentFailureSet.add(MATCH_ALL_RULE_NOT_ALLOWED); + permanentFailureSet.add(ALL_MATCHING_RULES_FAILED); } permanentFailureSet.add(NO_RETRY_FAILURE); diff --git a/telephony/java/android/telephony/ims/ImsService.java b/telephony/java/android/telephony/ims/ImsService.java index bccb6ef2b1e5..4477f81a378d 100644 --- a/telephony/java/android/telephony/ims/ImsService.java +++ b/telephony/java/android/telephony/ims/ImsService.java @@ -50,7 +50,6 @@ import com.android.internal.telephony.util.TelephonyUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.HashMap; import java.util.Map; import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; @@ -164,10 +163,9 @@ public class ImsService extends Service { * Used for logging purposes, see {@link #getCapabilitiesString(long)} * @hide */ - private static final Map<Long, String> CAPABILITIES_LOG_MAP = new HashMap<Long, String>() {{ - put(CAPABILITY_EMERGENCY_OVER_MMTEL, "EMERGENCY_OVER_MMTEL"); - put(CAPABILITY_SIP_DELEGATE_CREATION, "SIP_DELEGATE_CREATION"); - }}; + private static final Map<Long, String> CAPABILITIES_LOG_MAP = Map.of( + CAPABILITY_EMERGENCY_OVER_MMTEL, "EMERGENCY_OVER_MMTEL", + CAPABILITY_SIP_DELEGATE_CREATION, "SIP_DELEGATE_CREATION"); /** * The intent that must be defined as an intent-filter in the AndroidManifest of the ImsService. diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java index 090d4136872e..9996b868afc7 100644 --- a/telephony/java/android/telephony/ims/RegistrationManager.java +++ b/telephony/java/android/telephony/ims/RegistrationManager.java @@ -78,24 +78,22 @@ public interface RegistrationManager { /**@hide*/ // Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN // and WWAN are more accurate constants. - Map<Integer, Integer> IMS_REG_TO_ACCESS_TYPE_MAP = - new HashMap<Integer, Integer>() {{ - // Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE - // case, since it is defined. - put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, - AccessNetworkConstants.TRANSPORT_TYPE_INVALID); - put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE, - AccessNetworkConstants.TRANSPORT_TYPE_WWAN); - put(ImsRegistrationImplBase.REGISTRATION_TECH_NR, - AccessNetworkConstants.TRANSPORT_TYPE_WWAN); - put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN, - AccessNetworkConstants.TRANSPORT_TYPE_WLAN); - /* As the cross sim will be using ePDG tunnel over internet, it behaves - like IWLAN in most cases. Hence setting the access type as IWLAN - */ - put(ImsRegistrationImplBase.REGISTRATION_TECH_CROSS_SIM, - AccessNetworkConstants.TRANSPORT_TYPE_WLAN); - }}; + Map<Integer, Integer> IMS_REG_TO_ACCESS_TYPE_MAP = Map.of( + // Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE + // case, since it is defined. + ImsRegistrationImplBase.REGISTRATION_TECH_NONE, + AccessNetworkConstants.TRANSPORT_TYPE_INVALID, + ImsRegistrationImplBase.REGISTRATION_TECH_LTE, + AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + ImsRegistrationImplBase.REGISTRATION_TECH_NR, + AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN, + AccessNetworkConstants.TRANSPORT_TYPE_WLAN, + /* As the cross sim will be using ePDG tunnel over internet, it behaves + like IWLAN in most cases. Hence setting the access type as IWLAN + */ + ImsRegistrationImplBase.REGISTRATION_TECH_CROSS_SIM, + AccessNetworkConstants.TRANSPORT_TYPE_WLAN); /** @hide */ @NonNull diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java index a42327b8a1a9..174675fcde4c 100644 --- a/telephony/java/android/telephony/ims/feature/ImsFeature.java +++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java @@ -34,7 +34,6 @@ import com.android.internal.telephony.util.RemoteCallbackListExt; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.HashMap; import java.util.Map; /** @@ -85,11 +84,10 @@ public abstract class ImsFeature { * Used for logging purposes. * @hide */ - public static final Map<Integer, String> FEATURE_LOG_MAP = new HashMap<Integer, String>() {{ - put(FEATURE_EMERGENCY_MMTEL, "EMERGENCY_MMTEL"); - put(FEATURE_MMTEL, "MMTEL"); - put(FEATURE_RCS, "RCS"); - }}; + public static final Map<Integer, String> FEATURE_LOG_MAP = Map.of( + FEATURE_EMERGENCY_MMTEL, "EMERGENCY_MMTEL", + FEATURE_MMTEL, "MMTEL", + FEATURE_RCS, "RCS"); /** * Integer values defining IMS features that are supported in ImsFeature. @@ -145,11 +143,10 @@ public abstract class ImsFeature { * Used for logging purposes. * @hide */ - public static final Map<Integer, String> STATE_LOG_MAP = new HashMap<Integer, String>() {{ - put(STATE_UNAVAILABLE, "UNAVAILABLE"); - put(STATE_INITIALIZING, "INITIALIZING"); - put(STATE_READY, "READY"); - }}; + public static final Map<Integer, String> STATE_LOG_MAP = Map.of( + STATE_UNAVAILABLE, "UNAVAILABLE", + STATE_INITIALIZING, "INITIALIZING", + STATE_READY, "READY"); /** * Integer values defining the result codes that should be returned from |