Has anyone else seen a bug with HTC Flyer's Web View (hardware accelerated) or found a fix?

738 Views Asked by At

This issue is VERY specific to the HTC Flyer. One that has been upgraded to Honeycomb or later. It appears that if Hardware Acceleration is turned on, then the WebView just renders blank. The background color appears and you can scroll. You can even highlight text or tap links, but you just can't see anything. It is all invisible.

It also logs a ton of the following:

D/GLUtils(6612): GL ERROR - after drawQuad() glError (0x502)

Seems like a bug with the Flyer, but has anyone successfully used hardware acceleration with this device and a WebView?

Update

I have discovered that this issue is caused when the first WebView of an app is not hardware accelerated. Then, any further WebViews will not be able to be hardware accelerated, without this issue occurring.

To reproduce:

Create two Activities. Each activity can just have a WebView in it. The first activity should have hardware acceleration disabled. The second should have it enabled.

In the first activity (the non hardware accelerated one), load a url. The page will load fine. Now sometime after the page has loaded and displayed, start the second activity from the first.

The second activity (the hardware accelerated one) should also load a url. This will cause the bug to happen. The second activities' WebView will display blank.

Also:

Oddly enough, you can do the following and it will work:

Start an activity with hardware acceleration and a webview. Load a url and after it has displayed, start a second activity without hardware acceleration. Then in the second activity, load a url and then after it has displayed, start a third activity with hardware acceleration. The third activity will display correctly.

So this issue only seems to happen if the very first WebView that runs inside of the Application's lifecycle/instance is not hardware accelerated. It seems that if you do that, then any WebView that later attempts to be hardware accelerated will not work properly.

Again, out of hundreds of devices that this app runs on, this only occurs on the HTC Flyer.

1

There are 1 best solutions below

1
On

Thanks for reporting the issue. I haven't been able to get it to occur in my own tests. Can you provide some more details about what you are doing?

In my tests I created a simple Android app with a WebView that shows an index.html file from its assets folder. I made sure hardware acceleration is enabled, both by a high targetSdkVersion and explicitly setting hardwareAccelerated to true in the Android Manifest.xml. The content is showing fine in an updated Flyer I tested on.

I've heard a hardware accelerated web view won't work inside other hardware accelerated elements, like scroll views, and similar issues with showing web content on top of other web content. So maybe it could be something like that at work.

Here is the test project that is currently working: https://github.com/lnanek/HWWebView

Here is the AndroidManifest.xml from it:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
    package="com.htc.sample.hwwebview"
    a:versionCode="2"
    a:versionName="2.0" >
    <uses-sdk a:minSdkVersion="3" a:targetSdkVersion="15" />
    <uses-permission a:name="android.permission.INTERNET" />
    <application a:icon="@drawable/ic_launcher" a:label="@string/app_name" a:hardwareAccelerated="true" >
        <activity a:name=".Viewer" a:label="@string/app_name" >
            <intent-filter>
                <action a:name="android.intent.action.MAIN" />
                <category a:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Here is the main layout:
<?xml version="1.0" encoding="utf-8"?>
<WebView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />