how to start android-TREBLE compatible vendor java service from /vendor/app
A

0

8

In my Android-O device, below two background services communicating each other though AIDL.

  1. Native/c++ android service

    • Starts through init rc
    • Runs with system linux-user
    • Deployed in /system partition, eg, /system/bin/nat binary.
  2. Java Service from apk

    • Starts through bootcomplete receiver registered in AndroidManifest.
    • Service class also specified in AndroidManifest and export:enabled is set.
    • Runs system system linux user, signed with platform certficate.
    • Deployed in system partition. eg /system/app/jav/jav.apk

So far no issues. Both above services are registered with ServiceManager. Both services were able to call each other through /dev/binder., Both start with Android boot and continue to run indefinitely.

Treble brings Trouble here:

As per Treble requirements, both above should be moved to /vendor partition with proper SEPolicies in place., so that, both java and c++ services can call each other through /dev/vndbinder., i.e by registering themselves with VendorServiceManager.

Referring documentation, https://source.android.com/devices/architecture/hidl/binder-ipc i am able to start the native c++ service from /vendor/bin/nat which registers with VenorServiceManager(/dev/vndbinder) successfully.

Now I am able to call aidl interface functions through vndservice call com.yyy.zzz.Myservice 0 But, failed to start JAVA vendor service deployed as /vendor/app/jav/jav.apk.

Looks like always ServiceManager handles all 'service' entries in AndroidManifest, instead of VendorServiceManager even for /vendor parition apps. Can't i register with VendorServiceManager through AndroidManifest? If yes, is there any sample app/code that i can refer?

Also,Android throws error saying background services cannot be started. Is there a way to have a background JAVA services from /vendor partition app, even if its started by system linux user and signed with platform certificate?

I don't want to have 'Job scheduler' kind of deferred handlers, as the communication and responses expected to be in realtime and the service is expected to be running indefinitely from boot time.

Please help with your suggestions.

Aylmar answered 25/3, 2019 at 10:10 Comment(1)
Please answer this question if you got the answer.Gladdy

© 2022 - 2024 — McMap. All rights reserved.