[Android General] seb3773:
some tips...

Well after 2 months with this phone, I think it's time to share some tips and improvements I found usefull.

** Please notify me if it's the wrong thread for posting these kind of stuff, but I thought it doesn't belong to the other leagoo shark thread... **

I personnally think it's a very good phone, good hardware, and you got a lot for the price. But like with other phones, some improvements doesn't hurt ;)

(1)--> At first, you need to install TWRP recovery and you have to root the phone. You need it to tweak this beast.

Everything you need is in first post.

Important: For superSu, you have to untick "mount namespace separation", because most of the init.d tweaks won't work with this option activated. And you have to tick "activate su during boot" for the same reason :p

(2)--> Second step, install busybox (let's say with the stericson installer, install it directly -no need to wait for the "smart install" process-, and remove the installer apk after, because we doesn't need it anymore)

(3)--> Third step, let's add init.d support:

like I explained in the other leagoo shark thread, just search for the file install-recovery.sh In the directory /etc/ and modify it like that:

#!/system/bin/sh
/system/xbin/daemonsu --auto-daemon &

#init.d support
run-parts /system/etc/init.d/

All you have to do now, is to create a folder "init.d" (without the quotes) in /etc/ folder with 0777 permissions.

(4)--> Now that we have init.d support, here are some scripts I collected & adapted for our phone:

00opti:

This one increase sdcard0/sdcard1 -if any installed- read_ahead value for faster i/o, removes some debug flags, tunes oom, disable ipv6 and tunes ipv4 parameters

#!/system/bin/sh

echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 512 > /sys/block/mmcblk1/queue/read_ahead_kb

setprop profiler.debugmonitor false
setprop profiler.launch false
setprop profiler.hung.dumpdobugreport false
setprop debugtool.anrhistory 0
setprop profiler.force_disable_ulog 1
setprop profiler.force_disable_err_rpt 1
setprop logcat.live disable
setprop dalvik.vm.debug.alloc 0
setprop dalvik.vm.checkjni false

echo 0 > /sys/module/alarm_dev/parameters/debug_mask
echo 0 > /sys/module/alarmtimer/parameters/debug_mask
echo 0 > /sys/module/binder/parameters/debug_mask
echo 0 > /sys/module/kernel/parameters/initcall_debug
echo 0 > /sys/module/xt_qtaguid/parameters/debug_mask
echo 0 > /sys/module/sbsuspend/parameters/sbsuspend_debug_mask
echo 0 > /sys/module/earlysuspend/parameters/debug_mask
echo 0 > /sys/module/lowmemorykiller/parameters/debug_level

sysctl -w vm.block_dump=0
sysctl -e -w vm.oom_dump_tasks=1
sysctl -e -w vm.oom_kill_allocating_task=1

echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "1" > /proc/sys/net/ipv6/conf/default/disable_ipv6
/system/bin/ip6tables -P INPUT DROP
/system/bin/ip6tables -P OUTPUT DROP
/system/bin/ip6tables -P FORWARD DROP
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
echo "1" > /proc/sys/net/ipv4/tcp_sack
echo "1" > /proc/sys/net/ipv4/tcp_dsack
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout

01rmt:

This one does classics 'perfect" remounts, tunes some fs parameters,ipv4 tweaks and fstrim function

#!/system/bin/sh
mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh,errors=continue,nomblk_io_submit,ro /system
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /data
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /cache
echo 0 > /sys/kernel/debug/tracing/tracing_on

sysctl -e -w fs.lease-break-time=10
sysctl -e -w fs.inotify.max_queued_events=32000
sysctl -e -w fs.inotify.max_user_instances=256
sysctl -e -w fs.inotify.max_user_watches=10240
sysctl -e -w fs.file-max=165164
sysctl -w vm.laptop_mode=0

sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -w net.ipv4.route.flush=1

busybox fstrim -v /cache
busybox fstrim -v /system
busybox fstrim -v /data

02touch:

touch tuning **thanks seraser

#!/system/bin/sh
echo 20 > /sys/module/tpd_setting/parameters/tpd_em_auto_time_interval
echo 25 > /sys/module/tpd_setting/parameters/tpd_em_pressure_threshold
echo 4 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time
echo 5 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time0
echo 9 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time1

03others:

disabling Zram, some other tweaks, temporary folders cleaning, scrolling and touch tuning

#!/system/bin/sh

swapoff /dev/block/zram0

setprop persist.sys.scrollingcache 3
setprop ro.min.fling_velocity 8000
setprop ro.max.fling_velocity 12000
echo "1" > /sys/module/tpd_setting/parameters/tpd_mode
echo "63" > /sys/module/hid_magicmouse/parameters/scroll_speed

setprop ENFORCE_PROCESS_LIMIT false
setprop MAX_SERVICE_INACTIVITY false
setprop MIN_HIDDEN_APPS false
setprop MAX_HIDDEN_APPS false
setprop CONTENT_APP_IDLE_OFFSET false
setprop EMPTY_APP_IDLE_OFFSET false
setprop MAX_ACTIVITIES false
setprop ACTIVITY_INACTIVE_RESET_TIME false
setprop MAX_RECENT_TASKS false
setprop MIN_RECENT_TASKS false
setprop APP_SWITCH_DELAY_TIME false
setprop MAX_PROCESSES false
setprop PROC_START_TIMEOUT false
setprop CPU_MIN_CHECK_DURATION false
setprop GC_TIMEOUT false
setprop SERVICE_TIMEOUT false
setprop MIN_CRASH_INTERVAL false
setprop touch.pressure.scale 0.001

busybox rm -f /data/*.log
busybox rm -f /data/tombstones/*
busybox rm -f /data/system/dropbox/*
busybox rm -f /storage/sdcard0/LOST.DIR/*
busybox rm -f /storage/sdcard1/LOST.DIR/*
busybox rm -f /data/system/usagestats/*
busybox rm -r /data/system/appusagestats/*
busybox rm -f /data/anr/*
busybox rm -f /cache/*.apk
busybox rm -f /cache/*.tmp
busybox rm -f /data/backup/pending/*
busybox rm -f /data/local/tmp/*
busybox rm -r /data/tmp/*

setprop media.stagefright.enable-player true
setprop media.stagefright.enable-meta true
setprop media.stagefright.enable-scan true
setprop media.stagefright.enable-http true
setprop media.stagefright.enable-aac true
setprop media.stagefright.enable-qcp true

04gsf:

disabling some google services functions, use it at your own risks ^^^ Can't remember where I find these tweaks, so all credits goes to the author(s)

For this script to work, you need sqlite3 binary, you can use the one I attached (put it in system/xbin/ with according 0777 permissions)

#!/system/bin/sh
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'perform_market_checkin' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = -1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'checkin_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_gcore' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_idle' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_launch_service' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_KMSG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:event_log' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_LOG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'ads:jams:is_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'analytics.service_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = '127.0.0.1' where name = 'url:feedback_url'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = 1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:bandwidth_checkin_stat_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_secure set value = '0' where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_global set value = '0' where name = 'send_action_app_error'"

05renice:

renice processes, especially fingerprint scanner service. Please note this two lines:

- busybox renice -19 `pidof com.teslacoilsw.launcher` <--- because I use Nova launcher instead of the stock launcher, wich I personally recommend.

- busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service` <----- I'm using Ultimate Dynamic Navbar instead of the stock one, I will explain this later.

If you doesn't use this two apps, you can remove these lines. (well, if you don't, it will not hurt either)

#!/system/bin/sh
sleep 80
pid=$(busybox pgrep zygote 2>/dev/null)
busybox renice -1 $pid
busybox ionice -c 1 -n 0 -p $pid

for pid in `dumpsys activity services | busybox grep -i app=ProcessRecord | busybox awk '{ print $2 }' | busybox grep -v '/100[0-9]}' | busybox cut -d: -f1`; do
busybox renice 7 $pid
busybox ionice -c 2 -n 7 -p $pid
done;

busybox renice -20 `pidof com.android.phone`

busybox renice -19 `pidof egistec.fingerauth.host.service`

busybox renice -19 `pidof egistec.fingerauth.host.service:remote`

busybox renice -19 `pidof com.teslacoilsw.launcher`

busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service`

busybox renice -19 `pidof com.android.mms`
busybox renice -15 `pidof com.android.systemui`
busybox renice -3 `pidof android.process.acore`
busybox renice -3 `pidof android.process.media`

(5)--> Now let's tweak the build.prop file a bit...

I added this lines to the build.prop file:

#seb tweaks
ro.media.enc.jpeg.quality=100
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
logcat.live=disable
wifi.supplicant_scan_interval=240
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
ro.config.nocheckin=1
persist.sys.scrollingcache=3
net.rmnet0.dns1=8.8.8.8
net.rmnet0.dns2=8.8.4.4
net.dns1=8.8.8.8
net.dns2=8.8.4.4
net.ppp0.dns1=8.8.8.8
net.ppp0.dns2=8.8.4.4
net.wlan0.dns1=8.8.8.8
net.wlan0.dns2=8.8.4.4
net.eth0.dns1=8.8.8.8
net.eth0.dns2=8.8.4.4
net.gprs.dns1=8.8.8.8
net.gprs.dns2=8.8.4.4
#seb experimental
mot.proximity.delay=25
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
debugtool.anrhistory=0
profiler.debugmonitor=false
profiler.launch=false
profiler.hung.dumpdobugreport=false
ro.config.hw_quickpoweron=true
net.tcp.mss.wlan=491520
net.tcp.mss.rmnet=491520
persist.service.zram=0
ro.zram.default=0
persist.sys.use_dithering=0
pm.sleep_mode=1
power.saving.mode=1

(6)-->Xposed

Let's install xposed, you need this for

Amplify and Greenify

, wich I strongly recommend against the stock power saver (I removed it).

You can also install the module "Deny location Consent", very usefull as I doesn't want other localisation than the gps one (very good with this phone by the way) and I'm tired of clicking "disagree" to the google popup when I activate location.

(7)-->Launcher

I doesn't like the stock launcher. At all. I prefer to use Nova Launcher and remove "Launcher3". Your choice :)

With my firmware version (20160530), there is no tts settings in "settings" :-/ ... But with Nova, and the widget "activity", you can access tts settings :) (.Settings$TextToSpeechActivity ;see image attachement). I found other interresting activities in parameters too like :

.RadioInfo

.Settings$NotificationsStationActivity

.Settings$GestureSettingsHct ("Somatosensoriel intelligente" ?....)

.Settings$CaptioningSettingsActivity

.Settings$HeadsetSettingActivity

.MonitoringCertInfoActivity

(8)-->Debloating

Use a file explorer (with root access granted) to remove some system apps and titanium backup (or another tool with similar functionnality) to freeze some others.

I removed:

-All the themes (related to launcher 3, wich I doesn't use) : cn.sh.hct.themeOtdColors, cn.sh.hct.themeOtdNusiness, cn.sh.hct.themeOtdEasyFlat, cn.sh.hct.themeOtd, cn.sh.hct.themeOtdluxurious. I keep the main app "Themes" because It allows us to easily change the lockscreen wallpaper. (via the app or via the galery app)

-UpgradeSys, Tags, Power On/Off scheduler, Power Saver, Pico sv (I installed google tts), MTKLogger, MTKNlpServices, MTK android suite daemon, ConfigUpdater, FWupgrade, FWUpgradeProvider, RockClient, Music (I prefer another player), MusicFx.

I froze:

-BSPTelephonyDevTool, com.mediatek.batteryWarning, FastCamera (doesn't know what it is for ?), MTK Thermal manager

(9)-->The navbar

Well, I think there are two problems with the leagoo navbar.

At First, I doesn't like the resolution changing when you activate/desactivate the navbar wich occurs with certain apps. It can even crash some very specific apps (like Igo primo).

And the second thing very annoying is that you have to hide it manually. Too bad there isn't a "auto hide feature".

I solved these two issues with "Ultimate Dynamic Navbar", http://xdaforums.com/showthread.php?t=2270198

Now the navbar is superposed with anything on the screen, without changing the resolution of the running app. And you can specify a timeout for it to automatically hide.

Very customizable, very good and far better than the leagoo or the android stock navbar. You can use the integrated xposed module to hide the leagoo navbar; or modifying these two lines in build.prop (thanks to genesisalgor) :

ro.hct_navigationbar=0

qemu.hw.mainkeys=1

...... more to come if you are interrested :)

(like customizing the clock view with the flip cover -by modifyng framework-res.apk-,services disabling, optimizing system apks, bootanimation, .... and other tweaks).