2018-11-18 09:16:24 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
##########################################################################################
|
|
|
|
#
|
|
|
|
# NanoDroid System Testing Script
|
|
|
|
# by Nanolx
|
|
|
|
#
|
|
|
|
##########################################################################################
|
|
|
|
|
2020-09-24 18:40:58 +00:00
|
|
|
VERSION=23.0.99999999
|
2018-12-28 21:21:09 +00:00
|
|
|
TMPDIR=/dev/tmp
|
2019-05-11 19:58:15 +00:00
|
|
|
LOGFILE="/data/media/0/nanodroid_logs/NanoDroid-SysTest-$(date +%Y%m%d-%H.%M.%S).log"
|
2020-08-17 16:44:14 +00:00
|
|
|
APEX_LD=/system
|
2018-11-18 09:16:24 +00:00
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
# Generic Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
2019-06-09 20:12:18 +00:00
|
|
|
show_banner () {
|
|
|
|
ui_print " "
|
|
|
|
ui_print "*******************"
|
|
|
|
ui_print " NanoDroid SysTest "
|
|
|
|
ui_print " ${VERSION} "
|
|
|
|
ui_print "*******************"
|
|
|
|
ui_print " "
|
|
|
|
}
|
|
|
|
|
2018-11-18 09:16:24 +00:00
|
|
|
ui_print() {
|
2019-06-09 19:43:42 +00:00
|
|
|
${BOOTMODE} && echo "${1}" || \
|
|
|
|
echo -e "ui_print ${1}\nui_print" >> /proc/self/fd/${OUTFD}
|
2018-11-18 09:16:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
is_mounted () {
|
2020-10-04 16:22:13 +00:00
|
|
|
if [ -n "$2" ]; then
|
2018-11-18 09:16:24 +00:00
|
|
|
cat /proc/mounts | grep $1 | grep $2, >/dev/null
|
|
|
|
else
|
|
|
|
cat /proc/mounts | grep $1 >/dev/null
|
|
|
|
fi
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex_loop () {
|
|
|
|
local number=0
|
|
|
|
local minorx=1
|
|
|
|
local loop
|
|
|
|
|
|
|
|
[ -e /dev/block/loop1 ] && minorx=$(stat -Lc '%T' /dev/block/loop1)
|
|
|
|
|
|
|
|
apex_mount="${1}"
|
|
|
|
|
|
|
|
while [ ${number} -lt 64 ]; do
|
|
|
|
loop=/dev/block/loop${number}
|
|
|
|
[ -e ${loop} ] || mknod ${loop} b 7 $((number * minorx))
|
|
|
|
|
2020-08-15 17:55:00 +00:00
|
|
|
if losetup "${loop}" /apex/apex_payload.img 2>/dev/null; then
|
2020-08-11 19:25:48 +00:00
|
|
|
if mount -text4 -oro,noatime "${loop}" "${apex_mount}"; then
|
|
|
|
rm -f /apex/apex_payload.img
|
|
|
|
break
|
|
|
|
fi
|
2019-10-12 18:00:52 +00:00
|
|
|
fi
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
number=$((number + 1))
|
2019-10-12 18:00:52 +00:00
|
|
|
done
|
2020-08-11 19:25:48 +00:00
|
|
|
}
|
2019-10-12 18:00:52 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex () {
|
|
|
|
if ${BOOTMODE}; then
|
2020-08-18 16:42:29 +00:00
|
|
|
APEX_LD=/apex/com.android.runtime
|
2020-08-11 19:25:48 +00:00
|
|
|
else
|
|
|
|
APEX_LD=/apex/com.android.runtime
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
mkdir -p /apex
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
for apex in /system/apex/*; do
|
|
|
|
apex_mount="/apex/$(basename ${apex} .apex)"
|
|
|
|
apex_loop="/dev/loop_apex_$(basename ${apex} .apex)"
|
|
|
|
|
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.release ] && apex_mount=/apex/com.android.runtime
|
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.debug ] && apex_mount=/apex/com.android.runtime
|
|
|
|
|
2020-08-18 08:43:47 +00:00
|
|
|
mkdir -p "${apex_mount}"
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
if [ -f "${apex}" ]; then
|
|
|
|
unzip -oq "${apex}" apex_payload.img -d /apex
|
|
|
|
mount_apex_loop "${apex_mount}" || error "APEX loop setup failed!"
|
|
|
|
elif [ -d "${apex}" ]; then
|
|
|
|
mount -o bind "${apex}" "${apex_mount}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
|
|
|
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
2019-10-23 19:33:46 +00:00
|
|
|
fi
|
|
|
|
}
|
2019-10-12 18:00:52 +00:00
|
|
|
|
2019-10-23 19:33:46 +00:00
|
|
|
# taken from Magisk, with minor modifications for NanoDroid
|
|
|
|
mount_partitions () {
|
|
|
|
DEVICE_AB=FALSE
|
|
|
|
VENDOR_COMPAT=FALSE
|
|
|
|
SYSTEM_AS_ROOT=FALSE
|
2019-10-12 18:00:52 +00:00
|
|
|
|
2019-10-23 19:33:46 +00:00
|
|
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
|
|
|
if [ -z ${SLOT} ]; then
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot)
|
2020-10-04 16:22:13 +00:00
|
|
|
if [ -n ${SLOT} ]; then
|
2019-10-23 19:33:46 +00:00
|
|
|
SLOT=_${SLOT}
|
|
|
|
DEVICE_AB=TRUE
|
|
|
|
fi
|
2019-10-12 18:00:52 +00:00
|
|
|
fi
|
|
|
|
|
2020-08-24 19:44:13 +00:00
|
|
|
system_tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name system${SLOT} | head -n 1)
|
2019-10-23 19:33:46 +00:00
|
|
|
SYSTEM_BLOCK=$(readlink -f ${system_tmp})
|
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
vendor_tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name vendor${SLOT} | head -n 1)
|
|
|
|
VENDOR_BLOCK=$(readlink -f ${vendor_tmp})
|
2019-10-08 18:48:26 +00:00
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
if ${BOOTMODE}; then
|
|
|
|
APEX_LD=/apex/com.android.runtime
|
|
|
|
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
2019-10-08 18:48:26 +00:00
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
if [[ ! $(is_mounted /vendor) && -a /system/vendor ]]; then
|
|
|
|
VENDOR_COMPAT=TRUE
|
|
|
|
fi
|
2020-10-02 17:40:46 +00:00
|
|
|
|
|
|
|
SYSTEM_AS_ROOT=$(grep_prop ro.build.system_root_image)
|
2020-09-30 19:21:41 +00:00
|
|
|
else
|
|
|
|
is_mounted /data || mount /data || error "failed to mount /data!"
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
mount -o bind /dev/urandom /dev/random
|
2019-10-08 18:48:26 +00:00
|
|
|
|
2020-10-02 17:40:46 +00:00
|
|
|
SYSTEM_AS_ROOT=$(grep_prop ro.build.ab_update /default.prop)
|
2020-10-09 18:37:23 +00:00
|
|
|
if [ -e /system_root -o ${SYSTEM_AS_ROOT} ]; then
|
2020-10-05 17:56:26 +00:00
|
|
|
[ -L /system_root ] && mv /system_root /system_root_link
|
|
|
|
if [ ! -d /system_root ]; then
|
|
|
|
rm -rf /system_root
|
|
|
|
mkdir -p /system_root
|
|
|
|
fi
|
2020-10-02 17:40:46 +00:00
|
|
|
! is_mounted /system_root && mount -o rw /system_root
|
|
|
|
! is_mounted /system_root && mount -o rw ${SYSTEM_BLOCK} /system_root
|
2020-09-30 19:21:41 +00:00
|
|
|
mount -o bind /system_root/system /system
|
2020-10-02 17:40:46 +00:00
|
|
|
else
|
|
|
|
! is_mounted /system && mount -o rw /system
|
|
|
|
! is_mounted /system && mount -o rw ${SYSTEM_BLOCK} /system
|
2020-09-30 19:21:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
! is_mounted /vendor && mount -o ro /vendor
|
2020-10-05 17:56:26 +00:00
|
|
|
! is_mounted /vendor && mount -o ro ${VENDOR_BLOCK} /vendor
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-10-02 17:40:46 +00:00
|
|
|
if [[ ! $(is_mounted /vendor) && -d /system/vendor ]]; then
|
2020-09-30 19:21:41 +00:00
|
|
|
### XXX work-around required for some devices
|
|
|
|
VENDOR_COMPAT=TRUE
|
|
|
|
ln -sf /system/vendor /vendor >/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
[ -z "${build_props}" ] && error "failed to mount /system (unsupported A/B device?)"
|
|
|
|
|
|
|
|
[ -d /system/apex ] && mount_apex
|
|
|
|
fi
|
2018-11-18 09:16:24 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 20:11:24 +00:00
|
|
|
umount_partitions () {
|
|
|
|
umount -l /system_root 2>/dev/null
|
|
|
|
umount -l /system 2>/dev/null
|
|
|
|
umount -l /vendor 2>/dev/null
|
|
|
|
umount -l /dev/random 2>/dev/null
|
|
|
|
|
|
|
|
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
|
|
|
umount -l "${apex_mount}" 2>/dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
|
|
|
losetup -d "${apex_loop}" 2>/dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf /apex
|
|
|
|
}
|
|
|
|
|
2018-11-18 09:16:24 +00:00
|
|
|
error () {
|
|
|
|
ui_print " "
|
|
|
|
ui_print " !! ${@}"
|
|
|
|
ui_print " "
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2018-12-28 21:11:29 +00:00
|
|
|
##########################################################################################
|
2019-05-11 19:39:21 +00:00
|
|
|
# check if ROM has native fake signature spoofing support
|
2020-08-24 19:44:13 +00:00
|
|
|
# origingally by @ale5000 - revised by me
|
2018-12-28 21:11:29 +00:00
|
|
|
##########################################################################################
|
|
|
|
|
2019-05-11 19:39:21 +00:00
|
|
|
check_fake_package_signature () {
|
2018-12-28 21:11:29 +00:00
|
|
|
PERMISSION=android.permission.FAKE_PACKAGE_SIGNATURE
|
|
|
|
PERMISSION_OD=$(echo -n "${PERMISSION}" | od -A n -t x1 | tr -d '\n' | sed -e 's/^ //g;s/ /00/g')
|
2020-09-28 17:07:14 +00:00
|
|
|
PATCH_TYPE=""
|
2020-08-24 19:44:13 +00:00
|
|
|
FRAMEWORKRES_PATCH=false
|
|
|
|
SERVICESJAR_PATCH=false
|
2018-12-28 21:11:29 +00:00
|
|
|
|
2020-08-24 17:19:18 +00:00
|
|
|
mkdir -p ${TMPDIR}/sigcheck
|
2018-12-28 21:11:29 +00:00
|
|
|
|
2020-08-24 19:44:13 +00:00
|
|
|
# natively patched ROM: only framework-res.apk patched (old)
|
|
|
|
# natively patched ROM: both framework-res.apk and services.jar patched (new)
|
|
|
|
# self patched ROM: only services.jar patched
|
|
|
|
|
|
|
|
# check framework-res.apk for the patch
|
2020-08-29 19:43:10 +00:00
|
|
|
unzip -oq /system/framework/framework-res.apk -d "${TMPDIR}/sigcheck" \
|
2020-08-24 17:19:18 +00:00
|
|
|
|| error "failed to unpack framework-res.apk"
|
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
grep -qF "${PERMISSION}" "${TMPDIR}"/sigcheck/AndroidManifest.xml && FRAMEWORKRES_PATCH=true
|
|
|
|
od -A n -t x1 "${TMPDIR}"/sigcheck/AndroidManifest.xml | tr -d ' \n' | grep -qF "${PERMISSION_OD}" && FRAMEWORKRES_PATCH=true
|
2020-08-24 19:44:13 +00:00
|
|
|
|
|
|
|
# check services.jar for the patch
|
2020-08-29 19:43:10 +00:00
|
|
|
unzip -oq /system/framework/services.jar -d "${TMPDIR}/sigcheck" \
|
2020-08-24 17:19:18 +00:00
|
|
|
|| error "failed to unpack services.jar"
|
2019-05-11 19:39:21 +00:00
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
grep -qF "${PERMISSION}" "${TMPDIR}"/sigcheck/*.dex && SERVICESJAR_PATCH=true
|
|
|
|
od -A n -t x1 "${TMPDIR}"/sigcheck/*.dex | tr -d ' \n' | grep -qF "${PERMISSION_OD}" && SERVICESJAR_PATCH=true
|
2020-08-24 19:44:13 +00:00
|
|
|
|
|
|
|
# we don't use this anywhere (except in SysTest log),
|
|
|
|
# but may still come in hand in the future
|
|
|
|
if ${FRAMEWORKRES_PATCH} && ! ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="native_old"
|
|
|
|
elif ${FRAMEWORKRES_PATCH} && ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="native_new"
|
|
|
|
elif ! ${FRAMEWORKRES_PATCH} && ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="self_patched"
|
|
|
|
fi
|
2018-12-28 21:11:29 +00:00
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
[ -n "${PATCH_TYPE}" ] && return 0 || return 1
|
2018-12-28 21:11:29 +00:00
|
|
|
}
|
|
|
|
|
2019-05-11 19:39:21 +00:00
|
|
|
##########################################################################################
|
|
|
|
# check if Bromite System WebView is supported
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
check_bromite_webview_support () {
|
|
|
|
WEBVIEW_PKG="com.android.webview"
|
|
|
|
HAS_WEBVIEW=false
|
|
|
|
|
2019-10-29 18:39:28 +00:00
|
|
|
${AAPT} dump xmltree /system/framework/framework-res.apk res/xml/config_webview_packages.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/webviewprovider/\n/g' | grep com.android.webview | \
|
|
|
|
grep -q 'E: signature' || HAS_WEBVIEW=true
|
2019-05-11 19:39:21 +00:00
|
|
|
|
|
|
|
${HAS_WEBVIEW} && return 0 || return 1
|
|
|
|
}
|
|
|
|
|
2018-11-18 09:16:24 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Device Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
detect_outfd () {
|
|
|
|
if [ -z $OUTFD ] || readlink /proc/$$/fd/$OUTFD | grep -q /tmp; then
|
|
|
|
# We will have to manually find out OUTFD
|
|
|
|
for FD in `ls /proc/$$/fd`; do
|
|
|
|
if readlink /proc/$$/fd/$FD | grep -q pipe; then
|
|
|
|
if ps | grep -v grep | grep -q " 3 $FD "; then
|
|
|
|
OUTFD=$FD
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
detect_bootmode () {
|
|
|
|
[ -z ${BOOTMODE} ] && BOOTMODE=false
|
|
|
|
${BOOTMODE} || ps | grep zygote | grep -qv grep && BOOTMODE=true
|
|
|
|
${BOOTMODE} || ps -A | grep zygote | grep -qv grep && BOOTMODE=true
|
|
|
|
}
|
|
|
|
|
|
|
|
grep_prop() {
|
2020-10-02 17:40:46 +00:00
|
|
|
sed -n "s/^${1}=//p" ${build_props} ${2} | head -n 1
|
2018-11-18 09:16:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
grep_cmdline() {
|
|
|
|
local REGEX="s/^${1}=//p"
|
|
|
|
sed -E 's/ +/\n/g' /proc/cmdline | \
|
|
|
|
sed -n "${REGEX}" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
system_test () {
|
|
|
|
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
|
|
|
|
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
|
|
|
|
ABILONG=$(grep_prop ro.product.cpu.abi)
|
|
|
|
|
|
|
|
ARCH=arm
|
|
|
|
|
|
|
|
[ "$ABI" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABI2" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABILONG" = "arm64-v8a" ] && ARCH=arm64
|
|
|
|
[ "$ABILONG" = "x86_64" ] && ARCH=x86_64
|
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm | arm64 )
|
2018-12-28 21:21:09 +00:00
|
|
|
BB=${TMPDIR}/busybox.arm
|
|
|
|
FILE=${TMPDIR}/file.arm
|
2019-10-29 18:39:28 +00:00
|
|
|
AAPT=${TMPDIR}/aapt.arm
|
2018-11-18 09:16:24 +00:00
|
|
|
;;
|
|
|
|
x86 | x86_64 )
|
2018-12-28 21:21:09 +00:00
|
|
|
BB=${TMPDIR}/busybox.x86
|
|
|
|
FILE=${TMPDIR}/file.x86
|
2019-10-29 18:39:28 +00:00
|
|
|
AAPT=${TMPDIR}/aapt.x86
|
2018-11-18 09:16:24 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-12-28 21:21:09 +00:00
|
|
|
OLD_PATH=${PATH}
|
|
|
|
|
|
|
|
mkdir -p ${TMPDIR}/busybox
|
2018-12-28 21:31:40 +00:00
|
|
|
ln -s ${BB} ${TMPDIR}/busybox/busybox
|
2018-12-28 21:21:09 +00:00
|
|
|
|
2018-12-28 21:31:40 +00:00
|
|
|
chmod 0755 ${BB}
|
|
|
|
${BB} --install -s ${TMPDIR}/busybox/
|
2018-12-28 21:21:09 +00:00
|
|
|
|
|
|
|
export PATH="${TMPDIR}/busybox:${PATH}"
|
|
|
|
|
2019-10-29 18:39:28 +00:00
|
|
|
chmod 0755 "${FILE}" "${AAPT}"
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2020-08-17 16:44:14 +00:00
|
|
|
DALVIKVM_BIN=$(ls -l ${APEX_LD}/bin/dalvikvm | awk '{print $NF}')
|
|
|
|
DALVIKVM_ARCH=$("${FILE}" -m "${TMPDIR}/magic.mgc" -L ${APEX_LD}/bin/dalvikvm)
|
2018-11-18 09:16:24 +00:00
|
|
|
|
|
|
|
case ${DALVIKVM_BIN} in
|
2020-08-17 16:46:50 +00:00
|
|
|
*dalvikvm32* )
|
|
|
|
export LD="${APEX_LD}/lib:/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib"
|
2018-11-19 21:13:15 +00:00
|
|
|
;;
|
|
|
|
|
2020-08-17 16:46:50 +00:00
|
|
|
*dalvikvm64* )
|
|
|
|
export LD="${APEX_LD}/lib64:/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64"
|
2018-11-19 21:13:15 +00:00
|
|
|
;;
|
|
|
|
|
2020-08-17 16:46:50 +00:00
|
|
|
*dalvikvm* )
|
2018-11-18 09:16:24 +00:00
|
|
|
case ${DALVIKVM_ARCH} in
|
|
|
|
*32-bit* )
|
2020-08-17 16:46:50 +00:00
|
|
|
export LD="${APEX_LD}/lib:/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib"
|
2018-11-18 09:16:24 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*64-bit* )
|
2020-08-17 16:46:50 +00:00
|
|
|
export LD="${APEX_LD}/lib64:/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64"
|
2018-11-18 09:16:24 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-08-17 16:46:50 +00:00
|
|
|
if [ -f ${APEX_LD}/etc/ld.config.txt ]; then
|
|
|
|
export LD_FILE="${APEX_LD}/etc/ld.config.txt"
|
|
|
|
elif [ -f ${APEX_LD}/etc/ld.config.${SDK_VERSION}.txt ]; then
|
|
|
|
export LD_FILE="${APEX_LD}/etc/ld.config.${SDK_VERSION}.txt"
|
|
|
|
fi
|
|
|
|
|
2018-11-18 09:16:24 +00:00
|
|
|
SERVICES_JAR_DEX=$(unzip -lq /system/framework/services.jar | grep classes.dex)
|
|
|
|
|
|
|
|
if [ -n "$(find '/system/framework/' -name 'services.vdex')" ]; then
|
|
|
|
ROM_DEX_STATUS=VDEX
|
|
|
|
elif [ -n "$(find '/system/framework/' -name 'services.odex')" ]; then
|
|
|
|
ROM_DEX_STATUS=ODEX
|
|
|
|
else ROM_DEX_STATUS=UNKOWN
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ "${SERVICES_JAR_DEX}" ] && ROM_DEX_STATUS=DEODEX
|
2018-11-19 17:49:25 +00:00
|
|
|
}
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log () {
|
|
|
|
echo "${@}" >> ${LOGFILE}
|
|
|
|
}
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
store_results () {
|
2019-05-13 17:51:25 +00:00
|
|
|
mkdir -p "$(dirname "${LOGFILE}")"
|
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log "NanoDroid System Test Results"
|
|
|
|
add_log "============================="
|
|
|
|
add_log ""
|
|
|
|
|
|
|
|
add_log "CPU and ABI details"
|
|
|
|
add_log "==================="
|
|
|
|
add_log ""
|
|
|
|
add_log "ARCH=${ARCH}"
|
|
|
|
add_log "ABI=${ABI}"
|
|
|
|
add_log "ABI2=${ABI2}"
|
|
|
|
add_log "ABILONG=${ABILONG}"
|
|
|
|
|
|
|
|
add_log ""
|
|
|
|
add_log "Mounted Partitions"
|
|
|
|
add_log "=================="
|
|
|
|
add_log ""
|
|
|
|
add_log "DEVICE_AB=${DEVICE_AB}"
|
2018-12-28 21:24:12 +00:00
|
|
|
add_log "VENDOR_COMPAT=${VENDOR_COMPAT}"
|
2019-07-27 18:34:54 +00:00
|
|
|
add_log "SYSTEM_AS_ROOT=${SYSTEM_AS_ROOT}"
|
2020-08-24 19:44:13 +00:00
|
|
|
add_log "SYSTEMBLOCK=${SYSTEM_BLOCK}"
|
|
|
|
add_log "VENDORBLOCK=${VENDOR_BLOCK}"
|
|
|
|
add_log "SLOT=${SLOT}"
|
2018-12-28 21:25:39 +00:00
|
|
|
add_log ""
|
2019-06-09 19:46:29 +00:00
|
|
|
mount | sed '/magisk/d' | awk '{print $1 " on " $3 " params: " $6}' >> ${LOGFILE}
|
2018-11-19 17:49:25 +00:00
|
|
|
|
2019-06-13 18:16:04 +00:00
|
|
|
if [ ! ${BOOTMODE} ]; then
|
|
|
|
add_log ""
|
|
|
|
add_log "TWRP usuable space for Installer"
|
|
|
|
add_log "================================"
|
|
|
|
add_log ""
|
|
|
|
add_log $(df /dev 2>/dev/null | awk '/tmpfs/{print $4}')
|
|
|
|
fi
|
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
|
|
|
add_log "DalvikVM, LD_LIBRARY_PATH and DEX status"
|
|
|
|
add_log "========================================"
|
|
|
|
add_log ""
|
|
|
|
add_log "DALVIKVM_BIN=${DALVIKVM_BIN}"
|
|
|
|
add_log "DALVIKVM_ARCH=${DALVIKVM_ARCH}"
|
2018-11-19 18:00:49 +00:00
|
|
|
add_log "LD_LIBRARY_PATH=${LD}"
|
2020-08-17 16:46:50 +00:00
|
|
|
add_log "LD_CONFIG_FILE=${LD_FILE}"
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log "ROM_DEX_STATUS=${ROM_DEX_STATUS}"
|
2019-10-12 18:00:52 +00:00
|
|
|
|
2020-08-17 16:54:55 +00:00
|
|
|
if [ -d /system/apex ]; then
|
|
|
|
add_log ""
|
|
|
|
add_log "Loaded APEX modules"
|
|
|
|
add_log "==================="
|
|
|
|
add_log ""
|
|
|
|
|
|
|
|
i=0
|
|
|
|
|
|
|
|
for apex in /system/apex/*; do
|
|
|
|
i=$((i + 1))
|
|
|
|
add_log "[${i}] $(basename ${apex} .apex)"
|
|
|
|
done
|
2019-10-12 18:00:52 +00:00
|
|
|
fi
|
2018-11-19 17:49:25 +00:00
|
|
|
|
|
|
|
add_log ""
|
|
|
|
add_log "Generic System Properties"
|
|
|
|
add_log "========================="
|
|
|
|
add_log ""
|
2020-08-24 19:44:13 +00:00
|
|
|
add_log "build.prop files"
|
|
|
|
add_log ""
|
|
|
|
|
|
|
|
i=0
|
|
|
|
for prop in $(find /system /system_root /vendor -type f -name build.prop); do
|
|
|
|
i=$((i + 1))
|
|
|
|
add_log "[${i}] ${prop}"
|
|
|
|
done
|
|
|
|
|
|
|
|
add_log ""
|
|
|
|
add_log "system properties"
|
|
|
|
add_log ""
|
|
|
|
|
|
|
|
i=0
|
2018-11-18 09:16:24 +00:00
|
|
|
for prop in ro.build.description ro.build.display.id ro.build.flavor ro.build.product \
|
|
|
|
ro.build.tags ro.build.type ro.build.version.sdk ro.build.version.security_patch \
|
|
|
|
ro.product.cpu.abi ro.product.cpu.abilist ro.product.cpu.abilist32 \
|
|
|
|
ro.product.cpu.abilist64 ro.product.model ro.product.vendor.device; do
|
2020-08-24 19:44:13 +00:00
|
|
|
i=$((i + 1))
|
|
|
|
add_log "[${i}] ${prop}=$(grep_prop ${prop})"
|
2018-11-18 09:16:24 +00:00
|
|
|
done
|
|
|
|
|
2018-12-28 21:11:29 +00:00
|
|
|
add_log ""
|
2019-06-13 18:15:40 +00:00
|
|
|
add_log "Native Signature Spoofing support"
|
|
|
|
add_log "================================="
|
2018-12-28 21:11:29 +00:00
|
|
|
add_log ""
|
2020-08-24 19:44:13 +00:00
|
|
|
if check_fake_package_signature; then
|
|
|
|
add_log "NATIVE_SIGSPOOF=TRUE"
|
|
|
|
add_log "PATCH_TYPE=${PATCH_TYPE}"
|
|
|
|
else
|
|
|
|
add_log "NATIVE_SIGSPOOF=FALSE"
|
|
|
|
fi
|
2019-05-11 19:39:21 +00:00
|
|
|
|
|
|
|
add_log ""
|
2019-06-13 19:30:43 +00:00
|
|
|
add_log "Bromite System WebView support"
|
|
|
|
add_log "=============================="
|
2019-05-11 19:39:21 +00:00
|
|
|
add_log ""
|
|
|
|
check_bromite_webview_support && add_log "WEBVIEW_SUPPORT=TRUE" || add_log "WEBVIEW_SUPPORT=FALSE"
|
2018-12-28 21:11:29 +00:00
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
2019-06-13 19:30:43 +00:00
|
|
|
add_log "Magisk installation status"
|
|
|
|
add_log "=========================="
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
2019-05-11 19:58:15 +00:00
|
|
|
if [ -f /data/adb/magisk/util_functions.sh ]; then
|
|
|
|
add_log "MAGISK=TRUE"
|
|
|
|
|
|
|
|
. /data/adb/magisk/util_functions.sh
|
|
|
|
add_log "MAGISK_VERSION=${MAGISK_VER_CODE}"
|
|
|
|
|
|
|
|
if [ ${MAGISK_VER_CODE} -gt 18100 ]; then
|
|
|
|
add_log "MAGISK_IMAGELESS=TRUE"
|
|
|
|
else add_log "MAGISK_IMAGELESS=FALSE"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
add_log "MAGISK=FALSE"
|
|
|
|
add_Log "MAGISK_VERSION=NONE"
|
|
|
|
add_log "MAGISK_IMAGELESS=FALSE"
|
|
|
|
fi
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
|
|
|
add_log "Installed Google packages"
|
|
|
|
add_log "=== packages.list ======="
|
2018-12-28 21:11:29 +00:00
|
|
|
add_log ""
|
2019-05-11 19:58:15 +00:00
|
|
|
grep google /data/system/packages.list | sort >> ${LOGFILE}
|
2018-11-19 17:49:25 +00:00
|
|
|
|
|
|
|
add_log ""
|
|
|
|
add_log "=== packages.xml ========"
|
|
|
|
add_log ""
|
2019-05-11 19:58:15 +00:00
|
|
|
grep 'package .*google' /data/system/packages.xml | sort >> ${LOGFILE}
|
2018-11-18 09:16:24 +00:00
|
|
|
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
|
|
|
add_log "Content of /system/app"
|
|
|
|
add_log "======================"
|
|
|
|
add_log ""
|
2019-05-11 19:58:15 +00:00
|
|
|
find /system/app -type f -name '*.apk' | sort >> ${LOGFILE}
|
2018-11-19 17:49:25 +00:00
|
|
|
|
|
|
|
add_log ""
|
|
|
|
add_log "Content of /system/priv-app"
|
2019-06-16 17:07:19 +00:00
|
|
|
add_log "==========================="
|
2018-11-19 17:49:25 +00:00
|
|
|
add_log ""
|
2019-05-11 19:58:15 +00:00
|
|
|
find /system/priv-app -type f -name '*.apk' | sort >> ${LOGFILE}
|
2018-12-28 21:33:06 +00:00
|
|
|
|
2019-05-11 19:59:04 +00:00
|
|
|
chown root:sdcard_rw ${LOGFILE}
|
|
|
|
chmod 0644 ${LOGFILE}
|
|
|
|
|
2018-12-28 21:33:06 +00:00
|
|
|
export PATH=${OLD_PATH}
|
2018-11-18 09:16:24 +00:00
|
|
|
}
|
|
|
|
|