diff --git a/pkg/android/phoenix-common/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java b/pkg/android/phoenix-common/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java index 109126a171..896d8dcc8a 100644 --- a/pkg/android/phoenix-common/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java +++ b/pkg/android/phoenix-common/src/com/retroarch/browser/retroactivity/RetroActivityCommon.java @@ -49,14 +49,16 @@ public class RetroActivityCommon extends RetroActivityLocation long[] pattern = {16}; int[] strengths = {strength}; - if (id == -1) - vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); - else - { - InputDevice dev = InputDevice.getDevice(id); + if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { + if (id == -1) + vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); + else + { + InputDevice dev = InputDevice.getDevice(id); - if (dev != null) - vibrator = dev.getVibrator(); + if (dev != null) + vibrator = dev.getVibrator(); + } } if (vibrator == null) @@ -72,7 +74,7 @@ public class RetroActivityCommon extends RetroActivityLocation else pattern[0] = 1000; - if (Build.VERSION.SDK_INT >= 26) { + if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (id >= 0) Log.i("RetroActivity", "Vibrate id " + id + ": strength " + strength); diff --git a/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuActivity.java b/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuActivity.java index 3b70e60533..7f8a4ef9e7 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuActivity.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuActivity.java @@ -41,13 +41,16 @@ public final class MainMenuActivity extends PreferenceActivity private boolean addPermission(List permissionsList, String permission) { - if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - permissionsList.add(permission); + if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) + { + permissionsList.add(permission); - // Check for Rationale Option - if (!shouldShowRequestPermissionRationale(permission)) - return false; + // Check for Rationale Option + if (!shouldShowRequestPermissionRationale(permission)) + return false; + } } return true; @@ -55,7 +58,7 @@ public final class MainMenuActivity extends PreferenceActivity public void checkRuntimePermissions() { - if (android.os.Build.VERSION.SDK_INT >= 23) + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { // Android 6.0+ needs runtime permission checks List permissionsNeeded = new ArrayList(); @@ -90,10 +93,13 @@ public final class MainMenuActivity extends PreferenceActivity { if (which == AlertDialog.BUTTON_POSITIVE) { - requestPermissions(permissionsList.toArray(new String[permissionsList.size()]), - REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS); + 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); - Log.i("MainMenuActivity", "User accepted request for external storage permissions."); + Log.i("MainMenuActivity", "User accepted request for external storage permissions."); + } } } }); diff --git a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java index 92c142aebc..63b6f92989 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/retroactivity/RetroActivityFuture.java @@ -40,13 +40,16 @@ public final class RetroActivityFuture extends RetroActivityCamera { // Check for Android UI specific parameters Intent retro = getIntent(); - String refresh = retro.getStringExtra("REFRESH"); - // If REFRESH parameter is provided then try to set refreshrate accordingly - if(refresh != null) { - WindowManager.LayoutParams params = getWindow().getAttributes(); - params.preferredRefreshRate = Integer.parseInt(refresh); - getWindow().setAttributes(params); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { + String refresh = retro.getStringExtra("REFRESH"); + + // If REFRESH parameter is provided then try to set refreshrate accordingly + if(refresh != null) { + 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 @@ -61,20 +64,22 @@ public final class RetroActivityFuture extends RetroActivityCamera { public void hideMouseCursor() { - // Check for NVIDIA extensions and minimum SDK version - Method mInputManager_setCursorVisibility; - try { mInputManager_setCursorVisibility = - InputManager.class.getMethod("setCursorVisibility", boolean.class); - } - catch (NoSuchMethodException ex) { - return; // Extensions were not available so do nothing - } + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { + // Check for NVIDIA extensions and minimum SDK version + Method mInputManager_setCursorVisibility; + try { mInputManager_setCursorVisibility = + InputManager.class.getMethod("setCursorVisibility", boolean.class); + } + catch (NoSuchMethodException ex) { + return; // Extensions were not available so do nothing + } - // Hide the mouse cursor - InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE); - try { mInputManager_setCursorVisibility.invoke(inputManager, false); } - catch (InvocationTargetException ite) { } - catch (IllegalAccessException iae) { } + // Hide the mouse cursor + InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE); + try { mInputManager_setCursorVisibility.invoke(inputManager, false); } + catch (InvocationTargetException ite) { } + catch (IllegalAccessException iae) { } + } } @Override