Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56a3290e authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

servicemanager: add sanity check in destructor am: 130242db am: 516e4af7 am: 1f13e9ec

am: 2929bf5f

Change-Id: I73caef4e440fbff8a05670d8a4fe970be8d699c9
parents 82d40516 2929bf5f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -25,6 +25,13 @@ using ::android::binder::Status;
namespace android {

ServiceManager::ServiceManager(std::unique_ptr<Access>&& access) : mAccess(std::move(access)) {}
ServiceManager::~ServiceManager() {
    // this should only happen in tests

    for (const auto& [name, service] : mNameToService) {
        CHECK(service.binder != nullptr) << name;
    }
}

Status ServiceManager::getService(const std::string& name, sp<IBinder>* outBinder) {
    // Servicemanager is single-threaded and cannot block. This method exists for legacy reasons.
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ namespace android {
class ServiceManager : public os::BnServiceManager, public IBinder::DeathRecipient {
public:
    ServiceManager(std::unique_ptr<Access>&& access);
    ~ServiceManager();

    binder::Status getService(const std::string& name, sp<IBinder>* outBinder) override;
    binder::Status checkService(const std::string& name, sp<IBinder>* outBinder) override;