public final class

ActivityInvokerDesugar

extends java.lang.Object

 java.lang.Object

↳androidx.test.internal.platform.app.ActivityInvokerDesugar

Gradle dependencies

compile group: 'androidx.test', name: 'monitor', version: '1.7.2'

  • groupId: androidx.test
  • artifactId: monitor
  • version: 1.7.2

Artifact androidx.test:monitor:1.7.2 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test:monitor com.android.support.test:monitor

Overview

Handles default implementation for ActivityInvoker#getIntentForActivity

See the ActivityInvoker$$CC javadoc for prior history.

Starting in androidx.test:monitor:1.6.X, a new version of the desugar tooling was used that generated a ActivityInvoker$-CC class. Class names with hyphens are rejected by javac, so we cannot directly declare a ActivityInvoker$-CC class here. So instead we use a placeholder name, and use jarjar to rename the class after the javac step.

Summary

Methods
public static Intent$default$getIntentForActivity(ActivityInvoker invoker, java.lang.Class<Activity> activityClass)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static Intent $default$getIntentForActivity(ActivityInvoker invoker, java.lang.Class<Activity> activityClass)

Source

package androidx.test.internal.platform.app;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;

/**
 * Handles default implementation for ActivityInvoker#getIntentForActivity
 *
 * <p> See the {@link ActivityInvoker$$CC} javadoc for prior history.
 *
 * <p> Starting in androidx.test:monitor:1.6.X, a new version of the desugar tooling was used
 * that generated a ActivityInvoker$-CC class. Class names with hyphens are rejected by javac,
 * so we cannot directly declare a ActivityInvoker$-CC class here. So instead we use a
 * placeholder name, and use jarjar to rename the class after the javac step.
 *
 * @hide
 */
@RestrictTo(Scope.LIBRARY_GROUP)
public final class ActivityInvokerDesugar {

  private ActivityInvokerDesugar() {}

  public static Intent $default$getIntentForActivity(ActivityInvoker invoker,
            Class<? extends Activity> activityClass) {
    Intent intent =
        Intent.makeMainActivity(
            new ComponentName(getInstrumentation().getTargetContext(), activityClass));
    if (getInstrumentation().getTargetContext().getPackageManager().resolveActivity(intent, 0)
        != null) {
      return intent;
    }
    return Intent.makeMainActivity(
        new ComponentName(getInstrumentation().getContext(), activityClass));
  }
}