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

Commit ae8b20d8 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

ActivityManager: Add link/unlinkToDeath

Native services aren't killed when the system service dies, so they
may need to be able to tell when ActivityManager has died.

Test: adb shell stop; adb shell start; verify camera service still
   allows camera use. No regression to camera CTS.
Bug: 74230547

Change-Id: Iaa078b2f9a1d9c7be305b7667e3055a8ce52aa21
parent 43bfc23b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -80,4 +80,20 @@ void ActivityManager::unregisterUidObserver(const sp<IUidObserver>& observer)
    }
}

status_t ActivityManager::linkToDeath(const sp<IBinder::DeathRecipient>& recipient) {
    sp<IActivityManager> service = getService();
    if (service != NULL) {
        return IInterface::asBinder(service)->linkToDeath(recipient);
    }
    return INVALID_OPERATION;
}

status_t ActivityManager::unlinkToDeath(const sp<IBinder::DeathRecipient>& recipient) {
    sp<IActivityManager> service = getService();
    if (service != NULL) {
        return IInterface::asBinder(service)->unlinkToDeath(recipient);
    }
    return INVALID_OPERATION;
}

}; // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ public:
                             const String16& callingPackage);
    void unregisterUidObserver(const sp<IUidObserver>& observer);

    status_t linkToDeath(const sp<IBinder::DeathRecipient>& recipient);
    status_t unlinkToDeath(const sp<IBinder::DeathRecipient>& recipient);

private:
    Mutex mLock;
    sp<IActivityManager> mService;