Revert "(Android) Backport c9218bbd23"

This reverts commit 6e4c8ec6a61e6148765dcc6216005cb1c6be9268.
This commit is contained in:
twinaphex 2019-06-27 17:55:19 +02:00
parent 01c489eee0
commit 8037cbe3dc
4 changed files with 36 additions and 49 deletions

2
deps/dr/dr_flac.h vendored
View File

@ -667,7 +667,7 @@ const char* drflac_next_vorbis_comment(drflac_vorbis_comment_iterator* pIter, dr
#define DRFLAC_NO_CPUID #define DRFLAC_NO_CPUID
#endif #endif
#else #else
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__ANDROID__) #if defined(__GNUC__) || defined(__clang__)
static void drflac__cpuid(int info[4], int fid) static void drflac__cpuid(int info[4], int fid)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (

View File

@ -42,16 +42,13 @@ public final class MainMenuActivity extends PreferenceActivity
private boolean addPermission(List<String> permissionsList, String permission) private boolean addPermission(List<String> permissionsList, String permission)
{ {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED)
{ {
if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) permissionsList.add(permission);
{
permissionsList.add(permission);
// Check for Rationale Option // Check for Rationale Option
if (!shouldShowRequestPermissionRationale(permission)) if (!shouldShowRequestPermissionRationale(permission))
return false; return false;
}
} }
return true; return true;
@ -59,7 +56,7 @@ public final class MainMenuActivity extends PreferenceActivity
public void checkRuntimePermissions() public void checkRuntimePermissions()
{ {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) if (android.os.Build.VERSION.SDK_INT >= 23)
{ {
// Android 6.0+ needs runtime permission checks // Android 6.0+ needs runtime permission checks
List<String> permissionsNeeded = new ArrayList<String>(); List<String> permissionsNeeded = new ArrayList<String>();
@ -92,13 +89,10 @@ public final class MainMenuActivity extends PreferenceActivity
{ {
if (which == AlertDialog.BUTTON_POSITIVE) if (which == AlertDialog.BUTTON_POSITIVE)
{ {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),
{ REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),
REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
Log.i("MainMenuActivity", "User accepted request for external storage permissions."); Log.i("MainMenuActivity", "User accepted request for external storage permissions.");
}
} }
} }
}); });

View File

@ -49,17 +49,14 @@ public class RetroActivityCommon extends RetroActivityLocation
long[] pattern = {16}; long[] pattern = {16};
int[] strengths = {strength}; int[] strengths = {strength};
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) if (id == -1)
vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
else
{ {
if (id == -1) InputDevice dev = InputDevice.getDevice(id);
vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
else
{
InputDevice dev = InputDevice.getDevice(id);
if (dev != null) if (dev != null)
vibrator = dev.getVibrator(); vibrator = dev.getVibrator();
}
} }
if (vibrator == null) if (vibrator == null)
@ -75,7 +72,7 @@ public class RetroActivityCommon extends RetroActivityLocation
else else
pattern[0] = 1000; pattern[0] = 1000;
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= 26) {
if (id >= 0) if (id >= 0)
Log.i("RetroActivity", "Vibrate id " + id + ": strength " + strength); Log.i("RetroActivity", "Vibrate id " + id + ": strength " + strength);

View File

@ -40,16 +40,13 @@ public final class RetroActivityFuture extends RetroActivityCamera {
// Check for Android UI specific parameters // Check for Android UI specific parameters
Intent retro = getIntent(); Intent retro = getIntent();
String refresh = retro.getStringExtra("REFRESH");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { // If REFRESH parameter is provided then try to set refreshrate accordingly
String refresh = retro.getStringExtra("REFRESH"); if(refresh != null) {
WindowManager.LayoutParams params = getWindow().getAttributes();
// If REFRESH parameter is provided then try to set refreshrate accordingly params.preferredRefreshRate = Integer.parseInt(refresh);
if(refresh != null) { getWindow().setAttributes(params);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.preferredRefreshRate = Integer.parseInt(refresh);
getWindow().setAttributes(params);
}
} }
// If QUITFOCUS parameter is provided then enable that Retroarch quits when focus is lost // If QUITFOCUS parameter is provided then enable that Retroarch quits when focus is lost
@ -64,21 +61,20 @@ public final class RetroActivityFuture extends RetroActivityCamera {
public void hideMouseCursor() { public void hideMouseCursor() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { // Check for NVIDIA extensions and minimum SDK version
// Check for NVIDIA extensions and minimum SDK version Method mInputManager_setCursorVisibility;
Method mInputManager_setCursorVisibility; try { mInputManager_setCursorVisibility =
try { mInputManager_setCursorVisibility = InputManager.class.getMethod("setCursorVisibility", boolean.class);
InputManager.class.getMethod("setCursorVisibility", boolean.class); }
} catch (NoSuchMethodException ex) {
catch (NoSuchMethodException ex) { return; // Extensions were not available so do nothing
return; // Extensions were not available so do nothing }
}
// Hide the mouse cursor // Hide the mouse cursor
InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE); InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE);
try { mInputManager_setCursorVisibility.invoke(inputManager, false); } try { mInputManager_setCursorVisibility.invoke(inputManager, false); }
catch (InvocationTargetException ite) { } catch (InvocationTargetException ite) { }
catch (IllegalAccessException iae) { } catch (IllegalAccessException iae) { }
} }
@Override @Override