Android O background execution limits not fully applied with bounded and started service -


my sample app uses targetsdkversion 26.

i have simple service, both started , bounded following code snippet:

val intent = boundservicetest.buildintent(applicationcontext) applicationcontext.startservice(intent) applicationcontext.bindservice(intent, serviceconnection, bind_auto_create) 

please aware use global application context binding, not activity context.

the service imlements basic logging:

class boundservicetest : service() {    companion object {     private val tag = "boundservicetest"      fun buildintent(context: context): intent {         return intent(context, boundservicetest::class.java)     }   }    private val binder = binder()    override fun onbind(p0: intent?): ibinder {     log.d(tag, "onbind")     return binder   }    override fun onunbind(intent: intent?): boolean {     log.d(tag, "onunbind")     return super.onunbind(intent)   }    override fun oncreate() {     super.oncreate()     log.d(tag, "oncreate")   }    override fun onstartcommand(intent: intent?, flags: int, startid: int): int {     log.d(tag, "onstartcommand: startid = " + startid)     return start_sticky   }    override fun ondestroy() {     log.d(tag, "ondestroy")     super.ondestroy()   }  } 

basically not sure, if android o applies background execution limits or not, since documentation states (background service limitations):

bound services not affected

these rules not affect bound services in way. if app defines bound service, other components can bind service whether or not app in foreground.

but seems os isn't quite sure regarding logcat:

de.continental.android.androidoservicetest d/boundservicetest: oncreate de.continental.android.androidoservicetest d/boundservicetest: onstartcommand: startid = 1 de.continental.android.androidoservicetest d/boundservicetest: onbind ? w/activitymanager: stopping service due app idle: u0a141 -1m9s733ms de.continental.android.androidoservicetest/.boundservicetest i/runningstate: unknown non-service process: de.continental.android.androidoservicetest #14943 i/chatty: uid=1000(system) runningstate:ba identical 1 line i/runningstate: unknown non-service process: de.continental.android.androidoservicetest #14943 

the activitymanager log message indicates service shall stopped (regardless bound one), os doesn't stop service: log messages calling ondestroy method not displayed, compared simple started service without binding.

how scenario (started , bound service) handled in android o? or encounter bug?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -