Add @Nullable to Object#equals()
This is a partial cherry-pick of change: I5eedb571c9d78862115dfdc5dae1cf2a35343580 for connectivity classes. Bug: 170883422 Test: m Merged-In: I5eedb571c9d78862115dfdc5dae1cf2a35343580 Change-Id: I7dc661863b73f4198ddb4f3a1566583d0f07db3c
This commit is contained in:
committed by
Remi NGUYEN VAN
parent
b17ea56d30
commit
61a6c947ff
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.net.NetworkTemplate;
|
import android.net.NetworkTemplate;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@@ -95,7 +96,7 @@ public final class DataUsageRequest implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (obj instanceof DataUsageRequest == false) return false;
|
if (obj instanceof DataUsageRequest == false) return false;
|
||||||
DataUsageRequest that = (DataUsageRequest) obj;
|
DataUsageRequest that = (DataUsageRequest) obj;
|
||||||
return that.requestId == this.requestId
|
return that.requestId == this.requestId
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static android.net.IpSecManager.INVALID_RESOURCE_ID;
|
|||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.annotation.RequiresFeature;
|
import android.annotation.RequiresFeature;
|
||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
@@ -150,7 +151,7 @@ public final class IpSecTransform implements AutoCloseable {
|
|||||||
/**
|
/**
|
||||||
* Standard equals.
|
* Standard equals.
|
||||||
*/
|
*/
|
||||||
public boolean equals(Object other) {
|
public boolean equals(@Nullable Object other) {
|
||||||
if (this == other) return true;
|
if (this == other) return true;
|
||||||
if (!(other instanceof IpSecTransform)) return false;
|
if (!(other instanceof IpSecTransform)) return false;
|
||||||
final IpSecTransform rhs = (IpSecTransform) other;
|
final IpSecTransform rhs = (IpSecTransform) other;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.net;
|
|||||||
|
|
||||||
import static android.net.ConnectivityManager.TYPE_WIFI;
|
import static android.net.ConnectivityManager.TYPE_WIFI;
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
@@ -67,7 +68,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (obj instanceof NetworkIdentity) {
|
if (obj instanceof NetworkIdentity) {
|
||||||
final NetworkIdentity ident = (NetworkIdentity) obj;
|
final NetworkIdentity ident = (NetworkIdentity) obj;
|
||||||
return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
|
return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ public final class NetworkStats implements Parcelable {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(@Nullable Object o) {
|
||||||
if (o instanceof Entry) {
|
if (o instanceof Entry) {
|
||||||
final Entry e = (Entry) o;
|
final Entry e = (Entry) o;
|
||||||
return uid == e.uid && set == e.set && tag == e.tag && metered == e.metered
|
return uid == e.uid && set == e.set && tag == e.tag && metered == e.metered
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (obj instanceof NetworkTemplate) {
|
if (obj instanceof NetworkTemplate) {
|
||||||
final NetworkTemplate other = (NetworkTemplate) obj;
|
final NetworkTemplate other = (NetworkTemplate) obj;
|
||||||
return mMatchRule == other.mMatchRule
|
return mMatchRule == other.mMatchRule
|
||||||
|
|||||||
Reference in New Issue
Block a user