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

Commit 61614017 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11260009 from 066960e9 to 24Q2-release

Change-Id: Ica09623c7b88558303443f35d95cd19dc6346d30
parents 70e58336 066960e9
Loading
Loading
Loading
Loading
+15 −33
Original line number Diff line number Diff line
@@ -31,11 +31,7 @@ namespace aidl::android::os {
 */
class PersistableBundle {
   public:
    PersistableBundle() noexcept {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
            mPBundle = APersistableBundle_new();
        }
    }
    PersistableBundle() noexcept : mPBundle(APersistableBundle_new()) {}
    // takes ownership of the APersistableBundle*
    PersistableBundle(APersistableBundle* _Nonnull bundle) noexcept : mPBundle(bundle) {}
    // takes ownership of the APersistableBundle*
@@ -331,33 +327,21 @@ class PersistableBundle {
    }

    bool getBooleanVector(const std::string& key, std::vector<bool>* _Nonnull vec) {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
        return getVecInternal<bool>(&APersistableBundle_getBooleanVector, mPBundle, key.c_str(),
                                    vec);
    }
        return false;
    }
    bool getIntVector(const std::string& key, std::vector<int32_t>* _Nonnull vec) {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
        return getVecInternal<int32_t>(&APersistableBundle_getIntVector, mPBundle, key.c_str(),
                                       vec);
    }
        return false;
    }
    bool getLongVector(const std::string& key, std::vector<int64_t>* _Nonnull vec) {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
        return getVecInternal<int64_t>(&APersistableBundle_getLongVector, mPBundle, key.c_str(),
                                       vec);
    }
        return false;
    }
    bool getDoubleVector(const std::string& key, std::vector<double>* _Nonnull vec) {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
        return getVecInternal<double>(&APersistableBundle_getDoubleVector, mPBundle, key.c_str(),
                                      vec);
    }
        return false;
    }

    // Takes ownership of and frees the char** and its elements.
    // Creates a new set or vector based on the array of char*.
@@ -377,7 +361,6 @@ class PersistableBundle {
    }

    bool getStringVector(const std::string& key, std::vector<std::string>* _Nonnull vec) {
        if (__builtin_available(android __ANDROID_API_V__, *)) {
        int32_t bytes = APersistableBundle_getStringVector(mPBundle, key.c_str(), nullptr, 0,
                                                           &stringAllocator, nullptr);
        if (bytes > 0) {
@@ -389,7 +372,6 @@ class PersistableBundle {
                return true;
            }
        }
        }
        return false;
    }

+7 −0
Original line number Diff line number Diff line
@@ -1418,6 +1418,9 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason
    switch (entry.type) {
        case EventEntry::Type::KEY: {
            CancelationOptions options(CancelationOptions::Mode::CANCEL_NON_POINTER_EVENTS, reason);
            const KeyEntry& keyEntry = static_cast<const KeyEntry&>(entry);
            options.displayId = keyEntry.displayId;
            options.deviceId = keyEntry.deviceId;
            synthesizeCancelationEventsForAllConnectionsLocked(options);
            break;
        }
@@ -1425,10 +1428,14 @@ void InputDispatcher::dropInboundEventLocked(const EventEntry& entry, DropReason
            const MotionEntry& motionEntry = static_cast<const MotionEntry&>(entry);
            if (motionEntry.source & AINPUT_SOURCE_CLASS_POINTER) {
                CancelationOptions options(CancelationOptions::Mode::CANCEL_POINTER_EVENTS, reason);
                options.displayId = motionEntry.displayId;
                options.deviceId = motionEntry.deviceId;
                synthesizeCancelationEventsForAllConnectionsLocked(options);
            } else {
                CancelationOptions options(CancelationOptions::Mode::CANCEL_NON_POINTER_EVENTS,
                                           reason);
                options.displayId = motionEntry.displayId;
                options.deviceId = motionEntry.deviceId;
                synthesizeCancelationEventsForAllConnectionsLocked(options);
            }
            break;
+5 −7
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <compositionengine/LayerFE.h>
#include <compositionengine/OutputColorSetting.h>
#include <math/mat4.h>
#include <scheduler/interface/ICompositor.h>
#include <ui/FenceTime.h>
#include <ui/Transform.h>

@@ -89,17 +90,14 @@ struct CompositionRefreshArgs {
    // If set, causes the dirty regions to flash with the delay
    std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay;

    // Optional.
    // The earliest time to send the present command to the HAL.
    std::optional<std::chrono::steady_clock::time_point> earliestPresentTime;

    // The expected time for the next present
    nsecs_t expectedPresentTime{0};
    scheduler::FrameTargets frameTargets;

    // The frameInterval for the next present
    Fps frameInterval{};
    // TODO (b/315371484): Calculate per display and store on `FrameTarget`.
    Fps frameInterval;

    // If set, a frame has been scheduled for that time.
    // TODO (b/255601557): Calculate per display.
    std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime;

    std::vector<BorderRenderInfo> borderInfoList;
+33 −3
Original line number Diff line number Diff line
@@ -28,8 +28,11 @@
#include <compositionengine/impl/OutputLayer.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <compositionengine/impl/planner/Planner.h>
#include <ftl/algorithm.h>
#include <ftl/future.h>
#include <gui/TraceUtils.h>
#include <scheduler/FrameTargeter.h>
#include <scheduler/Time.h>

#include <optional>
#include <thread>
@@ -429,7 +432,28 @@ void Output::prepare(const compositionengine::CompositionRefreshArgs& refreshArg

ftl::Future<std::monostate> Output::present(
        const compositionengine::CompositionRefreshArgs& refreshArgs) {
    ATRACE_FORMAT("%s for %s", __func__, mNamePlusId.c_str());
    const auto stringifyExpectedPresentTime = [this, &refreshArgs]() -> std::string {
        return ftl::Optional(getDisplayId())
                .and_then(PhysicalDisplayId::tryCast)
                .and_then([&refreshArgs](PhysicalDisplayId id) {
                    return refreshArgs.frameTargets.get(id);
                })
                .transform([](const auto& frameTargetPtr) {
                    return frameTargetPtr.get()->expectedPresentTime();
                })
                .transform([](TimePoint expectedPresentTime) {
                    return base::StringPrintf(" vsyncIn %.2fms",
                                              ticks<std::milli, float>(expectedPresentTime -
                                                                       TimePoint::now()));
                })
                .or_else([] {
                    // There is no vsync for this output.
                    return std::make_optional(std::string());
                })
                .value();
    };
    ATRACE_FORMAT("%s for %s%s", __func__, mNamePlusId.c_str(),
                  stringifyExpectedPresentTime().c_str());
    ALOGV(__FUNCTION__);

    updateColorProfile(refreshArgs);
@@ -853,8 +877,14 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr
        return;
    }

    editState().earliestPresentTime = refreshArgs.earliestPresentTime;
    editState().expectedPresentTime = refreshArgs.expectedPresentTime;
    if (auto frameTargetPtrOpt = ftl::Optional(getDisplayId())
                                         .and_then(PhysicalDisplayId::tryCast)
                                         .and_then([&refreshArgs](PhysicalDisplayId id) {
                                             return refreshArgs.frameTargets.get(id);
                                         })) {
        editState().earliestPresentTime = frameTargetPtrOpt->get()->earliestPresentTime();
        editState().expectedPresentTime = frameTargetPtrOpt->get()->expectedPresentTime().ns();
    }
    editState().frameInterval = refreshArgs.frameInterval;
    editState().powerCallback = refreshArgs.powerCallback;

+3 −0
Original line number Diff line number Diff line
@@ -584,6 +584,9 @@ bool EventThread::shouldConsumeEvent(const DisplayEventReceiver::Event& event,
        case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
            return true;

        case DisplayEventReceiver::DISPLAY_EVENT_HDCP_LEVELS_CHANGE:
            return true;

        case DisplayEventReceiver::DISPLAY_EVENT_MODE_CHANGE: {
            return connection->mEventRegistration.test(
                    gui::ISurfaceComposer::EventRegistration::modeChanged);
Loading