Wednesday, December 5, 2012

Tasker: CPU max in Call

Summary

I've been through a few tasker profiles for during calls. This version waits 15 seconds after entering the in call state, and then sets CPU max to 200mhz. It aborts if one of the exit tasks changes the variable while its running. Tasker only runs one task at once, and will interrupt if the priorities are different, so setting the abort profile higher allows it to interrupt. Whenever I change the CPU max, I always put a perm notification up so you can cancel it manually.

Code from backup

Task: Wait, Lower CPU 200mhz (42)
Run Both Together
A1: Variable Set [ Name:%CallTrigger To:1 Do Maths:Off Append:Off ]
A2: Wait [ MS:0 Seconds:15 Minutes:0 Hours:0 Days:0 ]
A3: If [ %CallTrigger ~ 1 ]
A4: Notify [ Title:CPU at 200mhz, click to cancel Text: Icon: Number:0 Permanent:On Priority:3 ]
A5: CPU [ CPU:0 Governor:smartassV2 Min. Frequency:100000 Max. Frequency:200000 ] 

Task: Return CPU to normal (40)
A1: Variable Set [ Name:%CallTrigger To:0 Do Maths:Off Append:Off ]
A2: CPU [ CPU:0 Governor:smartassV2 Min. Frequency:100000 Max. Frequency:1000000 ]
A3: Notify Cancel [ Title:CPU at 200mhz, click to cancel Warn Not Exist:Off ]
A4: Notify Cancel [ Title:CPU at 400mhz, click to cancel Warn Not Exist:Off ] 

Profile: In Call (39)
Priority: 6 CoolDown: 0
State: Call [ Type:Any Number:* ]
Enter: Wait, Lower CPU 200mhz (42)

Profile: Abort Call Event (41)
Priority: 10 CoolDown: 0
Event: Phone Idle
Enter: Return CPU to normal (40)

Profile: Abort Call State (43)
Priority: 10 CoolDown: 0
State: Call [ Type:Any Number:* ]
Exit: Return CPU to normal (40)

Profile: Cancel 200mhz (23)
Event: Notification Click [ Owner Application:Tasker Title:CPU at 200mhz, click to cancel ]
Enter: Return CPU to normal (40)

No comments: