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

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

Snap for 12864127 from edc71465 to 25Q2-release

Change-Id: Ibb91261b9546250a34a71f8851165a6cc64ff250
parents 59e96ada edc71465
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -89,8 +89,8 @@ TEST(UtilsHost, ExecuteLongRunning2) {
    }
    }


    // ~CommandResult() called, child process is killed.
    // ~CommandResult() called, child process is killed.
    // Assert that the second sleep does not finish.
    // Assert that the last sleep does not finish.
    EXPECT_LT(millisSince(start), 6000);
    EXPECT_LT(millisSince(start), 8000);
}
}


TEST(UtilsHost, KillWithSigKill) {
TEST(UtilsHost, KillWithSigKill) {
+5 −0
Original line number Original line Diff line number Diff line
@@ -121,6 +121,11 @@ std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS {
    PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors),
    PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors),
    PARCEL_READ_NO_STATUS(std::vector<android::sp<android::IBinder>>, debugReadAllStrongBinders),
    PARCEL_READ_NO_STATUS(std::vector<android::sp<android::IBinder>>, debugReadAllStrongBinders),
    PARCEL_READ_NO_STATUS(std::vector<int>, debugReadAllFileDescriptors),
    PARCEL_READ_NO_STATUS(std::vector<int>, debugReadAllFileDescriptors),
    [] (const ::android::Parcel& p, FuzzedDataProvider&) {
        FUZZ_LOG() << "about to markSensitive";
        p.markSensitive();
        FUZZ_LOG() << "markSensitive done";
    },
    [] (const ::android::Parcel& p, FuzzedDataProvider& provider) {
    [] (const ::android::Parcel& p, FuzzedDataProvider& provider) {
        std::string interface = provider.ConsumeRandomLengthString();
        std::string interface = provider.ConsumeRandomLengthString();
        FUZZ_LOG() << "about to enforceInterface: " << interface;
        FUZZ_LOG() << "about to enforceInterface: " << interface;
+10 −0
Original line number Original line Diff line number Diff line
@@ -40,6 +40,13 @@ void fillRandomParcel(Parcel* outputParcel, FuzzedDataProvider&& provider,
    const uint8_t fuzzerParcelOptions = provider.ConsumeIntegral<uint8_t>();
    const uint8_t fuzzerParcelOptions = provider.ConsumeIntegral<uint8_t>();
    const bool resultShouldBeView = fuzzerParcelOptions & 1;
    const bool resultShouldBeView = fuzzerParcelOptions & 1;
    const bool resultShouldBeRpc = fuzzerParcelOptions & 2;
    const bool resultShouldBeRpc = fuzzerParcelOptions & 2;
    const bool resultShouldMarkSensitive = fuzzerParcelOptions & 4;

    auto sensitivity_guard = binder::impl::make_scope_guard([&]() {
        if (resultShouldMarkSensitive) {
            outputParcel->markSensitive();
        }
    });


    Parcel* p;
    Parcel* p;
    if (resultShouldBeView) {
    if (resultShouldBeView) {
@@ -49,6 +56,9 @@ void fillRandomParcel(Parcel* outputParcel, FuzzedDataProvider&& provider,
    } else {
    } else {
        p = outputParcel; // directly fill out the output Parcel
        p = outputParcel; // directly fill out the output Parcel
    }
    }

    // must be last guard, so outputParcel gets setup as view before
    // other guards
    auto viewify_guard = binder::impl::make_scope_guard([&]() {
    auto viewify_guard = binder::impl::make_scope_guard([&]() {
        if (resultShouldBeView) {
        if (resultShouldBeView) {
            outputParcel->makeDangerousViewOf(p);
            outputParcel->makeDangerousViewOf(p);
+19 −18
Original line number Original line Diff line number Diff line
@@ -1333,7 +1333,7 @@ bool InputDispatcher::shouldPruneInboundQueueLocked(const MotionEntry& motionEnt
        const bool isStylus = isPointerFromStylus(motionEntry, /*pointerIndex=*/0);
        const bool isStylus = isPointerFromStylus(motionEntry, /*pointerIndex=*/0);


        sp<WindowInfoHandle> touchedWindowHandle =
        sp<WindowInfoHandle> touchedWindowHandle =
                findTouchedWindowAtLocked(displayId, x, y, isStylus);
                mWindowInfos.findTouchedWindowAt(displayId, x, y, isStylus);
        if (touchedWindowHandle != nullptr &&
        if (touchedWindowHandle != nullptr &&
            touchedWindowHandle->getApplicationToken() !=
            touchedWindowHandle->getApplicationToken() !=
                    mAwaitedFocusedApplication->getApplicationToken()) {
                    mAwaitedFocusedApplication->getApplicationToken()) {
@@ -1452,20 +1452,19 @@ void InputDispatcher::addRecentEventLocked(std::shared_ptr<const EventEntry> ent
    }
    }
}
}


sp<WindowInfoHandle> InputDispatcher::findTouchedWindowAtLocked(ui::LogicalDisplayId displayId,
sp<WindowInfoHandle> InputDispatcher::DispatcherWindowInfo::findTouchedWindowAt(
                                                                float x, float y, bool isStylus,
        ui::LogicalDisplayId displayId, float x, float y, bool isStylus,
                                                                bool ignoreDragWindow) const {
        const sp<android::gui::WindowInfoHandle> ignoreWindow) const {
    // Traverse windows from front to back to find touched window.
    // Traverse windows from front to back to find touched window.
    const auto& windowHandles = mWindowInfos.getWindowHandlesForDisplay(displayId);
    const auto& windowHandles = getWindowHandlesForDisplay(displayId);
    for (const sp<WindowInfoHandle>& windowHandle : windowHandles) {
    for (const sp<WindowInfoHandle>& windowHandle : windowHandles) {
        if (ignoreDragWindow && haveSameToken(windowHandle, mDragState->dragWindow)) {
        if (ignoreWindow && haveSameToken(windowHandle, ignoreWindow)) {
            continue;
            continue;
        }
        }


        const WindowInfo& info = *windowHandle->getInfo();
        const WindowInfo& info = *windowHandle->getInfo();
        if (!info.isSpy() &&
        if (!info.isSpy() &&
            windowAcceptsTouchAt(info, displayId, x, y, isStylus,
            windowAcceptsTouchAt(info, displayId, x, y, isStylus, getDisplayTransform(displayId))) {
                                 mWindowInfos.getDisplayTransform(displayId))) {
            return windowHandle;
            return windowHandle;
        }
        }
    }
    }
@@ -2474,7 +2473,7 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
        // be a pointer that would generate ACTION_DOWN, *and* touch should not already be down.
        // be a pointer that would generate ACTION_DOWN, *and* touch should not already be down.
        const bool isStylus = isPointerFromStylus(entry, pointerIndex);
        const bool isStylus = isPointerFromStylus(entry, pointerIndex);
        sp<WindowInfoHandle> newTouchedWindowHandle =
        sp<WindowInfoHandle> newTouchedWindowHandle =
                findTouchedWindowAtLocked(displayId, x, y, isStylus);
                mWindowInfos.findTouchedWindowAt(displayId, x, y, isStylus);


        if (isDown) {
        if (isDown) {
            targets += findOutsideTargetsLocked(displayId, newTouchedWindowHandle, pointer.id);
            targets += findOutsideTargetsLocked(displayId, newTouchedWindowHandle, pointer.id);
@@ -2657,7 +2656,7 @@ InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, const Motio
                    tempTouchState.getFirstForegroundWindowHandle(entry.deviceId);
                    tempTouchState.getFirstForegroundWindowHandle(entry.deviceId);
            LOG_ALWAYS_FATAL_IF(oldTouchedWindowHandle == nullptr);
            LOG_ALWAYS_FATAL_IF(oldTouchedWindowHandle == nullptr);
            sp<WindowInfoHandle> newTouchedWindowHandle =
            sp<WindowInfoHandle> newTouchedWindowHandle =
                    findTouchedWindowAtLocked(displayId, x, y, isStylus);
                    mWindowInfos.findTouchedWindowAt(displayId, x, y, isStylus);


            // Verify targeted injection.
            // Verify targeted injection.
            if (const auto err = verifyTargetedInjection(newTouchedWindowHandle, entry); err) {
            if (const auto err = verifyTargetedInjection(newTouchedWindowHandle, entry); err) {
@@ -2881,7 +2880,8 @@ void InputDispatcher::finishDragAndDrop(ui::LogicalDisplayId displayId, float x,
    constexpr bool isStylus = false;
    constexpr bool isStylus = false;


    sp<WindowInfoHandle> dropWindow =
    sp<WindowInfoHandle> dropWindow =
            findTouchedWindowAtLocked(displayId, x, y, isStylus, /*ignoreDragWindow=*/true);
            mWindowInfos.findTouchedWindowAt(displayId, x, y, isStylus, /*ignoreWindow=*/
                                             mDragState->dragWindow);
    if (dropWindow) {
    if (dropWindow) {
        vec2 local = dropWindow->getInfo()->transform.transform(x, y);
        vec2 local = dropWindow->getInfo()->transform.transform(x, y);
        sendDropWindowCommandLocked(dropWindow->getToken(), local.x, local.y);
        sendDropWindowCommandLocked(dropWindow->getToken(), local.x, local.y);
@@ -2936,8 +2936,8 @@ void InputDispatcher::addDragEventLocked(const MotionEntry& entry) {
            constexpr bool isStylus = false;
            constexpr bool isStylus = false;


            sp<WindowInfoHandle> hoverWindowHandle =
            sp<WindowInfoHandle> hoverWindowHandle =
                    findTouchedWindowAtLocked(entry.displayId, x, y, isStylus,
                    mWindowInfos.findTouchedWindowAt(entry.displayId, x, y, isStylus,
                                              /*ignoreDragWindow=*/true);
                                                     /*ignoreWindow=*/mDragState->dragWindow);
            // enqueue drag exit if needed.
            // enqueue drag exit if needed.
            if (hoverWindowHandle != mDragState->dragHoverWindowHandle &&
            if (hoverWindowHandle != mDragState->dragHoverWindowHandle &&
                !haveSameToken(hoverWindowHandle, mDragState->dragHoverWindowHandle)) {
                !haveSameToken(hoverWindowHandle, mDragState->dragHoverWindowHandle)) {
@@ -5931,10 +5931,11 @@ bool InputDispatcher::transferTouchGesture(const sp<IBinder>& fromToken, const s
 * Return null if there are no windows touched on that display, or if more than one foreground
 * Return null if there are no windows touched on that display, or if more than one foreground
 * window is being touched.
 * window is being touched.
 */
 */
sp<WindowInfoHandle> InputDispatcher::findTouchedForegroundWindowLocked(
sp<WindowInfoHandle> InputDispatcher::findTouchedForegroundWindow(
        ui::LogicalDisplayId displayId) const {
        const std::unordered_map<ui::LogicalDisplayId, TouchState>& touchStatesByDisplay,
    auto stateIt = mTouchStatesByDisplay.find(displayId);
        ui::LogicalDisplayId displayId) {
    if (stateIt == mTouchStatesByDisplay.end()) {
    const auto stateIt = touchStatesByDisplay.find(displayId);
    if (stateIt == touchStatesByDisplay.end()) {
        ALOGI("No touch state on display %s", displayId.toString().c_str());
        ALOGI("No touch state on display %s", displayId.toString().c_str());
        return nullptr;
        return nullptr;
    }
    }
@@ -5970,7 +5971,7 @@ bool InputDispatcher::transferTouchOnDisplay(const sp<IBinder>& destChannelToken
            return false;
            return false;
        }
        }


        sp<WindowInfoHandle> from = findTouchedForegroundWindowLocked(displayId);
        sp<WindowInfoHandle> from = findTouchedForegroundWindow(mTouchStatesByDisplay, displayId);
        if (from == nullptr) {
        if (from == nullptr) {
            ALOGE("Could not find a source window in %s for %p", __func__, destChannelToken.get());
            ALOGE("Could not find a source window in %s for %p", __func__, destChannelToken.get());
            return false;
            return false;
+8 −5
Original line number Original line Diff line number Diff line
@@ -252,9 +252,6 @@ private:
    // to transfer focus to a new application.
    // to transfer focus to a new application.
    std::shared_ptr<const EventEntry> mNextUnblockedEvent GUARDED_BY(mLock);
    std::shared_ptr<const EventEntry> mNextUnblockedEvent GUARDED_BY(mLock);


    sp<android::gui::WindowInfoHandle> findTouchedWindowAtLocked(
            ui::LogicalDisplayId displayId, float x, float y, bool isStylus = false,
            bool ignoreDragWindow = false) const REQUIRES(mLock);
    std::vector<InputTarget> findOutsideTargetsLocked(
    std::vector<InputTarget> findOutsideTargetsLocked(
            ui::LogicalDisplayId displayId, const sp<android::gui::WindowInfoHandle>& touchedWindow,
            ui::LogicalDisplayId displayId, const sp<android::gui::WindowInfoHandle>& touchedWindow,
            int32_t pointerId) const REQUIRES(mLock);
            int32_t pointerId) const REQUIRES(mLock);
@@ -263,8 +260,9 @@ private:
            ui::LogicalDisplayId displayId, float x, float y, bool isStylus,
            ui::LogicalDisplayId displayId, float x, float y, bool isStylus,
            DeviceId deviceId) const REQUIRES(mLock);
            DeviceId deviceId) const REQUIRES(mLock);


    sp<android::gui::WindowInfoHandle> findTouchedForegroundWindowLocked(
    static sp<android::gui::WindowInfoHandle> findTouchedForegroundWindow(
            ui::LogicalDisplayId displayId) const REQUIRES(mLock);
            const std::unordered_map<ui::LogicalDisplayId, TouchState>& touchStatesByDisplay,
            ui::LogicalDisplayId displayId);


    std::shared_ptr<Connection> getConnectionLocked(const sp<IBinder>& inputConnectionToken) const
    std::shared_ptr<Connection> getConnectionLocked(const sp<IBinder>& inputConnectionToken) const
            REQUIRES(mLock);
            REQUIRES(mLock);
@@ -398,6 +396,11 @@ private:


        bool isWindowPresent(const sp<android::gui::WindowInfoHandle>& windowHandle) const;
        bool isWindowPresent(const sp<android::gui::WindowInfoHandle>& windowHandle) const;


        // Returns the touched window at the given location, excluding the ignoreWindow if provided.
        sp<android::gui::WindowInfoHandle> findTouchedWindowAt(
                ui::LogicalDisplayId displayId, float x, float y, bool isStylus = false,
                const sp<android::gui::WindowInfoHandle> ignoreWindow = nullptr) const;

        std::string dumpDisplayAndWindowInfo() const;
        std::string dumpDisplayAndWindowInfo() const;


    private:
    private: