Remove unnecessary pre-19 code branches.

Now that our minSdk is 19, we can remove a lot of old code paths that
only ran pre-19.
This commit is contained in:
Greyson Parrelli
2019-03-20 15:09:27 -07:00
parent a52c295a38
commit 8caaf057e8
42 changed files with 125 additions and 387 deletions

View File

@@ -141,10 +141,6 @@ public class DateUtils extends android.text.format.DateUtils {
}
private static String getLocalizedPattern(String template, Locale locale) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return DateFormat.getBestDateTimePattern(locale, template);
} else {
return new SimpleDateFormat(template, locale).toLocalizedPattern();
}
return DateFormat.getBestDateTimePattern(locale, template);
}
}

View File

@@ -23,11 +23,7 @@ public class MemoryFileUtil {
int fd = field.getInt(fileDescriptor);
if (Build.VERSION.SDK_INT >= 13) {
return ParcelFileDescriptor.adoptFd(fd);
} else {
return ParcelFileDescriptor.dup(fileDescriptor);
}
return ParcelFileDescriptor.adoptFd(fd);
} catch (IllegalAccessException e) {
throw new IOException(e);
} catch (InvocationTargetException e) {

View File

@@ -530,11 +530,7 @@ public class TextSecurePreferences {
}
public static boolean isSmsEnabled(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return Util.isDefaultSmsProvider(context);
} else {
return isInterceptAllSmsEnabled(context);
}
return Util.isDefaultSmsProvider(context);
}
public static int getLocalRegistrationId(Context context) {

View File

@@ -367,8 +367,7 @@ public class Util {
@SuppressLint("NewApi")
public static boolean isDefaultSmsProvider(Context context){
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) ||
(context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context)));
return context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context));
}
public static int getCurrentApkReleaseVersion(Context context) {
@@ -395,12 +394,8 @@ public class Util {
}
public static int getDaysTillBuildExpiry() {
if (Build.VERSION.SDK_INT < 19) {
return Integer.MAX_VALUE;
} else {
int age = (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP);
return 90 - age;
}
int age = (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP);
return 90 - age;
}
@TargetApi(VERSION_CODES.LOLLIPOP)