15th April ANNOUNCEMENT
NOTE: This app is currently in beta stage, meaning that the app is not bug-free, and stability may vary across devices. Future updates will improve on this!
Helix Engine roles:
Application Developer: ZeroInfinity, Profile Data Tuners: RogerF81, Mostafa Wael, Asiier
The idea was first thought of after Energy Aware Scheduling kernels started appearing during my time on the HTC 10 forums. The first problem was that there was no proper thermal solution could be implemented on Sense as thermal-engine relied solely on HTC's pnpmgr (Power N Performance Manager) and pnpmgr heavily depended on HMP, which was replaced by EAS. The second problem was that EAS was too demanding and during its early stages, it was too wild on the performance side. It needed to be tamed aggressively. The third problem was that we needed to find a way to improve battery life while impacting performance as little as possible. In the early iterations of Helix Engine, it consisted of the app engine, suspend engine, thermal engine, and powersaver engine.
The engine was written in C completely from scratch, compiled into an executable binary. The initial algorithm was to cap frequencies depending on certain conditions. The app engine reads from the battery, balanced, and performance lists, if a match is found comparing the package name in the list and the package name of the current top app, apply values depending on what profile that package name belonged to. The suspend engine would apply different values targeted for screen off usage (lower power consumption than battery profile from app engine). The thermal engine was a temporary solution for the lack of working thermal throttling drivers for EAS kernels, as the stock thermal throttling drivers on Sense ROMs relied heavily on pnpmgr (as mentioned in the first paragraph). It was an extremely basic thermal driver, definitely not the best solution but it was better than letting the device overheat. The power saver engine would check if the power saver toggle was checked, and if it was, it would apply battery profile settings for all apps.
If you are curious to see the development of Helix Engine in its early days, visit the link to my HTC 10 kernel thread here.
What does it do?:
Helix Engine is now a native android application with an Accessibility Service which automates dynamic performance profile switching (battery/balanced/performance modes) to provide better efficiency, improve battery consumption and performance depending on your usage.
- Root (I think this is obvious but just in case it's not...)
- An ARM64-based (ARMv8) System-on-Chip/chipset/processor/CPU with big.LITTLE or DynamiQ (clustered CPUs)
- No other modifications which may tweak kernel tunables automatically (e.g. Advanced Kernel Tweaks)
If you are looking for absolute raw performance with an "always smooth" experience, not giving any thought to battery life, then this app is definitely not for you. This app is specifically for those who want good battery life, without compromising too much performance. No more deciding what the best "balanced" configuration is.
Battery - low-performance mode to save power on apps that don't need that much power (e.g. Facebook, Messenger, Instagram, Reddit, apps that are generally for browsing)
Balanced - the default profile for apps that aren't in either Battery or Performance lists (normally newly installed apps). Apps that you think requires a decent amount of power, but not as much as the power intensive applications suitable for performance profile.
Performance - High-performance mode to enable buttery smooth gaming, as well as exceptional benchmark performance (if you are into that sort of thing). Also useful for very power intensive tasks like backup managers, file explorers (when transferring large files), media editing tools, camera apps, launchers (for fast app launches) etc.
Whitelist - Helix Engine will detect these apps and will avoid executing any scripts when they are in use. This prevents constant profile switching, very useful if you whitelist SystemUI (which becomes the top-app whenever you turn on the screen to the lockscreen, pull down the notification bar, or switching betwen recent apps. All which you will regularly use and it's just a waste of processing power to constantly switch whenever SystemUI is in the top-app group).
The engine detects which app is currently in use (in the top-app group), and will apply the profile's configuration according to the profile you've set the app to automatically.
For example, the battery profile's configuration is applied when an application that has been set to the battery profile has been detected as currently running. Apps set to balanced will apply the balanced profile's configuration. Apps set to performance will apply the performance profile's configuration. Apps set to whitelist will be ignored (i.e. no profile changes from the previous profile that was executed when the whitelisted app is in the top-app group).
The engine allows users to set a profile for each individual app on their device. Different profiles correspond to what profile's configuration will be applied (see above in App Engine).
When customizing app lists, each selection you make is saved in real time. You may backup your app lists in Settings for easy backup and restore (Premium feature) if you move devices or wipe app data.
Profile Data Customization:
Users can also configure each profile configuration to their personal preferences. Each configuration should be unique to its own profile.
For S835, S821, S820, Kirin 970 chipsets, the engine will load recommended pre-defined profile data for you. For every other device, you will need to configure each profile yourself as each chipset are different. There is a help card in each profile customization page to give you a general guideline of what you should be aiming for.
Helix Engine Operation Modes:
Dynamic Powersaver: Only battery and balanced profiles are available, battery profile will apply suspend engine's configuration.
Dynamic Battery: Only battery and balanced profiles are available.
Dynamic Balanced: Battery, balanced, performance profiles are available.
Dynamic Performance: Only balanced and performance profiles are available.
OPERATION MODE DOES NOT MEAN APP ENGINE PROFILE! DO NOT GET THEM CONFUSED!
These operation modes may restrict the profiles you are allowed to choose from in the app lists. Additionally, dynamic powersaver will apply suspend engine's configuration on apps that have their profiles set to battery.
For example, certain operation modes will only allow certain profiles to be selected:
Dynamic Battery will only allow battery and balanced profiles to be set and used, but not performance.
Dynamic Balanced will allow all 3 battery, balanced, and performance profiles to be set and used.
Dynamic Performance will only allow balanced and performance profiles to be set and used, not battery.
Dynamic Powersaver is the same as dynamic battery, but battery profiles will apply suspend engine's configuration instead of standard battery profile's configuration.
If you select dynamic battery or dynamic powersaver operation modes, the performance app list is DELETED, making all previously set performance apps to be set to the balanced profile.
If you select dynamic performance, the battery app list is DELETED, making all previously set battery apps to be set to the balanced profile.
Puts your device in a low power state when the screen is off. This is available on every operation mode, it will apply suspend engine's configuration. You may disable this or force the engine to run strictly in ONLY this mode (for superior battery life, at the cost of performance) in Settings.
Background Task Smart Checking:
When your screen is off, suspend engine kicks in, setting the phone in a low power state to gain superb idle drains. However, this is an issue if a performance-heavy task is running in the background as it will not get the maximum power the device can provide. To overcome this, the engine will check if a notification has changed, even when screen off. If a performance app is detected when notification has changed, it will use the performance profile while the app is running the background task. After the task has finished, usually the app will either remove the ongoing notification or change the notification to say it has finished, the engine will start the suspend engine again.
The engine has a protection against constantly applying profile configurations when it is unnecessary. One example was mentioned before which is the whitelist profile you can set for applications in the App Lists page. The other way that the engine prevents this is by temporarily logging what profile was last executed. If the new application that has just been focused as top-application is set the same profile as the previous application you were on, it will not execute again since the values have already been applied from the previous one.
Take this scenario for example. You set Facebook and Messenger both to battery. You launch Facebook and it becomes the top-application, battery profile's configuration will be applied. Then you switch to messenger via recent apps and messenger becomes the top-application, battery profile's configuration will not be applied again because it was already applied in the application that was top-application before. The combination of whitelisting SystemUI with this method significantly increases the efficiency of how the engine runs.
The app will apply some tunables on boot/when the service starts running so it can operate as intended, minimizing conflicts.
- Auto LMK (Low Memory Killer) configuration
Thanks to @ivicask for the idea and help with implementing this. The engine will apply recommended LMK values depending on the total RAM available on your device for excellent multitasking!
- Backup and Restore app lists: The engine will create a backup of the current state of your app lists and compress them into a zip. It will be created in /sdcard/Helix-Engine/applist-backups/applist_backup-[DATE-TIME] where [DATE-TIME] is replaced by the current date and time. When you restore app lists, you are given a choice of backups if you have multiple ones you want to restore specifically for an operation mode (since dynamic battery/powersaver will delete performance app list and dynamic performance will delete battery app list).
- Backup and restore profile data: The engine creates an XML file in /sdcard/Helix-Engine/engine_data.xml with the current configuration of all of your profiles. These backups can be shared and other people may restore them on their devices. Profile data can only be restored on devices with the same chipset model, kernel type, and kernel version as the device it was backed up on. So e.g., an S835 HMP config can only be restored on an S835 HMP device. An S820 EAS config can only be restored on an S820 EAS device. A device running XYZ Kernel can only be restored on a device running XYZ Kernel. HOWEVER, you change the kernel_version="XYZ-Kernel" in the engine_data.xml to kernel_version="any" in order to allow devices using any kernel to restore that profile data.
- View system apps: While the app applies pre-defined app lists at first launch, it will still apply pre-defined system apps in the app lists. This feature just allows you to display system apps in the app list UI and make it easier to change profile sets for system apps.
- Search through app lists using the search button in the action bar.
ATTENTION: Devices that has some sort of settings option to prevent apps from launching on boot: MAKE SURE YOU ALLOW HELIX ENGINE TO RUN ON BOOT OR ELSE THE SERVICE WILL NOT RUN AUTOMATICALLY!!!
For Huawei users: Settings > Battery > App Launch > switch off Helix Engine and tick everything for Manage Manually dialog
If your device has a power manager, the app can fix the problem automatically. However, PLEASE MAKE SURE YOU BACK UP YOUR SYSTEM AND VENDOR (for treble-enabled devices) PARTITIONS BEFORE PROCEEDING WITH THE FIX!!! YOU HAVE BEEN WARNED!
Join the G+ Community here for Alpha testing channel (releases in this channel can be very unstable and buggy)
Massive thanks to Chris@Honor_USA for supplying me with a Honor View 10 to develop on! Without this, I would not be able to provide proper support for Kirin 970 chipsets!
Massive thanks to @RogerF81 for maintaining all of the scripts for Helix Engine and alpha/beta testing! Also inspiration for ideas
Thanks to @Mostafa Wael for encouraging me to jump to Oneplus, giving some ideas on improving the engine, and beta testing!
Thanks to @Asiier for integrating AKT with Helix Engine and helping us improve our scripts!
Thanks to @geko95gek for also encouraging me to jump to Oneplus!
Thanks to my team members at Team Helix for supporting me!
Thanks to @ivicask for giving me the idea of the concept for this engine before it was created. Without him, I wouldn't even have started this project. Also massive thanks to him for helping us with LMK tweaks, giving us pointers on what to improve!
Thanks to @afafontes for helping us improve and fix bugs with the scripts.
Thanks to anjlab for in-app billing library (Source)
Thanks to @topjohnwu for libsu library (Source)