mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-13 04:53:38 +00:00
Some minor adjustments
This commit is contained in:
parent
e39d2567ea
commit
1e94f0a094
@ -8,7 +8,6 @@ import android.database.sqlite.SQLiteOpenHelper;
|
|||||||
import com.topjohnwu.magisk.Config;
|
import com.topjohnwu.magisk.Config;
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.container.Repo;
|
import com.topjohnwu.magisk.container.Repo;
|
||||||
import com.topjohnwu.superuser.internal.UiThreadHandler;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -35,7 +35,8 @@ public abstract class FlashZip {
|
|||||||
|
|
||||||
private boolean unzipAndCheck() throws IOException {
|
private boolean unzipAndCheck() throws IOException {
|
||||||
ZipUtils.unzip(tmpFile, tmpFile.getParentFile(), "META-INF/com/google/android", true);
|
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 {
|
private boolean flash() throws IOException {
|
||||||
|
@ -30,7 +30,6 @@ import com.topjohnwu.magisk.utils.AppUtils;
|
|||||||
import com.topjohnwu.magisk.utils.Topic;
|
import com.topjohnwu.magisk.utils.Topic;
|
||||||
import com.topjohnwu.net.Networking;
|
import com.topjohnwu.net.Networking;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -254,7 +253,7 @@ public class MagiskFragment extends BaseFragment
|
|||||||
|
|
||||||
private void updateCheckUI() {
|
private void updateCheckUI() {
|
||||||
int image, color;
|
int image, color;
|
||||||
String status;
|
String status, button = "";
|
||||||
|
|
||||||
if (Config.remoteMagiskVersionCode < 0) {
|
if (Config.remoteMagiskVersionCode < 0) {
|
||||||
color = colorNeutral;
|
color = colorNeutral;
|
||||||
@ -268,12 +267,12 @@ public class MagiskFragment extends BaseFragment
|
|||||||
color = colorInfo;
|
color = colorInfo;
|
||||||
image = R.drawable.ic_update;
|
image = R.drawable.ic_update;
|
||||||
status = getString(R.string.magisk_update_title);
|
status = getString(R.string.magisk_update_title);
|
||||||
magisk.install.setText(R.string.update);
|
button = getString(R.string.update);
|
||||||
} else {
|
} else {
|
||||||
color = colorOK;
|
color = colorOK;
|
||||||
image = R.drawable.ic_check_circle;
|
image = R.drawable.ic_check_circle;
|
||||||
status = getString(R.string.magisk_up_to_date);
|
status = getString(R.string.magisk_up_to_date);
|
||||||
magisk.install.setText(R.string.install);
|
button = getString(R.string.install);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Config.magiskVersionCode > 0) {
|
if (Config.magiskVersionCode > 0) {
|
||||||
@ -281,6 +280,7 @@ public class MagiskFragment extends BaseFragment
|
|||||||
magisk.statusIcon.setImageResource(image);
|
magisk.statusIcon.setImageResource(image);
|
||||||
magisk.statusIcon.setColorFilter(color);
|
magisk.statusIcon.setColorFilter(color);
|
||||||
magisk.status.setText(status);
|
magisk.status.setText(status);
|
||||||
|
magisk.install.setText(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.remoteManagerVersionCode < 0) {
|
if (Config.remoteManagerVersionCode < 0) {
|
||||||
@ -322,7 +322,8 @@ public class MagiskFragment extends BaseFragment
|
|||||||
uninstallButton.setVisibility(Shell.rootAccess() ? View.VISIBLE : View.GONE);
|
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;
|
shownDialog = true;
|
||||||
new EnvFixDialog(requireActivity()).show();
|
new EnvFixDialog(requireActivity()).show();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import com.topjohnwu.magisk.R;
|
|||||||
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
|
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
|
||||||
import com.topjohnwu.net.Networking;
|
import com.topjohnwu.net.Networking;
|
||||||
import com.topjohnwu.net.ResponseListener;
|
import com.topjohnwu.net.ResponseListener;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class DownloadApp {
|
|||||||
Config.export();
|
Config.export();
|
||||||
// Make it world readable
|
// Make it world readable
|
||||||
apk.setReadable(true, false);
|
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);
|
RootUtils.rmAndLaunch(app.getPackageName(), BuildConfig.APPLICATION_ID);
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import com.topjohnwu.magisk.R;
|
|||||||
import com.topjohnwu.magisk.uicomponents.Notifications;
|
import com.topjohnwu.magisk.uicomponents.Notifications;
|
||||||
import com.topjohnwu.signing.JarMap;
|
import com.topjohnwu.signing.JarMap;
|
||||||
import com.topjohnwu.signing.SignAPK;
|
import com.topjohnwu.signing.SignAPK;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -104,7 +104,7 @@ public class PatchAPK {
|
|||||||
|
|
||||||
// Install the application
|
// Install the application
|
||||||
repack.setReadable(true, false);
|
repack.setReadable(true, false);
|
||||||
if (!ShellUtils.fastCmdResult("pm install " + repack))
|
if (!Shell.su("pm install " + repack).exec().isSuccess())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Config.set(Config.Key.SU_MANAGER, pkg);
|
Config.set(Config.Key.SU_MANAGER, pkg);
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:cardCornerRadius="@dimen/card_corner_radius"
|
app:cardCornerRadius="@dimen/card_corner_radius"
|
||||||
app:cardElevation="@dimen/card_elevation">
|
app:cardElevation="@dimen/card_elevation">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user