• XDA Forums have been migrated to XenForo. To discuss, report bugs and other issues, use this thread.

[APP][5.0+] Spectrum - A kernel manager for users [ROOT]

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,114
0


Spectrum

Index:
This post: Overview, features, screenshots, and development.
2nd post: How to add Spectrum support to your kernel
3rd post: Spectrum Injector

What:
Spectrum is a simple, profile oriented kernel manager that allows developers to create profiles to serve to their users. This is useful for users who are inexperienced with kernel tweaking or users who want something that's a single click away.

How:
Choose from Balance, Performance, Battery, or Gaming profiles to quickly and easily change kernel settings to your preference, now even easier with the included QuickTiles.

Features:

  • Dark Material Design theme
  • 4 Profiles to choose from: Balance, Performance, Battery, and Gaming
  • Nougat Quicktile support
  • Launch QuickTile
  • Profile selector QuickTile
  • Customizable kernel name string
  • Easy to add, yet versatile kernel support
  • some eastereggs but shhh

History:
I initially intended Spectrum to be a companion app/updater for my kernel, Electron. However, I decided to make the app open and available for any developer to integrate into their kernel so that more users can have a simple kernel experience.

Download:
Spectrum on Google Play
Spectrum is also open source, you can find it on GitHub.

Thanks:
I'd like to give a special thanks to @The Flash for being an early adopter of Spectrum with Flash Kernel, and the tons of support and testing he gave while Spectrum was in development. I'd also like to thank @xanaxdroid for all the testing, critiquing, and support throughout development. Also, a huge thanks to @franciscofranco for the inspiration and giving code improvement tips. Couldn't have done it without you guys.

XDA:DevDB Information
Spectrum Kernel Manager, App for all devices (see above for details)

Contributors
frap129
Source Code: https://github.com/frap129/spectrum


Version Information
Status: Stable
Current Stable Version: 1.1
Stable Release Date: 2017-05-04

Created 2017-05-04
Last Updated 2017-07-15
 

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,114
0
How to add Spectrum support to your kernel:

Original documentation: GitHub

You'll need to add these 2 files to your devices ramdisk:
  • init.spectrum.rc
  • init.spectrum.sh
These files can be found on Github https://github.com/frap129/spectrum/tree/master/ramdisk

Now we have to include these ramdisk files. To do this, add
Code:
import /init.spectrum.rc
to the top of your devices main ramdisk file, usually called init.DEVICENAME.rc.

Next let's add your kernel name to the app. Open init.spectrum.rc and change "Electron" in
Code:
setprop persist.spectrum.kernel Electron
to your kernel's name.

Now just customize the 4 profiles in init.spectrum.rc to your liking! Profile 0 (Balanced) is the default, however, this can be changed in init.spectrum.sh. Here's my init.spectrum.rc file as an example:
Code:
# SPECTRUM KERNEL MANAGER
# Ramdisk file for profile based kernel management
# Implimentation inspired by Franco's fku profiles

# Initialization
on property:sys.boot_completed=1
   # Set default profile on first boot
   exec u:r:init:s0 root root -- /init.profiles.sh
   exec u:r:su:s0 root root -- /init.profiles.sh
   # Enable Spectrum support
   setprop spectrum.support 1

# Balance (default profile)
on property:persist.spectrum.profile=0
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor relaxed
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1708000
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor chill
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 1958400
    write /sys/module/cpu_boost/parameters/input_boost_enabled 1
    write /sys/module/cpu_boost/parameters/input_boost_freq "0:960000 1:960000 2:960000 3:960000 4:0 5:0 6:0 7:0"
    write /sys/module/cpu_boost/parameters/boost_ms 0
    write /sys/module/cpu_boost/parameters/input_boost_ms 40
    write /sys/module/cpu_boost/parameters/migration_load_threshold 15
    write /sys/module/cpu_boost/parameters/sync_threshold 0
    write /sys/module/msm_performance/parameters/touchboost 0
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_count 5
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_ceiling 10
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/boost_count 10
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/freq_step 6
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/freq_step 4
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold 60
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold_suspended 85
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold 75
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold_suspended 99
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/up_threshold 70
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/up_threshold 90
    write /sys/class/leds/lcd-backlight/max_brightness 255
    write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
    write /sys/module/adreno_idler/parameters/adreno_idler_active 1
    write /dev/cpuset/foreground/cpus 0-2,4-7
    write /dev/cpuset/foreground/boost/cpus 4-7
    write /dev/cpuset/top-app/cpus 0-7
    write /sys/module/lazyplug/parameters/nr_possible_cores 8

# Performance (based on DrunkSauce Lite)
on property:persist.spectrum.profile=1
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 75
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 0
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 40000
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack -1
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 80 384000:33 460800:25 600000:50 672000:65 787200:70 864000:85 960000:90 1248000:92
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 50000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/align_windows 0
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 166667
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 90
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 0
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1440000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack -1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads 74 768000:73 864000:64 960000:80 1248000:61 1344000:69 1440000:64 1536000:74 1632000:69 1689600:67 1824000:72
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 30000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/align_windows 0
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 20000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boostpulse_duration 80000
    write /sys/module/cpu_boost/parameters/input_boost_enabled 1
    write /sys/module/cpu_boost/parameters/input_boost_freq "0:1248000 1:1248000 2:1248000 3:1248000 4:0 5:0 6:0 7:0"
    write /sys/module/cpu_boost/parameters/boost_ms 80
    write /sys/module/cpu_boost/parameters/input_boost_ms 420
    write /sys/module/msm_performance/parameters/touchboost 0
    write /sys/class/leds/lcd-backlight/max_brightness 255
    write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
    write /sys/module/adreno_idler/parameters/adreno_idler_active 1
    write /dev/cpuset/foreground/cpus 0-2,4-7
    write /dev/cpuset/foreground/boost/cpus 4-7
    write /dev/cpuset/top-app/cpus 0-7
    write /sys/module/lazyplug/parameters/nr_possible_cores 8

# Battery
on property:persist.spectrum.profile=2
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor relaxed
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1248000
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor relaxed
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 768000
    write /sys/module/cpu_boost/parameters/input_boost_enabled 0
    write /sys/module/cpu_boost/parameters/input_boost_freq "0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0"
    write /sys/module/cpu_boost/parameters/boost_ms 0
    write /sys/module/cpu_boost/parameters/input_boost_ms 40
    write /sys/module/cpu_boost/parameters/migration_load_threshold 15
    write /sys/module/cpu_boost/parameters/sync_threshold 0
    write /sys/module/msm_performance/parameters/touchboost 0
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_count 6
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_ceiling 12
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/boost_count 12
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/freq_step 6
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/freq_step 4
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold 70
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold_suspended 85
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold 75
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold_suspended 99
    write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/up_threshold 75
    write /sys/devices/system/cpu/cpu4/cpufreq/chill/up_threshold 90
    write /sys/class/kgsl/kgsl-3d0/devfreq/governor powersave
    write /sys/class/leds/lcd-backlight/max_brightness 100
    write /dev/cpuset/foreground/cpus 0-2,4-5
    write /dev/cpuset/foreground/boost/cpus 4-5
    write /dev/cpuset/top-app/cpus 0-5
    write /sys/module/lazyplug/parameters/nr_possible_cores 6

# Gaming
on property:persist.spectrum.profile=3
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 75
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 0
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 40000
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack -1
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 80 384000:33 460800:25 600000:50 672000:65 787200:70 864000:85 960000:90 1248000:92
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 50000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/align_windows 0
    write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 166667
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 90
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 0
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1440000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack -1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads 74 768000:73 864000:64 960000:80 1248000:61 1344000:69 1440000:64 1536000:74 1632000:69 1689600:67 1824000:72
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 30000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/align_windows 0
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 20000
    write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boostpulse_duration 80000
    write /sys/module/cpu_boost/parameters/input_boost_enabled 1
    write /sys/module/cpu_boost/parameters/input_boost_freq "0:1248000 1:1248000 2:1248000 3:1248000 4:0 5:0 6:0 7:0"
    write /sys/module/cpu_boost/parameters/boost_ms 80
    write /sys/module/cpu_boost/parameters/input_boost_ms 420
    write /sys/module/msm_performance/parameters/touchboost 0
    write /sys/class/leds/lcd-backlight/max_brightness 255
    write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
    write /sys/module/adreno_idler/parameters/adreno_idler_active 0
    write /dev/cpuset/foreground/cpus 0-2,4-7
    write /dev/cpuset/foreground/boost/cpus 4-7
    write /dev/cpuset/top-app/cpus 0-7
    write /sys/module/lazyplug/parameters/nr_possible_cores 8
Recompile and your ready to go!

Some tips for profiles:
  • Make sure all profiles tweak the same parameters. Parameters don't get reset, when profile changes, so you have to make sure to change them back.
  • Not all profiles have to be complex! You could have one profile for your kernel and just use spectrum for minor tweaks
 
Last edited:

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,114
0
Spectrum injector

Spectrum Injector is a new method of adding spectrum support to your kernel! If the kernel you're running doesn't support Spectrum, you can add support without modifying it by flashing the spectrum injector zip. If the kernel does support Spectrum, flashing the zip will overwrite it and allow you to create your own profiles without decompiling the boot.img.

NOTE: These profiles are empty by default! You must customize them for them to do anything.

How to:
To create your profiles, you only need to modify the files located in /sdcard/Spectrum/profiles/ on your device.
These profiles are like ramdisk files, they accept commands of the format:
Code:
write /path/to/file value-to-set
along with all bash commands included in android such as
  • echo
  • chmod
  • chown
  • cp
  • mv
  • setprop

Once you have created your own custom profiles, you can apply them with the Spectrum app. Feel free to share your creations with other users, but remember, I'm not responsible for poorly written profiles that harm your device.

Download:https://www.androidfilehost.com/?fid=745425885120749066
 
Last edited:

nathanchance

Senior Recognized Developer / Recognized Contribut
Jul 22, 2015
13,748
49,942
0
25
Mesa, AZ
Wow @The Flash as faster at support than me for my own app. Guess thats how he got his name :p


Looks promising, but I'm awful at tuning kernel :p

Sent from my Redmi 3 using XDA Labs
One thing that helped me a lot was just learning what the tunables actually do: https://android.googlesource.com/ke...3.10/Documentation/cpu-freq/governors.txt#222

That documentation is a bit dense but can help a BUNCH when tweaking the governor. I'm always available to help with learning about tunables :)
 

rignfool

Well-known member
Dec 8, 2010
5,003
2,724
113
The Poconos
Could you please attach the GitHub files... I'm having a hell of a time getting them downloaded on mobile...

Edit: I got it... But man...

Sent from my Nexus 6 using Tapatalk
 
Last edited:

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,114
0
Could you please attach the GitHub files... I'm having a hell of a time getting them downloaded on mobile...

Edit: I got it... But man...

Sent from my Nexus 6 using Tapatalk
Why are you downloading them on mobile? Patching your ramdisk on your device?
 
  • Like
Reactions: achelis8

rignfool

Well-known member
Dec 8, 2010
5,003
2,724
113
The Poconos
Why are you downloading them on mobile? Patching your ramdisk on your device?
Android Image Kitchen for Mobile Magisk version
by @Oms0sis

And yeah... No Linux machine at my house...

I've been hacking Franco's profiles into the kernels I use for a few weeks now... And this makes my life a little easier... I only have to edit one file... And import one script and I can run the 3 things I use on init...

I wonder if you could use the image kitchen to modify on device thru the app interface...

Oh... And I get a crash on startup with the app...http://cloud.tapatalk.com/s/590d20a022a97/Log_2017-05-05_21-01-26.txt


Sent from my Nexus 6 using Tapatalk
 
  • Like
Reactions: kevp75

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,114
0
Android Image Kitchen for Mobile Magisk version
by @Oms0sis

And yeah... No Linux machine at my house...

I've been hacking Franco's profiles into the kernels I use for a few weeks now... And this makes my life a little easier... I only have to edit one file... And import one script and I can run the 3 things I use on init...

I wonder if you could use the image kitchen to modify on device thru the app interface...

Oh... And I get a crash on startup with the app...http://cloud.tapatalk.com/s/590d20a022a97/Log_2017-05-05_21-01-26.txt

Sent from my Nexus 6 using Tapatalk
Thanks for the log! It looks like a rom issue as it doesnt report an error or reason that it stopped, but i could be wrong. I'll look into it
 
Our Apps
Get our official app! (coming soon)
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone