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