Merge pull request #2175 from mfietz/issue/2143-opml-import-2.3

Do not check permissions for OPML import on pre-M Android versions
This commit is contained in:
Martin Fietz 2016-11-12 09:11:08 +01:00 committed by GitHub
commit 724ded4847
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package de.danoeh.antennapod.activity;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
@ -76,7 +77,8 @@ public class OpmlImportBaseActivity extends AppCompatActivity {
return; return;
} }
this.uri = uri; this.uri = uri;
if(uri.toString().contains(Environment.getExternalStorageDirectory().toString())) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
uri.toString().contains(Environment.getExternalStorageDirectory().toString())) {
int permission = ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE); int permission = ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) { if (permission != PackageManager.PERMISSION_GRANTED) {
requestPermission(); requestPermission();