mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 10:31:07 +00:00
Handle failure to bind com.nvidia.blakepairing more robustly
This commit is contained in:
@@ -92,8 +92,15 @@ public class ShieldControllerExtensionsHandler implements InputManager.InputDevi
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.nvidia.blakepairing", "com.nvidia.blakepairing.AccessoryService");
|
||||
if (!context.bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE)) {
|
||||
LimeLog.info("com.nvidia.blakepairing.AccessoryService is not available on this device");
|
||||
try {
|
||||
// The docs say to call unbindService() even if the bindService() call returns false
|
||||
// or throws a SecurityException.
|
||||
if (!context.bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE)) {
|
||||
LimeLog.info("com.nvidia.blakepairing.AccessoryService is not available on this device");
|
||||
context.unbindService(serviceConnection);
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
context.unbindService(serviceConnection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user