Add default values for InputTarget struct
The struct InputTarget has some default values for its fields, but not
for all fields. Now that we are adding a FocusEntry, we don't want to
deal with scale and such. To prevent undefined values in this struct,
add default initializers.
Bug: none
Test: none
Change-Id: I47660f81a642f55182dd90e91dc19e17f4e2f1dd
diff --git a/services/inputflinger/dispatcher/InputTarget.h b/services/inputflinger/dispatcher/InputTarget.h
index 5acf92b..2e9bca2 100644
--- a/services/inputflinger/dispatcher/InputTarget.h
+++ b/services/inputflinger/dispatcher/InputTarget.h
@@ -93,21 +93,22 @@
sp<InputChannel> inputChannel;
// Flags for the input target.
- int32_t flags;
+ int32_t flags = 0;
// The x and y offset to add to a MotionEvent as it is delivered.
// (ignored for KeyEvents)
- float xOffset, yOffset;
+ float xOffset = 0.0f;
+ float yOffset = 0.0f;
// Scaling factor to apply to MotionEvent as it is delivered.
// (ignored for KeyEvents)
- float globalScaleFactor;
+ float globalScaleFactor = 1.0f;
float windowXScale = 1.0f;
float windowYScale = 1.0f;
// The subset of pointer ids to include in motion events dispatched to this input target
// if FLAG_SPLIT is set.
- BitSet32 pointerIds;
+ BitSet32 pointerIds{};
};
std::string dispatchModeToString(int32_t dispatchMode);