artem
artem

Reputation: 16787

How to enable Hardware Acceleration on ICS, but disable in Gingerbread?

I want my app to be hw accelerated in ICS, but support of 2.3.3 is still needed too. Can I enable HW acceleration for ICS only? Or I can only drop 2.3.3 support?

Upvotes: 2

Views: 9544

Answers (3)

shalafi
shalafi

Reputation: 3996

There is something else here.

I enabled hardware acceleration for one of my games and it worked fine for ICS, but when I uploaded into the market I got many reports saying that the game became barely playable.

I contacted one of those users and I provided him another version just with hw acceleration turned off. He claimed that it worked better, and he was using gingerbread.

According to the official documentation, enabling hardware acceleration does not have any impact on gingerbread. However my experience is that it has.

Also, the official documentation claims that if you don't declare it and your target is ICS, it is enabled by default. However, when I explicitly turned it on I saw a clear improvement on the animations, swiping and scrolling.

So, the official documentation is not correct and there is a reason to manually disable / enable hardware acceleration for some versions.

I will be disabling hw acceleration in the manifest and using the following code.

if (android.os.Build.VERSION.SDK_INT>=11) {
   getWindow().setFlags(
        WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
        WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}

I'll let you know if this solves my problems, I hope so.

Edit: It worked fine and I stopped having complains from the users.

Upvotes: 3

android developer
android developer

Reputation: 115980

on ICS (android 4+) ,GPU acceleration is enabled by default and can be disabled in the manifest.

up to gingerbread, including, (up to android 2.3.x) , it's disabled since it's not available at all.

on honeycomb (android 3.x) , it's disabled by default , but can be enabled in the manifest.

Upvotes: 3

HandlerExploit
HandlerExploit

Reputation: 8251

Hardware acceleration was not added until 3.0. This is not an issue.

ref: http://developer.android.com/guide/topics/graphics/hardware-accel.html

Upvotes: 4

Related Questions