mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 14:42:29 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user