logpersist: make the am command an optional dependency
Only call am to restart the Settings application when the am command is
available.
logpersist restarts the Settings application whenever it changes
persist.logd.logpersistd or persist.log.tag, directly, or indirectly via
logcatd.rc. It does so, because the Settings application's inner state
depends on these properties, and it doesn't automatically pick up any
changes to them.
However, some stripped down versions of Android, such as Microdroid and
Minidroid, do not include the am command, the Activity manager, Java
APIs or the Settings application. Thus, for instance on Minidroid,
logpersist prints out a confusing error message when it calls am, even
though it completes successfully, and there's no Settings application
to restart.
Bug: 267597848
Test: manually tested logpersist on Minidroid and on a regular phone
build (aosp_cf_x86_64_phone-userdebug) running on Cuttlefish.
* on Minidroid: logpersist.start prints that it's attempting to
kill the Settings app, then that am is unavailable, but no
other errors.
* on phone: logpersist.start prints that it's attempting to kill
the Settings app and no other errors, meaning that it completes
successfully.
Change-Id: I9a0f779d51042b5b66aa1406b27a11e848a0312d
1 file changed