Require manifest specification for HIDL devices.
Changed vintfEmpty -> vintfLegacy which is based on
__ANDROID_TREBLE__.
This change does two things:
- make sure that race conditions between framework startup and
service startup don't occur unless "tryGetService" is explicitly
used. Since this change makes sure hals are actually in the manifest,
getService will always wait when appropriate.
- prevent framework backwards compatibility breaking for certain
development models (described below).
On Treble devices, allow this safety check to be turned off
during tests (like hidl_test) which register and unregister
services dynamically for testing purposes. On legacy/pre-Treble
devices, behavior is unchanged.
This means that you must set TREBLE_TESTING_OVERRIDE when running a test such
as hidl_test. Ideally these binaries set this value themselves. This allows
test modules to dynamically add and unset services even though they are not
declared in the device manifest. This prevents a problem where framework
changes are accidentally made in a way that is not backwards compatible. For
instance, consider the following situation for two devices developed in the
same tree:
A: serves @1.1::IFoo, declares @1.0::IFoo (incorrect)
B: serves @1.0::IFoo, declares @1.0::IFoo (correct configuration)
If development is done on device A, then framework code like: "V1_1::IFoo::
getService()->doV1_0Api()" will work. However, this will unintentionally break
the feature for devices like device B for which "V1_1::IFoo::getService()
will return nullptr. In order to prevent problems like this, we only allow
fetching an interface if it is declared in a VINTF manifest.
Test: multiple internal devices boot/work, lshal
Test: hidl_test, hidl_test_java
Test: added additional logging to hwservicemanager and made sure no
getService requests anywhere in the system were failing from this.
Bug: 38415912
Change-Id: Ib1d4f37c764470a96fbdfbcf991c8ca244746ea0
5 files changed