mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 21:45:27 +00:00
Add FLAG_ACTIVITY_NEW_TASK flag for updates
This commit is contained in:
parent
2e88e5e9c7
commit
b612bce779
@ -22,7 +22,8 @@ public class ManagerUpdate extends BroadcastReceiver {
|
|||||||
public void onDownloadDone(Uri uri) {
|
public void onDownloadDone(Uri uri) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
Intent install = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
Intent install = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
install.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
Uri content = FileProvider.getUriForFile(context,
|
Uri content = FileProvider.getUriForFile(context,
|
||||||
context.getPackageName() + ".provider", new File(uri.getPath()));
|
context.getPackageName() + ".provider", new File(uri.getPath()));
|
||||||
install.setData(content);
|
install.setData(content);
|
||||||
@ -30,7 +31,7 @@ public class ManagerUpdate extends BroadcastReceiver {
|
|||||||
} else {
|
} else {
|
||||||
Intent install = new Intent(Intent.ACTION_VIEW);
|
Intent install = new Intent(Intent.ACTION_VIEW);
|
||||||
install.setDataAndType(uri, "application/vnd.android.package-archive");
|
install.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||||
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
context.startActivity(install);
|
context.startActivity(install);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user