Determine displayType in SurfaceFlinger
This change eliminates an assumption that the first hotplug connect
event is for the primary display, and all other events are for the
external display.
Bug: 38464421
Test: Boots, settings app navigable
Change-Id: I753deb9a4e99a7b225ab89562c7acf4ce284dbf5
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index affe505..070b691 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -52,24 +52,13 @@
class ComposerCallbackBridge : public Hwc2::IComposerCallback {
public:
ComposerCallbackBridge(ComposerCallback* callback, int32_t sequenceId)
- : mCallback(callback), mSequenceId(sequenceId),
- mHasPrimaryDisplay(false) {}
+ : mCallback(callback), mSequenceId(sequenceId) {}
Return<void> onHotplug(Hwc2::Display display,
IComposerCallback::Connection conn) override
{
HWC2::Connection connection = static_cast<HWC2::Connection>(conn);
- if (!mHasPrimaryDisplay) {
- LOG_ALWAYS_FATAL_IF(connection != HWC2::Connection::Connected,
- "Initial onHotplug callback should be "
- "primary display connected");
- mHasPrimaryDisplay = true;
- mCallback->onHotplugReceived(mSequenceId, display,
- connection, true);
- } else {
- mCallback->onHotplugReceived(mSequenceId, display,
- connection, false);
- }
+ mCallback->onHotplugReceived(mSequenceId, display, connection);
return Void();
}
@@ -85,12 +74,9 @@
return Void();
}
- bool HasPrimaryDisplay() { return mHasPrimaryDisplay; }
-
private:
ComposerCallback* mCallback;
int32_t mSequenceId;
- bool mHasPrimaryDisplay;
};
} // namespace anonymous
@@ -117,8 +103,6 @@
sp<ComposerCallbackBridge> callbackBridge(
new ComposerCallbackBridge(callback, sequenceId));
mComposer->registerCallback(callbackBridge);
- LOG_ALWAYS_FATAL_IF(!callbackBridge->HasPrimaryDisplay(),
- "Registered composer callback but didn't get primary display");
}
// Required by HWC2 device