|
1 |
| -// flag values from https://developer.android.com/reference/android/content/Intent.html |
| 1 | +/// Special flags that can be set on an intent to control how it is handled. |
| 2 | +/// |
| 3 | +/// See |
| 4 | +/// https://developer.android.com/reference/android/content/Intent.html#setFlags(int) |
| 5 | +/// for the official documentation on Intent flags. The constants here mirror |
| 6 | +/// the existing [android.content.Intent] ones. |
2 | 7 | class Flag {
|
| 8 | + /// Specifies how an activity should be launched. Generally set by the system |
| 9 | + /// in conjunction with SINGLE_TASK. |
| 10 | + /// |
| 11 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_BROUGHT_TO_FRONT. |
3 | 12 | static const int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 4194304;
|
| 13 | + |
| 14 | + /// Causes any existing tasks associated with the activity to be cleared. |
| 15 | + /// |
| 16 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TASK |
4 | 17 | static const int FLAG_ACTIVITY_CLEAR_TASK = 32768;
|
| 18 | + |
| 19 | + /// Closes any activities on top of this activity and brings it to the front, |
| 20 | + /// if it's currently running. |
| 21 | + /// |
| 22 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP |
5 | 23 | static const int FLAG_ACTIVITY_CLEAR_TOP = 67108864;
|
| 24 | + |
| 25 | + /// @deprecated Use [FLAG_ACTIVITY_NEW_DOCUMENT] instead when on API 21 or above. |
| 26 | + /// |
| 27 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET |
| 28 | + @deprecated |
6 | 29 | static const int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 524288;
|
| 30 | + |
| 31 | + /// Keeps the activity from being listed with other recently launched |
| 32 | + /// activities. |
| 33 | + /// |
| 34 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
7 | 35 | static const int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 8388608;
|
| 36 | + |
| 37 | + /// Forwards the result from this activity to the existing one. |
| 38 | + /// |
| 39 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_FORWARD_RESULT |
8 | 40 | static const int FLAG_ACTIVITY_FORWARD_RESULT = 33554432;
|
| 41 | + |
| 42 | + /// Generally set by the system if the activity is being launched from |
| 43 | + /// history. |
| 44 | + /// |
| 45 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY |
9 | 46 | static const int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 1048576;
|
| 47 | + |
| 48 | + /// Used in split-screen mode to set the launched activity adjacent to the |
| 49 | + /// launcher. |
| 50 | + /// |
| 51 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_LAUNCH_ADJACENT |
10 | 52 | static const int FLAG_ACTIVITY_LAUNCH_ADJACENT = 4096;
|
| 53 | + |
| 54 | + /// Used in split-screen mode to set the launched activity adjacent to the |
| 55 | + /// launcher. |
| 56 | + /// |
| 57 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_MATCH_EXTERNAL |
11 | 58 | static const int FLAG_ACTIVITY_MATCH_EXTERNAL = 2048;
|
| 59 | + |
| 60 | + /// Creates and launches the activity into a new task. Should always be |
| 61 | + /// combined with [FLAG_ACTIVITY_NEW_DOCUMENT] or [FLAG_ACTIVITY_NEW_TASK]. |
| 62 | + /// |
| 63 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_MULTIPLE_TASK. |
12 | 64 | static const int FLAG_ACTIVITY_MULTIPLE_TASK = 134217728;
|
| 65 | + |
| 66 | + /// Opens a document into a new task rooted in this activity. |
| 67 | + /// |
| 68 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_DOCUMENT. |
13 | 69 | static const int FLAG_ACTIVITY_NEW_DOCUMENT = 524288;
|
| 70 | + |
| 71 | + /// The launched activity starts a new task on the activity stack. |
| 72 | + /// |
| 73 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK. |
14 | 74 | static const int FLAG_ACTIVITY_NEW_TASK = 268435456;
|
| 75 | + |
| 76 | + /// Prevents the system from playing an activity transition animation when |
| 77 | + /// launching this. |
| 78 | + /// |
| 79 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_ANIMATION. |
15 | 80 | static const int FLAG_ACTIVITY_NO_ANIMATION = 65536;
|
| 81 | + |
| 82 | + /// Does not keep the launched activity in history. |
| 83 | + /// |
| 84 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY. |
16 | 85 | static const int FLAG_ACTIVITY_NO_HISTORY = 1073741824;
|
| 86 | + |
| 87 | + /// Prevents a typical callback from occuring when the activity is paused. |
| 88 | + /// |
| 89 | + /// https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_USER_ACTION |
17 | 90 | static const int FLAG_ACTIVITY_NO_USER_ACTION = 262144;
|
| 91 | + |
| 92 | + /// Uses the previous activity as top when applicable. |
| 93 | + /// |
| 94 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_PREVIOUS_IS_TOP. |
18 | 95 | static const int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 16777216;
|
| 96 | + |
| 97 | + /// Brings any already instances of this activity to the front. |
| 98 | + /// |
| 99 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT. |
19 | 100 | static const int FLAG_ACTIVITY_REORDER_TO_FRONT = 131072;
|
| 101 | + |
| 102 | + /// Launches the activity in a way that resets the task in some cases. |
| 103 | + /// |
| 104 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED. |
20 | 105 | static const int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 2097152;
|
| 106 | + |
| 107 | + /// Keeps an entry in recent tasks. Used with [FLAG_ACTIVITY_NEW_DOCUMENT]. |
| 108 | + /// |
| 109 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_RETAIN_IN_RECENTS. |
21 | 110 | static const int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 8192;
|
| 111 | + |
| 112 | + /// Will not re-launch the activity if it is already at the top of the history |
| 113 | + /// stack. |
| 114 | + /// |
| 115 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_SINGLE_TOP. |
22 | 116 | static const int FLAG_ACTIVITY_SINGLE_TOP = 536870912;
|
| 117 | + |
| 118 | + /// Places the activity on top of the home task. Must be used with |
| 119 | + /// [FLAG_ACTIVITY_NEW_TASK]. |
| 120 | + /// |
| 121 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_TASK_ON_HOME. |
23 | 122 | static const int FLAG_ACTIVITY_TASK_ON_HOME = 16384;
|
| 123 | + |
| 124 | + /// Prints debug logs while the intent is resolving. |
| 125 | + /// |
| 126 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_DEBUG_LOG_RESOLUTION. |
24 | 127 | static const int FLAG_DEBUG_LOG_RESOLUTION = 8;
|
| 128 | + |
| 129 | + /// Does not match to any stopped components. |
| 130 | + /// |
| 131 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_EXCLUDE_STOPPED_PACKAGES. |
25 | 132 | static const int FLAG_EXCLUDE_STOPPED_PACKAGES = 16;
|
| 133 | + |
| 134 | + /// Can be set by the caller to flag the intent as not being launched directly |
| 135 | + /// by the user. |
| 136 | + /// |
| 137 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_FROM_BACKGROUND. |
26 | 138 | static const int FLAG_FROM_BACKGROUND = 4;
|
| 139 | + |
| 140 | + /// Will persist the URI permision across device reboots. |
| 141 | + /// |
| 142 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PERSISTABLE_URI_PERMISSION. |
27 | 143 | static const int FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 64;
|
| 144 | + |
| 145 | + /// Applies the URI permission grant based on prefix matching. |
| 146 | + /// |
| 147 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PREFIX_URI_PERMISSION. |
28 | 148 | static const int FLAG_GRANT_PREFIX_URI_PERMISSION = 128;
|
| 149 | + |
| 150 | + /// Grants the intent listener permission to read extra data from the Intent's |
| 151 | + /// URI. |
| 152 | + /// |
| 153 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION. |
29 | 154 | static const int FLAG_GRANT_READ_URI_PERMISSION = 1;
|
| 155 | + |
| 156 | + /// Grants the intent listener permission to write extra data from the |
| 157 | + /// Intent's URI. |
| 158 | + /// |
| 159 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION. |
30 | 160 | static const int FLAG_GRANT_WRITE_URI_PERMISSION = 2;
|
| 161 | + |
| 162 | + /// Always matches stopped components. This is the default behavior. |
| 163 | + /// |
| 164 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_INCLUDE_STOPPED_PACKAGES. |
31 | 165 | static const int FLAG_INCLUDE_STOPPED_PACKAGES = 32;
|
| 166 | + |
| 167 | + /// Allows the listener to run at a high priority. |
| 168 | + /// |
| 169 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_FOREGROUND. |
32 | 170 | static const int FLAG_RECEIVER_FOREGROUND = 268435456;
|
| 171 | + |
| 172 | + /// Doesn't allow listeners to cancel the broadcast. |
| 173 | + /// |
| 174 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_NO_ABORT. |
33 | 175 | static const int FLAG_RECEIVER_NO_ABORT = 134217728;
|
| 176 | + |
| 177 | + /// Only allows registered receivers to listen for the intent. |
| 178 | + /// |
| 179 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_REGISTERED_ONLY. |
34 | 180 | static const int FLAG_RECEIVER_REGISTERED_ONLY = 1073741824;
|
| 181 | + |
| 182 | + /// Will drop any pending broadcasts of this intent in favor of the newest |
| 183 | + /// one. |
| 184 | + /// |
| 185 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_REPLACE_PENDING. |
35 | 186 | static const int FLAG_RECEIVER_REPLACE_PENDING = 536870912;
|
| 187 | + |
| 188 | + /// Instant Apps will be able to listen for the intent (not the default |
| 189 | + /// behavior). |
| 190 | + /// |
| 191 | + /// See https://developer.android.com/reference/android/content/Intent.html#FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS. |
36 | 192 | static const int FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 2097152;
|
37 | 193 | }
|
0 commit comments