From 9c93b65206261c4e135a6a5d250c518024c4c1bf Mon Sep 17 00:00:00 2001
From: tehcneko <7764726+tehcneko@users.noreply.github.com>
Date: Tue, 2 Feb 2021 12:20:36 +0800
Subject: [PATCH] Remove "optimize all" and reboot menus (#43)
* Remove "optimize all" menus
* Remove reboot menus
---
app/src/main/AndroidManifest.xml | 4 -
.../java/io/github/lsposed/manager/App.java | 12 +-
.../manager/adapters/ScopeAdapter.java | 6 -
.../manager/ui/activity/BaseActivity.java | 28 -----
.../manager/ui/activity/MainActivity.java | 8 --
.../manager/ui/activity/ModulesActivity.java | 11 +-
.../ui/fragment/CompileDialogFragment.java | 24 +---
.../lsposed/manager/util/CompileUtil.java | 115 +-----------------
.../manager/util/NotificationUtil.java | 55 +--------
.../lsposed/manager/util/RebootUtil.java | 98 ---------------
app/src/main/res/drawable/ic_more.xml | 10 --
app/src/main/res/layout/activity_main.xml | 14 ---
app/src/main/res/menu/menu_app_item.xml | 6 -
app/src/main/res/menu/menu_app_list.xml | 55 ---------
app/src/main/res/menu/menu_installer.xml | 61 ----------
app/src/main/res/menu/menu_modules.xml | 78 ------------
app/src/main/res/values-zh-rCN/strings.xml | 20 ---
app/src/main/res/values-zh-rHK/strings.xml | 18 ---
app/src/main/res/values-zh-rTW/strings.xml | 18 ---
app/src/main/res/values/strings.xml | 20 ---
20 files changed, 15 insertions(+), 646 deletions(-)
delete mode 100644 app/src/main/java/io/github/lsposed/manager/util/RebootUtil.java
delete mode 100644 app/src/main/res/drawable/ic_more.xml
delete mode 100644 app/src/main/res/menu/menu_installer.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b4631855..d2261b8f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -53,10 +53,6 @@
-
-
= 11) {
if (Shizuku.checkSelfPermission() == PERMISSION_GRANTED) {
@@ -52,7 +46,7 @@ public class App extends Application {
} else if (Shizuku.shouldShowRequestPermissionRationale()) {
return -1;
} else {
- Shizuku.requestPermission(requestCode);
+ Shizuku.requestPermission(code);
return -1;
}
}
diff --git a/app/src/main/java/io/github/lsposed/manager/adapters/ScopeAdapter.java b/app/src/main/java/io/github/lsposed/manager/adapters/ScopeAdapter.java
index d74267db..f6b1cec6 100644
--- a/app/src/main/java/io/github/lsposed/manager/adapters/ScopeAdapter.java
+++ b/app/src/main/java/io/github/lsposed/manager/adapters/ScopeAdapter.java
@@ -243,10 +243,6 @@ public class ScopeAdapter extends RecyclerView.Adapter
if (launchIntent != null) {
activity.startActivity(launchIntent);
}
- } else if (itemId == R.id.app_menu_compile_speed) {
- CompileUtil.compileSpeed(activity, activity.getSupportFragmentManager(), info);
- } else if (itemId == R.id.app_menu_compile_dexopt) {
- CompileUtil.compileDexopt(activity, activity.getSupportFragmentManager(), info);
} else if (itemId == R.id.app_menu_compile_reset) {
CompileUtil.reset(activity, activity.getSupportFragmentManager(), info);
} else if (itemId == R.id.app_menu_store) {
@@ -352,8 +348,6 @@ public class ScopeAdapter extends RecyclerView.Adapter
menu.removeItem(R.id.app_menu_launch);
}
if (android) {
- menu.removeItem(R.id.app_menu_compile_speed);
- menu.removeItem(R.id.app_menu_compile_dexopt);
menu.removeItem(R.id.app_menu_compile_reset);
menu.removeItem(R.id.app_menu_store);
}
diff --git a/app/src/main/java/io/github/lsposed/manager/ui/activity/BaseActivity.java b/app/src/main/java/io/github/lsposed/manager/ui/activity/BaseActivity.java
index 8d5a0bf9..5d822f27 100644
--- a/app/src/main/java/io/github/lsposed/manager/ui/activity/BaseActivity.java
+++ b/app/src/main/java/io/github/lsposed/manager/ui/activity/BaseActivity.java
@@ -8,10 +8,8 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle;
-import android.view.MenuItem;
import android.view.View;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
@@ -28,10 +26,8 @@ import java.util.Objects;
import io.github.lsposed.manager.App;
import io.github.lsposed.manager.R;
-import io.github.lsposed.manager.util.CompileUtil;
import io.github.lsposed.manager.util.CustomThemeColor;
import io.github.lsposed.manager.util.CustomThemeColors;
-import io.github.lsposed.manager.util.RebootUtil;
public class BaseActivity extends AppCompatActivity {
@@ -172,28 +168,4 @@ public class BaseActivity extends AppCompatActivity {
.setNegativeButton(android.R.string.cancel, null)
.show();
}
-
- @Override
- public boolean onOptionsItemSelected(@NonNull MenuItem item) {
- int itemId = item.getItemId();
- if (itemId == R.id.dexopt_all) {
- CompileUtil.compileAllDexopt(this);
- } else if (itemId == R.id.speed_all) {
- CompileUtil.compileAllSpeed(this);
- } else if (itemId == R.id.reboot) {
- areYouSure(R.string.reboot, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.NORMAL));
- } else if (itemId == R.id.soft_reboot) {
- areYouSure(R.string.soft_reboot, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.USERSPACE));
- } else if (itemId == R.id.reboot_recovery) {
- areYouSure(R.string.reboot_recovery, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.RECOVERY));
- } else if (itemId == R.id.reboot_bootloader) {
- areYouSure(R.string.reboot_bootloader, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.BOOTLOADER));
- } else if (itemId == R.id.reboot_download) {
- areYouSure(R.string.reboot_download, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.DOWNLOAD));
- } else if (itemId == R.id.reboot_edl) {
- areYouSure(R.string.reboot_edl, (dialog, which) -> RebootUtil.reboot(RebootUtil.RebootType.EDL));
- }
-
- return super.onOptionsItemSelected(item);
- }
}
diff --git a/app/src/main/java/io/github/lsposed/manager/ui/activity/MainActivity.java b/app/src/main/java/io/github/lsposed/manager/ui/activity/MainActivity.java
index 4a850c17..4baa4a35 100644
--- a/app/src/main/java/io/github/lsposed/manager/ui/activity/MainActivity.java
+++ b/app/src/main/java/io/github/lsposed/manager/ui/activity/MainActivity.java
@@ -4,8 +4,6 @@ import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
-import androidx.appcompat.widget.PopupMenu;
-import androidx.appcompat.widget.TooltipCompat;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
@@ -60,12 +58,6 @@ public class MainActivity extends BaseActivity {
intent.setClass(getApplicationContext(), AboutActivity.class);
startActivity(intent);
});
- TooltipCompat.setTooltipText(binding.menuMore, getString(androidx.appcompat.R.string.abc_action_menu_overflow_description));
- PopupMenu appMenu = new PopupMenu(MainActivity.this, binding.menuMore);
- appMenu.inflate(R.menu.menu_installer);
- appMenu.setOnMenuItemClickListener(this::onOptionsItemSelected);
- binding.menuMore.setOnTouchListener(appMenu.getDragToOpenListener());
- binding.menuMore.setOnClickListener(v -> appMenu.show());
Glide.with(binding.appIcon)
.load(GlideHelper.wrapApplicationInfoForIconLoader(getApplicationInfo()))
.into(binding.appIcon);
diff --git a/app/src/main/java/io/github/lsposed/manager/ui/activity/ModulesActivity.java b/app/src/main/java/io/github/lsposed/manager/ui/activity/ModulesActivity.java
index b3398e4c..3ebbdb40 100644
--- a/app/src/main/java/io/github/lsposed/manager/ui/activity/ModulesActivity.java
+++ b/app/src/main/java/io/github/lsposed/manager/ui/activity/ModulesActivity.java
@@ -67,7 +67,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
}
}
}
- Comparator cmp = AppHelper.getAppListComparator(preferences.getInt("list_sort", 0), pm);
+ Comparator cmp = AppHelper.getAppListComparator(0, pm);
fullList.sort((a, b) -> {
boolean aChecked = moduleUtil.isModuleEnabled(a.packageName);
boolean bChecked = moduleUtil.isModuleEnabled(b.packageName);
@@ -160,15 +160,6 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
return super.onCreateOptionsMenu(menu);
}
- @Override
- public boolean onOptionsItemSelected(@NonNull MenuItem item) {
- if (AppHelper.onOptionsItemSelected(item, preferences)) {
- moduleUtil.updateModulesList(false, null);
- reloadModules.run();
- }
- return super.onOptionsItemSelected(item);
- }
-
@Override
public void onDestroy() {
super.onDestroy();
diff --git a/app/src/main/java/io/github/lsposed/manager/ui/fragment/CompileDialogFragment.java b/app/src/main/java/io/github/lsposed/manager/ui/fragment/CompileDialogFragment.java
index 7f77a641..56e5d974 100644
--- a/app/src/main/java/io/github/lsposed/manager/ui/fragment/CompileDialogFragment.java
+++ b/app/src/main/java/io/github/lsposed/manager/ui/fragment/CompileDialogFragment.java
@@ -36,8 +36,6 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
// TODO:
private static final String COMPILE_COMMAND_PREFIX = "cmd package ";
private static final String COMPILE_RESET_COMMAND = COMPILE_COMMAND_PREFIX + "compile --reset ";
- private static final String COMPILE_SPEED_COMMAND = COMPILE_COMMAND_PREFIX + "compile -f -m speed ";
- private static final String COMPILE_DEXOPT_COMMAND = COMPILE_COMMAND_PREFIX + "force-dex-opt ";
private static final String KEY_APP_INFO = "app_info";
private static final String KEY_MSG = "msg";
@@ -91,18 +89,10 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
try {
boolean checkProfiles = ShizukuSystemProperties.getBoolean("dalvik.vm.usejitprofiles", false);
- switch (mode) {
- case RESET:
- CompileUtil.PACKAGE_MANAGER.get().clearApplicationProfileData(appInfo.packageName);
- String filter = ShizukuSystemProperties.get("pm.dexopt.install");
- CompileUtil.PACKAGE_MANAGER.get().performDexOptMode(appInfo.packageName, checkProfiles, filter, true, true, null);
- break;
- case SPEED:
- CompileUtil.PACKAGE_MANAGER.get().performDexOptMode(appInfo.packageName, checkProfiles, "speed", true, true, null);
- break;
- case DEXOPT:
- CompileUtil.PACKAGE_MANAGER.get().forceDexOpt(appInfo.packageName);
- break;
+ if (mode == CompileUtil.CompileType.RESET) {
+ CompileUtil.PACKAGE_MANAGER.get().clearApplicationProfileData(appInfo.packageName);
+ String filter = ShizukuSystemProperties.get("pm.dexopt.install");
+ CompileUtil.PACKAGE_MANAGER.get().performDexOptMode(appInfo.packageName, checkProfiles, filter, true, true, null);
}
App.runOnUiThread(() -> {
ToastUtil.showLongToast(App.getInstance(), R.string.done);
@@ -129,7 +119,7 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
if (arguments != null) {
int type = arguments.getInt(KEY_TYPE);
appInfo = arguments.getParcelable(KEY_APP_INFO);
- int result = App.checkPermission(type, 1);
+ int result = App.checkPermission(type);
switch (result) {
case 0:
onRequestPermissionsResult(type, PERMISSION_GRANTED);
@@ -151,10 +141,6 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
String command = null;
if (type == CompileUtil.CompileType.RESET) {
command = COMPILE_RESET_COMMAND + appInfo.packageName;
- } else if (type == CompileUtil.CompileType.DEXOPT) {
- command = COMPILE_DEXOPT_COMMAND + appInfo.packageName;
- } else if (type == CompileUtil.CompileType.SPEED) {
- command = COMPILE_SPEED_COMMAND + appInfo.packageName;
}
if (command != null) {
new CompileTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, command);
diff --git a/app/src/main/java/io/github/lsposed/manager/util/CompileUtil.java b/app/src/main/java/io/github/lsposed/manager/util/CompileUtil.java
index ca9e20f0..6d485fcb 100644
--- a/app/src/main/java/io/github/lsposed/manager/util/CompileUtil.java
+++ b/app/src/main/java/io/github/lsposed/manager/util/CompileUtil.java
@@ -1,41 +1,21 @@
package io.github.lsposed.manager.util;
-import android.annotation.SuppressLint;
-import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
-import android.os.AsyncTask;
-import android.widget.Toast;
-import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager;
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-import com.topjohnwu.superuser.Shell;
-
-import java.util.List;
-
-import io.github.lsposed.manager.App;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.ui.fragment.CompileDialogFragment;
import rikka.shizuku.ShizukuBinderWrapper;
-import rikka.shizuku.ShizukuSystemProperties;
import rikka.shizuku.SystemServiceHelper;
-import static android.content.pm.PackageManager.PERMISSION_DENIED;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-
-@SuppressWarnings("deprecation")
public class CompileUtil {
// TODO:
public enum CompileType {
- RESET,
- SPEED,
- DEXOPT,
- SPEED_ALL,
- DEXOPT_ALL;
+ RESET;
@Override
public String toString() {
@@ -54,53 +34,8 @@ public class CompileUtil {
}
};
- @SuppressLint("StaticFieldLeak")
- private static Activity sActivity;
-
public static void onRequestPermissionsResult(int requestCode, int grantResult) {
- CompileUtil.CompileType mode = CompileUtil.CompileType.values()[requestCode];
- if (mode == CompileType.DEXOPT_ALL || mode == CompileType.SPEED_ALL) {
- AlertDialog dialog = new MaterialAlertDialogBuilder(sActivity)
- .setTitle(R.string.speed_now)
- .setMessage(R.string.this_may_take_a_while)
- .setCancelable(false)
- .show();
- AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
- if (grantResult == PERMISSION_GRANTED) {
- try {
- IPackageManager packageManager = PACKAGE_MANAGER.get();
- if (mode == CompileType.DEXOPT_ALL) {
- packageManager.runBackgroundDexoptJob(null);
- } else {
- boolean checkProfiles = ShizukuSystemProperties.getBoolean("dalvik.vm.usejitprofiles", false);
- List list = packageManager.getAllPackages();
- for (String packageName : list) {
- CompileUtil.PACKAGE_MANAGER.get().performDexOptMode(packageName, checkProfiles, "speed", true, true, null);
- }
- }
- dialog.dismiss();
- App.runOnUiThread(() -> Toast.makeText(sActivity, R.string.done, Toast.LENGTH_LONG).show());
- return;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (!Shell.rootAccess()) {
- dialog.dismiss();
- App.runOnUiThread(() -> Toast.makeText(sActivity, R.string.root_failed, Toast.LENGTH_LONG).show());
- return;
- }
-
- if (mode == CompileType.SPEED_ALL) {
- Shell.su("cmd package compile -m speed -a").exec();
- } else {
- Shell.su("cmd package bg-dexopt-job").exec();
- }
-
- dialog.dismiss();
- App.runOnUiThread(() -> Toast.makeText(sActivity, R.string.done, Toast.LENGTH_LONG).show());
- });
- } else if (instance != null) {
+ if (instance != null) {
instance.onRequestPermissionsResult(requestCode, grantResult);
}
}
@@ -108,52 +43,12 @@ public class CompileUtil {
public static void reset(Context context, FragmentManager fragmentManager,
ApplicationInfo info) {
compilePackageInBg(fragmentManager, info,
- context.getString(R.string.compile_reset_msg), CompileType.RESET);
- }
-
- public static void compileSpeed(Context context, FragmentManager fragmentManager,
- ApplicationInfo info) {
- compilePackageInBg(fragmentManager, info,
- context.getString(R.string.compile_speed_msg), CompileType.SPEED);
- }
-
- public static void compileDexopt(Context context, FragmentManager fragmentManager,
- ApplicationInfo info) {
- compilePackageInBg(fragmentManager, info,
- context.getString(R.string.compile_speed_msg), CompileType.DEXOPT);
- }
-
- public static void compileAllDexopt(Activity activity) {
- sActivity = activity;
- int type = CompileType.DEXOPT_ALL.ordinal();
- int result = App.checkPermission(type, 1);
- switch (result) {
- case 0:
- onRequestPermissionsResult(type, PERMISSION_GRANTED);
- break;
- case -2:
- onRequestPermissionsResult(type, PERMISSION_DENIED);
- break;
- }
- }
-
- public static void compileAllSpeed(Activity activity) {
- sActivity = activity;
- int type = CompileType.SPEED_ALL.ordinal();
- int result = App.checkPermission(type, 1);
- switch (result) {
- case 0:
- onRequestPermissionsResult(type, PERMISSION_GRANTED);
- break;
- case -2:
- onRequestPermissionsResult(type, PERMISSION_DENIED);
- break;
- }
+ context.getString(R.string.compile_reset_msg));
}
private static void compilePackageInBg(FragmentManager fragmentManager,
- ApplicationInfo info, String msg, CompileType type) {
- instance = CompileDialogFragment.newInstance(info, msg, type);
+ ApplicationInfo info, String msg) {
+ instance = CompileDialogFragment.newInstance(info, msg, CompileType.RESET);
instance.show(fragmentManager, TAG_COMPILE_DIALOG);
}
diff --git a/app/src/main/java/io/github/lsposed/manager/util/NotificationUtil.java b/app/src/main/java/io/github/lsposed/manager/util/NotificationUtil.java
index e3f33a95..8e41cf02 100644
--- a/app/src/main/java/io/github/lsposed/manager/util/NotificationUtil.java
+++ b/app/src/main/java/io/github/lsposed/manager/util/NotificationUtil.java
@@ -3,21 +3,16 @@ package io.github.lsposed.manager.util;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.util.Log;
import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
-import com.topjohnwu.superuser.Shell;
-
import io.github.lsposed.manager.App;
import io.github.lsposed.manager.R;
-import io.github.lsposed.manager.ui.activity.MainActivity;
import io.github.lsposed.manager.ui.activity.ModulesActivity;
@SuppressLint("UnspecifiedImmutableFlag")
@@ -27,9 +22,6 @@ public final class NotificationUtil {
private static final int NOTIFICATION_MODULES_UPDATED = 1;
private static final int PENDING_INTENT_OPEN_MODULES = 0;
private static final int PENDING_INTENT_OPEN_INSTALL = 1;
- private static final int PENDING_INTENT_SOFT_REBOOT = 2;
- private static final int PENDING_INTENT_REBOOT = 3;
-
private static final String NOTIFICATION_MODULES_CHANNEL = "modules_channel_2";
@SuppressLint("StaticFieldLeak")
@@ -53,14 +45,6 @@ public final class NotificationUtil {
notificationManager.createNotificationChannel(channel.build());
}
- public static void cancel(String tag, int id) {
- notificationManager.cancel(tag, id);
- }
-
- public static void cancelAll() {
- notificationManager.cancelAll();
- }
-
public static void showNotActivatedNotification(String packageName, String appName) {
Intent intent = new Intent(context, ModulesActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -80,7 +64,7 @@ public final class NotificationUtil {
}
public static void showModulesUpdatedNotification(String appName) {
- Intent intent = new Intent(context, MainActivity.class)
+ Intent intent = new Intent(context, ModulesActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pInstallTab = PendingIntent.getActivity(context, PENDING_INTENT_OPEN_INSTALL, intent, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -90,18 +74,6 @@ public final class NotificationUtil {
NotificationCompat.Builder builder = getNotificationBuilder(title, appName)
.setContentIntent(pInstallTab);
- Intent iSoftReboot = new Intent(context, RebootReceiver.class);
- iSoftReboot.putExtra(RebootReceiver.EXTRA_SOFT_REBOOT, true);
- PendingIntent pSoftReboot = PendingIntent.getBroadcast(context, PENDING_INTENT_SOFT_REBOOT,
- iSoftReboot, PendingIntent.FLAG_UPDATE_CURRENT);
-
- Intent iReboot = new Intent(context, RebootReceiver.class);
- PendingIntent pReboot = PendingIntent.getBroadcast(context, PENDING_INTENT_REBOOT,
- iReboot, PendingIntent.FLAG_UPDATE_CURRENT);
-
- builder.addAction(new NotificationCompat.Action.Builder(0, context.getString(R.string.reboot), pReboot).build());
- builder.addAction(new NotificationCompat.Action.Builder(0, context.getString(R.string.soft_reboot), pSoftReboot).build());
-
notificationManager.notify(null, NOTIFICATION_MODULES_UPDATED, builder.build());
}
@@ -115,29 +87,4 @@ public final class NotificationUtil {
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
-
- public static class RebootReceiver extends BroadcastReceiver {
- public static String EXTRA_SOFT_REBOOT = "soft";
-
- @Override
- public void onReceive(Context context, Intent intent) {
- /*
- * Close the notification bar in order to see the toast that module
- * was enabled successfully. Furthermore, if SU permissions haven't
- * been granted yet, the SU dialog will be prompted behind the
- * expanded notification panel and is therefore not visible to the
- * user.
- */
- context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
- cancelAll();
-
- if (!Shell.rootAccess()) {
- Log.e(App.TAG, "NotificationUtil -> Could not start root shell");
- return;
- }
-
- boolean softReboot = intent.getBooleanExtra(EXTRA_SOFT_REBOOT, false);
- RebootUtil.reboot(softReboot ? RebootUtil.RebootType.USERSPACE : RebootUtil.RebootType.NORMAL);
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/io/github/lsposed/manager/util/RebootUtil.java b/app/src/main/java/io/github/lsposed/manager/util/RebootUtil.java
deleted file mode 100644
index a9da34ae..00000000
--- a/app/src/main/java/io/github/lsposed/manager/util/RebootUtil.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package io.github.lsposed.manager.util;
-
-import android.content.Context;
-import android.os.Build;
-import android.os.IPowerManager;
-import android.os.PowerManager;
-import android.os.RemoteException;
-
-import com.topjohnwu.superuser.Shell;
-
-import io.github.lsposed.manager.App;
-import io.github.lsposed.manager.BuildConfig;
-import rikka.shizuku.ShizukuBinderWrapper;
-import rikka.shizuku.ShizukuSystemProperties;
-import rikka.shizuku.SystemServiceHelper;
-
-import static android.content.pm.PackageManager.PERMISSION_DENIED;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-
-public class RebootUtil {
- public enum RebootType {
- NORMAL,
- USERSPACE,
- RECOVERY,
- BOOTLOADER,
- DOWNLOAD,
- EDL;
-
- @Override
- public String toString() {
- return super.toString().toLowerCase();
- }
- }
-
- public static void onRequestPermissionsResult(int requestCode, int grantResult) {
- RebootType mode = RebootType.values()[requestCode];
- if (grantResult == PERMISSION_GRANTED) {
- try {
- if (mode == RebootType.USERSPACE && !supportUserspaceReboot()) {
- ShizukuSystemProperties.set("ctl.restart", "surfaceflinger");
- } else {
- POWER_MANAGER.get().reboot(BuildConfig.DEBUG, mode.toString(), false);
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- rebootWithShell(mode);
- }
- } else {
- rebootWithShell(mode);
- }
- }
-
- private static final Singleton POWER_MANAGER = new Singleton() {
- @Override
- protected IPowerManager create() {
- return IPowerManager.Stub.asInterface(new ShizukuBinderWrapper(SystemServiceHelper.getSystemService(Context.POWER_SERVICE)));
- }
- };
-
-
- public static void reboot(RebootType mode) {
- int result = App.checkPermission(mode.ordinal(), 0);
- switch (result) {
- case 0:
- onRequestPermissionsResult(mode.ordinal(), PERMISSION_GRANTED);
- break;
- case -2:
- onRequestPermissionsResult(mode.ordinal(), PERMISSION_DENIED);
- break;
- }
- }
-
- private static void rebootWithShell(RebootType mode) {
- if (!Shell.rootAccess()) {
- return;
- }
- String command;
- if (mode == RebootType.USERSPACE) {
- if (supportUserspaceReboot()) {
- command = "/system/bin/svc power reboot userspace";
- } else {
- command = "setprop ctl.restart surfaceflinger";
- }
- } else if (mode == RebootType.NORMAL) {
- command = "/system/bin/svc power reboot";
- } else if (mode == RebootType.RECOVERY) {
- Shell.su("touch /cache/recovery/boot").exec();
- command = "/system/bin/svc power recovery";
- } else {
- command = "/system/bin/svc power reboot " + mode.toString();
- }
- Shell.su(command).exec();
- }
-
- private static boolean supportUserspaceReboot() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && ((PowerManager) App.getInstance().getSystemService(Context.POWER_SERVICE)).isRebootingUserspaceSupported();
- }
-}
diff --git a/app/src/main/res/drawable/ic_more.xml b/app/src/main/res/drawable/ic_more.xml
deleted file mode 100644
index 14ff51ef..00000000
--- a/app/src/main/res/drawable/ic_more.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 713d32de..d55f2399 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -46,20 +46,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textSize="20sp"
tools:ignore="RelativeOverlap" />
-
-
-
-
diff --git a/app/src/main/res/menu/menu_app_list.xml b/app/src/main/res/menu/menu_app_list.xml
index 8b97ca7a..fcd05f8b 100644
--- a/app/src/main/res/menu/menu_app_list.xml
+++ b/app/src/main/res/menu/menu_app_list.xml
@@ -76,59 +76,4 @@
-
- -
-
-
-
- -
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_installer.xml b/app/src/main/res/menu/menu_installer.xml
deleted file mode 100644
index aee79b2c..00000000
--- a/app/src/main/res/menu/menu_installer.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_modules.xml b/app/src/main/res/menu/menu_modules.xml
index 905bbbf5..67714a43 100644
--- a/app/src/main/res/menu/menu_modules.xml
+++ b/app/src/main/res/menu/menu_modules.xml
@@ -7,82 +7,4 @@
android:title="@string/menuSearch"
app:actionViewClass="androidx.appcompat.widget.SearchView"
app:showAsAction="ifRoom" />
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 31a69c1b..dbb112f5 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -21,14 +21,11 @@
模块日志
- 软重启
- 重启
您确定?
请小心!
不再提示
- 无法获取 root 权限\n\n请确认您的设备已正确 root 且没有阻止 shell 命令
LSPosed 模块尚未激活
@@ -74,20 +71,11 @@
此模块因被安装在 SD 卡中而导致无法加载, 请将其移动到内部存储
- 导出…
- 导出已启用模块列表
- 导出已安装模块列表
- 没有任何已安装的模块
- 没有任何已启用的模块
信息
LSPosed 框架未安装
滚动到顶部
- 重启至恢复模式
- 重启至引导加载器
- 重启至下载模式
- 重启至救援模式
正在加载…
滚动到底部
关闭状态检查
@@ -96,8 +84,6 @@
取消优化
- 以 Speed 模式优化应用
- 以 Dexopt 模式优化应用
清除中…
优化中…
LSPosed 框架未安装
@@ -105,9 +91,6 @@
引导验证已禁用
无法获取引导验证状态
完成!
- 以 Dexopt 模式优化全部应用
- 以 Speed 模式优化全部应用
- 请稍后, 这将需要一段时间…
禁用详细日志
无法读取日志: \n
@@ -115,7 +98,6 @@
优化失败或返回值为空
优化失败:
未安装
- 重启至系统
禁用模块日志
模块抛出的的异常堆栈仍将正常抓取
跟随系统
@@ -139,9 +121,7 @@
启用资源钩子
警告: 资源钩子已被弃用
变体
- 优化…
系统应用
- 重启…
排序…
启用模块
未选择任何应用。继续?
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 0e781260..4b60a4fe 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -21,14 +21,11 @@
模塊日誌
- 軟重啟
- 重啟
您確定?
請小心!
不再提示
- 無法獲取 root 權限\n\n請確認您的設備已正確 root 且沒有阻止 shell 命令
LSPosed 模塊尚未激活
@@ -73,20 +70,11 @@
此模塊因被安裝在 SD 卡中而導致無法加載, 請將其移動到內部存儲
- 導出…
- 導出已啟用模塊列表
- 導出已安裝模塊列表
- 沒有任何已安裝的模塊
- 沒有任何已啟用的模塊
信息
LSPosed 框架未安裝
滾動到頂部
- 重啟至恢復模式
- 重啟至引導加載器
- 重啟至下載模式
- 重啟至救援模式
正在加載…
滾動到底部
關閉狀態檢查
@@ -95,8 +83,6 @@
取消優化
- 以 Speed 模式優化應用
- 以 Dexopt 模式優化應用
清除中…
優化中…
LSPosed 框架未安裝
@@ -104,16 +90,12 @@
引導驗證已禁用
無法獲取引導驗證狀態
完成!
- 以 Dexopt 模式優化全部應用
- 以 Speed 模式優化全部應用
- 請稍後, 這將需要一段時間…
禁用詳細日誌
無法讀取日誌: \n
運行
優化失敗或返回值為空
未安裝
- 重啟至系統
禁用模塊日誌
模塊拋出的的異常堆棧仍將正常抓取
跟隨系統
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 900e4815..68c09c63 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -21,14 +21,11 @@
模組日誌
- 軟重啟
- 重啟
您確定?
請小心!
不再提示
- 無法獲取 root 許可權\n\n請確認您的裝置已正確 root 且沒有阻止 shell 命令
LSPosed 模組尚未啟用
@@ -73,20 +70,11 @@
此模組因被安裝在 SD 卡中而導致無法載入, 請將其移動到內部儲存
- 匯出…
- 匯出已啟用模組列表
- 匯出已安裝模組列表
- 沒有任何已安裝的模組
- 沒有任何已啟用的模組
資訊
LSPosed 框架未安裝
滾動到頂部
- 重啟至恢復模式
- 重啟至引導載入器
- 重啟至下載模式
- 重啟至救援模式
正在載入…
滾動到底部
關閉狀態檢查
@@ -95,8 +83,6 @@
取消優化
- 以 Speed 模式優化 App
- 以 Dexopt 模式優化 App
清除中…
優化中…
LSPosed 框架未安裝
@@ -104,16 +90,12 @@
引導驗證已禁用
無法獲取引導驗證狀態
完成!
- 以 Dexopt 模式優化全部 App
- 以 Speed 模式優化全部 App
- 請稍後, 這將需要一段時間…
禁用詳細日誌
無法讀取日誌: \n
執行
優化失敗或返回值為空
未安裝
- 重啟至系統
禁用模組日誌
模組丟擲的的異常堆疊仍將正常抓取
跟隨系統
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 32919f55..9aacca07 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -22,14 +22,11 @@
Modules Logs
- Soft reboot
- Reboot
Are you sure?
Be careful!
Don\'t show this again
- Failed to get root access\n\nMake sure your device is rooted properly and you have not blocked shell commands
LSPosed module is not activated yet
@@ -77,20 +74,11 @@
This module cannot be loaded because it\'s installed on the SD card, please move it to internal storage
- Export…
- Export enabled modules list
- Export installed modules list
- There are no installed modules!
- There are no modules enabled
Info
LSPosed Framework is not installed
Scroll to top
- Reboot to Recovery
- Reboot to Bootloader
- Reboot to Download
- Reboot to Emergency
Loading…
Scroll to bottom
Skip status check
@@ -99,9 +87,6 @@
Android %2$s (%1$s, API %3$d)
This is the LSPosed Framework and modules log\nif you need a Android logcat, you can try our Log Catcher Magisk module
- Optimize all apps with Dexopt
- Optimize all apps with Speed mode
- Please wait, this may take a while…
Done!
Verified Boot is deactivated
Could not detect Verified Boot state
@@ -109,8 +94,6 @@
De-optimize
- Optimize with Speed mode
- Optimize with Dexopt mode
Resetting …
Optimizing …
@@ -125,7 +108,6 @@
Optimization failed or return value is empty
Optimization failed:
Not installed
- Reboot to System
Disable modules logs
Exception stack thrown by the module will still be catched normally
Use the pure black dark theme
@@ -146,9 +128,7 @@
Theme
Material Design 2
Variant
- Optimize…
System apps
- Reboot…
Sorting…
Enable module
You did not select any app. Continue?