t2k269 / PerAppHacking

Allow apply some hacking to applications by Xposed Framework
48 stars 16 forks source link

Alarm Multiplier ? #4

Closed cmlx closed 10 years ago

cmlx commented 10 years ago

I wonder what those 1, 2, ... *100 meaning.

t2k269 commented 10 years ago

The logic is:

                            long now = now((Integer)param.args[0]);
                            long at = (Long)param.args[1];
                            long interval = (Long)param.args[2];
                            at = (at - now) * multiplier + now; 
                            interval = interval * multiplier;
//                          XposedBridge.log("Delay " + lpparam.packageName + " to setRepeatingAlarm(" + param.args[0] + ", " + at + ", " + interval + ", " + param.args[3] + ")");
                            param.args[1] = at;
                            param.args[2] = interval;

A brief description here: The module tries to delay the alarm to reduce the occurrence of the alarm. Ex: if the original interval is 6000 (ie 6 seconds) and the multiplier is 10, the new interval is 60000 (ie 60 seconds). So that the occurrence will be from 10 times/minute to 1 times/minute.

Some apps may fail to pool its server if the interval is too long, try it at your own risk.

cmlx commented 10 years ago

Thank you, this feature is very useful for me. But I think it would be better to describe this feature as "1/n occurrence of alarm" to decrease frequency of AlarmManager acquire. The *n multiplier makes me confused.