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

Commit 32b0a6ab authored by Patrick Williams's avatar Patrick Williams Committed by Android (Google) Code Review
Browse files

Merge "Allow root to create secure virtual displays." into main

parents ecc38b7f e58a92b7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -578,11 +578,11 @@ void SurfaceFlinger::run() {

sp<IBinder> SurfaceFlinger::createDisplay(const String8& displayName, bool secure,
                                          float requestedRefreshRate) {
    // onTransact already checks for some permissions, but adding an additional check here.
    // This is to ensure that only system and graphics can request to create a secure
    // SurfaceComposerAIDL checks for some permissions, but adding an additional check here.
    // This is to ensure that only root, system, and graphics can request to create a secure
    // display. Secure displays can show secure content so we add an additional restriction on it.
    const int uid = IPCThreadState::self()->getCallingUid();
    if (secure && uid != AID_GRAPHICS && uid != AID_SYSTEM) {
    if (secure && uid != AID_ROOT && uid != AID_GRAPHICS && uid != AID_SYSTEM) {
        ALOGE("Only privileged processes can create a secure display");
        return nullptr;
    }
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ TEST_F(CredentialsTest, CreateDisplayTest) {
    // Check with root.
    {
        UIDFaker f(AID_ROOT);
        ASSERT_FALSE(condition());
        ASSERT_TRUE(condition());
    }

    // Check as a Graphics user.