mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-02 20:41:51 +00:00
1
stub/proguard-rules.pro
vendored
1
stub/proguard-rules.pro
vendored
@@ -29,5 +29,4 @@
|
||||
-allowaccessmodification
|
||||
-keepclassmembers class com.topjohnwu.magisk.dummy.* { <init>(); }
|
||||
-keepclassmembers class com.topjohnwu.magisk.DownloadActivity { <init>(); }
|
||||
-keepclassmembers class com.topjohnwu.magisk.FileProvider { <init>(); }
|
||||
-keepclassmembers class com.topjohnwu.magisk.DelegateRootService { <init>(); }
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -79,6 +80,7 @@ public class DownloadActivity extends Activity {
|
||||
|
||||
private void error(Throwable e) {
|
||||
Log.e(getClass().getSimpleName(), "", e);
|
||||
Toast.makeText(themed, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -111,22 +113,22 @@ public class DownloadActivity extends Activity {
|
||||
|
||||
private void dlAPK() {
|
||||
dialog = ProgressDialog.show(themed, getString(dling), getString(dling) + " " + APP_NAME, true);
|
||||
Runnable onSuccess = () -> {
|
||||
dialog.dismiss();
|
||||
Toast.makeText(themed, relaunch_app, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
};
|
||||
// Download and upgrade the app
|
||||
File apk = dynLoad ? DynAPK.current(this) : new File(getCacheDir(), "manager.apk");
|
||||
request(apkLink).setExecutor(AsyncTask.THREAD_POOL_EXECUTOR).getAsFile(apk, file -> {
|
||||
if (dynLoad) {
|
||||
DynLoad.setup(this);
|
||||
runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
Toast.makeText(themed, relaunch_app, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
});
|
||||
onSuccess.run();
|
||||
} else {
|
||||
runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
APKInstall.install(this, file);
|
||||
finish();
|
||||
});
|
||||
var receiver = APKInstall.register(this, BuildConfig.APPLICATION_ID, onSuccess);
|
||||
APKInstall.installapk(this, file);
|
||||
Intent intent = receiver.waitIntent();
|
||||
if (intent != null) startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -141,15 +143,10 @@ public class DownloadActivity extends Activity {
|
||||
InputStream is = new CipherInputStream(new ByteArrayInputStream(Bytes.res()), cipher);
|
||||
try (InputStream gzip = new GZIPInputStream(is);
|
||||
OutputStream out = new FileOutputStream(apk)) {
|
||||
byte[] buf = new byte[4096];
|
||||
for (int read; (read = gzip.read(buf)) >= 0;) {
|
||||
out.write(buf, 0, read);
|
||||
}
|
||||
APKInstall.transfer(gzip, out);
|
||||
}
|
||||
DynAPK.addAssetPath(getResources().getAssets(), apk.getPath());
|
||||
} catch (Exception e) {
|
||||
// Should not happen
|
||||
e.printStackTrace();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user