OSDN Git Service

Merge "Increase post launch idle timeout to 60 secs" into nyc-dev
authorGopinath Elanchezhian <gelanchezhian@google.com>
Fri, 1 Apr 2016 18:37:22 +0000 (18:37 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 1 Apr 2016 18:37:23 +0000 (18:37 +0000)
1  2 
tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java

@@@ -62,7 -62,7 +62,7 @@@ public class AppLaunch extends Instrume
      private static final String KEY_REQUIRED_ACCOUNTS = "required_accounts";
      private static final String WEARABLE_ACTION_GOOGLE =
              "com.google.android.wearable.action.GOOGLE";
-     private static final int INITIAL_LAUNCH_IDLE_TIMEOUT = 7500; //7.5s to allow app to idle
+     private static final int INITIAL_LAUNCH_IDLE_TIMEOUT = 60000; //60s to allow app to idle
      private static final int POST_LAUNCH_IDLE_TIMEOUT = 750; //750ms idle for non initial launches
      private static final int BETWEEN_LAUNCH_SLEEP_TIMEOUT = 2000; //2s between launching apps
  
          for (String pair : appNames) {
              String[] parts = pair.split("\\^");
              if (parts.length != 2) {
 -                Log.e(TAG, "The apps key is incorectly formatted");
 +                Log.e(TAG, "The apps key is incorrectly formatted");
                  fail();
              }
  
          }
      }
  
 +    private boolean hasLeanback(Context context) {
 +        return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
 +    }
 +
      private void createMappings() {
          mNameToIntent = new LinkedHashMap<String, Intent>();
          mNameToProcess = new LinkedHashMap<String, String>();
          PackageManager pm = getInstrumentation().getContext()
                  .getPackageManager();
          Intent intentToResolve = new Intent(Intent.ACTION_MAIN);
 -        intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER);
 +        intentToResolve.addCategory(hasLeanback(getInstrumentation().getContext()) ?
 +                Intent.CATEGORY_LEANBACK_LAUNCHER :
 +                Intent.CATEGORY_LAUNCHER);
          List<ResolveInfo> ris = pm.queryIntentActivities(intentToResolve, 0);
          resolveLoop(ris, intentToResolve, pm);
 +        // For Wear
          intentToResolve = new Intent(WEARABLE_ACTION_GOOGLE);
          ris = pm.queryIntentActivities(intentToResolve, 0);
          resolveLoop(ris, intentToResolve, pm);
          // report error if any of the following is true:
          // * launch thread is alive
          // * result is not null, but:
 -        //   * result is not START_SUCESS
 +        //   * result is not START_SUCCESS
          //   * or in case of no force stop, result is not TASK_TO_FRONT either
          if (t.isAlive() || (result != null
                  && ((result.result != ActivityManager.START_SUCCESS)