mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-26 01:27:23 +00:00
Update FlashZip
This commit is contained in:
parent
11e1d04dd1
commit
1e09ccb4d9
@ -43,14 +43,10 @@ public class ModulesFragment extends Fragment {
|
|||||||
private static final int FETCH_ZIP_CODE = 2;
|
private static final int FETCH_ZIP_CODE = 2;
|
||||||
public static List<Module> listModules = new ArrayList<>();
|
public static List<Module> listModules = new ArrayList<>();
|
||||||
public static List<Module> listModulesCache = new ArrayList<>();
|
public static List<Module> listModulesCache = new ArrayList<>();
|
||||||
@BindView(R.id.progressBar)
|
@BindView(R.id.progressBar) ProgressBar progressBar;
|
||||||
ProgressBar progressBar;
|
@BindView(R.id.fab) FloatingActionButton fabio;
|
||||||
@BindView(R.id.fab)
|
@BindView(R.id.pager) ViewPager viewPager;
|
||||||
FloatingActionButton fabio;
|
@BindView(R.id.tab_layout) TabLayout tabLayout;
|
||||||
@BindView(R.id.pager)
|
|
||||||
ViewPager viewPager;
|
|
||||||
@BindView(R.id.tab_layout)
|
|
||||||
TabLayout tabLayout;
|
|
||||||
private int viewPagePosition;
|
private int viewPagePosition;
|
||||||
private RepoHelper.TaskDelegate mTaskDelegate;
|
private RepoHelper.TaskDelegate mTaskDelegate;
|
||||||
|
|
||||||
@ -69,12 +65,10 @@ public class ModulesFragment extends Fragment {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
new Utils.LoadModules(getActivity()).execute();
|
|
||||||
mTaskDelegate = result -> {
|
mTaskDelegate = result -> {
|
||||||
if (result.equals("OK")) {
|
if (result.equals("OK")) {
|
||||||
RefreshUI();
|
RefreshUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
new updateUI().execute();
|
new updateUI().execute();
|
||||||
|
@ -517,13 +517,13 @@ public class Utils {
|
|||||||
final String docId = DocumentsContract.getDocumentId(mUri);
|
final String docId = DocumentsContract.getDocumentId(mUri);
|
||||||
|
|
||||||
Log.d("Magisk","Utils: FlashZip Running, " + docId + " and " + mUri.toString());
|
Log.d("Magisk","Utils: FlashZip Running, " + docId + " and " + mUri.toString());
|
||||||
String[] split = docId.split(":");
|
if (docId.contains(":"))
|
||||||
mName = split[1];
|
mName = docId.split(":")[1];
|
||||||
if (mName.contains("/")) {
|
else mName = docId;
|
||||||
split = mName.split("/");
|
if (mName.contains("/"))
|
||||||
}
|
mName = mName.substring(mName.lastIndexOf('/') + 1);
|
||||||
if (split[1].contains(".zip")) {
|
if (mName.contains(".zip")) {
|
||||||
file = mContext.getFilesDir() + "/" + split[1];
|
file = mContext.getFilesDir() + "/" + mName;
|
||||||
Log.d("Magisk", "Utils: FlashZip running for uRI " + mUri.toString());
|
Log.d("Magisk", "Utils: FlashZip running for uRI " + mUri.toString());
|
||||||
} else {
|
} else {
|
||||||
Log.e("Magisk", "Utils: error parsing Zipfile " + mUri.getPath());
|
Log.e("Magisk", "Utils: error parsing Zipfile " + mUri.getPath());
|
||||||
@ -587,6 +587,7 @@ public class Utils {
|
|||||||
protected Boolean doInBackground(Void... voids) {
|
protected Boolean doInBackground(Void... voids) {
|
||||||
if (mPath != null) {
|
if (mPath != null) {
|
||||||
Log.e("Magisk", "Utils: Error, flashZIP called without a valid zip file to flash.");
|
Log.e("Magisk", "Utils: Error, flashZIP called without a valid zip file to flash.");
|
||||||
|
progress.dismiss();
|
||||||
this.cancel(true);
|
this.cancel(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -594,11 +595,11 @@ public class Utils {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
ret = Shell.su(
|
ret = Shell.su(
|
||||||
"rm -rf /data/tmp",
|
"rm -rf /dev/tmp",
|
||||||
"mkdir -p /data/tmp",
|
"mkdir -p /dev/tmp",
|
||||||
"cp -af " + mPath + " /data/tmp/install.zip",
|
"cp -af " + mPath + " /dev/tmp/install.zip",
|
||||||
"unzip -o /data/tmp/install.zip META-INF/com/google/android/* -d /data/tmp",
|
"unzip -o /dev/tmp/install.zip META-INF/com/google/android/* -d /dev/tmp",
|
||||||
"BOOTMODE=true sh /data/tmp/META-INF/com/google/android/update-binary dummy 1 /data/tmp/install.zip",
|
"BOOTMODE=true sh /dev/tmp/META-INF/com/google/android/update-binary dummy 1 /dev/tmp/install.zip",
|
||||||
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
|
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
|
||||||
);
|
);
|
||||||
return ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1));
|
return ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1));
|
||||||
@ -608,7 +609,6 @@ public class Utils {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
Shell.su("rm -rf /data/tmp");
|
|
||||||
if (deleteFileAfter) {
|
if (deleteFileAfter) {
|
||||||
Shell.su("rm -rf " + mPath);
|
Shell.su("rm -rf " + mPath);
|
||||||
Log.d("Magisk", "Utils: Deleting file " + mPath);
|
Log.d("Magisk", "Utils: Deleting file " + mPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user