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

Commit f464f581 authored by Chris Ye's avatar Chris Ye Committed by Android (Google) Code Review
Browse files

Merge "Added the ability to read external batteries"

parents 089c2632 74be44dd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -213,6 +213,9 @@ public:
    inline void setVibrator(bool hasVibrator) { mHasVibrator = hasVibrator; }
    inline bool hasVibrator() const { return mHasVibrator; }

    inline void setHasBattery(bool hasBattery) { mHasBattery = hasBattery; }
    inline bool hasBattery() const { return mHasBattery; }

    inline void setButtonUnderPad(bool hasButton) { mHasButtonUnderPad = hasButton; }
    inline bool hasButtonUnderPad() const { return mHasButtonUnderPad; }

@@ -239,6 +242,7 @@ private:
    int32_t mKeyboardType;
    std::shared_ptr<KeyCharacterMap> mKeyCharacterMap;
    bool mHasVibrator;
    bool mHasBattery;
    bool mHasButtonUnderPad;
    bool mHasSensor;

+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other)
        mKeyboardType(other.mKeyboardType),
        mKeyCharacterMap(other.mKeyCharacterMap),
        mHasVibrator(other.mHasVibrator),
        mHasBattery(other.mHasBattery),
        mHasButtonUnderPad(other.mHasButtonUnderPad),
        mHasSensor(other.mHasSensor),
        mMotionRanges(other.mMotionRanges),
@@ -187,6 +188,7 @@ void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t control
    mSources = 0;
    mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE;
    mHasVibrator = false;
    mHasBattery = false;
    mHasButtonUnderPad = false;
    mHasSensor = false;
    mMotionRanges.clear();
+3 −0
Original line number Diff line number Diff line
@@ -28,4 +28,7 @@ interface IInputConstants
      * to identify apps that are using this flag.
      */
    const long BLOCK_FLAG_SLIPPERY = 157929241;

    // Indicate invalid battery capacity
    const int INVALID_BATTERY_CAPACITY = -1;
}
+4 −0
Original line number Diff line number Diff line
@@ -108,6 +108,10 @@ public:
    virtual bool isVibrating(int32_t deviceId) = 0;

    virtual std::vector<int32_t> getVibratorIds(int32_t deviceId) = 0;
    /* Get battery level of a particular input device. */
    virtual std::optional<int32_t> getBatteryCapacity(int32_t deviceId) = 0;
    /* Get battery status of a particular input device. */
    virtual std::optional<int32_t> getBatteryStatus(int32_t deviceId) = 0;

    /* Return true if the device can send input events to the specified display. */
    virtual bool canDispatchToDisplay(int32_t deviceId, int32_t displayId) = 0;
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ filegroup {
        "mapper/accumulator/CursorScrollAccumulator.cpp",
        "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
        "mapper/accumulator/TouchButtonAccumulator.cpp",
        "mapper/BatteryInputMapper.cpp",
        "mapper/CursorInputMapper.cpp",
        "mapper/ExternalStylusInputMapper.cpp",
        "mapper/InputMapper.cpp",
@@ -60,7 +61,11 @@ cc_defaults {
        "libui",
        "libutils",
    ],
    static_libs: [
        "libc++fs",
    ],
    header_libs: [
        "libbatteryservice_headers",
        "libinputreader_headers",
    ],
}
Loading