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

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

Snap for 12496712 from 915cd5f0 to 25Q1-release

Change-Id: Ia4b2613cc5169f096e6a71eb297122091903d150
parents ff4b381c 915cd5f0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -250,6 +250,9 @@ class MotionEventBuilder {
public:
    MotionEventBuilder(int32_t action, int32_t source) {
        mAction = action;
        if (mAction == AMOTION_EVENT_ACTION_CANCEL) {
            mFlags |= AMOTION_EVENT_FLAG_CANCELED;
        }
        mSource = source;
        mEventTime = systemTime(SYSTEM_TIME_MONOTONIC);
        mDownTime = mEventTime;
+1 −0
Original line number Diff line number Diff line
@@ -2807,6 +2807,7 @@ void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInf
    outInfo->autoLowLatencyModeSupported = ginfo.autoLowLatencyModeSupported;
    outInfo->gameContentTypeSupported = ginfo.gameContentTypeSupported;
    outInfo->preferredBootDisplayMode = ginfo.preferredBootDisplayMode;
    outInfo->hasArrSupport = ginfo.hasArrSupport;
}

status_t SurfaceComposerClient::getDynamicDisplayInfoFromId(int64_t displayId,
+3 −0
Original line number Diff line number Diff line
@@ -43,4 +43,7 @@ parcelable DynamicDisplayInfo {

    // The boot display mode preferred by the implementation.
    int preferredBootDisplayMode;

    // Represents whether display supports ARR.
    boolean hasArrSupport;
}
+2 −0
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ struct DynamicDisplayInfo {
    ui::DisplayModeId preferredBootDisplayMode;

    std::optional<ui::DisplayMode> getActiveDisplayMode() const;

    bool hasArrSupport;
};

} // namespace android::ui
+37 −26
Original line number Diff line number Diff line
@@ -4794,6 +4794,39 @@ void InputDispatcher::notifyPointerCaptureChanged(const NotifyPointerCaptureChan
    }
}

bool InputDispatcher::shouldRejectInjectedMotionLocked(const MotionEvent& motionEvent,
                                                       DeviceId deviceId,
                                                       ui::LogicalDisplayId displayId,
                                                       std::optional<gui::Uid> targetUid,
                                                       int32_t flags) {
    // Don't verify targeted injection, since it will only affect the caller's
    // window, and the windows are typically destroyed at the end of the test.
    if (targetUid.has_value()) {
        return false;
    }

    // Verify all other injected streams, whether the injection is coming from apps or from
    // input filter. Print an error if the stream becomes inconsistent with this event.
    // An inconsistent injected event sent could cause a crash in the later stages of
    // dispatching pipeline.
    auto [it, _] = mInputFilterVerifiersByDisplay.try_emplace(displayId,
                                                              std::string("Injection on ") +
                                                                      displayId.toString());
    InputVerifier& verifier = it->second;

    Result<void> result =
            verifier.processMovement(deviceId, motionEvent.getSource(), motionEvent.getAction(),
                                     motionEvent.getPointerCount(),
                                     motionEvent.getPointerProperties(),
                                     motionEvent.getSamplePointerCoords(), flags);
    if (!result.ok()) {
        logDispatchStateLocked();
        LOG(ERROR) << "Inconsistent event: " << motionEvent << ", reason: " << result.error();
        return true;
    }
    return false;
}

InputEventInjectionResult InputDispatcher::injectInputEvent(const InputEvent* event,
                                                            std::optional<gui::Uid> targetUid,
                                                            InputEventInjectionSync syncMode,
@@ -4904,33 +4937,11 @@ InputEventInjectionResult InputDispatcher::injectInputEvent(const InputEvent* ev

            mLock.lock();

            {
                // Verify all injected streams, whether the injection is coming from apps or from
                // input filter. Print an error if the stream becomes inconsistent with this event.
                // An inconsistent injected event sent could cause a crash in the later stages of
                // dispatching pipeline.
                auto [it, _] =
                        mInputFilterVerifiersByDisplay.try_emplace(displayId,
                                                                   std::string("Injection on ") +
                                                                           displayId.toString());
                InputVerifier& verifier = it->second;

                Result<void> result =
                        verifier.processMovement(resolvedDeviceId, motionEvent.getSource(),
                                                 motionEvent.getAction(),
                                                 motionEvent.getPointerCount(),
                                                 motionEvent.getPointerProperties(),
                                                 motionEvent.getSamplePointerCoords(), flags);
                if (!result.ok()) {
                    logDispatchStateLocked();
                    LOG(ERROR) << "Inconsistent event: " << motionEvent
                               << ", reason: " << result.error();
                    if (policyFlags & POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY) {
            if (shouldRejectInjectedMotionLocked(motionEvent, resolvedDeviceId, displayId,
                                                 targetUid, flags)) {
                mLock.unlock();
                return InputEventInjectionResult::FAILED;
            }
                }
            }

            const nsecs_t* sampleEventTimes = motionEvent.getSampleEventTimes();
            const size_t pointerCount = motionEvent.getPointerCount();
Loading