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

Commit 5b769bda authored by Steven Thomas's avatar Steven Thomas Committed by Android (Google) Code Review
Browse files

Merge "Fix frozen screen after exiting vr"

parents 7dddbc2d eb6d2059
Loading
Loading
Loading
Loading
+24 −24
Original line number Diff line number Diff line
@@ -145,15 +145,16 @@ void Device::destroyDisplay(hwc2_display_t displayId)

void Device::onHotplug(hwc2_display_t displayId, Connection connection) {
    if (connection == Connection::Connected) {
        auto display = getDisplayById(displayId);
        if (display) {
            if (display->isConnected()) {
                ALOGW("Attempt to hotplug connect display %" PRIu64
                        " , which is already connected.", displayId);
            } else {
                display->setConnected(true);
        // If we get a hotplug connected event for a display we already have,
        // destroy the display and recreate it. This will force us to requery
        // the display params and recreate all layers on that display.
        auto oldDisplay = getDisplayById(displayId);
        if (oldDisplay != nullptr && oldDisplay->isConnected()) {
            ALOGI("Hotplug connecting an already connected display."
                    " Clearing old display state.");
        }
        } else {
        mDisplays.erase(displayId);

        DisplayType displayType;
        auto intError = mComposer->getDisplayType(displayId,
                reinterpret_cast<Hwc2::IComposerClient::DisplayType *>(
@@ -170,7 +171,6 @@ void Device::onHotplug(hwc2_display_t displayId, Connection connection) {
                *mComposer.get(), mCapabilities, displayId, displayType);
        newDisplay->setConnected(true);
        mDisplays.emplace(displayId, std::move(newDisplay));
        }
    } else if (connection == Connection::Disconnected) {
        // The display will later be destroyed by a call to
        // destroyDisplay(). For now we just mark it disconnected.
+10 −10
Original line number Diff line number Diff line
@@ -2154,9 +2154,8 @@ void SurfaceFlinger::processDisplayHotplugEventsLocked() {
        getBE().mHwc->onHotplug(event.display, displayType, event.connection);

        if (event.connection == HWC2::Connection::Connected) {
            if (!mBuiltinDisplays[displayType].get()) {
                ALOGV("Creating built in display %d", displayType);
            ALOGW_IF(mBuiltinDisplays[displayType],
                    "Overwriting display token for display type %d", displayType);
                mBuiltinDisplays[displayType] = new BBinder();
                // All non-virtual displays are currently considered secure.
                DisplayDeviceState info(displayType, true);
@@ -2164,6 +2163,7 @@ void SurfaceFlinger::processDisplayHotplugEventsLocked() {
                        "Built-in Screen" : "External Screen";
                mCurrentState.displays.add(mBuiltinDisplays[displayType], info);
                mInterceptor->saveDisplayCreation(info);
            }
        } else {
            ALOGV("Removing built in display %d", displayType);