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

Commit d0a89659 authored by Vishnu Nair's avatar Vishnu Nair Committed by Tiger Huang
Browse files

Pipe display install orientation 1/2

This is a step to move the layout logic to the client side. We won't
invoke IWindowSession#relayout then, and the client should be able to
set the transform hint on its own.

Bug: 161810301
Test: presubmit
Change-Id: I541b70fb921e22ab46ccb22391b8ca65eeb3d1a4
parent f22b3b79
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,8 @@ size_t StaticDisplayInfo::getFlattenedSize() const {
    return FlattenableHelpers::getFlattenedSize(connectionType) +
    return FlattenableHelpers::getFlattenedSize(connectionType) +
            FlattenableHelpers::getFlattenedSize(density) +
            FlattenableHelpers::getFlattenedSize(density) +
            FlattenableHelpers::getFlattenedSize(secure) +
            FlattenableHelpers::getFlattenedSize(secure) +
            FlattenableHelpers::getFlattenedSize(deviceProductInfo);
            FlattenableHelpers::getFlattenedSize(deviceProductInfo) +
            FlattenableHelpers::getFlattenedSize(installOrientation);
}
}


status_t StaticDisplayInfo::flatten(void* buffer, size_t size) const {
status_t StaticDisplayInfo::flatten(void* buffer, size_t size) const {
@@ -40,6 +41,7 @@ status_t StaticDisplayInfo::flatten(void* buffer, size_t size) const {
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, density));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, density));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, secure));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, secure));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, deviceProductInfo));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, deviceProductInfo));
    RETURN_IF_ERROR(FlattenableHelpers::flatten(&buffer, &size, installOrientation));
    return OK;
    return OK;
}
}


@@ -48,6 +50,7 @@ status_t StaticDisplayInfo::unflatten(void const* buffer, size_t size) {
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &density));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &density));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &secure));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &secure));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &deviceProductInfo));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &deviceProductInfo));
    RETURN_IF_ERROR(FlattenableHelpers::unflatten(&buffer, &size, &installOrientation));
    return OK;
    return OK;
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <optional>
#include <optional>


#include <ui/DeviceProductInfo.h>
#include <ui/DeviceProductInfo.h>
#include <ui/Rotation.h>
#include <utils/Flattenable.h>
#include <utils/Flattenable.h>


namespace android::ui {
namespace android::ui {
@@ -31,6 +32,7 @@ struct StaticDisplayInfo : LightFlattenable<StaticDisplayInfo> {
    float density = 0.f;
    float density = 0.f;
    bool secure = false;
    bool secure = false;
    std::optional<DeviceProductInfo> deviceProductInfo;
    std::optional<DeviceProductInfo> deviceProductInfo;
    Rotation installOrientation = ROTATION_0;


    bool isFixedSize() const { return false; }
    bool isFixedSize() const { return false; }
    size_t getFlattenedSize() const;
    size_t getFlattenedSize() const;
+3 −0
Original line number Original line Diff line number Diff line
@@ -1022,6 +1022,9 @@ status_t SurfaceFlinger::getStaticDisplayInfo(const sp<IBinder>& displayToken,
    info->secure = display->isSecure();
    info->secure = display->isSecure();
    info->deviceProductInfo = display->getDeviceProductInfo();
    info->deviceProductInfo = display->getDeviceProductInfo();


    // TODO: Scale this to multiple displays.
    info->installOrientation = display->isPrimary() ? internalDisplayOrientation : ui::ROTATION_0;

    return NO_ERROR;
    return NO_ERROR;
}
}