bump min sdk to 24

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 3 years ago
parent 8619c66624
commit 24ec7f6cc6

@ -32,7 +32,7 @@ android {
defaultConfig { defaultConfig {
applicationId "com.fox2code.mmm" applicationId "com.fox2code.mmm"
minSdk 23 minSdk 24
targetSdk 33 targetSdk 33
versionCode 64 versionCode 64
versionName "1.2.1" versionName "1.2.1"

@ -14,7 +14,6 @@ import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.StyleRes; import androidx.annotation.StyleRes;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import androidx.emoji2.text.DefaultEmojiCompatConfig; import androidx.emoji2.text.DefaultEmojiCompatConfig;
@ -58,7 +57,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
// Warning! Locales that are't exist will crash the app // Warning! Locales that are't exist will crash the app
// Anything that is commented out is supported but the translation is not complete to at least 60% // Anything that is commented out is supported but the translation is not complete to at least 60%
public static HashSet<String> supportedLocales = new HashSet<>(); public static HashSet<String> supportedLocales = new HashSet<>();
private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().locale; private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().getLocales().get(0);
private static SimpleDateFormat timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale); private static SimpleDateFormat timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale);
private static SharedPreferences bootSharedPreferences; private static SharedPreferences bootSharedPreferences;
private static String relPackageName = BuildConfig.APPLICATION_ID; private static String relPackageName = BuildConfig.APPLICATION_ID;
@ -308,6 +307,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
Log.d("MainApplication", "Starting FoxMMM version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + "), commit " + BuildConfig.COMMIT_HASH); Log.d("MainApplication", "Starting FoxMMM version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + "), commit " + BuildConfig.COMMIT_HASH);
} }
super.onCreate(); super.onCreate();
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.d("MainApplication", "FoxMMM is running in debug mode"); Log.d("MainApplication", "FoxMMM is running in debug mode");
} }
@ -390,7 +390,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
Locale newTimeFormatLocale = newConfig.locale; Locale newTimeFormatLocale = newConfig.getLocales().get(0);
if (timeFormatLocale != newTimeFormatLocale) { if (timeFormatLocale != newTimeFormatLocale) {
timeFormatLocale = newTimeFormatLocale; timeFormatLocale = newTimeFormatLocale;
timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale); timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale);
@ -398,17 +398,14 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
} }
@RequiresApi(api = Build.VERSION_CODES.N)
public void clearAppData() { public void clearAppData() {
// Clear app data // Clear app data
try { try {
// Clearing app data // Clearing app data
// We have to manually delete the files and directories // We have to manually delete the files and directories
// because the cache directory is not cleared by the following method // because the cache directory is not cleared by the following method
File cacheDir = null; File cacheDir;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { cacheDir = this.getDataDir();
cacheDir = this.getDataDir();
}
if (cacheDir != null && cacheDir.isDirectory()) { if (cacheDir != null && cacheDir.isDirectory()) {
String[] children = cacheDir.list(); String[] children = cacheDir.list();
if (children != null) { if (children != null) {

@ -2,9 +2,11 @@ package com.fox2code.mmm.utils.sentry;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import com.fox2code.mmm.CrashHandler;
import com.fox2code.mmm.MainApplication; import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.androidacy.AndroidacyUtil; import com.fox2code.mmm.androidacy.AndroidacyUtil;
@ -35,10 +37,12 @@ public class SentryMain {
editor.putString("lastExitReason", "crash"); editor.putString("lastExitReason", "crash");
editor.putLong("lastExitTime", System.currentTimeMillis()); editor.putLong("lastExitTime", System.currentTimeMillis());
editor.apply(); editor.apply();
// If we just let the default uncaught exception handler handle the // open crash handler and exit
// exception, the app will hang and never close. Intent intent = new Intent(mainApplication, CrashHandler.class);
// So we need to kill the app ourselves. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
System.exit(1); mainApplication.startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
}); });
SentryAndroid.init(mainApplication, options -> { SentryAndroid.init(mainApplication, options -> {
// If crash reporting is disabled, stop here. // If crash reporting is disabled, stop here.

Loading…
Cancel
Save