More lint fixes

This commit is contained in:
l3d00m
2015-08-23 21:12:30 +02:00
parent e9743b616a
commit 48b936d7b7
30 changed files with 173 additions and 167 deletions
@@ -53,7 +53,7 @@ public class DhcpInfoInternal {
private Collection<RouteInfo> mRoutes;
public DhcpInfoInternal() {
mRoutes = new ArrayList<RouteInfo>();
mRoutes = new ArrayList<>();
}
public void addRoute(RouteInfo routeInfo) {
@@ -1387,7 +1387,7 @@ public interface IConnectivityManager extends android.os.IInterface {
}
}
static final int TRANSACTION_setNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_setNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION);
static final int TRANSACTION_getNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_getActiveNetworkInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
static final int TRANSACTION_getActiveNetworkInfoForUid = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
@@ -125,7 +125,7 @@ public interface INetworkPolicyListener extends android.os.IInterface {
}
}
static final int TRANSACTION_onUidRulesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_onUidRulesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION);
static final int TRANSACTION_onMeteredIfacesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_onRestrictBackgroundChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
}
@@ -439,7 +439,7 @@ public interface INetworkPolicyManager extends android.os.IInterface {
}
}
static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION);
static final int TRANSACTION_getUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_getUidsWithPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
static final int TRANSACTION_isUidForeground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
@@ -199,7 +199,7 @@ public class LinkCapabilities implements Parcelable {
* Constructor
*/
public LinkCapabilities() {
mCapabilities = new HashMap<Integer, String>();
mCapabilities = new HashMap<>();
}
/**
@@ -209,9 +209,9 @@ public class LinkCapabilities implements Parcelable {
*/
public LinkCapabilities(LinkCapabilities source) {
if (source != null) {
mCapabilities = new HashMap<Integer, String>(source.mCapabilities);
mCapabilities = new HashMap<>(source.mCapabilities);
} else {
mCapabilities = new HashMap<Integer, String>();
mCapabilities = new HashMap<>();
}
}
@@ -356,7 +356,7 @@ public class LinkCapabilities implements Parcelable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mCapabilities.size());
for (Entry<Integer, String> entry : mCapabilities.entrySet()) {
dest.writeInt(entry.getKey().intValue());
dest.writeInt(entry.getKey());
dest.writeString(entry.getValue());
}
}
@@ -52,14 +52,14 @@ import java.util.Collections;
public class LinkProperties implements Parcelable {
String mIfaceName;
private Collection<LinkAddress> mLinkAddresses = new ArrayList<LinkAddress>();
private Collection<InetAddress> mDnses = new ArrayList<InetAddress>();
private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
private Collection<LinkAddress> mLinkAddresses = new ArrayList<>();
private Collection<InetAddress> mDnses = new ArrayList<>();
private Collection<RouteInfo> mRoutes = new ArrayList<>();
private ProxyProperties mHttpProxy;
public static class CompareResult<T> {
public Collection<T> removed = new ArrayList<T>();
public Collection<T> added = new ArrayList<T>();
public Collection<T> removed = new ArrayList<>();
public Collection<T> added = new ArrayList<>();
@Override
public String toString() {
@@ -97,7 +97,7 @@ public class LinkProperties implements Parcelable {
}
public Collection<InetAddress> getAddresses() {
Collection<InetAddress> addresses = new ArrayList<InetAddress>();
Collection<InetAddress> addresses = new ArrayList<>();
for (LinkAddress linkAddress : mLinkAddresses) {
addresses.add(linkAddress.getAddress());
}
@@ -192,8 +192,7 @@ public class LinkProperties implements Parcelable {
public boolean isIdenticalAddresses(LinkProperties target) {
Collection<InetAddress> targetAddresses = target.getAddresses();
Collection<InetAddress> sourceAddresses = getAddresses();
return (sourceAddresses.size() == targetAddresses.size()) ?
sourceAddresses.containsAll(targetAddresses) : false;
return (sourceAddresses.size() == targetAddresses.size()) && sourceAddresses.containsAll(targetAddresses);
}
/**
@@ -275,8 +274,8 @@ public class LinkProperties implements Parcelable {
* are in target but not in mLinkAddresses are placed in the
* addedAddresses.
*/
CompareResult<LinkAddress> result = new CompareResult<LinkAddress>();
result.removed = new ArrayList<LinkAddress>(mLinkAddresses);
CompareResult<LinkAddress> result = new CompareResult<>();
result.removed = new ArrayList<>(mLinkAddresses);
result.added.clear();
if (target != null) {
for (LinkAddress newAddress : target.getLinkAddresses()) {
@@ -305,9 +304,9 @@ public class LinkProperties implements Parcelable {
* are in target but not in mDnses are placed in the
* addedAddresses.
*/
CompareResult<InetAddress> result = new CompareResult<InetAddress>();
CompareResult<InetAddress> result = new CompareResult<>();
result.removed = new ArrayList<InetAddress>(mDnses);
result.removed = new ArrayList<>(mDnses);
result.added.clear();
if (target != null) {
for (InetAddress newAddress : target.getDnses()) {
@@ -335,9 +334,9 @@ public class LinkProperties implements Parcelable {
* leaving the routes that are different. And route address which
* are in target but not in mRoutes are placed in added.
*/
CompareResult<RouteInfo> result = new CompareResult<RouteInfo>();
CompareResult<RouteInfo> result = new CompareResult<>();
result.removed = new ArrayList<RouteInfo>(mRoutes);
result.removed = new ArrayList<>(mRoutes);
result.added.clear();
if (target != null) {
for (RouteInfo r : target.getRoutes()) {
@@ -168,17 +168,7 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> {
@Override
public String toString() {
final StringBuilder builder = new StringBuilder("NetworkPolicy");
builder.append("[").append(template).append("]:");
builder.append(" cycleDay=").append(cycleDay);
builder.append(", cycleTimezone=").append(cycleTimezone);
builder.append(", warningBytes=").append(warningBytes);
builder.append(", limitBytes=").append(limitBytes);
builder.append(", lastWarningSnooze=").append(lastWarningSnooze);
builder.append(", lastLimitSnooze=").append(lastLimitSnooze);
builder.append(", metered=").append(metered);
builder.append(", inferred=").append(inferred);
return builder.toString();
return "NetworkPolicy" + "[" + template + "]:" + " cycleDay=" + cycleDay + ", cycleTimezone=" + cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes + ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze=" + lastLimitSnooze + ", metered=" + metered + ", inferred=" + inferred;
}
public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
@@ -153,8 +153,7 @@ public class ProxyProperties implements Parcelable {
return false;
}
if (mHost != null && p.mHost == null) return false;
if (mHost == null && p.mHost != null) return false;
return mPort == p.mPort;
return !(mHost == null && p.mHost != null) && mPort == p.mPort;
}
/**