AndroidManifest.xml - OpenGL consideration


#1

Greets,

I just want to post another discovery I made with Juce regarding AndroidManifest.xml settings and OpenGL performance. As some of you may know different API levels have different default configurations for Android backend support. After API 11 there is a hardware accelerated path with Android for the 2D API and such that can be enabled with an XML tag, but after API level 14 it is turned on by default. It turns out that when this backend hardware acceleration path is turned on there are variable 15-20FPS drops in rendering w/ OpenGL ES & Juce. The are many reasons to set a higher targetSDKVersion including removing the menu button from app navigation on tablets and ICS+ devices. More modern Android apps are mostly moving to the ActionBar and eliminating the dedicated menu button. To do this though one sets a higher targetSDKVersion (after 11), but if you set 14+ the Android backend hardware accelerated path is enabled by default.

IE:

To prevent the hardware accelerated path add this to your application tag:

  <application 
    android:label="@string/app_name" 
    android:icon="@drawable/icon"
    android:hardwareAccelerated="false"
    >

OpenGL rendering in Juce is separate of the hardware acceleration enabled in the Android 2D API / backend. So, if you have a Juce OpenGL app this may be something to consider or at least be aware of… It was a WTF moment for me and took a little head scratching & intuition w/ Android when I started modifying the targetSdkVersion and connecting it to the change in platform defaults.


#2

Wow. Thanks for tracking that down!

I guess the performance hit comes from the UI thread and GL thread fighting over hardware locks… Well, I suppose I’d better change the introjucer to always disable that android:hardwareAccelerated flag!


#3

You’ll have to verify adding the android:hardwareAccelerated tag as a default with IntroJucer unless you have a the targetSDKVersion tag higher than 11 I believe the build will fail since the hardwareAccelerated tag was not added until API 11. I imagine it should be fine to have IntroJucer also add the appropriate targetSDKVersion tag too and still leave the minSDKVersion at 8.


#4

Thanks! I’ve checked this in now if you want to try it.