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