Move methods

This commit is contained in:
topjohnwu 2019-04-08 15:46:44 -04:00
parent f187213568
commit b72004e9cc
5 changed files with 10 additions and 13 deletions

View File

@ -17,6 +17,7 @@ import com.topjohnwu.magisk.adapters.StringListAdapter;
import com.topjohnwu.magisk.components.BaseActivity;
import com.topjohnwu.magisk.tasks.FlashZip;
import com.topjohnwu.magisk.tasks.MagiskInstaller;
import com.topjohnwu.magisk.utils.RootUtils;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.CallbackList;
import com.topjohnwu.superuser.Shell;
@ -47,7 +48,7 @@ public class FlashActivity extends BaseActivity {
@OnClick(R.id.reboot)
void reboot() {
Utils.reboot();
RootUtils.reboot();
}
@OnClick(R.id.save_logs)

View File

@ -2,22 +2,18 @@ package com.topjohnwu.magisk.dialogs;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.topjohnwu.magisk.ClassMap;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.magisk.tasks.MagiskInstaller;
import com.topjohnwu.magisk.utils.RootUtils;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import com.topjohnwu.superuser.io.SuFile;
import java.io.IOException;
public class EnvFixDialog extends CustomAlertDialog {
public EnvFixDialog(@NonNull Activity activity) {
@ -42,7 +38,7 @@ public class EnvFixDialog extends CustomAlertDialog {
pd.dismiss();
Utils.toast(success ? R.string.reboot_delay_toast : R.string.setup_fail, Toast.LENGTH_LONG);
if (success)
UiThreadHandler.handler.postDelayed(Utils::reboot, 5000);
UiThreadHandler.handler.postDelayed(RootUtils::reboot, 5000);
}
}.exec();
});

View File

@ -25,6 +25,7 @@ import com.topjohnwu.magisk.adapters.ModulesAdapter;
import com.topjohnwu.magisk.components.BaseFragment;
import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.magisk.utils.Event;
import com.topjohnwu.magisk.utils.RootUtils;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.Shell;
@ -110,7 +111,7 @@ public class ModulesFragment extends BaseFragment {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.reboot:
Utils.reboot();
RootUtils.reboot();
return true;
case R.id.reboot_recovery:
Shell.su("/system/bin/reboot recovery").submit();

View File

@ -20,6 +20,10 @@ public class RootUtils extends Shell.Initializer {
Shell.su(Utils.fmt("(rm_launch %s %s)&", rm, component.flattenToString())).exec();
}
public static void reboot() {
Shell.su("/system/bin/reboot" + (Config.recovery ? " recovery" : "")).submit();
}
@Override
public boolean onInit(Context context, @NonNull Shell shell) {
Shell.Job job = shell.newJob();

View File

@ -27,7 +27,6 @@ import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.components.UpdateCheckService;
import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.magisk.container.ValueSortedMap;
import com.topjohnwu.magisk.tasks.CheckUpdates;
import com.topjohnwu.net.Networking;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.internal.UiThreadHandler;
@ -136,10 +135,6 @@ public class Utils {
Config.Value.MULTIUSER_MODE_OWNER_MANAGED);
}
public static void reboot() {
Shell.su("/system/bin/reboot" + (Config.recovery ? " recovery" : "")).submit();
}
public static boolean isCanary() {
return BuildConfig.VERSION_NAME.contains("-");
}