Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] StageWebView doesn't work with <runtimeInBackgroundThread>true</runtimeInBackgroundThread> #2616

Closed
itlancer opened this issue Apr 21, 2023 · 1 comment
Labels

Comments

@itlancer
Copy link

Problem Description

StageWebView doesn't work with <runtimeInBackgroundThread>true</runtimeInBackgroundThread> for Android.
Webframe just doesn't show.

Tested with latest AIR 50.2.2.3 and AIR 50.2.2.4 versions with multiple different Android devices with different OS versions with different applications and architectures.
Same problem in all cases.
There is no such problem without <runtimeInBackgroundThread>true</runtimeInBackgroundThread>.

Related issue:
#2615

Steps to Reproduce

Launch application with code below. It just display StageWebView.

Application example with sources attached.
android_runtimeinbackgroundthread_stagewebview_bug.zip

package {
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.media.StageWebView;
	import flash.events.Event;
	
	public class AndroidRuntimeInBackgroundThreadStageWebViewBug extends Sprite {
		private var stageWebView:StageWebView;
		
		public function AndroidRuntimeInBackgroundThreadStageWebViewBug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stageWebView = new StageWebView(true);
			stageWebView.loadURL("https://airsdk.harman.com/");
			stageWebView.viewPort = new Rectangle(0, 100, 1280, 620);
			stageWebView.stage = stage;
		}
	}
}

Actual Result:
StageWebView not displayed.
With ADB Logcat you can see error log:

W/System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
W/System.err:     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9629)
W/System.err:     at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1919)
W/System.err:     at android.view.View.requestLayout(View.java:26296)
W/System.err:     at android.view.View.requestLayout(View.java:26296)
W/System.err:     at android.view.View.requestLayout(View.java:26296)
W/System.err:     at android.view.View.requestLayout(View.java:26296)
W/System.err:     at android.view.ViewGroup.addView(ViewGroup.java:5075)
W/System.err:     at android.view.ViewGroup.addView(ViewGroup.java:5017)
W/System.err:     at android.view.ViewGroup.addView(ViewGroup.java:4989)
W/System.err:     at com.adobe.air.AndroidActivityWrapper.getOverlaysLayout(AndroidActivityWrapper.java:781)
W/System.err:     at com.adobe.air.AndroidWebView.addedToStage(AndroidWebView.java:731)
W/System.err:     at com.adobe.air.Entrypoints.EntryMainWrapper(Native Method)
W/System.err:     at com.adobe.air.Entrypoints.run(Entrypoints.java:275)
W/System.err:     at java.lang.Thread.run(Thread.java:1012)

Expected Result:
StageWebView will be shown.

Known Workarounds

none
*Do not use <runtimeInBackgroundThread>true</runtimeInBackgroundThread>.

@itlancer itlancer added the Bug label Apr 21, 2023
@itlancer
Copy link
Author

Fixed with latest AIR 50.2.2.6. Thanks!
But issue with StageText still exists #2615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant