Loading include/input/Input.h +34 −35 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #ifdef __linux__ #include <android/os/IInputConstants.h> #endif #include <android/os/PointerIconType.h> #include <math.h> #include <stdint.h> #include <ui/Transform.h> Loading Loading @@ -1213,43 +1214,41 @@ public: * * Due to backwards compatibility and public api constraints, this is a duplicate (but type safe) * definition of PointerIcon.java. * * TODO(b/235023317) move this definition to an aidl and statically assign to the below java public * api values. * * WARNING: Keep these definitions in sync with * frameworks/base/core/java/android/view/PointerIcon.java */ enum class PointerIconStyle : int32_t { TYPE_CUSTOM = -1, TYPE_NULL = 0, TYPE_NOT_SPECIFIED = 1, TYPE_ARROW = 1000, TYPE_CONTEXT_MENU = 1001, TYPE_HAND = 1002, TYPE_HELP = 1003, TYPE_WAIT = 1004, TYPE_CELL = 1006, TYPE_CROSSHAIR = 1007, TYPE_TEXT = 1008, TYPE_VERTICAL_TEXT = 1009, TYPE_ALIAS = 1010, TYPE_COPY = 1011, TYPE_NO_DROP = 1012, TYPE_ALL_SCROLL = 1013, TYPE_HORIZONTAL_DOUBLE_ARROW = 1014, TYPE_VERTICAL_DOUBLE_ARROW = 1015, TYPE_TOP_RIGHT_DOUBLE_ARROW = 1016, TYPE_TOP_LEFT_DOUBLE_ARROW = 1017, TYPE_ZOOM_IN = 1018, TYPE_ZOOM_OUT = 1019, TYPE_GRAB = 1020, TYPE_GRABBING = 1021, TYPE_HANDWRITING = 1022, TYPE_SPOT_HOVER = 2000, TYPE_SPOT_TOUCH = 2001, TYPE_SPOT_ANCHOR = 2002, TYPE_CUSTOM = static_cast<int32_t>(::android::os::PointerIconType::CUSTOM), TYPE_NULL = static_cast<int32_t>(::android::os::PointerIconType::TYPE_NULL), TYPE_NOT_SPECIFIED = static_cast<int32_t>(::android::os::PointerIconType::NOT_SPECIFIED), TYPE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::ARROW), TYPE_CONTEXT_MENU = static_cast<int32_t>(::android::os::PointerIconType::CONTEXT_MENU), TYPE_HAND = static_cast<int32_t>(::android::os::PointerIconType::HAND), TYPE_HELP = static_cast<int32_t>(::android::os::PointerIconType::HELP), TYPE_WAIT = static_cast<int32_t>(::android::os::PointerIconType::WAIT), TYPE_CELL = static_cast<int32_t>(::android::os::PointerIconType::CELL), TYPE_CROSSHAIR = static_cast<int32_t>(::android::os::PointerIconType::CROSSHAIR), TYPE_TEXT = static_cast<int32_t>(::android::os::PointerIconType::TEXT), TYPE_VERTICAL_TEXT = static_cast<int32_t>(::android::os::PointerIconType::VERTICAL_TEXT), TYPE_ALIAS = static_cast<int32_t>(::android::os::PointerIconType::ALIAS), TYPE_COPY = static_cast<int32_t>(::android::os::PointerIconType::COPY), TYPE_NO_DROP = static_cast<int32_t>(::android::os::PointerIconType::NO_DROP), TYPE_ALL_SCROLL = static_cast<int32_t>(::android::os::PointerIconType::ALL_SCROLL), TYPE_HORIZONTAL_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::HORIZONTAL_DOUBLE_ARROW), TYPE_VERTICAL_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::VERTICAL_DOUBLE_ARROW), TYPE_TOP_RIGHT_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::TOP_RIGHT_DOUBLE_ARROW), TYPE_TOP_LEFT_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::TOP_LEFT_DOUBLE_ARROW), TYPE_ZOOM_IN = static_cast<int32_t>(::android::os::PointerIconType::ZOOM_IN), TYPE_ZOOM_OUT = static_cast<int32_t>(::android::os::PointerIconType::ZOOM_OUT), TYPE_GRAB = static_cast<int32_t>(::android::os::PointerIconType::GRAB), TYPE_GRABBING = static_cast<int32_t>(::android::os::PointerIconType::GRABBING), TYPE_HANDWRITING = static_cast<int32_t>(::android::os::PointerIconType::HANDWRITING), TYPE_SPOT_HOVER = static_cast<int32_t>(::android::os::PointerIconType::SPOT_HOVER), TYPE_SPOT_TOUCH = static_cast<int32_t>(::android::os::PointerIconType::SPOT_TOUCH), TYPE_SPOT_ANCHOR = static_cast<int32_t>(::android::os::PointerIconType::SPOT_ANCHOR), }; } // namespace android libs/input/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ filegroup { "android/os/InputEventInjectionResult.aidl", "android/os/InputEventInjectionSync.aidl", "android/os/InputConfig.aidl", "android/os/PointerIconType.aidl", ], } Loading libs/input/MotionPredictor.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -22,17 +22,21 @@ #include <cmath> #include <cstddef> #include <cstdint> #include <limits> #include <string> #include <vector> #include <android-base/logging.h> #include <android-base/strings.h> #include <android/input.h> #include <com_android_input_flags.h> #include <attestation/HmacKeyManager.h> #include <ftl/enum.h> #include <input/TfLiteMotionPredictor.h> namespace input_flags = com::android::input::flags; namespace android { namespace { Loading Loading @@ -197,7 +201,14 @@ std::unique_ptr<MotionEvent> MotionPredictor::predict(nsecs_t timestamp) { // device starts to speed up, but avoids producing noisy predictions as it slows down. break; } // TODO(b/266747654): Stop predictions if confidence is < some threshold. if (input_flags::enable_prediction_pruning_via_jerk_thresholding()) { // TODO(b/266747654): Stop predictions if confidence is < some threshold // Arbitrarily high pruning index, will correct once jerk thresholding is implemented. const size_t upperBoundPredictionIndex = std::numeric_limits<size_t>::max(); if (i > upperBoundPredictionIndex) { break; } } const TfLiteMotionPredictorSample::Point predictedPoint = convertPrediction(axisFrom, axisTo, predictedR[i], predictedPhi[i]); Loading libs/input/android/os/PointerIconType.aidl 0 → 100644 +56 −0 Original line number Diff line number Diff line /** * Copyright (c) 2024, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.os; /** * Represents an icon that can be used as a mouse pointer. * Please look at frameworks/base/core/java/android/view/PointerIcon.java for the detailed * explanation of each constant. * @hide */ @Backing(type="int") enum PointerIconType { CUSTOM = -1, TYPE_NULL = 0, NOT_SPECIFIED = 1, ARROW = 1000, CONTEXT_MENU = 1001, HAND = 1002, HELP = 1003, WAIT = 1004, CELL = 1006, CROSSHAIR = 1007, TEXT = 1008, VERTICAL_TEXT = 1009, ALIAS = 1010, COPY = 1011, NO_DROP = 1012, ALL_SCROLL = 1013, HORIZONTAL_DOUBLE_ARROW = 1014, VERTICAL_DOUBLE_ARROW = 1015, TOP_RIGHT_DOUBLE_ARROW = 1016, TOP_LEFT_DOUBLE_ARROW = 1017, ZOOM_IN = 1018, ZOOM_OUT = 1019, GRAB = 1020, GRABBING = 1021, HANDWRITING = 1022, SPOT_HOVER = 2000, SPOT_TOUCH = 2001, SPOT_ANCHOR = 2002, } libs/input/input_flags.aconfig +9 −0 Original line number Diff line number Diff line Loading @@ -128,3 +128,12 @@ flag { description: "Enable fling scrolling to be stopped by putting a finger on the touchpad again" bug: "281106755" } flag { name: "enable_prediction_pruning_via_jerk_thresholding" namespace: "input" description: "Enable prediction pruning based on jerk thresholds." bug: "266747654" is_fixed_read_only: true } Loading
include/input/Input.h +34 −35 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #ifdef __linux__ #include <android/os/IInputConstants.h> #endif #include <android/os/PointerIconType.h> #include <math.h> #include <stdint.h> #include <ui/Transform.h> Loading Loading @@ -1213,43 +1214,41 @@ public: * * Due to backwards compatibility and public api constraints, this is a duplicate (but type safe) * definition of PointerIcon.java. * * TODO(b/235023317) move this definition to an aidl and statically assign to the below java public * api values. * * WARNING: Keep these definitions in sync with * frameworks/base/core/java/android/view/PointerIcon.java */ enum class PointerIconStyle : int32_t { TYPE_CUSTOM = -1, TYPE_NULL = 0, TYPE_NOT_SPECIFIED = 1, TYPE_ARROW = 1000, TYPE_CONTEXT_MENU = 1001, TYPE_HAND = 1002, TYPE_HELP = 1003, TYPE_WAIT = 1004, TYPE_CELL = 1006, TYPE_CROSSHAIR = 1007, TYPE_TEXT = 1008, TYPE_VERTICAL_TEXT = 1009, TYPE_ALIAS = 1010, TYPE_COPY = 1011, TYPE_NO_DROP = 1012, TYPE_ALL_SCROLL = 1013, TYPE_HORIZONTAL_DOUBLE_ARROW = 1014, TYPE_VERTICAL_DOUBLE_ARROW = 1015, TYPE_TOP_RIGHT_DOUBLE_ARROW = 1016, TYPE_TOP_LEFT_DOUBLE_ARROW = 1017, TYPE_ZOOM_IN = 1018, TYPE_ZOOM_OUT = 1019, TYPE_GRAB = 1020, TYPE_GRABBING = 1021, TYPE_HANDWRITING = 1022, TYPE_SPOT_HOVER = 2000, TYPE_SPOT_TOUCH = 2001, TYPE_SPOT_ANCHOR = 2002, TYPE_CUSTOM = static_cast<int32_t>(::android::os::PointerIconType::CUSTOM), TYPE_NULL = static_cast<int32_t>(::android::os::PointerIconType::TYPE_NULL), TYPE_NOT_SPECIFIED = static_cast<int32_t>(::android::os::PointerIconType::NOT_SPECIFIED), TYPE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::ARROW), TYPE_CONTEXT_MENU = static_cast<int32_t>(::android::os::PointerIconType::CONTEXT_MENU), TYPE_HAND = static_cast<int32_t>(::android::os::PointerIconType::HAND), TYPE_HELP = static_cast<int32_t>(::android::os::PointerIconType::HELP), TYPE_WAIT = static_cast<int32_t>(::android::os::PointerIconType::WAIT), TYPE_CELL = static_cast<int32_t>(::android::os::PointerIconType::CELL), TYPE_CROSSHAIR = static_cast<int32_t>(::android::os::PointerIconType::CROSSHAIR), TYPE_TEXT = static_cast<int32_t>(::android::os::PointerIconType::TEXT), TYPE_VERTICAL_TEXT = static_cast<int32_t>(::android::os::PointerIconType::VERTICAL_TEXT), TYPE_ALIAS = static_cast<int32_t>(::android::os::PointerIconType::ALIAS), TYPE_COPY = static_cast<int32_t>(::android::os::PointerIconType::COPY), TYPE_NO_DROP = static_cast<int32_t>(::android::os::PointerIconType::NO_DROP), TYPE_ALL_SCROLL = static_cast<int32_t>(::android::os::PointerIconType::ALL_SCROLL), TYPE_HORIZONTAL_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::HORIZONTAL_DOUBLE_ARROW), TYPE_VERTICAL_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::VERTICAL_DOUBLE_ARROW), TYPE_TOP_RIGHT_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::TOP_RIGHT_DOUBLE_ARROW), TYPE_TOP_LEFT_DOUBLE_ARROW = static_cast<int32_t>(::android::os::PointerIconType::TOP_LEFT_DOUBLE_ARROW), TYPE_ZOOM_IN = static_cast<int32_t>(::android::os::PointerIconType::ZOOM_IN), TYPE_ZOOM_OUT = static_cast<int32_t>(::android::os::PointerIconType::ZOOM_OUT), TYPE_GRAB = static_cast<int32_t>(::android::os::PointerIconType::GRAB), TYPE_GRABBING = static_cast<int32_t>(::android::os::PointerIconType::GRABBING), TYPE_HANDWRITING = static_cast<int32_t>(::android::os::PointerIconType::HANDWRITING), TYPE_SPOT_HOVER = static_cast<int32_t>(::android::os::PointerIconType::SPOT_HOVER), TYPE_SPOT_TOUCH = static_cast<int32_t>(::android::os::PointerIconType::SPOT_TOUCH), TYPE_SPOT_ANCHOR = static_cast<int32_t>(::android::os::PointerIconType::SPOT_ANCHOR), }; } // namespace android
libs/input/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ filegroup { "android/os/InputEventInjectionResult.aidl", "android/os/InputEventInjectionSync.aidl", "android/os/InputConfig.aidl", "android/os/PointerIconType.aidl", ], } Loading
libs/input/MotionPredictor.cpp +12 −1 Original line number Diff line number Diff line Loading @@ -22,17 +22,21 @@ #include <cmath> #include <cstddef> #include <cstdint> #include <limits> #include <string> #include <vector> #include <android-base/logging.h> #include <android-base/strings.h> #include <android/input.h> #include <com_android_input_flags.h> #include <attestation/HmacKeyManager.h> #include <ftl/enum.h> #include <input/TfLiteMotionPredictor.h> namespace input_flags = com::android::input::flags; namespace android { namespace { Loading Loading @@ -197,7 +201,14 @@ std::unique_ptr<MotionEvent> MotionPredictor::predict(nsecs_t timestamp) { // device starts to speed up, but avoids producing noisy predictions as it slows down. break; } // TODO(b/266747654): Stop predictions if confidence is < some threshold. if (input_flags::enable_prediction_pruning_via_jerk_thresholding()) { // TODO(b/266747654): Stop predictions if confidence is < some threshold // Arbitrarily high pruning index, will correct once jerk thresholding is implemented. const size_t upperBoundPredictionIndex = std::numeric_limits<size_t>::max(); if (i > upperBoundPredictionIndex) { break; } } const TfLiteMotionPredictorSample::Point predictedPoint = convertPrediction(axisFrom, axisTo, predictedR[i], predictedPhi[i]); Loading
libs/input/android/os/PointerIconType.aidl 0 → 100644 +56 −0 Original line number Diff line number Diff line /** * Copyright (c) 2024, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.os; /** * Represents an icon that can be used as a mouse pointer. * Please look at frameworks/base/core/java/android/view/PointerIcon.java for the detailed * explanation of each constant. * @hide */ @Backing(type="int") enum PointerIconType { CUSTOM = -1, TYPE_NULL = 0, NOT_SPECIFIED = 1, ARROW = 1000, CONTEXT_MENU = 1001, HAND = 1002, HELP = 1003, WAIT = 1004, CELL = 1006, CROSSHAIR = 1007, TEXT = 1008, VERTICAL_TEXT = 1009, ALIAS = 1010, COPY = 1011, NO_DROP = 1012, ALL_SCROLL = 1013, HORIZONTAL_DOUBLE_ARROW = 1014, VERTICAL_DOUBLE_ARROW = 1015, TOP_RIGHT_DOUBLE_ARROW = 1016, TOP_LEFT_DOUBLE_ARROW = 1017, ZOOM_IN = 1018, ZOOM_OUT = 1019, GRAB = 1020, GRABBING = 1021, HANDWRITING = 1022, SPOT_HOVER = 2000, SPOT_TOUCH = 2001, SPOT_ANCHOR = 2002, }
libs/input/input_flags.aconfig +9 −0 Original line number Diff line number Diff line Loading @@ -128,3 +128,12 @@ flag { description: "Enable fling scrolling to be stopped by putting a finger on the touchpad again" bug: "281106755" } flag { name: "enable_prediction_pruning_via_jerk_thresholding" namespace: "input" description: "Enable prediction pruning based on jerk thresholds." bug: "266747654" is_fixed_read_only: true }