Methods and types are poorly named. There is also some redundancy in service instance state tracking, as "idle" and "stopped" instances don't really exist.**
Changes to make:
- Remove unused "id" field from RunningServiceInfo
- Rename RunningServiceInfo to ServiceInstanceInfo
- ServiceManagerListener should be renamed to ServiceInstanceObserver
- Methods should be renamed and refactored:
- OnInit(RunningServiceInfo) => OnServiceInstanceObserverAdded(ServiceInstanceInfo)
- OnServiceCreated(RunningServiceInfo) => OnServiceInstanceCreated(Identity)
- OnServiceFailedToStart(Identity) => OnServiceInstanceFailedToStart(Identity)
- OnServiceStarted(Identity, pid) => OnServiceInstanceStarted(Identity)
- OnServicePIDReceived(Identity, pid) => OnServiceInstancePidKnown(Identity, pid)
- OnServiceStopped(Identity) => OnServiceInstanceStopped(Identity)
- Guarantee strict ordering of OnServiceInstancePidKnown following OnServiceStarted
** Idle instances always change to "starting" state immediately upon construction, and stopped instances are always destroyed immediately. As such, no instance can ever be observed in "idle" or "stopped" states.
Comment 1 by bugdroid1@chromium.org
, Nov 27