Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why setting hardwareaccelerated to false make things faster?

Tags:

android

I have an application running on tablet devices with two panes, for the left one I have a simple animation on replacing a fragment:

private void loadLeftFragment(Fragment fragment, boolean isAnimated) {
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();

        if (isAnimated) {
            fragmentTransaction.setCustomAnimations(android.R.anim.slide_in_left,
                    android.R.anim.slide_out_right);
        }

        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.replace(R.id.left_frame, fragment).commit();
    }

Please notice the animation peace of code. It runs perfectly smooth on Nexus 7, but on Galaxy Tab 2 it is not. So I experimented with android:hardwareAccelerated="true/false" tag in AndroidManifest.xml. And what I got is that when the value is set to false the animation on Galaxy Tab 2 is such as on Nexus 7, i.e. smooth and good looking. I didn't expect such a behavior assuming it should be vice versa - setting the hardwareAccelerated value to true makes things 'smoother'. But it happens if I set it to true I see lags, when false it is just nice! What I'm missing here? Thank you.

like image 718
Eugene Avatar asked Jul 17 '13 07:07

Eugene


People also ask

What is Android Hardwareaccelerated false?

Hardware acceleration is the process to use device hardware to speedup drawing operations of android application. In other word, android use hardware acceleration to speed up 2D rendering or fast up the image and video rendering. It is by default enabled if your Target API level is >=14.

Does hardware acceleration improve performance?

Hardware acceleration increases performance of the web browser. When the feature is enabled, some users experience issues that resemble the following when they view various websites: Hardware or software compatibility issues, such as websites that contain streaming or full-screen videos.

Should I enable tethering hardware acceleration?

Should I use tethering hardware acceleration? Hardware acceleration is good because it boosts performance for certain tasks. But sometimes, it may cause issues such as freezing or crashing in Google Chrome or other browsers, forcing you to disable the feature to fix the issue.

What does disabling hardware acceleration do?

Without hardware acceleration, most of these pages will stutter and freeze. Once you turn hardware acceleration on, you can enjoy digital fireworks, play around with a blob, or try solving a 3D Rubik's cube. Letting your CPU process and perform all tasks by itself greatly slows down your computer.


1 Answers

Well it all depends on the memory usage. What happens when you turn on hardware acceleration is, app’s animations and UI rendering happens with the GPU and that causes the system to take a hit to memory usage. Loading up the OpenGL drivers for each process takes memory usage of roughly 2MB, and boosts it to 8MB. On devices with limited RAM, this can be a real issue. When more RAM is eaten up, the system will necessarily have to close more background tasks to save memory.

So this option must be used cleverly and depending on the target devices.

like image 69
blganesh101 Avatar answered Nov 15 '22 19:11

blganesh101