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

Commit 521f4fc7 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Address comments: Add setPointerIcon for PointerChoreographer

Test: atest inputflinger_tests
Bug: 293587049
Change-Id: I3305518ed00ce3d7dd24ac299c218562dcf7e78b
parent 9932645d
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -450,12 +450,13 @@ bool PointerChoreographer::setPointerIcon(
        DeviceId deviceId) {
    std::scoped_lock _l(mLock);
    if (deviceId < 0) {
        ALOGW("Invalid device id %d. Cannot set pointer icon.", deviceId);
        LOG(WARNING) << "Invalid device id " << deviceId << ". Cannot set pointer icon.";
        return false;
    }
    const InputDeviceInfo* info = findInputDeviceLocked(deviceId);
    if (!info) {
        ALOGW("No input device info found for id %d. Cannot set pointer icon.", deviceId);
        LOG(WARNING) << "No input device info found for id " << deviceId
                     << ". Cannot set pointer icon.";
        return false;
    }
    const uint32_t sources = info->getSources();
@@ -485,12 +486,13 @@ bool PointerChoreographer::setPointerIcon(
                mousePointerIt->second->updatePointerIcon(std::get<PointerIconStyle>(icon));
            }
        } else {
            ALOGW("No mouse pointer controller found for display %d, device %d.", displayId,
                  deviceId);
            LOG(WARNING) << "No mouse pointer controller found for display " << displayId
                         << ", device " << deviceId << ".";
            return false;
        }
    } else {
        ALOGW("Cannot set pointer icon for display %d, device %d.", displayId, deviceId);
        LOG(WARNING) << "Cannot set pointer icon for display " << displayId << ", device "
                     << deviceId << ".";
        return false;
    }
    return true;
+5 −0
Original line number Diff line number Diff line
@@ -60,6 +60,11 @@ public:
    virtual FloatPoint getMouseCursorPosition(int32_t displayId) = 0;
    virtual void setShowTouchesEnabled(bool enabled) = 0;
    virtual void setStylusPointerIconEnabled(bool enabled) = 0;
    /**
     * Set the icon that is shown for the given pointer. The request may fail in some cases, such
     * as if the device or display was removed, or if the cursor was moved to a different display.
     * Returns true if the icon was changed successfully, false otherwise.
     */
    virtual bool setPointerIcon(std::variant<std::unique_ptr<SpriteIcon>, PointerIconStyle> icon,
                                int32_t displayId, DeviceId deviceId) = 0;