Skip to content

Commit

Permalink
v1.09
Browse files Browse the repository at this point in the history
  • Loading branch information
Chainfire committed Oct 5, 2017
0 parents commit 4936936
Show file tree
Hide file tree
Showing 65 changed files with 4,870 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
@@ -0,0 +1,17 @@
.idea
.gradle
*.iml
local.properties
*/bin
*/gen
*/build

suhide/proguard
ZIP/suhide/common/*.apk
ZIP/suhude/arm
ZIP/suhude/armv7
ZIP/suhude/arm64
ZIP/suhude/x86
ZIP/suhude/x64
ZIP/suhude/mips
ZIP/suhude/mips64
15 changes: 15 additions & 0 deletions LICENSE
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2017 Jorrit "Chainfire" Jongma & CCMT
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
20 changes: 20 additions & 0 deletions README.md
@@ -0,0 +1,20 @@
There are the sources for SuperSU's **suhide-lite** mod.

At time of writing, these correspond to **v1.09**.

Sources for the (uninteresting) Java parts can be found in **suhide/src**.

Sources for the (interesting) C parts can be found in **suhide/native**.

The (release) build process will output files to **ZIP/suhide**.

The folder structure is like this because it is copied out of the larger build tree used for SuperSU builds. The script that builds the actual flashable ZIP from the **ZIP/suhide** folder is missing as it depends on internal tools.

The gradle build script depends on an (included) older Gradle version and handles building with the NDK manually.

Your *local.properties* file needs correct paths set for both *sdk.dir* as well as *ndk.dir* variables.

Builds have been tested with NDK **r10e** specifically, on a Windows machine.


Published with permission from CCMT
173 changes: 173 additions & 0 deletions ZIP/suhide/META-INF/com/google/android/update-binary
@@ -0,0 +1,173 @@
#!/sbin/sh

OUTFD=$2
ZIP=$3

ui_print() {
echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
}

ui_print " "
ui_print "*************************"
ui_print "Installing suhide-lite..."
ui_print "*************************"
ui_print " "

mount -o ro /system
mount /system
mount -o rw,remount /

cd /tmp
mkdir suhide
cd suhide

unzip -o "$ZIP"

# some checks

ui_print "Compatibility checks..."
ui_print " "

if [ -f "/system/xbin/su" ]; then
ui_print "Fatal error: /system/xbin/su found"
ui_print "Do you have SuperSU v2.82 SR2 or newer installed in systemless mode ?"
exit 1
fi

if [ -f "/system/bin/su" ]; then
ui_print "Fatal error: /system/bin/su found"
ui_print "Do you have SuperSU v2.82 SR2 or newer installed in systemless mode ?"
exit 1
fi

if [ -f "/system/bin/app_process32_xposed" ]; then
ui_print "Fatal error: /system/bin/app_process32_xposed found"
ui_print "Xposed is not currently supported"
exit 1
fi

if [ -f "/system/bin/app_process64_xposed" ]; then
ui_print "Fatal error: /system/bin/app_process64_xposed found"
ui_print "Xposed is not currently supported"
exit 1
fi

if [ ! -d "/data/supersu_install" ] && [ ! -d "/cache/supersu_install" ]; then
if [ -f "/data/su.img" ]; then
ui_print "Fatal error: SuperSU image found at /data/su.img"
ui_print "SuperSU must be installed in BINDSBIN mode"
exit 1
fi

if [ -f "/cache/su.img" ]; then
ui_print "Fatal error: SuperSU image found at /cache/su.img"
ui_print "SuperSU must be installed in BINDSBIN mode"
exit 1
fi
fi

SUPATH=
if [ -d "/data/adb/su/bin" ]; then
SUPATH=/data/adb/su
elif [ -d "/data/supersu_install/bin" ]; then
SUPATH=/data/supersu_install
elif [ -d "/cache/supersu_install/bin" ]; then
SUPATH=/cache/supersu_install
fi

if [ -z "$SUPATH" ]; then
ui_print "Fatal error: SuperSU binaries not found"
ui_print "SuperSU must be installed in BINDSBIN mode"
exit 1
fi

# detect architecture

ui_print "Detecting architecture..."

ABI=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19 count=3)
ABILONG=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19)
ABI2=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi2=" | dd bs=1 skip=20 count=3)
ARCH=arm

if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;

if [ "$ABILONG" = "armeabi-v7a" ]; then ARCH=armv7; fi;
if [ "$ABI" = "mip" ]; then ARCH=mips; fi;
if [ "$ABILONG" = "mips" ]; then ARCH=mips; fi;

if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; fi;
if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; fi;
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; fi;

ui_print "- $ARCH"
ui_print " "

# place files

ui_print "Copying files..."

mkdir $SUPATH/suhide
chown 0.0 $SUPATH/suhide
chmod 0755 $SUPATH/suhide
chcon u:object_r:system_file:s0 $SUPATH/suhide

for FILE in setpropex suhide suhide32 suhide64; do
cp /tmp/suhide/$ARCH/$FILE $SUPATH/suhide/$FILE
chown 0.0 $SUPATH/suhide/$FILE
chmod 0755 $SUPATH/suhide/$FILE
chcon u:object_r:system_file:s0 $SUPATH/suhide/$FILE
done

for FILE in add list rm switch_packages; do
cp /tmp/suhide/common/$FILE $SUPATH/suhide/$FILE
chown 0.0 $SUPATH/suhide/$FILE
chmod 0755 $SUPATH/suhide/$FILE
chcon u:object_r:system_file:s0 $SUPATH/suhide/$FILE
done

for FILE in suhide.apk; do
cp /tmp/suhide/common/$FILE $SUPATH/suhide/$FILE
chown 0.0 $SUPATH/suhide/$FILE
chmod 0644 $SUPATH/suhide/$FILE
chcon u:object_r:system_file:s0 $SUPATH/suhide/$FILE
done

rm $SUPATH/su.d/*suhide*
cp /tmp/suhide/common/zz99suhide $SUPATH/su.d/zz99suhide
chown 0.0 $SUPATH/su.d/zz99suhide
chmod 0700 $SUPATH/su.d/zz99suhide
chcon u:object_r:system_file:s0 $SUPATH/su.d/zz99suhide

ui_print "- Complete"
ui_print " "

ui_print "Creating defaults..."
if [ ! -f "$SUPATH/suhide/suhide.uid" ]; then
echo com.google.android.gms.unstable>$SUPATH/suhide/suhide.uid
fi
chmod 0600 $SUPATH/suhide/suhide.uid
chcon u:object_r:system_file:s0 $SUPATH/suhide/suhide.uid
if [ ! -f "$SUPATH/suhide/suhide.pkg" ]; then
echo eu.chainfire.supersu>$SUPATH/suhide/suhide.pkg
echo eu.chainfire.suhide>>$SUPATH/suhide/suhide.pkg
fi
chmod 0600 $SUPATH/suhide/suhide.pkg
chcon u:object_r:system_file:s0 $SUPATH/suhide/suhide.pkg
ui_print "- Complete"
ui_print " "

# done

cd /tmp
rm -rf /tmp/suhide
cd /

ui_print "**********************"
ui_print "Installation complete!"
ui_print "**********************"
ui_print " "

exit 0
1 change: 1 addition & 0 deletions ZIP/suhide/META-INF/com/google/android/updater-script
@@ -0,0 +1 @@
#dummy file
9 changes: 9 additions & 0 deletions ZIP/suhide/common/add
@@ -0,0 +1,9 @@
#!/sbin/sush
UIDFILE=/sbin/supersu/suhide/suhide.uid
UID=$1

if [ ! -z "$UID" ]; then
if (! cat $UIDFILE 2>/dev/null | grep "^$UID$" >/dev/null); then
echo "$UID" >> $UIDFILE
fi
fi
3 changes: 3 additions & 0 deletions ZIP/suhide/common/list
@@ -0,0 +1,3 @@
#!/sbin/sush
UIDFILE=/sbin/supersu/suhide/suhide.uid
cat $UIDFILE
11 changes: 11 additions & 0 deletions ZIP/suhide/common/rm
@@ -0,0 +1,11 @@
#!/sbin/sush
UIDFILE=/sbin/supersu/suhide/suhide.uid
UID=$1

if [ ! -z "$UID" ]; then
cat $UIDFILE | grep -v "^$UID$" > $UIDFILE.tmp
if [ -f "$UIDFILE.tmp" ]; then
rm $UIDFILE
mv $UIDFILE.tmp $UIDFILE
fi
fi
16 changes: 16 additions & 0 deletions ZIP/suhide/common/switch_packages
@@ -0,0 +1,16 @@
#!/sbin/sush
PKGFILE=/sbin/supersu/suhide/suhide.pkg

HIDDEN=false
for i in `cat $PKGFILE 2>/dev/null`; do
if (`cat /data/system/users/0/package-restrictions.xml 2>/dev/null | grep $i | grep hidden >/dev/null`); then
HIDDEN=true
fi
done
for i in `cat $PKGFILE 2>/dev/null`; do
if (! $HIDDEN); then
pm hide $i
else
pm unhide $i
fi
done
56 changes: 56 additions & 0 deletions ZIP/suhide/common/zz99suhide
@@ -0,0 +1,56 @@
#!/sbin/sush

setprop() {
/sbin/supersu/suhide/setpropex $1 $2 /sbin/supersu/suhide/setpropex.lock
}

{
setprop ro.boot.verifiedbootstate green
setprop ro.boot.veritymode enforcing
setprop ro.boot.flash.locked 1
setprop ro.oem_unlock_supported 0
setprop sys.oem_unlock_allowed 0
setprop ro.debuggable 0
setprop ro.secure 1
setprop ro.adb.secure 1
} &

for PROP in ro.bootimage.build.fingerprint ro.build.description ro.build.fingerprint ro.build.tags ro.vendor.build.fingerprint; do
{
local CURRENT=$(getprop $PROP)
if [ ! -z "$CURRENT" ]; then
CURRENT=$(echo $CURRENT | sed 's/:userdebug\//:user\//g' | sed 's/:eng\//:user\//g' | sed 's/user-keys/release-keys/g' | sed 's/test-keys/release-keys/g')
setprop $PROP "$CURRENT"
fi
} &
done

{
mount -o rw,remount rootfs /
sed -i '/supersu_prop/d' /property_contexts
restorecon /property_contexts
sed -i '/supersu_prop/d' /plat_property_contexts
restorecon /plat_property_contexts
rm /init.supersu.rc
rm -rf /boot
mount -o ro,remount rootfs /
} &

wait

rm /sbin/supersu/suhide/setpropex.lock

if [ -f "/sbin/supersu/suhide/suhide.apk" ]; then
{
while (true); do
pm uninstall eu.chainfire.suhide
if (`pm install -r /sbin/supersu/suhide/suhide.apk >>/sbin/.suhide_install 2>&1`); then
break;
fi
sleep 1
done
rm -rf /sbin/supersu/suhide/suhide.apk
} &
fi

/sbin/supersu/suhide/suhide
16 changes: 16 additions & 0 deletions build.gradle
@@ -0,0 +1,16 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}

allprojects {
repositories {
jcenter()
mavenLocal()
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
#Wed Aug 26 16:07:58 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

0 comments on commit 4936936

Please sign in to comment.