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

Commit f1c029d2 authored by Philip Junker's avatar Philip Junker
Browse files

Add more debug logs for input devices.

Make InputManagerService and InputManager logging runtime-available.

Test: manual
Change-Id: I8c881278d59c5c766152661030ce0ca364cb0bbe
parent 05e1a0e5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -88,6 +88,12 @@ public final class InputDeviceIdentifier implements Parcelable {
        return Objects.hash(mDescriptor, mVendorId, mProductId);
    }

    @Override
    public String toString() {
        return "InputDeviceIdentifier: vendorId: " + mVendorId + ", productId: " + mProductId
                + ", descriptor: " + mDescriptor;
    }

    public static final @android.annotation.NonNull Parcelable.Creator<InputDeviceIdentifier> CREATOR =
            new Parcelable.Creator<InputDeviceIdentifier>() {

+2 −1
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ import java.util.List;
@SystemService(Context.INPUT_SERVICE)
public final class InputManager {
    private static final String TAG = "InputManager";
    private static final boolean DEBUG = false;
    // To enable these logs, run: 'adb shell setprop log.tag.InputManager DEBUG' (requires restart)
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    private static final int MSG_DEVICE_ADDED = 1;
    private static final int MSG_DEVICE_REMOVED = 2;
+7 −6
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ import android.os.LocaleList;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Locale;

/**
 * Describes a keyboard layout.
 *
@@ -157,9 +155,12 @@ public final class KeyboardLayout implements Parcelable,

    @Override
    public String toString() {
        if (mCollection.isEmpty()) {
            return mLabel;
        }
        return mLabel + " - " + mCollection;
        String collectionString = mCollection.isEmpty() ? "" : " - " + mCollection;
        return "KeyboardLayout " + mLabel + collectionString
                + ", descriptor: " + mDescriptor
                + ", priority: " + mPriority
                + ", locales: " + mLocales.toString()
                + ", vendorId: " + mVendorId
                + ", productId: " + mProductId;
    }
}
+11 −4
Original line number Diff line number Diff line
@@ -151,7 +151,8 @@ import java.util.OptionalInt;
public class InputManagerService extends IInputManager.Stub
        implements Watchdog.Monitor {
    static final String TAG = "InputManager";
    static final boolean DEBUG = false;
    // To enable these logs, run: 'adb shell setprop log.tag.InputManager DEBUG' (requires restart)
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml";
    private static final String PORT_ASSOCIATIONS_PATH = "etc/input-port-associations.xml";
@@ -1016,6 +1017,10 @@ public class InputManagerService extends IInputManager.Stub
                final InputDevice inputDevice = mInputDevices[i];
                deviceIdAndGeneration[i * 2] = inputDevice.getId();
                deviceIdAndGeneration[i * 2 + 1] = inputDevice.getGeneration();
                if (DEBUG) {
                    Log.d(TAG, "device " + inputDevice.getId() + " generation "
                            + inputDevice.getGeneration());
                }

                if (!inputDevice.isVirtual() && inputDevice.isFullKeyboard()) {
                    if (!containsInputDeviceWithDescriptor(oldInputDevices,
@@ -1539,8 +1544,8 @@ public class InputManagerService extends IInputManager.Stub
                layout = mDataStore.getCurrentKeyboardLayout(identifier.getDescriptor());
            }
            if (DEBUG) {
                Slog.d(TAG, "Loaded keyboard layout id for " + key + " and got "
                        + layout);
                Slog.d(TAG, "getCurrentKeyboardLayoutForInputDevice() "
                        + identifier.toString() + ": " + layout);
            }
            return layout;
        }
@@ -1562,7 +1567,9 @@ public class InputManagerService extends IInputManager.Stub
            try {
                if (mDataStore.setCurrentKeyboardLayout(key, keyboardLayoutDescriptor)) {
                    if (DEBUG) {
                        Slog.d(TAG, "Saved keyboard layout using " + key);
                        Slog.d(TAG, "setCurrentKeyboardLayoutForInputDevice() " + identifier
                                + " key: " + key
                                + " keyboardLayoutDescriptor: " + keyboardLayoutDescriptor);
                    }
                    mHandler.sendEmptyMessage(MSG_RELOAD_KEYBOARD_LAYOUTS);
                }