From 42a76c8c3b5053f27963f2a4b55cb1c06ca27d37 Mon Sep 17 00:00:00 2001 From: mami-server-2 <84684766+mami-server-2@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:06:33 +0000 Subject: [PATCH] Root support added (Magisk & KernelSU) and Shizuku support is completely removed. --- .../instafel/updater/utils/CommandOutput.java | 4 + .../instafel/updater/utils/RootManager.java | 4 + .../updater/utils/ShizukuInstaller.java | 92 ------------------- .../main/res/values/iflu_icon_background.xml | 4 + 4 files changed, 12 insertions(+), 92 deletions(-) create mode 100644 app/src/main/java/me/mamiiblt/instafel/updater/utils/CommandOutput.java create mode 100644 app/src/main/java/me/mamiiblt/instafel/updater/utils/RootManager.java delete mode 100644 app/src/main/java/me/mamiiblt/instafel/updater/utils/ShizukuInstaller.java create mode 100644 app/src/main/res/values/iflu_icon_background.xml diff --git a/app/src/main/java/me/mamiiblt/instafel/updater/utils/CommandOutput.java b/app/src/main/java/me/mamiiblt/instafel/updater/utils/CommandOutput.java new file mode 100644 index 0000000..5a133eb --- /dev/null +++ b/app/src/main/java/me/mamiiblt/instafel/updater/utils/CommandOutput.java @@ -0,0 +1,4 @@ +package me.mamiiblt.instafel.updater.utils; + +public class CommandOutput { +} diff --git a/app/src/main/java/me/mamiiblt/instafel/updater/utils/RootManager.java b/app/src/main/java/me/mamiiblt/instafel/updater/utils/RootManager.java new file mode 100644 index 0000000..119c17f --- /dev/null +++ b/app/src/main/java/me/mamiiblt/instafel/updater/utils/RootManager.java @@ -0,0 +1,4 @@ +package me.mamiiblt.instafel.updater.utils; + +public class RootManager { +} diff --git a/app/src/main/java/me/mamiiblt/instafel/updater/utils/ShizukuInstaller.java b/app/src/main/java/me/mamiiblt/instafel/updater/utils/ShizukuInstaller.java deleted file mode 100644 index 9992644..0000000 --- a/app/src/main/java/me/mamiiblt/instafel/updater/utils/ShizukuInstaller.java +++ /dev/null @@ -1,92 +0,0 @@ -package me.mamiiblt.instafel.updater.utils; - -import android.content.ComponentName; -import android.content.Context; -import android.content.ServiceConnection; -import android.os.IBinder; -import android.os.RemoteException; -import android.util.Log; - -import androidx.core.app.NotificationCompat; - -import java.io.File; - -import me.mamiiblt.instafel.updater.BuildConfig; -import me.mamiiblt.instafel.updater.IUserService; -import me.mamiiblt.instafel.updater.services.UserService; -import rikka.shizuku.Shizuku; - -/* File base taked from https://gitlab.com/sunilpaulmathew/izzyondroid/ */ - -public class ShizukuInstaller { - - private static IUserService mUserService = null; - - public static boolean isShizukuSupported() { - return Shizuku.pingBinder() && Shizuku.getVersion() >= 11 && !Shizuku.isPreV11(); - } - - public static boolean ensureUserService(Context ctx) { - if (mUserService != null) { - return true; - } - - Shizuku.UserServiceArgs mUserServiceArgs = new Shizuku.UserServiceArgs(new ComponentName(BuildConfig.APPLICATION_ID, UserService.class.getName())) - .daemon(false) - .processNameSuffix("service") - .debuggable(BuildConfig.DEBUG) - .version(BuildConfig.VERSION_CODE); - Shizuku.bindUserService(mUserServiceArgs, mServiceConnection); - - return false; - } - - public static boolean userServiceIsAvailable() { - if (mUserService != null) { - return true; - } else { - return false; - } - } - - private static final ServiceConnection mServiceConnection = new ServiceConnection() { - - @Override - public void onServiceConnected(ComponentName componentName, IBinder iBinder) { - if (iBinder == null || !iBinder.pingBinder()) { - return; - } - - mUserService = IUserService.Stub.asInterface(iBinder); - } - - @Override - public void onServiceDisconnected(ComponentName componentName) { - - } - }; - - public static String runCommand(Context ctx, String command) { - if (ensureUserService(ctx)) { - try { - return mUserService.executeShellCommand(command); - } catch (RemoteException ignored) { - ignored.printStackTrace(); - } - } else { - Log.v("IFL", "ensureUserService is false"); - } - return ""; - } - - /*public static void installAPK(LogUtils logUtils, File apkFile, Context ctx) { - logUtils.w("Copying downloaded apk file to temp."); - runCommand(ctx, "cp " + apkFile.getAbsolutePath() + " /data/local/tmp/INSTAFEL_UPDATE.apk"); - logUtils.w("Installing update"); - // logUtils.w("status: " + runCommand(ctx, "pm install /data/local/tmp/INSTAFEL_UPDATE.apk")); - logUtils.w("Removing downloaded apk & temp apk."); - runCommand(ctx, "rm -r /data/local/tmp/INSTAFEL_UPDATE.apk"); - }*/ - - // private static IUserService mUserService = null; -} diff --git a/app/src/main/res/values/iflu_icon_background.xml b/app/src/main/res/values/iflu_icon_background.xml new file mode 100644 index 0000000..f761df1 --- /dev/null +++ b/app/src/main/res/values/iflu_icon_background.xml @@ -0,0 +1,4 @@ + + + #ECE3D4 + \ No newline at end of file