Several fixes

This commit is contained in:
topjohnwu 2017-02-07 07:32:40 +08:00
parent f4ce813de9
commit d1b5ebad7d
5 changed files with 22 additions and 11 deletions
app

View File

@ -8,8 +8,8 @@ android {
applicationId "com.topjohnwu.magisk"
minSdkVersion 21
targetSdkVersion 25
versionCode 20
versionName "4.0"
versionCode 22
versionName "4.1"
jackOptions {
enabled true
jackInProcess true

View File

@ -56,8 +56,8 @@ public class MagiskManager extends Application {
// Configurations
public static boolean shellLogging;
public static boolean devLogging;
public static boolean magiskHide;
public boolean magiskHide;
public boolean isDarkTheme;
public int suRequestTimeout;
public int suLogTimeout = 14;

View File

@ -5,8 +5,11 @@ import android.os.Bundle;
import com.topjohnwu.magisk.components.Activity;
import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Utils;
import java.util.List;
public class SplashActivity extends Activity {
@Override
@ -18,13 +21,16 @@ public class SplashActivity extends Activity {
// Init the info and configs and root shell
magiskManager.init();
boolean boot_done = Utils.itemExist(MagiskManager.MAGISK_MANAGER_BOOT);
// Check MagiskHide status
List<String> ret = Shell.sh("getprop persist.magisk.hide");
boolean started = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0;
// Now fire all async tasks
new Async.CheckUpdates(magiskManager).exec();
new Async.GetBootBlocks(magiskManager).exec();
if (magiskManager.prefs.getBoolean("magiskhide", false) && !magiskManager.disabled &&
magiskManager.magiskVersion > 10.3 && boot_done) {
if (magiskManager.magiskHide && !magiskManager.disabled &&
magiskManager.magiskVersion > 11 && !started) {
new Async.MagiskHide().enable();
}
new Async.LoadModules(magiskManager) {

View File

@ -10,6 +10,9 @@ import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Async;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Utils;
import java.util.List;
public class BootReceiver extends BroadcastReceiver {
@ -29,11 +32,13 @@ public class BootReceiver extends BroadcastReceiver {
MagiskManager magiskManager = (MagiskManager) getApplicationContext();
magiskManager.initSuAccess();
magiskManager.updateMagiskInfo();
List<String> ret = Shell.sh("getprop persist.magisk.hide");
boolean started = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0;
if (magiskManager.prefs.getBoolean("magiskhide", false) &&
!magiskManager.disabled && magiskManager.magiskVersion > 10.3) {
!magiskManager.disabled && !started && magiskManager.magiskVersion > 11) {
magiskManager.toast(R.string.start_magiskhide, Toast.LENGTH_LONG);
Shell.su(true, Async.MAGISK_HIDE_PATH + "enable",
"touch " + MagiskManager.MAGISK_MANAGER_BOOT);
"setprop persist.magisk.hide 1");
}
}
}

View File

@ -229,7 +229,7 @@ public class Async {
@Override
protected void onPreExecute() {
progress = new ProgressDialog(magiskManager);
progress = new ProgressDialog(mContext);
progress.setTitle(R.string.zip_install_progress_title);
progress.show();
}
@ -323,11 +323,11 @@ public class Async {
}
public void enable() {
exec("enable");
exec("enable; setprop persist.magisk.hide 1");
}
public void disable() {
exec("disable");
exec("disable; setprop persist.magisk.hide 0");
}
}