Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcd0b05d authored by Joshua Schwarz's avatar Joshua Schwarz Committed by Android (Google) Code Review
Browse files

Merge "Add Google Now intent so that it is discoverable to AppLaunch metrics." into cw-e-dev

parents dfd4b8b2 349537b7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ public class AppLaunch extends InstrumentationTestCase {
    // optional parameter: comma separated list of required account types before proceeding
    // with the app launch
    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 POST_LAUNCH_IDLE_TIMEOUT = 750; //750ms idle for non initial launches
    private static final int BETWEEN_LAUNCH_SLEEP_TIMEOUT = 2000; //2s between launching apps
@@ -183,6 +185,13 @@ public class AppLaunch extends InstrumentationTestCase {
        Intent intentToResolve = new Intent(Intent.ACTION_MAIN);
        intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER);
        List<ResolveInfo> ris = pm.queryIntentActivities(intentToResolve, 0);
        resolveLoop(ris, intentToResolve, pm);
        intentToResolve = new Intent(WEARABLE_ACTION_GOOGLE);
        ris = pm.queryIntentActivities(intentToResolve, 0);
        resolveLoop(ris, intentToResolve, pm);
    }

    private void resolveLoop(List<ResolveInfo> ris, Intent intentToResolve, PackageManager pm) {
        if (ris == null || ris.isEmpty()) {
            Log.i(TAG, "Could not find any apps");
        } else {