├── .gitattributes ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── customize.sh ├── mod-util.sh ├── module.prop └── system └── xbin └── hidden /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have LF line endings on checkout. 2 | META-INF/** text eol=lf 3 | *.prop text eol=lf 4 | *.sh text eol=lf 5 | *.md text eol=lf 6 | 7 | # Denote all files that are truly binary and should not be modified. 8 | system/** binary 9 | -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # Global vars 10 | TMPDIR=/dev/tmp 11 | PERSISTDIR=/sbin/.magisk/mirror/persist 12 | 13 | rm -rf $TMPDIR 2>/dev/null 14 | mkdir -p $TMPDIR 15 | 16 | # echo before loading util_functions 17 | ui_print() { echo "$1"; } 18 | 19 | require_new_magisk() { 20 | ui_print "*******************************" 21 | ui_print " Please install Magisk v19.0+! " 22 | ui_print "*******************************" 23 | exit 1 24 | } 25 | 26 | is_legacy_script() { 27 | unzip -l "$ZIPFILE" install.sh | grep -q install.sh 28 | return $? 29 | } 30 | 31 | print_modname() { 32 | local len 33 | len=`echo -n $MODNAME | wc -c` 34 | len=$((len + 2)) 35 | local pounds=`printf "%${len}s" | tr ' ' '*'` 36 | ui_print "$pounds" 37 | ui_print " $MODNAME " 38 | ui_print "$pounds" 39 | ui_print "*******************" 40 | ui_print " Powered by Magisk " 41 | ui_print "*******************" 42 | } 43 | 44 | ############## 45 | # Environment 46 | ############## 47 | 48 | OUTFD=$2 49 | ZIPFILE=$3 50 | 51 | mount /data 2>/dev/null 52 | 53 | # Load utility functions 54 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 55 | . /data/adb/magisk/util_functions.sh 56 | [ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk 57 | 58 | # Preperation for flashable zips 59 | setup_flashable 60 | 61 | # Mount partitions 62 | mount_partitions 63 | 64 | # Detect version and architecture 65 | api_level_arch_detect 66 | 67 | # Setup busybox and binaries 68 | $BOOTMODE && boot_actions || recovery_actions 69 | 70 | ############## 71 | # Preparation 72 | ############## 73 | 74 | # Extract prop file 75 | unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2 76 | [ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!" 77 | 78 | $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules 79 | MODULEROOT=$NVBASE/$MODDIRNAME 80 | MODID=`grep_prop id $TMPDIR/module.prop` 81 | MODPATH=$MODULEROOT/$MODID 82 | MODNAME=`grep_prop name $TMPDIR/module.prop` 83 | 84 | # Create mod paths 85 | rm -rf $MODPATH 2>/dev/null 86 | mkdir -p $MODPATH 87 | 88 | ########## 89 | # Install 90 | ########## 91 | 92 | if is_legacy_script; then 93 | unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2 94 | 95 | # Load install script 96 | . $TMPDIR/install.sh 97 | 98 | # Callbacks 99 | print_modname 100 | on_install 101 | 102 | # Custom uninstaller 103 | [ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh 104 | 105 | # Skip mount 106 | $SKIPMOUNT && touch $MODPATH/skip_mount 107 | 108 | # prop file 109 | $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop 110 | 111 | # Module info 112 | cp -af $TMPDIR/module.prop $MODPATH/module.prop 113 | 114 | # post-fs-data scripts 115 | $POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh 116 | 117 | # service scripts 118 | $LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh 119 | 120 | ui_print "- Setting permissions" 121 | set_permissions 122 | else 123 | print_modname 124 | 125 | unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2 126 | 127 | if ! grep -q '^SKIPUNZIP=' $MODPATH/customize.sh 2>/dev/null; then 128 | ui_print "- Extracting module files" 129 | unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2 130 | 131 | # Default permissions 132 | set_perm_recursive $MODPATH 0 0 0755 0644 133 | fi 134 | 135 | # Load customization script 136 | [ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh 137 | fi 138 | 139 | # Handle replace folders 140 | for TARGET in $REPLACE; do 141 | ui_print "- Replace target: $TARGET" 142 | mktouch $MODPATH$TARGET/.replace 143 | done 144 | 145 | if $BOOTMODE; then 146 | # Update info for Magisk Manager 147 | mktouch $NVBASE/modules/$MODID/update 148 | cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop 149 | fi 150 | 151 | # Copy over custom sepolicy rules 152 | if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then 153 | ui_print "- Installing custom sepolicy patch" 154 | PERSISTMOD=$PERSISTDIR/magisk/$MODID 155 | mkdir -p $PERSISTMOD 156 | cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule 157 | fi 158 | 159 | # Remove stuffs that don't belong to modules 160 | rm -rf \ 161 | $MODPATH/system/placeholder $MODPATH/customize.sh \ 162 | $MODPATH/README.md $MODPATH/.git* 2>/dev/null 163 | 164 | ############## 165 | # Finalizing 166 | ############## 167 | 168 | cd / 169 | $BOOTMODE || recovery_cleanup 170 | rm -rf $TMPDIR 171 | 172 | ui_print "- Done" 173 | exit 0 -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hidden Settings 2 | 3 | ## Description 4 | Hidden Settings is essentially a wrapper for the `settings` android command. 5 | Using this module will make it easier to find certain rom settings that may not be visible under regular circumstances. 6 | 7 | ## Disclaimer 8 | The use of this module can cause serious harm if you do not know what you are doing. 9 | If you don't know what a setting does you SHOULD NOT attempt to change it. 10 | I (Skittles9823) will not be responsible for ANY damage caused to anyone's devices due to the use of this module. 11 | 12 | ## Instructions 13 | - Install the module from the Magisk Manager's Downloads section, then reboot. 14 | - open a terminal then type `su` then `hidden` to activate the UI. 15 | 16 | ## Sources and used tools 17 | - [Module source](https://github.com/skittles9823/hidden-settings) 18 | - [mod-util](https://github.com/veez21/mod-util) by [veez21@XDA-Developers](https://forum.xda-developers.com/member.php?u=7296895) 19 | - [Magisk](https://github.com/topjohnwu/Magisk) by [topjohnwu](https://forum.xda-developers.com/member.php?u=4470081) 20 | - [Magisk Module Template](https://github.com/topjohnwu/magisk-module-template) by [topjohnwu](https://forum.xda-developers.com/member.php?u=4470081) 21 | 22 | ## Changelog: 23 | ### v0.0.4 24 | - update to latest Magisk module template 25 | 26 | ### v0.0.3 27 | - remove a clear that made it impossible to view the settings dump for a whole namespace 28 | 29 | ### v0.0.2 30 | - fix resetting settings 31 | - optimise sed statements and switch to a more readable delimiter 32 | - some longer sed statements should have been using simple awk statements, so let's do that kthnks 33 | - read can take multiple args, let's use that feature to clean up my menus 34 | 35 | ### v0.0.1 36 | - initial version 37 | -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | # perm stuff by veez21 @ xda-developers, slightly modified by me :) 2 | #cp -af $TMPDIR/mod-util.sh $MODPATH/mod-util.sh 3 | bin=xbin 4 | if [ ! -d /system/xbin ]; then 5 | bin=bin 6 | mkdir $MODPATH/system/$bin 7 | mv $MODPATH/system/xbin/hidden $MODPATH/system/$bin 8 | rm -rf $MODPATH/system/xbin 9 | fi 10 | set_perm $MODPATH/system/$bin/hidden 0 0 0777 11 | set_perm $MODPATH/mod-util.sh 0 0 0777 -------------------------------------------------------------------------------- /mod-util.sh: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | # 3 | # Terminal Utility Functions 4 | # by veez21 5 | # 6 | ########################################################################################## 7 | 8 | # Versions 9 | MODUTILVER=v2.4 10 | MODUTILVCODE=240 11 | 12 | # Check A/B slot 13 | if [ -d /system_root ]; then 14 | isABDevice=true 15 | SYSTEM=/system_root/system 16 | SYSTEM2=/system 17 | CACHELOC=/data/cache 18 | else 19 | isABDevice=false 20 | SYSTEM=/system 21 | SYSTEM2=/system 22 | CACHELOC=/cache 23 | fi 24 | [ -z "$isABDevice" ] && { echo "Something went wrong!"; exit 1; } 25 | 26 | #=========================== Set Busybox up 27 | # Variables: 28 | # BBok - If busybox detection was ok (true/false) 29 | # _bb - Busybox binary directory 30 | # _bbname - Busybox name 31 | 32 | # set_busybox 33 | # alias busybox applets 34 | set_busybox() { 35 | if [ -x "$1" ]; then 36 | for i in $(${1} --list); do 37 | if [ "$i" != 'echo' ]; then 38 | alias "$i"="${1} $i" >/dev/null 2>&1 39 | fi 40 | done 41 | _busybox=true 42 | _bb=$1 43 | fi 44 | } 45 | _busybox=false 46 | if $_busybox; then 47 | true 48 | elif [ -x $SYSTEM2/xbin/busybox ]; then 49 | _bb=$SYSTEM2/xbin/busybox 50 | elif [ -x $SYSTEM2/bin/busybox ]; then 51 | _bb=$SYSTEM2/bin/busybox 52 | else 53 | echo "! Busybox not detected" 54 | echo "Please install one (@osm0sis' busybox recommended)" 55 | false 56 | fi 57 | set_busybox $_bb 58 | [ $? -ne 0 ] && exit $? 59 | [ -n "$LOGNAME" ] && alias clear='echo' 60 | _bbname="$($_bb | head -n1 | awk '{print $1,$2}')" 61 | BBok=true 62 | if [ "$_bbname" == "" ]; then 63 | _bbname="BusyBox not found!" 64 | BBok=false 65 | fi 66 | 67 | #=========================== Default Functions and Variables 68 | 69 | # Set perm 70 | set_perm() { 71 | chown $2:$3 $1 || return 1 72 | chmod $4 $1 || return 1 73 | [ -z $5 ] && chcon 'u:object_r:system_file:s0' $1 || chcon $5 $1 || return 1 74 | } 75 | 76 | # Set perm recursive 77 | set_perm_recursive() { 78 | find $1 -type d 2>/dev/null | while read dir; do 79 | set_perm $dir $2 $3 $4 $6 80 | done 81 | find $1 -type f -o -type l 2>/dev/null | while read file; do 82 | set_perm $file $2 $3 $5 $6 83 | done 84 | } 85 | 86 | # Mktouch 87 | mktouch() { 88 | mkdir -p ${1%/*} 2>/dev/null 89 | [ -z $2 ] && touch $1 || echo $2 > $1 90 | chmod 644 $1 91 | } 92 | 93 | # Grep prop 94 | grep_prop() { 95 | local REGEX="s/^$1=//p" 96 | shift 97 | local FILES=$@ 98 | [ -z "$FILES" ] && FILES='/system/build.prop' 99 | sed -n "$REGEX" $FILES 2>/dev/null | head -n 1 100 | } 101 | 102 | # Abort 103 | abort() { 104 | echo "$1" 105 | exit 1 106 | } 107 | 108 | 109 | # Device Info 110 | # Variables: BRAND MODEL DEVICE API ABI ABI2 ABILONG ARCH 111 | BRAND=$(getprop ro.product.brand) 112 | MODEL=$(getprop ro.product.model) 113 | DEVICE=$(getprop ro.product.device) 114 | ROM=$(getprop ro.build.display.id) 115 | API=`grep_prop ro.build.version.sdk` 116 | ABI=`grep_prop ro.product.cpu.abi | cut -c-3` 117 | ABI2=`grep_prop ro.product.cpu.abi2 | cut -c-3` 118 | ABILONG=`grep_prop ro.product.cpu.abi` 119 | ARCH=arm 120 | ARCH32=arm 121 | IS64BIT=false 122 | if [ "$ABI" = "x86" ]; then ARCH=x86; ARCH32=x86; fi; 123 | if [ "$ABI2" = "x86" ]; then ARCH=x86; ARCH32=x86; fi; 124 | if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; ARCH32=arm; IS64BIT=true; fi; 125 | if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; ARCH32=x86; IS64BIT=true; fi; 126 | 127 | # Version Number 128 | VER=$(grep_prop version $MODDIR/module.prop) 129 | # Version Code 130 | REL=$(grep_prop versionCode $MODDIR/module.prop) 131 | # Author 132 | AUTHOR=$(grep_prop author $MODDIR/module.prop) 133 | # Mod Name/Title 134 | MODTITLE=$(grep_prop name $MODDIR/module.prop) 135 | 136 | # Colors 137 | G='\e[01;32m' # GREEN TEXT 138 | R='\e[01;31m' # RED TEXT 139 | Y='\e[01;33m' # YELLOW TEXT 140 | B='\e[01;34m' # BLUE TEXT 141 | V='\e[01;35m' # VIOLET TEXT 142 | Bl='\e[01;30m' # BLACK TEXT 143 | C='\e[01;36m' # CYAN TEXT 144 | W='\e[01;37m' # WHITE TEXT 145 | BGBL='\e[1;30;47m' # Background W Text Bl 146 | N='\e[0m' # How to use (example): echo "${G}example${N}" 147 | loadBar=' ' # Load UI 148 | # Remove color codes if -nc or in ADB Shell 149 | [ -n "$1" -a "$1" == "-nc" ] && shift && NC=true 150 | [ "$NC" -o -n "$LOGNAME" ] && { 151 | G=''; R=''; Y=''; B=''; V=''; Bl=''; C=''; W=''; N=''; BGBL=''; loadBar='='; 152 | } 153 | 154 | # No. of characters in $MODTITLE, $VER, and $REL 155 | character_no=$(echo "$MODTITLE $VER $REL" | wc -c) 156 | 157 | # Divider 158 | div="${Bl}$(printf '%*s' "${character_no}" '' | tr " " "=")${N}" 159 | 160 | # title_div [-c] 161 | # based on $div with <title> 162 | title_div() { 163 | [ "$1" == "-c" ] && local character_no=$2 && shift 2 164 | [ -z "$1" ] && { local message=; no=0; } || { local message="$@ "; local no=$(echo "$@" | wc -c); } 165 | [ $character_no -gt $no ] && local extdiv=$((character_no-no)) || { echo "Invalid!"; return; } 166 | echo "${W}$message${N}${Bl}$(printf '%*s' "$extdiv" '' | tr " " "=")${N}" 167 | } 168 | 169 | # set_file_prop <property> <value> <prop.file> 170 | set_file_prop() { 171 | if [ -f "$3" ]; then 172 | if grep -q "$1=" "$3"; then 173 | sed -i "s/${1}=.*/${1}=${2}/g" "$3" 174 | else 175 | echo "$1=$2" >> "$3" 176 | fi 177 | else 178 | echo "$3 doesn't exist!" 179 | fi 180 | } 181 | 182 | # https://github.com/fearside/ProgressBar 183 | # ProgressBar <progress> <total> 184 | ProgressBar() { 185 | # Determine Screen Size 186 | if [[ "$COLUMNS" -le "57" ]]; then 187 | local var1=2 188 | local var2=20 189 | else 190 | local var1=4 191 | local var2=40 192 | fi 193 | # Process data 194 | local _progress=$(((${1}*100/${2}*100)/100)) 195 | local _done=$(((${_progress}*${var1})/10)) 196 | local _left=$((${var2}-$_done)) 197 | # Build progressbar string lengths 198 | local _done=$(printf "%${_done}s") 199 | local _left=$(printf "%${_left}s") 200 | 201 | # Build progressbar strings and print the ProgressBar line 202 | printf "\rProgress : ${BGBL}|${N}${_done// /${BGBL}$loadBar${N}}${_left// / }${BGBL}|${N} ${_progress}%%" 203 | } 204 | 205 | #https://github.com/fearside/SimpleProgressSpinner 206 | # Spinner <message> 207 | Spinner() { 208 | 209 | # Choose which character to show. 210 | case ${_indicator} in 211 | "|") _indicator="/";; 212 | "/") _indicator="-";; 213 | "-") _indicator="\\";; 214 | "\\") _indicator="|";; 215 | # Initiate spinner character 216 | *) _indicator="\\";; 217 | esac 218 | 219 | # Print simple progress spinner 220 | printf "\r${@} [${_indicator}]" 221 | } 222 | 223 | # cmd & spinner <message> 224 | e_spinner() { 225 | PID=$! 226 | h=0; anim='-\|/'; 227 | while [ -d /proc/$PID ]; do 228 | h=$(((h+1)%4)) 229 | sleep 0.02 230 | printf "\r${@} [${anim:$h:1}]" 231 | done 232 | } 233 | 234 | # test_connection 235 | # tests if there's internet connection 236 | test_connection() { 237 | echo -n "Testing internet connection " 238 | ping -q -c 1 -W 1 google.com >/dev/null 2>&1 && echo "- OK" || { echo "Error"; false; } 239 | } 240 | 241 | # Log files will be uploaded to termbin.com 242 | # Logs included: VERLOG LOG oldVERLOG oldLOG 243 | upload_logs() { 244 | $BBok && { 245 | test_connection || exit 246 | echo "Uploading logs" 247 | [ -s $VERLOG ] && verUp=$(cat $VERLOG | nc termbin.com 9999) || verUp=none 248 | [ -s $oldVERLOG ] && oldverUp=$(cat $oldVERLOG | nc termbin.com 9999) || oldverUp=none 249 | [ -s $LOG ] && logUp=$(cat $LOG | nc termbin.com 9999) || logUp=none 250 | [ -s $oldLOG ] && oldlogUp=$(cat $oldLOG | nc termbin.com 9999) || oldlogUp=none 251 | echo -n "Link: " 252 | echo "$MODEL ($DEVICE) API $API\n$ROM\n$ID\n 253 | O_Verbose: $oldverUp 254 | Verbose: $verUp 255 | 256 | O_Log: $oldlogUp 257 | Log: $logUp" | nc termbin.com 9999 258 | } || echo "Busybox not found!" 259 | exit 260 | } 261 | 262 | # Print Random 263 | # Prints a message at random 264 | # CHANCES - no. of chances <integer> 265 | # TARGET - target value out of CHANCES <integer> 266 | prandom() { 267 | local CHANCES=2 268 | local TARGET=2 269 | [ "$1" == "-c" ] && { local CHANCES=$2; local TARGET=$3; shift 3; } 270 | [ "$((RANDOM%CHANCES+1))" -eq "$TARGET" ] && echo "$@" 271 | } 272 | 273 | # Print Center 274 | # Prints text in the center of terminal 275 | pcenter() { 276 | local CHAR=$(printf "$@" | sed 's|\\e[[0-9;]*m||g' | wc -m) 277 | local hfCOLUMN=$((COLUMNS/2)) 278 | local hfCHAR=$((CHAR/2)) 279 | local indent=$((hfCOLUMN-hfCHAR)) 280 | echo "$(printf '%*s' "${indent}" '') $@" 281 | } 282 | 283 | # Heading 284 | mod_head() { 285 | clear 286 | echo "$div" 287 | echo "${W}$MODTITLE $VER${N}(${Bl}$REL${N})" 288 | echo "by ${W}$AUTHOR${N}" 289 | echo "$AUTHOR is not responsible for any damage caused by the use of this module" 290 | echo "$div" 291 | echo "${W}$_bbname${N}" 292 | echo "${Bl}$_bb${N}" 293 | echo "$div" 294 | [ -s $LOG ] && echo "Enter ${W}logs${N} to upload logs" && echo $div 295 | } 296 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=hidden_settings 2 | name=HiddenSettings 3 | version=v0.0.4 4 | versionCode=004 5 | author=Skittles9823 6 | description=A graphical interface to modify settings via terminal. 7 | -------------------------------------------------------------------------------- /system/xbin/hidden: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Terminal Magisk Mod Template 3 | # by veez21 @ xda-developers 4 | 5 | 6 | # Magisk Module ID ** 7 | ID="hidden_settings" 8 | 9 | # Detect root 10 | _name=$(basename $0) 11 | ls /data >/dev/null 2>&1 || { echo "$ID needs to run as root!"; echo "type 'su' then '$_name'"; exit 1; } 12 | 13 | # Import util_functions.sh 14 | [ -f /data/adb/magisk/util_functions.sh ] && . /data/adb/magisk/util_functions.sh || { echo "util_functions.sh not detected!"; exit 1; } 15 | 16 | # Magisk Mod Directory 17 | MOUNTPATH="/data/adb/modules" 18 | [ ! -d $MOUNTPATH ] && MOUNTPATH="/sbin/.magisk/img" 19 | MODDIR="$MOUNTPATH/$ID" 20 | [ ! -d $MODDIR ] && { echo "Module not detected!"; exit 1; } 21 | 22 | # Load mod-util.sh 23 | . $MODDIR/mod-util.sh || exit $? 24 | 25 | # Set Log Files 26 | mount -o remount,rw /cache 2>/dev/null 27 | mount -o rw,remount /cache 2>/dev/null 28 | # > Logs should go in this file 29 | LOG=$CACHELOC/$ID.log 30 | oldLOG=$CACHELOC/$ID-old.log 31 | # > Verbose output goes here 32 | VERLOG=$CACHELOC/$ID-verbose.log 33 | oldVERLOG=$CACHELOC/$ID-verbose-old.log 34 | 35 | # Start Logging verbosely 36 | mv -f $VERLOG $oldVERLOG 2>/dev/null; mv -f $LOG $oldLOG 2>/dev/null 37 | set -x 2>$VERLOG 38 | 39 | # Main 40 | # > You can start your MOD here. 41 | # > You can add functions, variables & etc. 42 | # > Rather than editing the default vars above. 43 | 44 | backup(){ 45 | touch $MODDIR/settings.bak 46 | for i in global secure system; do 47 | settings list $i | sed "s|=| |" | awk -v i=$i '{ print i" "$1" ""\""$2"\"" }' >> $MODDIR/settings.bak 48 | done 49 | } 50 | 51 | help_me(){ 52 | cat << EOF 53 | $MODTITLE $VER($REL) 54 | by $AUTHOR 55 | 56 | Usage: $_name 57 | or: $_name [options]... 58 | 59 | Options: 60 | -m [setting] [value] modify setting without terminal GUI 61 | -g [arg] get a range of settings and their 62 | values matching [arg] 63 | -l [system|secure|global] list all settings for a namespace 64 | -h show this message 65 | EOF 66 | exit 67 | } 68 | 69 | list_settings(){ 70 | [ "$noGUI" ] && $(settings list $1 && exit $1) 71 | for i in $namespace; do 72 | echo "====== $i ======" 73 | arg=$(settings list $i) 74 | echo "$arg" 75 | done 76 | } 77 | 78 | reset_setting_GUI(){ 79 | clear 80 | echo " ===== reset Settings =====" 81 | echo "" 82 | echo " Enter a setting value to reset it to default." 83 | echo " Make sure to enter the full string or it may \n match multiple values." 84 | echo " Settings can only be set one at a time as some \n settings cause the device to hot reboot." 85 | echo "" 86 | echo " x - ${Bl}Back to menu${N}" 87 | echo " 0 - ${Bl}Exit${N}" 88 | echo "" 89 | echo -n "[setting?]: " 90 | read choice 91 | case "$choice" in 92 | x) menu;; 93 | 0) exit;; 94 | *) setting=$(grep "$choice" $MODDIR/settings.bak | awk '{ print $1 " " $2 }') 95 | arg=$(grep "$choice" $MODDIR/settings.bak | awk '{ print $3 }') 96 | settings put "$setting" "$arg";; 97 | esac 98 | } 99 | 100 | get_setting(){ 101 | for i in $namespace; do 102 | echo "====== $i ======" 103 | arg=$(settings list $i | grep "$1" ) 104 | echo "$arg" 105 | done 106 | [ "$noGUI" ] && exit $? 107 | [ "$goBackGetGUI" ] && get_setting_GUI 108 | } 109 | 110 | get_setting_GUI(){ 111 | echo " ===== Find Settings =====" 112 | echo "" 113 | echo " Enter a search term and find matching settings" 114 | echo "" 115 | echo "" 116 | echo " x - ${Bl}Back to ${Type}Namespace settings${N}" 117 | echo " 0 - ${Bl}Exit${N}" 118 | echo "" 119 | echo -n "[Search?]: " 120 | read choice 121 | case "$choice" in 122 | x) menu_namespace $Type;; 123 | 0) exit;; 124 | *) goBackGetGUI=true 125 | get_setting $choice;; 126 | esac 127 | } 128 | 129 | modify_setting(){ 130 | for i in $namespace; do 131 | currNSpace=$i 132 | toChange=$(settings list $i | grep "$1" | sed 's|=.*||') 133 | [ $toChange ] && break 134 | done 135 | settings put "$currNSpace" "$toChange" "$2" 136 | [ "$noGUI" ] && exit $? 137 | [ "$goBackModGUI" ] && modify_setting_GUI 138 | } 139 | 140 | modify_setting_GUI(){ 141 | clear 142 | echo " ===== Modify Settings =====" 143 | echo "" 144 | echo " Enter a setting then value" 145 | echo " E.g. navigation_bar_visible 0" 146 | echo "" 147 | echo " x - ${Bl}Back to ${Type}Namespace settings${N}" 148 | echo " 0 - ${Bl}Exit${N}" 149 | echo "" 150 | echo -n "[Search?]: " 151 | read choice arg 152 | case "$choice" in 153 | x) menu_namespace $Type;; 154 | 0) exit;; 155 | *) goBackModGUI=true 156 | choice=($choice) 157 | modify_setting $choice $arg;; 158 | esac 159 | } 160 | 161 | menu_namespace(){ 162 | case "$1" in 163 | system|System) namespace=$1 164 | Type=System;; 165 | secure|Secure) namespace=$1 166 | Type=Secure;; 167 | global|Global) namespace=$1 168 | Type=Global;; 169 | all|All) Type=All;; 170 | esac 171 | echo " ===== ${Type}Namespace Settings =====" 172 | echo "" 173 | echo " 1 - ${W}List all settings${N}" 174 | echo " 2 - ${W}Find specific settings${N}" 175 | echo " 3 - ${W}Modify settings${N}" 176 | echo " x - ${Bl}Back to Menu${N}" 177 | echo " 0 - ${Bl}Exit${N}" 178 | echo "" 179 | echo -n "[CHOICE]: " 180 | read choice 181 | case "$choice" in 182 | 1) list_settings 183 | menu_namespace;; 184 | 2) clear && get_setting_GUI;; 185 | 3) clear && modify_setting_GUI;; 186 | x) menu;; 187 | 0) exit;; 188 | esac 189 | } 190 | 191 | menu(){ 192 | mod_head 193 | echo "" 194 | echo " 1 - ${W}System settings${N}" 195 | echo " 2 - ${W}Secure settings${N}" 196 | echo " 3 - ${W}Global settings${N}" 197 | echo " 4 - ${W}All settings${N}" 198 | echo " r - ${W}Reset/Backup setting(s) WIP${N}" 199 | echo " d - ${C}Donate${N}" 200 | echo " 0 - ${Bl}Exit${N}" 201 | echo "" 202 | echo -n "[CHOICE]: " 203 | read choice 204 | case "$choice" in 205 | 1) clear && menu_namespace system;; 206 | 2) clear && menu_namespace secure;; 207 | 3) clear && menu_namespace global;; 208 | 4) clear && menu_namespace all;; 209 | r|R) reset_setting_GUI;; 210 | d|D) am start https://paypal.me/skittles2398 >/dev/null;; 211 | logs) upload_logs;; 212 | 0) exit;; 213 | *) abort Invalid;; 214 | esac 215 | } 216 | 217 | noGUI= 218 | namespace=" 219 | system 220 | secure 221 | global 222 | " 223 | 224 | [ ! -f $MODDIR/settings.bak ] && backup 225 | 226 | case "$1" in 227 | -m) shift 228 | [ "$1" ] && { noGUI=true; modify_setting $1 $2; } || abort "Invalid setting/option!";; 229 | -g) shift 230 | [ "$1" ] && { noGUI=true; get_setting $1; } || abort "Invalid setting/option!";; 231 | -l) shift 232 | noGUI=true 233 | [ ! "$1" ] && abort "$(help_me)" 234 | if [ "$1" == "system" ]; then 235 | list_settings system 2>>$LOG 236 | elif [ "$1" == "secure" ]; then 237 | list_settings secure 2>>$LOG 238 | elif [ "$1" == "global" ]; then 239 | list_settings global 2>>$LOG 240 | else 241 | abort "$(help_me)" 242 | fi 243 | exit;; 244 | -h|--help) help_me;; 245 | esac 246 | 247 | menu 248 | exit $? 249 | --------------------------------------------------------------------------------