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

Commit c5d886b6 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Android (Google) Code Review
Browse files

Merge "Flag cleanup: enable_input_filter_rust_impl" into main

parents 77789bdb 87bd9952
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ import static com.android.hardware.input.Flags.touchpadVisualizer;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiKeyGestures;
import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiKeyGestures;
import static com.android.input.flags.Flags.FLAG_KEYBOARD_REPEAT_KEYS;
import static com.android.input.flags.Flags.FLAG_KEYBOARD_REPEAT_KEYS;
import static com.android.input.flags.Flags.enableInputFilterRustImpl;
import static com.android.input.flags.Flags.keyboardRepeatKeys;
import static com.android.input.flags.Flags.keyboardRepeatKeys;


import android.Manifest;
import android.Manifest;
@@ -883,7 +882,7 @@ public class InputSettings {
     * @hide
     * @hide
     */
     */
    public static boolean isAccessibilityBounceKeysFeatureEnabled() {
    public static boolean isAccessibilityBounceKeysFeatureEnabled() {
        return keyboardA11yBounceKeysFlag() && enableInputFilterRustImpl();
        return keyboardA11yBounceKeysFlag();
    }
    }


    /**
    /**
@@ -967,7 +966,7 @@ public class InputSettings {
     * @hide
     * @hide
     */
     */
    public static boolean isAccessibilitySlowKeysFeatureFlagEnabled() {
    public static boolean isAccessibilitySlowKeysFeatureFlagEnabled() {
        return keyboardA11ySlowKeysFlag() && enableInputFilterRustImpl();
        return keyboardA11ySlowKeysFlag();
    }
    }


    /**
    /**
@@ -1053,7 +1052,7 @@ public class InputSettings {
     * @hide
     * @hide
     */
     */
    public static boolean isAccessibilityStickyKeysFeatureEnabled() {
    public static boolean isAccessibilityStickyKeysFeatureEnabled() {
        return keyboardA11yStickyKeysFlag() && enableInputFilterRustImpl();
        return keyboardA11yStickyKeysFlag();
    }
    }


    /**
    /**
+5 −13
Original line number Original line Diff line number Diff line
@@ -94,8 +94,6 @@ namespace input_flags = com::android::input::flags;


namespace android {
namespace android {


static const bool ENABLE_INPUT_FILTER_RUST = input_flags::enable_input_filter_rust_impl();

// The exponent used to calculate the pointer speed scaling factor.
// The exponent used to calculate the pointer speed scaling factor.
// The scaling factor is calculated as 2 ^ (speed * exponent),
// The scaling factor is calculated as 2 ^ (speed * exponent),
// where the speed ranges from -7 to + 7 and is supplied by the user.
// where the speed ranges from -7 to + 7 and is supplied by the user.
@@ -3248,28 +3246,22 @@ static void nativeSetStylusPointerIconEnabled(JNIEnv* env, jobject nativeImplObj
static void nativeSetAccessibilityBounceKeysThreshold(JNIEnv* env, jobject nativeImplObj,
static void nativeSetAccessibilityBounceKeysThreshold(JNIEnv* env, jobject nativeImplObj,
                                                      jint thresholdTimeMs) {
                                                      jint thresholdTimeMs) {
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    if (ENABLE_INPUT_FILTER_RUST) {
    im->getInputManager()->getInputFilter().setAccessibilityBounceKeysThreshold(
    im->getInputManager()->getInputFilter().setAccessibilityBounceKeysThreshold(
            static_cast<nsecs_t>(thresholdTimeMs) * 1000000);
            static_cast<nsecs_t>(thresholdTimeMs) * 1000000);
}
}
}


static void nativeSetAccessibilitySlowKeysThreshold(JNIEnv* env, jobject nativeImplObj,
static void nativeSetAccessibilitySlowKeysThreshold(JNIEnv* env, jobject nativeImplObj,
                                                    jint thresholdTimeMs) {
                                                    jint thresholdTimeMs) {
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    if (ENABLE_INPUT_FILTER_RUST) {
    im->getInputManager()->getInputFilter().setAccessibilitySlowKeysThreshold(
    im->getInputManager()->getInputFilter().setAccessibilitySlowKeysThreshold(
            static_cast<nsecs_t>(thresholdTimeMs) * 1000000);
            static_cast<nsecs_t>(thresholdTimeMs) * 1000000);
}
}
}


static void nativeSetAccessibilityStickyKeysEnabled(JNIEnv* env, jobject nativeImplObj,
static void nativeSetAccessibilityStickyKeysEnabled(JNIEnv* env, jobject nativeImplObj,
                                                    jboolean enabled) {
                                                    jboolean enabled) {
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    NativeInputManager* im = getNativeInputManager(env, nativeImplObj);
    if (ENABLE_INPUT_FILTER_RUST) {
    im->getInputManager()->getInputFilter().setAccessibilityStickyKeysEnabled(enabled);
    im->getInputManager()->getInputFilter().setAccessibilityStickyKeysEnabled(enabled);
}
}
}


static void nativeSetInputMethodConnectionIsActive(JNIEnv* env, jobject nativeImplObj,
static void nativeSetInputMethodConnectionIsActive(JNIEnv* env, jobject nativeImplObj,
                                                   jboolean isActive) {
                                                   jboolean isActive) {
+1 −4
Original line number Original line Diff line number Diff line
@@ -50,10 +50,7 @@ import org.mockito.junit.MockitoJUnitRunner
 */
 */
@Presubmit
@Presubmit
@RunWith(MockitoJUnitRunner::class)
@RunWith(MockitoJUnitRunner::class)
@EnableFlags(
@EnableFlags(com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_STICKY_KEYS_FLAG)
    com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_STICKY_KEYS_FLAG,
    com.android.input.flags.Flags.FLAG_ENABLE_INPUT_FILTER_RUST_IMPL,
)
class StickyModifierStateListenerTest {
class StickyModifierStateListenerTest {


    @get:Rule
    @get:Rule