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

Commit 4a8e5f7e authored by Carlos Martinez Romero's avatar Carlos Martinez Romero
Browse files

Add permission checks for sfdo functions.

The sfdo functions should only be called from a system uid. If the permission check fails the call return an error.

Bug: 379296794
Test: adb shell sfdo debug-flash
Flag: EXEMPT minor bug fix - permission check
Change-Id: Iafff85704c61779b3b0ae43946238a86a0841760
parent f9854d27
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -9082,26 +9082,46 @@ binder::Status SurfaceComposerAIDL::setGameDefaultFrameRateOverride(int32_t uid,
}

binder::Status SurfaceComposerAIDL::enableRefreshRateOverlay(bool active) {
    status_t status = checkAccessPermission();
    if (status != OK) {
        return binderStatusFromStatusT(status);
    }
    mFlinger->sfdo_enableRefreshRateOverlay(active);
    return binder::Status::ok();
}

binder::Status SurfaceComposerAIDL::setDebugFlash(int delay) {
    status_t status = checkAccessPermission();
    if (status != OK) {
        return binderStatusFromStatusT(status);
    }
    mFlinger->sfdo_setDebugFlash(delay);
    return binder::Status::ok();
}

binder::Status SurfaceComposerAIDL::scheduleComposite() {
    status_t status = checkAccessPermission();
    if (status != OK) {
        return binderStatusFromStatusT(status);
    }
    mFlinger->sfdo_scheduleComposite();
    return binder::Status::ok();
}

binder::Status SurfaceComposerAIDL::scheduleCommit() {
    status_t status = checkAccessPermission();
    if (status != OK) {
        return binderStatusFromStatusT(status);
    }
    mFlinger->sfdo_scheduleCommit();
    return binder::Status::ok();
}

binder::Status SurfaceComposerAIDL::forceClientComposition(bool enabled) {
    status_t status = checkAccessPermission();
    if (status != OK) {
        return binderStatusFromStatusT(status);
    }
    mFlinger->sfdo_forceClientComposition(enabled);
    return binder::Status::ok();
}