ActivityFilter
public final class ActivityFilter
Filter for ActivityRule and SplitPlaceholderRule that checks for component name match when a new activity is started. If the filter matches the started activity Intent, the activity will then apply the rule based on the match result. This filter allows a wildcard symbol in the end or instead of the package name, and a wildcard symbol in the end or instead of the class name.
Summary
Public constructors |
|---|
ActivityFilter(@NonNull ComponentName componentName, String intentAction)Constructs a new |
Public methods |
|
|---|---|
boolean |
|
final @NonNull ComponentName |
|
final String |
Action used for activity launch intent. |
int |
hashCode() |
final boolean |
matchesActivity(@NonNull Activity activity)Returns |
final boolean |
matchesIntent(@NonNull Intent intent)Returns |
@NonNull String |
toString() |
Public constructors
ActivityFilter
public ActivityFilter(@NonNull ComponentName componentName, String intentAction)
Constructs a new ActivityFilter using a ComponentName and an Intent action.
| Parameters | |
|---|---|
@NonNull ComponentName componentName |
Component name in the intent for the activity. Must be non-empty. Can contain a single wildcard at the end. Supported formats: - package/class - |
String intentAction |
Action used for activity launch intent. If it is not |
Public methods
getComponentName
public final @NonNull ComponentName getComponentName()
ComponentName that the ActivityFilter will use to match Activity and Intent.
getIntentAction
public final String getIntentAction()
Action used for activity launch intent.
If it is not null, the ActivityFilter will check the activity Intent.getAction besides the component name. If it is null, Intent.getAction will be ignored.
matchesActivity
public final boolean matchesActivity(@NonNull Activity activity)
Returns true if the ActivityFilter matches this Activity. If the ActivityFilter is created with an intent action, the filter will also compare it with Intent.getAction of Activity.getIntent.
matchesIntent
public final boolean matchesIntent(@NonNull Intent intent)
Returns true if the ActivityFilter matches this Intent. If the ActivityFilter is created with an intent action, the filter will also compare it with Intent.getAction.