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

Commit 5c6c56c1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: add a backdoor to override display config" into qt-dev

parents e5fa4b1d 34392f72
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -4993,7 +4993,7 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
    }
    // Numbers from 1000 to 1034 are currently used for backdoors. The code
    // in onTransact verifies that the user is root, and has access to use SF.
    if (code >= 1000 && code <= 1034) {
    if (code >= 1000 && code <= 1035) {
        ALOGV("Accessing SurfaceFlinger through backdoor code: %u", code);
        return OK;
    }
@@ -5316,6 +5316,19 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                }
                return NO_ERROR;
            }
            case 1035: {
                n = data.readInt32();
                mDebugDisplayConfigSetByBackdoor = false;
                if (n >= 0) {
                    const auto displayToken = getInternalDisplayToken();
                    status_t result = setAllowedDisplayConfigs(displayToken, {n});
                    if (result != NO_ERROR) {
                        return result;
                    }
                    mDebugDisplayConfigSetByBackdoor = true;
                }
                return NO_ERROR;
            }
        }
    }
    return err;
@@ -5828,6 +5841,11 @@ status_t SurfaceFlinger::setAllowedDisplayConfigs(const sp<IBinder>& displayToke
        return BAD_VALUE;
    }

    if (mDebugDisplayConfigSetByBackdoor) {
        // ignore this request as config is overridden by backdoor
        return NO_ERROR;
    }

    postMessageSync(new LambdaMessage([&]() NO_THREAD_SAFETY_ANALYSIS {
        const auto display = getDisplayDeviceLocked(displayToken);
        if (!display) {
+3 −0
Original line number Diff line number Diff line
@@ -1142,6 +1142,9 @@ private:
    Hwc2::impl::PowerAdvisor mPowerAdvisor;

    std::unique_ptr<RefreshRateOverlay> mRefreshRateOverlay;

    // Flag used to set override allowed display configs from backdoor
    bool mDebugDisplayConfigSetByBackdoor = false;
};

} // namespace android