File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
libs/binder/include/binder Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -113,13 +113,27 @@ sp<INTERFACE> waitForDeclaredService(const String16& name) {
113113 return interface_cast<INTERFACE>(sm->waitForService (name));
114114}
115115
116+ template <typename INTERFACE>
117+ sp<INTERFACE> checkDeclaredService (const String16& name) {
118+ const sp<IServiceManager> sm = defaultServiceManager ();
119+ if (!sm->isDeclared (name)) return nullptr ;
120+ return interface_cast<INTERFACE>(sm->checkService (name));
121+ }
122+
116123template <typename INTERFACE>
117124sp<INTERFACE> waitForVintfService (
118125 const String16& instance = String16(" default" )) {
119126 return waitForDeclaredService<INTERFACE>(
120127 INTERFACE::descriptor + String16 (" /" ) + instance);
121128}
122129
130+ template <typename INTERFACE>
131+ sp<INTERFACE> checkVintfService (
132+ const String16& instance = String16(" default" )) {
133+ return checkDeclaredService<INTERFACE>(
134+ INTERFACE::descriptor + String16 (" /" ) + instance);
135+ }
136+
123137template <typename INTERFACE>
124138status_t getService (const String16& name, sp<INTERFACE>* outService)
125139{
You can’t perform that action at this time.
0 commit comments