INTRODUCTION
I am using MTK6582 device Agua Rio (close relative of Wiko Rainbow, Explay Fresh, Blu) for 4 months now and to be honest I really enjoyed using this Android phone and so I began searching for effective init.d tweaks that will be compatible for my phone. No offense to the other developers who worked hard on building a set of tweak scripts but most of them are not compatible with my phone. It is simply because the declarations of the path is not present in my device or sometimes they are just supported by MTK6582. So I started recreating my own scripts and have been using it for weeks and works as expected.
This is still in Alpha version so I am not expecting a 360-degree change in performance but if there's one thing I can guarantee you, they are working for the devices I've mentioned above and to prove that there are log files from where you can verify if the scripts were properly executed or not.
DISCLAIMER
I will not be held liable or responsible if you brick your device after flashing this tweak. ALWAYS HAVE YOUR BACKUP READY!
FLASH AT YOUR OWN RISK!!!
FEATURES
- Battery Tweaks (a lot of things going on here like battery re-calibration which will be done every 7 days, centisecs flushing interval, WiFi Sleep from Gaurav, Entropy tweak for battery, pm.sleep_mode)
- updated Loopysmoothness for MTK (I modified the declaration of variables so that the script can be a little more flexible - Credits to [email protected])
- VM Tweaks (experimental - modified scripts to work for MTK6582 credits to [email protected] and [email protected] of Fly-on)
- GPU Rendering (Enable GPU rendering for 2D operations)
- DHCPd script to clean the DHCP leases before starting
- SDboost - (modded script to work with MTK - credits to [email protected] of Fly-on and V6 Supercharger - SD Card read-ahead cache to 2048 KB)
- IOTweaks for responsiveness
- Network tweaks - (my own mix with a touch of [email protected] network tweaks)
- Zipalign - (modded script that will zipalign any new apps in /system/app, /system/framework, /data/app every reboot)
11-DEC-2014 ALPHA 3B UPDATES
- Remount - to make your device more responsive
- zRAM - utlizing ZRAM to increase performance - http://forum.xda-developers.com/showthread.php?t=2320734
- LagBuster - Credits to [email protected] for giving me an idea to incorporate RNGD Entropy
- Props - Adding more useful prop parameters
- Looping scripts (stored in /data/Tweaks/scripts)
-- Lagfix - will run every 60min and will execute fstrim Due to bad effects in the long run I have removed this (ref: http://man7.org/linux/man-pages/man8/fstrim.8.html)
-- Defrag - will run every 12hours to execute VACUUM and REINDEX to optimize the database - credits to [email protected] of Fly-on
-- CPU Hotplug - another battery tweak which I have modified which will run specific set of hotplug depending on the needs of your device and also depending on the current capacity of your battery. Credits to [email protected]
-- Xposed Log cleaner - this is one of the scripts I initially released to temporarily fix the logging problem of the latest Xposed Installer. If you don't have the app, the script will exit - http://forum.xda-developers.com/showpost.php?p=56439074
- Added host file to block annoying phishing and ad-serving websites
- Added resolv.conf to use Google's public DNS for faster browsing
11-DEC-2014 ALPHA 3B UPDATES
- lowmemorykiller - Another rotational script that will check and update your lowmemorykiller parameters - Won't really add much value since LMK resets its value from time to time.. Thanks again bro @kermage !
- 3G Booster - I have now added in the flashable installer the 3G hack from [email protected]
- Added an uninstaller in case you don't like the tweaks. Thank you for using.
WHAT'S INSIDE
/system/etc/init.d/
- 01_BattTweaks
- 02_LoopySmoothness
- 03_VMTweaks
- 04_GPURender
- 05_DHCPD
- 06_SDBoost
- 07_IOTweaks
- 10_DONOTDELETE
- 11_Network
- 13_EXT4Remount
- 14_Zram
- 16_LagBuster
- 17_SetProps
- 51_Zipalign
/system/etc/
- hosts
- resolv.conf
/system/xbin/
- bash
- busybox
- rngd
- sqlite3
- zip
- zipalign
/data/Tweaks/scripts
- 08_LagFix.sh
- 09_Defrag.sh
- 12_CPUHotplug.sh
- 15_Mem_Tweaks
- 50_XposedCleanLog.sh
/data/Tweaks/logs
*** All logs from init.d scripts and rotational scripts (/data/Tweaks/scripts)
Click to expand...
Click to collapse
REQUIREMENTS
1. Rooted
2. Busybox
3. Kernel with init.d support
4. Custom recovery tool (CWMR, TWRP, Philz, CarlivTouch)
5. Presence of mind
6. Faith!
HOW TO INSTALL
1. Download the flashable zip file and save it to your SDcard (remember where you saved it)
2. Power off your phone
3. Press Power + Vol UP + Vol DOWN simultaneously
4. Choose Recovery mode
5. Select install from SDcard
6. Install the zip file
7. Wait until the installation is completed.
8. Reboot!
To manually Push the tweak
1. Download the zip file into your SDcard
2. Extract the files
3. Copy all the contents of init.d to your /system/etc/init.d
4. Change the permission to rwxr-xr-x or rwxrwxrwx
5. Copy all the content of net to /system/etc
6. Change the permission of "hosts" and "resolv.conf" to rw-rw-rw
7. Go to /data and add a new folder named "Tweaks"
8. Go to /data/Tweaks and add new 2 folders - "scripts" and "logs"
9. Copy all the contents from "scripts" (from the zip file) to /data/Tweaks/scripts
10. Change the permissions of all the files in /data/Tweaks/scripts to rwxr-xr-x or rwxrwxrwx
11. Reboot.
HOW TO VERIFY
With the use of Root Explorer or ES Explorer, go to /data/Tweaks/logs and you will see the log files generated by the scripts. Also if you have a Terminal Emulator, you can check that the rotational scripts are running in the background.
Oh by the way, sorry to disappoint the Antutu lovers but the scripts were not customized to satisfy your eyes with Antutu scores.
To manually Delete the Tweaks
1. Delete all the files mentioned above from your phone using Root Explorer (or any file manager like ES explorer)
2. You can leave the files added in /system/xbin/ as it may help you in the future... 'just a suggestion but you can delete it if you want.
FAQs
Q: Not working. How can I tell the scripts were actually working?
A: Check the logs stored in /data/Tweaks/logs and inspect if there are log files. And with the use of any text editor check one by one the log files for any errors.
Q: There are no files in /data/Tweaks/logs, what happened?
A: It is possible that your ROM does not have init.d support. You can try using [email protected]'s fix for that (http://forum.xda-developers.com/showthread.php?t=1933849). Then you can try using again the tweak
Q: After flashing the tweaks, I cannot connect to my VPN app like Psiphon. How to fix this?
A: To be honest, I am unsure yet why but you can try either the following:
1. Check again the permission of /system/etc/hosts, /system/etc/resolv.conf and make sure they are set to rw-rw-rw. Then reboot;
2. OR, move/delete /system/etc/init.d/11_Network, /system/etc/hosts, /system/etc/resolv.conf then reboot
Q: My Internet connection is slow.
A: You can try adding the 3G hack from [email protected] (http://forum.xda-developers.com/showpost.php?p=42185612&postcount=100)
Q: The tweak is actually useless, it is not working. Should this be the case?
A: If I was not able to help you in any way, thanks for testing and feedback. Google is our friend.
Thank you all!
Mix n Match ALPHA 3B is now available
CHANGES 11-DEC-2014:
Please refer to the notes above. for the updates .
The INSTALLER will backup your previous tweaks and any conflicting files with Mix n Match. I have also added now an UNINSTALLER in case you are not satisfied. The UNINSTALLER will revert all the changes made before you flashed the latest tweaks.
Again... Flash at your own risk!
Thank you very much
great job man.. :good:
what version of rio you're using?
mines s5501 and running on kitkat deodexed by edmhar, is your tweaks compatible with edmhar's deodexed stock rom?
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Agua Rio
cheeze.keyk said:
great job man.. :good:
what version of rio you're using?
mines s5501 and running on kitkat deodexed by edmhar, is your tweaks compatible with edmhar's deodexed stock rom?
Click to expand...
Click to collapse
I am using Agua Rio V2
COOL!
umangleekha said:
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Click to expand...
Click to collapse
Cool! And good JOB as well
updated the hotplug
umangleekha said:
Good, i'll write governer tweaks for hotplug and post link here, i'll make different versions for more battery and more responsiveness
Click to expand...
Click to collapse
Hey Bro, in this release I have modified your CPU hotplug and this is a rotational shell script
Code:
#!/system/bin/sh
# Name: 12_CPUHotplug.sh
# Date: 11/03/2014
# Author: Arsie Organo Jr. - [email protected]
# Link:
# About: This is additional tweaking for MT6582 devices
# to improve battery life
# You will need your device to be:
# 1. Rooted
# 2. Busybox is installed.
# 3. hotplug
# Credits: Fly-On, Medusa, and Umang Leekha hotplug
####################################################
# START
# Logging
datalog=/data/Tweaks/logs/12_CPUHotplug.log
# Check if your device supports Hotplug
HOTPLUG=/sys/devices/system/cpu/cpufreq/hotplug
if [ -d $HOTPLUG ] ; then
echo "This device supports hotplug." | tee -a $datalog;
else
echo "No hotplug support for this device. Exiting script now!" | tee -a $datalog;
exit 0
fi;
# If device is awake, it will check current battery level and also the %usr level of the CPU (all)
a=1
sleepme=10
while [ $a -ge 0 ]
do
busybox rm -f $datalog
busybox touch $datalog
BATTSTAT=`cat /sys/class/power_supply/battery/capacity`
MAXLVL=100
USRLVL=`busybox mpstat -P ALL | grep all | awk '{print $3}'`
USRLVL=${USRLVL%.*}
GAUGE=60
ANTUTU=`ps | grep com.antutu | wc -l`
ANTUTUUSE=`busybox top -b -n10 -d3 | grep com.antutu.ABenchMark | cut -c42-45 | awk '{sum+=$0}END{print sum*10}'`
if [ $ANTUTUUSE -gt 10 ] ; then
echo "Antutu Benchmark is still running. Unable to switch to Level 5 hotplug." | tee -a $datalog;
else
killall -9 com.antutu.ABenchMark
fi;
chmod 644 /sys/devices/system/cpu/cpufreq/hotplug/*
if [ $ANTUTU -gt 0 ] ; then
echo "Level Antutu Hotplug (Pro Performance) will be applied due to Antutu - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 90 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 50000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 10 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 0 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 50000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 4 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
elif [ $USRLVL -lt $GAUGE ] || [ $BATTSTAT -lt $GAUGE ]; then
echo "Level 5 Hotplug (Battery Saver) will be applied - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 95 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 95 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 40000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 1 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 1 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 100 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 40000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 2 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
elif [ $USRLVL -ge $GAUGE ] && [ $BATTSTAT -ge $GAUGE ] ; then
echo "Level 0 Hotplug (Pro Performance) will be applied - $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $datalog;
echo "Battery Level: $BATTSTAT | MPSTAT Level: $USRLVL" | tee -a $datalog;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/up_threshold;
echo 85 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold;
echo 30000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential;
echo 15 > /sys/devices/system/cpu/cpufreq/hotplug/down_differential;
echo 0 > /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias;
echo 30000 > /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min;
echo 4 > /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit;
echo "up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/up_threshold )" | tee -a $datalog;
echo "cpu_up_threshold: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold )" | tee -a $datalog;
echo "sampling_rate: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate )" | tee -a $datalog;
echo "cpu_down_differential: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential )" | tee -a $datalog;
echo "powersave_bias: $( cat /sys/devices/system/cpu/cpufreq/hotplug/powersave_bias )" | tee -a $datalog;
echo "sampling_rate_min: $( cat /sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min )" | tee -a $datalog;
echo "cpu_num_limit: $( cat /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit )" | tee -a $datalog;
echo "===== COMPLETED - $( date +"%m-%d-%Y %H:%M:%S" ) =====" | tee -a $datalog;
fi;
sleep $sleepme
done
# END
Too interested in !
But I have to ask you how to uninstall if we did not use your special one, because of I have a sad experience before...
Good question, I always make sure that anything I install I create a document or uninstaller.. however, I was too busy at work and wanted to share this to my FB friends so I published it as Alpha version and wanted to get their feedback.
Give me a few minutes and I will update the doc on how to uninstall.
Hi dhampire,
I have updated the docs for you.. in the next release I will make an backup and uninstaller so that if someone does not want this tweaks they can go back from their previous set.
Good Job ser!
Next custom rom
LOL!
petiksmode said:
Next custom rom
Click to expand...
Click to collapse
hopefully I'd be able to cook one
Will this work on leagoo lead 3? mt6582, 512m of ram
init.d support
birdsilver said:
Will this work on leagoo lead 3? mt6582, 512m of ram
Click to expand...
Click to collapse
Please wait on my next release within this week and try on your phone. But please check first if your device supports init.d.
eyesfortech said:
Please wait on my next release within this week and try on your phone. But please check first if your device supports init.d.
Click to expand...
Click to collapse
Thank you very much for your response, I'll wait. I activated init.d thanks to Ryuinferno, via the terminal support.
:good:
The main page has been updated.. check out what's new
I have re-uploaded the MixnMatch_ALPHA_3b_Installer.zip installer today (12Dec2014) to fix the Bluetooth on/off bug.
Sorry for the inconvenience guys. It should be OK now.
Thanks your job! I'm trying now.
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Problem (Sound)
Hi. I have a report for you master.
Sound problem.
1. Telephone.
In my case, I can't hear a voice (1st call), after hang up, I can hear a voice on 2nd call with big voice.
2. Alarm
I can't hear a sound.
Common is sound problem.
Regards.
Logs
dhampire said:
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Click to expand...
Click to collapse
Can you send me the logs from /data/Tweaks/logs ?
Or please let me know if you are familiar with ADB Shell so that I can give you the commands to check.
Thanks.
17_SetProps
dhampire said:
Hi.
Thanks your job! I'm trying now.
In my device, your log said that these scripts did not work.
- 09_Defrag.sh
- 12_CPUHotplug.sh
My device Lenovo s930 (MT6582) dual sim / Kitkat 4.4.2
Regards.
Click to expand...
Click to collapse
dhampire said:
Hi. I have a report for you master.
Sound problem.
1. Telephone.
In my case, I can't hear a voice (1st call), after hang up, I can hear a voice on 2nd call with big voice.
2. Alarm
I can't hear a sound.
Common is sound problem.
Regards.
Click to expand...
Click to collapse
Hi,
Since we have a different device, can you delete 17_SetProps from /system/etc/init.d and then reboot?
Thanks.
Related
There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"] if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
This looks like a great idea :good: is it possible to easily change the intended interval at which yo want the scripts to run though?
HTCDreamOn said:
This looks like a great idea :good: is it possible to easily change the intended interval at which yo want the scripts to run though?
Click to expand...
Click to collapse
Sure, check the examples I posted, they are well commented. Just change the value of the "RUN_EVERY".
I'll take a look
mcbyte_it said:
Sure, check the examples I posted, they are well commented. Just change the value of the "RUN_EVERY".
Click to expand...
Click to collapse
Awesome, I'll give them a go!
how can i modify this script to zimpalign /system/app too?
UnitedOceanic said:
how can i modify this script to zimpalign /system/app too?
Click to expand...
Click to collapse
There is no much sense of zipaligning system apps every x days, once they are zipaligned (when making the ROM zip), they remain zipaligned. some apks might need zip aligning if they get moved/installed as system apps after rom install.
Not to mention the stability, I don't know the exact boot mechanism of android, if you start zip aligning system apps during the init.d, it might cause instability to some system apps.
But if you mount the /system partition as read/write, do the zipaligning loop, then remount it as read-only, it should be possible.
still, I don't recommend doing so....
i pushed many apps from /data/app to /system/app.
I deleted the libs from the apks and copied them to /system/libs to saved space. however I forgot to zipalign the apks after removing the libs. I used the zipalign script from the rom toolbox app unfortunately it didn't work as expected. it just deleted the apps that should have been zipaligned.
I don't really want to zipalign /system at every boot. just once for the modified apks.
mcbyte_it said:
There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"] if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
Click to expand...
Click to collapse
Thanks for this awesome script i was able to get an idea for this. I tried this two scripts but only zipalign works even though i have sqlite3 in stored in xbin.
mcbyte_it said:
There are many ROMs that include the ZipAlign or SQLite3 vacuum on boot, but these command are not really needed to run on EVERY boot, once every few days can be enough, so I came out with this script.
To run it, you need to have busybox with the stat applet (should be there always), which gives information about a file, including last modification date.
This is done is by checking the last modification date on a file, which is touched or changed only when the main script is executed.
Currently I modified the ZipAlign and SQLite vacuum in my own rom to use this technique, and they seem to work fine. The monitored file is the log of the operation done, which is stored in the /data/ directory
ZipAlign on Boot:
Code:
#!/system/bin/sh
# Automatic ZipAlign by Wes Garner
# ZipAlign files in /data that have not been previously ZipAligned (using md5sum)
# Thanks to oknowton for the changes
# Changelog:
# 1.0 (11/30/09) Original
# 1.1 (12/01/09) Switched to zipalign -c 4 to check the apk instead of MD5 (oknowton)
# 1.2 (06/01/13) Run the main script only once every N days (default 7 days, 1 week) (mcbyte_it)
[COLOR="DarkRed"]LOG_FILE=/data/zipalign.log
#Interval between ZipAlign runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/color]
[COLOR="DarkRed"]fi[/COLOR]
SQLite3 vacuum:
Code:
#!/system/bin/sh
# ========================================
# init.d script for McByte jkSGS3
# ========================================
# SQLite database vaccum
# Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file.
# Running VACUUM ensures that each table and index is largely stored contiguously within the database file.
# In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.
# sqlite3 binary in /system/xbin is required!
# Changelog
# v1.0 - (??/??/????) - original version
# v1.1 - (06/01/2013) - run only every X seconds, default = 1 week (mcbyte_it)
#
[COLOR="DarkRed"]# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ];
then[/COLOR]
[COLOR="Green"]if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`; do
/system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;[/COLOR]
[COLOR="DarkRed"]fi;[/COLOR]
Click to expand...
Click to collapse
Hi guys! I recently installed lollipop touch wiz and installed the two scripts on the Op, managed to get the sql script to work fine but when the zip align tries to run it errors out in the log, any advice to what I've done wrong or if you guys know of a change in lollipop that doesn't play nice with zip aligning?
Starting Automatic ZipAlign 06-04-2014 15:23:01
ZipAligning *.apk
ZipAligning *.apk Failed
Automatic ZipAlign finished at 06-04-2014 15:23:01
Click to expand...
Click to collapse
All I've done as far as modify the script is I got rid of the color tags.
Also the sql log shows the correct date as well, where this script does not.
Thank you in advance guys!
Any chance to make this flasheable thx!
how to make an specific init.d script runs every x minutes?
and when unlock the screen
Greetings
Hello everyone, I made a script to help developers solve problems and you become a more helpful user.
What does it do?
It exports to sdcard :
dmesg
last_kmsg
wakelocks
kernel version
logcat (normal and long)
radio (aka modem log)
getprop (aka build.prop)
running processes
partition info
mount info
RAM info
interrupts
boot logs from kernels like : nAa, lupus
Total maximum possible logs are 14 files.
What should I do? :cyclops:
Send files from the folder with the time-stamp you have just created or send the tar.gz'ed file to the corresponding developer to help him. Each time you run the script it creates a different folder with a unique time-stamp of the time and date you dumped the logs.
Send whatever is needed, everything is in bug_reporter folder.
Ok, how do we install this thing?
Make sure you download the latest version [ v1.4 is the latest ] which is attached below and put it in your sdcard...and that your device is rooted.
Go to CWM recovery and flash it! It does no harm, it just copies a small 6kb file in your /system/xbin. So there is no need to uninstall it later. It will accompany you until you flash a new ROM.
If you are coming from another version, just flash it over.
If you are having any problems, first attach the debug.txt from bug_reporter folder and tell me your device, kernel and ROM. The problem might be your busybox installation though.
Ok, how do we use this thing?
Make sure you have a terminal app, I use this : https://play.google.com/store/apps/details?id=jackpal.androidterm
Open a terminal app and just type :
Code:
su
bug
IT WON'T WORK PROPERLY IF NOT EXECUTED FROM /system/xbin/, SO IT MAY FAIL WITH SCRIPT MANAGER. TRY AND REPORT BACK TO ME.
That's it?
Yes. :good:
If you have any questions, feel free to ask anything. :highfive:
Any screenshots? :angel:
Yep.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I want to contribute/redistribute
Oh, please do! :victory: Spread it, mod it, rewrite it, make your own version, inform developers, tell ROM cookers to include it, do whatever you want with it, but please don't forget me...
Post any improvements or modifications for me here. :fingers-crossed:
Here is the "source code" of it:
Code:
#!/system/bin/sh
DIRECTORY="/sdcard/bug_reporter"
clear
#ROOT CHECK, FOR SCRIPT TO WORK ON ALL su VERSIONS
clear
echo "Checking root permissions..."
if [ "$(id)" != "uid=0(root) gid=0(root)" ];
then
echo " - Denied?"
echo " * Please accept superuser permission..."
echo " /!\ FIRST TYPE: su"
echo
exit
elif [ "$(id)" == "uid=0(root) gid=0(root)" ];
then
echo " - Granted! SU binary version : $(su -V)"
else
echo
echo " /!\ Some errors occured... Obviously..."
echo " * Run the script again."
echo " - Asking superuser permissions..."
echo " ( i ) If you see somewhere "root", we are OK,"
echo " else, we are NOT."
su
echo " Look at it :"
id
exit
fi
{
#CREATING THE NEST DIRECTORY
#
if [ ! -d "$DIRECTORY" ];
then
echo " - Directory not found.
echo " - Creating...
mkdir $DIRECTORY
echo " - Done!
else
echo " - Fatal error! Exiting...
exit
fi
#FOR DEBUGGING REASONS
#
echo " - SU binary version : $(su -V)"
#VACUUM
#
clear
##SETTING MAX MB
if [ ! -f $DIRECTORY/max_mb.txt ];
then
echo Logs can easily exceed over the size you can imagine.
echo So, I will ask you if you want me to delete them
echo in the future.
echo
echo "How many MB of logs do you want to keep?"
echo "(5 MB recommended)"
read keep
KEEP_KB=$(echo $(($keep*1024)) )
echo $KEEP_KB > $DIRECTORY/max_mb.txt
clear
fi
SIZE=$(du -s $DIRECTORY | cut -f1)
MAX_MB=$(cat $DIRECTORY/max_mb.txt)
MB=$(echo $(($SIZE/1024)) )
##CHECKING IF MAX MB ARE REACHED AND PROMPT
if [ "$SIZE" -ge "$MAX_MB" ];
then
echo Log files have reached the maximum size you have set.
echo Their size is around $MB MB.
echo
echo Do you want to clean all logs?
echo "(y = Yes, clean. n = No, reset max MB value)"
read clean
echo
if [ "$clean" == "y" ] || [ "$clean" == "Y" ] || [ "$clean" == "yes" ] || [ "$clean" == "YES" ];
then
rm -r $DIRECTORY
echo - Cleaned!
echo - Re-run the script to set again the max MB value.
echo - Bye!
exit
elif [ "$clean" == "n" ] || [ "$clean" == "N" ] || [ "$clean" == "no" ] || [ "$clean" == "NO" ];
then
rm $DIRECTORY/max_mb.txt
echo - Value reseted!
echo - Re-run the script to set again the max MB value.
echo - Continuing...
sleep 2
else
echo "/!\ Illegal character. Try again...";
sleep 1
exec bug
fi
fi
#PRECALCULATIONS FOR LOGCATING
#
ls dev/log > $DIRECTORY/devlog
MAIN=$(grep main $DIRECTORY/devlog)
RADIO=$(grep radio $DIRECTORY/devlog)
clear
DATETIME=$(date +%Y%m%d%H%M%S)
export DATETIME
echo " ,-------------, Everything is saved on sdcard"
echo " / [email protected] / under bug_reporter folder."
echo "/_____________/__,------,"
echo "| Bug reporter v1.4 / Remember the timestamp!"
echo "|_______________,-----' Format : yyyymmddhhmmss"
echo
echo "It exports and compresses as tarball the following :"
echo "* dmesg"
echo "* last_kmsg"
echo "* wakelocks"
echo "* kernel version"
echo "* logcat (normal and long)"
echo "* radio (aka modem log)"
echo "* getprop (aka build.prop)"
echo "* running processes"
echo "* partition info"
echo "* mount info"
echo "* RAM info"
echo "* interrupts"
echo "* boot logs from kernels like : nAa, lupus"
echo
cd $DIRECTORY
#TIMESTAMP WHICH IS THE FOLDER'S NAME WHERE THE FILES ARE SAVED ON EACH RUN
echo - report timestamp : $DATETIME
mkdir "$DATETIME"
echo - exporting...
#FOR DMESG
echo - dmesg
dmesg > $DIRECTORY/"$DATETIME"/dmesg.txt
echo - OK!
#FOR LAST_KSMG
#
echo - last_kmsg
if [ -f /proc/last_kmsg ];
then
cat /proc/last_kmsg > $DIRECTORY/"$DATETIME"/last_kmsg.txt
echo - OK!
else
echo " /!\ last_kmsg not found!";
fi
#FOR WAKELOCKS
#
echo - wakelocks
if [ -f /proc/wakelocks ];
then
cat /proc/wakelocks > $DIRECTORY/"$DATETIME"/wakelocks.txt
echo - OK!
else
echo " /!\ wakelocks not found!";
fi
#FOR KERNEL VERSION
#
echo - kernel version
if [ -f /proc/version ];
then
cat /proc/version > $DIRECTORY/"$DATETIME"/kernel.txt
uname -a >> $DIRECTORY/"$DATETIME"/kernel.txt
echo - OK!
else
echo " /!\ version not found!";
fi
#FOR LOLCATS
#
if [ "$MAIN" != "main" ] || [ "$RADIO" != "radio" ];
then
echo " /!\ main and radio logging aborted!";
echo "* I can't logcat properly, loggers may be disabled."
echo "- Your ROM's dev must have disabled it via a script."
echo " OR"
echo "- Loggers are disabled from kernel."
else
##MAIN
echo - logcat
logcat -d > $DIRECTORY/"$DATETIME"/logcat.txt
echo - OK!
echo - long logcat
logcat -v long -d > $DIRECTORY/"$DATETIME"/long_logcat.txt
echo - OK!
##RADIO
echo - radio
logcat -b radio -v time -d > $DIRECTORY/"$DATETIME"/radio.txt
echo - OK!
fi
#FOR GETPROP
#
echo - getprop
getprop > $DIRECTORY/"$DATETIME"/getprop.txt
echo - OK!
#FOR RUNNING PROCESSES
#
echo - processes
ps > $DIRECTORY/"$DATETIME"/processes.txt
echo - OK!
#FOR PARTITION INFO
#
echo - partition info
df > $DIRECTORY/"$DATETIME"/partitions.txt
echo - OK!
#FOR MOUNTS
#
echo - mount info
mount > $DIRECTORY/"$DATETIME"/mounts.txt
echo - OK!
#FOR RAM
#
echo - RAM info
free > $DIRECTORY/"$DATETIME"/ram.txt
echo - OK!
#FOR INTERRUPTS
#
echo - interrupts
cat /proc/interrupts > $DIRECTORY/"$DATETIME"/interrupts.txt
echo - OK!
##----DEVIDER FOR SPECIAL LOGS----##
#BOOT LOG FOR nAa KERNELS AND DERIVATIVES
#
if [ -f "/boot.txt" ];
then
echo " ( i ) Oh, I found a boot log too!"
echo "- That's found on some nAa kernels, backing it up."
cat /boot.txt > $DIRECTORY/"$DATETIME"/boot.txt
echo - OK!
fi
#BOOT LOG FOR lupus KERNELS AND DERIVATIVES
#
if [ -f "/tmp/lupus.log" ];
then
echo " ( i ) Oh, I found a boot log too!"
echo "- That's found on some lupus kernels, backing it up."
cat /tmp/lupus.log > $DIRECTORY/"$DATETIME"/boot.txt
echo - OK!
fi
##----###----##
#CLEANING UP UNEEDED FILES FOR USER
#
echo - Cleaning up...
##CLEANING LAST TARBALL
rm *.tar.gz 2>&1 | >$DIRECTORY/devlog
##devlog IS A FILE OF PRECALCULATIONS FOR LOGCAT
if [ -f "$DIRECTORY/devlog" ];
then
rm $DIRECTORY/devlog
fi
#COMPRESSING FOR EASY SENDING
#
echo - Compressing logs...
echo - Done!
echo " ( i ) Send "$DATETIME".tar.gz to developer(s)!"
tar -zcf "$DATETIME".tar.gz "$DATETIME"
echo - Exiting...
#ADVERTISING THE SCRIPT
#
echo "http://forum.xda-developers.com/showthread.php?p=41107818" > $DIRECTORY/"$DATETIME"/"I used bug_reporter script.txt"
#DEBUGING MY SCRIPT
#
} 2>&1 | tee $DIRECTORY/debug.txt
exit
CHANGELOG
Code:
[B]v1.4[/B] [B][COLOR="Red"]MORE FEATURES[/COLOR][/B]-[COLOR="SeaGreen"]WORKS ON ALL SUPERUSER APPS[/COLOR]
- alternative root check
- now it's [B]not[/B] necessary to have SuperSU, you can use whatever you want, but you have to type [B]su[/B] first
- added additional logging of : [B]running processes[/B], [B]partition info[/B], [B]mount info[/B], [B]RAM info[/B], [B]interrupts[/B], [B]boot logs[/B] from [B]lupus[/B] kernel
- avoided potential bug with radio logging
- added some more info about kernel version logging (with [B]uname -a[/B] command)
- code clean up and more easier to follow
- faster? (it takes 1 second for me)
[B]v1.3[/B] [B][COLOR="Red"]ROCK STABLE[/COLOR][/B]-[COLOR="SeaGreen"]THE BEST[/COLOR]
- corrected root check
- added compatibility with CM10.1, it uses an older version of su and the script will ask you to install SuperSU to update it
- corrected and re-ordered some text
- optimized script speed by removing unnecessary su requests (it just takes 3 secs to finish)
- added build.prop backup with getprop command, it will help devs understand more info about your situation
- added some sort of advertisement of the script, so that it'll become popular
- added compression of the last logging folder, so that you can easily send it to dev(s)
- added more info on the script, made more presentable and explanatory for those who are willing to modify it
[B]v1.2[/B] [B][COLOR="Red"]STABLE[/COLOR][/B]-[COLOR="SeaGreen"]FULLY TESTED[/COLOR]
- finally fixed logcat exporting, now it will work for sure, fully tested
- cleaned up the script a lot and made it simplier for reading
- added radio (aka modem log), wakelocks and kernel version logging
- fixed terminal output logging for debugging better
[B]v1.1[/B] [I][COLOR="Gray"]it won't logcat, but everything else works[/COLOR][/I]
- fixed wrong logcat exporting, now when it's disabled, you'll know it
- added an auto-check for vaccuming logs after reaching above the MB size you set (logs can easily reach 10 MB)
- small bugfixes
- root check, in order to be sure we collect logs as root
- terminal output logging for debugging reasons
[B]v1.0 beta[/B] [I][COLOR="Gray"]works, but has many errors, it may even fail to flash.[/COLOR][/I]
- initial release
Thank you very much, this script will help a lot of people, including me
Sent from my R800i using xda premium
Is it possible to move this bug file to system/xbin instead of flashing it (gives error). And if yes, what should be the permissions?
zadrozny91 said:
Is it possible to move this bug file to system/xbin instead of flashing it (gives error). And if yes, what should be the permissions?
Click to expand...
Click to collapse
It's fixed. Just flash bug_reporter[v1.0]-nAa.zip, the permissions are 755. If you are unsure about permissions, see this : http://www.draac.com/chmodchart.html
But I am telling you to flash the fixed zip, it'll work.
leajian said:
It's fixed. Just flash bug_reporter[v1.0]-nAa.zip, the permissions are 755. If you are unsure about permissions, see this : http://www.draac.com/chmodchart.html
But I am telling you to flash the fixed zip, it'll work.
Click to expand...
Click to collapse
nice concept ,,but there are some problems
after taking log
both lastkmsg and logcat file show nothing(empty files)
long logcat shows this: 9 com.android.settings
only dmesg is correctly extracted
UPDATE!
Code:
[B]v1.1[/B]
- fixed wrong logcat exporting, now when it's disabled, you'll know it
- added an auto-check for vaccuming logs after reaching above the MB size you set (logs can easily reach 10 MB)
- small bugfixes
- root check, in order to be sure we collect logs as root
- terminal output logging for debugging reasons
Thanks man, I was going to write something similar until I found this.
I cannot attest to the zip's functionality as I use it with script manager, but I can say version 1.0 worked perfectly (producing the three possible proper log files) for me. Version 1.1 not so much it tells me 'I can't logcat' when I clearly can; gl with your 'main not found' problem.
Also a suggestion maybe include in your zip a copy of the script that goes to /sdcard/ so the user can easily access it in order to facilitate using it as a widget.
defiant07 said:
Thanks man, I was going to write something similar until I found this.
I cannot attest to the zip's functionality as I use it with script manager, but I can say version 1.0 worked perfectly (producing the three possible proper log files) for me. Version 1.1 not so much it tells me 'I can't logcat' when I clearly can; gl with your 'main not found' problem.
Also a suggestion maybe include in your zip a copy of the script that goes to /sdcard/ so the user can easily access it in order to facilitate using it as a widget.
Click to expand...
Click to collapse
Indeed, logcating won't work no matter what. It's a bug. I am aware of it. I'll fix it today I guess along with some code cleanup and considering your suggestion.
Sent from my MT11i using xda premium
Code:
[B]v1.2[/B] [B][COLOR="Red"]STABLE[/COLOR][/B]-[COLOR="SeaGreen"]FULLY TESTED[/COLOR]
- finally fixed logcat exporting, now it will work for sure, fully tested
- cleaned up the script a lot and made it simplier for reading
- added radio (aka modem log), wakelocks and kernel version logging
- fixed terminal output logging for debugging better
Also v1.0 beta re-added in case you want it.
Might convert this to external scripts for windows and unix as well. Btw, why the root checker? If it needs to be in system/xbin then you already have root
Sent from my Nexus 7 using Tapatalk HD
cybojenix said:
Might convert this to external scripts for windows and unix as well. Btw, why the root checker? If it needs to be in system/xbin then you already have root
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
:victory: Yeah, do whatever you want with it!
About the root check... Have you ever thought of "just in case" case? Well sometimes sh!t happens... Like the 7+7=16 embarrassing situation on final exams for example.
Anyway, probably won't need this check on other unix systems... You'll need to start the script with
Code:
sudo -i
and remove any
Code:
su -c
in the script. Also some logging files are available only for android, like logcat and logcat radio. If you need any help with converting I can help you both for windows and unix, just PM me.
EDIT : Opss, root check is buggy, I've discovered it thanks to you! I'll upload a fixed minor revision later.
leajian said:
:victory: Yeah, do whatever you want with it!
About the root check... Have you ever thought of "just in case" case? Well sometimes sh!t happens... Like the 7+7=16 embarrassing situation on final exams for example.
Anyway, probably won't need this check on other unix systems... You'll need to start the script with
Code:
sudo -i
and remove any
Code:
su -c
in the script. Also some logging files are available only for android, like logcat and logcat radio. If you need any help with converting I can help you both for windows and unix, just PM me.
EDIT : Opss, root check is buggy, I've discovered it thanks to you! I'll upload a fixed minor revision later.
Click to expand...
Click to collapse
I mean set up a script to run from a pc to debug android. Let's you run it on non rooted devices (parts of it anyway)
It's quicker than getting a user to push and run via the android terminal (which not everyone has)
Easier to run via an adb interface which can be supplied, and implement an update script everyone is running the same version
Btw won't need help check my signature for the root scripts
Sent from my Nexus 7 using Tapatalk HD
UPDATE! The tool is now in a super stable state of development.
Code:
[B]v1.3[/B] [B][COLOR="Red"]ROCK STABLE[/COLOR][/B]-[COLOR="SeaGreen"]THE BEST[/COLOR]
- corrected root check
- added compatibility with CM10.1, it uses an older version of su and the script will ask you to install SuperSU to update it
- corrected and re-ordered some text
- optimized script speed by removing unnecessary su requests (it just takes 3 secs to finish)
- added build.prop backup with getprop command, it will help devs understand more info about your situation
- added some sort of advertisement of the script, so that it'll become popular
- added compression of the last logging folder, so that you can easily send it to dev(s)
- added more info on the script, made more presentable and explanatory for those who are willing to modify it
can i get permission for adding your script in my cm-10.1 for LG-P350 ?
PecanCM said:
can i get permission for adding your script in my cm-10.1 for LG-P350 ?
Click to expand...
Click to collapse
Says in the post you can. Just credit
Sent from my Nexus 7 using Tapatalk HD
Just sharing. I use this:
bugreport > /sdcard/bug_report_`date +"%Y%m%d-%H%M"`
You may want to incorporate it in some way.
Sent from my GT-I9100 using xda premium
RovG said:
Just sharing. I use this:
bugreport > /sdcard/bug_report_`date +"%Y%m%d-%H%M"`
You may want to incorporate it in some way.
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
Thanks, I'll have it in mind, the reason why I didn't do this before is that I wanted it to be simple and not so informative.
In next update I might add some colors too!
Anyway here is an update... :fingers-crossed:
Code:
[B]v1.4[/B] [B][COLOR="Red"]MORE FEATURES[/COLOR][/B]-[COLOR="SeaGreen"]WORKS ON ALL SUPERUSER APPS[/COLOR]
- alternative root check
- now it's [B]not[/B] necessary to have SuperSU, you can use whatever you want, but you have to type [B]su[/B] first
- added additional logging of : [B]running processes[/B], [B]partition info[/B], [B]mount info[/B], [B]RAM info[/B], [B]interrupts[/B], [B]boot logs[/B] from [B]lupus[/B] kernel
- avoided potential bug with radio logging
- added some more info about kernel version logging (with [B]uname -a[/B] command)
- code clean up and more easier to follow
- faster? (it takes 1 second for me)
Hello everyone, i just wanted help with my Bash script!
I usually flash nightlies and when ever i flash them, i lose my tweaks
So i decided creating a bash script for myself,
Here's how it is....
Code:
#!/system/bin/sh
## personal file
tweaks=/sdcard/tweaks
build=/system/build.prop
## loop trough $tweak
sed -r '/(#.*|^ *$)/d;/.*=.*/!d;$a' $tweak | while read line
do
## get entry from $tweak
entry=$(echo $line | sed "s/=.*//")
## if variable already present in $build
if cat $build | grep -q $entry
then
## override value in $build if different
if ! cat $build | grep -q $(cat $tweak | grep $entry)
then
sed -i "s/^${entry}=.*$/${line}/g" $build
fi
else
echo $line >> $build
fi
done
Everything works but i wanted to keep this process running (For testing purposes),
I mean after my tweaks/values get replaced, i want the same thing to happen with other values!
Eg:- /sdcard/tweak= Contains line= ro.build.model=Nexus 5,
Same file contains ro.build.model=Xperia Z,
now what i want my script to do is, First replace my phone model with Nexus 5 and after some time change it with Xperia Z without starting/stopping any other script!
But i aint too good at this!
So i require a helping hand!
I hope you get my point.
DeveDroid said:
Hello everyone, i just wanted help with my Bash script!
I usually flash nightlies and when ever i flash them, i lose my tweaks
So i decided creating a bash script for myself,
Here's how it is....
Code:
#!/system/bin/sh
## personal file
tweaks=/sdcard/tweaks
build=/system/build.prop
## loop trough $tweak
sed -r '/(#.*|^ *$)/d;/.*=.*/!d;$a' $tweak | while read line
do
## get entry from $tweak
entry=$(echo $line | sed "s/=.*//")
## if variable already present in $build
if cat $build | grep -q $entry
then
## override value in $build if different
if ! cat $build | grep -q $(cat $tweak | grep $entry)
then
sed -i "s/^${entry}=.*$/${line}/g" $build
fi
else
echo $line >> $build
fi
done
Everything works but i wanted to keep this process running (For testing purposes),
I mean after my tweaks/values get replaced, i want the same thing to happen with other values!
Eg:- /sdcard/tweak= Contains line= ro.build.model=Nexus 5,
Same file contains ro.build.model=Xperia Z,
now what i want my script to do is, First replace my phone model with Nexus 5 and after some time change it with Xperia Z without starting/stopping any other script!
But i aint too good at this!
So i require a helping hand!
I hope you get my point.
Click to expand...
Click to collapse
i caught a typo:
tweaks -> tweak
and,
First replace my phone model with Nexus 5 and after some time change it with Xperia Z without starting/stopping any other script!
why dont you try something called 'sleep' command? its very very convenient
for example:
Code:
sleep 60 #will make the script suspend for a minute
Tweakprop can handle build.proo tweaks. It grap the new build.prob against the tweaks file you created and add this to the new one. This is flasable under cwm/twrp and works quite good.
Please read the whole thing before deciding or asking any questions !!
This is a little script written by me to tweak the default cpu governer (hotplug) for MT6582 devices, currently tested only on A120, this script is actually programmed to set cpu power saving bias, number of cores online, and some more more attributes of our hotplug governer
Warning - flash on your own risk, i'm not responsible for any bad thing !!
Warning - this is only tested on A120 right now !!
Warning - only works on stock kitkat and cleankat for A120 !!
Warning - do give me credits if you include this in your rom !!
There are 7 different levels of power saving from 1 - 7 !!
Code:
Lvl BIAS CORES
1 150 4
2 250 4
3 150 3
4 250 3
5 100 2
6 250 2
You just have to flash any level and reboot !!
The higher level you flash, the more battery you save !!
Flash level 0 to get max perfomance with no battery saving !!
Well done brother. Now i can flash levels according to my need. There's a hell loads of difference in battery after flashing higher levels. Keep up the good work. You always come up with something remarkable.
Let us collaborate
Hi Mate,
I will message you on FB and will give you an update.
Update on script
Hi @umangleekha,
Again nice job :good:
But I have a suggestion (you can opt to take it or not). As you have mentioned the Level 0 is the stock value so you recommend us to install it whenever we want to revert. However there are a few of us who have already tweaked the values of what your script intends to change. And curious people like me would want to try your script as well. So to make things a little bit flexible and friendly, I did a little modification on your script and an uninstaller so that people can revert back to their previous settings.
I Pm'd you the scripts so you can decide if you want to update your set of installers. The uninstaller will can be applied to any of the Level installer they used.
Here's a little bit explanation of how it works, I am taking Level 6 for example:
Updated scipt
Code:
#!/system/bin/sh
#hotplug governer tweaks_umangleekha
#variables
up_threshold=/sys/devices/system/cpu/cpufreq/hotplug/up_threshold
cpu_up_threshold=/sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold
sampling_rate=/sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
cpu_down_differential=/sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential
down_differential=/sys/devices/system/cpu/cpufreq/hotplug/down_differential
powersave_bias=/sys/devices/system/cpu/cpufreq/hotplug/powersave_bias
sampling_rate_min=/sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min
cpu_num_limit=/sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit
hotplugbak=/data/hotplug
hotpluglog=/data/hotplug.log
rm -f $hotpluglog
touch $hotpluglog
if [ -s $hotplugbak ] ; then
echo "hotplug original values were stored." | tee -a $hotpluglog;
else
touch $hotplugbak;
echo "#!/system/bin/sh" | tee -a $hotplugbak;
echo "# This contains the original values" | tee -a $hotpluglog;
echo "" | tee -a $hotplugbak;
echo "hotplug will run the first time..." | tee -a $hotpluglog;
#creating a backup first
echo "echo $( cat $up_threshold ) > $up_threshold" | tee -a $hotplugbak;
echo "echo $( cat $cpu_up_threshold ) > $cpu_up_threshold" | tee -a $hotplugbak;
echo "echo $( cat $sampling_rate ) > $sampling_rate" | tee -a $hotplugbak;
echo "echo $( cat $cpu_down_differential ) > $cpu_down_differential" | tee -a $hotplugbak;
echo "echo $( cat $down_differential ) > $down_differential" | tee -a $hotplugbak;
echo "echo $( cat $powersave_bias ) > $powersave_bias" | tee -a $hotplugbak;
echo "echo $( cat $sampling_rate_min ) > $sampling_rate_min" | tee -a $hotplugbak;
echo "echo $( cat $cpu_num_limit ) > $sampling_rate_min" | tee -a $hotplugbak;
fi;
# applying hotplug now
echo 95 > $up_threshold
echo 95 > $cpu_up_threshold
echo 40000 > $sampling_rate
echo 1 > $cpu_down_differential
echo 1 > $down_differential
echo 250 > $powersave_bias
echo 40000 > $sampling_rate_min
echo 2 > $cpu_num_limit
What it does is it will create a backup named "hotplug" inside /data directory. And this will not be changed and will be done once (check the IF statement). And if the backup is already there, the first IF will be bypassed and it will proceed to the changes you need. If the backup is not there, it will create the backup first. Basically that's going to be your installer.
For the Uninstaller
So the script is pretty straightforward, it will delete the existing hotplug from the init.d and then execute the shell script which was previously backed up from the installer.
Code:
#!/system/bin/sh
#
# This will revert all the changes made by the battery tweak from Umang Leekha
##################################################################################
# Let us start
#mounting /system
mount -o rw,remount /system
mount -o rw,remount /data
# Deleting the hotplug
rm -rf /system/etc/init.d/hotplug;
/system/bin/sh /data/hotplug;
# Updating the correct permission
chmod 777 /system/etc/init.d/*
I hope this helps and more power!
Thanks, i'll consider your ideas in V2
Here are the results, using my Lvl5 Super battery tweak, i'm a modeate user, brightness 22%, wifi on almost everytime when screen is on, crome and whatsapp, also one football app, played piano tiles for 15mins, it's just my first test with my tweaks, i'll release level 7 and will reach 6hrs screen time soon
umang bro, put them all inside another zip and upload it. It's annoying to download one tweak at a time. thanks !
Results after moderate usage. thanks brother, i got around 7 hours on screen. [emoji6]
Hey dev i flashed the level7 zip on my unite2 with ur cleankat v2.9 rom bt after flasbibg when i chekedout the battery stat i was shocked.it was 89% charged bt saying only 6 mins backup left why so bro tell me whats the problem.! Help
Sent from my Micromax A106 using xda app-developers app
I think you will need to recalibrate your battery dude. There are apps in Google Playstore which you can use.
Hey Umang,
So you have now Level 7 with powersave_bias=0, cpu_num_limit=2 and assigned scaling_max_freq=1040000 for all the cores, what's the effect of these changes?
scaling_max_freq path is incorrect Level7
Hey Bro,
I just checked your script for Level7, where did you checked this hotplug? I checked on my MT6582 KK version and it seems your last 4 lines' path does not exist. I checked it via ADB.
Can this work on Gionee M2?
Sent from my Gionee M2 using XDA Free mobile app
After installing on my Gionee M2, i was stuck at the Gionee Boot logo... Bootloop had to restore my backup
Sent from my Gionee M2 using XDA Free mobile app
very nice share
I Represent to you:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The_Thing
The first and original FULLY customizable bloatware remover and realtime device optimizer
INDEX
First post: Introduction, Features & Images
Second post: Changelog & Downloads
Third post: How everything works & Other useful info
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
INTRODUCTION
Hey! The_Thing started as a AROMA installer originally made for the Samsung Galaxy S4, that allowed the user to choose what bloatware they wanted to remove. It has come a long way from that, now including many tweaks to increase performance, battery life, audio quality, camera quality and smoothness. But this MOD isn't intended to be just full of tweaks, they're just an added BONUS. It's made to grant the user as much power over his phone and its performance as possible, trough customizable bloatware removal, "The_Thing" and "Tim" scripts.
You can find a specifically optimized profile for Galaxy S4 here
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
FEATURES
FULLY customizable Installation thanks to AROMA installer
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
The_Thing script
Main script, that is used to control different settings and to access all the mods features:
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Bloatware backup manager
Bloatware backups are generated during removal if the user chose so.
They can be then removed or restored if needed.
Additional settings tab
It includes special abilities, like:
Swap and Zram creation
Init.d support, can be created if not supported originally by the users device
A Full Malware and Adware blocker made by @BSDgeek_Jake
A Fixer script, that can fix all sorts of common problems encountered while using Android
Uninstaller
I don't know why I should advertise the ability to uninstall the mod, but hey!
It's good to know that it's there
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
It also contains the following basic tweak scripts:
Killer script
Every user set hours Kills apps and processes defined in its Settings data files, to prolong battery life and to improve performance.
Smoothie script
Improves users phones UI and Games performance, for maximum smoothness and fluidity.
Cleaner script
Every user set days Cleans:
Androids excess junk
Android and app cache to save upto 1G of space!
Log and Usagestat files
And recent processes to save space, performance and to prevent the famous BlackScreenOfDeath.
User can also define additional directories and files to be cleaned.
Ram Booster script
Optimizes users RAM usage based on how much physical RAM the device has.
Also has the ability to lock user defined apps into memory. Usefull for apps you want to stay active and speedy, like WhatsApp
Tweak Engine script
The main basic tweaker. It has tweaks to improve:
Internet speed, Graphics performance, Battery life, I/O and Storage performance, Audio quality, Camera quality and Android Logging for a more pleasant user experience
Fstrim script
Trims /data, /system, /cache and /preload every user set days to improve storage performance and to prolong phones storage lifetime. It also dumps cahce to speed things up on devices that have memory leaks
App Optimizer script
Has three scripts build-in, that run every user set days:
SQLite Optimizer, Optimizes apps database files for faster access and a more pleasant app usage experience.
Zipaligner, Aligns apps and their files to keep their RAM usage low for a more seamless multitasking.
PermFixer, Fixes apps permissions to prevent FCs
AdBlock
Contains the Ad and Malware Blocker made by BSDgeek_Jake, for the user to install. You can choose between, Full, Light and Original blocker to keep the user safe and Ad-free
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Tim
Tim runs in the background, optimizing the users phone depending on what they're doing:
App Locker, to regularly lock foreground apps into memory for less lagier usage.
Schedules, to regularly Clean, Trim and boost the users device when you're not using it.
A Wake Lock Blocker to improve battery-life!
Stops processes causing Wake Locks to ensure the device goes to Deep Sleep
A Charger, for faster charge times and healthier batteries!
Controls how and at what speed the users device is charged to ensure its battery stays helthy.
It calibrates the users battery and androids Fuel Gauge while he/she is sleeping and it even gives a little to notify the user when his/her device is ready to roll
And basically does all the dirty work for you
It currently has 7 profiles:
Default
A User controlled profile, that's enabled when no other specific profiles are set
Gaming, for the true gamers
Maximized performance and sound quality for the awesome adventures awaiting!
Music, to keep that music playing!
Maximum battery savings, while still maintaining uninterrupted music playback!
Internet, for more fluid surfing the web!
Optimizing memory and internet usage to ensure speedy browsing!
Performance
A basic performance profile to squeeze all the juice out of the users device!
Battery/DeepSleep
Made to keep the users phone running as long as possible!
Multitasking
Made to keep the lags away, while the user switches back n' forth between apps!
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Bloatware removal customized to include unwanted apps from custom ROMs to stock ROMs for many phone brands
All Removed Bloatware will be Backedup if the user wants
The apps you can choose to remove:
General apps:
AudioFx
Apollo
BasicDreams
Browser
Calendar
Camera2
CellBroadcastReciever
CMFileManager
CMHome
CMWallpapers
Dashclock
DSPManager
Eleven
Email
Exchange2
Galaxy4
HoloSpiralWallpaper
LiveWallpapers
MagicSmokeWallpapers
Music
NoiseField
PhaseBeam
PhotoPhase
Phototable
PicoTts
VideoEditor
VisualizationWallpapers
VoicePlus
WhisperPush
SimToolKit
HTMLViewer
cLock Widget
Calculator
NFC Service
Goole apps:
Chrome Browser
Cloud Print
Gmail
Google+
Google Calendar
Google Desk Clock
Google Docs
Google Drive
Google Earth
Google Fitness
Google Keep
Google News & Weather
Google Now Launcher
Google Play Books
Google Play Games
Google Play Movies & TV
Google Play Music
Google Play Newsstand
Google Search
Google Sheets
Google Slides
Google Text-to-Speech
Google Wallet
Hangouts
Maps
Sound Search for Google Play
Street View on Google Maps
TalkBack
YouTube
I'll add explanations what they do later, for now just google them
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
IMAGES
Will be added soon [Hopefully ]
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Thanks to:
- @slaid480 for letting me use his Fly-On mod as a guide on how to write init.d scripts :highfive:
- @amarullz for developing AROMA. With out it, none of the interactive installation would be possible
- @lambgx02 and @Ryuinferno for the Entropy seeder and script
- @BSDgeek_Jake for the awesome Ad and Malware Blocker
- @BlackGunZ for fixed SQlite Vacuum & Reindex and Zipaligner scripts
- @Exit_Only for helping me out a little
- @Shade5
My Tester group:
-
MORE TESTERS NEEDED! If you want to be part of the development, PM me!
Ask before using my work in yours and add proper credits
If you want to make an optimized version for your device, ASK FIRST trough PM
Donations aren't expected, but are appreciated
XDA:DevDB Information
[MOD][TWEAK][SCRIPT] The_Thing V0.9.8 [16/09/2015], Tool/Utility for all devices (see above for details)
Contributors
_Bon_Bon
Source Code: https://github.com/DevBonBon/The_Thing
Version Information
Status: Alpha
Current Stable Version: 0.9.8
Stable Release Date: 2015-09-16
Current Beta Version: 0.9.8
Beta Release Date: 2015-09-16
Created 2015-07-31
Last Updated 2015-11-23
CHANGELOG
Code:
[U]Changelog[/U]
0.9.8
Installer | Fixed some weird bugs and slimmed the code
Installer | Fixed the Backup of Bloatware
Installer | Added and option to disable bloatware backup
Installer | Uninstaller now restores Ad-Block to default
Mod | Moved all the binaries back to /system
Mod | Made some preparations for "Tim"
Mod | Added an bootter script to call The_Thing on boot
Mod | Moved The_Thing, Fixer (And in the future) Tim to /system/bin
The_Thing | Made some fixes and cosmetic changes to the menus
The_Thing | Optimized how the menus work
The_Thing | Merged all the basic tweak scripts into The_Thing
The_Thing | Added the ability to call the different scripts inside The_Thing
The_Thing | Random optimizations to commands and functions, to save space and resources
The_Thing | Removed additional settings menu
The_Thing | Removed Terminal Emulator
Ram Booster | Fixed some values to reduce lag
Smoothie | Random fixes and improvements
Cleaner | Random fixes and improvements
Fixer | Moved the Uninstall Menu from The_Thing to here
Fixer | Added (Finaly!) the ability to manage Bloatware backups
0.9.1
Installer | Menu prop bug fixed (again) and other minor updates and fixes
Installer | Slimmed the package
Installer | Many optimizations to how the changelog is shown
Installer | Optimizations to make the installation more simplistic
Installer | Non-Aroma version now comes with Sqlite script and the Ad-Block
Mod | Fixed problems with binaries
Mod | Made the logging more precise
Mod | Changed all available commands to use busybox, to make the mod more universal
Mod | Cleaned the scripts
Mod | Fixed random things
The_Thing | Made the menus more clean, colorfull on understandable
The_Thing | Cleaned and fixed random things
Fixer | Now removes qrngd from system if it exsist
98_Tweak_Engine | Lots of optimizations and fixes to read-ahead tweaks
Ad-Block | Updated to the 01/09 version by BSDGeek_Jake
0.9
The next build will be the "Tim" update!
Fix | Changed the file format from Windows/Dos to UNIX
Fix | Fixed the user settings, now they're applied inside the scripts rather than in several text files. It's more space and resource conservative
Uninstaller | Small updates and fixes
Installer | Now only works as the bloatware remover and asks if the user wants the mod installed
Installer | Removed the Additional tab
Installer | Introduced .config file compability to the Non-Aroma installer. Currently does nothing, but in the future the user can use it to remove bloatware, like the AROMA installer
Mod | Changed how the whole mod works, now everything is enabled and controlled trough The_Thing
Mod | Added the Fixer script. It can fix some common bugs and problems in the users phone:
Recalibrate the proximity sensor
Recalibrate the battery
More to be added! If you have a idea, let me know!
Swap | Rebuilt inside The_Thing
92_Cleaner | Added the included junk feature! Now user can add additional directories to be cleaned
03_Killer | Fixes and finishing touches
94_Ram_Booster | Fixes and finishing touches to the App lock feature
Removed | Compability to android 2.3 Tell me if you want it back and I'll see what I can do
The_Thing | It's alive! >:D Finished and fixed the whole script:
Moved all the scripts to /data/The_Thing
User can enable/disable scripts runing on boot
Controll all the parts of the mod, for example user can disable audio tweaks if he/she uses other audio enhancers
Add and remove processes killed by the Killer script
Add and remove directories cleaned by the Cleaner script
Add and remove processes locked into memory by the Ram Booster script
Added numbers for easier navigation
Added a terminal emulator
Uninstaller now just uninstalls the whole mod
Scripts can be run manually trough The_Thing or directly trough the terminal
Terminal commands:
Entropy | Entropy_engine script
Killer | Killer script
Fstrimmer | Fstrim script
Smooth | Smoothie script
Cleaner | Cleaner script
Booster | Ram_Booster script
SQOpt | Sqlite_Vacuum_Reindex script
Zipaligner | Zipaligner script
Tweaker | Tweak_Engine
Fixer | Fixer script
So basically the whole MOD operates from /data/The_Thing for easier acces and removal
And (maybe) compability with any other MODs (Not suggested, or supported)
0.8.5
Installer | Finished non-aroma installer
Installer | Cleaned and slimmed the Installer paggage
Installer | Removed aroma uninstall menu
Installer | Fixed app backup
Installer | Fixed fixing the fix of the aroma installer script fix
Uninstaller | Fixes
Fix | Fixed scripts checking user settings wrong
94_Ram_Booster | Added VM tweaks
Mod | Cleaned and slimmed the scripts
Mod | Fixed some typos, if you find more don't be affareid to tell me ;)
0.8
Installer | Changed some text to explain things better
Installer | Renamed post installation menu to additional settings and placed the adblock there
Installer | Slimmed the install backage
Mod | Added The_Thing script, now you can customize mod settings trough it
Mod | Misaclinous other fixes and tweaks
Mod | Added a proper adblock to aroma installer, you can choose from full and tiny (Thanks to BSDGeek_Jake)
Fstrim | Updated trim binary
Fstrim | Now trims preload too
Fstrim | Added customisability, user can choose what gets trimmed and what doesn't
92_Cleaner | Added customisability, user can choose what gets cleaned and what doesn't
92_Cleaner | Minor fixes and updates
03_Killer | Media service Killer now Killer
03_Killer | Added customisability, user can now choose what services to kill, comes with SAFE defaults
Zipaligner | Added customisability, user can choose what directories get aligned
Zipaligner | Trimmed zipaligner code about to 1/3 of the original
94_Ram_Booster | Added customisability, user can choose what gets optimized and what doesn't
94_Ram_Booster | locked home screen app to memory
94_Ram_Booster | Added Kernel Same page merging to ram booster script
98_Tweak_Engine | Added customisability, user can choose what gets optimized and what doesn't
91_Smoothie | Added customisability, user can choose what gets optimized and what doesn't
The_Thing | Removed Entropy_Menu and rebuild it in The_Thing script
0.6
New | Added an uninstaller, supports v0.6 and up
New | Non-Aroma installer
Installer | Removed Samsung removal menu as it wasn't used
0.5
Mod | Cleaned and trimmed the code
Installer | Finished /data/data removal for:
Music (or eleven? I don't know as they're named the same xD)
Cell Broadcast Reciever
CM Filemanager
Whisper Push
PicoTTS
SIM Toolkit
HTML viewer
Browser
AudioFX
Calendar
Camera
Email & Exchange services
cLock
Calculator
NFC Service
CMWalpapers
Black Hole Live Wallpaper
Bubbles Live Wallpaper
Music Visualization Live Wallpaper
Phase Beam Live wallpaper
Holo Spiral
Live Wallpapers
Basic Day Dreams
Photo Phase
Photo Screensavers
All the Google apps below
Installer | Added to google removal menu:
Chrome Browser
Cloud Print
Gmail
Google+ <- No-one likes you >:p
Google Calendar
Google Desk Clock
Google Docs
Google Drive
Google Earth
Google Fitness
Google Keep
Google News & Weather
Google Now Launcher
Google Play Books
Google Play Games
Google Play Movies & TV
Google Play Music
Google Play Newsstand
Google Search
Google Sheets
Google Slides
Google Text-to-Speech
Google Wallet
Hangouts
Maps
Sound Search for Google Play
Street View on Google Maps
TalkBack
YouTube
0.4.6
Entropy_engine | A HUGE thanks to lambgx02 and Ryuinferno for the Entropy seeder and script
Entropy_engine | Fixed and updated Entropy Engine, it should now be more effective and battery friendly
Entropy_engine | Added an Entropy Menu so people can control the Entropy_engine script
Mod | A HUGE-er thanks to BlackGunZ for the SQlite Vacuum & Reindex and Zipaligner scripts
Mod | Fixed:
SQlite Vacuum & Reindex script
Zipaligner script
And so many other typos and errors
0.4.5
Mod | Fixed that "proper" logging
Mod | Fixed some minor bugs
Mod | Added an adblocker *Finaly, yay...*
Mod | Added an Entropy engine
Mod | Added SQLite database optimizer
Mod | Added a Zipalign script
Mod | Added A LOT of I/O & storage Tweaks
Installer | Removed Dalvik-Cache from clean menu, as it has to be cleaned to ensure that Zipalign script works
<b>0.4</b>
92_Cleaner | Optimizations to include more junk
98_Tweak_Engine | Added more general performance tweaks
98_Tweak_Engine | Added more Battery tweaks
98_Tweak_Engine | Added more GPU tweaks
98_Tweak_Engine | Added Audio tweaks
98_Tweak_Engine | Added more I/O tweaks
98_Tweak_Engine | Added calling tweaks
98_Tweak_Engine | Added more internet tweaks
98_Tweak_Engine | Added camera tweaks
Mod | Added a Smoothie script, to make users UI feel lightning fast
Mod | Added a Ram_Booster script, to increase RAM speed and performance
Mod | Added a Media server killer to save battery
Mod | In total added about 1000 lines of tweaking awesomeness
Mod | Included proper logging, so users can see what is going on with my tweaks, all the log as stored at /data/The_Thing/*
Installer | Added prober removing of old files on installation
Installer | Fixed and optimized installation UI to include better navigation
Installer | Redid the bloatware removal menu, to include multiple tabs in preparation of version 0.5
Installer | Added custom icons to installation UI
0.3
Mod | New name: The_Thing
Installer | Added a new tweak menu
Installer | Added the ability to enable/disable swap for cache
Installer | Added a master switch for Bloatware, and tweak menu (It has to be enabled for things to get installed)
Installer | Added some more functionality to installation
Installer | Fixed some typos and text missing from the UI
Installer | Cleaned and fixed stuff you can't see ;)
(a HUGE thanks to @slaid480 for letting me use his Fly-On Mod as a starting point on how to write shell scripts)
Mod | Added a cleaner script
Mod | Added a fstrim script that trims /cache, /data and /system
0.2.3
Installer | Updated to AROMA 3.00b1
Installer | Fixed setting metadata and permissions
Installer | Fixed script not removing /data files, if user didn't run it directly after rom install (still unfinished, but the largest space hoggers are taken care of)
Installer | Made removal menu more organised
Installer | Added SimToolKit, Html Viewer, cClock Widget, Calculator and NFC Service to removable bloatware list
Installer | Added a post installation menu
Installer | Added the ability to clear cache and dalvik during installation
Installer | Added the ability to reboot, reboot to recovery and to exit AROMA
Installer | Added the ability to delete batterystats.bin aka. the ability to calibrate your battery (it's most effective when used at full charge)
Installer | Cleaned up the code
0.2
Installer | Fixed script typos
Installer | Fixed some more script typos
Installer | Basically redid the whole script, because there were so many typos
0.1
- Initial test build
Is there a feature you want me to add? Just tell me what it is and I'll make sure to add it in the next build
Downloads
The_Thing ALPHA 0.9
Version 0.9.8: Click here
Non-Aroma 0.9.8: Click here
Uninstaller
Version 0.9.1: Click here
Non-Aroma 0.9.1 Click here
The_Thing ALPHA 0.8
Version 0.8.5: Click here
Non-Aroma
Version 0.8: Click Here
The_Thing APLHA 0.4
Version 0.4.5: Click Here
Version 0.4: Click Here
The_Thing APLHA 0.3
Version 0.3_Fix: Click Here
Version 0.3: Click Here
The_Thing APLHA 0.2
Version 0.2.3: Click Here
Version 0.2: Click Here
Info about The_Thing MOD
Things to know about The_Thing script:
To access The_Thing, type into terminal:
Code:
su
The_Thing
The_Thing scripts main menu will open.
From there you can continue to change The_Things internal script settings, Tims settings or the additional features.
You can also call The_Thing script using following commands:
Code:
[B]The_Thing -b[/B]
[Calls the script like it would be booting.]
[That means all scripts get executed according to their settings and then the script exits]
[Can't be combined with other commands]
[B]The_Thing -FAST[/B]
[Skips the Loading animation, that might make the script startup longer and is purely cosmetic]
[Can't be combined with other commands]
[B]The_Thing -s[/B]
[Runs the Smoothie scrip and exits]
[Can be combined with other commands]
[B]The_Thing -c[/B]
[Runs the Cleaner scrip and exits]
[Can be combined with other commands]
[B]The_Thing -f[/B]
[Runs the Fstrim scrip and exits]
[Can be combined with other commands]
[B]The_Thing -o[/B]
[Runs the Optimizer scrip and exits]
[Can be combined with other commands]
[B]The_Thing -k[/B]
[Runs the Killer scrip and exits]
[Can be combined with other commands]
[B]The_Thing -t[/B]
[Runs the Tweak Engine scrip and exits]
[Can be combined with other commands]
[B]The_Thing -r[/B]
[Runs the Ram Booster scrip and exits]
[Can be combined with other commands]
The_Things internal script settings
You can type "run" in any scripts settings tab to run it instantly.
Even though you can run all the scripts inside The_Thing, most of the tweaks won't stick.
Thus, to get the full power of this mod, enable run on boot for the script you want and reboot.
After you're done changing script settings, always reboot, so the new settings get applied.
Useful Info
Requirements:
- Android 4.0 or higher.
- Kernel with init.d support.
- Root and newest busyBox version.
- Custom recovery (TWRP is recommended).
- At least 56MB of free space in "/data".
- NEON support to use the AROMA Installer
Otherwise use the Non-Aroma installer
How to install:
Before Flashing please do a backup to avoid any incompatibility issues.
1. Download The_Thing Installer zip
2. Rebooting into recovery
3. Install The_Thing_*.zip
4. Reboot and be amazed by the new found power of your phone!
Frequently asked questions:
Q: Why am I here? (Or some other question that doesn't concern this MOD)
A: Watch this video
Q: What is AROMA?
A: Check Here
Q: Can I use The_Thing with my device?
A: The_Thing works on all Android devices, like Samsung, Sony, HTC, Google and LG with Root, BusyBox and init.d support.
Q: I'm coming from an old version should I uninstall my current version before installing the new one?
A: No, just flash the new version over the old one, the installation package will take care of everything.
Q: I feel very comfortable with my current old stable version, why should I update to a never one?
A: You should always update to the latest stable version, because they contain more improvements and important fixes.
Q: Can I use The_Thing with any other MOD that uses init.d Scripts, Binaries or Tweaks?
A: No you can't, as they might conflict.
Q: Why Isn't this included in the Non-Aroma version, but is in the Aroma one?
A: Sqlite script needs android version specific files to work, so I can't make it work universally. And the Ad-Blocker has different version and isn't for everybody, but You can safely flash the Ad-Blocker on top of my mod from here
Q: Do I need to do something before flashing?
A: No need to, as the installation package does everything.
Q: Do I need to do something after flashing The_Thing?
A: Nope. The script does everything for you
Looks great! Will try.
Help the development!
I need help
I'd like to add more apps to the bloatware removal menu, to make this script more usable to users who have a rooted stock rom.
I need info on what kinds of apps there come preinstalled in different brands of phones, like Samsung, LG and HTC
If you want to help, here's the things you'll need to tell me:
What's the apps /system folder path? Example: /system/app/PhotoTable
What is the apps /data folder path? Example: /data/data/com.cyanogenmod.wallpapers
From what phone brand is it from?
Thank you! :victory:
Cam this be used with SlimLP _Bon_Bon
sorry i've just read the bit i needed that i missed
Corduroysack said:
Cam this be used with SlimLP _Bon_Bon
sorry i've just read the bit i needed that i missed
Click to expand...
Click to collapse
Yeah! It works on all ROMs and on all phones, as said in the third post
Edit-
And I just understood what you said there
Just as I posted I looked back up thread and there it was ?
thanks ☺
do you have to apply the build props tweaks or there's no need with this script
demeus said:
do you have to apply the build props tweaks or there's no need with this script
Click to expand...
Click to collapse
No, the script applies them on boot, so you don't have to do anything after installation
Nice.
Will try it soon. Keep it up.
Sent from my SlimLP S4 Rom
i was trying to install the latest version of the mod but when in recovery shows "Starting AROMA INSTALLER" the recovery freeze and i have to pull off the battery ( same result with cwm and twrp )
Version 0.4.5 is out!
Changes
- Fixed that "proper" logging
- Fixed some minor bugs
- Added an adblocker *Finaly, yay...*
- Added an Entropy engine
- Added SQLite database optimizer
- Added a Zipalign script
- Removed Dalvik-Cache from clean menu, as it has to be cleaned to ensure that Zipalign script works
- Added A LOT of I/O & storage Tweaks
- Made some preparations for the next version *HYPE*
Check the download from here
tutibreaker said:
i was trying to install the latest version of the mod but when in recovery shows "Starting AROMA INSTALLER" the recovery freeze and i have to pull off the battery ( same result with cwm and twrp )
Click to expand...
Click to collapse
What recovery version are you using? As I'm on the latest TWRP and don't have any problems
Also what phone do you have?
And try the new 0.4.5 and see if the problem persists
_Bon_Bon said:
What recovery version are you using? As I'm on the latest TWRP and don't have any problems
Also what phone do you have?
And try the new 0.4.5 and see if the problem persists
Click to expand...
Click to collapse
i have a galaxy grand prime with twrp 2.8.4.0 ( the only avalaible ) i see the problem is my recovery
tutibreaker said:
i have a galaxy grand prime with twrp 2.8.4.0 ( the only avalaible ) i see the problem is my recovery
Click to expand...
Click to collapse
That's weird, your recovery should work :/
I'm sorry for the inconvenience and I'll make an AROMA free version of this MOD in the next few days so everyone can use it :good:
This is why I need testers
That new version I posted a moment agois broken. The Entropy_Engine, Zipaligner and SQlite scripts don't work
Sorry for the inconvenience I'll take a look at it later. Don't worry, they do no harm to you phone, they just... are...
Sorry again :/
_Bon_Bon said:
This is why I need testers
That new version I posted a moment agois broken. The Entropy_Engine, Zipaligner and SQlite scripts don't work
Sorry for the inconvenience I'll take a look at it later. Don't worry, they do no harm to you phone, they just... are...
Sorry again :/
Click to expand...
Click to collapse
I will give a look tomorrow and try to help you with those issues.
Sorry, I'll finish the new 0.4.6 update later (Maybe tomorrow), because I need some time off this project
After all this is a hobby for me and currently I'm not enjoying the coding anymore
Don't worry I'll come back soon enough, with more awesome updates and energy
_Bon_Bon said:
This is why I need testers
That new version I posted a moment agois broken. The Entropy_Engine, Zipaligner and SQlite scripts don't work
Sorry for the inconvenience I'll take a look at it later. Don't worry, they do no harm to you phone, they just... are...
Sorry again :/
Click to expand...
Click to collapse
Hello ! I tried to fix your scripts and they work normally. I didn't find a fix for the Entropy Engine, I will do researches about it later. Just in case, test them and tell me the results !
Fixed SQlite script :
Code:
#!/system/bin/sh
# "THE THING" also know as "TIM"
# (c) 2015 - By [email protected]
#
# insert some useless info [HERE]
# and [HERE] ;P
TIM=/data/The_Thing/Sqlite_Vacuum&Reindex.log
# Interval between SQLite3 runs, in seconds, 172800=48 hours
RUN_EVERY=172800
if [ -e $TIM ]; then
LASTRUN=`stat -t $The_Thing | awk '{print $14}'`
else
LASTRUN=0
fi;
CURRDATE=`date +%s`
INTERVAL=$(expr $CURRDATE - $LASTRUN)
if [ $INTERVAL -gt $RUN_EVERY ];
then
if [ -e $TIM ]; then
rm $TIM;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $TIM;
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $TIM;
fi;[/hide]
Fixed zipalign script :
Code:
#!/system/bin/sh
# "THE THING" also know as "TIM"
# (c) 2015 - By [email protected]
#
# insert some useless info [HERE]
# and [HERE] ;P
TIM=/data/The_Thing/Zipaligner.log
ZIPALIGNDB=/data/zipalign.db
RUN_EVERY=86400
if [ -e $TIM ]; then
rm $TIM;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
echo "Started Zipalign at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $TIM;
#-- Zipaling /data
echo "Zipaligning /data" | tee -a $TIM;
for DIR in /data/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $TIM;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $TIM;
/system/xbin/zipalign -f 4 $APK /data/local/$APK;
rc = "$?";
if [ $rc -eq 0 ]; then
if [ -e "/data/local/$APK" ]; then
cp -f -p "/data/local/$APK" "$APK" | tee -a $TIM;
rm -f "/data/local/$APK";
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "ZipAligning $APK Failed (no output file)" | tee -a $TIM;
fi;
else
[ -f "/data/local/$APK" ] && rm -f "/data/local/$APK"
echo "ZipAligning $APK Failed (rc: $rc)" | tee -a $TIM;
fi;
else
echo "Already aligned: $DIR/$APK" | tee -a $TIM;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
#-- Zipalign /system
echo "Zipaligning /system" | tee -a $TIM;
for DIR in /system/app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $TIM;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $TIM;
/system/xbin/zipalign -f 4 $APK /data/local/$APK;
rc = "$?";
if [ $rc -eq 0 ]; then
if [ -e "/data/local/$APK" ]; then
cp -f -p "/data/local/$APK" "$APK" | tee -a $TIM;
rm -f "/data/local/$APK";
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "ZipAligning $APK Failed (no output file)" | tee -a $TIM;
fi;
else
[ -f "/data/local/$APK" ] && rm -f "/data/local/$APK"
echo "ZipAligning $APK Failed (rc: $rc)" | tee -a $TIM;
fi;
else
echo "Already aligned: $DIR/$APK" | tee -a $TIM;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
for DIR in /system/priv-app; do
cd $DIR;
for APK in *.apk; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ]; then
echo "Already checked: $DIR/$APK" | tee -a $TIM;
else
ZIPCHECK=`/system/xbin/zipalign -c -v 4 $APK | grep FAILED | wc -l`;
if [ $ZIPCHECK == "1" ]; then
echo "Now aligning: $DIR/$APK" | tee -a $TIM;
/system/xbin/zipalign -f 4 $APK /data/local/$APK;
rc = "$?";
if [ $rc -eq 0 ]; then
if [ -e "/data/local/$APK" ]; then
cp -f -p "/data/local/$APK" "$APK" | tee -a $TIM;
rm -f "/data/local/$APK";
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
else
echo "ZipAligning $APK Failed (no output file)" | tee -a $TIM;
fi;
else
[ -f "/data/local/$APK" ] && rm -f "/data/local/$APK"
echo "ZipAligning $APK Failed (rc: $rc)" | tee -a $TIM;
fi;
else
echo "Already aligned: $DIR/$APK" | tee -a $TIM;
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB;
fi;
fi;
done;
done;
touch $ZIPALIGNDB;
echo "Zipaligning finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $TIM;