DroidPluginTeam / DroidPlugin

A plugin framework on android,Run any third-party apk without installation, modification or repackage
http://droidpluginteam.github.io/DroidPlugin/
GNU Lesser General Public License v3.0
6.9k stars 2.53k forks source link

Inappropriate plugin service closure (VoiceService in whatsapp) #417

Open jeryack opened 6 years ago

jeryack commented 6 years ago

While trying to wrap whatsapp I am having the following problem: Continuous call to handleOnStartOne() method inside ServcesManager for the same Service will cause startId to grow each time by one. So when it is time for the service to stop properly (i.e. when calling to stopServiceToken(..., startId)), the code that handles the appropriate closure will be skipped: handleOnUnbindOne(intent); handleOnDestroyOne(info); So if this Service needs to do some special arrangements when calling stopSelf(), it won't do it.

In the case of whatsapp the service name is VoiceService, and this phenomena is happening after trying to perform phone call so that onStartCommand() of this service will be called continuously as long as there is no Answer.

I can solve this specific problem by preventing from startId to grow, but I am afraid to do damage to other scenarios.

Thanks Ackstein