mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-21 07:50:11 +00:00
Don't process incoming input device requests from the host after we've stopped
This commit is contained in:
@@ -293,6 +293,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void enableSensors() {
|
public void enableSensors() {
|
||||||
|
if (stopped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
||||||
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
||||||
deviceContext.enableSensors();
|
deviceContext.enableSensors();
|
||||||
@@ -2030,6 +2034,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
boolean foundMatchingDevice = false;
|
boolean foundMatchingDevice = false;
|
||||||
boolean vibrated = false;
|
boolean vibrated = false;
|
||||||
|
|
||||||
|
if (stopped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
||||||
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
||||||
|
|
||||||
@@ -2090,6 +2098,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleRumbleTriggers(short controllerNumber, short leftTrigger, short rightTrigger) {
|
public void handleRumbleTriggers(short controllerNumber, short leftTrigger, short rightTrigger) {
|
||||||
|
if (stopped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
||||||
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
||||||
@@ -2201,6 +2213,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleSetMotionEventState(final short controllerNumber, final byte motionType, short reportRateHz) {
|
public void handleSetMotionEventState(final short controllerNumber, final byte motionType, short reportRateHz) {
|
||||||
|
if (stopped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Report rate is restricted to <= 200 Hz without the HIGH_SAMPLING_RATE_SENSORS permission
|
// Report rate is restricted to <= 200 Hz without the HIGH_SAMPLING_RATE_SENSORS permission
|
||||||
reportRateHz = (short) Math.min(200, reportRateHz);
|
reportRateHz = (short) Math.min(200, reportRateHz);
|
||||||
|
|
||||||
@@ -2262,6 +2278,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleSetControllerLED(short controllerNumber, byte r, byte g, byte b) {
|
public void handleSetControllerLED(short controllerNumber, byte r, byte g, byte b) {
|
||||||
|
if (stopped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
||||||
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user