Compare commits

..

15 Commits

Author SHA1 Message Date
Cameron Gutman 79bf17fe24 Add fastlane metadata for v9.10.1 2021-08-21 15:25:45 -05:00
Cameron Gutman 31f66031bc Version 9.10.1 2021-08-21 15:22:05 -05:00
Cameron Gutman d3f2284791 Update NDK to r23 2021-08-18 00:33:57 -05:00
Cameron Gutman ec647608c4 Allow state loss when committing SettingsFragment 2021-08-18 00:24:30 -05:00
Cameron Gutman 597582ddd8 Add workaround for NPE in getNetworkInterfaces() 2021-08-18 00:04:34 -05:00
Cameron Gutman c6d9889182 Fix lint results path for Gradle 7.0 2021-08-10 02:12:03 -05:00
Cameron Gutman 7c58234174 Use JDK 11 for Gradle 7.0 2021-08-10 02:02:24 -05:00
Cameron Gutman ae9282b0af Plumb UTF-8 text support through to NvConnection 2021-08-10 00:14:13 -05:00
Cameron Gutman 310ba646fc Update Gradle 2021-08-09 23:24:44 -05:00
Cameron Gutman 3e0bf25acb Update moonlight-common-c 2021-07-17 14:16:40 -05:00
Cameron Gutman f3d277c94a Update Maven dependencies 2021-07-17 14:01:59 -05:00
Cameron Gutman 04545ecbb0 Avoid tons of redundant calls to InputEvent.getSource() 2021-07-17 14:01:12 -05:00
Cameron Gutman 5350651d6f Fix crash when using USB driver on Android 12 2021-07-17 13:59:11 -05:00
Cameron Gutman f2e2e28419 Fix NPE if we receive a SOURCE_CLASS_POSITION event with no associated device 2021-07-17 13:15:57 -05:00
Cameron Gutman b9031785ac Fix crash if maxShortcutCountPerActivity is zero 2021-07-17 13:08:25 -05:00
15 changed files with 81 additions and 44 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
ndkVersion "22.1.7171670"
ndkVersion "23.0.7599858"
compileSdkVersion 31
@@ -9,8 +9,8 @@ android {
minSdkVersion 16
targetSdkVersion 31
versionName "9.10"
versionCode = 270
versionName "9.10.1"
versionCode = 271
}
flavorDimensions "root"
@@ -118,10 +118,10 @@ android {
}
dependencies {
implementation 'org.bouncycastle:bcprov-jdk15on:1.66'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.66'
implementation 'org.bouncycastle:bcprov-jdk15on:1.69'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.69'
implementation 'org.jcodec:jcodec:0.2.3'
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation 'com.squareup.okio:okio:1.17.5'
implementation 'org.jmdns:jmdns:3.5.5'
implementation 'org.jmdns:jmdns:3.5.7'
}
+28 -24
View File
@@ -1089,8 +1089,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
// Handle a synthetic back button event that some Android OS versions
// create as a result of a right-click. This event WILL repeat if
// the right mouse button is held down, so we ignore those.
if ((event.getSource() == InputDevice.SOURCE_MOUSE ||
event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE) &&
int eventSource = event.getSource();
if ((eventSource == InputDevice.SOURCE_MOUSE ||
eventSource == InputDevice.SOURCE_MOUSE_RELATIVE) &&
event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
// Send the right mouse button event if mouse back and forward
@@ -1159,8 +1160,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
// Handle a synthetic back button event that some Android OS versions
// create as a result of a right-click.
if ((event.getSource() == InputDevice.SOURCE_MOUSE ||
event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE) &&
int eventSource = event.getSource();
if ((eventSource == InputDevice.SOURCE_MOUSE ||
eventSource == InputDevice.SOURCE_MOUSE_RELATIVE) &&
event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
// Send the right mouse button event if mouse back and forward
@@ -1233,19 +1235,20 @@ public class Game extends Activity implements SurfaceHolder.Callback,
return false;
}
if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
int eventSource = event.getSource();
if ((eventSource & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
if (controllerHandler.handleMotionEvent(event)) {
return true;
}
}
else if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0 ||
(event.getSource() & InputDevice.SOURCE_CLASS_POSITION) != 0 ||
event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE)
else if ((eventSource & InputDevice.SOURCE_CLASS_POINTER) != 0 ||
(eventSource & InputDevice.SOURCE_CLASS_POSITION) != 0 ||
eventSource == InputDevice.SOURCE_MOUSE_RELATIVE)
{
// This case is for mice and non-finger touch devices
if (event.getSource() == InputDevice.SOURCE_MOUSE ||
(event.getSource() & InputDevice.SOURCE_CLASS_POSITION) != 0 || // SOURCE_TOUCHPAD
event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE ||
if (eventSource == InputDevice.SOURCE_MOUSE ||
(eventSource & InputDevice.SOURCE_CLASS_POSITION) != 0 || // SOURCE_TOUCHPAD
eventSource == InputDevice.SOURCE_MOUSE_RELATIVE ||
(event.getPointerCount() >= 1 &&
(event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE ||
event.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS ||
@@ -1272,7 +1275,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
conn.sendMouseMove(deltaX, deltaY);
}
}
else if ((event.getSource() & InputDevice.SOURCE_CLASS_POSITION) != 0) {
else if ((eventSource & InputDevice.SOURCE_CLASS_POSITION) != 0) {
// If this input device is not associated with the view itself (like a trackpad),
// we'll convert the device-specific coordinates to use to send the cursor position.
// This really isn't ideal but it's probably better than nothing.
@@ -1280,20 +1283,21 @@ public class Game extends Activity implements SurfaceHolder.Callback,
// Trackpad on newer versions of Android (Oreo and later) should be caught by the
// relative axes case above. If we get here, we're on an older version that doesn't
// support pointer capture.
InputDevice.MotionRange xRange = event.getDevice().getMotionRange(MotionEvent.AXIS_X, event.getSource());
InputDevice.MotionRange yRange = event.getDevice().getMotionRange(MotionEvent.AXIS_Y, event.getSource());
InputDevice device = event.getDevice();
if (device != null) {
InputDevice.MotionRange xRange = device.getMotionRange(MotionEvent.AXIS_X, eventSource);
InputDevice.MotionRange yRange = device.getMotionRange(MotionEvent.AXIS_Y, eventSource);
// All touchpads coordinate planes should start at (0, 0)
if (xRange != null && yRange != null && xRange.getMin() == 0 && yRange.getMin() == 0) {
int xMax = (int)xRange.getMax();
int yMax = (int)yRange.getMax();
// All touchpads coordinate planes should start at (0, 0)
if (xRange != null && yRange != null && xRange.getMin() == 0 && yRange.getMin() == 0) {
int xMax = (int)xRange.getMax();
int yMax = (int)yRange.getMax();
// Touchpads must be smaller than (65535, 65535)
if (xMax <= Short.MAX_VALUE && yMax <= Short.MAX_VALUE) {
conn.sendMousePosition((short)event.getAxisValue(MotionEvent.AXIS_X),
(short)event.getAxisValue(MotionEvent.AXIS_Y),
(short)xMax,
(short)yMax);
// Touchpads must be smaller than (65535, 65535)
if (xMax <= Short.MAX_VALUE && yMax <= Short.MAX_VALUE) {
conn.sendMousePosition((short)event.getX(), (short)event.getY(),
(short)xMax, (short)yMax);
}
}
}
}
@@ -41,8 +41,9 @@ public class AndroidNativePointerCaptureProvider extends AndroidPointerIconCaptu
// SOURCE_MOUSE_RELATIVE is how SOURCE_MOUSE appears when our view has pointer capture.
// SOURCE_TOUCHPAD will have relative axes populated iff our view has pointer capture.
// See https://developer.android.com/reference/android/view/View#requestPointerCapture()
return event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE ||
(event.getSource() == InputDevice.SOURCE_TOUCHPAD && targetView.hasPointerCapture());
int eventSource = event.getSource();
return eventSource == InputDevice.SOURCE_MOUSE_RELATIVE ||
(eventSource == InputDevice.SOURCE_TOUCHPAD && targetView.hasPointerCapture());
}
@Override
@@ -127,7 +127,12 @@ public class UsbDriverService extends Service implements UsbDriverListener {
// just returning a false result or returning 0 enumerated devices,
// they throw an undocumented SecurityException from this call, crashing
// the whole app. :(
usbManager.requestPermission(device, PendingIntent.getBroadcast(UsbDriverService.this, 0, new Intent(ACTION_USB_PERMISSION), 0));
int intentFlags = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// This PendingIntent must be mutable to allow the framework to populate EXTRA_DEVICE and EXTRA_PERMISSION_GRANTED.
intentFlags |= PendingIntent.FLAG_MUTABLE;
}
usbManager.requestPermission(device, PendingIntent.getBroadcast(UsbDriverService.this, 0, new Intent(ACTION_USB_PERMISSION), intentFlags));
} catch (SecurityException e) {
Toast.makeText(this, this.getText(R.string.error_usb_prohibited), Toast.LENGTH_LONG).show();
}
@@ -367,6 +367,12 @@ public class NvConnection {
}
}
public void sendUtf8Text(final String text) {
if (!isMonkey) {
MoonBridge.sendUtf8Text(text);
}
}
public static String findExternalAddressForMdns(String stunHostname, int stunPort) {
return MoonBridge.findExternalAddressIP4(stunHostname, stunPort);
}
@@ -291,6 +291,8 @@ public class MoonBridge {
public static native void sendMouseHighResScroll(short scrollAmount);
public static native void sendUtf8Text(String text);
public static native String getStageName(int stage);
public static native String findExternalAddressIP4(String stunHostName, int stunPort);
@@ -88,11 +88,11 @@ public class AddComputerManually extends Activity {
// Couldn't find a matching interface
return true;
} catch (SocketException e) {
} catch (Exception e) {
// Catch all exceptions because some broken Android devices
// will throw an NPE from inside getNetworkInterfaces().
e.printStackTrace();
return false;
} catch (UnknownHostException e) {
return false;
}
}
@@ -44,7 +44,7 @@ public class StreamSettings extends Activity {
void reloadSettings() {
getFragmentManager().beginTransaction().replace(
R.id.stream_settings, new SettingsFragment()
).commit();
).commitAllowingStateLoss();
}
@Override
@@ -39,7 +39,7 @@ public class ShortcutHelper {
@TargetApi(Build.VERSION_CODES.N_MR1)
private void reapShortcutsForDynamicAdd() {
List<ShortcutInfo> dynamicShortcuts = sm.getDynamicShortcuts();
while (dynamicShortcuts.size() >= sm.getMaxShortcutCountPerActivity()) {
while (!dynamicShortcuts.isEmpty() && dynamicShortcuts.size() >= sm.getMaxShortcutCountPerActivity()) {
ShortcutInfo maxRankShortcut = dynamicShortcuts.get(0);
for (ShortcutInfo scut : dynamicShortcuts) {
if (maxRankShortcut.getRank() < scut.getRank()) {
@@ -118,8 +118,16 @@ public class ShortcutHelper {
// To avoid a random carousel of shortcuts popping in and out based on polling status,
// we only add shortcuts if it's not at the limit or the user made a conscious action
// to interact with this PC.
if (forceAdd || sm.getDynamicShortcuts().size() < sm.getMaxShortcutCountPerActivity()) {
if (forceAdd) {
// This should free an entry for us to add one below
reapShortcutsForDynamicAdd();
}
// We still need to check the maximum shortcut count even after reaping,
// because there's a possibility that it could be zero.
if (sm.getDynamicShortcuts().size() < sm.getMaxShortcutCountPerActivity()) {
// Add a shortcut if there is room
sm.addDynamicShortcuts(Collections.singletonList(sinfo));
}
}
@@ -4,6 +4,7 @@
#include <android/log.h>
#include <arpa/inet.h>
#include <string.h>
JNIEXPORT void JNICALL
Java_com_limelight_nvstream_jni_MoonBridge_sendMouseMove(JNIEnv *env, jclass clazz, jshort deltaX, jshort deltaY) {
@@ -54,6 +55,13 @@ Java_com_limelight_nvstream_jni_MoonBridge_sendMouseHighResScroll(JNIEnv *env, j
LiSendHighResScrollEvent(scrollAmount);
}
JNIEXPORT void JNICALL
Java_com_limelight_nvstream_jni_MoonBridge_sendUtf8Text(JNIEnv *env, jclass clazz, jstring text) {
const char* utf8Text = (*env)->GetStringUTFChars(env, text, NULL);
LiSendUtf8TextEvent(utf8Text, strlen(utf8Text));
(*env)->ReleaseStringUTFChars(env, text, utf8Text);
}
JNIEXPORT void JNICALL
Java_com_limelight_nvstream_jni_MoonBridge_stopConnection(JNIEnv *env, jclass clazz) {
LiStopConnection();
+2 -1
View File
@@ -8,11 +8,12 @@ before_build:
- 'git submodule update --init --recursive'
- 'mklink /D C:\android-sdk "C:\Program Files (x86)\Android\android-sdk"'
- 'set ANDROID_HOME=C:\android-sdk'
- 'set JAVA_HOME=C:\Program Files\Java\jdk11'
build_script:
- gradlew.bat build connectedCheck
after_build:
- 'appveyor PushArtifact app\build\reports\lint-results.html'
- 'appveyor PushArtifact app\build\reports\lint-results-nonRootDebug.html'
deploy: off
+1 -1
View File
@@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.0'
}
}
@@ -0,0 +1,2 @@
- Fixed crash on Android 12 when using USB driver
- Fixed several other rare user-reported crashes
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip