1 // 2 // Copyright 2005 The Android Open Source Project 3 // 4 #ifndef ANDROID_SERVICE_MANAGER_H 5 #define ANDROID_SERVICE_MANAGER_H 6 7 #include <binder/IServiceManager.h> 8 #include <utils/KeyedVector.h> 9 #include <utils/threads.h> 10 11 namespace android { 12 13 // ---------------------------------------------------------------------- 14 15 class BServiceManager : public BnServiceManager 16 { 17 public: 18 BServiceManager(); 19 20 virtual sp<IBinder> getService( const String16& name) const; 21 virtual sp<IBinder> checkService( const String16& name) const; 22 virtual status_t addService( const String16& name, 23 const sp<IBinder>& service); 24 virtual Vector<String16> listServices(); 25 26 27 private: 28 mutable Mutex mLock; 29 mutable Condition mChanged; 30 sp<IPermissionController> mPermissionController; 31 KeyedVector<String16, sp<IBinder> > mServices; 32 }; 33 34 // ---------------------------------------------------------------------- 35 36 }; // namespace android 37 38 #endif // ANDROID_SERVICE_MANAGER_H 39