Skip to content

Commit 9d286fc

Browse files
Priyanka Advani (xWF)Android (Google) Code Review
authored andcommitted
Merge "Revert "InputVerifier: verify button events and states"" into main
2 parents 9a508df + 1e37d1e commit 9d286fc

13 files changed

Lines changed: 31 additions & 776 deletions

File tree

include/android/input.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ enum {
849849
* Refer to the documentation on the MotionEvent class for descriptions of each button.
850850
*/
851851
enum {
852-
// LINT.IfChange(AMOTION_EVENT_BUTTON)
853852
/** primary */
854853
AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
855854
/** secondary */
@@ -862,7 +861,6 @@ enum {
862861
AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
863862
AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
864863
AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
865-
// LINT.ThenChange(/frameworks/native/libs/input/rust/input.rs)
866864
};
867865

868866
/**

include/input/InputVerifier.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ class InputVerifier {
4747
InputVerifier(const std::string& name);
4848

4949
android::base::Result<void> processMovement(int32_t deviceId, int32_t source, int32_t action,
50-
int32_t actionButton, uint32_t pointerCount,
50+
uint32_t pointerCount,
5151
const PointerProperties* pointerProperties,
52-
const PointerCoords* pointerCoords, int32_t flags,
53-
int32_t buttonState);
52+
const PointerCoords* pointerCoords, int32_t flags);
5453

5554
void resetDevice(int32_t deviceId);
5655

libs/input/Android.bp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ rust_bindgen {
9191
"--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",
9292
"--allowlist-var=AMOTION_EVENT_ACTION_DOWN",
9393
"--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT",
94-
"--allowlist-var=AMOTION_EVENT_BUTTON_PRIMARY",
95-
"--allowlist-var=AMOTION_EVENT_BUTTON_SECONDARY",
96-
"--allowlist-var=AMOTION_EVENT_BUTTON_TERTIARY",
97-
"--allowlist-var=AMOTION_EVENT_BUTTON_BACK",
98-
"--allowlist-var=AMOTION_EVENT_BUTTON_FORWARD",
99-
"--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_PRIMARY",
100-
"--allowlist-var=AMOTION_EVENT_BUTTON_STYLUS_SECONDARY",
10194
"--allowlist-var=MAX_POINTER_ID",
10295
"--allowlist-var=AINPUT_SOURCE_CLASS_NONE",
10396
"--allowlist-var=AINPUT_SOURCE_CLASS_BUTTON",

libs/input/InputTransport.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ status_t InputPublisher::publishMotionEvent(
651651
const status_t status = mChannel->sendMessage(&msg);
652652

653653
if (status == OK && verifyEvents()) {
654-
Result<void> result = mInputVerifier.processMovement(deviceId, source, action, actionButton,
655-
pointerCount, pointerProperties,
656-
pointerCoords, flags, buttonState);
654+
Result<void> result =
655+
mInputVerifier.processMovement(deviceId, source, action, pointerCount,
656+
pointerProperties, pointerCoords, flags);
657657
if (!result.ok()) {
658658
LOG(ERROR) << "Bad stream: " << result.error();
659659
return BAD_VALUE;

libs/input/InputVerifier.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,17 @@ InputVerifier::InputVerifier(const std::string& name)
3434
: mVerifier(android::input::verifier::create(rust::String::lossy(name))){};
3535

3636
Result<void> InputVerifier::processMovement(DeviceId deviceId, int32_t source, int32_t action,
37-
int32_t actionButton, uint32_t pointerCount,
37+
uint32_t pointerCount,
3838
const PointerProperties* pointerProperties,
39-
const PointerCoords* pointerCoords, int32_t flags,
40-
int32_t buttonState) {
39+
const PointerCoords* pointerCoords, int32_t flags) {
4140
std::vector<RustPointerProperties> rpp;
4241
for (size_t i = 0; i < pointerCount; i++) {
4342
rpp.emplace_back(RustPointerProperties{.id = pointerProperties[i].id});
4443
}
4544
rust::Slice<const RustPointerProperties> properties{rpp.data(), rpp.size()};
4645
rust::String errorMessage =
4746
android::input::verifier::process_movement(*mVerifier, deviceId, source, action,
48-
actionButton, properties,
49-
static_cast<uint32_t>(flags),
50-
static_cast<uint32_t>(buttonState));
47+
properties, static_cast<uint32_t>(flags));
5148
if (errorMessage.empty()) {
5249
return {};
5350
} else {

libs/input/rust/input.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ bitflags! {
101101

102102
/// A rust enum representation of a MotionEvent action.
103103
#[repr(u32)]
104-
#[derive(PartialEq)]
105104
pub enum MotionAction {
106105
/// ACTION_DOWN
107106
Down = input_bindgen::AMOTION_EVENT_ACTION_DOWN,
@@ -194,27 +193,6 @@ impl MotionAction {
194193
}
195194
}
196195

197-
bitflags! {
198-
/// MotionEvent buttons.
199-
#[derive(Clone, Copy, Debug, Default, PartialEq)]
200-
pub struct MotionButton: u32 {
201-
/// Primary button (e.g. the left mouse button)
202-
const Primary = input_bindgen::AMOTION_EVENT_BUTTON_PRIMARY;
203-
/// Secondary button (e.g. the right mouse button)
204-
const Secondary = input_bindgen::AMOTION_EVENT_BUTTON_SECONDARY;
205-
/// Tertiary button (e.g. the middle mouse button)
206-
const Tertiary = input_bindgen::AMOTION_EVENT_BUTTON_TERTIARY;
207-
/// Back button
208-
const Back = input_bindgen::AMOTION_EVENT_BUTTON_BACK;
209-
/// Forward button
210-
const Forward = input_bindgen::AMOTION_EVENT_BUTTON_FORWARD;
211-
/// Primary stylus button
212-
const StylusPrimary = input_bindgen::AMOTION_EVENT_BUTTON_STYLUS_PRIMARY;
213-
/// Secondary stylus button
214-
const StylusSecondary = input_bindgen::AMOTION_EVENT_BUTTON_STYLUS_SECONDARY;
215-
}
216-
}
217-
218196
bitflags! {
219197
/// MotionEvent flags.
220198
/// The source of truth for the flag definitions are the MotionEventFlag AIDL enum.

0 commit comments

Comments
 (0)