From 39772b74742ed3c8769bd4632960afff6144ba2a Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 28 Jul 2021 17:12:52 +0100 Subject: [PATCH] Android: Remove old minimum SDK version checks --- .../jucer_ProjectExport_Android.h | 56 +++---------------- .../juce_audio_devices/juce_audio_devices.h | 10 +--- .../juce_core/native/juce_posix_SharedCode.h | 7 +-- 3 files changed, 13 insertions(+), 60 deletions(-) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 5a71f5c95e..a33b228dfb 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -1272,11 +1272,7 @@ private: String getAppPlatform() const { - auto ndkVersion = static_cast (androidMinimumSDK.get()); - if (ndkVersion == 9) - ndkVersion = 10; // (doesn't seem to be a version '9') - - return "android-" + String (ndkVersion); + return "android-" + androidMinimumSDK.get().toString(); } //============================================================================== @@ -1713,15 +1709,8 @@ private: app->setAttribute ("android:icon", "@drawable/icon"); } - if (static_cast (androidMinimumSDK.get()) >= 11) - { - if (! app->hasAttribute ("android:hardwareAccelerated")) - app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) - } - else - { - app->removeAttribute ("android:hardwareAccelerated"); - } + if (! app->hasAttribute ("android:hardwareAccelerated")) + app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) return app; } @@ -1734,34 +1723,12 @@ private: setAttributeIfNotPresent (*act, "android:label", "@string/app_name"); if (! act->hasAttribute ("android:configChanges")) - { - String configChanges ("keyboardHidden|orientation"); - if (static_cast (androidMinimumSDK.get()) >= 13) - configChanges += "|screenSize"; - - act->setAttribute ("android:configChanges", configChanges); - } - else - { - auto configChanges = act->getStringAttribute ("android:configChanges"); - - if (static_cast (androidMinimumSDK.get()) < 13 && configChanges.contains ("screenSize")) - { - configChanges = configChanges.replace ("|screenSize", "") - .replace ("screenSize|", "") - .replace ("screenSize", ""); - - act->setAttribute ("android:configChanges", configChanges); - } - } + act->setAttribute ("android:configChanges", "keyboardHidden|orientation|screenSize"); if (androidScreenOrientation.get() == "landscape") { - String landscapeString = static_cast (androidMinimumSDK.get()) < 9 - ? "landscape" - : (static_cast (androidMinimumSDK.get()) < 18 ? "sensorLandscape" : "userLandscape"); - - setAttributeIfNotPresent (*act, "android:screenOrientation", landscapeString); + setAttributeIfNotPresent (*act, "android:screenOrientation", + static_cast (androidMinimumSDK.get()) < 18 ? "sensorLandscape" : "userLandscape"); } else { @@ -1773,15 +1740,8 @@ private: // Using the 2D acceleration slows down OpenGL. We *do* enable it here for the activity though, and we disable it // in each ComponentPeerView instead. This way any embedded native views, which are not children of ComponentPeerView, // can still use hardware acceleration if needed (e.g. web view). - if (static_cast (androidMinimumSDK.get()) >= 11) - { - if (! act->hasAttribute ("android:hardwareAccelerated")) - act->setAttribute ("android:hardwareAccelerated", "true"); // (using the 2D acceleration slows down openGL) - } - else - { - act->removeAttribute ("android:hardwareAccelerated"); - } + if (! act->hasAttribute ("android:hardwareAccelerated")) + act->setAttribute ("android:hardwareAccelerated", "true"); // (using the 2D acceleration slows down openGL) return act; } diff --git a/modules/juce_audio_devices/juce_audio_devices.h b/modules/juce_audio_devices/juce_audio_devices.h index 33de7c0be3..c87c155fa7 100644 --- a/modules/juce_audio_devices/juce_audio_devices.h +++ b/modules/juce_audio_devices/juce_audio_devices.h @@ -124,21 +124,17 @@ #endif /** Config: JUCE_USE_ANDROID_OBOE - Enables Oboe devices (Android only, API 16 or above). + Enables Oboe devices (Android only). */ #ifndef JUCE_USE_ANDROID_OBOE #define JUCE_USE_ANDROID_OBOE 1 #endif -#if JUCE_USE_ANDROID_OBOE && JUCE_ANDROID_API_VERSION < 16 - #undef JUCE_USE_ANDROID_OBOE - #define JUCE_USE_ANDROID_OBOE 0 -#endif - /** Config: JUCE_USE_OBOE_STABILIZED_CALLBACK If JUCE_USE_ANDROID_OBOE is enabled, enabling this will wrap output audio streams in the oboe::StabilizedCallback class. This class attempts to keep the CPU spinning to avoid it being scaled down on certain devices. + (Android only). */ #ifndef JUCE_USE_ANDROID_OBOE_STABILIZED_CALLBACK #define JUCE_USE_ANDROID_OBOE_STABILIZED_CALLBACK 0 @@ -148,7 +144,7 @@ Enables OpenSLES devices (Android only). */ #ifndef JUCE_USE_ANDROID_OPENSLES - #if ! JUCE_USE_ANDROID_OBOE && JUCE_ANDROID_API_VERSION >= 9 + #if ! JUCE_USE_ANDROID_OBOE #define JUCE_USE_ANDROID_OPENSLES 1 #else #define JUCE_USE_ANDROID_OPENSLES 0 diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index abac4cbd4a..831a25cca5 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -865,11 +865,8 @@ static void* threadEntryProc (void* userData) return nullptr; } -#if JUCE_ANDROID && JUCE_MODULE_AVAILABLE_juce_audio_devices && \ - ((JUCE_USE_ANDROID_OPENSLES || (! defined(JUCE_USE_ANDROID_OPENSLES) && JUCE_ANDROID_API_VERSION > 8)) \ - || (JUCE_USE_ANDROID_OBOE || (! defined(JUCE_USE_ANDROID_OBOE) && JUCE_ANDROID_API_VERSION > 15))) - - #define JUCE_ANDROID_REALTIME_THREAD_AVAILABLE 1 +#if JUCE_ANDROID && JUCE_MODULE_AVAILABLE_juce_audio_devices && (JUCE_USE_ANDROID_OPENSLES || JUCE_USE_ANDROID_OBOE) + #define JUCE_ANDROID_REALTIME_THREAD_AVAILABLE 1 #endif #if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE