summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/content/RestrictionEntry.java7
-rw-r--r--services/input/InputReader.cpp53
-rw-r--r--services/input/InputReader.h5
-rw-r--r--services/java/com/android/server/firewall/IntentFirewall.java1
5 files changed, 57 insertions, 10 deletions
diff --git a/api/current.txt b/api/current.txt
index dcbbfea..dba8be7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6473,7 +6473,6 @@ package android.content {
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int TYPE_BOOLEAN = 1; // 0x1
field public static final int TYPE_CHOICE = 2; // 0x2
- field public static final int TYPE_CHOICE_LEVEL = 3; // 0x3
field public static final int TYPE_MULTI_SELECT = 4; // 0x4
field public static final int TYPE_NULL = 0; // 0x0
}
diff --git a/core/java/android/content/RestrictionEntry.java b/core/java/android/content/RestrictionEntry.java
index af90385..217cf76 100644
--- a/core/java/android/content/RestrictionEntry.java
+++ b/core/java/android/content/RestrictionEntry.java
@@ -60,6 +60,7 @@ public class RestrictionEntry implements Parcelable {
* and the corresponding values, respectively.
* The presentation could imply that values in lower array indices are included when a
* particular value is chosen.
+ * @hide
*/
public static final int TYPE_CHOICE_LEVEL = 3;
@@ -102,7 +103,7 @@ public class RestrictionEntry implements Parcelable {
private String[] currentValues;
/**
- * Constructor for {@link #TYPE_CHOICE} and {@link #TYPE_CHOICE_LEVEL} types.
+ * Constructor for {@link #TYPE_CHOICE} type.
* @param key the unique key for this restriction
* @param selectedString the current value
*/
@@ -206,7 +207,7 @@ public class RestrictionEntry implements Parcelable {
* shown to the user. Values will be chosen from this list as the user's selection and the
* selected values can be retrieved by a call to {@link #getAllSelectedStrings()}, or
* {@link #getSelectedString()}, depending on whether it is a multi-select type or choice type.
- * This method is not relevant for types other than {@link #TYPE_CHOICE_LEVEL},
+ * This method is not relevant for types other than
* {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
* @param choiceValues an array of Strings which will be the selected values for the user's
* selections.
@@ -241,7 +242,7 @@ public class RestrictionEntry implements Parcelable {
* user selects one or more of these choices, the corresponding value from the possible values
* are stored as the selected strings. The size of this array must match the size of the array
* set in {@link #setChoiceValues(String[])}. This method is not relevant for types other
- * than {@link #TYPE_CHOICE_LEVEL}, {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
+ * than {@link #TYPE_CHOICE}, and {@link #TYPE_MULTI_SELECT}.
* @param choiceEntries the list of user-visible choices.
* @see #setChoiceValues(String[])
*/
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index ab38ed2..3d6b6e7 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -6110,15 +6110,42 @@ void JoystickInputMapper::populateDeviceInfo(InputDeviceInfo* info) {
for (size_t i = 0; i < mAxes.size(); i++) {
const Axis& axis = mAxes.valueAt(i);
- info->addMotionRange(axis.axisInfo.axis, AINPUT_SOURCE_JOYSTICK,
- axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ addMotionRange(axis.axisInfo.axis, axis, info);
+
if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) {
- info->addMotionRange(axis.axisInfo.highAxis, AINPUT_SOURCE_JOYSTICK,
- axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ addMotionRange(axis.axisInfo.highAxis, axis, info);
+
}
}
}
+void JoystickInputMapper::addMotionRange(int32_t axisId, const Axis& axis,
+ InputDeviceInfo* info) {
+ info->addMotionRange(axisId, AINPUT_SOURCE_JOYSTICK,
+ axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ /* In order to ease the transition for developers from using the old axes
+ * to the newer, more semantically correct axes, we'll continue to register
+ * the old axes as duplicates of their corresponding new ones. */
+ int32_t compatAxis = getCompatAxis(axisId);
+ if (compatAxis >= 0) {
+ info->addMotionRange(compatAxis, AINPUT_SOURCE_JOYSTICK,
+ axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution);
+ }
+}
+
+/* A mapping from axes the joystick actually has to the axes that should be
+ * artificially created for compatibility purposes.
+ * Returns -1 if no compatibility axis is needed. */
+int32_t JoystickInputMapper::getCompatAxis(int32_t axis) {
+ switch(axis) {
+ case AMOTION_EVENT_AXIS_LTRIGGER:
+ return AMOTION_EVENT_AXIS_BRAKE;
+ case AMOTION_EVENT_AXIS_RTRIGGER:
+ return AMOTION_EVENT_AXIS_GAS;
+ }
+ return -1;
+}
+
void JoystickInputMapper::dump(String8& dump) {
dump.append(INDENT2 "Joystick Input Mapper:\n");
@@ -6373,9 +6400,10 @@ void JoystickInputMapper::sync(nsecs_t when, bool force) {
size_t numAxes = mAxes.size();
for (size_t i = 0; i < numAxes; i++) {
const Axis& axis = mAxes.valueAt(i);
- pointerCoords.setAxisValue(axis.axisInfo.axis, axis.currentValue);
+ setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.axis, axis.currentValue);
if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) {
- pointerCoords.setAxisValue(axis.axisInfo.highAxis, axis.highCurrentValue);
+ setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.highAxis,
+ axis.highCurrentValue);
}
}
@@ -6391,6 +6419,19 @@ void JoystickInputMapper::sync(nsecs_t when, bool force) {
getListener()->notifyMotion(&args);
}
+void JoystickInputMapper::setPointerCoordsAxisValue(PointerCoords* pointerCoords,
+ int32_t axis, float value) {
+ pointerCoords->setAxisValue(axis, value);
+ /* In order to ease the transition for developers from using the old axes
+ * to the newer, more semantically correct axes, we'll continue to produce
+ * values for the old axes as mirrors of the value of their corresponding
+ * new axes. */
+ int32_t compatAxis = getCompatAxis(axis);
+ if (compatAxis >= 0) {
+ pointerCoords->setAxisValue(compatAxis, value);
+ }
+}
+
bool JoystickInputMapper::filterAxes(bool force) {
bool atLeastOneSignificantChange = force;
size_t numAxes = mAxes.size();
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index 312f19b..ed2a5c1 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -1805,6 +1805,11 @@ private:
float newValue, float currentValue, float thresholdValue);
static bool isCenteredAxis(int32_t axis);
+ static int32_t getCompatAxis(int32_t axis);
+
+ static void addMotionRange(int32_t axisId, const Axis& axis, InputDeviceInfo* info);
+ static void setPointerCoordsAxisValue(PointerCoords* pointerCoords, int32_t axis,
+ float value);
};
} // namespace android
diff --git a/services/java/com/android/server/firewall/IntentFirewall.java b/services/java/com/android/server/firewall/IntentFirewall.java
index edba243..4496aae 100644
--- a/services/java/com/android/server/firewall/IntentFirewall.java
+++ b/services/java/com/android/server/firewall/IntentFirewall.java
@@ -107,6 +107,7 @@ public class IntentFirewall {
public IntentFirewall(AMSInterface ams) {
mAms = ams;
File rulesFile = getRulesFile();
+ rulesFile.getParentFile().mkdirs();
readRules(rulesFile);