Remove more pre SDK 21 stuffs

This commit is contained in:
topjohnwu 2021-04-09 21:29:42 -07:00
parent 1f0a35f073
commit 01b985eded
9 changed files with 15 additions and 48 deletions

View File

@ -4,17 +4,17 @@
## Introduction ## Introduction
Magisk is a suite of open source tools for customizing Android, supporting devices higher than Android 4.2. It covers fundamental parts of Android customization: root, boot scripts, SELinux patches, AVB2.0 / dm-verity / forceencrypt removals etc. Magisk is a suite of open source software for customizing Android, supporting devices higher than Android 5.0.<br>
Here are some feature highlights: Here are some feature highlights:
- **MagiskSU**: Provide root access to your device - **MagiskSU**: Provide root access for applications
- **Magisk Modules**: Modify read-only partitions by installing modules - **Magisk Modules**: Modify read-only partitions by installing modules
- **MagiskHide**: Hide Magisk from root detections / system integrity checks - **MagiskHide**: Hide Magisk from root detections / system integrity checks
- **MagiskBoot**: The most complete tool for unpacking and repacking Android boot images
## Downloads ## Downloads
Please note that the only source of official Magisk information and downloads is [Github](https://github.com/topjohnwu/Magisk/). Beware of any other websites. [Github](https://github.com/topjohnwu/Magisk/) is the only source where you can get official Magisk information and downloads.
[![](https://img.shields.io/badge/Magisk-v22.1-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v22.1) [![](https://img.shields.io/badge/Magisk-v22.1-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v22.1)
[![](https://img.shields.io/badge/Magisk%20Beta-v22.1-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v22.1) [![](https://img.shields.io/badge/Magisk%20Beta-v22.1-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v22.1)
@ -27,13 +27,6 @@ Please note that the only source of official Magisk information and downloads is
- [Magisk Documentation](https://topjohnwu.github.io/Magisk/) - [Magisk Documentation](https://topjohnwu.github.io/Magisk/)
- [Magisk Troubleshoot Wiki](https://www.didgeridoohan.com/magisk/HomePage) (by [@Didgeridoohan](https://github.com/Didgeridoohan)) - [Magisk Troubleshoot Wiki](https://www.didgeridoohan.com/magisk/HomePage) (by [@Didgeridoohan](https://github.com/Didgeridoohan))
## Android Version Support
- Android 4.2+: MagiskSU and Magisk Modules Only
- Android 4.4+: All core features available
- Android 6.0+: Guaranteed MagiskHide support
- Android 7.0+: Full MagiskHide protection
## Bug Reports ## Bug Reports
**Only bug reports from Canary builds will be accepted.** **Only bug reports from Canary builds will be accepted.**

View File

@ -31,7 +31,7 @@ static int call_applet(int argc, char *argv[]) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
umask(0); umask(0);
dload_selinux(); enable_selinux();
cmdline_logging(); cmdline_logging();
init_argv0(argc, argv); init_argv0(argc, argv);

View File

@ -140,12 +140,6 @@ static bool magisk_env() {
xmkdir(SECURE_DIR "/post-fs-data.d", 0755); xmkdir(SECURE_DIR "/post-fs-data.d", 0755);
xmkdir(SECURE_DIR "/service.d", 0755); xmkdir(SECURE_DIR "/service.d", 0755);
// Disable/remove magiskhide, resetprop
if (SDK_INT < 19) {
unlink("/sbin/resetprop");
unlink("/sbin/magiskhide");
}
if (access(DATABIN "/busybox", X_OK)) if (access(DATABIN "/busybox", X_OK))
return false; return false;

View File

@ -264,9 +264,6 @@ static void update_hide_config() {
int launch_magiskhide(bool late_props) { int launch_magiskhide(bool late_props) {
mutex_guard lock(hide_state_lock); mutex_guard lock(hide_state_lock);
if (SDK_INT < 19)
return DAEMON_ERROR;
if (hide_state) if (hide_state)
return HIDE_IS_ENABLED; return HIDE_IS_ENABLED;
@ -325,7 +322,7 @@ void auto_start_magiskhide(bool late_props) {
pthread_kill(monitor_thread, SIGALRM); pthread_kill(monitor_thread, SIGALRM);
#endif #endif
hide_late_sensitive_props(); hide_late_sensitive_props();
} else if (SDK_INT >= 19) { } else {
db_settings dbs; db_settings dbs;
get_db_settings(dbs, HIDE_CONFIG); get_db_settings(dbs, HIDE_CONFIG);
if (dbs[HIDE_CONFIG]) if (dbs[HIDE_CONFIG])

View File

@ -36,7 +36,6 @@ extern int (*fsetfilecon)(int fd, const char *con);
void getfilecon_at(int dirfd, const char *name, char **con); void getfilecon_at(int dirfd, const char *name, char **con);
void setfilecon_at(int dirfd, const char *name, const char *con); void setfilecon_at(int dirfd, const char *name, const char *con);
void selinux_builtin_impl(); void enable_selinux();
void dload_selinux();
void restorecon(); void restorecon();
void restore_tmpcon(); void restore_tmpcon();

View File

@ -99,7 +99,7 @@ void setfilecon_at(int dirfd, const char *name, const char *con) {
lsetfilecon(path, con); lsetfilecon(path, con);
} }
void selinux_builtin_impl() { void enable_selinux() {
setcon = __setcon; setcon = __setcon;
getfilecon = __getfilecon; getfilecon = __getfilecon;
lgetfilecon = __lgetfilecon; lgetfilecon = __lgetfilecon;
@ -108,13 +108,3 @@ void selinux_builtin_impl() {
lsetfilecon = __lsetfilecon; lsetfilecon = __lsetfilecon;
fsetfilecon = __fsetfilecon; fsetfilecon = __fsetfilecon;
} }
void dload_selinux() {
if (access("/system/lib/libselinux.so", F_OK) && access("/system/lib64/libselinux.so", F_OK))
return;
/* We only check whether libselinux.so exists but don't dlopen.
* For some reason calling symbols returned from dlsym
* will result to SEGV_ACCERR on some devices.
* Always use builtin implementations for SELinux stuffs. */
selinux_builtin_impl();
}

View File

@ -11,7 +11,7 @@
# in the emulator. The constructed Magisk environment is not a # in the emulator. The constructed Magisk environment is not a
# fully functional one as if it is running on an actual device. # fully functional one as if it is running on an actual device.
# #
# The script assumes you are using x86/x64 emulator images. # The script assumes you are using x64 emulator images.
# Build binaries with `./build.py binary` before running this script. # Build binaries with `./build.py binary` before running this script.
# #
##################################################################### #####################################################################
@ -29,14 +29,8 @@ mount_sbin() {
if [ ! -f /system/build.prop ]; then if [ ! -f /system/build.prop ]; then
# Running on PC # Running on PC
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
tmp="/data/local/tmp" adb push native/out/x86/busybox native/out/x86/magiskinit \
adb push native/out/x86/busybox native/out/x86/magiskinit scripts/emulator.sh $tmp native/out/x86_64/magisk scripts/emulator.sh /data/local/tmp
emu_arch=$(adb shell "chmod 777 $tmp/busybox; $tmp/busybox uname -m")
if [ "$emu_arch" = "x86_64" ]; then
adb push native/out/x86_64/magisk /data/local/tmp
else
adb push native/out/x86/magisk /data/local/tmp
fi
adb shell sh /data/local/tmp/emulator.sh adb shell sh /data/local/tmp/emulator.sh
exit 0 exit 0
fi fi
@ -89,7 +83,7 @@ elif [ -e /sbin ]; then
mount_sbin mount_sbin
if ! grep -q '/sbin/.magisk/mirror/system_root' /proc/mounts; then if ! grep -q '/sbin/.magisk/mirror/system_root' /proc/mounts; then
mkdir -p /sbin/.magisk/mirror/system_root mkdir -p /sbin/.magisk/mirror/system_root
block=`mount | grep ' / ' | awk '{ print $1 }'` block=$(mount | grep ' / ' | awk '{ print $1 }')
[ $block = "/dev/root" ] && block=/dev/block/dm-0 [ $block = "/dev/root" ] && block=/dev/block/dm-0
mount -o ro $block /sbin/.magisk/mirror/system_root mount -o ro $block /sbin/.magisk/mirror/system_root
fi fi
@ -98,7 +92,7 @@ elif [ -e /sbin ]; then
if [ -L $file ]; then if [ -L $file ]; then
cp -af $file /sbin cp -af $file /sbin
else else
sfile=/sbin/`basename $file` sfile=/sbin/$(basename $file)
touch $sfile touch $sfile
mount -o bind $file $sfile mount -o bind $file $sfile
fi fi

View File

@ -48,7 +48,7 @@ ui_print "- Target image: $BOOTIMAGE"
# Detect version and architecture # Detect version and architecture
api_level_arch_detect api_level_arch_detect
[ $API -lt 17 ] && abort "! Magisk only support Android 4.2 and above" [ $API -lt 21 ] && abort "! Magisk only support Android 5.0 and above"
ui_print "- Device platform: $ARCH" ui_print "- Device platform: $ARCH"

View File

@ -448,7 +448,7 @@ flash_image() {
install_magisk() { install_magisk() {
cd $MAGISKBIN cd $MAGISKBIN
if [ $API -ge 21 -a ! -c $BOOTIMAGE ]; then if [ ! -c $BOOTIMAGE ]; then
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
$BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0" $BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0"
fi fi