MagiskHidePropsConf/system/binpath/props

4248 lines
97 KiB
Plaintext
Raw Normal View History

2018-10-30 08:28:47 +00:00
#!/system/bin/sh
2018-03-18 15:39:43 +00:00
# MagiskHide Props Config
2020-01-10 18:45:27 +00:00
# Copyright (c) 2018-2020 Didgeridoohan @ XDA Developers
2019-02-02 12:37:20 +00:00
# Licence: MIT
2018-03-18 15:39:43 +00:00
2018-08-07 11:50:01 +00:00
# ====================================================
# ==================== Root check ====================
# ====================================================
2018-10-21 14:17:11 +00:00
# Check for access to the Magisk internals. No access == no root
ls /data/adb>/dev/null 2>&1
2018-10-04 21:54:41 +00:00
if [ "$?" != 0 ]; then
su -c props "$@" # Rerun script with root access
2018-08-07 11:50:01 +00:00
exit
fi
2019-02-02 12:37:20 +00:00
# Startup message
echo ""
echo "Loading... Please wait."
echo ""
2018-03-18 15:39:43 +00:00
# =====================================================
# ================ Paths and variables ================
# =====================================================
2020-08-14 08:01:35 +00:00
ADBPATHPH=ADB_PLACEHOLDER
2019-04-05 21:10:02 +00:00
MODPATH=$ADBPATH/modules/MagiskHidePropsConf
2020-08-14 08:01:35 +00:00
LATEFILEPH=LATE_PLACEHOLDER
2019-05-04 18:57:59 +00:00
BOOTSTAGE="props"
2018-03-18 15:39:43 +00:00
2020-10-25 19:49:49 +00:00
# Development testing check
2018-06-19 09:56:08 +00:00
DEVTESTING=false
2018-07-01 05:31:37 +00:00
case "$1" in
*t*) # Development testing
DEVTESTING=true
;;
esac
2018-03-18 15:39:43 +00:00
# Colours
2019-11-02 22:24:17 +00:00
if [ -f "$LATEFILE" ] && [ "$(grep "OPTIONCOLOUR=" $LATEFILE | sed 's|.*=||' | sed 's|\"||g')" == 0 ] || [ "$ANDROID_SOCKET_adbd" ]; then
2018-04-15 22:05:33 +00:00
COLOURCHK="nc"
2018-03-18 15:39:43 +00:00
else
2018-04-15 22:05:33 +00:00
COLOURCHK="$1"
2018-03-18 15:39:43 +00:00
fi
2018-04-15 22:05:33 +00:00
case "$COLOURCHK" in
*nc*) # Don't use colours
G=''
R=''
Y=''
B=''
V=''
Bl=''
C=''
W=''
N=''
;;
*) # Use colours
G='\e[01;32m' # GREEN
R='\e[01;31m' # RED
Y='\e[01;33m' # YELLOW
B='\e[01;34m' # BLUE
V='\e[01;35m' # VIOLET
Bl='\e[01;30m' # BLACK
C='\e[01;36m' # CYAN
W='\e[01;37m' # WHITE
N='\e[00;37;40m' # NEUTRAL
;;
esac
2018-03-18 15:39:43 +00:00
# ===================================================
# ==================== Functions ====================
# ===================================================
# Load functions
2020-01-10 18:45:27 +00:00
. $MODPATH/common/util_functions.sh
2018-03-18 15:39:43 +00:00
2020-01-26 09:36:26 +00:00
if [ -f "$VLOGFILE" ]; then
mv -f $VLOGFILE $VLASTLOGFILE
fi
2020-02-26 21:08:29 +00:00
set -x 2>$VLOGFILE
2020-01-26 09:36:26 +00:00
2018-07-19 19:47:43 +00:00
log_handler "Running props script."
2020-06-11 19:20:13 +00:00
# Checking for Busybox
2020-08-14 08:01:35 +00:00
if [ ! -f "$BBPATH" ]; then
2018-12-05 15:22:57 +00:00
menu_header "${C}No Busybox found${N}"
echo ""
2020-06-11 19:20:13 +00:00
echo "The script couldn't find Magisk's Busybox."
echo "Make sure that your installation of Magisk"
echo "is functioning properly and try again."
2018-12-05 15:22:57 +00:00
echo ""
2020-06-11 19:20:13 +00:00
echo "If you can't find anything wrong, please"
2018-12-05 15:22:57 +00:00
echo "check the module documentation on how to"
2020-08-27 09:07:28 +00:00
echo "ask for support and please provide"
echo "logs (see the module documentation)."
2018-12-05 15:22:57 +00:00
echo ""
log_handler "No Busybox found."
2020-10-25 19:49:49 +00:00
log_handler "Exiting... Bye bye.\n\n===================="
2018-12-05 15:22:57 +00:00
exit 0
fi
2020-06-11 19:20:13 +00:00
# Check MagiskHide status
MHTEMP=$(magiskhide status) >> $LOGFILE 2>&1
2018-05-29 20:44:54 +00:00
blank_input() {
# Find menu level
case $1 in
1) INPUT=""
;;
2) INPUT2=""
;;
3) INPUT3=""
;;
4) INPUT4=""
;;
5) INPUT5=""
;;
2019-02-02 12:37:20 +00:00
6) INPUT6=""
;;
2018-05-29 20:44:54 +00:00
esac
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${R}Don't enter an empty value${N}."
2018-05-29 20:44:54 +00:00
echo "Try again."
sleep 2
}
2018-09-04 07:55:57 +00:00
active_option() {
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${R}That's already the active option.${N}"
2018-09-04 07:55:57 +00:00
sleep 2
}
2018-03-18 15:39:43 +00:00
invalid_input() {
INPMSG=""
# Set the message text
case $1 in
2019-03-27 10:50:00 +00:00
1) INPMSG="Only pick from the options above, one at a time."
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
2) INPMSG="Only enter '${G}y${N}' or '${G}n${N}'."
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
3) INPMSG="Only enter '${G}y${N}', '${G}n${N}' or '${G}e${N}'."
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
4) INPMSG="Only enter '${G}y${N}', '${G}n${N}', '${G}r${N}' or '${G}e${N}'."
2018-03-18 15:39:43 +00:00
;;
2019-02-10 16:12:18 +00:00
5) INPMSG="Only enter '${G}d${N}', '${G}y${N}', '${G}n${N}' or '${G}e${N}'."
;;
6) INPMSG="Enter a fingerprint or pick from the options, one at a time."
2018-10-25 06:37:05 +00:00
;;
2020-02-26 21:08:29 +00:00
7) INPMSG="Only pick numbers, separated by a comma."
;;
2020-08-14 08:01:35 +00:00
8) INPMSG="Only enter numbers, or an option from above."
;;
2018-03-18 15:39:43 +00:00
esac
# Find menu level
case $2 in
2019-02-02 12:37:20 +00:00
1) INPUT=""
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
2) INPUT2=""
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
3) INPUT3=""
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
4) INPUT4=""
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
5) INPUT5=""
;;
6) INPUT6=""
2018-03-18 15:39:43 +00:00
;;
2019-03-27 10:50:00 +00:00
7) INPUT7=""
;;
2018-03-18 15:39:43 +00:00
esac
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${R}Invalid input${N}. $INPMSG"
2018-03-18 15:39:43 +00:00
sleep 2
}
exit_fn() {
menu_header "${C}Bye bye.${N}"
echo ""
2020-10-25 19:49:49 +00:00
log_handler "Exiting... Bye bye.\n\n===================="
2018-03-18 15:39:43 +00:00
exit 0
}
# ======================== Device's fingerprint ========================
2020-08-14 08:01:35 +00:00
# Second menu level - fingerprint, $1=header, $2=Current fingerprint, $3=Original fingerprint, $4=Module set fingerprint
2018-03-18 15:39:43 +00:00
menu_change_fingerprint() {
2018-10-30 08:28:47 +00:00
rm -f $CSTMFILE
2020-03-06 12:37:19 +00:00
if [ "$DEVPRINTS" == "true" ]; then
INPUT2=f
else
INPUT2=""
fi
2018-03-18 15:39:43 +00:00
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT2" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
2020-09-07 20:00:48 +00:00
echo "Edit the device fingerprint to"
echo "pass SafetyNet's CTS profile."
echo
2019-02-02 12:37:20 +00:00
if [ "$FINGERPRINTENB" == 0 ]; then
2020-08-27 09:07:28 +00:00
echo "Fingerprint modification currently"
echo "disabled because of a conflicting"
echo "module (see the logs for details)."
2018-03-18 15:39:43 +00:00
echo ""
echo "Nothing to do... Returning to main menu."
2018-06-19 09:56:08 +00:00
sleep 3
2018-03-18 15:39:43 +00:00
INPUT=""
break
else
2019-02-02 12:37:20 +00:00
if [ "$4" ] && [ "$PRINTEDIT" == 1 ]; then
2018-03-18 15:39:43 +00:00
PRINTMODULETXT=" (by this module)"
else
PRINTMODULETXT=""
fi
2019-04-02 19:42:29 +00:00
if [ "$PRINTSTAGE" == 0 ]; then
PRINTSTAGETXT="default"
elif [ "$PRINTSTAGE" == 1 ]; then
PRINTSTAGETXT="post-fs-data"
elif [ "$PRINTSTAGE" == 2 ]; then
PRINTSTAGETXT="late_start service"
fi
if [ "$PATCHSTAGE" == 0 ]; then
PATCHSTAGETXT="default"
elif [ "$PATCHSTAGE" == 1 ]; then
PATCHSTAGETXT="post-fs-data"
elif [ "$PATCHSTAGE" == 2 ]; then
PATCHSTAGETXT="late_start service"
fi
2018-03-28 16:50:15 +00:00
if [ "$2" ]; then
2018-04-15 22:05:33 +00:00
echo "Currently set to${PRINTMODULETXT}:"
2018-05-06 09:57:49 +00:00
echo ""
if [ "$PRINTMODULETXT" ]; then
2019-02-02 12:37:20 +00:00
get_device_used "$2"
2018-05-06 09:57:49 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e ${C}$2${N}
2018-03-28 16:39:57 +00:00
if [ "$2" != "$3" ]; then
2018-05-06 09:57:49 +00:00
echo ""
2018-03-28 16:39:57 +00:00
echo "The original value is:"
2020-08-14 08:01:35 +00:00
echo -e ${C}$3${N}
2018-03-28 16:39:57 +00:00
fi
else
echo "ro.build.fingerprint doesn't seem to"
echo "currently exist on your system."
2018-03-18 15:39:43 +00:00
fi
echo ""
echo "Enter the new fingerprint or"
echo "pick from the options below."
echo ""
2020-06-11 19:20:13 +00:00
$(magiskhide status)
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}f${N} - Pick a certified fingerprint"
2018-03-18 15:39:43 +00:00
if [ "$PRINTMODULETXT" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset fingerprint"
2018-03-18 15:39:43 +00:00
fi
2019-02-02 12:37:20 +00:00
if [ "$ORIGVENDPRINT" ]; then
if [ "$PRINTVEND" == 1 ]; then
VENDTXT="${G} (active)${N}"
else
VENDTXT=""
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}v${N} - Use vendor fingerprint (for Treble GSI ROMs)${VENDTXT}"
2019-02-02 12:37:20 +00:00
fi
2020-09-12 18:30:24 +00:00
if [ "$OPTIONWEBP" == 0 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}u${N} - Update fingerprints list (v$(get_file_value $PRINTSLOC "PRINTSV="))"
2018-04-15 22:05:33 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}s${N} - Boot stages (${C}${PRINTSTAGETXT}/${PATCHSTAGETXT}${N})."
echo -e "${G}b${N} - Go back."
echo -e "${G}e${N} - Exit"
2018-03-18 15:39:43 +00:00
echo ""
2019-02-02 12:37:20 +00:00
if [ "$PRINTCHK" == 1 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${R}The device fingerprint has been updated.${N}"
echo -e "${R}Please reboot to apply.${N}"
2019-02-02 12:37:20 +00:00
echo ""
fi
2018-04-19 03:13:40 +00:00
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-03-18 15:39:43 +00:00
read -r INPUT2
fi
fi
case "$INPUT2" in
2018-06-03 16:40:24 +00:00
f|F) menu_pick_print "$1"
2018-03-18 15:39:43 +00:00
;;
2018-06-19 09:56:08 +00:00
r|R)
2018-03-18 15:39:43 +00:00
if [ "$PRINTMODULETXT" ]; then
menu_reset_print "Reset fingerprint"
else
2018-04-15 22:05:33 +00:00
menu_new_print "$1" "$INPUT2" 2
2018-03-18 15:39:43 +00:00
fi
;;
2019-02-02 12:37:20 +00:00
v|V)
if [ "$ORIGVENDPRINT" ]; then
menu_vendor_print "$1"
else
2019-02-10 16:12:18 +00:00
invalid_input 6 2
2019-02-02 12:37:20 +00:00
fi
;;
2018-06-19 09:56:08 +00:00
u|U)
2020-09-12 18:30:24 +00:00
if [ "$OPTIONWEBP" == 0 ]; then
2018-06-19 09:56:08 +00:00
menu_update_print "Update fingerprints list"
else
menu_new_print "$1" "$INPUT2" 2
fi
2018-04-15 22:05:33 +00:00
;;
2019-03-27 10:50:00 +00:00
s|S) menu_bootstage_print "$1"
;;
2018-06-03 16:40:24 +00:00
b|B)
2018-03-18 15:39:43 +00:00
INPUT=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
2018-06-03 16:40:24 +00:00
""|[[:blank:]]*) blank_input 2
2018-05-29 20:44:54 +00:00
;;
2018-10-25 06:37:05 +00:00
*)
if [ "${#INPUT2}" -lt 10 ]; then
2019-02-10 16:12:18 +00:00
invalid_input 6 2
2018-10-25 06:37:05 +00:00
else
menu_new_print "$1" "$INPUT2" 2
fi
2018-03-18 15:39:43 +00:00
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - pick fingerprint, $1=header
2018-04-15 22:05:33 +00:00
menu_pick_print() {
2020-03-06 12:37:19 +00:00
DEVPRINTS="" # Disable automatically entering the fingerprints list after the first time.
2018-03-18 15:39:43 +00:00
INPUT3=""
2018-04-15 22:05:33 +00:00
OEMLIST=""
2019-03-27 10:50:00 +00:00
HEADERPRINTV="${C}$1${N}\n List version - v$(get_file_value $PRINTSLOC "PRINTSV=")\n Select an option below."
2018-03-18 15:39:43 +00:00
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT3" ]; then
2018-10-30 08:28:47 +00:00
# Load the list of fingerprint files
log_handler "Loading fingerprints list v$(get_file_value $PRINTSLOC "PRINTSV=")."
2018-10-25 06:37:05 +00:00
OEMLIST="$(ls $PRINTFILES | sed 's|\.sh||g')"
2018-10-30 08:28:47 +00:00
if [ "$OEMLIST" ]; then
# Check for custom fingerprints list
2018-12-09 09:05:50 +00:00
if [ -s "$CSTMPRINTS" ] && [ ! -f "$CSTMFILE" ]; then
2018-10-30 08:28:47 +00:00
log_handler "Found custom fingerprints list."
2018-12-09 09:05:50 +00:00
format_file $CSTMPRINTS
2018-10-30 08:28:47 +00:00
log_handler "Creating custom prints file."
2018-10-30 08:59:15 +00:00
cat $CSTMPRINTS >> $LOGFILE 2>&1 && echo "" >> $LOGFILE 2>&1
2018-10-30 08:28:47 +00:00
echo -e "PRINTSLIST=\"" >> $CSTMFILE
cat $CSTMPRINTS >> $CSTMFILE
echo -e "\"" >> $CSTMFILE
# Reload the list with new files
OEMLIST="$(ls $PRINTFILES | sed 's|\.sh||g')"
fi
ITEMCOUNT=1
2019-03-27 10:50:00 +00:00
menu_header "$HEADERPRINTV"
2018-10-30 08:28:47 +00:00
echo ""
2020-03-06 12:37:19 +00:00
# Display currently set print when fingerprints testing
if [ "$(get_file_value $PRINTSLOC "PRINTSV=")" == "Dev" ]; then
TMPDEVPRINT="$(getprop ro.build.fingerprint)"
echo "Currently set to:"
get_device_used $TMPDEVPRINT
2020-08-14 08:01:35 +00:00
echo -e "${C}$TMPDEVPRINT${N}"
2020-03-06 12:37:19 +00:00
echo ""
fi
2018-10-30 08:28:47 +00:00
for ITEM in $OEMLIST; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $ITEM"
2018-10-30 08:28:47 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-10-30 08:28:47 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-10-30 08:28:47 +00:00
read -r INPUT3
else
log_handler "No fingerprints list."
collect_logs "issue"
2018-11-18 06:31:58 +00:00
menu_header "${C}$1${N}\n Something's wrong!"
2018-10-30 08:28:47 +00:00
echo "Hm... That's not right."
echo ""
echo "There is currently no fingerprints list"
echo "available. Try updating it manually."
echo ""
echo "If the issue persists, report it in the"
2020-08-14 08:01:35 +00:00
echo -e "support thread @ XDA, ${R}with logs!${C}"
2018-10-30 08:28:47 +00:00
echo ""
echo "Logs have automatically been saved to"
2020-08-14 08:01:35 +00:00
echo -e "your internal storage ${R}(propslogs.tar.gz)${C}."
2018-10-30 08:28:47 +00:00
echo ""
echo -n "Press enter to continue..."
read -r INPUTTMP
INPUT2=""
break
fi
2018-03-18 15:39:43 +00:00
fi
2019-11-22 19:19:18 +00:00
case "$INPUT3" in
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*)
if [ "$INPUT3" -ge 1 -a "$INPUT3" -lt "$ITEMCOUNT" ]; then
ITEMCOUNT=1
for ITEM in $OEMLIST; do
if [ "$ITEMCOUNT" == "$INPUT3" ]; then
menu_pick_print_sub "$HEADERPRINTV" "$ITEM"
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
invalid_input 1 3
2018-03-18 15:39:43 +00:00
fi
2019-11-22 19:19:18 +00:00
;;
esac
2018-03-18 15:39:43 +00:00
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - pick fingerprint, $1=header, $2=OEM
2018-04-15 22:05:33 +00:00
menu_pick_print_sub() {
2018-10-25 06:37:05 +00:00
# Loading fingerprints
2018-10-30 08:28:47 +00:00
TMPFILE=$PRINTFILES/$2.sh
if [ -f "$TMPFILE" ]; then
. $TMPFILE
INPUT4=""
else
2019-03-27 10:50:00 +00:00
menu_header "$1"
2018-10-30 08:28:47 +00:00
log_handler "Can't find '$TMPFILE'."
collect_logs "issue"
echo "Oh no! Something went wrong..."
echo ""
echo "Can't find the fingerprints file."
echo "Try updating it manually."
echo ""
echo "If the issue persists, report it in the"
2020-08-14 08:01:35 +00:00
echo -e "support thread @ XDA, ${R}with logs!${C}"
2018-10-30 08:28:47 +00:00
echo ""
echo "Logs have automatically been saved to"
2020-08-14 08:01:35 +00:00
echo -e "your internal storage ${R}(propslogs.tar.gz)${C}."
2018-10-30 08:28:47 +00:00
echo ""
echo -n "Press enter to continue..."
read -r INPUTTMP
INPUT4="b"
fi
2018-03-18 15:39:43 +00:00
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT4" ]; then
ITEMCOUNT=1
2019-03-27 10:50:00 +00:00
menu_header "$1"
2018-04-15 22:05:33 +00:00
echo ""
2020-09-12 18:30:24 +00:00
# Display currently set print when fingerprints testing
if [ "$(get_file_value $PRINTSLOC "PRINTSV=")" == "Dev" ]; then
TMPDEVPRINT="$(getprop ro.build.fingerprint)"
echo "Currently set to:"
get_device_used $TMPDEVPRINT
echo -e "${C}$TMPDEVPRINT${N}"
echo ""
fi
2018-04-15 22:05:33 +00:00
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for ITEM in $PRINTSLIST; do
2018-10-30 08:28:47 +00:00
if [ "$(get_first $ITEM)" == "$2" ] || [ "$2" == "Custom" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $(get_device "$ITEM")"
2018-04-15 22:05:33 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
fi
done
IFS=$SAVEIFS
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT4
fi
2019-11-22 19:19:18 +00:00
case "$INPUT4" in
b|B)
INPUT3=""
break
;;
e|E) exit_fn
;;
*)
if [ "$INPUT4" -ge 1 -a "$INPUT4" -lt "$ITEMCOUNT" ]; then
ITEMCOUNT=1
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for ITEM in $PRINTSLIST; do
if [ "$ITEMCOUNT" == "$INPUT4" ]; then
case "$ITEM" in
*\;*)
IFS=$SAVEIFS
2020-02-26 21:08:29 +00:00
menu_pick_print_version "$1" "$(get_device "$ITEM")" "$(get_eq_right "$ITEM")"
2019-11-22 19:19:18 +00:00
INPUT2=""
INPUT3=""
break
;;
*)
IFS=$SAVEIFS
menu_new_print "$1" "$(get_eq_right "$ITEM")"
INPUT2=""
INPUT3=""
break
;;
esac
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
IFS=$SAVEIFS
else
invalid_input 1 4
2018-04-15 22:05:33 +00:00
fi
2019-11-22 19:19:18 +00:00
;;
esac
2018-04-15 22:05:33 +00:00
done
}
2020-08-14 08:01:35 +00:00
# Fifth menu level - pick Android version, $1=header, $2=Device, $3=fingerprint string (without device info)
2019-03-27 10:50:00 +00:00
menu_pick_print_version() {
2018-04-15 22:05:33 +00:00
INPUT5=""
2019-03-27 10:50:00 +00:00
ANDROIDV="$(get_print_versions "$2")"
2018-04-15 22:05:33 +00:00
while true
do
if [ -z "$INPUT5" ]; then
2019-03-27 10:50:00 +00:00
ITEMCOUNT=1
menu_header "$1"
echo ""
echo "There are several fingerprints available"
echo "for this device, for different versions"
echo "of Android. Pick one."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$(echo "$2" | sed 's| (.*||')${N}"
2019-03-27 10:50:00 +00:00
echo ""
for ITEM in $ANDROIDV; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - Android version ${C}$ITEM${N}"
2019-03-27 10:50:00 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2019-03-27 10:50:00 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2019-03-27 10:50:00 +00:00
read -r INPUT5
fi
2019-11-22 19:19:18 +00:00
case "$INPUT5" in
b|B)
INPUT4=""
break
;;
e|E) exit_fn
;;
*)
if [ "$INPUT5" -ge 1 -a "$INPUT5" -lt "$ITEMCOUNT" ]; then
ITEMCOUNT=1
for ITEM in $ANDROIDV; do
if [ "$ITEMCOUNT" == "$INPUT5" ]; then
TMPPRINT="$(echo $3 | cut -f $ITEMCOUNT -d ';')"
menu_new_print "$1" "$TMPPRINT"
INPUT2=""
INPUT3=""
INPUT4=""
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
invalid_input 1 5
2019-03-27 10:50:00 +00:00
fi
2019-11-22 19:19:18 +00:00
;;
esac
2019-03-27 10:50:00 +00:00
done
}
2020-08-14 08:01:35 +00:00
# Sixth menu level - confirm fingerprint, $1=header, $2=fingerprint
2019-03-27 10:50:00 +00:00
menu_new_print() {
2020-03-06 12:37:19 +00:00
# Check if fingerprints testing is active
if [ "$(get_file_value $PRINTSLOC "PRINTSV=")" == "Dev" ]; then
DEVCHK=true
INPUT6=y
else
DEVCHK=false
INPUT6=""
fi
2019-03-27 10:50:00 +00:00
while true
do
if [ -z "$INPUT6" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
echo "You are about to use the following as your device's fingerprint."
2018-05-06 09:57:49 +00:00
echo ""
2019-02-02 12:37:20 +00:00
get_device_used "$2"
2020-08-14 08:01:35 +00:00
echo -e "${V}$(get_print_display $2)${N}"
2018-03-18 15:39:43 +00:00
echo ""
echo "Make sure that it is correct before continuing."
2019-11-02 22:24:17 +00:00
echo "Do you want to continue?"
2018-03-18 15:39:43 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2019-03-27 10:50:00 +00:00
read -r INPUT6
2018-03-18 15:39:43 +00:00
fi
2019-03-27 10:50:00 +00:00
case "$INPUT6" in
2018-06-03 16:40:24 +00:00
y|Y)
2018-05-06 09:57:49 +00:00
change_print "$1" "$2"
2020-03-06 12:37:19 +00:00
if [ "$DEVCHK" == "true" ]; then
force_reboot
fi
2019-02-02 12:37:20 +00:00
INPUT2=""
INPUT3=""
INPUT4=""
2019-03-27 10:50:00 +00:00
INPUT5=""
2018-03-18 15:39:43 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-03-18 15:39:43 +00:00
INPUT2=""
INPUT3=""
2018-04-15 22:05:33 +00:00
INPUT4=""
2019-03-27 10:50:00 +00:00
INPUT5=""
2018-03-18 15:39:43 +00:00
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
2019-03-27 10:50:00 +00:00
*) invalid_input 3 6
2018-03-18 15:39:43 +00:00
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset fingerprint, $1=header
2018-03-18 15:39:43 +00:00
menu_reset_print() {
INPUT3=""
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT3" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
echo "This will reset the device"
echo "fingerprint to the default value."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-03-18 15:39:43 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2020-10-25 19:49:49 +00:00
y|Y)
2018-03-18 15:39:43 +00:00
reset_print "$1"
2019-02-02 12:37:20 +00:00
INPUT2=""
2018-03-18 15:39:43 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-03-18 15:39:43 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Vendor fingerprint, $1=header
2019-02-02 12:37:20 +00:00
menu_vendor_print() {
INPUT3=""
while true
do
if [ "$PRINTVEND" == 0 ]; then
STATETXT="${G}enable${N}"
CURRTXT="${R}disabled${N}"
TMPVAL=1
else
STATETXT="${R}disable${N}"
CURRTXT="${G}enabled${N}"
TMPVAL=0
fi
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "This will $STATETXT using the vendor"
2019-02-02 12:37:20 +00:00
echo "fingerprint for Treble GSI ROMs."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "The option is currently $CURRTXT."
2019-02-02 12:37:20 +00:00
echo ""
echo "Do you want to continue?"
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2019-02-02 12:37:20 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
change_print_vendor "$1" "$TMPVAL"
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Update fingerprints listj, $1=header
2018-04-15 22:05:33 +00:00
menu_update_print() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}\n List version - v$(get_file_value $PRINTSLOC "PRINTSV=")"
echo ""
echo "Do you want to check online if there"
echo "is an update to the fingerprints list?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-04-15 22:05:33 +00:00
read -r INPUT3
2018-03-18 15:39:43 +00:00
fi
2018-04-15 22:05:33 +00:00
case "$INPUT3" in
2020-10-25 19:49:49 +00:00
y|Y)
2018-04-15 22:05:33 +00:00
download_prints "manual"
INPUT2=""
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-04-15 22:05:33 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Boot stage, $1=header
2019-03-27 10:50:00 +00:00
menu_bootstage_print() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
if [ "$PRINTSTAGE" == 0 ]; then
2019-04-02 19:42:29 +00:00
PRINTSTAGETXT=" ${C}(default)${N}"
elif [ "$PRINTSTAGE" == 1 ]; then
PRINTSTAGETXT=" ${C}(post-fs-data)${N}"
elif [ "$PRINTSTAGE" == 2 ]; then
PRINTSTAGETXT=" ${C}(late_start service)${N}"
fi
if [ "$PATCHSTAGE" == 0 ]; then
PATCHSTAGETXT=" ${C}(default)${N}"
elif [ "$PATCHSTAGE" == 1 ]; then
PATCHSTAGETXT=" ${C}(post-fs-data)${N}"
elif [ "$PATCHSTAGE" == 2 ]; then
PATCHSTAGETXT=" ${C}(late_start service)${N}"
fi
menu_header "${C}$1${N}"
echo ""
echo "Change boot stage for the device fingerprint"
echo "or security patch date props."
echo ""
echo "Pick an option below."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Device fingerprint$PRINTSTAGETXT."
echo -e "${G}2${N} - Security patch date$PATCHSTAGETXT."
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2019-04-02 19:42:29 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2019-04-02 19:42:29 +00:00
read -r INPUT3
fi
case "$INPUT3" in
1)
menu_bootstage_print_set "$1" "print"
INPUT2=""
break
;;
2)
menu_bootstage_print_set "$1" "patch"
INPUT2=""
break
;;
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 1 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - Set boot stage, $1=header, $2=type (print or patch)
2019-04-02 19:42:29 +00:00
menu_bootstage_print_set() {
INPUT4=""
while true
do
if [ -z "$INPUT4" ]; then
if [ "$2" == "print" ]; then
PROPTXT="fingerprint"
TMPSTAGE=$PRINTSTAGE
CHNGSTAGE="PRINTSTAGE"
elif [ "$2" == "patch" ]; then
PROPTXT="security patch date"
TMPSTAGE=$PATCHSTAGE
CHNGSTAGE="PATCHSTAGE"
fi
if [ "$TMPSTAGE" == 0 ]; then
2019-03-27 10:50:00 +00:00
CURRTXT="default"
TMPTXT="${C}post-fs-data${N} or ${C}late_start sevice${N}"
CHOICETXT="${G}p${N}(ost), ${G}l${N}(ate)"
2019-04-02 19:42:29 +00:00
elif [ "$TMPSTAGE" == 1 ]; then
2019-03-27 10:50:00 +00:00
CURRTXT="post-fs-data"
TMPTXT="${C}default${N} or ${C}late_start service${N}"
CHOICETXT="${G}d${N}(efault), ${G}l${N}(ate)"
2019-04-02 19:42:29 +00:00
elif [ "$TMPSTAGE" == 2 ]; then
2019-03-27 10:50:00 +00:00
CURRTXT="late_start service"
TMPTXT="${C}default${N} or ${C}post-fs-data${N}"
CHOICETXT="${G}d${N}(efault), ${G}p${N}(post)"
fi
menu_header "${C}$1${N}"
echo ""
2019-04-02 19:42:29 +00:00
echo "Current boot stage for $PROPTXT is"
2020-08-27 09:07:28 +00:00
echo -e "${G}$CURRTXT${N}."
2019-03-27 10:50:00 +00:00
echo ""
echo "Do you want to change it to"
2020-08-14 08:01:35 +00:00
echo -e "$TMPTXT?"
2019-03-27 10:50:00 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter $CHOICETXT, ${G}b${N}(ack) or ${G}e${N}(xit): "
2019-04-02 19:42:29 +00:00
read -r INPUT4
2019-03-27 10:50:00 +00:00
fi
2019-04-02 19:42:29 +00:00
case "$INPUT4" in
2019-03-27 10:50:00 +00:00
d|D)
2019-04-02 19:42:29 +00:00
if [ "$TMPSTAGE" != 0 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=0
2019-04-02 19:42:29 +00:00
log_handler "Boot stage for $PROPTXT changed to default."
replace_fn $CHNGSTAGE $TMPSTAGE $OPTNEW $LATEFILE
2019-03-27 10:50:00 +00:00
# Load module values
. $LATEFILE
2019-04-02 19:42:29 +00:00
INPUT3=""
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
2019-04-02 19:42:29 +00:00
invalid_input 1 4
2019-03-27 10:50:00 +00:00
fi
;;
p|P)
2019-04-02 19:42:29 +00:00
if [ "$TMPSTAGE" != 1 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=1
2019-04-02 19:42:29 +00:00
log_handler "Boot stage for $PROPTXT changed to post-fs-data."
replace_fn $CHNGSTAGE $TMPSTAGE $OPTNEW $LATEFILE
2019-03-27 10:50:00 +00:00
# Load module values
. $LATEFILE
2019-04-02 19:42:29 +00:00
INPUT3=""
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
2019-04-02 19:42:29 +00:00
invalid_input 1 4
2019-03-27 10:50:00 +00:00
fi
;;
l|L)
2019-04-02 19:42:29 +00:00
if [ "$TMPSTAGE" != 2 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=2
2019-04-02 19:42:29 +00:00
log_handler "Boot stage for $PROPTXT changed to late_start service."
replace_fn $CHNGSTAGE $TMPSTAGE $OPTNEW $LATEFILE
2019-03-27 10:50:00 +00:00
# Load module values
. $LATEFILE
2019-04-02 19:42:29 +00:00
INPUT3=""
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
2019-04-02 19:42:29 +00:00
invalid_input 1 4
2019-03-27 10:50:00 +00:00
fi
;;
b|B)
2019-04-02 19:42:29 +00:00
INPUT3=""
2019-03-27 10:50:00 +00:00
break
;;
e|E) exit_fn
;;
2019-04-02 19:42:29 +00:00
*) invalid_input 1 4
2019-03-27 10:50:00 +00:00
;;
esac
done
}
2020-07-26 18:52:55 +00:00
# ======================== Force BASIC key attestation ========================
2020-08-14 08:01:35 +00:00
# Second menu level - BASIC attestation, $1=header
2020-07-26 18:52:55 +00:00
menu_force_basic() {
INPUT2=""
while true
do
if [ "$BASICATTEST" == 0 ]; then
2020-10-25 19:49:49 +00:00
fn_oem_file # Find the OEM print file used
2020-07-26 18:52:55 +00:00
STATETXT="${G}enable${N}"
2020-10-25 19:49:49 +00:00
if [ "$BASICATTMODEL" ]; then
YTXT=" (use default value, ${C}$BASICATTMODEL${N})"
else
YTXT=" (use default value, ${C}$(getprop ro.product.device)${N})"
fi
2020-07-26 18:52:55 +00:00
else
STATETXT="${R}disable${N}"
YTXT=""
fi
if [ "$BASICATTCUST" ]; then
CUSTTXT=" ${G}active${N}"
else
CUSTTXT=""
fi
if [ "$BASICATTLIST" ]; then
LISTTXT=" ${G}active${N}"
else
LISTTXT=""
fi
if [ -z "$INPUT2" ]; then
menu_header "${C}$1${N}"
echo ""
2020-09-07 20:00:48 +00:00
echo "Edit device model to change"
echo "bootloader state check from"
echo "hardware based to basic."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to $STATETXT"
2020-07-26 18:52:55 +00:00
echo "forced BASIC key attestation?"
echo ""
echo "The currently loaded value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$(getprop ro.product.model)${N}"
2020-07-26 18:52:55 +00:00
if [ "$BASICATTEST" == 1 ] && [ "$ORIGMODEL" != "$(getprop ro.product.model)" ]; then
echo "(Set by this module.)"
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes$YTXT"
echo -e "${G}n${N} - No"
2020-10-25 19:49:49 +00:00
echo -e "${G}d${N} - Pick from device list$LISTTXT"
2020-08-14 08:01:35 +00:00
echo -e "${G}c${N} - Custom value$CUSTTXT"
2020-07-26 18:52:55 +00:00
if [ "$BASICATTCUST" ] || [ "$BASICATTLIST" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset"
2020-07-26 18:52:55 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
if [ "$BASICATTEST" == 0 ]; then
echo "This may disable some device"
echo "specific features, like the"
echo "Samsung Galaxy Store. YMMV."
echo ""
fi
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
echo -n "Enter your desired option: "
read -r INPUT2
fi
case "$INPUT2" in
y|Y)
forced_basic "$1"
INPUT=""
;;
n|N)
INPUT=""
break
;;
2020-10-25 19:49:49 +00:00
d|D)
2020-07-26 18:52:55 +00:00
forced_list_menu "$1"
INPUT=""
;;
c|C)
forced_custom_menu "$1"
INPUT=""
;;
r|R)
if [ "$BASICATTCUST" ] || [ "$BASICATTLIST" ]; then
forced_reset_menu "$1"
INPUT=""
break
else
invalid_input 1 2
fi
;;
e|E) exit_fn
;;
*) invalid_input 1 2
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Pick from list, $1=header
2020-07-26 18:52:55 +00:00
forced_list_menu() {
INPUT3=""
OEMLIST=""
HEADERPRINTV="${C}$1${N}\n List version - v$(get_file_value $PRINTSLOC "PRINTSV=")\n Select an option below."
while true
do
if [ -z "$INPUT3" ]; then
# Load the list of fingerprint files
log_handler "Loading fingerprints list v$(get_file_value $PRINTSLOC "PRINTSV=")."
OEMLIST="$(ls $PRINTFILES | sed 's|\.sh||g')"
if [ "$OEMLIST" ]; then
ITEMCOUNT=1
menu_header "$HEADERPRINTV"
echo ""
for ITEM in $OEMLIST; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $ITEM"
2020-07-26 18:52:55 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
echo ""
if [ "$BASICATTLIST" ]; then
echo "The currently set list value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$BASICATTLIST${N}"
2020-07-26 18:52:55 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset list value"
2020-07-26 18:52:55 +00:00
else
echo "Currently the default/custom"
echo "values are being used."
echo ""
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
2020-10-25 19:49:49 +00:00
echo "Do NOT use your actual device."
echo "Pick a device as close to yours"
echo "as you can, to possibly keep"
echo "device specific features working."
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-07-26 18:52:55 +00:00
echo -n "Enter your desired option: "
read -r INPUT3
else
log_handler "No fingerprints list."
collect_logs "issue"
menu_header "${C}$1${N}\n Something's wrong!"
echo "Hm... That's not right."
echo ""
echo "There is currently no fingerprints list"
echo "available. Try updating it manually."
echo ""
echo "If the issue persists, report it in the"
2020-08-14 08:01:35 +00:00
echo -e "support thread @ XDA, ${R}with logs!${C}"
2020-07-26 18:52:55 +00:00
echo ""
echo "Logs have automatically been saved to"
2020-08-14 08:01:35 +00:00
echo -e "your internal storage ${R}(propslogs.tar.gz)${C}."
2020-07-26 18:52:55 +00:00
echo ""
echo -n "Press enter to continue..."
read -r INPUTTMP
INPUT2=""
break
fi
fi
case "$INPUT3" in
r|R)
if [ "$BASICATTLIST" ]; then
forced_list_reset_menu "$1"
INPUT2=""
break
else
invalid_input 1 3
fi
;;
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*)
if [ "$INPUT3" -ge 1 -a "$INPUT3" -lt "$ITEMCOUNT" ]; then
ITEMCOUNT=1
for ITEM in $OEMLIST; do
if [ "$ITEMCOUNT" == "$INPUT3" ]; then
forced_list_pick_menu "$HEADERPRINTV" "$ITEM"
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
invalid_input 1 3
fi
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - reset list value, $1=header
2020-07-26 18:52:55 +00:00
forced_list_reset_menu() {
INPUT4=""
2020-10-25 19:49:49 +00:00
fn_oem_file # Find the OEM print file used
2020-07-26 18:52:55 +00:00
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Are you sure you want to reset"
echo "the list value for forced BASIC"
2020-10-25 19:49:49 +00:00
echo "key attestation to the default"
if [ "$BASICATTMODEL" ]; then
echo -e "value (${C}$BASICATTMODEL${N})?"
else
echo -e "value (${C}$(getprop ro.product.device)${N})?"
fi
2020-07-26 18:52:55 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-07-26 18:52:55 +00:00
read -r INPUT4
fi
case "$INPUT4" in
y|Y)
forced_reset "$1" 1
INPUT2=""
INPUT3=""
break
;;
n|N)
INPUT3=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - pick from list, $1=header, $2=OEM
2020-07-26 18:52:55 +00:00
forced_list_pick_menu() {
# Loading fingerprints
TMPFILE=$PRINTFILES/$2.sh
if [ -f "$TMPFILE" ]; then
. $TMPFILE
INPUT4=""
else
menu_header "$1"
log_handler "Can't find '$TMPFILE'."
collect_logs "issue"
echo "Oh no! Something went wrong..."
echo ""
echo "Can't find the fingerprints file."
echo "Try updating it manually."
echo ""
echo "If the issue persists, report it in the"
2020-08-14 08:01:35 +00:00
echo -e "support thread @ XDA, ${R}with logs!${C}"
2020-07-26 18:52:55 +00:00
echo ""
echo "Logs have automatically been saved to"
2020-08-14 08:01:35 +00:00
echo -e "your internal storage ${R}(propslogs.tar.gz)${C}."
2020-07-26 18:52:55 +00:00
echo ""
echo -n "Press enter to continue..."
read -r INPUTTMP
INPUT4="b"
fi
while true
do
if [ -z "$INPUT4" ]; then
ITEMCOUNT=1
menu_header "$1"
echo ""
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for ITEM in $PRINTSLIST; do
if [ "$(get_first $ITEM)" == "$2" ]; then
2020-09-23 08:30:49 +00:00
echo -e "${G}$ITEMCOUNT${N} - $(get_device "$ITEM" | sed "s| (.*)||")"
2020-07-26 18:52:55 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
fi
done
IFS=$SAVEIFS
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo -n "Enter your desired option: "
read -r INPUT4
fi
case "$INPUT4" in
b|B)
INPUT3=""
break
;;
e|E) exit_fn
;;
*)
if [ "$INPUT4" -ge 1 -a "$INPUT4" -lt "$ITEMCOUNT" ]; then
ITEMCOUNT=1
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for ITEM in $PRINTSLIST; do
if [ "$ITEMCOUNT" == "$INPUT4" ]; then
IFS=$SAVEIFS
forced_list_confirm_menu "$1" "$(get_eq_left "$ITEM" | sed "s|^.*\:||")"
INPUT2=""
INPUT3=""
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
IFS=$SAVEIFS
else
invalid_input 1 4
fi
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fifth menu level - confirm list value, $1=header, $2=device info
2020-07-26 18:52:55 +00:00
forced_list_confirm_menu() {
INPUT5=""
while true
do
if [ -z "$INPUT5" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Do you want to use the following"
echo "as the value for the module props?"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$2${N}"
2020-07-26 18:52:55 +00:00
echo ""
if [ "$BASICATTLIST" ]; then
echo "The currently set list value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$BASICATTLIST${N}"
2020-07-26 18:52:55 +00:00
else
echo "Currently the default/custom"
echo "values are being used."
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-07-26 18:52:55 +00:00
read -r INPUT5
fi
case "$INPUT5" in
y|Y)
forced_list_confirm "$1" "$2"
INPUT2=""
INPUT3=""
INPUT4=""
break
;;
n|N)
INPUT4=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 5
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - set custom value, $1=header
2020-07-26 18:52:55 +00:00
forced_custom_menu() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Enter the value you want the"
echo "module props to have, or pick"
echo "an option below."
echo ""
if [ "$BASICATTCUST" ]; then
echo "The currently set custom value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$BASICATTCUST${N}"
2020-07-26 18:52:55 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset custom value"
2020-07-26 18:52:55 +00:00
else
echo "Currently the default/list"
echo "values are being used."
echo ""
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Back"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
echo -n "Enter your desired option: "
read -r INPUT3
fi
case "$INPUT3" in
r|R)
if [ "$BASICATTCUST" ]; then
forced_custom_reset_menu "$1"
INPUT2=""
break
else
invalid_input 1 3
fi
;;
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) forced_custom_confirm_menu "$1" "$INPUT3"
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - reset custom value, $1=header
2020-07-26 18:52:55 +00:00
forced_custom_reset_menu() {
INPUT4=""
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Are you sure you want to reset"
echo "the custom value for forced BASIC"
2020-10-25 19:49:49 +00:00
echo "key attestation to the default"
if [ "$BASICATTMODEL" ]; then
echo -e "value (${C}$BASICATTMODEL${N})?"
else
echo -e "value (${C}$(getprop ro.product.device)${N})?"
fi
2020-07-26 18:52:55 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-07-26 18:52:55 +00:00
read -r INPUT4
fi
case "$INPUT4" in
y|Y)
forced_reset "$1" 2
INPUT2=""
INPUT3=""
break
;;
n|N)
INPUT3=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - confirm custom value, $1=header, $2=custom input value
2020-07-26 18:52:55 +00:00
forced_custom_confirm_menu() {
INPUT4=""
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Do you want to use the following"
echo "as the value for the module props?"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$2${N}"
2020-07-26 18:52:55 +00:00
echo ""
if [ "$BASICATTCUST" ]; then
echo "The currently set custom value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$BASICATTCUST${N}"
2020-07-26 18:52:55 +00:00
else
echo "Currently the default module"
echo "values are being used."
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-07-26 18:52:55 +00:00
read -r INPUT4
fi
case "$INPUT4" in
y|Y)
forced_custom_confirm "$1" "$2"
INPUT2=""
INPUT3=""
break
;;
n|N)
INPUT3=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - reset, $1=header
2020-07-26 18:52:55 +00:00
forced_reset_menu() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Are you sure you want to reset"
echo "the custom/list value for forced"
echo "BASIC key attestation to the default."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
2020-07-26 18:52:55 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-07-26 18:52:55 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
forced_reset "$1" 3
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
done
}
2019-02-02 12:37:20 +00:00
# ======================== Device simulation ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Device simulation, $1=header
2019-02-02 12:37:20 +00:00
menu_dev_sim() {
INPUT2=""
while true
do
ENABLE="${G} (enabled)${N}"
DISABLE="${R} (disabled)${N}"
DEVSIMTXT=""
DESCRIPTIONTXT=""
2019-11-02 22:24:17 +00:00
DISPTXT=""
2019-03-27 10:50:00 +00:00
SDKTXT=""
2020-02-26 21:08:29 +00:00
MANUFACTURERTXT=""
MODELTXT=""
2019-02-02 12:37:20 +00:00
if [ "$DEVSIM" == 1 ]; then
DEVSIMTXT=$ENABLE
else
DEVSIMTXT=$DISABLE
fi
for ITEM in $PRINTPARTS; do
TMPPROP=$(get_prop_type $ITEM | tr '[:lower:]' '[:upper:]')
TMPVAR=$(echo "${TMPPROP}TXT")
if [ "$(get_file_value $LATEFILE "${TMPPROP}SET=")" == 1 ]; then
eval "${TMPPROP}TXT='$ENABLE'"
elif [ "$(get_file_value $LATEFILE "${TMPPROP}SET=")" == 0 ]; then
eval "${TMPPROP}TXT='$DISABLE'"
else
eval "${TMPPROP}TXT="
fi
done
if [ "$DESCRIPTIONSET" == 1 ]; then
DESCRIPTIONTXT=$ENABLE
else
DESCRIPTIONTXT=$DISABLE
fi
2019-11-02 22:24:17 +00:00
if [ "$DISPLAYSET" == 1 ]; then
DISPTXT=$ENABLE
else
DISPTXT=$DISABLE
fi
2019-03-27 10:50:00 +00:00
if [ "$SDKSET" == 1 ]; then
SDKTXT=$ENABLE
else
SDKTXT=$DISABLE
fi
2020-02-26 21:08:29 +00:00
if [ "$MANUFACTURERSET" == 1 ]; then
MANUFACTURERTXT=$ENABLE
else
MANUFACTURERTXT=$DISABLE
fi
if [ "$MODELSET" == 1 ]; then
MODELTXT=$ENABLE
else
MODELTXT=$DISABLE
fi
if [ "$PARTPROPSSET" == 1 ]; then
PARTPROPSTXT=$ENABLE
else
PARTPROPSTXT=$DISABLE
fi
2019-03-27 10:50:00 +00:00
if [ "$SIMSTAGE" == 0 ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(default)${N}"
2019-03-27 10:50:00 +00:00
elif [ "$SIMSTAGE" == 1 ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(post-fs-data)${N}"
2019-03-27 10:50:00 +00:00
elif [ "$SIMSTAGE" == 2 ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(late_start service)${N}"
2019-03-27 10:50:00 +00:00
fi
2019-02-02 12:37:20 +00:00
if [ -z "$INPUT2" ]; then
menu_header "${C}$1${N}"
echo ""
2020-09-07 20:00:48 +00:00
echo "Change prop values based on the"
echo "currently used fingerprint to"
echo "simulate that device."
echo ""
2019-02-02 12:37:20 +00:00
if [ "$PRINTEDIT" == 0 ]; then
echo "This option is only enabled if there"
echo "is a fingerprint set by the module."
echo ""
echo "Nothing to do... Returning to main menu."
sleep 3
INPUT=""
break
fi
2019-05-04 18:57:59 +00:00
echo "These settings will do basic device"
2019-02-02 12:37:20 +00:00
echo "simulation by setting certain props"
echo "based on the currently set device"
echo "fingerprint."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${R}Only enable this if you really need it"
2019-11-02 22:24:17 +00:00
echo "and be careful about which props you"
2020-08-14 08:01:35 +00:00
echo -e "enable.${N}"
2019-03-27 10:50:00 +00:00
echo ""
2019-02-02 12:37:20 +00:00
echo "Pick an option below."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G} s${N} - Device simulation${DEVSIMTXT}"
2019-02-02 12:37:20 +00:00
if [ "$DEVSIM" == 1 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G} 1${N} - ro.product.brand${BRANDTXT}"
echo -e "${G} 2${N} - ro.product.name${NAMETXT}"
echo -e "${G} 3${N} - ro.product.device${DEVICETXT}"
echo -e "${G} 4${N} - ro.build.version.release${RELEASETXT}"
echo -e "${G} 5${N} - ro.build.id${IDTXT}"
echo -e "${G} 6${N} - ro.build.version.incremental${INCREMENTALTXT}"
echo -e "${G} 7${N} - ro.build.version.sdk${SDKTXT}"
echo -e "${G} 8${N} - ro.build.display.id${DISPTXT}"
2020-02-26 21:08:29 +00:00
if [ "$SIMMANUFACTURER" ] && [ "$SIMMODEL" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G} 9${N} - ro.product.manufacturer${MANUFACTURERTXT}"
2021-01-14 21:01:33 +00:00
#if [ "$BASICATTEST" == 0 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}10${N} - ro.product.model${MODELTXT}"
2021-01-14 21:01:33 +00:00
#else
# echo -e " (Simulating ro.product.model is currently ${R}disabled${N}.)"
# echo ""
#fi
2020-02-26 21:08:29 +00:00
MANMODEN=true
else
MANMODEN=false
fi
2020-08-14 08:01:35 +00:00
echo -e "${G} a${N} - Enable/disable all props"
2019-02-02 12:37:20 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G} d${N} - ro.build.description${DESCRIPTIONTXT}"
echo -e "${G} p${N} - Use partition props$PARTPROPSTXT"
echo -e "${G} t${N} - Boot stage$STAGETXT"
echo -e "${G} b${N} - Go back"
echo -e "${G} e${N} - Exit"
2020-02-26 21:08:29 +00:00
echo ""
echo "Pick several options at once by"
echo "separating inputs with a comma."
echo "Example: 1,5,6"
2019-02-02 12:37:20 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2019-02-02 12:37:20 +00:00
read -r INPUT2
fi
case "$INPUT2" in
s|S) menu_dev_sim_enable "$1"
;;
2020-02-26 21:08:29 +00:00
*\,*|1|2|3|4|5|6|7|8|9|10|a|A|d|D)
case "$INPUT2" in
*\,*)
NUMCHECK="$(echo $(echo $INPUT2 | sed 's|\,||g') | tr -d [0-9])"
case "$INPUT2" in
*1*|*2*|*3*|*4*|*5*|*6*|*7*|*8*|*a*|*A*|*d*|*D*)
if [ -z "$NUMCHECK" ]; then
menu_dev_sim_prop "$1" "$INPUT2"
else
invalid_input 7 2
fi
;;
*9*|*10*)
if [ "$MANMODEN" == "false" ]; then
invalid_input 1 2
else
2021-01-14 21:01:33 +00:00
#if [ "$BASICATTEST" == 1 ]; then
# case "$INPUT2" in
# *10*) invalid_input 7 2
# ;;
# *)
# if [ -z "$NUMCHECK" ]; then
# menu_dev_sim_prop "$1" "$INPUT2"
# else
# invalid_input 7 2
# fi
# ;;
# esac
#else
2020-07-26 18:52:55 +00:00
if [ -z "$NUMCHECK" ]; then
menu_dev_sim_prop "$1" "$INPUT2"
else
invalid_input 7 2
fi
2021-01-14 21:01:33 +00:00
#fi
2020-02-26 21:08:29 +00:00
fi
;;
*)
invalid_input 1 2
;;
esac
;;
*)
if [ "$DEVSIM" == 1 ] || [ "$INPUT2" == "d" -o "$INPUT2" == "D" ]; then
if [ "$MANMODEN" == "false" ] && [ "$INPUT2" == 9 -o "$INPUT2" == 10 ]; then
invalid_input 1 2
else
2021-01-14 21:01:33 +00:00
#if [ "$BASICATTEST" == 1 ] && [ "$INPUT2" == 10 ]; then
# invalid_input 1 2
#else
2020-07-26 18:52:55 +00:00
menu_dev_sim_prop "$1" "$INPUT2"
2021-01-14 21:01:33 +00:00
#fi
2020-02-26 21:08:29 +00:00
fi
else
invalid_input 1 2
fi
;;
esac
2019-02-02 12:37:20 +00:00
;;
2019-03-27 10:50:00 +00:00
t|T) menu_bootstage_sim "$1"
;;
2020-02-26 21:08:29 +00:00
p|P) menu_partprops_sim "$1" "$PARTPROPSSET"
;;
2019-02-02 12:37:20 +00:00
b|B)
INPUT=""
break
;;
e|E) exit_fn
;;
*) invalid_input 1 2
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Enable device simulation, $1=header
2019-02-02 12:37:20 +00:00
menu_dev_sim_enable() {
INPUT3=""
while true
do
if [ "$DEVSIM" == 0 ]; then
STATETXT="${G}enable${N}"
CURRTXT="${R}disabled${N}"
else
STATETXT="${R}disable${N}"
CURRTXT="${G}enabled${N}"
fi
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to $STATETXT basic"
2019-02-02 12:37:20 +00:00
echo "device simulation?"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Currently $CURRTXT."
2019-02-02 12:37:20 +00:00
echo ""
if [ "$DEVSIM" == 0 ]; then
2019-11-02 22:24:17 +00:00
echo "Enabling this option will let you"
echo "set certain props based on the"
echo "currently used device fingerprint."
2019-02-02 12:37:20 +00:00
echo ""
fi
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2019-02-02 12:37:20 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
2019-11-02 22:24:17 +00:00
change_dev_sim "$1" "file"
2019-02-02 12:37:20 +00:00
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Set device simulation props, $1=header, $2=list value for specific prop/option
2019-02-02 12:37:20 +00:00
menu_dev_sim_prop() {
INPUT3=""
while true
do
2020-02-26 21:08:29 +00:00
TMPTXT=""
TMPPARTS=$PRINTPARTS$ADNSIMPROPS1$ADNSIMPROPS2
TMPITEMS=""
CNT=1
2019-02-02 12:37:20 +00:00
case "$2" in
2020-02-26 21:08:29 +00:00
*\,*) TMPTXT="Multi"
;;
2019-02-02 12:37:20 +00:00
1) TMPTXT="ro.build.brand"
;;
2) TMPTXT="ro.build.name"
;;
3) TMPTXT="ro.build.device"
;;
4) TMPTXT="ro.build.version.release"
;;
5) TMPTXT="ro.build.id"
;;
6) TMPTXT="ro.build.version.incremental"
;;
2019-03-27 10:50:00 +00:00
7) TMPTXT="ro.build.version.sdk"
;;
2019-11-02 22:24:17 +00:00
8) TMPTXT="ro.build.display.id"
;;
2020-02-26 21:08:29 +00:00
9) TMPTXT="ro.product.manufacturer"
;;
10) TMPTXT="ro.product.model"
;;
a|A) TMPTXT="All"
;;
2019-02-02 12:37:20 +00:00
d|D) TMPTXT="ro.build.description"
;;
esac
2020-02-26 21:08:29 +00:00
if [ "$TMPTXT" == "Multi" ] || [ "$TMPTXT" == "All" ]; then
TMPLST=$(echo $2 | sed 's|\,| |g')
for ITEM in $TMPPARTS; do
for INT in $TMPLST; do
if [ "$INT" == "$CNT" ]; then
if [ "$TMPITEMS" ]; then
TMPITEMS="$TMPITEMS $ITEM"
else
TMPITEMS="$ITEM"
fi
fi
done
CNT=$(($CNT+1))
done
if [ "$TMPTXT" == "All" ]; then
TYPETXT="all"
if [ "$MANMODEN" == "true" ]; then
TMPINPUT="$TMPPARTS"
else
TMPINPUT=$PRINTPARTS$ADNSIMPROPS1
fi
else
TYPETXT="the following"
TMPINPUT="$TMPITEMS"
fi
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to ${G}enable${N} or ${R}disable${N}"
2020-02-26 21:08:29 +00:00
echo "$TYPETXT simulation props?"
echo ""
if [ "$TMPTXT" == "Multi" ]; then
echo "${C}$(echo $TMPITEMS | sed 's| |\n|g')${N}"
echo ""
fi
2020-08-14 08:01:35 +00:00
echo -e "${R}Warning!${N} Some of these props"
2020-02-26 21:08:29 +00:00
echo "may cause issues with your device."
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Enable"
echo -e "${G}2${N} - Disable"
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2020-02-26 21:08:29 +00:00
echo ""
echo -n "Enter your desired option: "
read -r INPUT3
case "$INPUT3" in
1|2)
before_change
if [ "$INPUT3" == 1 ]; then
TMPVAL=1
else
TMPVAL=0
fi
for ITEM in $TMPINPUT; do
change_sim_prop "Device simulation" "$ITEM" "$TMPVAL" "none"
done
INPUT2=""
after_change "$1"
break
;;
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 1 3
;;
esac
fi
2019-02-02 12:37:20 +00:00
else
2020-02-26 21:08:29 +00:00
TMPPROP=$(get_prop_type $TMPTXT | tr '[:lower:]' '[:upper:]')
if [ "$(get_file_value $LATEFILE "${TMPPROP}SET=")" == 0 ]; then
STATETXT="${G}enable${N}"
CURRTXT="${R}disabled${N}"
TMPVAL=1
else
STATETXT="${R}disable${N}"
CURRTXT="${G}enabled${N}"
TMPVAL=0
fi
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to $STATETXT simulating"
echo -e "${C}${TMPTXT}${N}?"
echo -e "It is currently $CURRTXT."
2020-02-26 21:08:29 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-02-26 21:08:29 +00:00
read -r INPUT3
case "$INPUT3" in
y|Y)
if [ "$TMPPROP" == "DESCRIPTION" ]; then
change_sim_descr "$1" "$TMPVAL"
else
change_sim_prop "$1" "$TMPTXT" "$TMPVAL"
fi
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
fi
2019-02-02 12:37:20 +00:00
fi
2020-02-26 21:08:29 +00:00
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Partition props, $1=header, $2=Partition simulation currently enabled or disabled
2020-02-26 21:08:29 +00:00
menu_partprops_sim() {
INPUT3=""
while true
do
2019-02-02 12:37:20 +00:00
if [ -z "$INPUT3" ]; then
2020-02-26 21:08:29 +00:00
if [ "$2" == "1" ]; then
CURRTXT="enabled"
TMPTXT="disable"
OPTCURR=1
OPTNEW=0
else
CURRTXT="disabled"
TMPTXT="enable"
OPTCURR=0
OPTNEW=1
fi
2019-02-02 12:37:20 +00:00
menu_header "${C}$1${N}"
echo ""
2020-02-26 21:08:29 +00:00
echo "Partition specific props simulation"
2020-08-14 08:01:35 +00:00
echo -e "is currently ${G}$CURRTXT${N}."
2020-02-26 21:08:29 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to ${C}$TMPTXT${N} it?"
2019-02-02 12:37:20 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2019-02-02 12:37:20 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
2020-02-26 21:08:29 +00:00
change_sim_partprops "$1" "$OPTNEW"
2019-02-02 12:37:20 +00:00
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 3 3
;;
esac
2018-03-18 15:39:43 +00:00
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Boot stage, $1=header
2019-03-27 10:50:00 +00:00
menu_bootstage_sim() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
if [ "$SIMSTAGE" == 0 ]; then
CURRTXT="default"
TMPTXT="${C}post-fs-data${N} or ${C}late_start sevice${N}"
CHOICETXT="${G}p${N}(ost), ${G}l${N}(ate)"
elif [ "$SIMSTAGE" == 1 ]; then
CURRTXT="post-fs-data"
TMPTXT="${C}default${N} or ${C}late_start service${N}"
CHOICETXT="${G}d${N}(efault), ${G}l${N}(ate)"
elif [ "$SIMSTAGE" == 2 ]; then
CURRTXT="late_start service"
TMPTXT="${C}default${N} or ${C}post-fs-data${N}"
CHOICETXT="${G}d${N}(efault), ${G}p${N}(post)"
fi
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Current boot stage is ${G}$CURRTXT${N}."
2019-03-27 10:50:00 +00:00
echo ""
echo "Do you want to change it to"
2020-08-14 08:01:35 +00:00
echo -e "$TMPTXT?"
2019-03-27 10:50:00 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter $CHOICETXT, ${G}b${N}(ack) or ${G}e${N}(xit): "
2019-03-27 10:50:00 +00:00
read -r INPUT3
fi
case "$INPUT3" in
d|D)
if [ "$SIMSTAGE" != 0 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=0
log_handler "Boot stage changed to default."
replace_fn SIMSTAGE $SIMSTAGE $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
;;
p|P)
if [ "$SIMSTAGE" != 1 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=1
log_handler "Boot stage changed to post-fs-data."
replace_fn SIMSTAGE $SIMSTAGE $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
;;
l|L)
if [ "$SIMSTAGE" != 2 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=2
log_handler "Boot stage changed to late_start service."
replace_fn SIMSTAGE $SIMSTAGE $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
;;
b|B)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 1 3
;;
esac
done
}
2018-03-18 15:39:43 +00:00
# ======================== MagiskHide Props ========================
2020-08-14 08:01:35 +00:00
# Second menu level - MagiskHide props, $1=header
2018-03-18 15:39:43 +00:00
menu_magiskhide_props() {
INPUT2=""
while true
do
ACTIVE="${G} (active)${N}"
DEBUGGABLETXT=""
SECURETXT=""
TYPETXT=""
TAGSTXT=""
SELINUXTXT=""
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT2" ]; then
2019-02-02 12:37:20 +00:00
if [ "$REDEBUGGABLE" == "true" ]; then
2018-03-18 15:39:43 +00:00
DEBUGGABLETXT=$ACTIVE
fi
2019-02-02 12:37:20 +00:00
if [ "$RESECURE" == "true" ]; then
2018-03-18 15:39:43 +00:00
SECURETXT=$ACTIVE
fi
2019-02-02 12:37:20 +00:00
if [ "$RETYPE" == "true" ]; then
2018-03-18 15:39:43 +00:00
TYPETXT=$ACTIVE
fi
2020-02-26 21:08:29 +00:00
if [ "$RETAGS" == "true" ]; then
2018-03-18 15:39:43 +00:00
TAGSTXT=$ACTIVE
fi
2020-05-21 19:02:54 +00:00
if [ "$REBOOTMODE" == "true" ]; then
BOOTMODETXT=$ACTIVE
fi
if [ "$REMODE" == "true" ]; then
MODETXT=$ACTIVE
fi
2019-02-02 12:37:20 +00:00
if [ "$RESELINUX" == "true" ]; then
2018-03-18 15:39:43 +00:00
SELINUXTXT=$ACTIVE
fi
menu_header "${C}$1${N}\n Select an option below:"
echo ""
2020-05-21 19:02:54 +00:00
echo "Change some of the sensitive props set by MagiskHide."
2018-04-19 03:13:40 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - ro.debuggable${DEBUGGABLETXT}"
echo -e "${G}2${N} - ro.secure${SECURETXT}"
echo -e "${G}3${N} - ro.build.type${TYPETXT}"
echo -e "${G}4${N} - ro.build.tags${TAGSTXT}"
echo -e "${G}5${N} - ro.bootmode${BOOTMODETXT}"
echo -e "${G}6${N} - ro.boot.mode${MODETXT}"
2020-05-21 19:02:54 +00:00
if [ "$(getprop ro.build.selinux)" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}7${N} - ro.build.selinux${SELINUXTXT}"
2020-05-21 19:02:54 +00:00
fi
2020-02-26 21:08:29 +00:00
if [ "$PROPCOUNT" -lt 5 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}a${N} - Change all props"
2020-02-26 21:08:29 +00:00
fi
2019-02-02 12:37:20 +00:00
if [ "$PROPCOUNT" -gt 1 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset all props"
2018-03-18 15:39:43 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back to main menu"
echo -e "${G}e${N} - Exit"
2018-03-18 15:39:43 +00:00
echo ""
2020-02-26 21:08:29 +00:00
echo "Pick several options at once by"
echo "separating inputs with a comma."
2020-05-21 19:02:54 +00:00
echo "Example: 1,3,4"
2020-02-26 21:08:29 +00:00
echo ""
2018-04-19 03:13:40 +00:00
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-03-18 15:39:43 +00:00
read -r INPUT2
fi
case "$INPUT2" in
2020-02-26 21:08:29 +00:00
*\,*)
if [ -z "$(echo $(echo $INPUT2 | sed 's|\,||g') | tr -d [0-9])" ]; then
menu_change_prop "Change multiple props" $INPUT2
else
invalid_input 7 2
fi
;;
2020-10-25 19:49:49 +00:00
1) menu_change_prop "ro.debuggable" $CURRDEBUGGABLE $ORIGDEBUGGABLE $MODULEDEBUGGABLE
2018-03-18 15:39:43 +00:00
;;
2020-02-26 21:08:29 +00:00
2) menu_change_prop "ro.secure" $CURRSECURE $ORIGSECURE $MODULESECURE
2018-03-18 15:39:43 +00:00
;;
2020-02-26 21:08:29 +00:00
3) menu_change_prop "ro.build.type" $CURRTYPE $ORIGTYPE $MODULETYPE
2018-03-18 15:39:43 +00:00
;;
2020-02-26 21:08:29 +00:00
4) menu_change_prop "ro.build.tags" $CURRTAGS $ORIGTAGS $MODULETAGS
2018-03-18 15:39:43 +00:00
;;
2020-05-21 19:02:54 +00:00
5) menu_change_prop "ro.bootmode" $CURRBOOTMODE $ORIGBOOTMODE $MODULEBOOTMODE
;;
6) menu_change_prop "ro.boot.mode" $CURRMODE $ORIGMODE $MODULEMODE
;;
7)
if [ "$(getprop ro.build.selinux)" ]; then
menu_change_prop "ro.build.selinux" $CURRSELINUX $ORIGSELINUX $MODULESELINUX
else
invalid_input 1 2
fi
2018-03-18 15:39:43 +00:00
;;
2020-02-26 21:08:29 +00:00
a|A)
if [ "$PROPCOUNT" -lt 5 ]; then
menu_change_prop "Change all props"
else
invalid_input 1 2
fi
;;
r|R)
2019-02-02 12:37:20 +00:00
if [ "$PROPCOUNT" -gt 1 ]; then
2018-03-18 15:39:43 +00:00
menu_reset_prop_all "Reset all props"
else
invalid_input 1 2
fi
;;
2018-06-03 16:40:24 +00:00
b|B)
2018-03-18 15:39:43 +00:00
INPUT=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
*) invalid_input 1 2
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - MagiskHide props, $1=header, $2=Currently set prop value, $3=Original prop value, $4=Module set prop value
2018-03-18 15:39:43 +00:00
menu_change_prop() {
INPUT3=""
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT3" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
2020-02-26 21:08:29 +00:00
if [ "$1" == "Change multiple props" ]; then
TMPITEMS=""
CNT=1
TMPLST=$(echo $2 | sed 's|\,| |g')
for ITEM in $PROPSLIST; do
for INT in $TMPLST; do
2020-05-21 19:02:54 +00:00
case $INT in
7)
if [ "$(getprop ro.build.selinux)" ]; then
if [ "$INT" == "$CNT" ]; then
if [ "$TMPITEMS" ]; then
TMPITEMS="$TMPITEMS $ITEM"
else
TMPITEMS="$ITEM"
fi
fi
fi
;;
*)
if [ "$INT" == "$CNT" ]; then
if [ "$TMPITEMS" ]; then
TMPITEMS="$TMPITEMS $ITEM"
else
TMPITEMS="$ITEM"
fi
fi
;;
esac
2020-02-26 21:08:29 +00:00
done
CNT=$(($CNT+1))
done
echo "Do you want to change the"
echo "following props:"
2018-03-18 15:39:43 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$(echo $TMPITEMS | sed 's| |\n|g')${N}"
2020-02-26 21:08:29 +00:00
elif [ "$1" == "Change all props" ]; then
echo "Do you want to change all"
echo "MagiskHide sensitive props?"
TMPITEMS=$PROPSLIST
else
PROP=$(get_prop_type "$1")
REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')
# Checks if the prop exists
if [ "$2" ]; then
if [ "$4" ] && [ "$(get_file_value $LATEFILE "${REPROP}=")" == "true" ]; then
PROPMODULETXT=", by this module"
BACKTXT=" back"
else
PROPMODULETXT=""
BACKTXT=""
fi
2020-10-25 19:49:49 +00:00
echo -e "Currently set to ${C}$2${N}${PROPMODULETXT}."
2020-02-26 21:08:29 +00:00
if [ "$2" != "$3" ]; then
2020-08-14 08:01:35 +00:00
echo -e "The original value is ${C}$3${N}."
2020-02-26 21:08:29 +00:00
fi
echo ""
safe_props "$1" $2
change_to "$1" $2
if [ "$SAFE" == 1 ]; then
echo "You currently have the safe value set."
2020-08-14 08:01:35 +00:00
echo -e "Are you sure you want to change it$BACKTXT to ${C}$CHANGE${N}?"
2020-02-26 21:08:29 +00:00
else
2020-08-14 08:01:35 +00:00
echo -e "Do you want to change it${BACKTXT} to ${C}$CHANGE${N}?"
2020-02-26 21:08:29 +00:00
fi
2018-03-18 15:39:43 +00:00
else
2020-02-26 21:08:29 +00:00
echo "This prop doesn't currently exist on your system."
echo ""
echo "Nothing to do... Returning to main menu."
sleep 3
INPUT2=""
break
2018-03-18 15:39:43 +00:00
fi
fi
2020-02-26 21:08:29 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-02-26 21:08:29 +00:00
read -r INPUT3
2018-03-18 15:39:43 +00:00
fi
case "$INPUT3" in
2018-06-03 16:40:24 +00:00
y|Y)
2020-02-26 21:08:29 +00:00
if [ "$1" == "Change multiple props" ] || [ "$1" == "Change all props" ]; then
for ITEM in $TMPITEMS; do
PROP=$(get_prop_type "$ITEM")
CURRPROP=$(echo "CURR${PROP}" | tr '[:lower:]' '[:upper:]')
TMPVAL="$(eval "echo \$$CURRPROP")"
change_to "$ITEM" $TMPVAL
change_prop "$ITEM" $CHANGE "none"
. $LATEFILE
done
after_change "$1"
elif [ "$PROPMODULETXT" ]; then
2018-03-18 15:39:43 +00:00
menu_reset_prop "Reset $1" "$1"
else
change_prop "$1" $CHANGE
fi
2019-02-02 12:37:20 +00:00
INPUT2=""
2018-03-18 15:39:43 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-03-18 15:39:43 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset all MagiskHide props, $1=header
2018-03-18 15:39:43 +00:00
menu_reset_prop_all() {
INPUT3=""
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT3" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
echo "This will reset all prop"
echo "values to default values."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-03-18 15:39:43 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2020-10-25 19:49:49 +00:00
y|Y)
2018-03-18 15:39:43 +00:00
reset_prop_all "$1"
2019-02-02 12:37:20 +00:00
INPUT2=""
2018-03-18 15:39:43 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-03-18 15:39:43 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
2018-04-15 22:05:33 +00:00
*) invalid_input 3 3
2018-03-18 15:39:43 +00:00
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset specific MagiskHide prop, $1=header, $2=prop name
2018-03-18 15:39:43 +00:00
menu_reset_prop() {
INPUT3=""
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT3" ]; then
2018-03-18 15:39:43 +00:00
menu_header "${C}$1${N}"
echo ""
echo "This will reset $2"
echo "to it's default value."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-03-18 15:39:43 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2020-10-25 19:49:49 +00:00
y|Y)
2018-03-18 15:39:43 +00:00
reset_prop "$2"
2019-02-02 12:37:20 +00:00
INPUT2=""
2018-03-18 15:39:43 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-03-18 15:39:43 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
2018-04-15 22:05:33 +00:00
*) invalid_input 3 3
2018-03-18 15:39:43 +00:00
;;
esac
done
}
2018-04-15 22:05:33 +00:00
# ======================== Custom Props ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Custom props, $1=Header
2018-04-15 22:05:33 +00:00
menu_custom_props() {
2018-03-18 15:39:43 +00:00
INPUT2=""
while true
do
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT2" ]; then
2019-03-27 10:50:00 +00:00
ITEMCOUNT=0
if [ "$OPTIONBOOT" == 0 ]; then
2019-04-02 19:42:29 +00:00
DEFSTAGETXT=" (system.prop)"
2019-03-27 10:50:00 +00:00
elif [ "$OPTIONBOOT" == 1 ]; then
2018-09-04 07:55:57 +00:00
DEFSTAGETXT=" (post-fs-data)"
2019-03-27 10:50:00 +00:00
elif [ "$OPTIONBOOT" == 2 ]; then
2018-09-04 07:55:57 +00:00
DEFSTAGETXT=" (late_start service)"
2018-09-04 08:23:35 +00:00
fi
2018-04-15 22:05:33 +00:00
menu_header "${C}$1${N}\n Select an option below:"
2020-09-07 20:00:48 +00:00
echo ""
2020-08-14 08:01:35 +00:00
if [ "$CUSTOMEDIT" == 0 ] && [ "$CUSTOMPROPS" -o "$CUSTOMPROPSPOST" -o "$CUSTOMPROPSLATE" -o "$CUSTOMPROPSDELAY" ]; then
2018-04-26 20:40:46 +00:00
CTRLSET=0
2020-08-14 08:01:35 +00:00
echo -e "You have ${C}custom props set${N},"
echo -e "but the option is ${R}not activated${N}."
2018-04-26 20:40:46 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to activate it (enter ${G}r${N} to reset)?"
2018-04-26 20:40:46 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o), ${G}r${N}(eset) or ${G}e${N}(xit): "
2018-06-03 16:40:24 +00:00
read -r INPUT2
else
2018-04-26 20:40:46 +00:00
CTRLSET=1
echo "Set or edit custom prop values for your device."
echo ""
2020-08-14 08:01:35 +00:00
if [ "$CUSTOMPROPS" ] || [ "$CUSTOMPROPSPOST" ] || [ "$CUSTOMPROPSLATE" ] || [ "$CUSTOMPROPSDELAY" ]; then
2020-08-27 09:07:28 +00:00
echo "Currently set props (pick to edit):"
2019-03-27 10:50:00 +00:00
ITEMCOUNT=1
2018-09-04 07:55:57 +00:00
if [ "$CUSTOMPROPS" ]; then
2020-08-27 09:07:28 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}Default boot stage${G}${DEFSTAGETXT}${N}"
2018-09-04 07:55:57 +00:00
for ITEM in $CUSTOMPROPS; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $(get_eq_left "$ITEM")"
2018-09-04 07:55:57 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
fi
if [ "$CUSTOMPROPSPOST" ]; then
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}post-fs-data boot stage${N}"
2018-09-04 07:55:57 +00:00
for ITEM in $CUSTOMPROPSPOST; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $(get_eq_left "$ITEM")"
2018-09-04 07:55:57 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
fi
2020-08-14 08:01:35 +00:00
if [ "$CUSTOMPROPSLATE" ] || [ "$CUSTOMPROPSDELAY" ]; then
CUSTOMPROPSLATETMP="$CUSTOMPROPSLATE $CUSTOMPROPSDELAY"
2018-09-04 07:55:57 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}late_start service boot stage${N}"
for ITEM in $CUSTOMPROPSLATETMP; do
if [ "$(echo $CUSTOMPROPSDELAY | grep $(get_eq_left $ITEM))" ]; then
DELAYTXT=" ${C}(delayed)${N}"
else
DELAYTXT=""
fi
echo -e "${G}$ITEMCOUNT${N} - $(get_eq_left "$ITEM")$DELAYTXT"
2018-09-04 07:55:57 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
fi
2018-04-26 20:40:46 +00:00
else
echo "Currently no custom props set."
echo "Please add one by selecting"
echo "\"New custom prop\" below."
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}n${N} - New custom prop"
if [ "$CUSTOMPROPS" ] || [ "$CUSTOMPROPSPOST" ] || [ "$CUSTOMPROPSLATE" ] || [ "$CUSTOMPROPSDELAY" ]; then
echo -e "${G}r${N} - Reset all custom props"
2018-04-26 20:40:46 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back to main menu"
echo -e "${G}e${N} - Exit"
2018-04-26 20:40:46 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-26 20:40:46 +00:00
read -r INPUT2
2018-04-15 22:05:33 +00:00
fi
2019-11-22 19:19:18 +00:00
case "$INPUT2" in
y|Y)
if [ "$CTRLSET" == 1 ]; then
invalid_input 1 2
elif [ "$CTRLSET" == 0 ]; then
replace_fn CUSTOMEDIT 0 1 $LATEFILE
INPUT=""
break
fi
;;
n|N)
if [ "$CTRLSET" == 1 ]; then
menu_new_custprop "New custom prop"
elif [ "$CTRLSET" == 0 ]; then
INPUT=""
break
fi
;;
r|R)
if [ "$CTRLSET" == 1 ]; then
menu_reset_all_custprop "Reset all custom props"
elif [ "$CTRLSET" == 0 ]; then
menu_reset_all_custprop "Reset all custom props"
fi
;;
b|B)
if [ "$CTRLSET" == 1 ]; then
INPUT=""
break
elif [ "$CTRLSET" == 0 ]; then
invalid_input 4 2
fi
;;
e|E) exit_fn
;;
*)
if [ "$INPUT2" -ge 1 -a "$INPUT2" -lt "$ITEMCOUNT" ] && [ "$CTRLSET" == 1 ]; then
ITEMCOUNT=1
for ITEM in $CUSTOMPROPSLIST; do
if [ "$ITEMCOUNT" == "$INPUT2" ]; then
2020-08-14 08:01:35 +00:00
menu_edit_custprop "$(get_eq_left "$ITEM")"
2019-11-22 19:19:18 +00:00
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
if [ "$CTRLSET" == 1 ]; then
invalid_input 1 2
elif [ "$CTRLSET" == 0 ]; then
invalid_input 4 2
2018-04-26 20:40:46 +00:00
fi
2019-11-22 19:19:18 +00:00
fi
;;
esac
2018-04-15 22:05:33 +00:00
fi
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Edit custom prop, $1=prop name
2018-04-15 22:05:33 +00:00
menu_edit_custprop() {
INPUT3=""
2018-09-04 07:55:57 +00:00
if [ "$(echo $CUSTOMPROPS | grep $1)" ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(system.prop)${N}"
2020-08-14 08:01:35 +00:00
elif [ "$(echo $CUSTOMPROPSPOST | grep $1)" ] && [ "$(echo $CUSTOMPROPSLATE | grep $1)" -o "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(both)${N}"
2018-09-04 07:55:57 +00:00
elif [ "$(echo $CUSTOMPROPSPOST | grep $1)" ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(post-fs-data)${N}"
2020-08-14 08:01:35 +00:00
elif [ "$(echo $CUSTOMPROPSLATE | grep $1)" ] || [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
2019-04-02 19:42:29 +00:00
STAGETXT=" ${C}(late_start service)${N}"
2020-08-14 08:01:35 +00:00
fi
DELAYTXT=""
if [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
for ITEM in $CUSTOMPROPSDELAY; do
case $ITEM in
*$1*)
DELAYTXT=" ${G}(active, $(get_prop_delay "$ITEM") seconds)${N}"
break
;;
esac
done
2018-09-04 07:55:57 +00:00
fi
2018-04-15 22:05:33 +00:00
while true
do
if [ -z "$INPUT3" ]; then
2018-09-04 07:55:57 +00:00
for ITEM in $CUSTOMPROPSLIST; do
2020-08-14 08:01:35 +00:00
TMPITEM=$(get_prop_value "$ITEM")
2018-05-06 09:57:49 +00:00
if [ "$(get_eq_left "$ITEM")" == "$1" ]; then
2020-03-01 19:50:53 +00:00
if [ "$TMPITEM" == "$(getprop $1)" ]; then
2018-04-15 22:05:33 +00:00
PROPNOTSET=0
else
PROPNOTSET=1
fi
2019-05-04 18:57:59 +00:00
SETPROPVALUE="$TMPITEM"
2018-04-15 22:05:33 +00:00
break
fi
done
menu_header "${C}$1${N}"
echo ""
2018-09-04 07:55:57 +00:00
echo "The current value for"
2020-08-27 09:07:28 +00:00
echo -e "${C}$1${N} is:"
2018-09-04 07:55:57 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$(getprop $1)${N}"
2018-04-15 22:05:33 +00:00
if [ "$PROPNOTSET" == 0 ]; then
echo "(Set by this module.)"
echo ""
echo "Enter a new value or select"
echo "from the options below."
echo ""
2018-03-18 15:39:43 +00:00
else
2020-08-14 08:01:35 +00:00
echo ""
echo -e "${R}Not yet set by this module. Please reboot to set.${N}"
2019-05-04 18:57:59 +00:00
if [ "$OPTIONBOOT" == 1 ] || [ "$STAGETXT" == " ${C}(post-fs-data)${N}" ] || [ "$STAGETXT" == " ${C}(system.prop)${N}" ]; then
2018-10-25 06:37:05 +00:00
echo ""
2019-05-04 18:57:59 +00:00
echo "This might be caused by the prop being set"
echo "too early. If the above state does not change"
echo "after a reboot, try changing the boot stage"
2020-08-14 08:01:35 +00:00
echo -e "when the prop is set to ${G}late_start service${N}."
2018-10-25 06:37:05 +00:00
fi
2018-04-15 22:05:33 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to reboot now (${G}y/n${N})?"
2019-05-04 18:57:59 +00:00
echo ""
2018-03-18 15:39:43 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}s${N} - Prop boot stage$STAGETXT"
echo -e "${G}d${N} - Delay$DELAYTXT"
echo -e "${G}r${N} - Reset prop"
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT3
2018-03-18 15:39:43 +00:00
fi
2018-04-15 22:05:33 +00:00
case "$INPUT3" in
2019-05-04 18:57:59 +00:00
y|Y) force_reboot
;;
n|N)
INPUT2=""
break
;;
2020-08-14 08:01:35 +00:00
s|S) menu_bootstage_custprop "$1" "$SETPROPVALUE"
;;
d|D) menu_delay_custprop "$1" "$SETPROPVALUE" "$(getprop $1)" "edit"
2018-09-04 07:55:57 +00:00
;;
2018-06-03 16:40:24 +00:00
r|R)
2019-05-04 18:57:59 +00:00
menu_reset_custprop "$1" "$SETPROPVALUE"
break
2018-03-18 15:39:43 +00:00
;;
2018-06-03 16:40:24 +00:00
b|B)
2018-04-15 22:05:33 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*)
2018-07-01 05:31:37 +00:00
if [ "$PROPNOTSET" == 0 ]; then
2020-03-01 19:50:53 +00:00
menu_set_custprop "$1" "$INPUT3" "$(getprop $1)"
2018-04-15 22:05:33 +00:00
break
2018-03-18 15:39:43 +00:00
else
2018-04-15 22:05:33 +00:00
invalid_input 1 3
2018-03-18 15:39:43 +00:00
fi
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - New custom prop, $1=Header
2018-04-15 22:05:33 +00:00
menu_new_custprop() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-27 09:07:28 +00:00
echo "Enter the prop to set. Example:"
echo -e "${C}ro.sf.lcd_density${N}"
echo ""
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2018-06-03 16:40:24 +00:00
b|B)
2018-04-15 22:05:33 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
2019-11-02 22:24:17 +00:00
""|[[:blank:]]*) blank_input 3
2018-05-29 20:44:54 +00:00
;;
2018-04-15 22:05:33 +00:00
*)
2019-11-02 22:24:17 +00:00
if [ "$(echo $PROPSLIST | grep -Eo "(^| )$INPUT3($| )")" ] || [ "$(echo $CUSTOMPROPSLIST | grep -Eo "(^| )$INPUT3($| )")" ]; then
2018-04-15 22:05:33 +00:00
menu_magiskhide_custprop "$INPUT3"
else
menu_set_new_custprop "$INPUT3"
break
fi
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset all custom props, $1=Header
2018-04-15 22:05:33 +00:00
menu_reset_all_custprop() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
echo "This will reset all"
echo "custom prop values."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-04-15 22:05:33 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2018-06-03 16:40:24 +00:00
y|Y)
2018-04-15 22:05:33 +00:00
reset_all_custprop
INPUT2=""
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-04-15 22:05:33 +00:00
INPUT2=""
2020-08-14 08:01:35 +00:00
INPUT3=""
2018-04-15 22:05:33 +00:00
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - MagiskHide custom prop and duplicate props, $1=prop name
2018-04-15 22:05:33 +00:00
menu_magiskhide_custprop() {
INPUT4=""
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
2018-06-19 09:56:08 +00:00
if [ "$(echo $PROPSLIST | grep -o $1)" ]; then
2020-08-27 09:07:28 +00:00
echo -e "${C}$1${N} is"
2018-06-19 09:56:08 +00:00
echo "one of the sensitive props already set"
echo "by MagiskHide. No need to do it again."
else
2020-08-27 09:07:28 +00:00
echo -e "${C}$1${N} is"
2018-06-19 09:56:08 +00:00
echo "already on your list of custom props."
echo "No need to set it again."
fi
2018-04-15 22:05:33 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT4
fi
case "$INPUT4" in
2018-06-03 16:40:24 +00:00
b|B)
2018-04-15 22:05:33 +00:00
INPUT3=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 1 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - Set new custom prop, $1=prop name
2018-04-15 22:05:33 +00:00
menu_set_new_custprop() {
INPUT4=""
2020-03-01 19:50:53 +00:00
TMPPROP=$(getprop "$1")
2018-04-15 22:05:33 +00:00
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-27 09:07:28 +00:00
echo "Enter the value you want to set"
2020-08-14 08:01:35 +00:00
echo -e "${C}$1${N} to,"
2018-04-15 22:05:33 +00:00
echo "or select from the options below."
echo ""
2020-07-09 19:53:40 +00:00
echo "The currently set value is:"
2020-10-25 19:49:49 +00:00
if [ "$TMPPROP" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${C}$TMPPROP${N}"
2019-11-02 22:24:17 +00:00
echo "Please enter the new value."
2018-04-15 22:05:33 +00:00
else
2020-08-14 08:01:35 +00:00
echo -e "${C}Currently not set, or the value could not be retrieved.${N}"
2019-11-02 22:24:17 +00:00
echo "Please enter the value to set."
2018-04-15 22:05:33 +00:00
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT4
fi
case "$INPUT4" in
2018-06-03 16:40:24 +00:00
b|B)
2018-10-21 14:17:11 +00:00
INPUT2=""
2018-04-15 22:05:33 +00:00
INPUT3=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-05-29 20:44:54 +00:00
;;
2018-06-03 16:40:24 +00:00
""|[[:blank:]]*) blank_input 4
2018-05-29 20:44:54 +00:00
;;
2018-04-15 22:05:33 +00:00
*)
2018-10-21 14:17:11 +00:00
menu_set_custprop "$1" "$INPUT4" "$TMPPROP"
2018-04-15 22:05:33 +00:00
INPUT2=""
INPUT3=""
break
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - Custom prop boot stage, $1=prop name, $2=prop value
2018-09-04 07:55:57 +00:00
menu_bootstage_custprop() {
INPUT4=""
2019-05-04 18:57:59 +00:00
PLEND=" is"
DEFAULTTXT=""
POSTTXT=""
LATETXT=""
BOTHTXT=""
OPTTYPE1="default"
OPTTYPE2="post"
OPTTYPE3="late"
OPTTYPE4="both"
2018-09-04 07:55:57 +00:00
if [ "$(echo $CUSTOMPROPS | grep $1)" ]; then
TMPBSTAGE="default"
DEFAULTTXT="${G} (current)${N}"
2019-05-04 18:57:59 +00:00
INTOPT=1
2018-09-04 07:55:57 +00:00
elif [ "$(echo $CUSTOMPROPSPOST | grep $1)" ]; then
TMPBSTAGE="post-fs-data"
POSTTXT="${G} (current)${N}"
2020-08-14 08:01:35 +00:00
INTOPT=2
elif [ "$(echo $CUSTOMPROPSLATE | grep $1)" ] || [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
2018-09-04 07:55:57 +00:00
TMPBSTAGE="late_start service"
2020-08-14 08:01:35 +00:00
if [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
LATETXT="${G} (current, delayed)${N}"
else
LATETXT="${G} (current)${N}"
fi
INTOPT=3
elif [ "$(echo $CUSTOMPROPSPOST | grep $1)" ] && [ "$(echo $CUSTOMPROPSLATE | grep $1)" ]; then
TMPBSTAGE="both"
PLEND="s are"
BOTHTXT="${G} (current)${N}"
2019-05-04 18:57:59 +00:00
INTOPT=4
2018-09-04 07:55:57 +00:00
else
TMPBSTAGE=""
fi
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Select what boot stage"
2020-08-14 08:01:35 +00:00
echo -e "${C}$1${N}"
2018-09-04 07:55:57 +00:00
echo "should be set in."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Currently ${C}${TMPBSTAGE}${N}"
2019-02-02 12:37:20 +00:00
echo "boot stage$PLEND used."
2018-09-04 07:55:57 +00:00
echo ""
echo "Select an option below."
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Default${DEFAULTTXT}"
echo -e "${G}2${N} - post-fs-data${POSTTXT}"
echo -e "${G}3${N} - late_start service${LATETXT}"
echo -e "${G}4${N} - Both boot stages${BOTHTXT}"
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-09-04 07:55:57 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-09-04 07:55:57 +00:00
read -r INPUT4
fi
case "$INPUT4" in
2019-05-04 18:57:59 +00:00
1|2|3|4)
if [ "$INTOPT" == "$INPUT4" ]; then
2019-02-02 12:37:20 +00:00
INPUT4=""
active_option
else
2019-05-04 18:57:59 +00:00
OPTTYPE="OPTTYPE${INPUT4}"
set_custprop "$1" "$2" "$(eval "echo \$$OPTTYPE")"
2020-08-14 08:01:35 +00:00
DELAYTXT=""
2018-09-04 07:55:57 +00:00
INPUT3=""
break
fi
;;
b|B)
INPUT3=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-09-04 07:55:57 +00:00
;;
*) invalid_input 1 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - Reset custom prop, $1=prop name, $2=prop value
2018-04-15 22:05:33 +00:00
menu_reset_custprop() {
INPUT4=""
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "This will reset ${C}$1${N}"
2018-04-15 22:05:33 +00:00
echo "to its original value."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-04-15 22:05:33 +00:00
read -r INPUT4
fi
case "$INPUT4" in
2018-06-03 16:40:24 +00:00
y|Y)
2018-04-15 22:05:33 +00:00
reset_custprop "$1" "$2"
INPUT2=""
INPUT3=""
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-04-15 22:05:33 +00:00
INPUT3=""
2020-08-14 08:01:35 +00:00
INPUT4=""
2018-04-15 22:05:33 +00:00
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 3 4
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fifth menu level - Set custom prop, $1=prop name, $2=prop value, $3=current value, $4=option
2018-04-15 22:05:33 +00:00
menu_set_custprop() {
2018-09-04 07:55:57 +00:00
PROPSTAGE="default"
DEFAULTTXT=" ${G}(current)${N}"
POSTTXT=""
LATETXT=""
2019-02-02 12:37:20 +00:00
BOTHTXT=""
2020-08-14 08:01:35 +00:00
DELAYTXT=""
DELAYVAL=""
DELAYTIMING=""
if [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
for ITEM in $CUSTOMPROPSDELAY; do
case $ITEM in
*$1*)
DELAYTXT=" ${G}(active)${N}"
break
;;
esac
done
fi
2018-04-15 22:05:33 +00:00
INPUT5=""
while true
do
if [ -z "$INPUT5" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "This will set ${C}$1${N} to:"
2019-11-22 19:19:18 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${C}$2${N}"
2018-04-15 22:05:33 +00:00
echo ""
2020-07-09 19:53:40 +00:00
if [ "$4" == "option" ]; then
echo "The currently set value is:"
2020-10-25 19:49:49 +00:00
if [ "$(getprop "$1")" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${C}$(getprop "$1")${N}"
2020-07-09 19:53:40 +00:00
echo "Please enter the new value."
else
2020-08-14 08:01:35 +00:00
echo -e "${C}Currently not set, or the value could not be retrieved.${N}"
2020-07-09 19:53:40 +00:00
echo "Please enter the value to set."
fi
echo ""
fi
2018-09-04 07:55:57 +00:00
echo "Pick an option below to change"
echo "what boot stage the prop will"
2020-08-14 08:01:35 +00:00
echo "be set in, or set/reset a delay:"
2018-09-04 07:55:57 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Default${DEFAULTTXT}"
echo -e "${G}2${N} - post-fs-data${POSTTXT}"
echo -e "${G}3${N} - late_start service${LATETXT}"
echo -e "${G}4${N} - Both boot stages${BOTHTXT}"
echo -e "${G}d${N} - Delay${DELAYTXT}"
2018-09-04 07:55:57 +00:00
echo ""
2018-04-15 22:05:33 +00:00
echo "Do you want to continue?"
echo ""
2020-07-09 19:53:40 +00:00
if [ "$4" == "option" ]; then
2020-08-14 08:01:35 +00:00
echo -e "Enter ${G}y${N}(es) or ${G}n${N}(o)"
2020-07-09 19:53:40 +00:00
else
2020-08-14 08:01:35 +00:00
echo -e "Enter ${G}y${N}(es), ${G}n${N}(o), ${G}e${N}(xit)"
2020-07-09 19:53:40 +00:00
fi
2019-11-03 21:04:04 +00:00
echo -n "or an option from above: "
2018-04-15 22:05:33 +00:00
read -r INPUT5
fi
case "$INPUT5" in
2018-09-04 07:55:57 +00:00
1)
if [ "$DEFAULTTXT" ]; then
2019-02-02 12:37:20 +00:00
INPUT5=""
2018-09-04 07:55:57 +00:00
active_option
else
PROPSTAGE="default"
DEFAULTTXT=" ${G}(current)${N}"
POSTTXT=""
LATETXT=""
2019-02-02 12:37:20 +00:00
BOTHTXT=""
2020-08-14 08:01:35 +00:00
DELAYTXT=""
DELAYVAL=""
DELAYTIMING=""
2018-09-04 07:55:57 +00:00
INPUT5=""
fi
;;
2)
if [ "$POSTTXT" ]; then
2019-02-02 12:37:20 +00:00
INPUT5=""
2018-09-04 07:55:57 +00:00
active_option
else
PROPSTAGE="post"
DEFAULTTXT=""
POSTTXT=" ${G}(current)${N}"
LATETXT=""
2019-02-02 12:37:20 +00:00
BOTHTXT=""
2020-08-14 08:01:35 +00:00
DELAYTXT=""
DELAYVAL=""
DELAYTIMING=""
2018-09-04 07:55:57 +00:00
INPUT5=""
fi
;;
3)
if [ "$LATETXT" ]; then
2019-02-02 12:37:20 +00:00
INPUT5=""
2018-09-04 07:55:57 +00:00
active_option
else
PROPSTAGE="late"
DEFAULTTXT=""
POSTTXT=""
LATETXT=" ${G}(current)${N}"
2019-02-02 12:37:20 +00:00
BOTHTXT=""
2020-08-14 08:01:35 +00:00
DELAYTXT=""
DELAYVAL=""
DELAYTIMING=""
2019-02-02 12:37:20 +00:00
INPUT5=""
fi
;;
4)
if [ "$BOTHTXT" ]; then
INPUT5=""
active_option
else
PROPSTAGE="both"
DEFAULTTXT=""
POSTTXT=""
LATETXT=""
BOTHTXT=" ${G}(current)${N}"
2020-08-14 08:01:35 +00:00
DELAYTXT=""
DELAYVAL=""
DELAYTIMING=""
2018-09-04 07:55:57 +00:00
INPUT5=""
fi
;;
2020-08-14 08:01:35 +00:00
d|D) menu_delay_custprop "$1" "$2" "$3" "new"
;;
2018-06-03 16:40:24 +00:00
y|Y)
2020-08-14 08:01:35 +00:00
set_custprop "$1" "$2" "$PROPSTAGE" "$3" "$DELAYVAL" "$DELAYTIMING"
2018-04-15 22:05:33 +00:00
INPUT2=""
INPUT3=""
INPUT4=""
2019-02-02 12:37:20 +00:00
INPUT5=""
2018-04-15 22:05:33 +00:00
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-04-15 22:05:33 +00:00
INPUT4=""
2018-09-04 07:55:57 +00:00
INPUT5=""
2018-04-15 22:05:33 +00:00
break
;;
2020-07-09 19:53:40 +00:00
e|E)
if [ "$4" == "option" ]; then
invalid_input 2 5
else
exit_fn
fi
2018-04-15 22:05:33 +00:00
;;
2020-07-09 19:53:40 +00:00
*)
if [ "$4" == "option" ]; then
invalid_input 2 5
else
invalid_input 3 5
fi
2018-04-15 22:05:33 +00:00
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth or sixth menu level - Delay prop, $1=prop name, $2=prop value, $3=current value, $4=new or edit
menu_delay_custprop() {
INPUTTMP=""
TMPDELAY="$DELAYVAL"
TIMINGTXT=" ${G}(Wait for \"Boot completed\")${N}"
TIMINGOPT="boot"
if [ "$4" == "edit" ]; then
INPUT4=""
if [ "$CUSTOMPROPSDELAY" ]; then
for ITEM in $CUSTOMPROPSDELAY; do
case $ITEM in
*$1*)
TMPDELAY="$(get_prop_delay "$ITEM")"
if [ "$(get_prop_delay_exec "$ITEM")" != "boot" ]; then
TIMINGTXT=" ${G}(Run immediately)${N}"
TIMINGOPT=""
fi
;;
esac
done
fi
elif [ "$4" == "new" ]; then
INPUT6=""
fi
while true
do
if [ "$4" == "edit" ] && [ -z "$INPUT4" ] || [ "$4" == "new" ] && [ -z "$INPUT6" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Enter the time (in seconds)"
echo "you want the prop"
echo -e "${C}$1${N}"
echo "to be delayed."
if [ "$TMPDELAY" ]; then
echo ""
echo "Currently delayed by"
echo -e "${C}$TMPDELAY${N} seconds"
fi
echo ""
echo "Note that this prop will"
echo "automatically be set during the"
echo "late_start service boot stage."
echo ""
echo -e "${G}t${N} - Change timing$TIMINGTXT"
if [ "$DELAYTXT" ]; then
echo -e "${G}r${N} - Reset delay"
fi
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
echo ""
echo -n "Enter your desired option: "
if [ "$4" == "edit" ]; then
read -r INPUT4
elif [ "$4" == "new" ]; then
read -r INPUT6
fi
fi
if [ "$4" == "edit" ]; then
INPUTTMP=$INPUT4
elif [ "$4" == "new" ]; then
INPUTTMP=$INPUT6
fi
case "$INPUTTMP" in
t|T)
if [ "$TIMINGOPT" ]; then
TIMINGTXT=" ${G}(Run immediately)${N}"
TIMINGOPT=""
else
TIMINGTXT=" ${G}(Wait for \"Boot completed\")${N}"
TIMINGOPT="boot"
fi
if [ "$4" == "edit" ]; then
INPUT4=""
INPUTTMP=""
elif [ "$4" == "new" ]; then
INPUT6=""
INPUTTMP=""
fi
;;
r|R) menu_reset_delay_custprop "$1" "$2" "$3" "$4"
;;
b|B)
if [ "$4" == "edit" ]; then
INPUT3=""
break
elif [ "$4" == "new" ]; then
INPUT5=""
break
fi
;;
e|E) exit_fn
;;
*)
if [ "$INPUTTMP" ]; then
NUMCHECK="$(echo $INPUTTMP | tr -d [0-9])"
if [ -z "$NUMCHECK" ]; then
if [ "$4" == "edit" ]; then
STAGETXT=" ${C}(late_start service)${N}"
DELAYTXT=" ${G}(active, $INPUTTMP seconds)${N}"
INPUT3=""
set_custprop "$1" "$2" "delay" "$3" "$INPUTTMP" "$TIMINGOPT"
break
elif [ "$4" == "new" ]; then
PROPSTAGE="delay"
DEFAULTTXT=""
POSTTXT=""
LATETXT=" ${G}(current)${N}"
BOTHTXT=""
DELAYTXT=" ${G}(active)${N}"
DELAYVAL="$INPUTTMP"
DELAYTIMING="$TIMINGOPT"
INPUT5=""
break
fi
else
if [ "$4" == "edit" ]; then
invalid_input 8 4
elif [ "$4" == "new" ]; then
invalid_input 8 6
fi
fi
else
if [ "$4" == "edit" ]; then
invalid_input 8 4
elif [ "$4" == "new" ]; then
invalid_input 8 6
fi
fi
;;
esac
done
}
# Fifth or seventh level - Reset delay, $1=prop name, $2=prop value, $3=current value, $4=new or edit
menu_reset_delay_custprop() {
if [ "$4" == "edit" ]; then
INPUT5=""
elif [ "$4" == "new" ]; then
INPUT7=""
fi
INPUTTMP=""
TMPDELAY=""
if [ "$(echo $CUSTOMPROPSDELAY | grep $1)" ]; then
for ITEM in $CUSTOMPROPSDELAY; do
case $ITEM in
*$1*)
TMPDELAY="$(get_prop_delay "$ITEM")"
break
;;
esac
done
fi
while true
do
if [ "$4" == "edit" ] && [ -z "$INPUT5" ] || [ "$4" == "new" ] && [ -z "$INPUT7" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Do you want to reset"
echo "the delay for prop"
echo -e "${C}$1${N}"
echo ""
echo "The current delay is"
echo -e "${C}$TMPDELAY${N} seconds"
echo ""
echo "This will move the prop back"
echo "to the default boot stage."
echo ""
echo -e "${G}y${N} - Yes"
echo -e "${G}n${N} - No"
echo -e "${G}e${N} - Exit"
echo ""
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
if [ "$4" == "edit" ]; then
read -r INPUT5
elif [ "$4" == "new" ]; then
read -r INPUT7
fi
fi
if [ "$4" == "edit" ]; then
INPUTTMP=$INPUT5
elif [ "$4" == "new" ]; then
INPUTTMP=$INPUT7
fi
case "$INPUTTMP" in
y|Y)
set_custprop "$1" "$2" "default" "$3"
if [ "$4" == "edit" ]; then
INPUT3=""
INPUT4=""
break
elif [ "$4" == "new" ]; then
INPUT5=""
INPUT6=""
break
fi
;;
n|N)
if [ "$4" == "edit" ]; then
INPUT4=""
break
elif [ "$4" == "new" ]; then
INPUT6=""
break
fi
;;
e|E) exit_fn
;;
*)
if [ "$4" == "edit" ]; then
invalid_input 3 5
elif [ "$4" == "new" ]; then
invalid_input 3 7
fi
;;
esac
done
}
2018-06-19 09:56:08 +00:00
# ======================== Delete Props ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Delete props, $1=header
2018-06-19 09:56:08 +00:00
menu_delete_props() {
INPUT2=""
while true
do
if [ -z "$INPUT2" ]; then
2019-03-27 10:50:00 +00:00
ITEMCOUNT=0
2018-06-19 09:56:08 +00:00
menu_header "${C}$1${N}\n Select an option below:"
2020-10-25 19:49:49 +00:00
echo ""
2019-02-02 12:37:20 +00:00
if [ "$DELEDIT" == 0 ] && [ "$DELETEPROPS" ]; then
2018-06-19 09:56:08 +00:00
CTRLSET=0
2020-08-14 08:01:35 +00:00
echo -e "You have a list of ${C}props to delete${N},"
echo -e "but the option is ${R}not activated${N}."
2018-06-19 09:56:08 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to activate it (enter ${G}r${N} to reset)?"
2018-06-19 09:56:08 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o), ${G}r${N}(eset) or ${G}e${N}(xit): "
2018-06-19 09:56:08 +00:00
read -r INPUT2
else
CTRLSET=1
echo "Delete prop values on your device."
echo ""
if [ "$DELETEPROPS" ]; then
2019-03-27 10:50:00 +00:00
ITEMCOUNT=1
2018-06-19 09:56:08 +00:00
echo "Select a prop below to reset it."
echo ""
for ITEM in $DELETEPROPS; do
2020-08-14 08:01:35 +00:00
echo -e "${G}$ITEMCOUNT${N} - $ITEM"
2018-06-19 09:56:08 +00:00
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
echo "Currently no props set for removal."
echo "Please add one by selecting"
echo "\"New prop\" below."
fi
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}n${N} - New prop"
2018-06-19 09:56:08 +00:00
if [ "$CUSTOMPROPS" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset all props"
2018-06-19 09:56:08 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back to main menu"
echo -e "${G}e${N} - Exit"
2018-06-19 09:56:08 +00:00
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-06-19 09:56:08 +00:00
read -r INPUT2
fi
2019-11-22 19:19:18 +00:00
case "$INPUT2" in
y|Y)
if [ "$CTRLSET" == 1 ]; then
invalid_input 1 2
elif [ "$CTRLSET" == 0 ]; then
replace_fn DELEDIT 0 1 $LATEFILE
INPUT=""
break
fi
;;
n|N)
if [ "$CTRLSET" == 1 ]; then
menu_new_delprop "New prop"
elif [ "$CTRLSET" == 0 ]; then
INPUT=""
break
fi
;;
r|R)
if [ "$CTRLSET" == 1 ]; then
menu_reset_all_delprop "Reset all props"
elif [ "$CTRLSET" == 0 ]; then
menu_reset_all_delprop "Reset all props"
fi
;;
b|B)
if [ "$CTRLSET" == 1 ]; then
INPUT=""
break
elif [ "$CTRLSET" == 0 ]; then
invalid_input 4 2
fi
;;
e|E) exit_fn
;;
*)
if [ "$INPUT2" -ge 1 -a "$INPUT2" -lt "$ITEMCOUNT" ] && [ "$CTRLSET" == 1 ]; then
ITEMCOUNT=1
for ITEM in $DELETEPROPS; do
if [ "$ITEMCOUNT" == "$INPUT2" ]; then
menu_reset_delprop "$ITEM"
break
fi
ITEMCOUNT=$(($ITEMCOUNT+1))
done
else
if [ "$CTRLSET" == 1 ]; then
invalid_input 1 2
elif [ "$CTRLSET" == 0 ]; then
invalid_input 4 2
2018-06-19 09:56:08 +00:00
fi
2019-11-22 19:19:18 +00:00
fi
;;
esac
2018-06-19 09:56:08 +00:00
fi
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset deleted prop, $1=header/prop name
2018-06-19 09:56:08 +00:00
menu_reset_delprop() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "This will remove ${C}$1${N}"
2018-06-19 09:56:08 +00:00
echo "from the list of props to delete."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-06-19 09:56:08 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
reset_delprop "$1"
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-06-19 09:56:08 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - New prop to delete, $1=header
2018-06-19 09:56:08 +00:00
menu_new_delprop() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2020-08-27 09:07:28 +00:00
echo "Enter the prop to delete. Example:"
echo -e "${C}ro.sf.lcd_density${N}"
echo ""
echo -e "${G}b${N} - Go back"
echo -e "${G}e${N} - Exit"
2018-06-19 09:56:08 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-06-19 09:56:08 +00:00
read -r INPUT3
fi
case "$INPUT3" in
b|B)
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-06-19 09:56:08 +00:00
;;
2020-08-14 08:01:35 +00:00
""|[[:blank:]]*) blank_input 3
2018-06-19 09:56:08 +00:00
;;
*)
menu_set_new_delprop "$INPUT3"
break
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Reset all deleted props, $1=header
2018-06-19 09:56:08 +00:00
menu_reset_all_delprop() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
echo "This will reset the entire"
echo "list of props to delete."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-06-19 09:56:08 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
reset_all_delprop
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-06-19 09:56:08 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Fourth menu level - Set new prop to delete, $1=header/prop name
2018-06-19 09:56:08 +00:00
menu_set_new_delprop() {
INPUT4=""
2020-03-01 19:50:53 +00:00
TMPPROP=$(getprop "$1")
2018-06-19 09:56:08 +00:00
while true
do
if [ -z "$INPUT4" ]; then
menu_header "${C}$1${N}"
echo ""
if [ "$TMPPROP" ]; then
echo "The current value is:"
2020-08-14 08:01:35 +00:00
echo -e "${C}$TMPPROP${N}"
2018-06-19 09:56:08 +00:00
echo ""
2018-09-04 07:55:57 +00:00
echo "This will delete"
2020-08-14 08:01:35 +00:00
echo -e "${C}$1${N}"
2018-06-19 09:56:08 +00:00
echo "from your system."
else
2019-11-02 22:24:17 +00:00
echo "This prop doesn't currently exist on your system."
2018-06-19 09:56:08 +00:00
echo ""
echo "Nothing to do... Returning to main menu."
sleep 3
INPUT2=""
INPUT3=""
break
fi
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-06-19 09:56:08 +00:00
read -r INPUT4
fi
case "$INPUT4" in
y|Y)
set_delprop "$1"
INPUT2=""
INPUT3=""
break
;;
n|N)
INPUT3=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-06-19 09:56:08 +00:00
;;
*) invalid_input 3 4
;;
esac
done
}
2018-04-15 22:05:33 +00:00
# ======================== Options ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Options, $1=header
2018-04-15 22:05:33 +00:00
menu_options() {
INPUT2=""
while true
do
COLOURTXT=""
PRINTSCHKTXT=""
if [ -z "$INPUT2" ]; then
2019-03-27 10:50:00 +00:00
if [ "$OPTIONBOOT" == 0 ]; then
2019-04-02 19:42:29 +00:00
BOOTTXT="system.prop"
2019-03-27 10:50:00 +00:00
elif [ "$OPTIONBOOT" == 1 ]; then
2018-05-29 07:29:19 +00:00
BOOTTXT="post-fs-data"
2019-03-27 10:50:00 +00:00
elif [ "$OPTIONBOOT" == 2 ]; then
BOOTTXT="late_start service"
2018-05-29 07:29:19 +00:00
fi
2019-02-02 12:37:20 +00:00
if [ "$OPTIONCOLOUR" == 1 ]; then
2018-04-15 22:05:33 +00:00
COLOURTXT="enabled"
CC=${G}
else
COLOURTXT="disabled"
CC=${R}
fi
2020-09-12 18:30:24 +00:00
if [ "$OPTIONWEBP" == 1 ]; then
2018-04-15 22:05:33 +00:00
PRINTSCHKTXT="enabled"
CP=${G}
else
PRINTSCHKTXT="disabled"
CP=${R}
fi
2020-09-12 18:30:24 +00:00
if [ "$OPTIONWEBU" == 1 ]; then
MUPDATECHKTXT="enabled"
CMU=${G}
else
MUPDATECHKTXT="disabled"
CMU=${R}
fi
2019-02-02 12:37:20 +00:00
if [ "$OPTIONUPDATE" == 1 ]; then
2020-09-12 18:30:24 +00:00
PUPDATECHKTXT="enabled"
CPU=${G}
2019-02-02 12:37:20 +00:00
else
2020-09-12 18:30:24 +00:00
PUPDATECHKTXT="disabled"
CPU=${R}
2019-02-02 12:37:20 +00:00
fi
2019-11-22 19:19:18 +00:00
if [ "$OPTIONBACK" == 1 ]; then
BACKCHKTXT="enabled"
CB=${G}
else
BACKCHKTXT="disabled"
CB=${R}
fi
2018-04-15 22:05:33 +00:00
menu_header "${C}$1${N}\n Select an option below:"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Boot stage (currently ${C}${BOOTTXT}${N})"
echo -e "${G}2${N} - Script colours (currently ${CC}${COLOURTXT}${N})"
2020-09-12 18:30:24 +00:00
echo -e "${G}3${N} - Automatic module update check (currently ${CMU}${MUPDATECHKTXT}${N})"
echo -e "${G}4${N} - Automatic update of fingerprints list (currently ${CP}${PRINTSCHKTXT}${N})"
echo -e "${G}5${N} - Automatic fingerprints update (currently ${CPU}${PUPDATECHKTXT}${N})"
echo -e "${G}6${N} - Background boot script (currently ${CB}${BACKCHKTXT}${N})"
2020-08-14 08:01:35 +00:00
echo -e "${G}x${N} - Export settings"
echo -e "${G}r${N} - Reset all settings"
2018-05-29 20:44:54 +00:00
if [ "$2" != "s" ]; then
2020-08-14 08:01:35 +00:00
echo -e "${G}b${N} - Go back to main menu"
2018-05-29 20:44:54 +00:00
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}e${N} - Exit"
2018-04-15 22:05:33 +00:00
echo ""
2018-04-19 03:13:40 +00:00
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-04-15 22:05:33 +00:00
read -r INPUT2
fi
case "$INPUT2" in
2020-02-26 21:08:29 +00:00
1) menu_options_bootstage "Boot stage" "$BOOTTXT"
2018-05-29 07:29:19 +00:00
;;
2020-02-26 21:08:29 +00:00
2) menu_option_chng "Script colours" "$COLOURTXT" "Script colours are" "OPTIONCOLOUR"
2018-04-15 22:05:33 +00:00
;;
2020-09-12 18:30:24 +00:00
3) menu_option_chng "Automatic module update check" "$MUPDATECHKTXT" "Automatic checking for a module update\nis" "OPTIONWEBU"
2018-04-15 22:05:33 +00:00
;;
2020-09-12 18:30:24 +00:00
4) menu_option_chng "Automatic update of fingerprints list" "$PRINTSCHKTXT" "Automatic updating of the fingerprints\nlist is" "OPTIONWEBP"
2019-11-22 19:19:18 +00:00
;;
2020-09-12 18:30:24 +00:00
5) menu_option_chng "Automatic fingerprints update" "$PUPDATECHKTXT" "Automatic updating of the applied\nfingerprint is" "OPTIONUPDATE"
;;
6) menu_option_chng "Background boot script" "$BACKCHKTXT" "Background boot script execution\nis" "OPTIONBACK"
2019-02-02 12:37:20 +00:00
;;
2020-02-26 21:08:29 +00:00
x|X) menu_option_export "Export settings"
;;
r|R) menu_options_reset "Reset all settings"
2018-04-15 22:05:33 +00:00
;;
2018-06-03 16:40:24 +00:00
b|B)
2018-05-29 20:44:54 +00:00
if [ "$2" == "s" ]; then
invalid_input 1 2
else
INPUT=""
break
fi
2018-04-15 22:05:33 +00:00
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 1 2
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Options, boot stage, $1=header, $2=Current stage
2018-05-29 07:29:19 +00:00
menu_options_bootstage() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
2019-04-02 19:42:29 +00:00
if [ "$2" == "system.prop" ]; then
2019-03-27 10:50:00 +00:00
TMPTXT="${C}post-fs-data${N} or ${C}late_start sevice${N}"
CHOICETXT="${G}p${N}(ost), ${G}l${N}(ate)"
elif [ "$2" == "post-fs-data" ]; then
2019-04-02 19:42:29 +00:00
TMPTXT="${C}system.prop${N} or ${C}late_start service${N}"
CHOICETXT="${G}s${N}(ystem.prop), ${G}l${N}(ate)"
2019-03-27 10:50:00 +00:00
elif [ "$2" == "late_start service" ]; then
2019-04-02 19:42:29 +00:00
TMPTXT="${C}system.prop${N} or ${C}post-fs-data${N}"
CHOICETXT="${G}s${N}(ystem.prop), ${G}p${N}(post)"
2018-05-29 07:29:19 +00:00
fi
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Current boot stage is ${G}$2${N}."
2018-05-29 07:29:19 +00:00
echo ""
2019-03-27 10:50:00 +00:00
echo "Do you want to change it to"
2020-08-14 08:01:35 +00:00
echo -e "$TMPTXT?"
2018-05-29 07:29:19 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter $CHOICETXT, ${G}b${N}(ack) or ${G}e${N}(xit): "
2018-05-29 07:29:19 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2019-04-02 19:42:29 +00:00
s|S)
2019-03-27 10:50:00 +00:00
if [ "$OPTIONBOOT" != 0 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=0
2019-04-02 19:42:29 +00:00
log_handler "Boot stage changed to system.prop."
2019-03-27 10:50:00 +00:00
replace_fn OPTIONBOOT $OPTIONBOOT $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
2018-05-29 07:29:19 +00:00
;;
2019-03-27 10:50:00 +00:00
p|P)
if [ "$OPTIONBOOT" != 1 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=1
log_handler "Boot stage changed to post-fs-data."
replace_fn OPTIONBOOT $OPTIONBOOT $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
;;
l|L)
if [ "$OPTIONBOOT" != 2 ]; then
2020-02-26 21:08:29 +00:00
before_change
2019-03-27 10:50:00 +00:00
OPTNEW=2
log_handler "Boot stage changed to late_start service."
replace_fn OPTIONBOOT $OPTIONBOOT $OPTNEW $LATEFILE
# Load module values
. $LATEFILE
INPUT2=""
2019-04-02 19:42:29 +00:00
after_change "$1"
2019-03-27 10:50:00 +00:00
break
else
invalid_input 1 3
fi
;;
b|B)
2018-05-29 07:29:19 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-05-29 07:29:19 +00:00
;;
2019-03-27 10:50:00 +00:00
*) invalid_input 1 3
2018-05-29 07:29:19 +00:00
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Options, general function, $1=header, $2=is option disabled or enabled, $3=information text
2019-11-22 19:19:18 +00:00
menu_option_chng() {
2018-04-15 22:05:33 +00:00
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
if [ "$2" == "enabled" ]; then
TMPTXT="disable"
OPTCURR=1
OPTNEW=0
2019-11-22 19:19:18 +00:00
EXECCURR="background"
EXECNEW="regular"
2018-04-15 22:05:33 +00:00
else
TMPTXT="enable"
OPTCURR=0
OPTNEW=1
2019-11-22 19:19:18 +00:00
EXECCURR="regular"
EXECNEW="background"
2018-04-15 22:05:33 +00:00
fi
menu_header "${C}$1${N}"
echo ""
2020-08-14 08:01:35 +00:00
echo -e "$3 currently ${G}$2${N}."
2019-02-02 12:37:20 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -e "Do you want to ${C}$TMPTXT${N} it?"
2019-02-02 12:37:20 +00:00
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2019-02-02 12:37:20 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
2019-11-22 19:19:18 +00:00
log_handler "$1 was ${TMPTXT}d."
replace_fn $4 $OPTCURR $OPTNEW $LATEFILE
if [ "$4" == "OPTIONBACK" ]; then
sed -i -e "s|^{|\#anch${OPTCURR}|;s|^\#anch${OPTNEW}|{|;s|$EXECCURR|$EXECNEW|" $MODPATH/post-fs-data.sh
fi
2019-02-02 12:37:20 +00:00
# Load module values
. $LATEFILE
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Export all settings to a module configuration file, $1=header
2020-02-26 21:08:29 +00:00
menu_option_export() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
echo "This will will export all settings"
echo "to a module configuration file."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2020-02-26 21:08:29 +00:00
read -r INPUT3
fi
case "$INPUT3" in
y|Y)
2020-08-14 08:01:35 +00:00
export_settings "$1"
2020-02-26 21:08:29 +00:00
INPUT2=""
break
;;
n|N)
INPUT2=""
break
;;
e|E) exit_fn
;;
*) invalid_input 3 3
;;
esac
done
}
2020-08-14 08:01:35 +00:00
# Third menu level - Options, reset all options, $1=header
2018-04-15 22:05:33 +00:00
menu_options_reset() {
INPUT3=""
while true
do
if [ -z "$INPUT3" ]; then
menu_header "${C}$1${N}"
echo ""
2018-04-19 03:13:40 +00:00
echo "This will reset all script settings"
2018-04-15 22:05:33 +00:00
echo "to their default values."
echo ""
echo "Do you want to continue?"
echo ""
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-04-15 22:05:33 +00:00
read -r INPUT3
fi
case "$INPUT3" in
2018-06-03 16:40:24 +00:00
y|Y)
2018-04-19 03:13:40 +00:00
log_handler "Resetting all script settings."
2019-03-27 10:50:00 +00:00
replace_fn OPTIONBOOT $OPTIONBOOT 0 $LATEFILE
2019-02-02 12:37:20 +00:00
replace_fn OPTIONCOLOUR $OPTIONCOLOUR 1 $LATEFILE
2020-09-12 18:30:24 +00:00
replace_fn OPTIONWEBP $OPTIONWEBP 1 $LATEFILE
replace_fn OPTIONWEBU $OPTIONWEBU 1 $LATEFILE
2020-02-26 21:08:29 +00:00
replace_fn OPTIONUPDATE $OPTIONUPDATE 1 $LATEFILE
replace_fn OPTIONBACK $OPTIONBACK 0 $LATEFILE
2019-02-02 12:37:20 +00:00
# Load module values
. $LATEFILE
2018-04-15 22:05:33 +00:00
INPUT2=""
break
;;
2018-06-03 16:40:24 +00:00
n|N)
2018-04-15 22:05:33 +00:00
INPUT2=""
break
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-04-15 22:05:33 +00:00
;;
*) invalid_input 3 3
;;
esac
done
}
2018-06-19 09:56:08 +00:00
# ======================== Logs ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Logs, $1=header, $2=Run as a command flag or not
2018-06-19 09:56:08 +00:00
menu_logs() {
INPUT2=""
while true
do
if [ -z "$INPUT2" ]; then
menu_header "${C}$1${N}"
echo ""
echo "This will package the Magisk log and the"
2020-08-27 09:07:28 +00:00
echo "module specific log files, together with"
echo "all the original and current prop values"
echo "and save it on your device."
2018-06-19 09:56:08 +00:00
echo ""
2020-08-27 09:07:28 +00:00
echo "If you are having issues, please upload"
echo "the packaged file to the support thread"
echo "@ XDA, with a detailed description."
2018-06-19 09:56:08 +00:00
echo ""
echo "Do you want to contine?"
echo ""
if [ "$2" == "l" ]; then
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es) or ${G}n${N}(o): "
2018-06-19 09:56:08 +00:00
else
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-06-19 09:56:08 +00:00
fi
read -r INPUT2
fi
case "$INPUT2" in
y|Y)
collect_logs "$1" "$2"
INPUT=""
break
;;
n|N)
if [ "$2" == "l" ]; then
exit_fn
else
INPUT=""
break
fi
;;
e|E)
if [ "$2" == "l" ]; then
invalid_input 1 2
else
exit_fn
fi
;;
*) invalid_input 1 2
;;
esac
done
}
2020-09-12 18:30:24 +00:00
# ======================== Perform module update check ========================
# Second menu level - Reset all options and settings, $1=header
menu_update_check() {
INPUT2=""
while true
do
if [ -z "$INPUT2" ]; then
menu_header "${C}$1${N}"
echo ""
echo "Do you want to check online if there"
echo "is an update to module?"
echo ""
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
read -r INPUT2
fi
case "$INPUT2" in
2020-10-25 19:49:49 +00:00
y|Y)
2020-09-12 18:30:24 +00:00
update_check "manual"
INPUT=""
break
;;
2020-10-25 19:49:49 +00:00
n|N)
2020-09-12 18:30:24 +00:00
INPUT=""
break
;;
e|E) exit_fn
;;
*) invalid_input 1 2
;;
esac
done
}
2018-04-19 03:13:40 +00:00
# ======================== Reset all options and settings ========================
2020-08-14 08:01:35 +00:00
# Second menu level - Reset all options and settings, $1=header, $2=Run as a command flag or not
2018-04-15 22:05:33 +00:00
reset_everything() {
INPUT2=""
while true
do
if [ -z "$INPUT2" ]; then
menu_header "${C}$1${N}"
echo ""
2018-04-19 03:13:40 +00:00
echo "All module options and settings"
echo "will be reset to the default values."
2018-04-15 22:05:33 +00:00
echo ""
echo "Do you want to continue?"
echo ""
if [ "$2" == "r" ]; then
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es) or ${G}n${N}(o): "
2018-04-15 22:05:33 +00:00
LOGTXT=" (option -r)"
INV1=2
INV2=1
else
2020-08-14 08:01:35 +00:00
echo -en "Enter ${G}y${N}(es), ${G}n${N}(o) or ${G}e${N}(xit): "
2018-04-15 22:05:33 +00:00
LOGTXT=""
INV1=3
INV2=2
fi
read -r INPUT2
fi
case "$INPUT2" in
2020-10-25 19:49:49 +00:00
y|Y)
2018-04-15 22:05:33 +00:00
log_handler "Resetting all module settings$LOGTXT."
2019-04-02 19:42:29 +00:00
reset_fn "$1" "$2"
2019-02-02 12:37:20 +00:00
INPUT=""
2018-04-15 22:05:33 +00:00
break
;;
2020-10-25 19:49:49 +00:00
n|N)
2018-04-15 22:05:33 +00:00
if [ "$2" == "r" ]; then
exit_fn
else
INPUT=""
break
fi
;;
2020-10-25 19:49:49 +00:00
e|E)
2018-04-15 22:05:33 +00:00
if [ "$2" == "r" ]; then
invalid_input $INV1 $INV2
else
exit_fn
fi
;;
*) invalid_input $INV1 $INV2
;;
esac
done
}
2018-03-18 15:39:43 +00:00
# ====================================================
# =================== Script check ===================
# ====================================================
2018-07-01 05:31:37 +00:00
ISSUECHK=0
if [ "$ISSUECHK" == 0 ] && [ ! -f "$LATEFILE" ]; then
2019-02-02 12:37:20 +00:00
log_handler "The module settings file can't be found."
2018-07-01 05:31:37 +00:00
ISSUECHK=1
2019-02-02 12:37:20 +00:00
ISSUETXT="The module settings file can't be found.\n\n Please reboot your device to reset."
2018-03-18 15:39:43 +00:00
fi
2019-02-02 12:37:20 +00:00
# Load module settings
all_values
2018-03-28 16:39:57 +00:00
orig_check
2018-07-01 05:31:37 +00:00
if [ "$ISSUECHK" == 0 ] && [ "$ORIGLOAD" == 0 ]; then
2018-12-05 15:22:57 +00:00
log_handler "Original prop values are not loaded in late_start service boot script."
2018-07-01 05:31:37 +00:00
ISSUECHK=1
ISSUETXT="The original prop values are not loaded,\n possibly due to a full reset of the module,\n or something has gone wrong.\n\n Please reboot your device to reset."
2018-03-18 15:39:43 +00:00
fi
2018-04-19 03:13:40 +00:00
script_ran_check
2018-07-01 05:31:37 +00:00
if [ "$ISSUECHK" == 0 ] && [ "$POSTCHECK" == 0 ] && [ "$LATECHECK" == 0 ]; then
2019-02-02 12:37:20 +00:00
log_handler "None of the module scripts ran during boot."
2018-07-01 05:31:37 +00:00
ISSUECHK=1
2019-02-02 12:37:20 +00:00
ISSUETXT="None of the module scripts appear\n to have run during boot.\n\n This means the module won't work.\n\n Please reboot your device and see if\n they do run."
2018-07-01 05:31:37 +00:00
elif [ "$ISSUECHK" == 0 ] && [ "$POSTCHECK" == 0 ]; then
2019-02-02 12:37:20 +00:00
log_handler "The post-fs-data.sh module script did not run during boot."
2018-07-01 05:31:37 +00:00
ISSUECHK=1
2019-02-02 12:37:20 +00:00
ISSUETXT="The post-fs-data.sh module script does not\n appear to have run during boot.\n\n This means the module won't work.\n\n Please reboot your device and see if\n it does run."
2018-07-01 05:31:37 +00:00
elif [ "$ISSUECHK" == 0 ] && [ "$LATECHECK" == 0 ]; then
2019-02-02 12:37:20 +00:00
log_handler "The service.sh module script did not run during boot."
2018-07-01 05:31:37 +00:00
ISSUECHK=1
2019-02-02 12:37:20 +00:00
ISSUETXT="The service.sh module script does not\n appear to have run during boot.\n\n This means the module won't work.\n\n Please reboot your device and see if\n it does run."
2018-04-19 03:13:40 +00:00
fi
2019-11-22 19:19:18 +00:00
if [ "$ISSUECHK" == 1 ] && [ "$1" != "-s" ]; then
2018-07-01 05:31:37 +00:00
collect_logs "issue"
2020-07-09 19:53:40 +00:00
reboot_fn "${ISSUETXT}\n\n Things to try:\n Disable other modules.\n (Cloudflare and EdXposed are known examples)\n Change boot stage settings or background\n execution for the boot script\n (run the props\n command with the -s option).\n\n If the issue persists after a reboot,\n please report the issue, ${R}with logs!${C}\n\n Logs have automatically been saved\n to your internal storage\n ${R}(propslogs.tar.gz)${C}.\n\n If the automatic collection failed,\n please collect the logs manually.\n\n ${G}See the documentation for further details.${N}" "reset-script"
2018-07-01 05:31:37 +00:00
fi
2018-07-26 09:03:13 +00:00
2018-03-18 15:39:43 +00:00
# ====================================================
# ====================== Options =====================
# ====================================================
2020-09-12 18:30:24 +00:00
# Testing connection
test_connection "$1"
2020-07-09 19:53:40 +00:00
2020-09-12 18:30:24 +00:00
if [ "$1" ]; then
invalid_option() {
log_handler "Invalid option."
clear
menu_header "${C}Help${N}"
echo ""
echo -e "${R}Invalid option.${N}"
echo ""
echo "Try again without options,"
echo "or use -h for help and details."
echo ""
log_handler "Exiting... Bye bye.\n\n===================="
exit 0
}
# Check for second input variable. If found, set custom prop
if [ "$2" ]; then
log_handler "Setting custom prop from command prompt."
clear
menu_set_custprop "$1" "$2" "$(getprop $1)" "option"
clear
echo "Done."
echo ""
log_handler "Exiting... Bye bye.\n\n===================="
exit 0
else
2020-07-09 19:53:40 +00:00
case "$1" in
*\.*|*\=*) invalid_option
;;
2020-09-12 18:30:24 +00:00
*d*|*f*|*l*|*h*|*nc*|*nw*|*r*|*s*|*t*|*u*) # Do nothing
2020-07-09 19:53:40 +00:00
;;
*) invalid_option
;;
esac
fi
2020-09-12 18:30:24 +00:00
# Check non-combinable options
for ITEM1 in $SOLORUN; do
case "$1" in
*$ITEM1*)
for ITEM2 in $SOLORUN; do
if [ "$ITEM1" != "$ITEM2" ]; then
case "$1" in
*$ITEM2*)
invalid_option
;;
esac
fi
done
;;
esac
done
2018-04-15 22:05:33 +00:00
2020-09-12 18:30:24 +00:00
# Help menu
case "$1" in
-h)
log_handler "Showing help (-h)."
clear
menu_header "${C}Help${N}"
echo ""
echo -e $(echo $(get_file_value $MODPATH/module.prop "description=") | sed 's|, |,\\n|g' | sed 's|\. |\.\\n|g')
echo ""
echo "Usage: props NAME VALUE"
echo " or: props [options]..."
echo ""
echo "Entering a property NAME and VALUE will save"
echo "this information to the module settings as custom"
echo "prop values."
echo ""
echo "Options:"
echo " -d *Update to fingerprints test list during start."
echo " -f *Update fingerprints list during start."
echo " -l *Save module logs and info."
echo " -h *Show this message."
echo " -nc Run without colours."
echo " -nw Run without connecting to the web during start."
echo " -r *Reset all options/settings."
echo " -s *Open script settings menu."
echo " -t Activate test mode."
echo " -u *Perform a module update check during start."
echo ""
echo "Options marked with an asterisk (*) cannot be"
echo "combined with each other."
echo ""
echo "See the module readme or the"
echo "support thread @ XDA for details."
echo ""
log_handler "Exiting... Bye bye.\n\n===================="
exit 0
2020-10-25 19:49:49 +00:00
;;
2020-09-12 18:30:24 +00:00
esac
# Run options
case "$1" in
*d*) # Download developers prints list, for testing prints
download_prints "Dev" "$1"
;;
*f*) # Update fingerprints list
download_prints "f" "$1"
;;
*l*) # Save logs
menu_logs "Collect logs" "l"
;;
*r*) # Reset all settings
reset_everything "Reset all settings" "r"
;;
*s*) # Open settings menu
menu_options "Script settings" "s"
;;
*u*) # Perform an update check
update_check "" "$1"
;;
esac
fi
2018-04-15 22:05:33 +00:00
2020-09-12 18:30:24 +00:00
# Download fingerprints list and perform a module update check, if enabled
if [ "$OPTIONWEBP" == 1 ] || [ "$OPTIONWEBU" == 1 ]; then
2019-02-02 12:37:20 +00:00
case "$1" in
2020-09-12 18:30:24 +00:00
*d*|*f*|*u*)
case "$1" in
*d*|*f*) # Don't download prints
if [ "$OPTIONWEBU" == 1 ]; then
update_check "" "$1"
fi
;;
*u*) # Don't perform the update check
if [ "$OPTIONWEBP" == 1 ]; then
download_prints "" "$1"
fi
;;
esac
2019-02-02 12:37:20 +00:00
;;
2020-09-12 18:30:24 +00:00
*)
if [ "$OPTIONWEBP" == 1 ]; then
download_prints "" "$1"
fi
if [ "$OPTIONWEBU" == 1 ]; then
update_check "" "$1"
fi
2019-02-02 12:37:20 +00:00
;;
esac
2018-04-15 22:05:33 +00:00
fi
2020-03-06 12:37:19 +00:00
# Check if fingerprints testing is active
if [ "$(get_file_value $PRINTSLOC "PRINTSV=")" == "Dev" ]; then
DEVPRINTS=true
fi
2018-03-18 15:39:43 +00:00
# ===================================================
# ==================== Main menu ====================
# ===================================================
while true
do
2018-03-28 16:39:57 +00:00
orig_check
if [ "$ORIGLOAD" == 0 ]; then
2018-03-18 15:39:43 +00:00
log_handler "Original values are not loaded in propsconf_late."
2018-03-28 16:39:57 +00:00
reboot_fn "The original prop values are not loaded,\n possibly due to a full reset of the module.\n\n Please reboot your device to reset." "reset-script"
2018-03-18 15:39:43 +00:00
else
2020-03-06 12:37:19 +00:00
if [ "$DEVPRINTS" == "true" ]; then
INPUT=1
else
INPUT=""
fi
2018-03-18 15:39:43 +00:00
ACTIVE="${G} (active)${N}"
DISABLED="${R} (disabled)${N}"
PRINTTXT=""
2020-07-26 18:52:55 +00:00
BASICTXT=""
2019-02-02 12:37:20 +00:00
DEVTXT=""
2018-03-18 15:39:43 +00:00
FILETXT=""
PROPTXT=""
2018-04-15 22:05:33 +00:00
CUSTTXT=""
2018-06-19 09:56:08 +00:00
DELTXT=""
2018-04-15 22:05:33 +00:00
if [ -z "$INPUT" ]; then
2019-02-02 12:37:20 +00:00
if [ "$FINGERPRINTENB" == 0 ]; then
2018-03-18 15:39:43 +00:00
PRINTTXT=$DISABLED
2019-02-02 12:37:20 +00:00
elif [ "$PRINTEDIT" == 1 ]; then
2018-03-18 15:39:43 +00:00
PRINTTXT=$ACTIVE
fi
2021-01-14 21:01:33 +00:00
#if [ "$BASICATTEST" == 1 ]; then
# BASICTXT=$ACTIVE
#fi
2019-02-02 12:37:20 +00:00
if [ "$FINGERPRINTENB" == 0 ] || [ "$PRINTEDIT" == 0 ]; then
DEVTXT=$DISABLED
2019-11-22 19:19:18 +00:00
elif [ "$DEVSIM" == 1 ] && [ "$BRANDSET" == 1 ] || [ "$NAMESET" == 1 ] || [ "$DEVICESET" == 1 ] || [ "$RELEASESET" == 1 ] || [ "$IDSET" == 1 ] || [ "$INCREMENTALSET" == 1 ] || [ "$SDKSET" == 1 ] || [ "$DISPLAYSET" == 1 ]; then
2019-02-02 12:37:20 +00:00
DEVTXT=$ACTIVE
fi
if [ "$PROPEDIT" == 1 ]; then
2018-03-18 15:39:43 +00:00
PROPTXT=$ACTIVE
fi
2019-02-02 12:37:20 +00:00
if [ "$CUSTOMEDIT" == 1 ]; then
2018-04-15 22:05:33 +00:00
CUSTTXT=$ACTIVE
fi
2019-02-02 12:37:20 +00:00
if [ "$DELEDIT" == 1 ]; then
2018-06-19 09:56:08 +00:00
DELTXT=$ACTIVE
fi
2018-03-18 15:39:43 +00:00
menu_header "Select an option below."
echo ""
2020-09-12 18:30:24 +00:00
if [ "$UPDATECHECK" ]; then
echo -e "${C}$UPDATECHECK${N}"
echo ""
if [ "$UPDATECHECK" == "No update available." ]; then
UPDATECHECK=""
fi
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}1${N} - Edit device fingerprint${PRINTTXT}"
2021-01-14 21:01:33 +00:00
# echo -e "${G}2${N} - Force BASIC key attestation${BASICTXT}" # Google once again changed their SN checks. This is no longer viable. Will remove completely in future.
echo -e "${G}2${N} - Device simulation${DEVTXT}"
echo -e "${G}3${N} - Edit MagiskHide props${PROPTXT}"
echo -e "${G}4${N} - Add/edit custom props${CUSTTXT}"
echo -e "${G}5${N} - Delete prop values${DELTXT}"
echo -e "${G}6${N} - Script settings"
echo -e "${G}7${N} - Collect logs"
2020-09-12 18:30:24 +00:00
if [ -z "$UPDATECHECK" ]; then
echo -e "${G}u${N} - Perform module update check"
fi
2020-08-14 08:01:35 +00:00
echo -e "${G}r${N} - Reset all options/settings"
echo -e "${G}b${N} - Reboot device"
echo -e "${G}e${N} - Exit"
2018-03-18 15:39:43 +00:00
echo ""
2019-02-02 12:37:20 +00:00
if [ "$REBOOTCHK" == 1 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${R}Some options/settings have been changed.${N}"
echo -e "${R}Please reboot for them to take affect.${N}"
2018-03-18 15:39:43 +00:00
echo ""
fi
2019-02-02 12:37:20 +00:00
if [ "$PRINTCHK" == 1 ]; then
2020-08-14 08:01:35 +00:00
echo -e "${R}The device fingerprint has been updated.${N}"
echo -e "${R}Please reboot to apply.${N}"
2019-02-02 12:37:20 +00:00
echo ""
fi
2018-03-18 15:39:43 +00:00
echo "See the module readme or the"
2018-04-15 22:05:33 +00:00
echo "support thread @ XDA for details."
2018-03-18 15:39:43 +00:00
echo ""
2019-11-02 22:24:17 +00:00
echo -n "Enter your desired option: "
2018-03-18 15:39:43 +00:00
read -r INPUT
fi
case "$INPUT" in
2019-02-02 12:37:20 +00:00
1) menu_change_fingerprint "Edit device fingerprint${PRINTTXT}" $CURRFINGERPRINT $ORIGFINGERPRINT $MODULEFINGERPRINT
;;
2021-01-14 21:01:33 +00:00
# 2) menu_force_basic "Force BASIC key attestation${BASICTXT}" # Google once again changed their SN checks. This is no longer viable. Will remove completely in future.
# ;;
2) menu_dev_sim "Device simulation${DEVTXT}"
2018-04-15 22:05:33 +00:00
;;
2021-01-14 21:01:33 +00:00
3) menu_magiskhide_props "MagiskHide props${PROPTXT}"
2018-03-18 15:39:43 +00:00
;;
2021-01-14 21:01:33 +00:00
4) menu_custom_props "Custom props${CUSTTXT}"
2018-03-18 15:39:43 +00:00
;;
2021-01-14 21:01:33 +00:00
5) menu_delete_props "Delete props${DELTXT}"
2018-06-19 09:56:08 +00:00
;;
2021-01-14 21:01:33 +00:00
6) menu_options "Script settings"
2018-06-19 09:56:08 +00:00
;;
2021-01-14 21:01:33 +00:00
7) menu_logs "Collect logs"
2018-03-18 15:39:43 +00:00
;;
2020-09-12 18:30:24 +00:00
u|U)
if [ -z "$UPDATECHECK" ]; then
menu_update_check "Perform module update check"
else
invalid_input 1 1
fi
;;
2019-02-02 12:37:20 +00:00
r|R) reset_everything "Reset all options/settings"
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
b|B) reboot_fn "Reboot device" "reboot"
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
e|E) exit_fn
2018-03-18 15:39:43 +00:00
;;
2019-02-02 12:37:20 +00:00
*) invalid_input 1 1
2018-03-18 15:39:43 +00:00
;;
esac
fi
2018-09-04 08:23:35 +00:00
done