fix read_uri_permission

This commit is contained in:
Chumva 2018-05-21 15:13:09 +03:00
parent 183576066a
commit 9ca3fed810
5 changed files with 6 additions and 2 deletions

View file

@ -111,7 +111,6 @@ public class ContributionVersionActivity extends OsmandListActivity {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(AndroidUtils.getUriForFile(getMyApplication(), pathToDownload), "application/vnd.android.package-archive"); intent.setDataAndType(AndroidUtils.getUriForFile(getMyApplication(), pathToDownload), "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(intent, ACTIVITY_TO_INSTALL); startActivityForResult(intent, ACTIVITY_TO_INSTALL);
updateInstalledApp(false, currentSelectedBuild.date); updateInstalledApp(false, currentSelectedBuild.date);
} }

View file

@ -589,6 +589,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject)); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
sendIntent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(getMyApplication(), dst)); sendIntent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(getMyApplication(), dst));
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(sendIntent); startActivity(sendIntent);
} catch (IOException e) { } catch (IOException e) {
Toast.makeText(getActivity(), "Error sharing favorites: " + e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "Error sharing favorites: " + e.getMessage(), Toast.LENGTH_SHORT).show();

View file

@ -843,7 +843,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
// } // }
Uri fileUri = AndroidUtils.getUriForFile(getMapActivity(), getBaseFileName(lat, lon, app, ext)); Uri fileUri = AndroidUtils.getUriForFile(getMapActivity(), getBaseFileName(lat, lon, app, ext));
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
// start the video capture Intent // start the video capture Intent
mapActivity.startActivityForResult(intent, 205); mapActivity.startActivityForResult(intent, 205);
@ -1881,6 +1881,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
if (r.isVideo()) { if (r.isVideo()) {
Intent vint = new Intent(Intent.ACTION_VIEW); Intent vint = new Intent(Intent.ACTION_VIEW);
vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "video/*"); vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "video/*");
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
vint.setFlags(0x10000000); vint.setFlags(0x10000000);
try { try {
ctx.startActivity(vint); ctx.startActivity(vint);
@ -1891,6 +1892,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
} else if (r.isPhoto()) { } else if (r.isPhoto()) {
Intent vint = new Intent(Intent.ACTION_VIEW); Intent vint = new Intent(Intent.ACTION_VIEW);
vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "image/*"); vint.setDataAndType(AndroidUtils.getUriForFile(mapActivity, r.file), "image/*");
vint.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
vint.setFlags(0x10000000); vint.setFlags(0x10000000);
ctx.startActivity(vint); ctx.startActivity(vint);
return; return;

View file

@ -1414,6 +1414,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
final Intent sendIntent = new Intent(Intent.ACTION_SEND); final Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri); sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
sendIntent.setType("application/gpx+xml"); sendIntent.setType("application/gpx+xml");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(sendIntent); startActivity(sendIntent);
return true; return true;
} }

View file

@ -2068,6 +2068,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_history_subject)); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_history_subject));
sendIntent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(getMapActivity(), dst)); sendIntent.putExtra(Intent.EXTRA_STREAM, AndroidUtils.getUriForFile(getMapActivity(), dst));
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(sendIntent); startActivity(sendIntent);
} }
}; };