mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 13:17:39 +02:00
Do not place files into /sdcard/MagiskManager
This commit is contained in:
@ -12,6 +12,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.topjohnwu.magisk.NoUIActivity;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.utils.Download;
|
||||
|
||||
public abstract class BaseActivity extends FlavorActivity {
|
||||
|
||||
@ -26,6 +27,7 @@ public abstract class BaseActivity extends FlavorActivity {
|
||||
granted = false;
|
||||
}
|
||||
if (granted) {
|
||||
Download.EXTERNAL_PATH.mkdirs();
|
||||
callback.run();
|
||||
} else {
|
||||
// Passed in context should be an activity if not granted, need to show dialog!
|
||||
|
@ -10,6 +10,7 @@ import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.components.BaseActivity;
|
||||
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||
@ -19,7 +20,11 @@ import java.io.File;
|
||||
public class Download {
|
||||
|
||||
public static final File EXTERNAL_PATH =
|
||||
new File(Environment.getExternalStorageDirectory(), "MagiskManager");
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||
|
||||
static {
|
||||
EXTERNAL_PATH.mkdirs();
|
||||
}
|
||||
|
||||
public static boolean isDownloading = false;
|
||||
|
||||
@ -30,11 +35,7 @@ public class Download {
|
||||
BaseActivity.runWithPermission(context,
|
||||
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
|
||||
File file = new File(EXTERNAL_PATH, getLegalFilename(filename));
|
||||
|
||||
if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs())
|
||||
|| (file.exists() && !file.delete())) {
|
||||
return;
|
||||
}
|
||||
file.delete();
|
||||
|
||||
Toast.makeText(context, context.getString(R.string.downloading_toast, filename),
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
Reference in New Issue
Block a user