diff options
| author | 2021-10-27 23:14:48 +0000 | |
|---|---|---|
| committer | 2021-10-27 23:14:48 +0000 | |
| commit | 2f96a4f6468b2e6657088e6a3d6e5f7f07215a52 (patch) | |
| tree | a572ea4098de7e1db7a6ee9b9681920993b5576a | |
| parent | 9ac7c58fc540f527aff64fa8091ad6e49ce3d365 (diff) | |
| parent | 84b38799cd4f44d79ecfdcaf7a5de35e0edb38e7 (diff) | |
Merge "Use PlatformProperties to read VelocityTracker strategy"
| -rw-r--r-- | core/java/android/view/VelocityTracker.java | 5 | ||||
| -rw-r--r-- | services/core/jni/Android.bp | 2 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 57 |
3 files changed, 37 insertions, 27 deletions
diff --git a/core/java/android/view/VelocityTracker.java b/core/java/android/view/VelocityTracker.java index e1c4305e8747..2b79bbfa72d4 100644 --- a/core/java/android/view/VelocityTracker.java +++ b/core/java/android/view/VelocityTracker.java @@ -19,7 +19,7 @@ package android.view; import android.annotation.IntDef; import android.compat.annotation.UnsupportedAppUsage; import android.os.Build; -import android.os.SystemProperties; +import android.sysprop.InputProperties; import android.util.ArrayMap; import android.util.Pools.SynchronizedPool; @@ -279,8 +279,7 @@ public final class VelocityTracker { // If user has not selected a specific strategy if (strategy == VELOCITY_TRACKER_STRATEGY_DEFAULT) { // Check if user specified strategy by overriding system property. - String strategyProperty = - SystemProperties.get("persist.input.velocitytracker.strategy"); + String strategyProperty = InputProperties.velocitytracker_strategy().orElse(null); if (strategyProperty == null || strategyProperty.isEmpty()) { mStrategy = strategy; } else { diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp index 4e4a5c35f032..eb2c8a6b8834 100644 --- a/services/core/jni/Android.bp +++ b/services/core/jni/Android.bp @@ -114,6 +114,8 @@ cc_defaults { "libutils", "libui", "libvibratorservice", + "PlatformProperties", + "InputFlingerProperties", "libinput", "libinputflinger", "libinputflinger_base", diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index 94b1ad18fa9f..790acbf2cd23 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -26,30 +26,14 @@ // Log debug messages about InputDispatcherPolicy #define DEBUG_INPUT_DISPATCHER_POLICY 0 +#include <InputFlingerProperties.sysprop.h> #include <android-base/parseint.h> #include <android-base/stringprintf.h> #include <android/os/IInputConstants.h> +#include <android/sysprop/InputProperties.sysprop.h> +#include <android_os_MessageQueue.h> #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> -#include <limits.h> -#include <atomic> -#include <cinttypes> - -#include <utils/Log.h> -#include <utils/Looper.h> -#include <utils/threads.h> -#include <utils/Trace.h> - -#include <binder/IServiceManager.h> - -#include <input/PointerController.h> -#include <input/SpriteController.h> -#include <ui/Region.h> - -#include <batteryservice/include/batteryservice/BatteryServiceConstants.h> -#include <inputflinger/InputManager.h> - -#include <android_os_MessageQueue.h> #include <android_view_InputChannel.h> #include <android_view_InputDevice.h> #include <android_view_KeyEvent.h> @@ -57,11 +41,25 @@ #include <android_view_PointerIcon.h> #include <android_view_VerifiedKeyEvent.h> #include <android_view_VerifiedMotionEvent.h> - +#include <batteryservice/include/batteryservice/BatteryServiceConstants.h> +#include <binder/IServiceManager.h> +#include <input/PointerController.h> +#include <input/SpriteController.h> +#include <inputflinger/InputManager.h> +#include <limits.h> #include <nativehelper/ScopedLocalFrame.h> #include <nativehelper/ScopedLocalRef.h> #include <nativehelper/ScopedPrimitiveArray.h> #include <nativehelper/ScopedUtfChars.h> +#include <ui/Region.h> +#include <utils/Log.h> +#include <utils/Looper.h> +#include <utils/Trace.h> +#include <utils/threads.h> + +#include <atomic> +#include <cinttypes> +#include <vector> #include "android_hardware_display_DisplayViewport.h" #include "android_hardware_input_InputApplicationHandle.h" @@ -69,8 +67,6 @@ #include "android_util_Binder.h" #include "com_android_server_power_PowerManagerService.h" -#include <vector> - #define INDENT " " using android::base::ParseUint; @@ -2089,11 +2085,24 @@ static void nativeReloadDeviceAliases(JNIEnv* /* env */, InputReaderConfiguration::CHANGE_DEVICE_ALIAS); } +static std::string dumpInputProperties() { + std::string out = "Input properties:\n"; + const bool perWindowInputRotation = + sysprop::InputFlingerProperties::per_window_input_rotation().value_or(false); + out += StringPrintf(" per_window_input_rotation = %s\n", toString(perWindowInputRotation)); + const std::string strategy = + sysprop::InputProperties::velocitytracker_strategy().value_or("default"); + out += " persist.input.velocitytracker.strategy = " + strategy + "\n"; + out += "\n"; + return out; +} + static jstring nativeDump(JNIEnv* env, jclass /* clazz */, jlong ptr) { - NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); + std::string dump = dumpInputProperties(); - std::string dump; + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); im->dump(dump); + return env->NewStringUTF(dump.c_str()); } |