Prevent crash

pull/212/head
M66B 2 years ago
parent cc06a8a673
commit c7996156ed

@ -328,15 +328,29 @@ public class ApplicationEx extends Application
@Override
public void onTrimMemory(int level) {
try {
/*
java.lang.NoClassDefFoundError: Not a primitive type: '\u0000'
at androidx.core.content.ContextCompat$Api23Impl.getSystemService(Unknown Source:0)
at androidx.core.content.ContextCompat.getSystemService(SourceFile:7)
at eu.faircode.email.Helper.getSystemService(Unknown Source:4)
at eu.faircode.email.Log.logMemory(SourceFile:8)
at eu.faircode.email.ApplicationEx.onTrimMemory(SourceFile:18)
at android.app.ActivityThread.handleTrimMemory(ActivityThread.java:5453)
*/
Log.logMemory(this, "Trim memory level=" + level);
Map<String, String> crumb = new HashMap<>();
crumb.put("level", Integer.toString(level));
Log.breadcrumb("trim", crumb);
super.onTrimMemory(level);
} catch (Throwable ex) {
Log.e(ex);
}
}
@Override
public void onLowMemory() {
try {
Log.logMemory(this, "Low memory");
Map<String, String> crumb = new HashMap<>();
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
@ -345,6 +359,9 @@ public class ApplicationEx extends Application
ContactInfo.clearCache(this, false);
super.onLowMemory();
} catch (Throwable ex) {
Log.e(ex);
}
}
static void upgrade(Context context) {

Loading…
Cancel
Save