-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2267 from android/axt_2024_05_14_stable_release_b…
…ranch_in_progress Cherry pick 'Fix ActivityInvoker$-CC class not found errors' to axt_2024_05_14_stable_release_branch
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
runner/monitor/java/androidx/test/internal/platform/app/ActivityInvokerDesugar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rule androidx.test.internal.platform.app.ActivityInvokerDesugar androidx.test.internal.platform.app.ActivityInvoker$-CC |