summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2012-12-04 16:35:09 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-12-04 16:35:09 -0800
commit32ec47c1b15b5a9c8f8d9e9f324bb6fe353119fe (patch)
tree16f619dd80143c45e8c2e4f54d3186b6d734f732 /tests
parentf54d82c810c14ef4d105c2b015d1277969f33fcd (diff)
parent63cc22a5c393fec725d271f5a7d82fb2fe05647f (diff)
downloadframeworks_base-32ec47c1b15b5a9c8f8d9e9f324bb6fe353119fe.zip
frameworks_base-32ec47c1b15b5a9c8f8d9e9f324bb6fe353119fe.tar.gz
frameworks_base-32ec47c1b15b5a9c8f8d9e9f324bb6fe353119fe.tar.bz2
am 63cc22a5: am 4eab3d88: Merge "more app launch test tweaks" into jb-mr1.1-dev
* commit '63cc22a5c393fec725d271f5a7d82fb2fe05647f': more app launch test tweaks
Diffstat (limited to 'tests')
-rw-r--r--tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index af74da2..e2cb65d 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -17,9 +17,9 @@ package com.android.tests.applaunch;
import android.app.ActivityManager;
import android.app.ActivityManager.ProcessErrorStateInfo;
-import android.app.IActivityManager.WaitResult;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
+import android.app.IActivityManager.WaitResult;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -70,7 +70,9 @@ public class AppLaunch extends InstrumentationTestCase {
for (String app : mNameToResultKey.keySet()) {
try {
startApp(app, results);
- closeApp();
+ sleep(750);
+ closeApp(app);
+ sleep(2000);
} catch (NameNotFoundException e) {
Log.i(TAG, "Application " + app + " not found");
}
@@ -147,16 +149,23 @@ public class AppLaunch extends InstrumentationTestCase {
return;
}
results.putString(mNameToResultKey.get(appName), String.valueOf(result.thisTime));
- sleep(1000);
}
- private void closeApp() {
+ private void closeApp(String appName) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
getInstrumentation().getContext().startActivity(homeIntent);
- sleep(1000);
+ Intent startIntent = mNameToIntent.get(appName);
+ if (startIntent != null) {
+ String packageName = startIntent.getComponent().getPackageName();
+ try {
+ mAm.forceStopPackage(packageName, UserHandle.USER_CURRENT);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error closing app", e);
+ }
+ }
}
private void sleep(int time) {