mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	Add setScreenOrientation to BaseUiAutomation class
This allows workloads to be launched in a pre-determined orientation not the orientation of the physical device itself. Updated the productivity workloads to take advantage of this new facility.
This commit is contained in:
		| @@ -35,6 +35,7 @@ import com.android.uiautomator.testrunner.UiAutomatorTestCase; | ||||
| public class BaseUiAutomation extends UiAutomatorTestCase { | ||||
|  | ||||
|     public long waitTimeout = TimeUnit.SECONDS.toMillis(4); | ||||
|     public enum ScreenOrientation { RIGHT, NATURAL, LEFT }; | ||||
|  | ||||
|     public void sleep(int second) { | ||||
|         super.sleep(second * 1000); | ||||
| @@ -251,4 +252,24 @@ public class BaseUiAutomation extends UiAutomatorTestCase { | ||||
|  | ||||
|         view.performTwoPointerGesture(startPoint1, startPoint2, endPoint1, endPoint2, steps); | ||||
|     } | ||||
|  | ||||
|     public void setScreenOrientation(ScreenOrientation orientation) throws Exception { | ||||
|         switch (orientation) { | ||||
|             case RIGHT: | ||||
|                 getUiDevice().setOrientationRight(); | ||||
|                 break; | ||||
|             case NATURAL: | ||||
|                 getUiDevice().setOrientationNatural(); | ||||
|                 break; | ||||
|             case LEFT: | ||||
|                 getUiDevice().setOrientationLeft(); | ||||
|                 break; | ||||
|             default: | ||||
|                 throw new Exception("No orientation specified"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void unsetScreenOrientation() throws Exception { | ||||
|         getUiDevice().unfreezeRotation(); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user