Skip to content

Commit

Permalink
Merge pull request #241 from ACRA/correct_sys_logs_test
Browse files Browse the repository at this point in the history
Fix check for whether to gather read logs. Has permission if either READ_LOGS_PERMISSION or API >= 16.
  • Loading branch information
william-ferguson-au committed Feb 24, 2015
2 parents 11b8425 + e122a4f commit 3ee37a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/acra/collector/CrashReportDataFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ public CrashReportData createCrashData(String msg, Throwable th, Map<String, Str
// Before JellyBean, this required the READ_LOGS permission
// Since JellyBean, READ_LOGS is not granted to third-party apps anymore for security reasons.
// Though, we can call logcat without any permission and still get traces related to our app.
if (prefs.getBoolean(ACRA.PREF_ENABLE_SYSTEM_LOGS, true)
&& (pm.hasPermission(Manifest.permission.READ_LOGS))
|| Compatibility.getAPILevel() >= 16) {
final boolean hasReadLogsPermission = pm.hasPermission(Manifest.permission.READ_LOGS) || (Compatibility.getAPILevel() >= 16);
if (prefs.getBoolean(ACRA.PREF_ENABLE_SYSTEM_LOGS, true) && hasReadLogsPermission) {
Log.i(ACRA.LOG_TAG, "READ_LOGS granted! ACRA can include LogCat and DropBox data.");
if (crashReportFields.contains(LOGCAT)) {
crashReportData.put(LOGCAT, LogCatCollector.collectLogCat(null));
Expand Down

0 comments on commit 3ee37a5

Please sign in to comment.