mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 12:47:38 +00:00
Extract external path
This commit is contained in:
parent
97bf388471
commit
b570cb5b77
@ -3,7 +3,6 @@ package com.topjohnwu.magisk;
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.text.TextUtils;
|
||||
@ -30,6 +29,7 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
@ -109,7 +109,6 @@ public class MagiskLogFragment extends Fragment {
|
||||
super(MagiskLogFragment.this.getActivity());
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
@Override
|
||||
protected Object doInBackground(Object... params) {
|
||||
mode = (int) params[0];
|
||||
@ -126,13 +125,13 @@ public class MagiskLogFragment extends Fragment {
|
||||
|
||||
case 2:
|
||||
Calendar now = Calendar.getInstance();
|
||||
String filename = String.format(
|
||||
"magisk_%s_%04d%02d%02d_%02d%02d%02d.log", "error",
|
||||
String filename = String.format(Locale.US,
|
||||
"magisk_log_%04d%02d%02d_%02d:%02d:%02d.log",
|
||||
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
|
||||
now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY),
|
||||
now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
|
||||
|
||||
targetFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager/" + filename);
|
||||
targetFile = new File(Const.EXTERNAL_PATH + "/logs", filename);
|
||||
|
||||
if ((!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs())
|
||||
|| (targetFile.exists() && !targetFile.delete())) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.topjohnwu.magisk.asyncs;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.topjohnwu.crypto.JarMap;
|
||||
@ -97,7 +96,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
|
||||
MagiskManager mm = MagiskManager.get();
|
||||
|
||||
// Generate a new unhide app with random package name
|
||||
File repack = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", "repack.apk");
|
||||
File repack = new File(Const.EXTERNAL_PATH, "repack.apk");
|
||||
repack.getParentFile().mkdirs();
|
||||
String pkg = genPackageName("com.", Const.ORIG_PKG_NAME.length());
|
||||
|
||||
|
@ -4,7 +4,6 @@ import android.app.Activity;
|
||||
import android.content.res.AssetManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.topjohnwu.crypto.SignBoot;
|
||||
@ -203,7 +202,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
|
||||
|
||||
switch (mode) {
|
||||
case PATCH_MODE:
|
||||
File dest = new File(Environment.getExternalStorageDirectory() + "/MagiskManager/patched_boot" + mm.bootFormat);
|
||||
File dest = new File(Const.EXTERNAL_PATH, patched_boot + mm.bootFormat);
|
||||
dest.getParentFile().mkdirs();
|
||||
switch (mm.bootFormat) {
|
||||
case ".img":
|
||||
|
@ -5,7 +5,6 @@ import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.widget.Toast;
|
||||
@ -45,7 +44,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
|
||||
public ProcessRepoZip(Activity context, String link, String filename, boolean install) {
|
||||
super(context);
|
||||
mLink = link;
|
||||
mFile = new File(Environment.getExternalStorageDirectory() + "/MagiskManager", filename);
|
||||
mFile = new File(Const.EXTERNAL_PATH, filename);
|
||||
mInstall = install;
|
||||
mHandler = new Handler();
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.container.Policy;
|
||||
import com.topjohnwu.magisk.utils.Shell;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.topjohnwu.magisk.utils;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -22,6 +25,7 @@ public class Const {
|
||||
public static final String TMP_FOLDER_PATH = "/dev/tmp";
|
||||
public static final String MAGISK_LOG = "/cache/magisk.log";
|
||||
public static final String BUSYBOXPATH = "/dev/magisk/bin";
|
||||
public static final File EXTERNAL_PATH = new File(Environment.getExternalStorageDirectory(), "MagiskManager");
|
||||
|
||||
public static String MAGISK_PATH() {
|
||||
if (Utils.itemExist("/dev/magisk/img")) {
|
||||
|
@ -14,7 +14,6 @@ import android.database.Cursor;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.design.widget.Snackbar;
|
||||
@ -70,7 +69,7 @@ public class Utils {
|
||||
return;
|
||||
|
||||
runWithPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE, () -> {
|
||||
File file = new File(Environment.getExternalStorageDirectory() + "/MagiskManager/" + filename);
|
||||
File file = new File(Const.EXTERNAL_PATH, filename);
|
||||
|
||||
if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs())
|
||||
|| (file.exists() && !file.delete())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user