diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-02-27 11:25:56 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-02-27 11:25:56 +0100 |
commit | 3cf21e2d3712f40659afbf44296c8ea571d9f7a3 (patch) | |
tree | 0998789ed09c18f7859df518fc85deaa2583a47d /src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java | |
parent | c393e6089177f31683c4cecfdb359802de1b5e0c (diff) | |
parent | e1a2f248afcc9fd884015da78decd5c0c8c83552 (diff) |
Merge pull request #1721 from fiaxh/export_logs_storage_permission
Request WRITE_EXTERNAL_STORAGE for ExportLogsPreference in >= M
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java b/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java index a4e178bd..bedb4172 100644 --- a/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java +++ b/src/main/java/eu/siacs/conversations/ui/ExportLogsPreference.java @@ -1,7 +1,10 @@ package eu.siacs.conversations.ui; +import android.Manifest; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; import android.preference.Preference; import android.util.AttributeSet; @@ -22,6 +25,10 @@ public class ExportLogsPreference extends Preference { } protected void onClick() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + && getContext().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + return; + } final Intent startIntent = new Intent(getContext(), ExportLogsService.class); getContext().startService(startIntent); super.onClick(); |