开发者

SIGSEGV loading HTML + Flash into a WebView

I'm getting SIGSEGV signals when I try to load HTML into a WebView with embedded flash plugins (mostly youtube) with loadDataWithBaseURL with the PluginState set to PluginState.ON. I'm able to reproduce the error with a simple test case. See the following code:

package ians.android2;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings;

public class TestAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceStat开发者_运维技巧e) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    WebView wv = (WebView)findViewById(R.id.webview);
    wv.getSettings().setPluginState(WebSettings.PluginState.ON);

    String html = "";
    html += "<object width=\"620\" height=\"376\">";
    html += "<param name=\"movie\" value=\"http://www.youtube.com/v/C4KdcRHoXOA?fs=1&amp;hl=en_US&amp;rel=0\"></param>";
    html += "<param name=\"allowFullScreen\" value=\"true\"></param>";
    html += "<param name=\"allowscriptaccess\" value=\"always\"></param>";
    html += "<embed src=\"http://www.youtube.com/v/C4KdcRHoXOA?fs=1&amp;hl=en_US&amp;rel=0\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"620\" height=\"376\"></embed>";
    html += "</object>";

    wv.loadDataWithBaseURL("notreal/", html, "text/html", "utf-8", null);
    }
}


SIGSEGV signals or Segmentation Faults occur when a process attempts to reference memory outside the memory segments that have been allocated to the process. This prevents processes from corrupting other processes running on the phone and indeed Android itself.

Without attempting to reproduce the problem myself I would suggest that your code has possibly exposed a defect in the Dalvik JVM running on the HTC.

One of the cool things about Segmentation Faults is that you should be able to get a core file which describes the state of the process in memory when the fault occurred.

Core files are readable by the GNU debugger gdb and will give the call stack trace up to the point where the segmentation fault occurred. So if you could find a corresponding core file then that would be useful to submit along with a bug request to the Android developers. A bit of research should reveal whether or not you can get the core file from a process crash on a HTC.

From the point of view getting your code working I suggest trying less complex HTML to see if that works and then incrementally adding the html that you require to see if a specific change in HTML exposes the defect. This would be useful for the Android developers in any bug report that you submitted to them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜