mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-10-04 14:51:48 +00:00
Fix SecurityException when opening downloaded files in other app
The flag was not passed to the intent that wraps the actual view intent for the app chooser.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package us.shandian.giga.ui.adapter;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.content.Intent.FLAG_GRANT_PREFIX_URI_PERMISSION;
|
||||
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
||||
import static android.content.Intent.createChooser;
|
||||
@@ -356,7 +357,9 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||
viewIntent.addFlags(FLAG_GRANT_PREFIX_URI_PERMISSION);
|
||||
|
||||
Intent chooserIntent = createChooser(viewIntent, null);
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | FLAG_GRANT_READ_URI_PERMISSION);
|
||||
chooserIntent.addFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||
chooserIntent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
|
||||
chooserIntent.addFlags(FLAG_GRANT_PREFIX_URI_PERMISSION);
|
||||
|
||||
ShareUtils.openIntentInApp(mContext, chooserIntent);
|
||||
}
|
||||
@@ -375,7 +378,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
|
||||
intent.putExtra(Intent.EXTRA_TITLE, mContext.getString(R.string.share_dialog_title));
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
mContext.startActivity(intent);
|
||||
|
||||
Reference in New Issue
Block a user