I recently looked at how SpringBoard plays it's vibrations when you toggle silent switch or connect to power source. It only uses AudioServicesPlaySystemSound
with same argument (0x452 for charging, 0x453 for silent switch) regardles of silent switch. Only place where I've seen AudioServicesPlaySystemSoundWithVibration
call is when bulletin is added.
That applies to iOS 5-7. Only difference is on iOS 5 bulletins use AudioServicesPlaySoundWithBehavior
because AudioServicesPlaySystemSoundWithVibration
is only available starting at iOS 6.
UPDATE
Preferences app uses AudioServicesPlaySystemSound
with 0x547 or 0x546 as argument. The reason you can't see that with MobileSubstrate is because Preferences app loads AudioToolbox
framework at runtime using dlopen
and then obtains pointer to AudioServicesPlaySystemSound
with dlsym
. To hook the function in that case you need to wait until Preferences app obtained the pointer and only then hook it.
UPDATE 2
SpringBoard also uses CoreMedia.framework APIs to play vibrations. All arguments here are just a guess from looking at disassembly. I don't have much experience with C structure arguments and floating-point instructions.
FigVibratorPlayVibrationWithDictionary(CFDictionaryRef pattern, BOOL, float)
. Last two arguments are unknown to me - they are set as NO and 1.0f.
FigVibratorPlayVibration(float, CMTime, CMTime, CTime)
.
Functions above are most likely to be used by iOS but there are some other functions worth hooking:
FigVibratorStartOneShot(float, CMTime)
FigVibratorStartRepeating
. First argument is probably a float but don't know for others - it's some number of CMTime arguments.