linux - Is there a way to stop android services in init.rc gracefully (without SIGKILL)? -


i have native android service started , stopped property set via gui. commands start , stop service in init.rc follows:

service myservice /system/bin/myservice     class late_start     user my_service     disabled  on property:persist.myapp.myservice.enable=1     start myservice  on property:persist.myapp.myservice.enable=0     stop myservice 

there jni memory resources need cleaned if service stopped, appears service stopped via sigkill:

6944  6974 v myservice: imyprocessa::ontransact()  712   712 ap_kernel: init: service 'myservice' being killed...  510   510 servicemanager: service 'processa.myservice' died  656   656 v processa: processa::notificationclient::binderdied()  656   656 v processa: removenotificationclient() 0xb6bc60a8, pid 6944  656   656 v processa: processa::notificationclient::~notificationclient()  712   712 ap_kernel: init: service 'myservice' (pid 6944) killed signal 9  712   712 ap_kernel: init: service 'myservice' (pid 6944) killing children in process group  

since there no way intercept sigkill clean up, there options init.rc 'stop myservice' can change termination signal can intercept sigterm, example?

after discussing coworker, our consensus after sigkill, kernel reclaim of memory associated process , there no memory leak.

if has information contradicting that, please let me know.


Comments