Further lint cleanup

This commit is contained in:
l3d00m
2015-08-20 19:29:46 +02:00
parent 419ba50ab2
commit 8f881e23b2
15 changed files with 24 additions and 81 deletions
@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface SdkConstant { public @interface SdkConstant {
public static enum SdkConstantType { public static enum SdkConstantType {
ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE; ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE
} }
SdkConstantType value(); SdkConstantType value();
@@ -566,11 +566,8 @@ public class ConnectivityManager {
public boolean requestRouteToHost(int networkType, int hostAddress) { public boolean requestRouteToHost(int networkType, int hostAddress) {
InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress);
if (inetAddress == null) { return inetAddress != null && requestRouteToHostAddress(networkType, inetAddress);
return false;
}
return requestRouteToHostAddress(networkType, inetAddress);
} }
/** /**
@@ -112,12 +112,12 @@ public class DhcpInfoInternal {
p.addRoute(route); p.addRoute(route);
} }
//if empty, connectivity configures default DNS //if empty, connectivity configures default DNS
if (TextUtils.isEmpty(dns1) == false) { if (!TextUtils.isEmpty(dns1)) {
p.addDns(NetworkUtils.numericToInetAddress(dns1)); p.addDns(NetworkUtils.numericToInetAddress(dns1));
} else { } else {
if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns1!"); if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns1!");
} }
if (TextUtils.isEmpty(dns2) == false) { if (!TextUtils.isEmpty(dns2)) {
p.addDns(NetworkUtils.numericToInetAddress(dns2)); p.addDns(NetworkUtils.numericToInetAddress(dns2));
} else { } else {
if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns2!"); if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns2!");
@@ -152,11 +152,7 @@ public class DhcpInfoInternal {
* metered, and sensitive to heavy data transfers. * metered, and sensitive to heavy data transfers.
*/ */
public boolean hasMeteredHint() { public boolean hasMeteredHint() {
if (vendorInfo != null) { return vendorInfo != null && vendorInfo.contains("ANDROID_METERED");
return vendorInfo.contains("ANDROID_METERED");
} else {
return false;
}
} }
public String toString() { public String toString() {
@@ -331,13 +331,8 @@ public class NetworkTemplate implements Parcelable {
* Check if mobile network with matching IMSI. * Check if mobile network with matching IMSI.
*/ */
private boolean matchesMobile(NetworkIdentity ident) { private boolean matchesMobile(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) { // TODO: consider matching against WiMAX subscriber identity
// TODO: consider matching against WiMAX subscriber identity return ident.mType == TYPE_WIMAX || ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType)) && Objects.equal(mSubscriberId, ident.mSubscriberId));
return true;
} else {
return ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType))
&& Objects.equal(mSubscriberId, ident.mSubscriberId));
}
} }
/** /**
@@ -391,18 +386,11 @@ public class NetworkTemplate implements Parcelable {
* Check if matches Ethernet network template. * Check if matches Ethernet network template.
*/ */
private boolean matchesEthernet(NetworkIdentity ident) { private boolean matchesEthernet(NetworkIdentity ident) {
if (ident.mType == TYPE_ETHERNET) { return ident.mType == TYPE_ETHERNET;
return true;
}
return false;
} }
private boolean matchesMobileWildcard(NetworkIdentity ident) { private boolean matchesMobileWildcard(NetworkIdentity ident) {
if (ident.mType == TYPE_WIMAX) { return ident.mType == TYPE_WIMAX || sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
return true;
} else {
return sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
}
} }
private boolean matchesWifiWildcard(NetworkIdentity ident) { private boolean matchesWifiWildcard(NetworkIdentity ident) {
@@ -149,13 +149,12 @@ public class ProxyProperties implements Parcelable {
if (!(o instanceof ProxyProperties)) return false; if (!(o instanceof ProxyProperties)) return false;
ProxyProperties p = (ProxyProperties) o; ProxyProperties p = (ProxyProperties) o;
if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false; if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false;
if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) { if (mHost != null && p.getHost() != null && !mHost.equals(p.getHost())) {
return false; return false;
} }
if (mHost != null && p.mHost == null) return false; if (mHost != null && p.mHost == null) return false;
if (mHost == null && p.mHost != null) return false; if (mHost == null && p.mHost != null) return false;
if (mPort != p.mPort) return false; return mPort == p.mPort;
return true;
} }
/** /**
@@ -168,7 +168,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != parser.START_TAG while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) { && type != parser.END_DOCUMENT) {
;
} }
if (type != parser.START_TAG) { if (type != parser.START_TAG) {
@@ -186,7 +185,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != parser.START_TAG while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) { && type != parser.END_DOCUMENT) {
;
} }
} }
@@ -154,7 +154,7 @@ public class MmsConfig {
} }
public static boolean getMmsEnabled() { public static boolean getMmsEnabled() {
return mMmsEnabled == 1 ? true : false; return mMmsEnabled == 1;
} }
public static int getMaxMessageSize() { public static int getMaxMessageSize() {
@@ -294,7 +294,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != XmlPullParser.START_TAG while ((type=parser.next()) != XmlPullParser.START_TAG
&& type != XmlPullParser.END_DOCUMENT) { && type != XmlPullParser.END_DOCUMENT) {
;
} }
if (type != XmlPullParser.START_TAG) { if (type != XmlPullParser.START_TAG) {
@@ -312,7 +311,6 @@ public class MmsConfig {
int type; int type;
while ((type=parser.next()) != XmlPullParser.START_TAG while ((type=parser.next()) != XmlPullParser.START_TAG
&& type != XmlPullParser.END_DOCUMENT) { && type != XmlPullParser.END_DOCUMENT) {
;
} }
} }
@@ -755,11 +755,8 @@ public class MessageUtils {
// "foo+caf_=6505551212=tmomail.net@gmail.com", which is the 'from' address from a forwarded email // "foo+caf_=6505551212=tmomail.net@gmail.com", which is the 'from' address from a forwarded email
// message from Gmail. We don't want to treat "foo+caf_=6505551212=tmomail.net@gmail.com" and // message from Gmail. We don't want to treat "foo+caf_=6505551212=tmomail.net@gmail.com" and
// "6505551212" to be the same. // "6505551212" to be the same.
if (number.indexOf('@') >= 0) { return number.indexOf('@') < 0 && PhoneNumberUtils.compare(number, getLocalNumber());
return false;
}
return PhoneNumberUtils.compare(number, getLocalNumber());
} }
public static void handleReadReport(final Context context, public static void handleReadReport(final Context context,
@@ -919,7 +916,7 @@ public class MessageUtils {
public static void viewMmsMessageAttachment(final Activity activity, final Uri msgUri, public static void viewMmsMessageAttachment(final Activity activity, final Uri msgUri,
final SlideshowModel slideshow, final int requestCode, AsyncDialog asyncDialog) { final SlideshowModel slideshow, final int requestCode, AsyncDialog asyncDialog) {
boolean isSimple = (slideshow == null) ? false : slideshow.isSimple(); boolean isSimple = (slideshow != null) && slideshow.isSimple();
if (isSimple) { if (isSimple) {
// In attachment-editor mode, we only ever have one slide. // In attachment-editor mode, we only ever have one slide.
MessageUtils.viewSimpleSlideshow(activity, slideshow); MessageUtils.viewSimpleSlideshow(activity, slideshow);
@@ -43,7 +43,7 @@ public class RecipientIdCache {
this.id = id; this.id = id;
this.number = number; this.number = number;
} }
}; }
static void init(Context context) { static void init(Context context) {
sInstance = new RecipientIdCache(context); sInstance = new RecipientIdCache(context);
@@ -1400,10 +1400,7 @@ public class ExifInterface {
public boolean isTagCountDefined(int tagId) { public boolean isTagCountDefined(int tagId) {
int info = getTagInfo().get(tagId); int info = getTagInfo().get(tagId);
// No value in info can be zero, as all tags have a non-zero type // No value in info can be zero, as all tags have a non-zero type
if (info == 0) { return info != 0 && getComponentCountFromInfo(info) != ExifTag.SIZE_UNDEFINED;
return false;
}
return getComponentCountFromInfo(info) != ExifTag.SIZE_UNDEFINED;
} }
/** /**
@@ -1550,10 +1547,7 @@ public class ExifInterface {
*/ */
public boolean setTagValue(int tagId, int ifdId, Object val) { public boolean setTagValue(int tagId, int ifdId, Object val) {
ExifTag t = getTag(tagId, ifdId); ExifTag t = getTag(tagId, ifdId);
if (t == null) { return t != null && t.setValue(val);
return false;
}
return t.setValue(val);
} }
/** /**
@@ -1829,10 +1823,7 @@ public class ExifInterface {
*/ */
public boolean setCompressedThumbnail(Bitmap thumb) { public boolean setCompressedThumbnail(Bitmap thumb) {
ByteArrayOutputStream thumbnail = new ByteArrayOutputStream(); ByteArrayOutputStream thumbnail = new ByteArrayOutputStream();
if (!thumb.compress(Bitmap.CompressFormat.JPEG, 90, thumbnail)) { return thumb.compress(Bitmap.CompressFormat.JPEG, 90, thumbnail) && setCompressedThumbnail(thumbnail.toByteArray());
return false;
}
return setCompressedThumbnail(thumbnail.toByteArray());
} }
/** /**
@@ -636,10 +636,7 @@ public class ExifParser {
private boolean checkAllowed(int ifd, int tagId) { private boolean checkAllowed(int ifd, int tagId) {
int info = mInterface.getTagInfo().get(tagId); int info = mInterface.getTagInfo().get(tagId);
if (info == ExifInterface.DEFINITION_NULL) { return info != ExifInterface.DEFINITION_NULL && ExifInterface.isIfdAllowed(info, ifd);
return false;
}
return ExifInterface.isIfdAllowed(info, ifd);
} }
protected void readFullTagValue(ExifTag tag) throws IOException { protected void readFullTagValue(ExifTag tag) throws IOException {
@@ -880,10 +880,7 @@ public class ExifTag {
} }
private boolean checkBadComponentCount(int count) { private boolean checkBadComponentCount(int count) {
if (mHasDefinedDefaultComponentCount && (mComponentCountActual != count)) { return mHasDefinedDefaultComponentCount && (mComponentCountActual != count);
return true;
}
return false;
} }
private static String convertTypeToString(short type) { private static String convertTypeToString(short type) {
@@ -974,20 +971,11 @@ public class ExifTag {
if (tag.mValue == null) { if (tag.mValue == null) {
return false; return false;
} else if (mValue instanceof long[]) { } else if (mValue instanceof long[]) {
if (!(tag.mValue instanceof long[])) { return tag.mValue instanceof long[] && Arrays.equals((long[]) mValue, (long[]) tag.mValue);
return false;
}
return Arrays.equals((long[]) mValue, (long[]) tag.mValue);
} else if (mValue instanceof Rational[]) { } else if (mValue instanceof Rational[]) {
if (!(tag.mValue instanceof Rational[])) { return tag.mValue instanceof Rational[] && Arrays.equals((Rational[]) mValue, (Rational[]) tag.mValue);
return false;
}
return Arrays.equals((Rational[]) mValue, (Rational[]) tag.mValue);
} else if (mValue instanceof byte[]) { } else if (mValue instanceof byte[]) {
if (!(tag.mValue instanceof byte[])) { return tag.mValue instanceof byte[] && Arrays.equals((byte[]) mValue, (byte[]) tag.mValue);
return false;
}
return Arrays.equals((byte[]) mValue, (byte[]) tag.mValue);
} else { } else {
return mValue.equals(tag.mValue); return mValue.equals(tag.mValue);
} }
@@ -401,9 +401,6 @@ public class Utils {
* @return true if app is default * @return true if app is default
*/ */
public static boolean isDefaultSmsApp(Context context) { public static boolean isDefaultSmsApp(Context context) {
if (hasKitKat()) { return !hasKitKat() || context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context));
return context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context));
}
return true;
} }
} }
@@ -26,7 +26,6 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
implements LiveView { implements LiveView {
private final Resources mRes;
private final SharedPreferences mPrefs; private final SharedPreferences mPrefs;
private final Drawable mMuted; private final Drawable mMuted;
@@ -35,7 +34,6 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
public ConversationListAdapter(Context context) { public ConversationListAdapter(Context context) {
mContext = context; mContext = context;
mRes = MainActivity.getRes(mContext);
mPrefs = MainActivity.getPrefs(mContext); mPrefs = MainActivity.getPrefs(mContext);
mMuted = ContextCompat.getDrawable(context, R.drawable.ic_mute); mMuted = ContextCompat.getDrawable(context, R.drawable.ic_mute);
@@ -10,7 +10,6 @@ import android.os.Build;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.moez.QKSMS.R;
import com.moez.QKSMS.interfaces.LiveView; import com.moez.QKSMS.interfaces.LiveView;
import com.moez.QKSMS.common.LiveViewManager; import com.moez.QKSMS.common.LiveViewManager;
import com.moez.QKSMS.ui.ThemeManager; import com.moez.QKSMS.ui.ThemeManager;