diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 4 | ||||
-rw-r--r-- | core/java/android/net/NetworkIdentity.java | 8 | ||||
-rw-r--r-- | core/java/android/net/NetworkPolicy.java | 8 | ||||
-rw-r--r-- | core/java/android/net/NetworkStats.java | 6 | ||||
-rw-r--r-- | core/java/android/net/NetworkTemplate.java | 13 | ||||
-rw-r--r-- | core/java/android/view/DisplayAdjustments.java | 6 | ||||
-rw-r--r-- | core/java/com/android/internal/util/Objects.java | 62 |
7 files changed, 23 insertions, 84 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 65c40c1..d849965 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -93,7 +93,6 @@ import com.android.internal.os.BinderInternal; import com.android.internal.os.RuntimeInit; import com.android.internal.os.SamplingProfilerIntegration; import com.android.internal.util.FastPrintWriter; -import com.android.internal.util.Objects; import com.android.org.conscrypt.OpenSSLSocketImpl; import com.google.android.collect.Lists; @@ -109,6 +108,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.TimeZone; import java.util.regex.Pattern; @@ -222,7 +222,7 @@ public final class ActivityThread { public boolean equals(Object o) { if (o instanceof ProviderKey) { final ProviderKey other = (ProviderKey) o; - return Objects.equal(authority, other.authority) && userId == other.userId; + return Objects.equals(authority, other.authority) && userId == other.userId; } return false; } diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java index 3c67bf9..36dd2fdfb 100644 --- a/core/java/android/net/NetworkIdentity.java +++ b/core/java/android/net/NetworkIdentity.java @@ -26,7 +26,7 @@ import android.net.wifi.WifiManager; import android.os.Build; import android.telephony.TelephonyManager; -import com.android.internal.util.Objects; +import java.util.Objects; /** * Network definition that includes strong identity. Analogous to combining @@ -60,7 +60,7 @@ public class NetworkIdentity { @Override public int hashCode() { - return Objects.hashCode(mType, mSubType, mSubscriberId, mNetworkId, mRoaming); + return Objects.hash(mType, mSubType, mSubscriberId, mNetworkId, mRoaming); } @Override @@ -68,8 +68,8 @@ public class NetworkIdentity { if (obj instanceof NetworkIdentity) { final NetworkIdentity ident = (NetworkIdentity) obj; return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming - && Objects.equal(mSubscriberId, ident.mSubscriberId) - && Objects.equal(mNetworkId, ident.mNetworkId); + && Objects.equals(mSubscriberId, ident.mSubscriberId) + && Objects.equals(mNetworkId, ident.mNetworkId); } return false; } diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java index 441db7a..10c686b 100644 --- a/core/java/android/net/NetworkPolicy.java +++ b/core/java/android/net/NetworkPolicy.java @@ -21,7 +21,7 @@ import static com.android.internal.util.Preconditions.checkNotNull; import android.os.Parcel; import android.os.Parcelable; -import com.android.internal.util.Objects; +import java.util.Objects; /** * Policy for networks matching a {@link NetworkTemplate}, including usage cycle @@ -146,7 +146,7 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> { @Override public int hashCode() { - return Objects.hashCode(template, cycleDay, cycleTimezone, warningBytes, limitBytes, + return Objects.hash(template, cycleDay, cycleTimezone, warningBytes, limitBytes, lastWarningSnooze, lastLimitSnooze, metered, inferred); } @@ -159,8 +159,8 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> { && lastWarningSnooze == other.lastWarningSnooze && lastLimitSnooze == other.lastLimitSnooze && metered == other.metered && inferred == other.inferred - && Objects.equal(cycleTimezone, other.cycleTimezone) - && Objects.equal(template, other.template); + && Objects.equals(cycleTimezone, other.cycleTimezone) + && Objects.equals(template, other.template); } return false; } diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java index 9cb904d..a7aae2a 100644 --- a/core/java/android/net/NetworkStats.java +++ b/core/java/android/net/NetworkStats.java @@ -23,12 +23,12 @@ import android.util.SparseBooleanArray; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; -import com.android.internal.util.Objects; import java.io.CharArrayWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; +import java.util.Objects; /** * Collection of active network statistics. Can contain summary details across @@ -337,7 +337,7 @@ public class NetworkStats implements Parcelable { public int findIndex(String iface, int uid, int set, int tag) { for (int i = 0; i < size; i++) { if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i] - && Objects.equal(iface, this.iface[i])) { + && Objects.equals(iface, this.iface[i])) { return i; } } @@ -362,7 +362,7 @@ public class NetworkStats implements Parcelable { } if (uid == this.uid[i] && set == this.set[i] && tag == this.tag[i] - && Objects.equal(iface, this.iface[i])) { + && Objects.equals(iface, this.iface[i])) { return i; } } diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java index c189ba4..27197cc 100644 --- a/core/java/android/net/NetworkTemplate.java +++ b/core/java/android/net/NetworkTemplate.java @@ -34,8 +34,9 @@ import android.content.res.Resources; import android.os.Parcel; import android.os.Parcelable; +import java.util.Objects; + import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.util.Objects; /** * Template definition used to generically match {@link NetworkIdentity}, @@ -176,7 +177,7 @@ public class NetworkTemplate implements Parcelable { @Override public int hashCode() { - return Objects.hashCode(mMatchRule, mSubscriberId, mNetworkId); + return Objects.hash(mMatchRule, mSubscriberId, mNetworkId); } @Override @@ -184,8 +185,8 @@ public class NetworkTemplate implements Parcelable { if (obj instanceof NetworkTemplate) { final NetworkTemplate other = (NetworkTemplate) obj; return mMatchRule == other.mMatchRule - && Objects.equal(mSubscriberId, other.mSubscriberId) - && Objects.equal(mNetworkId, other.mNetworkId); + && Objects.equals(mSubscriberId, other.mSubscriberId) + && Objects.equals(mNetworkId, other.mNetworkId); } return false; } @@ -235,7 +236,7 @@ public class NetworkTemplate implements Parcelable { return true; } else { return ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType)) - && Objects.equal(mSubscriberId, ident.mSubscriberId)); + && Objects.equals(mSubscriberId, ident.mSubscriberId)); } } @@ -280,7 +281,7 @@ public class NetworkTemplate implements Parcelable { private boolean matchesWifi(NetworkIdentity ident) { switch (ident.mType) { case TYPE_WIFI: - return Objects.equal( + return Objects.equals( removeDoubleQuotes(mNetworkId), removeDoubleQuotes(ident.mNetworkId)); default: return false; diff --git a/core/java/android/view/DisplayAdjustments.java b/core/java/android/view/DisplayAdjustments.java index 041d9e0..35fb504 100644 --- a/core/java/android/view/DisplayAdjustments.java +++ b/core/java/android/view/DisplayAdjustments.java @@ -19,7 +19,7 @@ package android.view; import android.content.res.CompatibilityInfo; import android.os.IBinder; -import com.android.internal.util.Objects; +import java.util.Objects; /** @hide */ public class DisplayAdjustments { @@ -91,7 +91,7 @@ public class DisplayAdjustments { return false; } DisplayAdjustments daj = (DisplayAdjustments)o; - return Objects.equal(daj.mCompatInfo, mCompatInfo) && - Objects.equal(daj.mActivityToken, mActivityToken); + return Objects.equals(daj.mCompatInfo, mCompatInfo) && + Objects.equals(daj.mActivityToken, mActivityToken); } } diff --git a/core/java/com/android/internal/util/Objects.java b/core/java/com/android/internal/util/Objects.java deleted file mode 100644 index 2664182..0000000 --- a/core/java/com/android/internal/util/Objects.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.util; - -import java.util.Arrays; - -/** - * Object utility methods. - */ -public class Objects { - - /** - * Determines whether two possibly-null objects are equal. Returns: - * - * <ul> - * <li>{@code true} if {@code a} and {@code b} are both null. - * <li>{@code true} if {@code a} and {@code b} are both non-null and they are - * equal according to {@link Object#equals(Object)}. - * <li>{@code false} in all other situations. - * </ul> - * - * <p>This assumes that any non-null objects passed to this function conform - * to the {@code equals()} contract. - */ - public static boolean equal(Object a, Object b) { - return a == b || (a != null && a.equals(b)); - } - - /** - * Generates a hash code for multiple values. The hash code is generated by - * calling {@link Arrays#hashCode(Object[])}. - * - * <p>This is useful for implementing {@link Object#hashCode()}. For example, - * in an object that has three properties, {@code x}, {@code y}, and - * {@code z}, one could write: - * <pre> - * public int hashCode() { - * return Objects.hashCode(getX(), getY(), getZ()); - * }</pre> - * - * <b>Warning</b>: When a single object is supplied, the returned hash code - * does not equal the hash code of that object. - */ - public static int hashCode(Object... objects) { - return Arrays.hashCode(objects); - } - -} |