OSDN Git Service

freeze screen rotation during memory and app launch test
authorGuang Zhu <guangzhu@google.com>
Fri, 8 Aug 2014 18:30:21 +0000 (11:30 -0700)
committerThe Android Automerger <android-build@android.com>
Fri, 8 Aug 2014 20:08:20 +0000 (13:08 -0700)
Change-Id: I2a039be383562019a0af9470c5053cd3cb1e6142

tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
tests/MemoryUsage/src/com/android/tests/memoryusage/MemoryUsageTest.java

index dfb8070..a209d6c 100644 (file)
@@ -22,6 +22,7 @@ import android.app.ActivityManager.ProcessErrorStateInfo;
 import android.app.ActivityManagerNative;
 import android.app.IActivityManager;
 import android.app.IActivityManager.WaitResult;
+import android.app.UiAutomation;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -72,6 +73,18 @@ public class AppLaunch extends InstrumentationTestCase {
     private Bundle mResult = new Bundle();
     private Set<String> mRequiredAccounts;
 
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        getInstrumentation().getUiAutomation().setRotation(UiAutomation.ROTATION_FREEZE_0);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        getInstrumentation().getUiAutomation().setRotation(UiAutomation.ROTATION_UNFREEZE);
+        super.tearDown();
+    }
+
     public void testMeasureStartUpTime() throws RemoteException, NameNotFoundException {
         InstrumentationTestRunner instrumentation =
                 (InstrumentationTestRunner)getInstrumentation();
index 051ed0e..f582a91 100644 (file)
@@ -20,6 +20,7 @@ import android.app.ActivityManager.ProcessErrorStateInfo;
 import android.app.ActivityManager.RunningAppProcessInfo;
 import android.app.ActivityManagerNative;
 import android.app.IActivityManager;
+import android.app.UiAutomation;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -67,6 +68,18 @@ public class MemoryUsageTest extends InstrumentationTestCase {
     private Set<String> mPersistentProcesses;
     private IActivityManager mAm;
 
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        getInstrumentation().getUiAutomation().setRotation(UiAutomation.ROTATION_FREEZE_0);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        getInstrumentation().getUiAutomation().setRotation(UiAutomation.ROTATION_UNFREEZE);
+        super.tearDown();
+    }
+
     public void testMemory() {
         MemoryUsageInstrumentation instrumentation =
                 (MemoryUsageInstrumentation) getInstrumentation();