[Moto G 4G Android Development] Kayant:
Special features and sysfs settings

Dynamic dirty page writebacks

This feature has been developed by me and allows to dynamically manage the dirty page writebacks with two different intervals, one when the screen is on and another when the screen is off.

It is based on a commit of Francisco Franco, but instead of using hard coded values and of disabling at all the dirty page writebacks while the screen is on (possibility of data loss), I preferred to use a customizable higher dirty page writebacks interval (15 seconds) than the default one (5 seconds) while the screen is on and a customizable default interval (5 seconds) when the screen is off.

By using a higher interval we have better performance and less battery consumption, with a very low risk of data loss.

How to customize the dynamic dirty page writebacks feature (default enabled):

Three new procfs parameters are exposed inside /proc/sys/vm path:

- dynamic_dirty_writeback is the activation status of this feature, set 1 to enable it, set 0 to disable it and use the standard behaviour

- dirty_writeback_active_centisecs is the interval for the dirty page writebacks when the system is active (screen on), the default value is 1500 centisecs (15 seconds)

- dirty_writeback_suspend_centisecs is the interval for the dirty page writebacks when the system is suspended (screen off), the default value is 500 centisecs (5 seconds)

To change the value you can use Performance Controlto suit your own taste

KCAL support for post processing control [v2]

Please click the link below for more information, and how to use it : - all credits to savoca

[DEV][PATCH] KCAL - Advanced color control for Qualcomm MDSS 8x10/8x26/8974/8084

ZZMoove Governor Profile

use tools like Kernel Adiutor, Android Tuner or similar tools which are supporting the change of multible tuneables on-the-fly

or just do it directly in kernel sysfs via a terminal emulator and give the tuneable "profile_number" one of the following values:

1 for Default Balanced Profile

2 for Yank Battery -> Better battery, try to use lower freq as possible

3 for Yank Battery Extreme -> Aggressive Battery profile, by trying to reduce hotplugging as can as possible and with this profile the user will suffer abit in performance side

4 for ZaneZam Performance -> Extreme tuned for performance, aggressively try to hold on high frequency to obtain higher performance

5 for ZaneZam Relax -> Moderate tuned, more to balance but abit performance

WAKE GESTURE

Implemented with Pocket mode, in which, each time proximity sensor been covered, it will suspend touch to avoid sudden screen wakeup.

Normally proximity sensor will active to covered when it detect any object about 3cm from phone distance.

Please use kernel adiutor to enable it.

Known bug for this features for now is:

1 - touch will less responsive during first wakeup after doubletap

/-------------New wakegesture been reverted because bugging touch in multiROM startup screen-------------------/

/-------------Wake Gesture implementation only available in Hs9 until Hs12, and simplerV5-----------------------------/

Unhide to read more information about it

NOTE !

1- To ensure all the wake gesture working correctly, users must use this apk >>> http://elementalx.org/wake-gestures/ to enable or modify the setting

2- Only use kernel adiutor to change doubletap2wake function for FULL SCREEN or HALF SCREEN/bottom side and to enable sleep2wake ONLY.

3- Do not use kernel adiutor to enable sweep2wake feature and all feature that activate through swipe

4- Pocket detection in wake gesture.apk wont work for us, so no need to enable or tick it, we already had automatic pocket detection from kernel directly

5- doubletap2wake is default in HALF SCREEN MODE/bottom side only, which means, you can only double tap on bottom side only to wake up, use kernel adiutor to change it.

EXTRA FEATURES IN WAKE GESTURE!

Wake Gestures

This is a new feature similar to the Motion Launch Gestures on the HTC One m8. Requires this app:http://elementalx.org/wake-gestures/

Set /sys/android_touch/wake_gestures to 1 to enable input events for wake gesture actions. Set to 0 to use traditional sweep2wake or doubletap2wake (wakes up the phone and turns on the screen only).

Note that if you enable wake_gestures, nothing will happen if you don't install the Wake Gesture Xposed module.

Sweep2wake

Sweep2wake allows you to turn on your phone by swiping your finger across the screen. There are four sweep actions that will work

Gesture........Value

Sweep right......1

Sweep left........2

Sweep up.........4

Sweep down....8

Add up the values for each gesture you want to enable and put the total in /sys/android_touch/sweep2wake. For example, to enable all gestures, the value is 15 (1+2+4+8). To enable sweep right, sweep left and sweep up, the value is 7 (1+2+4)

/sys/android_touch/sweep2wake

Doubletap2wake

DoubleTap2Wake (DT2W) allows you to wake the device by double tapping anywhere on the screen. This causes significant battery drain. You can edit /etc/elementalx.conf to change the setting on boot.

/sys/android_touch/doubletap2wake

0 = disabled

1 = enabled (bottom of screen only)

2 = enabled (full screen)

Vibration Strength

Haptic feedback can be enabled for the wake gestures in /sys/android_touch/vib_strength. This setting takes a number between 0 and 90. Default is 20. Setting this to 0 disables haptic feedback for gestures.

S2W/DT2W power key toggle

If enabled, turning the screen off with the power button disables s2w and dt2w to save battery (since s2w/dt2w cause significant battery drain). When you turn the screen back on, s2w and dt2w return to their previous settings. If the screen times out, s2w/dt2w are not disabled this is only if you use the power button to turn it off. You can edit /etc/elementalx.conf to change the setting on boot.

S2W/DT2W Timeout

Doubletap2wake and sweep2wake can be automatically disabled after a certain number of minutes. I give a few choices between 5 and 120 minutes in the installer. Default is 30 minutes. You can put in whatever you want in /etc/elementalx.conf.

When the screen is turned on, the timeout is canceled and will start again next time you turn the screen off. This means that if you have your screen set to come on for incoming messages or notifications, the timeout will start over again.

If you also enabled the power button to toggle s2w/dt2w, there is no timeout when you use the power button, the wake functions are immediately disabled (same as before).

You can edit /etc/elementalx.conf to change the setting on boot.

Sweep2Sleep

Sweep2Sleep allows you to put the device to sleep by sweeping your finger across the navigation bar area. Unlike Sweep2wake, this does not cause any battery drain. You can edit /etc/elementalx.conf to change the setting on boot.

/sys/android_touch/sweep2sleep

0 = disabled

1 = sweep right

2 = sweep left

3 = sweep left or right

MSM_LIMITER

This function will limit the cpu in certain condition such as frequency during suspend, resume and min frequency. This features enabled in default and the frequency already been set for highest suspend freq to 787Mhz (screen off), min freq 300Mhz, resume freq 1.2Ghz. This feature may can reduce power consumption as it limit our cpu frequency after the screen off.

so here the step to disable it: -

1. By using Terminal Emulator (note that set value will be lost after a reboot/shutdown)

- Open Terminal Emulator

- Run this command to disable msm_limiter feature

su
echo "0" > /sys/kernel/msm_limiter/limiter_enabled
echo "0" for disable or echo "1" for enable it back

Furthermore, you can adjust the frequency of suspend, resume and min frequency to suit your taste here the command

1. For resume frequency

su
echo "<put you own frequency here without ">" symbol >" > /sys/kernel/msm_limiter/resume_max_freq

example:-

su
echo "1824000" > /sys/kernel/msm_limiter/resume_max_freq
this will make your CPU freq up to 1.8Ghz when screen on.. it just an example.

2. For suspend frequency

su
echo "<put you own frequency here without ">" symbol >" > /sys/kernel/msm_limiter/suspend_max_freq
Table of our devices frequency

300000
384000
600000
787200
998400
1094400
1190400