mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 14:27:38 +00:00
Android P cannot install from sdcardfs, use TMPDIR
This commit is contained in:
parent
79ccb30dd2
commit
2c78c415e9
@ -159,9 +159,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
if (mm.magiskVersionCode >= 1440) {
|
if (mm.magiskVersionCode >= 1440) {
|
||||||
if (mm.getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
if (mm.getPackageName().equals(Const.ORIG_PKG_NAME)) {
|
||||||
hideManager.setOnPreferenceClickListener((pref) -> {
|
hideManager.setOnPreferenceClickListener((pref) -> {
|
||||||
Utils.runWithPermission(getActivity(),
|
new HideManager(getActivity()).exec();
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
||||||
() -> new HideManager(getActivity()).exec());
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
generalCatagory.removePreference(restoreManager);
|
generalCatagory.removePreference(restoreManager);
|
||||||
@ -188,18 +186,6 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
generalCatagory.removePreference(hideManager);
|
generalCatagory.removePreference(hideManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm.getPackageName().equals(Const.ORIG_PKG_NAME) && mm.magiskVersionCode >= 1440) {
|
|
||||||
hideManager.setOnPreferenceClickListener((pref) -> {
|
|
||||||
Utils.runWithPermission(getActivity(),
|
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
||||||
() -> new HideManager(getActivity()).exec());
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
generalCatagory.removePreference(restoreManager);
|
|
||||||
} else {
|
|
||||||
generalCatagory.removePreference(hideManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Shell.rootAccess() || (Const.USER_ID > 0 &&
|
if (!Shell.rootAccess() || (Const.USER_ID > 0 &&
|
||||||
mm.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
|
mm.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
|
||||||
prefScreen.removePreference(suCategory);
|
prefScreen.removePreference(suCategory);
|
||||||
|
@ -11,9 +11,10 @@ import com.topjohnwu.magisk.utils.Utils;
|
|||||||
import com.topjohnwu.magisk.utils.ZipUtils;
|
import com.topjohnwu.magisk.utils.ZipUtils;
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
import com.topjohnwu.superuser.ShellUtils;
|
import com.topjohnwu.superuser.ShellUtils;
|
||||||
|
import com.topjohnwu.superuser.io.SuFile;
|
||||||
|
import com.topjohnwu.superuser.io.SuFileOutputStream;
|
||||||
import com.topjohnwu.utils.JarMap;
|
import com.topjohnwu.utils.JarMap;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
@ -104,8 +105,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
|
|||||||
MagiskManager mm = MagiskManager.get();
|
MagiskManager mm = MagiskManager.get();
|
||||||
|
|
||||||
// Generate a new unhide app with random package name
|
// Generate a new unhide app with random package name
|
||||||
File repack = new File(Const.EXTERNAL_PATH, "repack.apk");
|
SuFile repack = new SuFile("/data/local/tmp/repack.apk", true);
|
||||||
repack.getParentFile().mkdirs();
|
|
||||||
String pkg = genPackageName("com.", Const.ORIG_PKG_NAME.length());
|
String pkg = genPackageName("com.", Const.ORIG_PKG_NAME.length());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -123,7 +123,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
|
|||||||
apk.getOutputStream(je).write(xml);
|
apk.getOutputStream(je).write(xml);
|
||||||
|
|
||||||
// Sign the APK
|
// Sign the APK
|
||||||
ZipUtils.signZip(apk, repack);
|
ZipUtils.signZip(apk, new SuFileOutputStream(repack));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
@ -49,21 +49,10 @@ public class ZipUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void signZip(InputStream is, File output) throws Exception {
|
|
||||||
try (JarMap map = new JarMap(is, false)) {
|
|
||||||
signZip(map, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void signZip(File input, File output) throws Exception {
|
public static void signZip(File input, File output) throws Exception {
|
||||||
try (JarMap map = new JarMap(input, false)) {
|
try (JarMap map = new JarMap(input, false);
|
||||||
signZip(map, output);
|
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(output))) {
|
||||||
}
|
signZip(map, out);
|
||||||
}
|
|
||||||
|
|
||||||
public static void signZip(JarMap input, File output) throws Exception {
|
|
||||||
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(output))) {
|
|
||||||
signZip(input, out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user