SDL: Turn HIDAPI joystick support off by default on mobile platforms (66054)

From 66054a6515f8538b055dc77c4a9ac27ff8a822a6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 10 Mar 2024 15:00:49 -0700
Subject: [PATCH] Turn HIDAPI joystick support off by default on mobile
 platforms

On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers.

Fixes https://github.com/libsdl-org/SDL/issues/9241

(cherry picked from commit e3cf2e479498205cec56906e03800da24e38786b)
---
 src/joystick/hidapi/SDL_hidapijoystick_c.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/joystick/hidapi/SDL_hidapijoystick_c.h b/src/joystick/hidapi/SDL_hidapijoystick_c.h
index cd18730a83e9f..738c43abebe46 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick_c.h
+++ b/src/joystick/hidapi/SDL_hidapijoystick_c.h
@@ -47,7 +47,14 @@
 #define SDL_JOYSTICK_HIDAPI_SHIELD
 
 /* Whether HIDAPI is enabled by default */
+#if defined(__ANDROID__) || \
+    defined(__IPHONEOS__) || \
+    defined(__TVOS__)
+/* On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers, so we'll leave it off by default. */
+#define SDL_HIDAPI_DEFAULT SDL_FALSE
+#else
 #define SDL_HIDAPI_DEFAULT SDL_TRUE
+#endif
 
 /* The maximum size of a USB packet for HID devices */
 #define USB_PACKET_LENGTH 64