Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

[AIR 33.1.1.926][Android] Stage::setAspectRatio() incorrect work

Open itlancer opened this issue 1 year ago • 1 comments

Problem Description

Stage::setAspectRatio() incorrect work for Android devices with AIR 33.1.1.926. This break many applications that used it. I found two problems around it.

Tested with AIR 33.1.1.926 with different AIR applications, Android devices and architectures. Same problem in all cases. It works fine with AIR 33.1.1.889 and earlier. There is no such issues with iOS.

Related issue: https://github.com/airsdk/Adobe-Runtime-Support/issues/2042

Steps to Reproduce

Note: application manifest have <autoOrients>true</autoOrients> and didn't have aspectRatio at all.

  1. Launch code below with any Android device that allows you to rotate it (better to use phone/tablet). It just show red rectangle in landscape orientation (caused by stage.setAspectRatio(StageAspectRatio.LANDSCAPE)).
  2. Try to rotate your device upside-down (in landscape upside-down orientation). Application will not rotate (but it should) - bug 1.
  3. Click anywhere on stage (to call stage.setAspectRatio(StageAspectRatio.ANY) and "unlock" rotation to any orientation).
  4. Rotate device in any other orientation.

Application example with sources attached. set_aspect_ratio_bug.zip

package {
	import flash.display.Sprite;
	import flash.display.StageAspectRatio;
	import flash.events.MouseEvent;
	
	public class SetAspectRatioBug extends Sprite {
		
		public function SetAspectRatioBug() {
			//Draw rectangle just to better demonstrate "rotaton" problem
			graphics.beginFill(0xff0000);
			graphics.drawRect(0, 0, 300, 50);
			graphics.endFill();
			
			stage.addEventListener(MouseEvent.CLICK, click);
			stage.setAspectRatio(StageAspectRatio.LANDSCAPE);
		}
	
		private function click(e:MouseEvent):void {
			stage.setAspectRatio(StageAspectRatio.ANY);
			//stage.autoOrients = true;//Uncomment with line to workaround
		}
	}
}

Actual Result: Application will not rotate - bug 2.

Expected Result: Application will rotate as with AIR 33.1.1.889.

Known Workarounds

For bug 1 - none. May be write own native extension to control application orientation. For bug 2 - use stage.autoOrients = true after stage.setAspectRatio(StageAspectRatio.ANY). You can see this commented line in code above.

itlancer avatar Aug 03 '22 11:08 itlancer

FYI we have a fix for this one now in the updated release: https://airsdk.harman.com/download

ajwfrost avatar Aug 05 '22 05:08 ajwfrost

Fixed with latest AIR 33.1.1.929. Thanks!

itlancer avatar Aug 25 '22 09:08 itlancer