Some minor adjustments

This commit is contained in:
topjohnwu 2019-02-03 05:16:29 -05:00
parent e39d2567ea
commit 1e94f0a094
6 changed files with 13 additions and 11 deletions

View File

@ -8,7 +8,6 @@ import android.database.sqlite.SQLiteOpenHelper;
import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.container.Repo;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import java.util.HashSet;
import java.util.Set;

View File

@ -35,7 +35,8 @@ public abstract class FlashZip {
private boolean unzipAndCheck() throws IOException {
ZipUtils.unzip(tmpFile, tmpFile.getParentFile(), "META-INF/com/google/android", true);
return ShellUtils.fastCmdResult("grep -q '#MAGISK' " + new File(tmpFile.getParentFile(), "updater-script"));
return Shell.su("grep -q '#MAGISK' " + new File(tmpFile.getParentFile(), "updater-script"))
.exec().isSuccess();
}
private boolean flash() throws IOException {

View File

@ -30,7 +30,6 @@ import com.topjohnwu.magisk.utils.AppUtils;
import com.topjohnwu.magisk.utils.Topic;
import com.topjohnwu.net.Networking;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.ShellUtils;
import java.util.Locale;
@ -254,7 +253,7 @@ public class MagiskFragment extends BaseFragment
private void updateCheckUI() {
int image, color;
String status;
String status, button = "";
if (Config.remoteMagiskVersionCode < 0) {
color = colorNeutral;
@ -268,12 +267,12 @@ public class MagiskFragment extends BaseFragment
color = colorInfo;
image = R.drawable.ic_update;
status = getString(R.string.magisk_update_title);
magisk.install.setText(R.string.update);
button = getString(R.string.update);
} else {
color = colorOK;
image = R.drawable.ic_check_circle;
status = getString(R.string.magisk_up_to_date);
magisk.install.setText(R.string.install);
button = getString(R.string.install);
}
}
if (Config.magiskVersionCode > 0) {
@ -281,6 +280,7 @@ public class MagiskFragment extends BaseFragment
magisk.statusIcon.setImageResource(image);
magisk.statusIcon.setColorFilter(color);
magisk.status.setText(status);
magisk.install.setText(button);
}
if (Config.remoteManagerVersionCode < 0) {
@ -322,7 +322,8 @@ public class MagiskFragment extends BaseFragment
uninstallButton.setVisibility(Shell.rootAccess() ? View.VISIBLE : View.GONE);
}
if (!shownDialog && !ShellUtils.fastCmdResult("env_check")) {
if (!shownDialog && Config.magiskVersionCode > 0 &&
!Shell.su("env_check").exec().isSuccess()) {
shownDialog = true;
new EnvFixDialog(requireActivity()).show();
}

View File

@ -7,7 +7,7 @@ import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
import com.topjohnwu.net.Networking;
import com.topjohnwu.net.ResponseListener;
import com.topjohnwu.superuser.ShellUtils;
import com.topjohnwu.superuser.Shell;
import java.io.File;
@ -84,7 +84,7 @@ public class DownloadApp {
Config.export();
// Make it world readable
apk.setReadable(true, false);
if (ShellUtils.fastCmdResult("pm install " + apk))
if (Shell.su("pm install " + apk).exec().isSuccess())
RootUtils.rmAndLaunch(app.getPackageName(), BuildConfig.APPLICATION_ID);
progress.dismiss();
}

View File

@ -10,7 +10,7 @@ import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.uicomponents.Notifications;
import com.topjohnwu.signing.JarMap;
import com.topjohnwu.signing.SignAPK;
import com.topjohnwu.superuser.ShellUtils;
import com.topjohnwu.superuser.Shell;
import java.io.BufferedOutputStream;
import java.io.File;
@ -104,7 +104,7 @@ public class PatchAPK {
// Install the application
repack.setReadable(true, false);
if (!ShellUtils.fastCmdResult("pm install " + repack))
if (!Shell.su("pm install " + repack).exec().isSuccess())
return false;
Config.set(Config.Key.SU_MANAGER, pkg);

View File

@ -79,6 +79,7 @@
android:layout_marginTop="4dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="4dp"
android:visibility="gone"
app:cardCornerRadius="@dimen/card_corner_radius"
app:cardElevation="@dimen/card_elevation">