Android service not showing in `service list`

Viewed 429

I have a background system service running on my android (priv-app), and I can create and start it properly with:

# am start-service  -n <my service>

It starts properly and I can see it running wiht ps -A, but service list does not show it.

I would like to call its methods using am start -a <myservice>.doSomething. I never see a "client" binding to it.

I can see the service running in dumpsys tho:

  * ServiceRecord{ea1df4c u0 com.foo.bar.platformprovision/.PlatformProvisionService}
    intent={cmp=com.foo.bar.platformprovision/.PlatformProvisionService}
    packageName=com.foo.bar.platformprovision
    processName=com.foo.bar.platformprovision
    permission=android.permission.BIND_JOB_SERVICE
    baseDir=/system/priv-app/bar_platformprovision_debug/platformprovision_debug.apk
    dataDir=/data/user/0/com.foo.bar.platformprovision
    app=ProcessRecord{3f8a209 19448:com.foo.bar.platformprovision/u0a113}
    createTime=-21m13s353ms startingBgTimeout=--
    lastActivity=-21m2s910ms restartTime=-21m2s910ms createdFromFg=true
    startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1

My onBind code looks like this:

  @Override
  public IBinder onBind(Intent intent) {
    Log.i(TAG, "XXX: Service bond");

    IBinder ib = (IBinder) new RemotePlatformServiceImp();
    return ib;
  }

Two questions:

  1. why I do not see my process running in service list
  2. How to call methods (from AIDL) from adb properly?
1 Answers

This command adb shell service list only shows system services. App services won't show there.

If your service is in an app, even if that app is a system app, it doesn't make it a "system service". These services are the ones started by SystemServer, like for example AudioService

adb shell dumpsys activity services will show info for apps services.

As for the second question, as far as I know adb shell service call XXXX also would work only for system services.

Related