Ver Fonte

Version 4.66

Threema há 4 anos atrás
pai
commit
134b3f1869
2 ficheiros alterados com 29 adições e 25 exclusões
  1. 2 2
      app/build.gradle
  2. 27 23
      app/src/main/java/ch/threema/app/ThreemaApplication.java

+ 2 - 2
app/build.gradle

@@ -20,7 +20,7 @@ if (getGradle().getStartParameter().getTaskRequests().toString().contains("Hms")
 }
 
 // version codes
-def app_version = "4.65"
+def app_version = "4.66"
 def beta_suffix = "" // with leading dash
 
 /**
@@ -99,7 +99,7 @@ android {
         vectorDrawables.useSupportLibrary = true
         applicationId "ch.threema.app"
         testApplicationId 'ch.threema.app.test'
-        versionCode 718
+        versionCode 720
         versionName "${app_version}${beta_suffix}"
         resValue "string", "app_name", "Threema"
         // package name used for sync adapter - needs to match mime types below

+ 27 - 23
app/src/main/java/ch/threema/app/ThreemaApplication.java

@@ -843,38 +843,42 @@ public class ThreemaApplication extends MultiDexApplication implements DefaultLi
 
 			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
 				ActivityManager activityManager = (ActivityManager) getAppContext().getSystemService(Context.ACTIVITY_SERVICE);
-				List<ApplicationExitInfo> applicationExitInfos = activityManager.getHistoricalProcessExitReasons(null, 0, 0);
+				try {
+					List<ApplicationExitInfo> applicationExitInfos = activityManager.getHistoricalProcessExitReasons(null, 0, 0);
 
-				if (applicationExitInfos.size() > 0) {
-					for (ApplicationExitInfo exitInfo : applicationExitInfos) {
-						long timestampOfLastLog = 0L;
-						if (sharedPreferences != null) {
-							timestampOfLastLog = sharedPreferences.getLong(EXIT_REASON_LOGGING_TIMESTAMP, timestampOfLastLog);
-						}
+					if (applicationExitInfos.size() > 0) {
+						for (ApplicationExitInfo exitInfo : applicationExitInfos) {
+							long timestampOfLastLog = 0L;
+							if (sharedPreferences != null) {
+								timestampOfLastLog = sharedPreferences.getLong(EXIT_REASON_LOGGING_TIMESTAMP, timestampOfLastLog);
+							}
 
-						if (exitInfo.getTimestamp() > timestampOfLastLog) {
-							logger.info(String.format(Locale.US, "*** App last exited at %s with reason: %d, description: %s", DateUtils.formatDateTime(getAppContext(), exitInfo.getTimestamp(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME), exitInfo.getReason(), exitInfo.getDescription()));
-							if (exitInfo.getReason() == ApplicationExitInfo.REASON_ANR) {
-								try {
-									InputStream traceInputStream = exitInfo.getTraceInputStream();
-									if (traceInputStream != null) {
-										BufferedReader r = new BufferedReader(new InputStreamReader(traceInputStream));
-										StringBuilder s = new StringBuilder();
-										for (String line; (line = r.readLine()) != null; ) {
-											s.append(line).append('\n');
+							if (exitInfo.getTimestamp() > timestampOfLastLog) {
+								logger.info(String.format(Locale.US, "*** App last exited at %s with reason: %d, description: %s", DateUtils.formatDateTime(getAppContext(), exitInfo.getTimestamp(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME), exitInfo.getReason(), exitInfo.getDescription()));
+								if (exitInfo.getReason() == ApplicationExitInfo.REASON_ANR) {
+									try {
+										InputStream traceInputStream = exitInfo.getTraceInputStream();
+										if (traceInputStream != null) {
+											BufferedReader r = new BufferedReader(new InputStreamReader(traceInputStream));
+											StringBuilder s = new StringBuilder();
+											for (String line; (line = r.readLine()) != null; ) {
+												s.append(line).append('\n');
+											}
+											logger.info(s.toString());
 										}
-										logger.info(s.toString());
+									} catch (IOException e) {
+										logger.error("Error getting ANR trace", e);
 									}
-								} catch (IOException e) {
-									logger.error("Error getting ANR trace", e);
 								}
 							}
 						}
-					}
 
-					if (sharedPreferences != null) {
-						sharedPreferences.edit().putLong(EXIT_REASON_LOGGING_TIMESTAMP, System.currentTimeMillis()).apply();
+						if (sharedPreferences != null) {
+							sharedPreferences.edit().putLong(EXIT_REASON_LOGGING_TIMESTAMP, System.currentTimeMillis()).apply();
+						}
 					}
+				} catch (IllegalArgumentException e) {
+					logger.error("Unable to get reason of last exit", e);
 				}
 			}