diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 06c3dc8cee..daffb547ed 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -1606,9 +1606,14 @@ private: } if (androidMinimumSDK.get().getIntValue() >= 11) - app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) + { + if (! app->hasAttribute ("android:hardwareAccelerated")) + app->setAttribute ("android:hardwareAccelerated", "false"); // (using the 2D acceleration slows down openGL) + } else + { app->removeAttribute ("android:hardwareAccelerated"); + } auto* act = getOrCreateChildWithName (*app, "activity"); @@ -1652,6 +1657,19 @@ private: setAttributeIfNotPresent (*act, "android:launchMode", "singleTask"); + // 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 (androidMinimumSDK.get().getIntValue() >= 11) + { + if (! act->hasAttribute ("android:hardwareAccelerated")) + act->setAttribute ("android:hardwareAccelerated", "true"); // (using the 2D acceleration slows down openGL) + } + else + { + act->removeAttribute ("android:hardwareAccelerated"); + } + auto* intent = getOrCreateChildWithName (*act, "intent-filter"); auto* action = getOrCreateChildWithName (*intent, "action"); diff --git a/modules/juce_core/native/java/JuceAppActivity.java b/modules/juce_core/native/java/JuceAppActivity.java index 4ae9f5e02a..64559402c1 100644 --- a/modules/juce_core/native/java/JuceAppActivity.java +++ b/modules/juce_core/native/java/JuceAppActivity.java @@ -568,6 +568,8 @@ public class JuceAppActivity extends Activity colorMatrix.set (colorTransform); paint.setColorFilter (new ColorMatrixColorFilter (colorMatrix)); + + setLayerType (View.LAYER_TYPE_NONE, null); } //============================================================================== diff --git a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp index 03190d461e..1bc8d0e805 100644 --- a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp +++ b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp @@ -106,8 +106,11 @@ private: { jobject peerView = (jobject) currentPeer->getNativeHandle(); + auto* env = getEnv(); + auto parentView = env->CallObjectMethod (peerView, AndroidView.getParent); + // Assuming a parent is always of ViewGroup type - getEnv()->CallVoidMethod (peerView, AndroidViewGroup.addView, view.get()); + env->CallVoidMethod (parentView, AndroidViewGroup.addView, view.get()); componentMovedOrResized (false, false); }