ActivityFilter

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(componentName: ComponentName, intentAction: String?)

Constructs a new ActivityFilter using a ComponentName and an Intent action.

Public functions

open operator Boolean
equals(other: Any?)
open Int
Boolean

Returns true if the ActivityFilter matches this Activity.

Boolean

Returns true if the ActivityFilter matches this Intent.

open String

Public properties

ComponentName

ComponentName that the ActivityFilter will use to match Activity and Intent.

String?

Action used for activity launch intent.

Public constructors

ActivityFilter

Added in 1.0.0
ActivityFilter(componentName: ComponentName, intentAction: String?)

Constructs a new ActivityFilter using a ComponentName and an Intent action.

Parameters
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

  • package/*

  • package/suffix.*

  • */*

intentAction: String?

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.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

matchesActivity

Added in 1.0.0
fun matchesActivity(activity: Activity): Boolean

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.

Parameters
activity: Activity

the Activity to test against.

matchesIntent

Added in 1.0.0
fun matchesIntent(intent: Intent): Boolean

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.

Parameters
intent: Intent

the Intent to test against.

toString

open fun toString(): String

Public properties

componentName

Added in 1.0.0
val componentNameComponentName

ComponentName that the ActivityFilter will use to match Activity and Intent.

intentAction

Added in 1.0.0
val intentActionString?

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.