├── unlock_apk-debug.apk ├── iscroll ├── getwifi ├── tomdate ├── tohex ├── screenshot ├── hardcoded ├── todate ├── tojpg ├── animate ├── getprop ├── unlock ├── setlocalprop ├── systemuilog ├── monkey ├── getimgs └── genimgs ├── README.md ├── LICENSE └── sysui /unlock_apk-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhenleiji/AndroidScripts/HEAD/unlock_apk-debug.apk -------------------------------------------------------------------------------- /iscroll: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to perform infinite scroll (crtl+C to stop) 6 | # 7 | # HOW TO USE 8 | # ~$ ./iscroll 9 | while true 10 | do 11 | adb shell input swipe 540 1800 540 -5000 12 | sleep 1 13 | done 14 | -------------------------------------------------------------------------------- /getwifi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to get WI-FI password from Android phone. 6 | # 7 | # Attention: Only works when android phone is rooted. 8 | # 9 | # HOW TO USE 10 | # ~$ ./getwifi 11 | adb shell cat /data/misc/wifi/wpa_supplicant.conf 12 | -------------------------------------------------------------------------------- /tomdate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to convert Unix time (milliseconds) to UTC time. 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./todate [milliseconds] 10 | # 11 | # Example : 12 | # ~$ ./todate 1476676336400 13 | todate $(($1/1000)) 14 | -------------------------------------------------------------------------------- /tohex: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to convert decimal number to hexadecimal 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./tohex [0-100] 10 | # 11 | # Example : 12 | # ~$ ./tohex 67 13 | NUM=$(($1*255+50)) 14 | echo 'ibase=10;obase=16;'$NUM/100'' | bc 15 | -------------------------------------------------------------------------------- /screenshot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to take Android phone screenshoot. 6 | # 7 | # HOW TO USE 8 | # ~$ ./screenshot 9 | adb shell screencap -p /sdcard/screen.png 10 | adb pull /sdcard/screen.png screen_`date +%Y_%m_%d_%H_%M_%S`.png 11 | adb shell rm /sdcard/screen.png 12 | 13 | -------------------------------------------------------------------------------- /hardcoded: -------------------------------------------------------------------------------- 1 | # Nome: Zhenlei Ji 2 | # Email: zhenlei.ji@gmail.com 3 | # 4 | # Easy way to check hardcoded strings. 5 | # 6 | # HOW TO USE 7 | # Commands: 8 | # ~$ ./hardcoded [PATH] 9 | # 10 | # Example : 11 | # ~$ ./hardcoded ~/git/HS-Apps-Android 12 | find $1 -type f -name '*.xml' -exec grep android:text=\"[^@] {} \; \ 13 | | cut -d '"' -f 2 \ 14 | | sort \ 15 | | uniq 16 | -------------------------------------------------------------------------------- /todate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to convert Unix time (seconds) to UTC time. 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./todate [seconds] 10 | # 11 | # Example : 12 | # ~$ ./todate 1476676336 13 | if [ "$(uname)" == "Darwin" ]; then 14 | date -r $1 +'%Y-%m-%d %H:%M:%S' 15 | else 16 | date --date="@$1" 17 | fi 18 | -------------------------------------------------------------------------------- /tojpg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to convert all png files to jpg in a folder 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./tojpg [folder_path] [optinal: output_folder_path] 10 | # 11 | # Example : 12 | # ~$ ./tojpg resources 13 | # ~$ ./tojpg resources resources_jpg 14 | if [ -z "$2" ] 15 | then 16 | OUT_PATH='out' 17 | else 18 | OUT_PATH=$2 19 | 20 | if [ ! -d "$OUT_PATH" ]; then 21 | mkdir $OUT_PATH 22 | fi 23 | 24 | for file in `ls $1` 25 | do 26 | convert $1$file $OUT_PATH/${file/.png/.jpg} 27 | done 28 | -------------------------------------------------------------------------------- /animate: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to set animation speed. 6 | # 0 - Animation disable 7 | # .5 - Animation 0.5x 8 | # 1 - Animation 1x 9 | # 1.5 - Animation 1.5x 10 | # 2 - Animation 2x 11 | # 5 - Animation 5x 12 | # 10 - Animation 10x 13 | # 14 | # HOW TO USE 15 | # Commands: 16 | # ~$ ./animate [speed] 17 | # 18 | # Example : 19 | # ~$ ./animate 0 20 | adb shell settings put global window_animation_scale $1 21 | adb shell settings put global transition_animation_scale $1 22 | adb shell settings put global animator_duration_scale $1 23 | 24 | -------------------------------------------------------------------------------- /getprop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to extract phone information 6 | # 7 | # HOW TO USE 8 | # ~$ ./getprop 9 | echo "Manufacturer: "`adb shell getprop ro.product.manufacturer` 10 | echo "Name: "`adb shell getprop ro.product.name` 11 | echo "Model: "`adb shell getprop ro.product.model` 12 | echo "Android Version: "`adb shell getprop ro.build.version.release` 13 | echo "Android SDK: "`adb shell getprop ro.build.version.sdk` 14 | echo 15 | echo "Date: "`adb shell getprop ro.build.date` 16 | echo "Timezone: "`adb shell getprop persist.sys.timezone` 17 | echo "Locale: "`adb shell getprop persist.sys.locale` 18 | -------------------------------------------------------------------------------- /unlock: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way unlock your Android phone. 6 | # Attention: You phone must allow install unknown source. 7 | # 8 | # HOW TO USE 9 | # ~$ ./unlock 10 | 11 | if [ $# -eq 0 ] 12 | then 13 | if [ -z `adb shell pm list package | grep io.appium.unlock` ] 14 | then 15 | adb install /opt/Programs/Script/unlock_apk-debug.apk 16 | fi 17 | adb shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n io.appium.unlock/.Unlock" 18 | elif [ $# -eq 1 ] 19 | then 20 | if [ "$1" == "-r" ] || [ "$1" == "r" ] 21 | then 22 | adb uninstall io.appium.unlock 23 | else 24 | echo "Invalid parameter $1. User -r or r" 25 | fi 26 | else 27 | echo "Illegal number of parameters" 28 | fi 29 | -------------------------------------------------------------------------------- /setlocalprop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to enable log on device with verbose priority. 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./setlocalprop [TAG] [TAG] [TAG].. 10 | # 11 | # Example : 12 | # ~$ ./setlocalprop ZenModeHelper ZenModePanel ZenModeController VolumeUI ManagedServices 13 | if [ "$#" -eq 0 ]; then 14 | echo "Forgot to add tags as parameter." 15 | else 16 | echo "Creating local.prop file..." 17 | LOCAL_PROP="local.prop" 18 | 19 | # Set root mode 20 | adb root 21 | 22 | # Delay to connect 23 | sleep 1 24 | 25 | # Waiting for connection 26 | while [ `adb devices | wc -l` -ne 3 ]; do 27 | sleep 1 28 | done 29 | 30 | if [ -f $LOCAL_PROP ]; then 31 | rm $LOCAL_PROP 32 | fi 33 | 34 | for tag in "$@"; do 35 | echo log.tag.$tag=VERBOSE >> $LOCAL_PROP 36 | done 37 | 38 | echo "Adding local.prop file into device..." 39 | adb push $LOCAL_PROP /data/$LOCAL_PROP 40 | adb shell chmod 644 /data/$LOCAL_PROP 41 | adb shell chown root.root /data/$LOCAL_PROP 42 | adb reboot 43 | echo "Reboot device..." 44 | rm $LOCAL_PROP 45 | fi 46 | -------------------------------------------------------------------------------- /systemuilog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to enable log on systemui without reboot. 6 | 7 | # HOW TO USE 8 | # TAG - tag name, e.g. ZenModePanel, usually it is class name. 9 | # priority - the priority of log, could be (default: V): 10 | # v - Verbose (lowest priority) 11 | # d - Debug 12 | # i - Info 13 | # w - Warning 14 | # e - Error 15 | # f - Fatal 16 | # s - Silent (highest priority, on which nothing is ever printed) 17 | # Commands: 18 | # ~$ ./systemuilog [TAG] [priority] 19 | # 20 | # Example 1: 21 | # ~$ ./systemuilog ZenModePanel 22 | # 23 | # Example 2: 24 | # ~$ ./systemuilog ZenModePanel w 25 | 26 | # Handle input arguments 27 | if [ -z "$1" ]; then 28 | echo "ERROR: No argument supplied" 29 | else 30 | # Set priority 31 | PRIORITY="VERBOSE" 32 | if [ -n "$2" ]; then 33 | if [ "$2" == "d" -o "$2" == "D" ]; then 34 | PRIORITY="DEBUG" 35 | elif [ "$2" == "i" -o "$2" == "I" ]; then 36 | PRIORITY="INFO" 37 | elif [ "$2" == "w" -o "$2" == "W" ]; then 38 | PRIORITY="WARNING" 39 | elif [ "$2" == "e" -o "$2" == "E" ]; then 40 | PRIORITY="FATAL" 41 | elif [ "$2" == "f" -o "$2" == "F" ]; then 42 | PRIORITY="SILENT" 43 | fi 44 | fi 45 | fi 46 | 47 | echo "Enabling $1 log with $PRIORITY priority ." 48 | # Set root mode 49 | adb root 50 | 51 | # Delay to connect 52 | sleep 1 53 | 54 | # Waiting for connection 55 | while [ `adb devices | wc -l` -ne 3 ]; do 56 | sleep 1 57 | done 58 | 59 | # Get pid of systemui process 60 | PID=`adb shell ps | grep systemui | tr -s [:space:] ' ' | cut -d' ' -f2` 61 | 62 | # Kill the process, so systemui process will restart 63 | adb shell kill -9 $PID 64 | 65 | adb shell setprop log.tag.$1 $PRIORITY 66 | echo "Done." 67 | -------------------------------------------------------------------------------- /monkey: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to run monkey test. 6 | # 7 | # HOW TO USE 8 | # Commands: 9 | # ~$ ./monkey [PACKAGE] [optional: NUMBER_OF_EVENTS (default: 720000)] [optional: ROUND (default: 1)] [optional: SEED] 10 | # 11 | # Example : 12 | # ~$ ./monkey com.itspen.app 13 | # ~$ ./monkey com.itspen.app 5000000 3 345 14 | 15 | MONKEY_LOG=monkey.txt 16 | LOGCAT_LOG=logcat.txt 17 | ROUND=1 18 | 19 | if [ $# -eq 0 ] 20 | then 21 | echo "No arguments supplied! How to use:" 22 | echo "./monkey [PACKAGE] [optional: NUMBER_OF_EVENTS (default: 720000)] [optional: ROUND (default: 1)] [optional: SEED]" 23 | exit 1 24 | fi 25 | 26 | if [ -z "$2" ] 27 | then 28 | NUMBER_OF_EVENTS=720000 29 | else 30 | NUMBER_OF_EVENTS=$2 31 | fi 32 | 33 | if [ "$3" ] && [ $3 -gt 1 ] 34 | then 35 | ROUND=$3 36 | fi 37 | 38 | for i in `seq 1 $ROUND`; 39 | do 40 | echo Teste $i 41 | echo Monkey is running... 42 | 43 | if [ "$1" ] 44 | then 45 | if [ "$4" ] 46 | then 47 | SEED=$4 48 | else 49 | SEED=$RANDOM 50 | fi 51 | OUTPUT_PATH=$(date +"%Y_%m_%d_%H_%M_%S_$SEED/") 52 | mkdir $OUTPUT_PATH 53 | 54 | echo "Manufacturer: "`adb shell getprop ro.product.manufacturer` > $OUTPUT_PATH$MONKEY_LOG 55 | echo "Name: "`adb shell getprop ro.product.name` >> $OUTPUT_PATH$MONKEY_LOG 56 | echo "Model: "`adb shell getprop ro.product.model` >> $OUTPUT_PATH$MONKEY_LOG 57 | echo "Android Version: "`adb shell getprop ro.build.version.release` >> $OUTPUT_PATH$MONKEY_LOG 58 | echo "Android SDK: "`adb shell getprop ro.build.version.sdk` >> $OUTPUT_PATH$MONKEY_LOG 59 | echo "" >> $OUTPUT_PATH$MONKEY_LOG 60 | echo "Date: "`adb shell getprop ro.build.date` >> $OUTPUT_PATH$MONKEY_LOG 61 | echo "Timezone: "`adb shell getprop persist.sys.timezone` >> $OUTPUT_PATH$MONKEY_LOG 62 | echo "Locale: "`adb shell getprop persist.sys.locale` >> $OUTPUT_PATH$MONKEY_LOG 63 | echo "" >> $OUTPUT_PATH$MONKEY_LOG 64 | echo "-----------------------------------------------" >> $OUTPUT_PATH$MONKEY_LOG 65 | echo "" >> $OUTPUT_PATH$MONKEY_LOG 66 | 67 | adb shell monkey -p $1 --hprof --pct-touch 30 --pct-motion 30 --pct-trackball 0 --pct-nav 0 --pct-majornav 20 --pct-appswitch 10 --pct-anyevent 10 --pct-syskeys 0 -s $SEED -v --throttle 300 $NUMBER_OF_EVENTS >> $OUTPUT_PATH$MONKEY_LOG 68 | adb logcat -d > $OUTPUT_PATH$LOGCAT_LOG 69 | fi 70 | 71 | echo Monkey finished: $(date +"%d.%m.%Y %T") >> $OUTPUT_PATH$MONKEY_LOG 72 | echo Monkey finished... 73 | echo 74 | done 75 | -------------------------------------------------------------------------------- /getimgs/genimgs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Easy way to generate images to all resolutions. 6 | # 7 | # Pre condition: 8 | # The script uses images from 3 folders: 9 | # * resources - contains all xxhdpi resources 10 | # * actionbar - contains all xxhdpi resources releated to action bar 11 | # * actionbar_land - contains all xxhdpi landscape resources related to action bar 12 | # 13 | # HOW TO USE 14 | # Move the script to folder that contains 3 folders mentioned before and run: 15 | # ~$ ./genimgs 16 | # 17 | # And voilà, the script will generate images to all resolutions. So, you just 18 | # need move all folder from out to your Android project. 19 | 20 | # For macs 21 | cd "$(dirname "$0")" 22 | 23 | # Folders 24 | OUT_PATH='out' 25 | IN_PATH='resources' 26 | AB_FOLDER='actionbar' 27 | AB_LAND_FOLDER='actionbar_land' 28 | 29 | # Android Folders 30 | LDPI_FOLDER='drawable-ldpi' 31 | MDPI_FOLDER='drawable-mdpi' 32 | HDPI_FOLDER='drawable-hdpi' 33 | XHDPI_FOLDER='drawable-xhdpi' 34 | XXHDPI_FOLDER='drawable-xxhdpi' 35 | LAND_SUFIX='-land' 36 | 37 | # Check portrait folders 38 | if [ ! -d "$OUT_PATH/$LDPI_FOLDER" ]; then 39 | mkdir -p $OUT_PATH/$LDPI_FOLDER 40 | fi 41 | 42 | if [ ! -d "$OUT_PATH/$MDPI_FOLDER" ]; then 43 | mkdir -p $OUT_PATH/$MDPI_FOLDER 44 | fi 45 | 46 | if [ ! -d "$OUT_PATH/$HDPI_FOLDER" ]; then 47 | mkdir -p $OUT_PATH/$HDPI_FOLDER 48 | fi 49 | 50 | if [ ! -d "$OUT_PATH/$XHDPI_FOLDER" ]; then 51 | mkdir -p $OUT_PATH/$XHDPI_FOLDER 52 | fi 53 | 54 | if [ ! -d "$OUT_PATH/$XXHDPI_FOLDER" ]; then 55 | mkdir -p $OUT_PATH/$XXHDPI_FOLDER 56 | fi 57 | 58 | # Check landscape folders 59 | if [ ! -d "$OUT_PATH/$LDPI_FOLDER$LAND_SUFIX" ]; then 60 | mkdir -p $OUT_PATH/$LDPI_FOLDER$LAND_SUFIX 61 | fi 62 | 63 | if [ ! -d "$OUT_PATH/$MDPI_FOLDER$LAND_SUFIX" ]; then 64 | mkdir -p $OUT_PATH/$MDPI_FOLDER$LAND_SUFIX 65 | fi 66 | 67 | if [ ! -d "$OUT_PATH/$HDPI_FOLDER$LAND_SUFIX" ]; then 68 | mkdir -p $OUT_PATH/$HDPI_FOLDER$LAND_SUFIX 69 | fi 70 | 71 | if [ ! -d "$OUT_PATH/$XHDPI_FOLDER$LAND_SUFIX" ]; then 72 | mkdir -p $OUT_PATH/$XHDPI_FOLDER$LAND_SUFIX 73 | fi 74 | 75 | if [ ! -d "$OUT_PATH/$XXHDPI_FOLDER$LAND_SUFIX" ]; then 76 | mkdir -p $OUT_PATH/$XXHDPI_FOLDER$LAND_SUFIX 77 | fi 78 | 79 | # Resources 80 | echo "Starting convert..." 81 | if [ -d "$IN_PATH" ]; then 82 | for i in `ls $IN_PATH` 83 | do 84 | convert -resize 25% $IN_PATH/$i $OUT_PATH/$LDPI_FOLDER/$i 85 | convert -resize 33% $IN_PATH/$i $OUT_PATH/$MDPI_FOLDER/$i 86 | convert -resize 50% $IN_PATH/$i $OUT_PATH/$HDPI_FOLDER/$i 87 | convert -resize 66% $IN_PATH/$i $OUT_PATH/$XHDPI_FOLDER/$i 88 | cp $IN_PATH/$i $OUT_PATH/$XXHDPI_FOLDER/$i 89 | done 90 | fi 91 | 92 | # Actionbar Portrait 93 | if [ -d "$AB_FOLDER" ]; then 94 | for i in `ls $AB_FOLDER` 95 | do 96 | # Portrait 97 | convert -resize 25% $AB_FOLDER/$i $OUT_PATH/$LDPI_FOLDER/$i 98 | convert -resize 33% $AB_FOLDER/$i $OUT_PATH/$MDPI_FOLDER/$i 99 | convert -resize 50% $AB_FOLDER/$i $OUT_PATH/$HDPI_FOLDER/$i 100 | convert -resize 66% $AB_FOLDER/$i $OUT_PATH/$XHDPI_FOLDER/$i 101 | cp $AB_FOLDER/$i $OUT_PATH/$XXHDPI_FOLDER/$i 102 | 103 | # Landscape 104 | convert -resize 17% $AB_FOLDER/$i $OUT_PATH/$LDPI_FOLDER$LAND_SUFIX/$i 105 | convert -resize 22% $AB_FOLDER/$i $OUT_PATH/$MDPI_FOLDER$LAND_SUFIX/$i 106 | convert -resize 33% $AB_FOLDER/$i $OUT_PATH/$HDPI_FOLDER$LAND_SUFIX/$i 107 | convert -resize 44% $AB_FOLDER/$i $OUT_PATH/$XHDPI_FOLDER$LAND_SUFIX/$i 108 | convert -resize 66% $AB_FOLDER/$i $OUT_PATH/$XXHDPI_FOLDER$LAND_SUFIX/$i 109 | done 110 | fi 111 | 112 | # Actionbar Landscape 113 | if [ -d "$AB_LAND_FOLDER" ]; then 114 | for i in `ls $AB_LAND_FOLDER` 115 | do 116 | # Portrait 117 | convert -resize 38% $AB_LAND_FOLDER/$i $OUT_PATH/$LDPI_FOLDER/$i 118 | convert -resize 50% $AB_LAND_FOLDER/$i $OUT_PATH/$MDPI_FOLDER/$i 119 | convert -resize 75% $AB_LAND_FOLDER/$i $OUT_PATH/$HDPI_FOLDER/$i 120 | cp $AB_LAND_FOLDER/$i $OUT_PATH/$XHDPI_FOLDER/$i 121 | convert -resize 150% $AB_LAND_FOLDER/$i $OUT_PATH/$XXHDPI_FOLDER/$i 122 | 123 | # Landscape 124 | convert -resize 25% $AB_LAND_FOLDER/$i $OUT_PATH/$LDPI_FOLDER$LAND_SUFIX/$i 125 | convert -resize 33% $AB_LAND_FOLDER/$i $OUT_PATH/$MDPI_FOLDER$LAND_SUFIX/$i 126 | convert -resize 50% $AB_LAND_FOLDER/$i $OUT_PATH/$HDPI_FOLDER$LAND_SUFIX/$i 127 | convert -resize 66% $AB_LAND_FOLDER/$i $OUT_PATH/$XHDPI_FOLDER$LAND_SUFIX/$i 128 | cp $AB_LAND_FOLDER/$i $OUT_PATH/$XXHDPI_FOLDER$LAND_SUFIX/$i 129 | done 130 | fi 131 | echo "Finished!" 132 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidScripts 2 | Some useful scripts for Android. 3 | # Usage 4 | Find below some details how to use the scripts. 5 | ## Utils 6 | Useful scripts for application developer (software). 7 | ### 1. genimgs 8 | Easy way to generate images to all resolutions. 9 | 10 | **Pre condition:** 11 | 12 | 1. You must have ImageMagick installed in your computer. More details about ImageMagick [here](http://www.imagemagick.org/script/index.php). 13 | 2. The script uses images from 3 folders: 14 | * resources - contains all xxhdpi resources 15 | * actionbar - contains all xxhdpi resources releated to action bar 16 | * actionbar_land - contains all xxhdpi landscape resources related to action bar 17 | 18 | **HOW TO USE** 19 | 20 | Move the script to folder that contains 3 folders mentioned before and run: 21 | ``` 22 | ~$ ./genimgs 23 | ``` 24 | And voilà, the script will generate images to all resolutions. So, you just need move all folder from out to your Android project. 25 | ### 2. getwifi 26 | Easy way to get WI-FI password from Android phone. 27 | 28 | **Attention:** Only works when android phone is rooted. 29 | 30 | **HOW TO USE** 31 | ``` 32 | ~$ ./getwifi 33 | ``` 34 | ### 3. monkey 35 | Easy way to run monkey test. If you are interested to know more about monkey test, please see this [link](https://developer.android.com/studio/test/monkey.html). 36 | 37 | **HOW TO USE** 38 | 39 | Commands: 40 | ``` 41 | ~$ ./monkey [PACKAGE] [optional: NUMBER_OF_EVENTS (default: 720000)] [optional: ROUND (default: 1)] [optional: SEED] 42 | ``` 43 | Example : 44 | ``` 45 | ~$ ./monkey com.itspen.app 46 | ~$ ./monkey com.itspen.app 5000000 3 345 47 | ``` 48 | ### 4. screenshoot 49 | Easy way to take Android phone screenshoot and grab in your computer. 50 | 51 | **HOW TO USE** 52 | ``` 53 | ~$ ./screenshot 54 | ``` 55 | ### 5. todate 56 | Easy way to convert Unix time (seconds) to UTC time. 57 | 58 | **HOW TO USE** 59 | 60 | Commands: 61 | ``` 62 | ~$ ./todate [seconds] 63 | ``` 64 | Example: 65 | ``` 66 | ~$ ./todate 1476676336 67 | ``` 68 | ### 6. tomdate 69 | Easy way to convert Unix time (milliseconds) to UTC time. 70 | 71 | **HOW TO USE** 72 | 73 | Commands: 74 | ``` 75 | ~$ ./todate [milliseconds] 76 | ``` 77 | Example: 78 | ``` 79 | ~$ ./todate 1476676336400 80 | ``` 81 | ### 7. tohex 82 | Easy way to convert decimal number to hexadecimal. I usually use to convert alpha to hex. 83 | 84 | **HOW TO USE** 85 | 86 | Commands: 87 | ``` 88 | ~$ ./tohex [0-100] 89 | ``` 90 | Example : 91 | ``` 92 | ~$ ./tohex 67 93 | ``` 94 | ### 8. tojpg 95 | Easy way to convert all png files to jpg in a folder 96 | 97 | **HOW TO USE** 98 | 99 | Commands: 100 | ``` 101 | ~$ ./tojpg [folder_path] [optinal: output_folder_path] 102 | ``` 103 | 104 | Example : 105 | ``` 106 | ~$ ./tojpg resources 107 | ~$ ./tojpg resources resources_jpg 108 | ``` 109 | ### 9. unlock 110 | Easy way unlock your Android phone. 111 | 112 | **Attention:** You phone must allow install unknown source. 113 | 114 | **HOW TO USE** 115 | 116 | ``` 117 | ~$ ./unlock 118 | ``` 119 | ### 10. getprop 120 | Easy way to extract phone information. 121 | 122 | **HOW TO USE** 123 | 124 | Commands: 125 | ``` 126 | ~$ ./getprop 127 | ``` 128 | 129 | Example: 130 | ![](https://image.ibb.co/djDzp8/Screen_Shot_2018_07_09_at_14_47_07.png) 131 | 132 | ### 11. hardcoded 133 | Easy way to check hardcoded strings. 134 | 135 | **HOW TO USE** 136 | 137 | ``` 138 | ~$ ./hardcoded 139 | ``` 140 | 141 | ### 12. iscroll 142 | Easy way to perform infinite scroll (**crtl+C** to stop) 143 | 144 | **HOW TO USE** 145 | 146 | ``` 147 | ~$ ./iscroll 148 | ``` 149 | 150 | ### 13. animate 151 | Easy way to set animation speed. 152 | 153 | The speed can be: 154 | - 0 - Animation disable 155 | - .5 - Animation 0.5x 156 | - 1 - Animation 1x 157 | - 1.5 - Animation 1.5x 158 | - 2 - Animation 2x 159 | - 5 - Animation 5x 160 | - 10 - Animation 10x 161 | 162 | **HOW TO USE** 163 | 164 | Commands: 165 | ``` 166 | ~$ ./animate [speed] 167 | ``` 168 | Example : 169 | ``` 170 | ~$ ./animate 0 171 | ``` 172 | 173 | ## Framework 174 | Useful scripts for framework developer (middleware). 175 | ### 1. setlocalprop 176 | Easy way to enable log on device with verbose priority. If you are interested to know more about monkey test, please see this [link](http://stackoverflow.com/questions/4126815/android-logging-levels). 177 | 178 | **HOW TO USE** 179 | 180 | Commands: 181 | ``` 182 | ~$ ./setlocalprop [TAG] [TAG] [TAG].. 183 | ``` 184 | Example : 185 | ``` 186 | ~$ ./setlocalprop ZenModeHelper ZenModePanel ZenModeController VolumeUI ManagedServices 187 | ``` 188 | ### 2. systemuilog 189 | Easy way to enable log on systemui without reboot. 190 | 191 | **HOW TO USE** 192 | 193 | TAG - tag name, e.g. ZenModePanel, usually it is class name. 194 | priority - the priority of log, could be (default: V): 195 | * v - Verbose (lowest priority) 196 | * d - Debug 197 | * i - Info 198 | * w - Warning 199 | * e - Error 200 | * f - Fatal 201 | * s - Silent (highest priority, on which nothing is ever printed) 202 | Commands: 203 | ``` 204 | ~$ ./systemuilog [TAG] [priority] 205 | ``` 206 | Example 1: 207 | ``` 208 | ~$ ./systemuilog ZenModePanel 209 | ``` 210 | Example 2: 211 | ``` 212 | ~$ ./systemuilog ZenModePanel w 213 | ``` 214 | ### 3. sysui 215 | Translate sysui log codes into strings. Following the filters: 216 | * sysui_view_visibility 217 | * sysui_action 218 | * sysui_count 219 | * sysui_histogram 220 | 221 | **HOW TO USE** 222 | 223 | Return all filters: 224 | ``` 225 | ~$ ./sysui [aplogcat-events.txt path] 226 | ~$ adb logcat -b events | ./sysui 227 | ``` 228 | Return a specific filter: 229 | ``` 230 | ~$ ./sysui [aplogcat-events.txt path] | grep sysui_view_visibility Filtered by sysui_view_visibility 231 | ~$ ./sysui [aplogcat-events.txt path] | grep sysui_action Filtered by sysui_action 232 | ~$ ./sysui [aplogcat-events.txt path] | grep sysui_count Filtered by sysui_count 233 | ~$ ./sysui [aplogcat-events.txt path] | grep sysui_histogram Filtered by sysui_histogram 234 | ``` 235 | # Setup 236 | Download the scripts and add bash script folder to path. Please see below the steps: 237 | 238 | 1. Open .bashrc file, for example: 239 | 240 | ``` 241 | zhenlei@zenbook:~$ nano .bashrc 242 | ``` 243 | 2. Add bash script folder to path: 244 | 245 | ``` 246 | export PATH=$PATH:/home/zhenlei/git/AndroidScripts 247 | ``` 248 | 249 | And voilà! All script in AndroidScripts folder will be recognized by command line. 250 | 251 | **ATTENTION** 252 | 253 | Bear in mind that genimgs script must be moved to specific folder that contains 3 folders mentioned (resources, actionbar, actionbar_land) before to run. The reason to do that is, the script was used for UI/UX team that does not know using script well, and by that just click in the script to run. 254 | # License 255 | Copyright 2016 Zhenlei Ji 256 | 257 | Licensed under the Apache License, Version 2.0 (the "License"); 258 | you may not use this file except in compliance with the License. 259 | You may obtain a copy of the License at 260 | 261 | http://www.apache.org/licenses/LICENSE-2.0 262 | 263 | Unless required by applicable law or agreed to in writing, software 264 | distributed under the License is distributed on an "AS IS" BASIS, 265 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 266 | See the License for the specific language governing permissions and 267 | limitations under the License. 268 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /sysui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Nome: Zhenlei Ji 3 | # Email: zhenlei.ji@gmail.com 4 | # 5 | # Translate sysui log codes into strings. Following the filters: 6 | # - sysui_view_visibility 7 | # - sysui_action 8 | # - sysui_count 9 | # - sysui_histogram 10 | # 11 | # HOW TO USE 12 | # Return all filters: 13 | # ~$ ./sysui [aplogcat-events.txt path] 14 | # ~$ adb logcat -b events | ./sysui 15 | # 16 | # Return a specific filter: 17 | # ~$ ./sysui [aplogcat-events.txt path] | grep sysui_view_visibility # Filtered by sysui_view_visibility 18 | # ~$ ./sysui [aplogcat-events.txt path] | grep sysui_action # Filtered by sysui_action 19 | # ~$ ./sysui [aplogcat-events.txt path] | grep sysui_count # Filtered by sysui_count 20 | # ~$ ./sysui [aplogcat-events.txt path] | grep sysui_histogram # Filtered by sysui_histogram 21 | 22 | function translate { 23 | TAG_VIEW_VISIBILITY='sysui_view_visibility' 24 | TAG_ACTION='sysui_action' 25 | TAG_COUNT='sysui_count' 26 | TAG_HISTOGRAM='sysui_histogram' 27 | 28 | WHITE_LIST=($TAG_VIEW_VISIBILITY $TAG_ACTION $TAG_COUNT $TAG_HISTOGRAM) 29 | FILTER="$(printf '%s\n' "${WHITE_LIST[@]}" | paste -sd '|')" 30 | 31 | while read line; do 32 | if [[ $line =~ $FILTER ]] 33 | then 34 | # Tags 35 | line=${line/[0,/[VIEW_UNKNOWN,} 36 | line=${line/[1,/[MAIN_SETTINGS,} 37 | line=${line/[2,/[ACCESSIBILITY,} 38 | line=${line/[3,/[ACCESSIBILITY_CAPTION_PROPERTIES,} 39 | line=${line/[4,/[ACCESSIBILITY_SERVICE,} 40 | line=${line/[5,/[ACCESSIBILITY_TOGGLE_DALTONIZER,} 41 | line=${line/[6,/[ACCESSIBILITY_TOGGLE_GLOBAL_GESTURE,} 42 | line=${line/[7,/[ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFICATION,} 43 | line=${line/[8,/[ACCOUNT,} 44 | line=${line/[9,/[ACCOUNTS_ACCOUNT_SYNC,} 45 | line=${line/[10,/[ACCOUNTS_CHOOSE_ACCOUNT_ACTIVITY,} 46 | line=${line/[11,/[ACCOUNTS_MANAGE_ACCOUNTS,} 47 | line=${line/[12,/[APN,} 48 | line=${line/[13,/[APN_EDITOR,} 49 | line=${line/[14,/[APP_OPS_DETAILS,} 50 | line=${line/[15,/[APP_OPS_SUMMARY,} 51 | line=${line/[16,/[APPLICATION,} 52 | line=${line/[17,/[APPLICATIONS_APP_LAUNCH,} 53 | line=${line/[18,/[APPLICATIONS_APP_PERMISSION,} 54 | line=${line/[19,/[APPLICATIONS_APP_STORAGE,} 55 | line=${line/[20,/[APPLICATIONS_INSTALLED_APP_DETAILS,} 56 | line=${line/[21,/[APPLICATIONS_PROCESS_STATS_DETAIL,} 57 | line=${line/[22,/[APPLICATIONS_PROCESS_STATS_MEM_DETAIL,} 58 | line=${line/[23,/[APPLICATIONS_PROCESS_STATS_UI,} 59 | line=${line/[24,/[BLUETOOTH,} 60 | line=${line/[25,/[BLUETOOTH_DEVICE_PICKER,} 61 | line=${line/[26,/[BLUETOOTH_DEVICE_PROFILES,} 62 | line=${line/[27,/[CHOOSE_LOCK_GENERIC,} 63 | line=${line/[28,/[CHOOSE_LOCK_PASSWORD,} 64 | line=${line/[29,/[CHOOSE_LOCK_PATTERN,} 65 | line=${line/[30,/[CONFIRM_LOCK_PASSWORD,} 66 | line=${line/[31,/[CONFIRM_LOCK_PATTERN,} 67 | line=${line/[32,/[CRYPT_KEEPER,} 68 | line=${line/[33,/[CRYPT_KEEPER_CONFIRM,} 69 | line=${line/[34,/[DASHBOARD_SEARCH_RESULTS,} 70 | line=${line/[35,/[DASHBOARD_SUMMARY,} 71 | line=${line/[36,/[DATA_USAGE,} 72 | line=${line/[37,/[DATA_USAGE_SUMMARY,} 73 | line=${line/[38,/[DATE_TIME,} 74 | line=${line/[39,/[DEVELOPMENT,} 75 | line=${line/[40,/[DEVICEINFO,} 76 | line=${line/[41,/[DEVICEINFO_IMEI_INFORMATION,} 77 | line=${line/[42,/[DEVICEINFO_MEMORY,} 78 | line=${line/[43,/[DEVICEINFO_SIM_STATUS,} 79 | line=${line/[44,/[DEVICEINFO_STATUS,} 80 | line=${line/[45,/[DEVICEINFO_USB,} 81 | line=${line/[46,/[DISPLAY,} 82 | line=${line/[47,/[DREAM,} 83 | line=${line/[48,/[ENCRYPTION,} 84 | line=${line/[49,/[FINGERPRINT,} 85 | line=${line/[50,/[FINGERPRINT_ENROLL,} 86 | line=${line/[51,/[FUELGAUGE_BATTERY_HISTORY_DETAIL,} 87 | line=${line/[52,/[FUELGAUGE_BATTERY_SAVER,} 88 | line=${line/[53,/[FUELGAUGE_POWER_USAGE_DETAIL,} 89 | line=${line/[54,/[FUELGAUGE_POWER_USAGE_SUMMARY,} 90 | line=${line/[55,/[HOME,} 91 | line=${line/[56,/[ICC_LOCK,} 92 | line=${line/[57,/[INPUTMETHOD_LANGUAGE,} 93 | line=${line/[58,/[INPUTMETHOD_KEYBOARD,} 94 | line=${line/[59,/[INPUTMETHOD_SPELL_CHECKERS,} 95 | line=${line/[60,/[INPUTMETHOD_SUBTYPE_ENABLER,} 96 | line=${line/[61,/[INPUTMETHOD_USER_DICTIONARY,} 97 | line=${line/[62,/[INPUTMETHOD_USER_DICTIONARY_ADD_WORD,} 98 | line=${line/[63,/[LOCATION,} 99 | line=${line/[64,/[LOCATION_MODE,} 100 | line=${line/[65,/[MANAGE_APPLICATIONS,} 101 | line=${line/[66,/[MASTER_CLEAR,} 102 | line=${line/[67,/[MASTER_CLEAR_CONFIRM,} 103 | line=${line/[68,/[NET_DATA_USAGE_METERED,} 104 | line=${line/[69,/[NFC_BEAM,} 105 | line=${line/[70,/[NFC_PAYMENT,} 106 | line=${line/[71,/[NOTIFICATION,} 107 | line=${line/[72,/[NOTIFICATION_APP_NOTIFICATION,} 108 | line=${line/[73,/[NOTIFICATION_OTHER_SOUND,} 109 | line=${line/[74,/[NOTIFICATION_REDACTION,} 110 | line=${line/[75,/[NOTIFICATION_STATION,} 111 | line=${line/[76,/[NOTIFICATION_ZEN_MODE,} 112 | line=${line/[77,/[OWNER_INFO,} 113 | line=${line/[78,/[PRINT_JOB_SETTINGS,} 114 | line=${line/[79,/[PRINT_SERVICE_SETTINGS,} 115 | line=${line/[80,/[PRINT_SETTINGS,} 116 | line=${line/[81,/[PRIVACY,} 117 | line=${line/[82,/[PROXY_SELECTOR,} 118 | line=${line/[83,/[RESET_NETWORK,} 119 | line=${line/[84,/[RESET_NETWORK_CONFIRM,} 120 | line=${line/[85,/[RUNNING_SERVICE_DETAILS,} 121 | line=${line/[86,/[SCREEN_PINNING,} 122 | line=${line/[87,/[SECURITY,} 123 | line=${line/[88,/[SIM,} 124 | line=${line/[89,/[TESTING,} 125 | line=${line/[90,/[TETHER,} 126 | line=${line/[91,/[TRUST_AGENT,} 127 | line=${line/[92,/[TRUSTED_CREDENTIALS,} 128 | line=${line/[93,/[TTS_ENGINE_SETTINGS,} 129 | line=${line/[94,/[TTS_TEXT_TO_SPEECH,} 130 | line=${line/[95,/[USAGE_ACCESS,} 131 | line=${line/[96,/[USER,} 132 | line=${line/[97,/[USERS_APP_RESTRICTIONS,} 133 | line=${line/[98,/[USER_DETAILS,} 134 | line=${line/[99,/[VOICE_INPUT,} 135 | line=${line/[100,/[VPN,} 136 | line=${line/[101,/[WALLPAPER_TYPE,} 137 | line=${line/[102,/[WFD_WIFI_DISPLAY,} 138 | line=${line/[103,/[WIFI,} 139 | line=${line/[104,/[WIFI_ADVANCED,} 140 | line=${line/[105,/[WIFI_CALLING,} 141 | line=${line/[106,/[WIFI_SAVED_ACCESS_POINTS,} 142 | line=${line/[107,/[WIFI_APITEST,} 143 | line=${line/[108,/[WIFI_INFO,} 144 | line=${line/[109,/[WIFI_P2P,} 145 | line=${line/[110,/[WIRELESS,} 146 | line=${line/[111,/[QS_PANEL,} 147 | line=${line/[112,/[QS_AIRPLANEMODE,} 148 | line=${line/[113,/[QS_BLUETOOTH,} 149 | line=${line/[114,/[QS_CAST,} 150 | line=${line/[115,/[QS_CELLULAR,} 151 | line=${line/[116,/[QS_COLORINVERSION,} 152 | line=${line/[117,/[QS_DATAUSAGEDETAIL,} 153 | line=${line/[118,/[QS_DND,} 154 | line=${line/[119,/[QS_FLASHLIGHT,} 155 | line=${line/[120,/[QS_HOTSPOT,} 156 | line=${line/[121,/[QS_INTENT,} 157 | line=${line/[122,/[QS_LOCATION,} 158 | line=${line/[123,/[QS_ROTATIONLOCK,} 159 | line=${line/[124,/[QS_USERDETAILITE,} 160 | line=${line/[125,/[QS_USERDETAIL,} 161 | line=${line/[126,/[QS_WIFI,} 162 | line=${line/[127,/[NOTIFICATION_PANEL,} 163 | line=${line/[128,/[NOTIFICATION_ITEM,} 164 | line=${line/[129,/[NOTIFICATION_ITEM_ACTION,} 165 | line=${line/[130,/[APPLICATIONS_ADVANCED,} 166 | line=${line/[131,/[LOCATION_SCANNING,} 167 | line=${line/[132,/[MANAGE_APPLICATIONS_ALL,} 168 | line=${line/[133,/[MANAGE_APPLICATIONS_NOTIFICATIONS,} 169 | line=${line/[134,/[ACTION_WIFI_ADD_NETWORK,} 170 | line=${line/[135,/[ACTION_WIFI_CONNECT,} 171 | line=${line/[136,/[ACTION_WIFI_FORCE_SCAN,} 172 | line=${line/[137,/[ACTION_WIFI_FORGET,} 173 | line=${line/[138,/[ACTION_WIFI_OFF,} 174 | line=${line/[139,/[ACTION_WIFI_ON,} 175 | line=${line/[140,/[MANAGE_PERMISSIONS,} 176 | line=${line/[141,/[NOTIFICATION_ZEN_MODE_PRIORITY,} 177 | line=${line/[142,/[NOTIFICATION_ZEN_MODE_AUTOMATION,} 178 | line=${line/[143,/[MANAGE_DOMAIN_URLS,} 179 | line=${line/[144,/[NOTIFICATION_ZEN_MODE_SCHEDULE_RULE,} 180 | line=${line/[145,/[NOTIFICATION_ZEN_MODE_EXTERNAL_RULE,} 181 | line=${line/[146,/[NOTIFICATION_ZEN_MODE_EVENT_RULE,} 182 | line=${line/[147,/[ACTION_BAN_APP_NOTES,} 183 | line=${line/[148,/[ACTION_DISMISS_ALL_NOTES,} 184 | line=${line/[149,/[QS_DND_DETAILS,} 185 | line=${line/[150,/[QS_BLUETOOTH_DETAILS,} 186 | line=${line/[151,/[QS_CAST_DETAILS,} 187 | line=${line/[152,/[QS_WIFI_DETAILS,} 188 | line=${line/[153,/[QS_WIFI_TOGGLE,} 189 | line=${line/[154,/[QS_BLUETOOTH_TOGGLE,} 190 | line=${line/[155,/[QS_CELLULAR_TOGGLE,} 191 | line=${line/[156,/[QS_SWITCH_USER,} 192 | line=${line/[157,/[QS_CAST_SELECT,} 193 | line=${line/[158,/[QS_CAST_DISCONNECT,} 194 | line=${line/[159,/[ACTION_BLUETOOTH_TOGGLE,} 195 | line=${line/[160,/[ACTION_BLUETOOTH_SCAN,} 196 | line=${line/[161,/[ACTION_BLUETOOTH_RENAME,} 197 | line=${line/[162,/[ACTION_BLUETOOTH_FILES,} 198 | line=${line/[163,/[QS_DND_TIME,} 199 | line=${line/[164,/[QS_DND_CONDITION_SELECT,} 200 | line=${line/[165,/[QS_DND_ZEN_SELECT,} 201 | line=${line/[166,/[QS_DND_TOGGLE,} 202 | line=${line/[167,/[ACTION_ZEN_ALLOW_REMINDERS,} 203 | line=${line/[168,/[ACTION_ZEN_ALLOW_EVENTS,} 204 | line=${line/[169,/[ACTION_ZEN_ALLOW_MESSAGES,} 205 | line=${line/[170,/[ACTION_ZEN_ALLOW_CALLS,} 206 | line=${line/[171,/[ACTION_ZEN_ALLOW_REPEAT_CALLS,} 207 | line=${line/[172,/[ACTION_ZEN_ADD_RULE,} 208 | line=${line/[173,/[ACTION_ZEN_ADD_RULE_OK,} 209 | line=${line/[174,/[ACTION_ZEN_DELETE_RULE,} 210 | line=${line/[175,/[ACTION_ZEN_DELETE_RULE_OK,} 211 | line=${line/[176,/[ACTION_ZEN_ENABLE_RULE,} 212 | line=${line/[177,/[ACTION_AIRPLANE_TOGGLE,} 213 | line=${line/[178,/[ACTION_CELL_DATA_TOGGLE,} 214 | line=${line/[179,/[NOTIFICATION_ACCESS,} 215 | line=${line/[180,/[NOTIFICATION_ZEN_MODE_ACCESS,} 216 | line=${line/[181,/[APPLICATIONS_DEFAULT_APPS,} 217 | line=${line/[182,/[APPLICATIONS_STORAGE_APPS,} 218 | line=${line/[183,/[APPLICATIONS_USAGE_ACCESS_DETAIL,} 219 | line=${line/[184,/[APPLICATIONS_HIGH_POWER_APPS,} 220 | line=${line/[185,/[FUELGAUGE_HIGH_POWER_DETAILS,} 221 | line=${line/[186,/[ACTION_LS_UNLOCK,} 222 | line=${line/[187,/[ACTION_LS_SHADE,} 223 | line=${line/[188,/[ACTION_LS_HINT,} 224 | line=${line/[189,/[ACTION_LS_CAMERA,} 225 | line=${line/[190,/[ACTION_LS_DIALER,} 226 | line=${line/[191,/[ACTION_LS_LOCK,} 227 | line=${line/[192,/[ACTION_LS_NOTE,} 228 | line=${line/[193,/[ACTION_LS_QS,} 229 | line=${line/[194,/[ACTION_SHADE_QS_PULL,} 230 | line=${line/[195,/[ACTION_SHADE_QS_TAP,} 231 | line=${line/[196,/[LOCKSCREEN,} 232 | line=${line/[197,/[BOUNCER,} 233 | line=${line/[198,/[SCREEN,} 234 | line=${line/[199,/[NOTIFICATION_ALERT,} 235 | line=${line/[200,/[ACTION_EMERGENCY_CALL,} 236 | line=${line/[201,/[APPLICATIONS_MANAGE_ASSIST,} 237 | line=${line/[202,/[PROCESS_STATS_SUMMARY,} 238 | line=${line/[203,/[ACTION_ROTATION_LOCK,} 239 | line=${line/[204,/[ACTION_NOTE_CONTROLS,} 240 | line=${line/[205,/[ACTION_NOTE_INFO,} 241 | line=${line/[206,/[ACTION_APP_NOTE_SETTINGS,} 242 | line=${line/[207,/[VOLUME_DIALOG,} 243 | line=${line/[208,/[VOLUME_DIALOG_DETAILS,} 244 | line=${line/[209,/[ACTION_VOLUME_SLIDER,} 245 | line=${line/[210,/[ACTION_VOLUME_STREAM,} 246 | line=${line/[211,/[ACTION_VOLUME_KEY,} 247 | line=${line/[212,/[ACTION_VOLUME_ICON,} 248 | line=${line/[213,/[ACTION_RINGER_MODE,} 249 | line=${line/[214,/[ACTION_ACTIVITY_CHOOSER_SHOWN,} 250 | line=${line/[215,/[ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET,} 251 | line=${line/[216,/[ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET,} 252 | line=${line/[217,/[ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET,} 253 | line=${line/[218,/[ACTION_BRIGHTNESS,} 254 | line=${line/[219,/[ACTION_BRIGHTNESS_AUTO,} 255 | line=${line/[220,/[BRIGHTNESS_DIALOG,} 256 | line=${line/[221,/[SYSTEM_ALERT_WINDOW_APPS,} 257 | line=${line/[222,/[DREAMING,} 258 | line=${line/[223,/[DOZING,} 259 | line=${line/[224,/[OVERVIEW_ACTIVITY,} 260 | line=${line/[225,/[ABOUT_LEGAL_SETTINGS,} 261 | line=${line/[226,/[ACTION_SEARCH_RESULTS,} 262 | line=${line/[227,/[TUNER,} 263 | line=${line/[228,/[TUNER_QS,} 264 | line=${line/[229,/[TUNER_DEMO_MODE,} 265 | line=${line/[230,/[TUNER_QS_REORDER,} 266 | line=${line/[231,/[TUNER_QS_ADD,} 267 | line=${line/[232,/[TUNER_QS_REMOVE,} 268 | line=${line/[233,/[TUNER_STATUS_BAR_ENABLE,} 269 | line=${line/[234,/[TUNER_STATUS_BAR_DISABLE,} 270 | line=${line/[235,/[TUNER_DEMO_MODE_ENABLED,} 271 | line=${line/[236,/[TUNER_DEMO_MODE_ON,} 272 | line=${line/[237,/[TUNER_BATTERY_PERCENTAGE,} 273 | line=${line/[238,/[FUELGAUGE_INACTIVE_APPS,} 274 | line=${line/[239,/[ACTION_ASSIST_LONG_PRESS,} 275 | line=${line/[240,/[FINGERPRINT_ENROLLING,} 276 | line=${line/[241,/[FINGERPRINT_FIND_SENSOR,} 277 | line=${line/[242,/[FINGERPRINT_ENROLL_FINISH,} 278 | line=${line/[243,/[FINGERPRINT_ENROLL_INTRO,} 279 | line=${line/[244,/[FINGERPRINT_ENROLL_ONBOARD,} 280 | line=${line/[245,/[FINGERPRINT_ENROLL_SIDECAR,} 281 | line=${line/[246,/[FINGERPRINT_ENROLLING_SETUP,} 282 | line=${line/[247,/[FINGERPRINT_FIND_SENSOR_SETUP,} 283 | line=${line/[248,/[FINGERPRINT_ENROLL_FINISH_SETUP,} 284 | line=${line/[249,/[FINGERPRINT_ENROLL_INTRO_SETUP,} 285 | line=${line/[250,/[FINGERPRINT_ENROLL_ONBOARD_SETUP,} 286 | line=${line/[251,/[ACTION_FINGERPRINT_ENROLL,} 287 | line=${line/[252,/[ACTION_FINGERPRINT_AUTH,} 288 | line=${line/[253,/[ACTION_FINGERPRINT_DELETE,} 289 | line=${line/[254,/[ACTION_FINGERPRINT_RENAME,} 290 | line=${line/[255,/[ACTION_DOUBLE_TAP_POWER_CAMERA_GESTURE,} 291 | line=${line/[256,/[ACTION_WIGGLE_CAMERA_GESTURE,} 292 | line=${line/[27601,/[QS_DATA,} 293 | line=${line/[27602,/[QS_DATA_TOGGLE,} 294 | line=${line/[27603,/[QS_DETAIL,} 295 | 296 | # Visibility 297 | if [[ $line == *$TAG_VIEW_VISIBILITY* ]] 298 | then 299 | line=${line/,0]/,invisible]} 300 | line=${line/,100]/,visible]} 301 | fi 302 | 303 | # Zen Mode 304 | if [[ $line == *$TAG_COUNT* ]] 305 | then 306 | line=${line/[dnd_mode_0,/[DND OFF,} 307 | line=${line/[dnd_mode_1,/[DND PRIORITY ONLY,} 308 | line=${line/[dnd_mode_2,/[DND TOTAL SILENCE,} 309 | line=${line/[dnd_mode_3,/[DND ALARM ONLY,} 310 | fi 311 | 312 | # Ringer Mode 313 | if [[ $line == *$TAG_ACTION* ]] 314 | then 315 | line=${line/[ACTION_RINGER_MODE,0/[ACTION_RINGER_MODE,RINGER_MODE_SILENT} 316 | line=${line/[ACTION_RINGER_MODE,1/[ACTION_RINGER_MODE,RINGER_MODE_VIBRATE} 317 | line=${line/[ACTION_RINGER_MODE,2/[ACTION_RINGER_MODE,RINGER_MODE_NORMAL} 318 | fi 319 | 320 | # Type of stream 321 | if [[ $line == *$TAG_ACTION* ]] 322 | then 323 | line=${line/[ACTION_VOLUME_STREAM,-1/[ACTION_VOLUME_STREAM,STREAM_DEFAULT} 324 | line=${line/[ACTION_VOLUME_STREAM,0/[ACTION_VOLUME_STREAM,STREAM_VOICE_CALL} 325 | line=${line/[ACTION_VOLUME_STREAM,1/[ACTION_VOLUME_STREAM,STREAM_SYSTEM} 326 | line=${line/[ACTION_VOLUME_STREAM,2/[ACTION_VOLUME_STREAM,STREAM_RING} 327 | line=${line/[ACTION_VOLUME_STREAM,3/[ACTION_VOLUME_STREAM,STREAM_MUSIC} 328 | line=${line/[ACTION_VOLUME_STREAM,4/[ACTION_VOLUME_STREAM,STREAM_ALARM} 329 | line=${line/[ACTION_VOLUME_STREAM,5/[ACTION_VOLUME_STREAM,STREAM_NOTIFICATION} 330 | line=${line/[ACTION_VOLUME_STREAM,6/[ACTION_VOLUME_STREAM,STREAM_BLUETOOTH_SCO} 331 | line=${line/[ACTION_VOLUME_STREAM,7/[ACTION_VOLUME_STREAM,STREAM_SYSTEM_ENFORCED} 332 | line=${line/[ACTION_VOLUME_STREAM,8/[ACTION_VOLUME_STREAM,STREAM_DTMF} 333 | line=${line/[ACTION_VOLUME_STREAM,9/[ACTION_VOLUME_STREAM,STREAM_TTS} 334 | fi 335 | 336 | # Translated 337 | echo $line 338 | fi 339 | done 340 | } 341 | 342 | # Check if the parameter is a file 343 | if [[ -f "$1" ]] 344 | then 345 | cat $1 | translate 346 | else 347 | translate $1 348 | fi 349 | --------------------------------------------------------------------------------