servicemanager: add tests for updatable-via-apex
This is a follow-up of 76944fee1a642cdfbabaa72ef7d29e53af1d50db.
With an example vendor apex installed on a cuttlefish device, the added
tests test two new APIs regarding updatable-via-apex.
- ServiceManager.updatableViaApex(instance)
- ServiceManager.getUpdatableNames(apexName)
This also fixes both methods
- (minor) updatableViaApex returns early when the match found
- getUpdatableNames iterates over all instances to find updatable
instances.
Bug: 254201177
Test: atest servicemanager_test
Change-Id: I165c5532b40a4f9d520bef55864708b1629e24c7
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp
index 2ae61b9..cc038ae 100644
--- a/cmds/servicemanager/ServiceManager.cpp
+++ b/cmds/servicemanager/ServiceManager.cpp
@@ -136,6 +136,7 @@
updatableViaApex = manifestInstance.updatableViaApex();
return false; // break (libvintf uses opposite convention)
});
+ if (updatableViaApex.has_value()) return true; // break (found match)
return false; // continue
});
@@ -154,7 +155,7 @@
manifestInstance.interface() + "/" + manifestInstance.instance();
instances.push_back(aname);
}
- return false; // continue
+ return true; // continue (libvintf uses opposite convention)
});
return false; // continue
});