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

Commit 8d2470d0 authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Android (Google) Code Review
Browse files

Merge "screenrecord: Use DisplayId::fromValue"

parents bbf17c29 31cce4f4
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -1067,7 +1067,7 @@ int main(int argc, char* const argv[]) {

    std::optional<PhysicalDisplayId> displayId = SurfaceComposerClient::getInternalDisplayId();
    if (!displayId) {
        fprintf(stderr, "Failed to get token for internal display\n");
        fprintf(stderr, "Failed to get ID for internal display\n");
        return 1;
    }

@@ -1168,17 +1168,14 @@ int main(int argc, char* const argv[]) {
            }
            break;
        case 'd':
            gPhysicalDisplayId = PhysicalDisplayId(atoll(optarg));
            if (gPhysicalDisplayId.value == 0) {
                fprintf(stderr, "Please specify a valid physical display id\n");
                return 2;
            } else if (SurfaceComposerClient::
                    getPhysicalDisplayToken(gPhysicalDisplayId) == nullptr) {
                fprintf(stderr, "Invalid physical display id: %s\n",
                        to_string(gPhysicalDisplayId).c_str());
                return 2;
            }
            if (const auto id = android::DisplayId::fromValue<PhysicalDisplayId>(atoll(optarg));
                id && SurfaceComposerClient::getPhysicalDisplayToken(*id)) {
                gPhysicalDisplayId = *id;
                break;
            }

            fprintf(stderr, "Invalid physical display ID\n");
            return 2;
        default:
            if (ic != '?') {
                fprintf(stderr, "getopt_long returned unexpected value 0x%x\n", ic);