[GUIDE][ROOT]Reduce LAGS At Realtime - Android General

Hi Guys, Im Here To Share You My Guide About Reducing Lag At Realtime. But First Heres The Requirements
Note: Use This If You Dont Have Battery Issues. This Method Is Only For Gaming And Multitasking.
Requirements
-An Android Device Running With 4.0.x And Above(Not Sure If Will Work On GB)
-Root Permission
-Busybox Stable Build(Higher Version Is Recommended)
-Terminal Emulator Or Script Manager App From Play Store
-A Custom Recovery Like ClockWorkMod Or Team Win Recovery Project
-Droidedit App From Play Store
Click to expand...
Click to collapse
Instructions
1. Reboot To Recovery Mode
2. Backup Your Device Using Recovery
3. After Backing Up Your Phone, Open DroidEdit App From App Drawer
4. Write The Following Line On DroidEdit App:
Code:
#!/system/bin/sh
mount -o rw,remount /system 2>/dev/null
mount -o rw,remount rootfs 2>/dev/null
mount -o rw,remount / 2>/dev/null
cat >> /system/bin/kill_lag <<EOF
#!/system/bin/sh
# Lag Reducer
while true; do
echo 3 >> /proc/sys/vm/drop_caches;
sleep 2
echo 2 >> /proc/sys/vm/drop_caches;
done;
EOF
chmod 755 /system/bin/kill_lag 2>/dev/null
chown 0:0 /system/bin/kill_lag 2>/dev/null
nohup /system/bin/kill_lag &
exit 0
5. Save It At The Root Of Your Sdcard Then Named It As kill_lag.sh
6. Open Script Manager App
7. Find The kill_lag.sh at /sdcard
8. Tap kill_lag.sh Then Tap Su Icon, Last, Tap Run
9. Wait Then Done
Click to expand...
Click to collapse
Compatibility
This Method Will Work On Any Android Device Unless You Have Root
Note
To All Users, Dont Copy This Guide With Out My Permission.
Thanks To
-Busybox Developers For BusyBox
-All Devs Here At XDA And Also You, Users
-Unix

Setting drop_caches to 3 then back to 2 to free pagecache is a bit of a myth.
It will obviously free some RAM, but it will also spike up the CPU because there's a load as cache is being rebuilt. Ideally drop_cache doesn't need to played with, or at least not a lot (once a day?) otherwise you're just going to trade the false sense of "performance" for battery life.

Related

If there anyone know how to root 4.5.629 ?

This is the new OTA update of droid 2 global.
winoz said:
This is the new OTA update of droid 2 global.
Click to expand...
Click to collapse
No known official root method is out at the moment. In the meantime you can try SuperOneClick or MotoFail
Seemingly does not work, but to no avail motofail
so I m guessing you HAD root, and lost it after updating? Can you confirm this?
More Info
I can confirm that. I had root and now, after receiving the update this morning, I do not.
I opened Superuser, entered Preferences, and scrolled down to the General section to tap on Su binary to check for updates (or even reapply my current binary, which is v3.0.3.2). Since my version is the latest version I clicked the button Update anyway. Superuser reports the following:
This updater cannot update the su binary on phones that have some kind of write protection on the system partition like S-ON. You can continue to use Superuser with your outdated binary, or update su with ROM Manager.
Click to expand...
Click to collapse
I tried Pete's Motorola Root Tools (v1.06) to see if I could re-root, but no joy. Step three (the step that adds su, busybox and superuser) fails with the following message:
ERROR: adb could not be granted root access via local.prop method
Try again from the start, but if the problem continues, check your version of Gingerbread -- hopefully you don't have a version where this exploit was fixed.
Click to expand...
Click to collapse
It seems like perhaps the exploit has been patched. Here is the log from Pete's Tools at that point:
Code:
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> if [ -e /data/local/12m.bak ];
> then
> rm /data/local/12m.bak
> fi
> exit
> exit
$ su
rm /data/local/12m.bak
$ /system/xbin/su
fi
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ if [ -e /data/local/12m.bak ];
> then
> rm /data/local/12m.bak
> fi
$ exit
$ exit
$ exit
(success)
> mv /data/local/12m /data/local/12m.bak
(success)
> ln -s /data /data/local/12m
(success)
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> if [ -e /data/local/12m ];
> then
> rm /data/local/12m
> fi
> exit
> exit
$ su
$ /system/xbin/su
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ if [ -e /data/local/12m ];
> then
> rm /data/local/12m
> fi
$ exit
$ exit
$ exit
(success)
> mv /data/local/12m.bak /data/local/12m
(success)
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> if [ -e /data/local.prop.bak ];
> then
> rm /data/local.prop.bak
> fi
> exit
> exit
$ su
$ /system/xbin/su
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ if [ -e /data/local.prop.bak ];
> then
> rm /data/local.prop.bak
> fi
$ exit
$ exit
$ exit
(success)
> mv /data/local.prop /data/local.prop.bak
> echo "ro.sys.atvc_allow_netmon_usb=0" > /data/local.prop
> echo "ro.sys.atvc_allow_netmon_ih=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_res_core=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_res_panic=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_all_adb=1" >> /data/local.prop
> echo "ro.sys.atvc_allow_all_core=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_efem=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_bp_log=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_ap_mot_log=0" >> /data/local.prop
> echo "ro.sys.atvc_allow_gki_log=0" >> /data/local.prop
$ mv /data/local.prop /data/local.prop.bak
failed on '/data/local.prop' - Permission denied
$ echo "ro.sys.atvc_allow_netmon_usb=0" > /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_netmon_ih=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_res_core=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_res_panic=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_all_adb=1" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_all_core=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_efem=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_bp_log=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_ap_mot_log=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ echo "ro.sys.atvc_allow_gki_log=0" >> /data/local.prop
cannot create /data/local.prop: permission denied
$ exit
(success)
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> if [ -e /system/bin/su ];
> then
> rm /system/bin/su
> fi
> exit
> exit
$ su
$ /system/xbin/su
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ if [ -e /system/bin/su ];
> then
> rm /system/bin/su
> fi
$ exit
$ exit
$ exit
(success)
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> if [ -e /system/sbin/su ];
> then
> rm /system/sbin/su
> fi
> exit
> exit
$ su
$ /system/xbin/su
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ if [ -e /system/sbin/su ];
> then
> rm /system/sbin/su
> fi
$ exit
$ exit
$ exit
(success)
> su
> /system/xbin/su
> mount -o remount,rw /dev/block/mtdblock3 /system
> exit
> exit
$ su
$ /system/xbin/su
$ mount -o remount,rw /dev/block/mtdblock3 /system
mount: Operation not permitted
$ exit
$ exit
$ exit
(success)
Anybody have any other ideas?
The phone is asking constantly to update. It just releases a timer that, if you are not watching it, will update without user consent. I disabled background data to no avail.
Is there any way to block the phone from installing the OTA automatically? I really prefer having root than to update.
XT311 3.2.4 Almost cracked it !! ??
I'm New around here and would love to get this sorted for the XT311. I got mine today and spent 6hrs trying all sorts.. Im a unix boy.... Old school and kinda liked getting back into it.. Ok i have some info
''The ro.sys.atvc_allow_all_adb property is a Motorola-specific configuration that prevents ADB from dropping its root privileges. Reboot the device one final time, and on logging in with “adb shell”, you should be presented with a root prompt''
Is this specific param our problem on Motorola device and not completing for all the same reasons.. All these root tools are failaing over the same lame Mount issue...
Im on SuperOneClick and the Exploit Pluggin for Motofail lol...
Hope we get the 311 rooted again soon.... those infamous Jap files are hard to track .....
barbaroja said:
Is there any way to block the phone from installing the OTA automatically? I really prefer having root than to update.
Click to expand...
Click to collapse
The list of files responsible for OTA updates:
/system/app/BlurUpdater_VZW.apk
/system/app/BlurUpdater_VZW.odex
/system/etc/security/otacerts.zip
Got it rooted !!
Model: Moto XT311
Ver: UK Motorola 'Fire'
Running: v2.3.4
Kernel: Apps_2.6.32.9
Build Number: 4_40C_4067
Here is how i did it to the letter... Even at times i questioned the sequence but it worked.. These instructions are formulated from various sources.. Before you begin unzip the main Zip file I have uploaded and then unzip all the contained zips to one folder. Call the folder Root and put it on your main drive ie(C:/). Ensure that the infamous FXX_PR3_NV.xml is in the root folder..
INSTRUCTIONS:-
Before Rooting:
Prepare your phone by doing the following:
- Go to Settings > Applications > CHECK "Unknown Sources"
- Go to Settings > Applications > Developer > CHECK "USB Debugging" and "Stay Awake"
- Connect your phone via USB, when prompted DO NOT select USB Mass Storage.
1. download and UN-compress all files. on your phone, choose application setting->development->enable "USB debugging", then connect your phone with your pc with USB cable and install driver automatically.
2. install SUT1.75 & RSD LiTE by Motorola which include drivers.
3. Run SUT1.75, choose FXX_PR3_NV.xml. Make sure you select file open option XML from drop down in file open menu.
4. Run cmd > adb shell (if your ROOT folder is located in c:\, then change directly to c:\ROOT, type adb shell), wait untill "#" appear, then you can minimise the cmd window.
5. Open RootD3 folder, run RootD3_zhCN.cmd,
Phone will reboot 3 times. After the 1st reboot, please check if the 2nd reboot starts automatically, if not, unplug the USB cable and plug it again, Goto step 5 again and complete when the 3rd reboot is done.
6. Go into SuperOneClick folder, run SuperOneClick.exe, press Root.
Force a connection with USB drivers. The software will automaticaly do this. The program will now executed and run with NO ERRORS.
After it says it is completed, check if you have the Skull Android icon ( Get SUuperUser APP) Now look in the menu, if Confirmed, your phone has been rooted.
I can't upload any files or provide links as im new round here..
I HAVE ALL FILES/SOFTWARE NEEDED FOR THIS PROCEDURE !!!
79.5 MB (83,442,583 bytes)..
BrB in next few ours with a link up to the DL Locations..
Hack build.prop
I'm trying to prevent this update OTA currently.
Is there a way to modify build.prop to trick the phone in to thinking it has already been updated?
Perhaps if someone who has had the update can post their build.prop we can figure out which properties have changed.
If you edit build.prop phone cant update. All i did was change 0 to 1 so I can have 5 bars for gsm signal and it didn't want to finish the update.
Maybe matie... This is my next job on my XT311 before i plug it into the web..
I found this may be of some use..
down vote accepted
TO STOP AUTO UPDATES
Remove SystemUpdater.apk from /system/app. From terminal (with ADB)
Code:
adb pull /system/app/SystemUpdater.apk C:/Path/to/your/desktop //Backup the file (just in case)
adb remount //Remount the system partition to read-write
adb shell rm /system/app/SystemUpdater.apk //Remove the apk
Warning - this will permanently disable system updates, until you push SystemUpdater back to /system/app
OR If your running different motorola look in the app for Updaters
Code:
adb pull /system/app/Upgrader.apk C:/Path/to/your/desktop //Backup the file (just in case)
adb remount //Remount the system partition to read-write
adb shell rm /system/app/Upgrader.apk //Remove the apk
This is MotoIII example..
Hope this helps....
Well I figured myself how to prevent the phone from upgrading. In fact it was easy.
1. You need titanium backup.
2. Freeze "upgrader" app.
3. Wipe its data. If you do not wipe, the order remains alive (in my case it already had started to download) and is taken by the downloader and it will continue to download and update the phone.
Thats it. Hope it helps.
It seems its similar to the solution above, only without involving adb.
UberSteiner said:
Got it rooted !!
Model: Moto XT311
Ver: UK Motorola 'Fire'
Running: v2.3.4
Kernel: Apps_2.6.32.9
Build Number: 4_40C_4067
Click to expand...
Click to collapse
Do you realise that you're in the DROID2 GLOBAL forum section?
Super One Click root method does not work for 4.5.629.
Rootkeeper
Just tested this. Install voodoo rootkeeper from market before updating. Root seems to work so far.
bummer that there's no way to SBF back. My device auto-updated on me.
i'm assuming that none of this matters if you're on a different rom. i'm using miui so my phone won't auto update right?
Custom ROMs naturally do not support VZW's OTA update mechanism as they're incompatible.
Stock ROM with /system/app/BlurUpdater_VZW.apk renamed also doesn't.
Stock ROM with CWM installed or bloatware frozen is incompatible with the update, however the phone will download and try to install it, only to fail and repeat that again 2 hours later.
Tried freezing 'Upgrader'
I tried freezing 'Upgrader' from titanium backup and wiping the data - this did not work for me.
The update was still downloaded. It has, however, not yet been installed.
Can anyone help me to
1. remove the download before it installs.
2. block this OTA upgrade after removal
I'd appreciate the help to prevent this thing from being unrooted.
Thanks
The update is downloaded to /cache. You can delete it from there.
To disable automatic updates, rename the following files:
/system/app/BlurUpdater_VZW.apk
/system/app/BlurUpdater_VZW.odex
/system/etc/security/otacerts.zip
by adding .bak on the end of their names.

[Enable Cron for Android Phones]

# What is Cron ?
Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.
Examples :
The following line specifies that the amazing V6 Supercharger flush script execute every 3 hours of every day of the month, of every day of the week :
0 */3 * * * /system/xbin/flush
The following line causes the user program /data/jitter.sh to be run at 1am, 6pm and 11pm :
0 1,18,23 * * * /data/jitter.sh
# What is this thread about ?
This thread created just to share my little knowledge to activate crond in android phones, which could be usefull as additional tweak for our android phones.
# Disclaimer
Do this at your own risk - Ensure you understand that you are assuming all risks and there may also be other adverse effects. If you do not want to bear the risk, Please don't continue.
# Tested Device
- Galaxy Wonder GT-I8150 Stock ROM GB 2.3.6
- Lenovo S880 Stock ROM ICS 4.0.3
- Lenovo A560 Stock ROM ICS 4.0.3
# Requirement
1. Device is rooted, search Here howto root.
2. Already enable init.d, read Here howto enable init.d.
# Howto Install
1. Download SP8-CRON_v2.zip
2. Extract the Zip file to your SD card ( Install.sh & SP8CRON), for example in /mnt/sdcard.
*** Installation Method ***
Using ADB :
1. Connect to phone using adb, then run su.
2. go to extraction directory, example cd /mnt/sdcard
3. run this command : sh Install.sh
4. Installation script will begin and automatically reboot your phone when finish.
Using Script Manager :
1. Install Script manager.
2. Run Script manager, choose "Browse as Root".
3. Go to extraction directory, tap : Install.sh file , then tap : enable su (skull icon).
4. Installation script will begin and automatically reboot your phone when finish.
# Howto IUse
To modify cron schedule to meet your needs, please modify cron file at : /data/cronjob/root
(Examples above)
To check whether crond is running or not :
from ADB or Script Manager Console :
1. Run : su
2. Run :
pgrep -l crond , System will respon with showing pid number.
... and ...
crontab -l , System will list cron schedule list.
Thanks for reading this simple thread, Please hit Thanks if you found this thread is usefull
Changes :
V1 - Script on data folder and add logs.
V2 - Modify script to run on system folder, add Amazing V6 Supercharger flush and sclean script to schedule
-[spikecursed]-
Code:
# Mounting root
busybox mount -o remount,rw rootfs / 2>/dev/null;
ln -s /system/bin/ /bin 2>/dev/null;
mkdir -p /var/spool/cron/crontabs 2>/dev/null;
ln -s /system/etc/cron.d/root /var/spool/cron/crontabs/root 2>/dev/null;
busybox mount -o remount,ro rootfs / 2>/dev/null;
This is messing up my "internal sd card" so I am trying to set the path in the cron file instead but PATH=/system/bin isn't doing it, anyone know how to achieve this?
I have used the script and it's work great! Thank you very much.
I am writing this for any person having same problem as me.
I was struggle finding the real path for cron script.
The command crontab -e leads me to the incorrect path, the real and origin is at "/system/etc/cron.d/root".
We have to mount /system first with "mount -o remount,rw /system".
Then edit "/system/etc/cron.d/root" for cron script.
Don't forget to mount back /system as read-only with "mount -o remount,rw /system".

[TWEAK] [ROOT] mDNIe screen sharpness tweak

If in file "sys/class/mdnie/scenario" in first byte replace 0 to 1 or 2 or 3 or 4 screen sharpness is increasing (1 more sharp.........4 less sharp.).
my taste
I have tryed 2 and 3. My taste is 3 perfect
is this safe
zeyadhan said:
is this safe
Click to expand...
Click to collapse
Absolutely. I like 3.
alexhc18 said:
Absolutely. I like 3.
Click to expand...
Click to collapse
yeah 3 is nice.But it resets to zero every time I change wallpaper.
any way to make it permanent .
alexhc18 said:
If in file "sys/class/mdnie/scenario" in first byte replace 0 to 1 or 2 or 3 or 4 screen sharpness is increasing (1 more sharp.........4 less sharp.).
Click to expand...
Click to collapse
For some reason, I can never get this to work. When I try to make the changes by navigating to sys/class/mdnie, there's another folder/shortcut that takes me to another minor folder. In there, I see the scenario file and quite a few others. It even has text and no single digit (like my note 2 did) further more, any changes I make to the scenario file never stick. Maybe the T-Mobile US version is different?
When I reboot will the value reset itself? And do I need reboot after changing the value? I'm confused hmm.
RE: OK I figured out the thing that I asked. (I had no time to try those when I asked.)
1) No need to reboot after editing.
2) After reboot you have to re-do it.
Sent from my SM-N900 using XDA Premium HD app
3 looks bad ass. Use root explorer. Its what I used and changed the value easily.
so 0 value is the most sharpness ?
right ?
Sent from my SM-N900 using XDA Premium 4 mobile app
Is there anyway to make it permanent? Rather than redoing anytime when power off or reset. .w
garykcliu said:
Is there anyway to make it permanent? Rather than redoing anytime when power off or reset. .w
Click to expand...
Click to collapse
Make init.d support on mobile and create file "00mdnie" in folder "etc/init.d" with this inside:
#!/system/bin/sh
echo 3 > /sys/class/mdnie/mdnie/scenario
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
Or type in "terminal emulator" : echo 3 > /sys/class/mdnie/mdnie/scenario
Apps camera and gallery resets this to default 0
alexhc18 said:
Make init.d support on mobile and create file "00mdnie" in folder "etc/init.d" with this inside:
#!/system/bin/sh
echo 3 > /sys/class/mdnie/mdnie/scenario
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
Or type in "terminal emulator" : echo 3 > /sys/class/mdnie/mdnie/scenario
Apps camera and gallery resets this to default 0
Click to expand...
Click to collapse
I just followed your guide but still cannot make it work as well.
Perhaps it is too technical for me but anyway thanks so much for your assistance.
By the way, is it possible to make a flashable zip so that we can flash on CWM?
Thank you
garykcliu said:
I just followed your guide but still cannot make it work as well.
Perhaps it is too technical for me but anyway thanks so much for your assistance.
By the way, is it possible to make a flashable zip so that we can flash on CWM?
Thank you
Click to expand...
Click to collapse
First you need busybox. Install this by Stericson: https://play.google.com/store/apps/details?id=stericson.busybox
reboot after installing. Open busybox, use "normal install" method to "system/bin", don't use "smart install".
Then CWM install this:
View attachment zip_init.zip by Ryuinferno
alexhc18 said:
Make init.d support on mobile and create file "00mdnie" in folder "etc/init.d" with this inside:
#!/system/bin/sh
echo 3 > /sys/class/mdnie/mdnie/scenario
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
Or type in "terminal emulator" : echo 3 > /sys/class/mdnie/mdnie/scenario
Apps camera and gallery resets this to default 0
Click to expand...
Click to collapse
#!/system/bin/sh
#Replace the number down here with what you want
VAL=`3`
#init.d commands (optional)
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
#auto check commands
while [ 1 ]
do
VAL1=`cat /sys/class/mdnie/mdnie/scenario`
if [ "$VAL1" != "$VAL" ]
then
echo "$VAL" > /sys/class/mdnie/mdnie/scenario
fi
sleep 1
done
iba21 said:
#!/system/bin/sh
#Replace the number down here with what you want
VAL=`3`
#init.d commands (optional)
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
#auto check commands
while [ 1 ]
do
VAL1=`cat /sys/class/mdnie/mdnie/scenario`
if [ "$VAL1" != "$VAL" ]
then
echo "$VAL" > /sys/class/mdnie/mdnie/scenario
fi
sleep 1
done
Click to expand...
Click to collapse
Unfortunately no matter how hard I tried, I still cannot get it worked.
I have no other alternative but to give up.
Anyway thanks so much for your advice.
You need a rom witch has the init.d script.. or busybox and create the init.d folder + putting the correct permissions
And sure.. you have to create a script witch contains that code
iba21 said:
You need a rom witch has the init.d script.. or busybox and create the init.d folder + putting the correct permissions
And sure.. you have to create a script witch contains that code
Click to expand...
Click to collapse
This is what I have done...I have enabled the init.d support and then go into the etc/init.d folder to create a file '00mdnie' without extension which contains the codes:
------
#!/system/bin/sh
echo 3 > /sys/class/mdnie/mdnie/scenario
busybox mount -o remount,rw -t auto /system;
busybox chmod -R 777 /system/etc/init.d;
busybox mount -o remount,ro -t auto /system;
------
However every time when I shut down or reboot the N900 and then it will automatically reset to 0 and could you please advise when went wrong with the procedures that I am doing.
Thank you so much.
You have to put what i wrote.. all codes
tried that in CM11 4.4.2, manual setting scenario works but its uncomfortable to change it everytime it resets. pasting your code into init.d makes no difference... any ideas? i love sharpness tweaks but don't want to change kernel now so....
Script init.d
00mdnie
Code:
#!/system/bin/sh
# By @criskelo - CriskeloRoms
# Mod By @alexhc18
chmod 777 /sys/class/mdnie/mdnie/scenario
echo 1 > /sys/class/mdnie/mdnie/scenario
chmod 555 /sys/class/mdnie/mdnie/scenario
This prevents the gallery or camera changes the value to 0
:good:
Edit:
chmod 555 /sys/class/mdnie/mdnie/scenario
Read only and execution
Do not write
Edit:
ATTACHED FILES
All in one
Only install by CWM
ADD in your rom
screen sharpness 1
Support-Init.d

[MOD][SCRIPTS] Boot Script Utilities

About this thread
In this thread i will post my work on a init.d like support for stock rom which i call "Boot Script Utilities".
This work was developed for personal use and for my personal purposes.
If you do not like to use it please do not.
Click to expand...
Click to collapse
Just to be clear
I am not responsible for whatever happens to your phone.
Some Info
What is init.d?
Init.d is a folder located in "/system/etc/init.d/", but not all roms have his folder (stock rom don't have the folder).
What is special with this folder is that any script inside this folder will run on phone boot.
Why to run scripts on boot?
On boot many system variables are initiated before any application run, so you can make automatic tweaks on every boot.
ex. Swap external storage to internal.
Click to expand...
Click to collapse
Boot Script Utilities on stock Samsung Galaxy Core
This was developed for personal use. This is not the original init.d support.
I developed a similar support in order to implement some more features.
This do not means that this is a better way to roon scripts on boot.
What do i need?
A rooted Samsung Galaxy Core (I used I8260, for how to root search the forum)
A good root explorer (well Root Explorer worked)
A recovery with backup/restore support (to backup your rom in case you soft brick your phone)
What we will do?
We will edit a system file to run a script i wrote. This script will run all scripts (or not all read more below) inside /system/etc/init.d/ folder.
Step 0 - Backup your rom
Boot into your recovery and make a backup.
Step 1 - init.d folder
Create a directory on "/system/etc/" and name it "init.d".
So now directory "/system/etc/init.d/" exist.
Step 2 - Boot Script Utilities main script
Copy "init.bsu.boot.sh" file (link on the end of the post) in "/system/etc/".
So now file "/system/etc/init.bsu.boot.sh" exist.
Step 3 - Edit system file, run Boot Script Utilities
The system file we will edit is "/system/etc/init.qcom.post_boot.sh"
Insert this code on the bottom of the script
Code:
# Run Boot Script Utilities
# For galaxy core stock rom
# by DarkThanos
/system/bin/sh /system/etc/init.bsu.boot.sh > /data/tmp/init.bsu.log 2>&1 &
Step 4 - Ready
Insert your scripts inside "/system/etc/init.d/" and whey will run on boot.
Click to expand...
Click to collapse
Boot Script Utilities features
Disable all scripts
If file "/system/etc/init.d/disabled" exist no script will run.
Disable scripts
Any script named like "*.disabled" or "*.disabled.sh" will not run.
ex. "/system/etc/init.d/testscript.disabled.sh" will not run.
Run scripts asynchronous
Any script named like "*.async" or "*.async.sh" will run asynchronous.
ex. "/system/etc/init.d/testscript.async.sh" will run asynchronous.
Scripts run order
Scripts run in name order.
Log on every boot
All scripts results-errors output (stdout/stderr) will be printed on "/data/tmp/init.bsu.log"
Click to expand...
Click to collapse
[Change log]
1.0 Version
Script Public for first time.
init.d like support
Click to expand...
Click to collapse
[Dev Doc]
It does not really matters from where the script is called.
The script first checks if boot is completed, if not it sleeps for 2 seconds.
(so you need to call the script after boot, or before but asynchronous)
Code:
# Get boot complete state
isBootCompleted=`getprop dev.bootcomplete`
# Wait For boot complete event
# Probably useless unless script called from other file
while [ "$isBootCompleted" -ne '1' ]
do
# Wait and check again
sleep 2
# Check if boot completed
isBootCompleted=`getprop dev.bootcomplete`
done
The next step is to check if "/system/etc/init.d/disabled" file exist.
If it do not exist, it will run all not disabled scripts inside "/system/etc/init.d/".
It will check every file inside and analyze its name so it knows if the script is disabled or asynchronous.
Code:
# Create a init.d Support
# Implement /system/etc/init.d/ folder
# Check if init.d is disabled
# If /system/etc/init.d/disabled file exist, then init.d is disabled
if [[ ! -f /system/etc/init.d/disabled ]]
then
echo "[$manager_name] Initiating init.d scripts"
# Run every script on init.d folder
for scriptfile in /system/etc/init.d/*
do
if test -f "$scriptfile"
then
# Get script name
scriptname=$(basename $scriptfile)
# Check if script is disabled
# ex1 : 'testscript.sh.disabled' is disabled
# ex1 : 'testscript.disabled.sh' is disabled
echo "$scriptname" | grep -q -E '\.(disabled|disable\.sh)$'
if [ $? -eq 0 ]
then
echo "[$manager_name] Script $scriptname is disabled"
else
# check if script is asynchronous
# ex1 : 'testscript.sh.async' is asynchronous
# ex2 : 'testscript.async.sh' is asynchronous
echo "$scriptname" | grep -q -E '\.(async|async\.sh)$'
if [ $? -eq 0 ]
then
echo "[$manager_name] Run Script $scriptname asynchronous"
/system/bin/sh "$scriptfile" | script_log &
else
echo "[$manager_name] Run Script $scriptname"
/system/bin/sh "$scriptfile" | script_log
fi
fi
fi
done
else
echo '[$manager_name] init.d is disabled'
fi
That's all.
Please suggest any fixes or any improvements by messaging me.
Thanks for your time.
Click to expand...
Click to collapse
All Scripts
Links to all scripts posts
Optimize apks using ZipAlign
Optimize SQlite databases of apps
Swap External SD with Internal SD
Click to expand...
Click to collapse
[Script][Swap External SD with Internal SD][v1.0]
Name : Swap External SD with Internal SD
Version : v1.0
Author : DarkThanos
Thanks to: codlab
Click to expand...
Click to collapse
This script wait for your external sd card to be mounted and swap it with internal if it is bigger.
One minute after boot it will stop waiting.
(Fastest swap method I found)
I am not responsible for whatever happens to your phone.
Tested on my Samsung Galaxy Core (I8260)
[Change log]
1.0 Version
Script Public for first time.
Swap internal sd with external (if external>internal)
Click to expand...
Click to collapse
[Dev Doc]
The script first creates 2 directories to mount external sd and internal sd,
so that it can distinguish them from each other ("/data/sd_cards/internal/", "/data/sd_cards/external/").
Code:
# Mount root rw
mount -o remount,rw /
# Create directory to mount sd cards
# Make directory to save cards
mkdir -p /data/sd_cards
# Make directory to save internal
mkdir -p /data/sd_cards/internal
# Make directory to save external
mkdir -p /data/sd_cards/external
In the next step, the script waits for an external sd to be mounted.
This wait time is the reason why the script is better to be asynchronous.
The script checks every 5 seconds for an external sd, but after 1 minute (12 tries) it stops.
Code:
# Wait for external sd card to be mounted
# Max wait time is 1 minute
maxWaitTime=60
# While external Sd Card has 0 Capacity
while [[ $(du -s /storage/extSdCard | awk '{print $1}') == "0" && $maxWaitTime>0 ]]
do
# Check again in 5 seconds
sleep 5
# Count down max wait time
maxWaitTime=maxWaitTime-5
done
As soon as an external sd is mounted, the script mounts the external sd on "/data/sd_cards/external/"
and the internal on "/data/sd_cards/internal/".
Code:
# Save mount points on folders
# Mount bind internal SD in folder /data/sd_cards/internal
mount -o bind /storage/sdcard0 /data/sd_cards/internal
# Mount bind external SD in folder /data/sd_cards/external
mount -t vfat -o rw,nosuid,nodev,noexec,relatime,user_id=1023,group_id=1023,default_permissions,allow_other /dev/block/vold/179:33 /data/sd_cards/external
So now the real internal sd can be found in the directory "/data/sd_cards/internal/"
and the real external sd can be found in the directory "/data/sd_cards/external/".
The reason we do this is to be able to make a script swap them again.
Then it checks the size of each, so that it knows if it ia worthing of swapping them.
Code:
# Get sd cards sizes
internalSdSize=$(du -s /storage/sdcard0 | awk '{print $1}')
externalSdSize=$(du -s /storage/extSdCard | awk '{print $1}')
If external sd is bigger, then on "/storage/sdcard0/" we mount "/data/sd_cards/external/"
and on "/storage/extSdCard/" we mount "/data/sd_cards/internal/".
Code:
# Swap sd cards
# If external sd card is bigger than internal swap
if [ $externalSdSize -gt $internalSdSize ]
then
# Swap
mount -o bind /data/sd_cards/internal /storage/extSdCard
mount -o bind /data/sd_cards/external /storage/sdcard0
fi
Click to expand...
Click to collapse
[Script][Optimize SQlite databases of apps][v1.0]
Name : Optimize SQlite databases of apps
Version : v1.0
Rewritten by : DarkThanos
Based on work of: pikachu01
Click to expand...
Click to collapse
This script optimize applications' database using sqlite3 (Vacuum/Reindex) every 5 boots or 5 days.
On any other boot it optimize only databases of phone, contacts, mms and settings .
Before use make a folder "libs" inside "/system/etc/init.d/",
insert the "sqlite3" file inside and give it execute permissions (the file is given with the script)
Bugs: (Its safe for use, its a warning not an error)
Contacts database is always locked, so can't be optimized.
I am not responsible for whatever happens to your phone.
Tested on my Samsung Galaxy Core (I8260)
[Change log]
1.0 Version
Script Public for first time.
SQlite databases on "/data/" optimize every 5 boots or 5 days.
SQlite databases of phone, contacts, mms and settings optimize on every boot.
Click to expand...
Click to collapse
[Dev Doc]
Script first initiate some variables
(path to Sqlite lib, path to a folder to save scripts data, minimum time between optimizes)
Code:
# Some variables
# SQLite path
sql_lib="/system/etc/init.d/libs/sqlite3";
# Data folder path
data_folder="/data/boot_scripts_data/";
# Data counter file name
data_file_counter="sql_optimize_counter";
# Data last run file name
data_file_lastrun="sql_optimize_lastrun";
# Max time between optimizes (in sec)
# 5 days = $(expr 5 \* 24 \* 60 \* 60 )
max_time_dif=432000
Check how many boots passed since last optimize
and when the last optimize was by reading scripts data.
Code:
# Create data folder if not exist
mkdir -p "$data_folder"
# Get data from files
# Run Counter
if [[ ! -f "$data_folder$data_file_counter" ]]
then
# File do not exist
touch "$data_folder$data_file_counter"
echo "0" > "$data_folder$data_file_counter"
runCount="0"
else
runCount=$(cat $data_folder$data_file_counter)
fi
# Last run date
if [[ ! -f "$data_folder$data_file_lastrun" ]]
then
# File do not exist
touch "$data_folder$data_file_lastrun"
echo "0" > "$data_folder$data_file_lastrun"
lastRun=0
else
lastRun=$(cat $data_folder$data_file_lastrun)
fi
If boots passed since last optimize equals with 5 or last optimized more than 5 days before,
then make a full database optimization.
Code:
# Check if its time for optimize
if [ $(( $(date +%s) - $lastRun )) -ge $max_time_dif -o $runCount -ge 5 ]; then
echo "Full mode optimize"
# Save data
echo "0" > "$data_folder$data_file_counter"
echo $(date +%s) > "$data_folder$data_file_lastrun"
# Optimize /data/
optimize_folder "/data/"
echo "All applications' databases were optimized"
Else make a light optimize.
(only phone, contacts, mms and settings)
Code:
else
echo "Light mode optimize"
# Save data
echo $((runCount+1)) > "$data_folder$data_file_counter"
# Only for Galaxy Core
# Count databases optimized
count=0
# phone optimize
optimize_folder "/data/data/com.android.phone/databases/"
# contacts optimize
optimize_folder "/data/data/com.android.providers.contacts/databases/"
# mms optimize
optimize_folder "/data/data/com.android.mms/databases/"
# email optimize
optimize_folder "/data/data/com.android.mms/databases/"
# settings optimize
optimize_folder "/data/data/com.android.settings/databases/"
echo "Important databases were optimized"
fi;
Optimize functions
Code:
# Some functions
# Optimize db
optimize_db(){
# Vacuum and then reindex
$sql_lib $1 'VACUUM;';
$sql_lib $1 'REINDEX;';
#echo $(basename $1)" was optimized."
}
# Optimize every db on folder
optimize_folder(){
local path=$1
count_result=0;
find $path -type f -iname "*.db" -print0 | while IFS= read -r -d $'\0' database; do
optimize_db $database
done
#echo "Databases inside $path were optimized."
}
Use the sqlite binary to VACUUM and REINDEX the given database.
Click to expand...
Click to collapse
[Script][Optimize apks using ZipAlign][v1.0]
Name : Optimize apks using ZipAlign
Version : v1.0
Author : Wes Garner
Suggestions : oknowton
Edited by : DarkThanos
Click to expand...
Click to collapse
This script zipalign applications' apk (only the apks that are not already zipaligned) on every boot.
First boot may take a while.
Before use make a folder "libs" inside "/system/etc/init.d/",
insert the "zipalign" file inside and give it execute permissions (the file is given with the script)
Bugs:(Not for use, more testing needed)
Some apps return an error after zipaligned, and need to be reinstalled.
(Found fix. Zipaligned apk do not holds read rights after copy. Command "cp -p" do not hold permissions. Temp fix "chmod 644". [I need help with that])
A download will be posted when it is stable.
I am not responsible for whatever happens to your phone.
Tested on my Samsung Galaxy Core (I8260)
Need to be tested for stable use.
[Change log]
1.0 Version
Script Public for first time.
Optimize apks using ZipAlign (on every boot check apps).
Click to expand...
Click to collapse
[Dev Doc]
Script code
Code:
#!/system/bin/sh
# Optimize apks using ZipAlign
#
# Work of:
# Wes Garner (Script code)
# oknowton (Suggestions)
#
# Modifications by:
# DarkThanos
#
# For the xda Galaxy Core users
#
# Some variables
# SQLite path
zipalign_lib="/system/etc/init.d/libs/zipalign";
# Data folder path
data_folder="/data/boot_scripts_data/";
# Data database file name
apk_cache="zipalign_apk_cache";
# Counters
count_apps=0
count_zipaligned_apps=0
count_zipalign_failed=0
# Report ZipAlign start
echo "ZipAlign Optimization Start";
# For every apk in /data/app/
for apk in /data/app/*.apk ; do
# Check if this apk is zipaligned
$zipalign_lib -c 4 $apk;
# Get results
not_zipaligned=$?;
# Count app
count_apps=$((count_apps+1))
# If not, align it
if [ $not_zipaligned -eq 1 ]; then
# ZipAlign app
result=`$zipalign_lib -f 4 $apk $data_folder$apk_cache`
if [ -e $data_folder$apk_cache -a ${#result} -eq 0 ]; then
# Successful zipalign
/system/xbin/busybox cp -p $data_folder$apk_cache $apk;
chmod 644 $apk;
rm $data_folder$apk_cache;
count_zipaligned_apps=$((count_zipaligned_apps+1))
else
echo "[ERROR] $result"
# Failed zipalign
count_zipalign_failed=$((count_zipalign_failed+1))
#echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
fi;
done;
# Report results
echo "Apks ZipAligned $count_zipaligned_apps/$count_apps ($count_zipalign_failed failed)";
# Exit
exit 0
I need help with the code:
Code:
/system/xbin/busybox cp -p $data_folder$apk_cache $apk;
chmod 644 $apk;
rm $data_folder$apk_cache;
I try to make all my script work with no busybox. "cp" command do not exist in android (without busybox).
Is "cat" a good alternative?
Also, should I use "chmod 644 $apk;"? "cp -p" do not work and I am pretty sure the script has root rights.
Thanks for your time.
Click to expand...
Click to collapse
I need betatester
Sent from my GT-I8262 using XDA Premium 4 mobile app
NieeLz said:
I need betatester
Click to expand...
Click to collapse
Download the "init.bsu.boot" script (from first post). Create the "/system/etc/init.d/" folder. And run the script (from your download folder) using Script Manager (do not forget to enable "su"). Then check "/data/tmp/init.bsu.log" (open as text) and see the log.
This is an easy safe test.
You can also make a test script, like:
Code:
#!/system/bin/sh
# Test Script
echo "This will be on log."
(You can read the script codes too, I have many comments.)

[ROOT] [Magisk/Tasker] [Andromeda] Start Andromeda directly on boot from your phone

Hi,
You need to be rooted. Why to use Andromeda if you are rooted, you might wonder. Well, it runs miles better, there is no difference in speed between a themed and a not themed app. With a root Substratum, the difference is quite noticeable, for the worst.
Plus, I used magisk, although it should also be runnable from within Tasker, Auto Tools, or something alike, or simply with /system/etc/init.d support, which my P20 Pro lacks. The init.d injector magisk module didn't work either.
Hence I've modified the official linux adb script to be run at init directly on the phone. Due to the missing init.d support on many phones, like mine, I placed the script on /magisk/.core/service.d since I already had magisk installed
I also
Code:
ln -s /magisk/.core/service.d /system/etc/init.d
to make it easier to remember and have init.d support
The sleep timer might need to be increased, I tried to wait for projekt.substratum to be running but it was not enough, so unless someone can shed light on what other process to wait for, the sleep will do.
So download the script, rename it to start_andromeda-android.sh, and
Code:
adb push start_andromeda-android.sh /magisk/.core/service.d/
adb shell
su
chown 0:0 /magisk/.core/service.d/start_andromeda-android.sh
chmod 0755 /magisk/.core/service.d/start_andromeda-android.sh
#### optional, if your phone lacks /system/etc/init.d support, and you want to simulate it with magisk
# mount -o remount,rw /system
## if /system/etc/init.d exists and is not functional, like on my P20 Pro, just do
# rm -fr /system/etc/init.d
# ln -s /magisk/.core/service.d /system/etc/init.d
# mount -o remount,ro /system
# start_andromeda-android.sh
Code:
#!/system/bin/sh
sleep 15
# Let's first grab the location where Andromeda is installed
pkg=$(pm path projekt.andromeda)
# Due to the way the output is formatted, we have to strip 10 chars at the start
pkg=$(echo $pkg | cut -d : -f 2 | sed s/\\r//g)
# Now let's kill the running Andromeda services on the mobile device
kill=$(pidof andromeda)
# Check if we need to kill the existing pids, then kill them if need be
if [ -z "$kill" ]; then[INDENT]am force-stop projekt.substratum
appops set projekt.andromeda RUN_IN_BACKGROUND allow
appops set projekt.substratum RUN_IN_BACKGROUND allow
CLASSPATH=$pkg app_process /system/bin --nice-name=andromeda projekt.andromeda.Andromeda &
[/INDENT]
else
[INDENT]am force-stop projekt.substratum
kill -9 $kill
appops set projekt.andromeda RUN_IN_BACKGROUND allow
appops set projekt.substratum RUN_IN_BACKGROUND allow
CLASSPATH=$pkg app_process /system/bin --nice-name=andromeda projekt.andromeda.Andromeda &
[/INDENT]
fi

Categories

Resources