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

Commit 7fc648b2 authored by Gil Dekel's avatar Gil Dekel
Browse files

libs/ui: Move ScreenPartStatus into its own header

We need to remove all libs/ui dependencies on DisplayIdentification in
order to be able to move it back to SF/Display. ScreenPartStatus is one
such dependency.

Move ScreenPartStatus to its own header in libs/ui. Also replace
ScreenPartStatusToString() with ftl::enum_string.

Bug: 415078475
Flag: EXEMPT refactor
Test: presubmit
Change-Id: I82ba05d156cdf63fb497ba9b5110cb673e35cb68
parent f30f8081
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@

#include <ui/DeviceProductInfo.h>
#include <ui/DisplayId.h>
#include <ui/ScreenPartStatus.h>
#include <ui/Size.h>

#define LEGACY_DISPLAY_TYPE_PRIMARY 0
@@ -39,33 +40,6 @@ struct DetailedTimingDescriptor {
    ui::Size physicalSizeInMm;
};

// These values must match the ones in ScreenPartStatus.aidl file in the composer HAL
enum class ScreenPartStatus : uint8_t {
    /**
     * Device cannot differentiate an original screen from a replaced screen.
     */
    UNSUPPORTED = 0,
    /**
     * Device has the original screen it was manufactured with.
     */
    ORIGINAL = 1,
    /**
     * Device has a replaced screen.
     */
    REPLACED = 2,
};

inline std::string ScreenPartStatusToString(ScreenPartStatus screenPartStatus) {
    switch (screenPartStatus) {
        case ScreenPartStatus::ORIGINAL:
            return "ORIGINAL";
        case ScreenPartStatus::REPLACED:
            return "REPLACED";
        default:
            return "UNSUPPORTED";
    }
}

struct DisplayIdentificationInfo {
    PhysicalDisplayId id;
    std::string name;
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <cstdint>

namespace android {

// These values must match the ones in ScreenPartStatus.aidl file in the composer HAL
enum class ScreenPartStatus : uint8_t {
    // Device cannot differentiate an original screen from a replaced screen.
    UNSUPPORTED = 0,
    // Device has the original screen it was manufactured with.
    ORIGINAL = 1,
    // Device has a replaced screen.
    REPLACED = 2,

    ftl_last = REPLACED
};

} // namespace android
+1 −2
Original line number Diff line number Diff line
@@ -6158,8 +6158,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
        }

        StringAppendF(&result, "port=%u pnpId=%s screenPartStatus=%s displayName=\"", port,
                      edid->pnpId.data(),
                      android::ScreenPartStatusToString(screenPartStatus).c_str());
                      edid->pnpId.data(), ftl::enum_string(screenPartStatus).c_str());
        result.append(edid->displayName.data(), edid->displayName.length());
        result.append("\"\n");
    }