mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 11:47:38 +00:00
Only allow device owner to hide/restore Magisk Manager
This commit is contained in:
parent
75ab1fa570
commit
f8ea43466c
@ -106,12 +106,12 @@ public class Data {
|
|||||||
mm.prefs.edit().commit();
|
mm.prefs.edit().commit();
|
||||||
File xml = new File(mm.getFilesDir().getParent() + "/shared_prefs",
|
File xml = new File(mm.getFilesDir().getParent() + "/shared_prefs",
|
||||||
mm.getPackageName() + "_preferences.xml");
|
mm.getPackageName() + "_preferences.xml");
|
||||||
Shell.su(Utils.fmt("for usr in /data/user/*; do cat %s > ${usr}/%s; done", xml, Const.MANAGER_CONFIGS)).exec();
|
Shell.su(Utils.fmt("cat %s > /data/user/0/%s", xml, Const.MANAGER_CONFIGS)).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void importPrefs() {
|
public static void importPrefs() {
|
||||||
MagiskManager mm = MM();
|
MagiskManager mm = MM();
|
||||||
SuFile config = new SuFile(Utils.fmt("/data/user/%d/%s", Const.USER_ID, Const.MANAGER_CONFIGS));
|
SuFile config = new SuFile("/data/user/0/" + Const.MANAGER_CONFIGS);
|
||||||
if (config.exists()) {
|
if (config.exists()) {
|
||||||
SharedPreferences.Editor editor = mm.prefs.edit();
|
SharedPreferences.Editor editor = mm.prefs.edit();
|
||||||
try {
|
try {
|
||||||
|
@ -140,7 +140,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
fingerprint.setSummary(R.string.disable_fingerprint);
|
fingerprint.setSummary(R.string.disable_fingerprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Shell.rootAccess()) {
|
if (Shell.rootAccess() && Const.USER_ID == 0) {
|
||||||
if (mm.getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
if (mm.getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
||||||
hideManager.setOnPreferenceClickListener((pref) -> {
|
hideManager.setOnPreferenceClickListener((pref) -> {
|
||||||
PatchAPK.hideManager(requireActivity());
|
PatchAPK.hideManager(requireActivity());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user