Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Application being forced to use hardware acceleration?

Tags:

android

My app uses Canvas methods which are not supported by hardware acceleration (clipPath, drawPicture), so I do not enable hardware accelaration. However, I started getting crash reports with exceptions like: android.view.GLES20Canvas.drawPicture(GLES20Canvas.java:895).

In investigating this, it seems that some devices have an option to force hardware acceleration in settings: "force gpu rendering, use 2d harware acceleartion in applciations". So, I added <application android:hardwareAccelerated="false"> to my manifest.xml, but still get the crash when the "force gpu rendering" setting is checked.

So, is there anyway to prevent my application from being forced to use hardware acceleration?

like image 846
ab11 Avatar asked Apr 08 '26 08:04

ab11


1 Answers

Disable it for the views using those operations with the 'View Level' option in the dev guide - I expect that other options will be foiled by how the setting is forced on your app.

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

Failing that, the link describes how you can detect hardware acceleration, to complain about it.

View.isHardwareAccelerated() returns true if the View is attached to a hardware accelerated window.

Canvas.isHardwareAccelerated() returns true if the Canvas is hardware accelerated

like image 135
Julian Fondren Avatar answered Apr 10 '26 00:04

Julian Fondren