mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 17:48:29 +00:00
Fix crash on non-Nougat
This commit is contained in:
parent
e5be8b7f67
commit
c854f436bf
@ -5,6 +5,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -98,11 +99,18 @@ public class MagiskFragment extends Fragment {
|
|||||||
new DownloadReceiver() {
|
new DownloadReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void task(Uri uri) {
|
public void task(Uri uri) {
|
||||||
Intent install = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
Intent install = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||||
Uri content = FileProvider.getUriForFile(getActivity(), "com.topjohnwu.magisk.provider", new File(uri.getPath()));
|
install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
install.setData(content);
|
Uri content = FileProvider.getUriForFile(getActivity(), "com.topjohnwu.magisk.provider", new File(uri.getPath()));
|
||||||
mContext.startActivity(install);
|
install.setData(content);
|
||||||
|
mContext.startActivity(install);
|
||||||
|
} else {
|
||||||
|
Intent install = new Intent(Intent.ACTION_VIEW);
|
||||||
|
install.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||||
|
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(install);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appLink,
|
appLink,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user