Skip to content

Commit 5aab65d

Browse files
committed
libs/ui: Remove isStable() flag from DisplayId
There are currently no clients of DisplayId who use isStable(). This CL removes the parsing and serving of "stableness" of a DisplayId by removing the isStable() API, and all associated tests. See: go/edid-display-ids-al13 Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids Bug: 352320847 Test: Display{Id|Identification} & libsurfaceflinger_unittest Change-Id: I903fae86085001d32f77f34286c9f03ee481093b
1 parent a834ced commit 5aab65d

2 files changed

Lines changed: 3 additions & 31 deletions

File tree

libs/ui/include/ui/DisplayId.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <ostream>
2121
#include <string>
2222

23-
#include <ftl/hash.h>
2423
#include <ftl/optional.h>
2524

2625
namespace android {
@@ -31,16 +30,12 @@ struct DisplayId {
3130
// Flag indicating that the display is virtual.
3231
static constexpr uint64_t FLAG_VIRTUAL = 1ULL << 63;
3332

34-
// Flag indicating that the ID is stable across reboots.
35-
static constexpr uint64_t FLAG_STABLE = 1ULL << 62;
36-
3733
// TODO(b/162612135) Remove default constructor
3834
DisplayId() = default;
3935
constexpr DisplayId(const DisplayId&) = default;
4036
DisplayId& operator=(const DisplayId&) = default;
4137

4238
constexpr bool isVirtual() const { return value & FLAG_VIRTUAL; }
43-
constexpr bool isStable() const { return value & FLAG_STABLE; }
4439

4540
uint64_t value;
4641

@@ -106,6 +101,9 @@ struct PhysicalDisplayId : DisplayId {
106101
constexpr uint8_t getPort() const { return static_cast<uint8_t>(value); }
107102

108103
private:
104+
// Flag indicating that the ID is stable across reboots.
105+
static constexpr uint64_t FLAG_STABLE = 1ULL << 62;
106+
109107
constexpr PhysicalDisplayId(uint64_t flags, uint8_t port, uint16_t manufacturerId,
110108
uint32_t modelHash)
111109
: DisplayId(flags | (static_cast<uint64_t>(manufacturerId) << 40) |
@@ -149,13 +147,6 @@ struct HalVirtualDisplayId : VirtualDisplayId {
149147
struct GpuVirtualDisplayId : VirtualDisplayId {
150148
explicit constexpr GpuVirtualDisplayId(BaseId baseId) : VirtualDisplayId(FLAG_GPU | baseId) {}
151149

152-
static constexpr std::optional<GpuVirtualDisplayId> fromUniqueId(const std::string& uniqueId) {
153-
if (const auto hashOpt = ftl::stable_hash(uniqueId)) {
154-
return GpuVirtualDisplayId(HashTag{}, *hashOpt);
155-
}
156-
return {};
157-
}
158-
159150
static constexpr std::optional<GpuVirtualDisplayId> tryCast(DisplayId id) {
160151
if (id.isVirtual() && (id.value & FLAG_GPU)) {
161152
return GpuVirtualDisplayId(id);
@@ -164,10 +155,6 @@ struct GpuVirtualDisplayId : VirtualDisplayId {
164155
}
165156

166157
private:
167-
struct HashTag {}; // Disambiguate with BaseId constructor.
168-
constexpr GpuVirtualDisplayId(HashTag, uint64_t hash)
169-
: VirtualDisplayId(FLAG_STABLE | FLAG_GPU | hash) {}
170-
171158
explicit constexpr GpuVirtualDisplayId(DisplayId other) : VirtualDisplayId(other) {}
172159
};
173160

libs/ui/tests/DisplayId_test.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,6 @@ TEST(DisplayIdTest, createVirtualIdFromGpuVirtualId) {
7575
EXPECT_EQ((id.isVirtual() && isGpuVirtualId), GpuVirtualDisplayId::tryCast(id).has_value());
7676
}
7777

78-
TEST(DisplayIdTest, createGpuVirtualIdFromUniqueId) {
79-
static const std::string kUniqueId("virtual:ui:DisplayId_test");
80-
const auto idOpt = GpuVirtualDisplayId::fromUniqueId(kUniqueId);
81-
ASSERT_TRUE(idOpt.has_value());
82-
const GpuVirtualDisplayId id = idOpt.value();
83-
EXPECT_TRUE(VirtualDisplayId::tryCast(id));
84-
EXPECT_TRUE(GpuVirtualDisplayId::tryCast(id));
85-
EXPECT_FALSE(HalVirtualDisplayId::tryCast(id));
86-
EXPECT_FALSE(PhysicalDisplayId::tryCast(id));
87-
EXPECT_FALSE(HalDisplayId::tryCast(id));
88-
89-
EXPECT_EQ(id, DisplayId::fromValue(id.value));
90-
EXPECT_EQ(id, DisplayId::fromValue<GpuVirtualDisplayId>(id.value));
91-
}
92-
9378
TEST(DisplayIdTest, createHalVirtualId) {
9479
const HalVirtualDisplayId id(42);
9580
EXPECT_TRUE(VirtualDisplayId::tryCast(id));

0 commit comments

Comments
 (0)