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

Commit 167c270e authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Determine whether an input device supports USI using IDC files

It is necessary to identify a USI device so that additional logic can be
applied to the battery information that is exposed via USI.

Bug: 243005009
Test: manual, check dumpsys output
Change-Id: I697008e6600ef16b7ecde85c99732759747b8a9b
parent f5b4d7a8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -280,6 +280,9 @@ public:

    std::vector<InputDeviceLightInfo> getLights();

    inline void setSupportsUsi(bool supportsUsi) { mSupportsUsi = supportsUsi; }
    inline bool supportsUsi() const { return mSupportsUsi; }

private:
    int32_t mId;
    int32_t mGeneration;
@@ -292,6 +295,8 @@ private:
    uint32_t mSources;
    int32_t mKeyboardType;
    std::shared_ptr<KeyCharacterMap> mKeyCharacterMap;
    // Whether this device supports the Universal Stylus Initiative (USI) protocol for styluses.
    bool mSupportsUsi;

    bool mHasVibrator;
    bool mHasBattery;
+2 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other)
        mSources(other.mSources),
        mKeyboardType(other.mKeyboardType),
        mKeyCharacterMap(other.mKeyCharacterMap),
        mSupportsUsi(other.mSupportsUsi),
        mHasVibrator(other.mHasVibrator),
        mHasBattery(other.mHasBattery),
        mHasButtonUnderPad(other.mHasButtonUnderPad),
@@ -210,6 +211,7 @@ void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t control
    mHasBattery = false;
    mHasButtonUnderPad = false;
    mHasSensor = false;
    mSupportsUsi = false;
    mMotionRanges.clear();
    mSensors.clear();
    mLights.clear();
+6 −0
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) {
                             y.resolution);
    }
    info->setButtonUnderPad(mParameters.hasButtonUnderPad);
    info->setSupportsUsi(mParameters.supportsUsi);
}

void TouchInputMapper::dump(std::string& dump) {
@@ -505,6 +506,10 @@ void TouchInputMapper::configureParameters() {
    // up in your pocket but you can enable it using the input device configuration.
    mParameters.wake = getDeviceContext().isExternal();
    getDeviceContext().getConfiguration().tryGetProperty("touch.wake", mParameters.wake);

    mParameters.supportsUsi = false;
    getDeviceContext().getConfiguration().tryGetProperty("touch.supportsUsi",
                                                         mParameters.supportsUsi);
}

void TouchInputMapper::dumpParameters(std::string& dump) {
@@ -521,6 +526,7 @@ void TouchInputMapper::dumpParameters(std::string& dump) {
                         mParameters.uniqueDisplayId.c_str());
    dump += StringPrintf(INDENT4 "OrientationAware: %s\n", toString(mParameters.orientationAware));
    dump += INDENT4 "Orientation: " + ftl::enum_string(mParameters.orientation) + "\n";
    dump += StringPrintf(INDENT4 "SupportsUsi: %s\n", toString(mParameters.supportsUsi));
}

void TouchInputMapper::configureRawPointerAxes() {
+3 −0
Original line number Diff line number Diff line
@@ -232,6 +232,9 @@ protected:
        GestureMode gestureMode;

        bool wake;

        // Whether the device supports the Universal Stylus Initiative (USI) protocol for styluses.
        bool supportsUsi;
    } mParameters;

    // Immutable calibration parameters in parsed form.