Loading services/core/java/com/android/server/input/NativeInputManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.input; import android.annotation.Nullable; import android.hardware.display.DisplayViewport; import android.hardware.input.InputSensorInfo; import android.hardware.lights.Light; Loading Loading @@ -141,6 +142,13 @@ public interface NativeInputManagerService { int getBatteryStatus(int deviceId); /** * Get the device path of the battery for an input device. * @return the path for the input device battery, or null if there is none. */ @Nullable String getBatteryDevicePath(int deviceId); List<Light> getLights(int deviceId); int getLightPlayerId(int deviceId, int lightId); Loading Loading @@ -326,6 +334,9 @@ public interface NativeInputManagerService { @Override public native int getBatteryStatus(int deviceId); @Override public native String getBatteryDevicePath(int deviceId); @Override public native List<Light> getLights(int deviceId); Loading services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -2090,6 +2090,14 @@ static jint nativeGetBatteryStatus(JNIEnv* env, jobject nativeImplObj, jint devi return static_cast<jint>(ret.value_or(BATTERY_STATUS_UNKNOWN)); } static jstring nativeGetBatteryDevicePath(JNIEnv* env, jobject nativeImplObj, jint deviceId) { NativeInputManager* im = getNativeInputManager(env, nativeImplObj); const std::optional<std::string> batteryPath = im->getInputManager()->getReader().getBatteryDevicePath(deviceId); return batteryPath ? env->NewStringUTF(batteryPath->c_str()) : nullptr; } static void nativeReloadKeyboardLayouts(JNIEnv* env, jobject nativeImplObj) { NativeInputManager* im = getNativeInputManager(env, nativeImplObj); Loading Loading @@ -2371,6 +2379,7 @@ static const JNINativeMethod gInputManagerMethods[] = { {"setLightColor", "(III)V", (void*)nativeSetLightColor}, {"getBatteryCapacity", "(I)I", (void*)nativeGetBatteryCapacity}, {"getBatteryStatus", "(I)I", (void*)nativeGetBatteryStatus}, {"getBatteryDevicePath", "(I)Ljava/lang/String;", (void*)nativeGetBatteryDevicePath}, {"reloadKeyboardLayouts", "()V", (void*)nativeReloadKeyboardLayouts}, {"reloadDeviceAliases", "()V", (void*)nativeReloadDeviceAliases}, {"dump", "()Ljava/lang/String;", (void*)nativeDump}, Loading Loading
services/core/java/com/android/server/input/NativeInputManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.input; import android.annotation.Nullable; import android.hardware.display.DisplayViewport; import android.hardware.input.InputSensorInfo; import android.hardware.lights.Light; Loading Loading @@ -141,6 +142,13 @@ public interface NativeInputManagerService { int getBatteryStatus(int deviceId); /** * Get the device path of the battery for an input device. * @return the path for the input device battery, or null if there is none. */ @Nullable String getBatteryDevicePath(int deviceId); List<Light> getLights(int deviceId); int getLightPlayerId(int deviceId, int lightId); Loading Loading @@ -326,6 +334,9 @@ public interface NativeInputManagerService { @Override public native int getBatteryStatus(int deviceId); @Override public native String getBatteryDevicePath(int deviceId); @Override public native List<Light> getLights(int deviceId); Loading
services/core/jni/com_android_server_input_InputManagerService.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -2090,6 +2090,14 @@ static jint nativeGetBatteryStatus(JNIEnv* env, jobject nativeImplObj, jint devi return static_cast<jint>(ret.value_or(BATTERY_STATUS_UNKNOWN)); } static jstring nativeGetBatteryDevicePath(JNIEnv* env, jobject nativeImplObj, jint deviceId) { NativeInputManager* im = getNativeInputManager(env, nativeImplObj); const std::optional<std::string> batteryPath = im->getInputManager()->getReader().getBatteryDevicePath(deviceId); return batteryPath ? env->NewStringUTF(batteryPath->c_str()) : nullptr; } static void nativeReloadKeyboardLayouts(JNIEnv* env, jobject nativeImplObj) { NativeInputManager* im = getNativeInputManager(env, nativeImplObj); Loading Loading @@ -2371,6 +2379,7 @@ static const JNINativeMethod gInputManagerMethods[] = { {"setLightColor", "(III)V", (void*)nativeSetLightColor}, {"getBatteryCapacity", "(I)I", (void*)nativeGetBatteryCapacity}, {"getBatteryStatus", "(I)I", (void*)nativeGetBatteryStatus}, {"getBatteryDevicePath", "(I)Ljava/lang/String;", (void*)nativeGetBatteryDevicePath}, {"reloadKeyboardLayouts", "()V", (void*)nativeReloadKeyboardLayouts}, {"reloadDeviceAliases", "()V", (void*)nativeReloadDeviceAliases}, {"dump", "()Ljava/lang/String;", (void*)nativeDump}, Loading