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

Commit 9bb8be17 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "input: clean up touchpad visualizer flag"" into main

parents 93abcd6e bd101382
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.hardware.input.Flags.mouseSwapPrimaryButton;
import static com.android.hardware.input.Flags.pointerAcceleration;
import static com.android.hardware.input.Flags.touchpadSystemGestureDisable;
import static com.android.hardware.input.Flags.touchpadThreeFingerTapShortcut;
import static com.android.hardware.input.Flags.touchpadVisualizer;
import static com.android.input.flags.Flags.FLAG_KEYBOARD_REPEAT_KEYS;
import static com.android.input.flags.Flags.keyboardRepeatKeys;

@@ -433,6 +434,15 @@ public class InputSettings {
        return touchpadSystemGestureDisable();
    }

    /**
     * Returns true if the feature flag for touchpad visualizer is enabled.
     *
     * @hide
     */
    public static boolean isTouchpadVisualizerFeatureFlagEnabled() {
        return touchpadVisualizer();
    }

    /**
     * Returns true if the feature flag for the touchpad three-finger tap shortcut is enabled.
     *
@@ -485,6 +495,9 @@ public class InputSettings {
     * @hide
     */
    public static boolean useTouchpadVisualizer(@NonNull Context context) {
        if (!isTouchpadVisualizerFeatureFlagEnabled()) {
            return false;
        }
        return Settings.System.getIntForUser(context.getContentResolver(),
                Settings.System.TOUCHPAD_VISUALIZER, 0, UserHandle.USER_CURRENT) == 1;
    }
@@ -499,6 +512,9 @@ public class InputSettings {
     */
    @RequiresPermission(Manifest.permission.WRITE_SETTINGS)
    public static void setTouchpadVisualizer(@NonNull Context context, boolean enabled) {
        if (!isTouchpadVisualizerFeatureFlagEnabled()) {
            return;
        }
        Settings.System.putIntForUser(context.getContentResolver(),
                Settings.System.TOUCHPAD_VISUALIZER, enabled ? 1 : 0, UserHandle.USER_CURRENT);
    }
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@ flag {
    bug: "341799888"
}

flag {
    namespace: "input_native"
    name: "touchpad_visualizer"
    description: "Enables a developer overlay that displays raw touchpad input data and gesture recognition status in real-time."
    bug: "286551975"
}

flag {
    namespace: "input_native"
    name: "manage_key_gestures"
+14 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_M
import static com.android.hardware.input.Flags.enableCustomizableInputGestures;
import static com.android.hardware.input.Flags.fixKeyboardInterceptorPolicyCall;
import static com.android.hardware.input.Flags.keyEventActivityDetection;
import static com.android.hardware.input.Flags.touchpadVisualizer;
import static com.android.server.policy.WindowManagerPolicy.ACTION_PASS_TO_USER;

import android.Manifest;
@@ -347,7 +348,7 @@ public class InputManagerService extends IInputManager.Stub
    // Monitors any changes to the sysfs nodes when an input device is connected.
    private final SysfsNodeMonitor mSysfsNodeMonitor;

    @NonNull
    @Nullable
    private final TouchpadDebugViewController mTouchpadDebugViewController;

    // Manages Keyboard backlight
@@ -544,8 +545,9 @@ public class InputManagerService extends IInputManager.Stub
        mSettingsObserver = new InputSettingsObserver(mContext, mHandler, this, mNative);
        mKeyboardLayoutManager = new KeyboardLayoutManager(mContext, mNative, mDataStore,
                injector.getLooper());
        mTouchpadDebugViewController = new TouchpadDebugViewController(mContext,
                injector.getLooper(), this);
        mTouchpadDebugViewController =
                touchpadVisualizer() ? new TouchpadDebugViewController(mContext,
                        injector.getLooper(), this) : null;
        mBatteryController = new BatteryController(mContext, mNative, injector.getLooper(),
                injector.getUEventManager());
        mSysfsNodeMonitor = new SysfsNodeMonitor(mContext, mNative, injector.getLooper(),
@@ -2392,14 +2394,18 @@ public class InputManagerService extends IInputManager.Stub
    // Native callback.
    @SuppressWarnings("unused")
    private void notifyTouchpadHardwareState(TouchpadHardwareState hardwareStates, int deviceId) {
        if (mTouchpadDebugViewController != null) {
            mTouchpadDebugViewController.updateTouchpadHardwareState(hardwareStates, deviceId);
        }
    }

    // Native callback.
    @SuppressWarnings("unused")
    private void notifyTouchpadGestureInfo(int type, int deviceId) {
        if (mTouchpadDebugViewController != null) {
            mTouchpadDebugViewController.updateTouchpadGestureInfo(type, deviceId);
        }
    }

    // Native callback.
    @SuppressWarnings("unused")
@@ -3978,8 +3984,10 @@ public class InputManagerService extends IInputManager.Stub

    void updateTouchpadVisualizerEnabled(boolean enabled) {
        mNative.setShouldNotifyTouchpadHardwareState(enabled);
        if (mTouchpadDebugViewController != null) {
            mTouchpadDebugViewController.updateTouchpadVisualizerEnabled(enabled);
        }
    }

    void updatePointerLocationEnabled(boolean enabled) {
        mWindowManagerCallbacks.notifyPointerLocationChanged(enabled);