Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f96a4f6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use PlatformProperties to read VelocityTracker strategy"

parents 9ac7c58f 84b38799
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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 {
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ cc_defaults {
        "libutils",
        "libui",
        "libvibratorservice",
        "PlatformProperties",
        "InputFlingerProperties",
        "libinput",
        "libinputflinger",
        "libinputflinger_base",
+33 −24
Original line number Diff line number Diff line
@@ -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());
}