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

Commit 43a6ba67 authored by Chong Zhang's avatar Chong Zhang
Browse files

Trust self pid in ResourceObserverService

Permission check only applies to remote observers.
bug: 170300341
test: unit test *without* running 'adb root' first.

Change-Id: I351ea58653c9c964cbb8cb9a76d000fc4450c2e2
parent 358a0844
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -163,7 +163,8 @@ binder_status_t ResourceObserverService::dump(
Status ResourceObserverService::registerObserver(
        const std::shared_ptr<IResourceObserver>& in_observer,
        const std::vector<MediaObservableFilter>& in_filters) {
    if (checkCallingPermission(
    if ((getpid() != AIBinder_getCallingPid()) &&
            checkCallingPermission(
            String16("android.permission.REGISTER_MEDIA_RESOURCE_OBSERVER")) == false) {
        ALOGE("Permission Denial: "
                "can't registerObserver from pid=%d, uid=%d\n",
@@ -217,7 +218,8 @@ Status ResourceObserverService::registerObserver(

Status ResourceObserverService::unregisterObserver(
        const std::shared_ptr<IResourceObserver>& in_observer) {
    if (checkCallingPermission(
    if ((getpid() != AIBinder_getCallingPid()) &&
            checkCallingPermission(
            String16("android.permission.REGISTER_MEDIA_RESOURCE_OBSERVER")) == false) {
        ALOGE("Permission Denial: "
                "can't unregisterObserver from pid=%d, uid=%d\n",