summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2024-05-10 17:24:06 -0700
committer Siarhei Vishniakou <svv@google.com> 2024-05-10 18:07:38 -0700
commitb58c0c31025bc458204f35ae11f8b343535d27c6 (patch)
treeaea9c90a901773be84592ae29db414f343f2fbf7
parent870f4e7e579658f03b5c09a9928d35830bb7986f (diff)
Remove __linux__ ifdefs where not needed
The downstream branches now know about Parcel and binder, so in some places, these #ifdef statements are not needed. This CL should help reduce the divergence with downstream efforts. See the merge conflict resolution CL as an example: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/native/+/27201796/-2..3 Bug: 309829647 Test: presubmit Change-Id: Iec17cface5069ca79a565c205546db8ada8a07ee
-rw-r--r--include/input/Input.h20
-rw-r--r--include/input/KeyCharacterMap.h4
-rw-r--r--libs/input/Input.cpp6
-rw-r--r--libs/input/KeyCharacterMap.cpp6
4 files changed, 3 insertions, 33 deletions
diff --git a/include/input/Input.h b/include/input/Input.h
index 092a6982ed..e939145bbf 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -41,13 +41,11 @@
* Additional private constants not defined in ndk/ui/input.h.
*/
enum {
-#ifdef __linux__
+
/* This event was generated or modified by accessibility service. */
AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
-#else
- AKEY_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
-#endif
+
/* Signifies that the key is being predispatched */
AKEY_EVENT_FLAG_PREDISPATCH = 0x20000000,
@@ -90,15 +88,11 @@ enum {
AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE =
android::os::IInputConstants::MOTION_EVENT_FLAG_NO_FOCUS_CHANGE,
-#if defined(__linux__)
/**
* This event was generated or modified by accessibility service.
*/
AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT =
android::os::IInputConstants::INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT,
-#else
- AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800,
-#endif
AMOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS =
android::os::IInputConstants::MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS,
@@ -204,9 +198,7 @@ struct AInputDevice {
namespace android {
-#ifdef __linux__
class Parcel;
-#endif
/*
* Apply the given transform to the point without applying any translation/offset.
@@ -312,12 +304,8 @@ enum {
POLICY_FLAG_RAW_MASK = 0x0000ffff,
-#ifdef __linux__
POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY =
android::os::IInputConstants::POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY,
-#else
- POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000,
-#endif
/* These flags are set by the input dispatcher. */
@@ -486,10 +474,8 @@ struct PointerCoords {
vec2 getXYValue() const { return vec2(getX(), getY()); }
-#ifdef __linux__
status_t readFromParcel(Parcel* parcel);
status_t writeToParcel(Parcel* parcel) const;
-#endif
bool operator==(const PointerCoords& other) const;
inline bool operator!=(const PointerCoords& other) const {
@@ -912,10 +898,8 @@ public:
// Matrix is in row-major form and compatible with SkMatrix.
void applyTransform(const std::array<float, 9>& matrix);
-#ifdef __linux__
status_t readFromParcel(Parcel* parcel);
status_t writeToParcel(Parcel* parcel) const;
-#endif
static bool isTouchEvent(uint32_t source, int32_t action);
inline bool isTouchEvent() const {
diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h
index dfcf766402..92d5ec4d4e 100644
--- a/include/input/KeyCharacterMap.h
+++ b/include/input/KeyCharacterMap.h
@@ -19,9 +19,7 @@
#include <stdint.h>
#include <list>
-#ifdef __linux__
#include <binder/IBinder.h>
-#endif
#include <android-base/result.h>
#include <input/Input.h>
@@ -144,13 +142,11 @@ public:
std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode,
int32_t metaState) const;
-#ifdef __linux__
/* Reads a key map from a parcel. */
static std::unique_ptr<KeyCharacterMap> readFromParcel(Parcel* parcel);
/* Writes a key map to a parcel. */
void writeToParcel(Parcel* parcel) const;
-#endif
bool operator==(const KeyCharacterMap& other) const = default;
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index d27156383a..1178d02510 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -32,9 +32,7 @@
#include <input/InputDevice.h>
#include <input/InputEventLabels.h>
-#ifdef __linux__
#include <binder/Parcel.h>
-#endif
#if defined(__ANDROID__)
#include <sys/random.h>
#endif
@@ -483,7 +481,6 @@ void PointerCoords::scale(float globalScaleFactor, float windowXScale, float win
scaleAxisValue(*this, AMOTION_EVENT_AXIS_RELATIVE_Y, windowYScale);
}
-#ifdef __linux__
status_t PointerCoords::readFromParcel(Parcel* parcel) {
bits = parcel->readInt64();
@@ -511,7 +508,6 @@ status_t PointerCoords::writeToParcel(Parcel* parcel) const {
parcel->writeBool(isResampled);
return OK;
}
-#endif
void PointerCoords::tooManyAxes(int axis) {
ALOGW("Could not set value for axis %d because the PointerCoords structure is full and "
@@ -801,7 +797,6 @@ void MotionEvent::applyTransform(const std::array<float, 9>& matrix) {
}
}
-#ifdef __linux__
static status_t readFromParcel(ui::Transform& transform, const Parcel& parcel) {
float dsdx, dtdx, tx, dtdy, dsdy, ty;
status_t status = parcel.readFloat(&dsdx);
@@ -948,7 +943,6 @@ status_t MotionEvent::writeToParcel(Parcel* parcel) const {
}
return OK;
}
-#endif
bool MotionEvent::isTouchEvent(uint32_t source, int32_t action) {
if (isFromSource(source, AINPUT_SOURCE_CLASS_POINTER)) {
diff --git a/libs/input/KeyCharacterMap.cpp b/libs/input/KeyCharacterMap.cpp
index 41909bfb2d..f75bf410f2 100644
--- a/libs/input/KeyCharacterMap.cpp
+++ b/libs/input/KeyCharacterMap.cpp
@@ -19,11 +19,9 @@
#include <stdlib.h>
#include <string.h>
-#ifdef __linux__
-#include <binder/Parcel.h>
-#endif
#include <android/keycodes.h>
#include <attestation/HmacKeyManager.h>
+#include <binder/Parcel.h>
#include <input/InputEventLabels.h>
#include <input/KeyCharacterMap.h>
#include <input/Keyboard.h>
@@ -611,7 +609,6 @@ void KeyCharacterMap::addLockedMetaKey(Vector<KeyEvent>& outEvents,
}
}
-#ifdef __linux__
std::unique_ptr<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
if (parcel == nullptr) {
ALOGE("%s: Null parcel", __func__);
@@ -744,7 +741,6 @@ void KeyCharacterMap::writeToParcel(Parcel* parcel) const {
parcel->writeInt32(toAndroidKeyCode);
}
}
-#endif // __linux__
// --- KeyCharacterMap::Parser ---