Browse Source

Backport some SDL 2.0.16-dev features

- Let Android know that we can handle USB devices
- Support wired Amazon Luna gamepad on Android
- Chromebooks support relative mouse motion now
pull/2517/head
Anders Jenbo 5 years ago
parent
commit
ad38140956
  1. 4
      android-project/app/src/main/AndroidManifest.xml
  2. 7
      android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
  3. 5
      android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

4
android-project/app/src/main/AndroidManifest.xml

@ -60,6 +60,10 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Let Android know that we can handle some USB devices and should receive this event -->
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<!-- Drop file event -->
<!--
<intent-filter>

7
android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

@ -7,6 +7,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.os.Build;
import android.util.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -275,6 +276,7 @@ public class HIDDeviceManager {
0x15e4, // Numark
0x162e, // Joytech
0x1689, // Razer Onza
0x1949, // Lab126, Inc.
0x1bad, // Harmonix
0x24c6, // PowerA
};
@ -382,6 +384,11 @@ public class HIDDeviceManager {
return;
}
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
return;
}
// Find bonded bluetooth controllers and create SteamControllers for them
mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE);
if (mBluetoothManager == null) {

5
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

@ -986,11 +986,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/
public static boolean supportsRelativeMouse()
{
// ChromeOS doesn't provide relative mouse motion via the Android 7 APIs
if (isChromebook()) {
return false;
}
// DeX mode in Samsung Experience 9.0 and earlier doesn't support relative mice properly under
// Android 7 APIs, and simply returns no data under Android 8 APIs.
//

Loading…
Cancel
Save