Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package android.content.pm; |
| 18 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 19 | import android.annotation.IntDef; |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 20 | import android.annotation.TestApi; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 21 | import android.annotation.UnsupportedAppUsage; |
Aurimas Liutikas | 7f69533 | 2018-05-31 21:07:32 -0700 | [diff] [blame] | 22 | import android.content.ComponentName; |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 23 | import android.content.Intent; |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 24 | import android.content.res.Configuration; |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 25 | import android.content.res.Configuration.NativeConfig; |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 26 | import android.content.res.TypedArray; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | import android.os.Parcel; |
| 28 | import android.os.Parcelable; |
| 29 | import android.util.Printer; |
| 30 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 31 | import java.lang.annotation.Retention; |
| 32 | import java.lang.annotation.RetentionPolicy; |
| 33 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 34 | /** |
| 35 | * Information you can retrieve about a particular application |
| 36 | * activity or receiver. This corresponds to information collected |
| 37 | * from the AndroidManifest.xml's <activity> and |
| 38 | * <receiver> tags. |
| 39 | */ |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 40 | public class ActivityInfo extends ComponentInfo implements Parcelable { |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 41 | |
| 42 | // NOTE: When adding new data members be sure to update the copy-constructor, Parcel |
| 43 | // constructor, and writeToParcel. |
| 44 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | /** |
| 46 | * A style resource identifier (in the package's resources) of this |
| 47 | * activity's theme. From the "theme" attribute or, if not set, 0. |
| 48 | */ |
| 49 | public int theme; |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 50 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | /** |
| 52 | * Constant corresponding to <code>standard</code> in |
| 53 | * the {@link android.R.attr#launchMode} attribute. |
| 54 | */ |
| 55 | public static final int LAUNCH_MULTIPLE = 0; |
| 56 | /** |
| 57 | * Constant corresponding to <code>singleTop</code> in |
| 58 | * the {@link android.R.attr#launchMode} attribute. |
| 59 | */ |
| 60 | public static final int LAUNCH_SINGLE_TOP = 1; |
| 61 | /** |
| 62 | * Constant corresponding to <code>singleTask</code> in |
| 63 | * the {@link android.R.attr#launchMode} attribute. |
| 64 | */ |
| 65 | public static final int LAUNCH_SINGLE_TASK = 2; |
| 66 | /** |
| 67 | * Constant corresponding to <code>singleInstance</code> in |
| 68 | * the {@link android.R.attr#launchMode} attribute. |
| 69 | */ |
| 70 | public static final int LAUNCH_SINGLE_INSTANCE = 3; |
| 71 | /** |
| 72 | * The launch mode style requested by the activity. From the |
| 73 | * {@link android.R.attr#launchMode} attribute, one of |
| 74 | * {@link #LAUNCH_MULTIPLE}, |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 75 | * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 76 | * {@link #LAUNCH_SINGLE_INSTANCE}. |
| 77 | */ |
| 78 | public int launchMode; |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Constant corresponding to <code>none</code> in |
| 82 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 83 | */ |
| 84 | public static final int DOCUMENT_LAUNCH_NONE = 0; |
| 85 | /** |
| 86 | * Constant corresponding to <code>intoExisting</code> in |
| 87 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 88 | */ |
| 89 | public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; |
| 90 | /** |
| 91 | * Constant corresponding to <code>always</code> in |
| 92 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 93 | */ |
| 94 | public static final int DOCUMENT_LAUNCH_ALWAYS = 2; |
| 95 | /** |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 96 | * Constant corresponding to <code>never</code> in |
| 97 | * the {@link android.R.attr#documentLaunchMode} attribute. |
| 98 | */ |
| 99 | public static final int DOCUMENT_LAUNCH_NEVER = 3; |
| 100 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 101 | * The document launch mode style requested by the activity. From the |
| 102 | * {@link android.R.attr#documentLaunchMode} attribute, one of |
| 103 | * {@link #DOCUMENT_LAUNCH_NONE}, {@link #DOCUMENT_LAUNCH_INTO_EXISTING}, |
| 104 | * {@link #DOCUMENT_LAUNCH_ALWAYS}. |
| 105 | * |
| 106 | * <p>Modes DOCUMENT_LAUNCH_ALWAYS |
| 107 | * and DOCUMENT_LAUNCH_INTO_EXISTING are equivalent to {@link |
| 108 | * android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT |
| 109 | * Intent.FLAG_ACTIVITY_NEW_DOCUMENT} with and without {@link |
| 110 | * android.content.Intent#FLAG_ACTIVITY_MULTIPLE_TASK |
| 111 | * Intent.FLAG_ACTIVITY_MULTIPLE_TASK} respectively. |
| 112 | */ |
| 113 | public int documentLaunchMode; |
| 114 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 115 | /** |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 116 | * Constant corresponding to <code>persistRootOnly</code> in |
| 117 | * the {@link android.R.attr#persistableMode} attribute. |
| 118 | */ |
| 119 | public static final int PERSIST_ROOT_ONLY = 0; |
| 120 | /** |
| 121 | * Constant corresponding to <code>doNotPersist</code> in |
| 122 | * the {@link android.R.attr#persistableMode} attribute. |
| 123 | */ |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 124 | public static final int PERSIST_NEVER = 1; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 125 | /** |
| 126 | * Constant corresponding to <code>persistAcrossReboots</code> in |
| 127 | * the {@link android.R.attr#persistableMode} attribute. |
| 128 | */ |
| 129 | public static final int PERSIST_ACROSS_REBOOTS = 2; |
| 130 | /** |
| 131 | * Value indicating how this activity is to be persisted across |
| 132 | * reboots for restoring in the Recents list. |
| 133 | * {@link android.R.attr#persistableMode} |
| 134 | */ |
| 135 | public int persistableMode; |
| 136 | |
| 137 | /** |
Craig Mautner | ffcfcaa | 2014-06-05 09:54:38 -0700 | [diff] [blame] | 138 | * The maximum number of tasks rooted at this activity that can be in the recent task list. |
| 139 | * Refer to {@link android.R.attr#maxRecents}. |
| 140 | */ |
| 141 | public int maxRecents; |
| 142 | |
| 143 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 144 | * Optional name of a permission required to be able to access this |
| 145 | * Activity. From the "permission" attribute. |
| 146 | */ |
| 147 | public String permission; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 148 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 149 | /** |
| 150 | * The affinity this activity has for another task in the system. The |
| 151 | * string here is the name of the task, often the package name of the |
| 152 | * overall package. If null, the activity has no affinity. Set from the |
| 153 | * {@link android.R.attr#taskAffinity} attribute. |
| 154 | */ |
| 155 | public String taskAffinity; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 156 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 157 | /** |
| 158 | * If this is an activity alias, this is the real activity class to run |
| 159 | * for it. Otherwise, this is null. |
| 160 | */ |
| 161 | public String targetActivity; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 162 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | /** |
Todd Kennedy | 50d946c1 | 2017-03-17 13:55:38 -0700 | [diff] [blame] | 164 | * Token used to string together multiple events within a single launch action. |
| 165 | * @hide |
| 166 | */ |
| 167 | public String launchToken; |
| 168 | |
| 169 | /** |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 170 | * Activity can not be resized and always occupies the fullscreen area with all windows fully |
| 171 | * visible. |
| 172 | * @hide |
| 173 | */ |
| 174 | public static final int RESIZE_MODE_UNRESIZEABLE = 0; |
| 175 | /** |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 176 | * Activity didn't explicitly request to be resizeable, but we are making it resizeable because |
Wale Ogunwale | df241e9 | 2016-10-13 15:14:21 -0700 | [diff] [blame] | 177 | * of the SDK version it targets. Only affects apps with target SDK >= N where the app is |
| 178 | * implied to be resizeable if it doesn't explicitly set the attribute to any value. |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 179 | * @hide |
| 180 | */ |
| 181 | public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1; |
| 182 | /** |
| 183 | * Activity explicitly requested to be resizeable. |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 184 | * @hide |
| 185 | */ |
Steven Timotius | 4346f0a | 2017-09-12 11:07:21 -0700 | [diff] [blame] | 186 | @TestApi |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 187 | public static final int RESIZE_MODE_RESIZEABLE = 2; |
| 188 | /** |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 189 | * Activity is resizeable and supported picture-in-picture mode. This flag is now deprecated |
| 190 | * since activities do not need to be resizeable to support picture-in-picture. |
| 191 | * See {@link #FLAG_SUPPORTS_PICTURE_IN_PICTURE}. |
| 192 | * |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 193 | * @hide |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 194 | * @deprecated |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 195 | */ |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 196 | public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 197 | /** |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 198 | * Activity does not support resizing, but we are forcing it to be resizeable. Only affects |
Wale Ogunwale | df241e9 | 2016-10-13 15:14:21 -0700 | [diff] [blame] | 199 | * certain pre-N apps where we force them to be resizeable. |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 200 | * @hide |
| 201 | */ |
| 202 | public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4; |
| 203 | /** |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 204 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 205 | * as the size remains landscape. |
| 206 | * @hide |
| 207 | */ |
| 208 | public static final int RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY = 5; |
| 209 | /** |
| 210 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 211 | * as the size remains portrait. |
| 212 | * @hide |
| 213 | */ |
| 214 | public static final int RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY = 6; |
| 215 | /** |
| 216 | * Activity does not support resizing, but we are forcing it to be resizeable as long |
| 217 | * as the bounds remain in the same orientation as they are. |
| 218 | * @hide |
| 219 | */ |
| 220 | public static final int RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION = 7; |
| 221 | /** |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 222 | * Value indicating if the resizing mode the activity supports. |
| 223 | * See {@link android.R.attr#resizeableActivity}. |
| 224 | * @hide |
| 225 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 226 | @UnsupportedAppUsage |
Wale Ogunwale | 8f6c925 | 2016-04-29 16:46:47 -0700 | [diff] [blame] | 227 | public int resizeMode = RESIZE_MODE_RESIZEABLE; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 228 | |
| 229 | /** |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 230 | * Value indicating the maximum aspect ratio the activity supports. |
| 231 | * <p> |
| 232 | * 0 means unset. |
| 233 | * @See {@link android.R.attr#maxAspectRatio}. |
| 234 | * @hide |
| 235 | */ |
| 236 | public float maxAspectRatio; |
| 237 | |
| 238 | /** |
Adrian Roos | 917791e | 2018-11-28 16:30:44 +0100 | [diff] [blame] | 239 | * Value indicating the minimum aspect ratio the activity supports. |
| 240 | * <p> |
| 241 | * 0 means unset. |
| 242 | * @See {@link android.R.attr#minAspectRatio}. |
| 243 | * @hide |
| 244 | */ |
| 245 | public float minAspectRatio; |
| 246 | |
| 247 | /** |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 248 | * Name of the VrListenerService component to run for this activity. |
| 249 | * @see android.R.attr#enableVrMode |
| 250 | * @hide |
| 251 | */ |
| 252 | public String requestedVrComponent; |
| 253 | |
| 254 | /** |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 255 | * Value for {@link #colorMode} indicating that the activity should use the |
| 256 | * default color mode (sRGB, low dynamic range). |
| 257 | * |
| 258 | * @see android.R.attr#colorMode |
| 259 | */ |
| 260 | public static final int COLOR_MODE_DEFAULT = 0; |
| 261 | /** |
| 262 | * Value of {@link #colorMode} indicating that the activity should use a |
| 263 | * wide color gamut if the presentation display supports it. |
| 264 | * |
| 265 | * @see android.R.attr#colorMode |
| 266 | */ |
| 267 | public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1; |
| 268 | /** |
| 269 | * Value of {@link #colorMode} indicating that the activity should use a |
| 270 | * high dynamic range if the presentation display supports it. |
| 271 | * |
| 272 | * @see android.R.attr#colorMode |
| 273 | */ |
| 274 | public static final int COLOR_MODE_HDR = 2; |
| 275 | |
| 276 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 277 | @IntDef(prefix = { "COLOR_MODE_" }, value = { |
| 278 | COLOR_MODE_DEFAULT, |
| 279 | COLOR_MODE_WIDE_COLOR_GAMUT, |
| 280 | COLOR_MODE_HDR, |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 281 | }) |
| 282 | @Retention(RetentionPolicy.SOURCE) |
| 283 | public @interface ColorMode {} |
| 284 | |
| 285 | /** |
| 286 | * The color mode requested by this activity. The target display may not be |
| 287 | * able to honor the request. |
| 288 | */ |
| 289 | @ColorMode |
| 290 | public int colorMode = COLOR_MODE_DEFAULT; |
| 291 | |
| 292 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 293 | * Bit in {@link #flags} indicating whether this activity is able to |
| 294 | * run in multiple processes. If |
| 295 | * true, the system may instantiate it in the some process as the |
| 296 | * process starting it in order to conserve resources. If false, the |
| 297 | * default, it always runs in {@link #processName}. Set from the |
| 298 | * {@link android.R.attr#multiprocess} attribute. |
| 299 | */ |
| 300 | public static final int FLAG_MULTIPROCESS = 0x0001; |
| 301 | /** |
| 302 | * Bit in {@link #flags} indicating that, when the activity's task is |
| 303 | * relaunched from home, this activity should be finished. |
| 304 | * Set from the |
| 305 | * {@link android.R.attr#finishOnTaskLaunch} attribute. |
| 306 | */ |
| 307 | public static final int FLAG_FINISH_ON_TASK_LAUNCH = 0x0002; |
| 308 | /** |
| 309 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 310 | * of a task, that task's stack should be cleared each time the user |
| 311 | * re-launches it from home. As a result, the user will always |
| 312 | * return to the original activity at the top of the task. |
| 313 | * This flag only applies to activities that |
| 314 | * are used to start the root of a new task. Set from the |
| 315 | * {@link android.R.attr#clearTaskOnLaunch} attribute. |
| 316 | */ |
| 317 | public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 0x0004; |
| 318 | /** |
| 319 | * Bit in {@link #flags} indicating that, when the activity is the root |
| 320 | * of a task, that task's stack should never be cleared when it is |
| 321 | * relaunched from home. Set from the |
| 322 | * {@link android.R.attr#alwaysRetainTaskState} attribute. |
| 323 | */ |
| 324 | public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 0x0008; |
| 325 | /** |
| 326 | * Bit in {@link #flags} indicating that the activity's state |
| 327 | * is not required to be saved, so that if there is a failure the |
| 328 | * activity will not be removed from the activity stack. Set from the |
| 329 | * {@link android.R.attr#stateNotNeeded} attribute. |
| 330 | */ |
| 331 | public static final int FLAG_STATE_NOT_NEEDED = 0x0010; |
| 332 | /** |
| 333 | * Bit in {@link #flags} that indicates that the activity should not |
| 334 | * appear in the list of recently launched activities. Set from the |
| 335 | * {@link android.R.attr#excludeFromRecents} attribute. |
| 336 | */ |
| 337 | public static final int FLAG_EXCLUDE_FROM_RECENTS = 0x0020; |
| 338 | /** |
| 339 | * Bit in {@link #flags} that indicates that the activity can be moved |
| 340 | * between tasks based on its task affinity. Set from the |
| 341 | * {@link android.R.attr#allowTaskReparenting} attribute. |
| 342 | */ |
| 343 | public static final int FLAG_ALLOW_TASK_REPARENTING = 0x0040; |
| 344 | /** |
| 345 | * Bit in {@link #flags} indicating that, when the user navigates away |
| 346 | * from an activity, it should be finished. |
| 347 | * Set from the |
| 348 | * {@link android.R.attr#noHistory} attribute. |
| 349 | */ |
| 350 | public static final int FLAG_NO_HISTORY = 0x0080; |
| 351 | /** |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 352 | * Bit in {@link #flags} indicating that, when a request to close system |
| 353 | * windows happens, this activity is finished. |
| 354 | * Set from the |
| 355 | * {@link android.R.attr#finishOnCloseSystemDialogs} attribute. |
| 356 | */ |
| 357 | public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100; |
Dianne Hackborn | 327fbd2 | 2011-01-17 14:38:50 -0800 | [diff] [blame] | 358 | /** |
| 359 | * Value for {@link #flags}: true when the application's rendering should |
| 360 | * be hardware accelerated. |
| 361 | */ |
| 362 | public static final int FLAG_HARDWARE_ACCELERATED = 0x0200; |
| 363 | /** |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 364 | * Value for {@link #flags}: true when the application can be displayed for all users |
| 365 | * regardless of if the user of the application is the current user. Set from the |
| 366 | * {@link android.R.attr#showForAllUsers} attribute. |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 367 | * @hide |
| 368 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 369 | @UnsupportedAppUsage |
Wale Ogunwale | 6dfdfd6 | 2015-04-15 12:01:38 -0700 | [diff] [blame] | 370 | public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400; |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 371 | /** |
John Spurlock | 322d771 | 2013-09-05 02:39:46 +0000 | [diff] [blame] | 372 | * Bit in {@link #flags} corresponding to an immersive activity |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 373 | * that wishes not to be interrupted by notifications. |
| 374 | * Applications that hide the system notification bar with |
| 375 | * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} |
| 376 | * may still be interrupted by high-priority notifications; for example, an |
| 377 | * incoming phone call may use |
Daniel Sandler | 8091ca5 | 2010-06-22 13:58:46 -0400 | [diff] [blame] | 378 | * {@link android.app.Notification#fullScreenIntent fullScreenIntent} |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 379 | * to present a full-screen in-call activity to the user, pausing the |
| 380 | * current activity as a side-effect. An activity with |
| 381 | * {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the |
| 382 | * notification may be shown in some other way (such as a small floating |
| 383 | * "toast" window). |
Christopher Tate | 73c2aee | 2012-03-15 16:27:14 -0700 | [diff] [blame] | 384 | * |
| 385 | * Note that this flag will always reflect the Activity's |
| 386 | * <code>android:immersive</code> manifest definition, even if the Activity's |
| 387 | * immersive state is changed at runtime via |
| 388 | * {@link android.app.Activity#setImmersive(boolean)}. |
| 389 | * |
| 390 | * @see android.app.Notification#FLAG_HIGH_PRIORITY |
| 391 | * @see android.app.Activity#setImmersive(boolean) |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 392 | */ |
Craig Mautner | 5962b12 | 2012-10-05 14:45:52 -0700 | [diff] [blame] | 393 | public static final int FLAG_IMMERSIVE = 0x0800; |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 394 | /** |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 395 | * Bit in {@link #flags}: If set, a task rooted at this activity will have its |
| 396 | * baseIntent replaced by the activity immediately above this. Each activity may further |
| 397 | * relinquish its identity to the activity above it using this flag. Set from the |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 398 | * {@link android.R.attr#relinquishTaskIdentity} attribute. |
Craig Mautner | 9d4e9bc | 2014-06-18 18:34:56 -0700 | [diff] [blame] | 399 | */ |
| 400 | public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000; |
| 401 | /** |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 402 | * Bit in {@link #flags} indicating that tasks started with this activity are to be |
| 403 | * removed from the recent list of tasks when the last activity in the task is finished. |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 404 | * Corresponds to {@link android.R.attr#autoRemoveFromRecents} |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 405 | */ |
| 406 | public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000; |
| 407 | /** |
Dianne Hackborn | a4e102e | 2014-09-04 22:52:27 -0700 | [diff] [blame] | 408 | * Bit in {@link #flags} indicating that this activity can start is creation/resume |
| 409 | * while the previous activity is still pausing. Corresponds to |
| 410 | * {@link android.R.attr#resumeWhilePausing} |
| 411 | */ |
| 412 | public static final int FLAG_RESUME_WHILE_PAUSING = 0x4000; |
| 413 | /** |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 414 | * Bit in {@link #flags} indicating that this activity should be run with VR mode enabled. |
| 415 | * |
Aurimas Liutikas | 7f69533 | 2018-05-31 21:07:32 -0700 | [diff] [blame] | 416 | * @see android.app.Activity#setVrModeEnabled(boolean, ComponentName) |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 417 | */ |
| 418 | public static final int FLAG_ENABLE_VR_MODE = 0x8000; |
Wale Ogunwale | 6cae765 | 2015-12-26 07:36:26 -0800 | [diff] [blame] | 419 | |
| 420 | /** |
Wale Ogunwale | 6cae765 | 2015-12-26 07:36:26 -0800 | [diff] [blame] | 421 | * Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is |
| 422 | * in a task/stack whose activities are normally not focusable. |
| 423 | * See android.R.attr#alwaysFocusable. |
| 424 | * @hide |
| 425 | */ |
| 426 | public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000; |
| 427 | |
Ruben Brunk | dd18a0b | 2015-12-04 16:16:31 -0800 | [diff] [blame] | 428 | /** |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 429 | * Bit in {@link #flags} indicating if the activity is visible to instant |
| 430 | * applications. The activity is visible if it's either implicitly or |
| 431 | * explicitly exposed. |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 432 | * @hide |
| 433 | */ |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 434 | public static final int FLAG_VISIBLE_TO_INSTANT_APP = 0x100000; |
| 435 | |
| 436 | /** |
| 437 | * Bit in {@link #flags} indicating if the activity is implicitly visible |
| 438 | * to instant applications. Implicitly visible activities are those that |
| 439 | * implement certain intent-filters: |
| 440 | * <ul> |
| 441 | * <li>action {@link Intent#CATEGORY_BROWSABLE}</li> |
| 442 | * <li>action {@link Intent#ACTION_SEND}</li> |
| 443 | * <li>action {@link Intent#ACTION_SENDTO}</li> |
| 444 | * <li>action {@link Intent#ACTION_SEND_MULTIPLE}</li> |
| 445 | * </ul> |
| 446 | * @hide |
| 447 | */ |
| 448 | public static final int FLAG_IMPLICITLY_VISIBLE_TO_INSTANT_APP = 0x200000; |
Todd Kennedy | 7bc3a70 | 2016-12-08 14:54:48 -0800 | [diff] [blame] | 449 | |
| 450 | /** |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 451 | * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode. |
| 452 | * See {@link android.R.attr#supportsPictureInPicture}. |
| 453 | * @hide |
| 454 | */ |
Todd Kennedy | c05f5d1 | 2017-04-25 11:11:40 -0700 | [diff] [blame] | 455 | public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000; |
chaviw | 59b9885 | 2017-06-13 12:05:44 -0700 | [diff] [blame] | 456 | |
| 457 | /** |
| 458 | * Bit in {@link #flags} indicating if the activity should be shown when locked. |
| 459 | * See {@link android.R.attr#showWhenLocked} |
| 460 | * @hide |
| 461 | */ |
| 462 | public static final int FLAG_SHOW_WHEN_LOCKED = 0x800000; |
| 463 | |
| 464 | /** |
| 465 | * Bit in {@link #flags} indicating if the screen should turn on when starting the activity. |
| 466 | * See {@link android.R.attr#turnScreenOn} |
| 467 | * @hide |
| 468 | */ |
| 469 | public static final int FLAG_TURN_SCREEN_ON = 0x1000000; |
| 470 | |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 471 | /** |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 472 | * @hide Bit in {@link #flags}: If set, this component will only be seen |
Fyodor Kupolov | 4f5de34 | 2015-08-25 10:08:45 -0700 | [diff] [blame] | 473 | * by the system user. Only works with broadcast receivers. Set from the |
| 474 | * android.R.attr#systemUserOnly attribute. |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 475 | */ |
Fyodor Kupolov | 4f5de34 | 2015-08-25 10:08:45 -0700 | [diff] [blame] | 476 | public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000; |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 477 | /** |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 478 | * Bit in {@link #flags}: If set, a single instance of the receiver will |
| 479 | * run for all users on the device. Set from the |
| 480 | * {@link android.R.attr#singleUser} attribute. Note that this flag is |
Dianne Hackborn | d4ac8d7 | 2012-09-27 23:20:10 -0700 | [diff] [blame] | 481 | * only relevant for ActivityInfo structures that are describing receiver |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 482 | * components; it is not applied to activities. |
| 483 | */ |
| 484 | public static final int FLAG_SINGLE_USER = 0x40000000; |
| 485 | /** |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 486 | * @hide Bit in {@link #flags}: If set, this activity may be launched into an |
| 487 | * owned ActivityContainer such as that within an ActivityView. If not set and |
Svet Ganov | f2acc54 | 2015-11-06 09:02:00 -0800 | [diff] [blame] | 488 | * this activity is launched into such a container a SecurityException will be |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 489 | * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. |
| 490 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 491 | @UnsupportedAppUsage |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 492 | public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; |
chaviw | 59b9885 | 2017-06-13 12:05:44 -0700 | [diff] [blame] | 493 | |
Craig Mautner | ffd14a1 | 2014-04-23 21:38:50 -0700 | [diff] [blame] | 494 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 495 | * Options that have been set in the activity declaration in the |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 496 | * manifest. |
| 497 | * These include: |
| 498 | * {@link #FLAG_MULTIPROCESS}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 499 | * {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH}, |
| 500 | * {@link #FLAG_ALWAYS_RETAIN_TASK_STATE}, |
| 501 | * {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS}, |
Dianne Hackborn | ffa4248 | 2009-09-23 22:20:11 -0700 | [diff] [blame] | 502 | * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY}, |
Daniel Sandler | 613dde4 | 2010-06-21 13:46:39 -0400 | [diff] [blame] | 503 | * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}, |
Dianne Hackborn | 7d19e02 | 2012-08-07 19:12:33 -0700 | [diff] [blame] | 504 | * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 505 | */ |
| 506 | public int flags; |
| 507 | |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 508 | /** |
| 509 | * Bit in {@link #privateFlags} indicating if the activity should be shown when locked in case |
| 510 | * an activity behind this can also be shown when locked. |
wilsonshih | d9841fb | 2019-01-23 16:36:17 +0800 | [diff] [blame] | 511 | * See {@link android.R.attr#inheritShowWhenLocked}. |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 512 | * @hide |
| 513 | */ |
| 514 | public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1; |
| 515 | |
| 516 | /** |
| 517 | * Options that have been set in the activity declaration in the manifest. |
| 518 | * These include: |
| 519 | * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED}. |
| 520 | * @hide |
| 521 | */ |
| 522 | public int privateFlags; |
| 523 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 524 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 525 | @IntDef(prefix = { "SCREEN_ORIENTATION_" }, value = { |
Wale Ogunwale | 5136249 | 2016-09-08 17:49:17 -0700 | [diff] [blame] | 526 | SCREEN_ORIENTATION_UNSET, |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 527 | SCREEN_ORIENTATION_UNSPECIFIED, |
| 528 | SCREEN_ORIENTATION_LANDSCAPE, |
| 529 | SCREEN_ORIENTATION_PORTRAIT, |
| 530 | SCREEN_ORIENTATION_USER, |
| 531 | SCREEN_ORIENTATION_BEHIND, |
| 532 | SCREEN_ORIENTATION_SENSOR, |
| 533 | SCREEN_ORIENTATION_NOSENSOR, |
| 534 | SCREEN_ORIENTATION_SENSOR_LANDSCAPE, |
| 535 | SCREEN_ORIENTATION_SENSOR_PORTRAIT, |
| 536 | SCREEN_ORIENTATION_REVERSE_LANDSCAPE, |
| 537 | SCREEN_ORIENTATION_REVERSE_PORTRAIT, |
| 538 | SCREEN_ORIENTATION_FULL_SENSOR, |
| 539 | SCREEN_ORIENTATION_USER_LANDSCAPE, |
| 540 | SCREEN_ORIENTATION_USER_PORTRAIT, |
| 541 | SCREEN_ORIENTATION_FULL_USER, |
| 542 | SCREEN_ORIENTATION_LOCKED |
| 543 | }) |
| 544 | @Retention(RetentionPolicy.SOURCE) |
| 545 | public @interface ScreenOrientation {} |
| 546 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 547 | /** |
Wale Ogunwale | 5136249 | 2016-09-08 17:49:17 -0700 | [diff] [blame] | 548 | * Internal constant used to indicate that the app didn't set a specific orientation value. |
| 549 | * Different from {@link #SCREEN_ORIENTATION_UNSPECIFIED} below as the app can set its |
| 550 | * orientation to {@link #SCREEN_ORIENTATION_UNSPECIFIED} while this means that the app didn't |
| 551 | * set anything. The system will mostly treat this similar to |
| 552 | * {@link #SCREEN_ORIENTATION_UNSPECIFIED}. |
| 553 | * @hide |
| 554 | */ |
| 555 | public static final int SCREEN_ORIENTATION_UNSET = -2; |
| 556 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 557 | * Constant corresponding to <code>unspecified</code> in |
| 558 | * the {@link android.R.attr#screenOrientation} attribute. |
| 559 | */ |
| 560 | public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; |
| 561 | /** |
| 562 | * Constant corresponding to <code>landscape</code> in |
| 563 | * the {@link android.R.attr#screenOrientation} attribute. |
| 564 | */ |
| 565 | public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; |
| 566 | /** |
| 567 | * Constant corresponding to <code>portrait</code> in |
| 568 | * the {@link android.R.attr#screenOrientation} attribute. |
| 569 | */ |
| 570 | public static final int SCREEN_ORIENTATION_PORTRAIT = 1; |
| 571 | /** |
| 572 | * Constant corresponding to <code>user</code> in |
| 573 | * the {@link android.R.attr#screenOrientation} attribute. |
| 574 | */ |
| 575 | public static final int SCREEN_ORIENTATION_USER = 2; |
| 576 | /** |
| 577 | * Constant corresponding to <code>behind</code> in |
| 578 | * the {@link android.R.attr#screenOrientation} attribute. |
| 579 | */ |
| 580 | public static final int SCREEN_ORIENTATION_BEHIND = 3; |
| 581 | /** |
| 582 | * Constant corresponding to <code>sensor</code> in |
| 583 | * the {@link android.R.attr#screenOrientation} attribute. |
| 584 | */ |
| 585 | public static final int SCREEN_ORIENTATION_SENSOR = 4; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 586 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 587 | /** |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 588 | * Constant corresponding to <code>nosensor</code> in |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 589 | * the {@link android.R.attr#screenOrientation} attribute. |
| 590 | */ |
| 591 | public static final int SCREEN_ORIENTATION_NOSENSOR = 5; |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 592 | |
| 593 | /** |
| 594 | * Constant corresponding to <code>sensorLandscape</code> in |
| 595 | * the {@link android.R.attr#screenOrientation} attribute. |
| 596 | */ |
| 597 | public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; |
| 598 | |
| 599 | /** |
| 600 | * Constant corresponding to <code>sensorPortrait</code> in |
| 601 | * the {@link android.R.attr#screenOrientation} attribute. |
| 602 | */ |
| 603 | public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; |
| 604 | |
| 605 | /** |
| 606 | * Constant corresponding to <code>reverseLandscape</code> in |
| 607 | * the {@link android.R.attr#screenOrientation} attribute. |
| 608 | */ |
| 609 | public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; |
| 610 | |
| 611 | /** |
| 612 | * Constant corresponding to <code>reversePortrait</code> in |
| 613 | * the {@link android.R.attr#screenOrientation} attribute. |
| 614 | */ |
| 615 | public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; |
| 616 | |
| 617 | /** |
| 618 | * Constant corresponding to <code>fullSensor</code> in |
| 619 | * the {@link android.R.attr#screenOrientation} attribute. |
| 620 | */ |
| 621 | public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; |
| 622 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 623 | /** |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 624 | * Constant corresponding to <code>userLandscape</code> in |
| 625 | * the {@link android.R.attr#screenOrientation} attribute. |
| 626 | */ |
| 627 | public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; |
| 628 | |
| 629 | /** |
| 630 | * Constant corresponding to <code>userPortrait</code> in |
| 631 | * the {@link android.R.attr#screenOrientation} attribute. |
| 632 | */ |
| 633 | public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; |
| 634 | |
| 635 | /** |
| 636 | * Constant corresponding to <code>fullUser</code> in |
| 637 | * the {@link android.R.attr#screenOrientation} attribute. |
| 638 | */ |
| 639 | public static final int SCREEN_ORIENTATION_FULL_USER = 13; |
| 640 | |
| 641 | /** |
| 642 | * Constant corresponding to <code>locked</code> in |
| 643 | * the {@link android.R.attr#screenOrientation} attribute. |
| 644 | */ |
| 645 | public static final int SCREEN_ORIENTATION_LOCKED = 14; |
| 646 | |
| 647 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 648 | * The preferred screen orientation this activity would like to run in. |
| 649 | * From the {@link android.R.attr#screenOrientation} attribute, one of |
| 650 | * {@link #SCREEN_ORIENTATION_UNSPECIFIED}, |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 651 | * {@link #SCREEN_ORIENTATION_LANDSCAPE}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 652 | * {@link #SCREEN_ORIENTATION_PORTRAIT}, |
| 653 | * {@link #SCREEN_ORIENTATION_USER}, |
| 654 | * {@link #SCREEN_ORIENTATION_BEHIND}, |
| 655 | * {@link #SCREEN_ORIENTATION_SENSOR}, |
Dianne Hackborn | e5439f2 | 2010-10-02 16:53:50 -0700 | [diff] [blame] | 656 | * {@link #SCREEN_ORIENTATION_NOSENSOR}, |
| 657 | * {@link #SCREEN_ORIENTATION_SENSOR_LANDSCAPE}, |
| 658 | * {@link #SCREEN_ORIENTATION_SENSOR_PORTRAIT}, |
| 659 | * {@link #SCREEN_ORIENTATION_REVERSE_LANDSCAPE}, |
| 660 | * {@link #SCREEN_ORIENTATION_REVERSE_PORTRAIT}, |
Dianne Hackborn | b9ec1ac | 2013-04-10 17:34:25 -0700 | [diff] [blame] | 661 | * {@link #SCREEN_ORIENTATION_FULL_SENSOR}, |
| 662 | * {@link #SCREEN_ORIENTATION_USER_LANDSCAPE}, |
| 663 | * {@link #SCREEN_ORIENTATION_USER_PORTRAIT}, |
| 664 | * {@link #SCREEN_ORIENTATION_FULL_USER}, |
| 665 | * {@link #SCREEN_ORIENTATION_LOCKED}, |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 666 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 667 | @ScreenOrientation |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 668 | public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 669 | |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 670 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 671 | @IntDef(flag = true, prefix = { "CONFIG_" }, value = { |
| 672 | CONFIG_MCC, |
| 673 | CONFIG_MNC, |
| 674 | CONFIG_LOCALE, |
| 675 | CONFIG_TOUCHSCREEN, |
| 676 | CONFIG_KEYBOARD, |
| 677 | CONFIG_KEYBOARD_HIDDEN, |
| 678 | CONFIG_NAVIGATION, |
| 679 | CONFIG_ORIENTATION, |
| 680 | CONFIG_SCREEN_LAYOUT, |
| 681 | CONFIG_UI_MODE, |
| 682 | CONFIG_SCREEN_SIZE, |
| 683 | CONFIG_SMALLEST_SCREEN_SIZE, |
| 684 | CONFIG_DENSITY, |
| 685 | CONFIG_LAYOUT_DIRECTION, |
| 686 | CONFIG_COLOR_MODE, |
| 687 | CONFIG_FONT_SCALE, |
| 688 | }) |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 689 | @Retention(RetentionPolicy.SOURCE) |
| 690 | public @interface Config {} |
| 691 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 692 | /** |
| 693 | * Bit in {@link #configChanges} that indicates that the activity |
| 694 | * can itself handle changes to the IMSI MCC. Set from the |
| 695 | * {@link android.R.attr#configChanges} attribute. |
| 696 | */ |
| 697 | public static final int CONFIG_MCC = 0x0001; |
| 698 | /** |
| 699 | * Bit in {@link #configChanges} that indicates that the activity |
| 700 | * can itself handle changes to the IMSI MNC. Set from the |
| 701 | * {@link android.R.attr#configChanges} attribute. |
| 702 | */ |
| 703 | public static final int CONFIG_MNC = 0x0002; |
| 704 | /** |
| 705 | * Bit in {@link #configChanges} that indicates that the activity |
| 706 | * can itself handle changes to the locale. Set from the |
| 707 | * {@link android.R.attr#configChanges} attribute. |
| 708 | */ |
| 709 | public static final int CONFIG_LOCALE = 0x0004; |
| 710 | /** |
| 711 | * Bit in {@link #configChanges} that indicates that the activity |
| 712 | * can itself handle changes to the touchscreen type. Set from the |
| 713 | * {@link android.R.attr#configChanges} attribute. |
| 714 | */ |
| 715 | public static final int CONFIG_TOUCHSCREEN = 0x0008; |
| 716 | /** |
| 717 | * Bit in {@link #configChanges} that indicates that the activity |
| 718 | * can itself handle changes to the keyboard type. Set from the |
| 719 | * {@link android.R.attr#configChanges} attribute. |
| 720 | */ |
| 721 | public static final int CONFIG_KEYBOARD = 0x0010; |
| 722 | /** |
| 723 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 93e462b | 2009-09-15 22:50:40 -0700 | [diff] [blame] | 724 | * can itself handle changes to the keyboard or navigation being hidden/exposed. |
| 725 | * Note that inspite of the name, this applies to the changes to any |
| 726 | * hidden states: keyboard or navigation. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 727 | * Set from the {@link android.R.attr#configChanges} attribute. |
| 728 | */ |
| 729 | public static final int CONFIG_KEYBOARD_HIDDEN = 0x0020; |
| 730 | /** |
| 731 | * Bit in {@link #configChanges} that indicates that the activity |
| 732 | * can itself handle changes to the navigation type. Set from the |
| 733 | * {@link android.R.attr#configChanges} attribute. |
| 734 | */ |
| 735 | public static final int CONFIG_NAVIGATION = 0x0040; |
| 736 | /** |
| 737 | * Bit in {@link #configChanges} that indicates that the activity |
| 738 | * can itself handle changes to the screen orientation. Set from the |
| 739 | * {@link android.R.attr#configChanges} attribute. |
| 740 | */ |
| 741 | public static final int CONFIG_ORIENTATION = 0x0080; |
| 742 | /** |
| 743 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 744 | * can itself handle changes to the screen layout. Set from the |
| 745 | * {@link android.R.attr#configChanges} attribute. |
| 746 | */ |
| 747 | public static final int CONFIG_SCREEN_LAYOUT = 0x0100; |
| 748 | /** |
| 749 | * Bit in {@link #configChanges} that indicates that the activity |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 750 | * can itself handle the ui mode. Set from the |
| 751 | * {@link android.R.attr#configChanges} attribute. |
Tobias Haamel | 27b28b3 | 2010-02-09 23:09:17 +0100 | [diff] [blame] | 752 | */ |
| 753 | public static final int CONFIG_UI_MODE = 0x0200; |
| 754 | /** |
| 755 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 756 | * can itself handle the screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 757 | * {@link android.R.attr#configChanges} attribute. This will be |
| 758 | * set by default for applications that target an earlier version |
| 759 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 760 | * <b>however</b>, you will not see the bit set here becomes some |
| 761 | * applications incorrectly compare {@link #configChanges} against |
| 762 | * an absolute value rather than correctly masking out the bits |
| 763 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 764 | */ |
| 765 | public static final int CONFIG_SCREEN_SIZE = 0x0400; |
| 766 | /** |
| 767 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 768 | * can itself handle the smallest screen size. Set from the |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 769 | * {@link android.R.attr#configChanges} attribute. This will be |
| 770 | * set by default for applications that target an earlier version |
| 771 | * than {@link android.os.Build.VERSION_CODES#HONEYCOMB_MR2}... |
| 772 | * <b>however</b>, you will not see the bit set here becomes some |
| 773 | * applications incorrectly compare {@link #configChanges} against |
| 774 | * an absolute value rather than correctly masking out the bits |
| 775 | * they are interested in. Please don't do that, thanks. |
Dianne Hackborn | 69cb875 | 2011-05-19 18:13:32 -0700 | [diff] [blame] | 776 | */ |
| 777 | public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800; |
| 778 | /** |
| 779 | * Bit in {@link #configChanges} that indicates that the activity |
Dianne Hackborn | 908aecc | 2012-07-31 16:37:34 -0700 | [diff] [blame] | 780 | * can itself handle density changes. Set from the |
| 781 | * {@link android.R.attr#configChanges} attribute. |
| 782 | */ |
| 783 | public static final int CONFIG_DENSITY = 0x1000; |
| 784 | /** |
| 785 | * Bit in {@link #configChanges} that indicates that the activity |
Fabrice Di Meglio | 5f79799 | 2012-06-15 20:16:41 -0700 | [diff] [blame] | 786 | * can itself handle the change to layout direction. Set from the |
| 787 | * {@link android.R.attr#configChanges} attribute. |
| 788 | */ |
| 789 | public static final int CONFIG_LAYOUT_DIRECTION = 0x2000; |
| 790 | /** |
| 791 | * Bit in {@link #configChanges} that indicates that the activity |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 792 | * can itself handle the change to the display color gamut or dynamic |
| 793 | * range. Set from the {@link android.R.attr#configChanges} attribute. |
| 794 | */ |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 795 | public static final int CONFIG_COLOR_MODE = 0x4000; |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 796 | /** |
| 797 | * Bit in {@link #configChanges} that indicates that the activity |
MÃ¥rten Kongstad | 49a4a1d | 2017-01-12 08:36:37 +0100 | [diff] [blame] | 798 | * can itself handle asset path changes. Set from the {@link android.R.attr#configChanges} |
| 799 | * attribute. This is not a core resource configuration, but a higher-level value, so its |
| 800 | * constant starts at the high bits. |
| 801 | * @hide We do not want apps handling this yet, but we do need some kind of bit for diffs. |
| 802 | */ |
| 803 | public static final int CONFIG_ASSETS_PATHS = 0x80000000; |
| 804 | /** |
| 805 | * Bit in {@link #configChanges} that indicates that the activity |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 806 | * can itself handle changes to the font scaling factor. Set from the |
| 807 | * {@link android.R.attr#configChanges} attribute. This is |
Fabrice Di Meglio | dc25d25 | 2013-04-09 18:04:29 -0700 | [diff] [blame] | 808 | * not a core resource configuration, but a higher-level value, so its |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 809 | * constant starts at the high bits. |
| 810 | */ |
| 811 | public static final int CONFIG_FONT_SCALE = 0x40000000; |
Wale Ogunwale | 822e512 | 2017-07-26 06:02:24 -0700 | [diff] [blame] | 812 | /** |
| 813 | * Bit indicating changes to window configuration that isn't exposed to apps. |
| 814 | * This is for internal use only and apps don't handle it. |
| 815 | * @hide |
| 816 | * {@link Configuration}. |
| 817 | */ |
| 818 | public static final int CONFIG_WINDOW_CONFIGURATION = 0x20000000; |
Filip Gruszczynski | d2f1d94 | 2015-10-14 15:10:12 -0700 | [diff] [blame] | 819 | |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 820 | /** @hide |
| 821 | * Unfortunately the constants for config changes in native code are |
| 822 | * different from ActivityInfo. :( Here are the values we should use for the |
| 823 | * native side given the bit we have assigned in ActivityInfo. |
| 824 | */ |
| 825 | public static int[] CONFIG_NATIVE_BITS = new int[] { |
Dianne Hackborn | 1d0b177 | 2013-09-06 14:02:54 -0700 | [diff] [blame] | 826 | Configuration.NATIVE_CONFIG_MNC, // MNC |
| 827 | Configuration.NATIVE_CONFIG_MCC, // MCC |
| 828 | Configuration.NATIVE_CONFIG_LOCALE, // LOCALE |
| 829 | Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN |
| 830 | Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD |
| 831 | Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN |
| 832 | Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION |
| 833 | Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION |
| 834 | Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT |
| 835 | Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE |
| 836 | Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE |
| 837 | Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE |
| 838 | Configuration.NATIVE_CONFIG_DENSITY, // DENSITY |
| 839 | Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 840 | Configuration.NATIVE_CONFIG_COLOR_MODE, // COLOR_MODE |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 841 | }; |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 842 | |
| 843 | /** |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 844 | * Convert Java change bits to native. |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 845 | * |
| 846 | * @hide |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 847 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 848 | @UnsupportedAppUsage |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 849 | public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) { |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 850 | int output = 0; |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 851 | for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 852 | if ((input & (1 << i)) != 0) { |
Dianne Hackborn | ebff8f9 | 2011-05-12 18:07:47 -0700 | [diff] [blame] | 853 | output |= CONFIG_NATIVE_BITS[i]; |
| 854 | } |
| 855 | } |
| 856 | return output; |
| 857 | } |
| 858 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 859 | /** |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 860 | * Convert native change bits to Java. |
| 861 | * |
| 862 | * @hide |
| 863 | */ |
Alan Viverette | ac85f90 | 2016-03-11 15:15:51 -0500 | [diff] [blame] | 864 | public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) { |
Alan Viverette | c1d5279 | 2015-05-05 09:49:03 -0700 | [diff] [blame] | 865 | int output = 0; |
| 866 | for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { |
| 867 | if ((input & CONFIG_NATIVE_BITS[i]) != 0) { |
| 868 | output |= (1 << i); |
| 869 | } |
| 870 | } |
| 871 | return output; |
| 872 | } |
| 873 | |
| 874 | /** |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 875 | * @hide |
| 876 | * Unfortunately some developers (OpenFeint I am looking at you) have |
| 877 | * compared the configChanges bit field against absolute values, so if we |
| 878 | * introduce a new bit they break. To deal with that, we will make sure |
| 879 | * the public field will not have a value that breaks them, and let the |
| 880 | * framework call here to get the real value. |
| 881 | */ |
| 882 | public int getRealConfigChanged() { |
| 883 | return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 |
| 884 | ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE |
| 885 | | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) |
| 886 | : configChanges; |
| 887 | } |
| 888 | |
| 889 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 890 | * Bit mask of kinds of configuration changes that this activity |
| 891 | * can handle itself (without being restarted by the system). |
| 892 | * Contains any combination of {@link #CONFIG_FONT_SCALE}, |
| 893 | * {@link #CONFIG_MCC}, {@link #CONFIG_MNC}, |
| 894 | * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN}, |
Dianne Hackborn | 723738c | 2009-06-25 19:48:04 -0700 | [diff] [blame] | 895 | * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION}, |
Alan Viverette | 28c4a0b | 2015-11-20 17:23:46 -0500 | [diff] [blame] | 896 | * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT}, |
Romain Guy | c9ba559 | 2017-01-18 16:34:42 -0800 | [diff] [blame] | 897 | * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION} and |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 898 | * {@link #CONFIG_COLOR_MODE}. |
Alan Viverette | 28c4a0b | 2015-11-20 17:23:46 -0500 | [diff] [blame] | 899 | * Set from the {@link android.R.attr#configChanges} attribute. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 900 | */ |
| 901 | public int configChanges; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 902 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 903 | /** |
| 904 | * The desired soft input mode for this activity's main window. |
| 905 | * Set from the {@link android.R.attr#windowSoftInputMode} attribute |
| 906 | * in the activity's manifest. May be any of the same values allowed |
| 907 | * for {@link android.view.WindowManager.LayoutParams#softInputMode |
| 908 | * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified), |
| 909 | * the mode from the theme will be used. |
| 910 | */ |
Yohei Yukawa | 22dac1c | 2017-02-12 16:54:16 -0800 | [diff] [blame] | 911 | @android.view.WindowManager.LayoutParams.SoftInputModeFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 912 | public int softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 913 | |
| 914 | /** |
| 915 | * The desired extra UI options for this activity and its main window. |
| 916 | * Set from the {@link android.R.attr#uiOptions} attribute in the |
| 917 | * activity's manifest. |
| 918 | */ |
| 919 | public int uiOptions = 0; |
| 920 | |
| 921 | /** |
Scott Main | e797ed6 | 2011-09-22 16:17:45 -0700 | [diff] [blame] | 922 | * Flag for use with {@link #uiOptions}. |
| 923 | * Indicates that the action bar should put all action items in a separate bar when |
| 924 | * the screen is narrow. |
| 925 | * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML |
| 926 | * attribute. |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 927 | */ |
| 928 | public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; |
| 929 | |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 930 | /** |
| 931 | * If defined, the activity named here is the logical parent of this activity. |
| 932 | */ |
| 933 | public String parentActivityName; |
| 934 | |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 935 | /** |
| 936 | * Screen rotation animation desired by the activity, with values as defined |
| 937 | * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}. |
Robert Carr | c0149bf | 2017-05-01 15:22:22 -0700 | [diff] [blame] | 938 | * |
| 939 | * -1 means to use the system default. |
| 940 | * |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 941 | * @hide |
| 942 | */ |
Robert Carr | c0149bf | 2017-05-01 15:22:22 -0700 | [diff] [blame] | 943 | public int rotationAnimation = -1; |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 944 | |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 945 | /** @hide */ |
| 946 | public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0; |
| 947 | /** @hide */ |
| 948 | public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1; |
| 949 | /** @hide */ |
| 950 | public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2; |
| 951 | /** @hide */ |
| 952 | public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3; |
| 953 | |
| 954 | /** @hide */ |
| 955 | public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) { |
| 956 | switch (lockTaskLaunchMode) { |
| 957 | case LOCK_TASK_LAUNCH_MODE_DEFAULT: |
| 958 | return "LOCK_TASK_LAUNCH_MODE_DEFAULT"; |
| 959 | case LOCK_TASK_LAUNCH_MODE_NEVER: |
| 960 | return "LOCK_TASK_LAUNCH_MODE_NEVER"; |
| 961 | case LOCK_TASK_LAUNCH_MODE_ALWAYS: |
| 962 | return "LOCK_TASK_LAUNCH_MODE_ALWAYS"; |
| 963 | case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED: |
| 964 | return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED"; |
| 965 | default: |
| 966 | return "unknown=" + lockTaskLaunchMode; |
| 967 | } |
| 968 | } |
| 969 | /** |
| 970 | * Value indicating if the activity is to be locked at startup. Takes on the values from |
| 971 | * {@link android.R.attr#lockTaskMode}. |
| 972 | * @hide |
| 973 | */ |
| 974 | public int lockTaskLaunchMode; |
| 975 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 976 | /** |
| 977 | * Information about desired position and size of activity on the display when |
| 978 | * it is first started. |
| 979 | */ |
| 980 | public WindowLayout windowLayout; |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 981 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 982 | public ActivityInfo() { |
| 983 | } |
| 984 | |
| 985 | public ActivityInfo(ActivityInfo orig) { |
| 986 | super(orig); |
| 987 | theme = orig.theme; |
| 988 | launchMode = orig.launchMode; |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 989 | documentLaunchMode = orig.documentLaunchMode; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 990 | permission = orig.permission; |
| 991 | taskAffinity = orig.taskAffinity; |
| 992 | targetActivity = orig.targetActivity; |
| 993 | flags = orig.flags; |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 994 | privateFlags = orig.privateFlags; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 995 | screenOrientation = orig.screenOrientation; |
| 996 | configChanges = orig.configChanges; |
| 997 | softInputMode = orig.softInputMode; |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 998 | uiOptions = orig.uiOptions; |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 999 | parentActivityName = orig.parentActivityName; |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 1000 | maxRecents = orig.maxRecents; |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1001 | lockTaskLaunchMode = orig.lockTaskLaunchMode; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1002 | windowLayout = orig.windowLayout; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1003 | resizeMode = orig.resizeMode; |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1004 | requestedVrComponent = orig.requestedVrComponent; |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 1005 | rotationAnimation = orig.rotationAnimation; |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1006 | colorMode = orig.colorMode; |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1007 | maxAspectRatio = orig.maxAspectRatio; |
Adrian Roos | 917791e | 2018-11-28 16:30:44 +0100 | [diff] [blame] | 1008 | minAspectRatio = orig.minAspectRatio; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1009 | } |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1010 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1011 | /** |
| 1012 | * Return the theme resource identifier to use for this activity. If |
| 1013 | * the activity defines a theme, that is used; else, the application |
| 1014 | * theme is used. |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1015 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1016 | * @return The theme associated with this activity. |
| 1017 | */ |
| 1018 | public final int getThemeResource() { |
| 1019 | return theme != 0 ? theme : applicationInfo.theme; |
| 1020 | } |
| 1021 | |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1022 | private String persistableModeToString() { |
| 1023 | switch(persistableMode) { |
| 1024 | case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY"; |
Craig Mautner | 7f72f53 | 2014-07-21 10:07:12 -0700 | [diff] [blame] | 1025 | case PERSIST_NEVER: return "PERSIST_NEVER"; |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1026 | case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS"; |
| 1027 | default: return "UNKNOWN=" + persistableMode; |
| 1028 | } |
| 1029 | } |
| 1030 | |
Wale Ogunwale | 508ff55 | 2016-02-15 19:31:50 -0800 | [diff] [blame] | 1031 | /** |
Riddle Hsu | 0a343c3 | 2018-12-21 00:40:48 +0800 | [diff] [blame] | 1032 | * Returns true if the activity has maximum or minimum aspect ratio. |
| 1033 | * @hide |
| 1034 | */ |
| 1035 | public boolean hasFixedAspectRatio() { |
| 1036 | return maxAspectRatio != 0 || minAspectRatio != 0; |
| 1037 | } |
| 1038 | |
| 1039 | /** |
Wale Ogunwale | 508ff55 | 2016-02-15 19:31:50 -0800 | [diff] [blame] | 1040 | * Returns true if the activity's orientation is fixed. |
| 1041 | * @hide |
| 1042 | */ |
Riddle Hsu | 0a343c3 | 2018-12-21 00:40:48 +0800 | [diff] [blame] | 1043 | public boolean isFixedOrientation() { |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1044 | return isFixedOrientationLandscape() || isFixedOrientationPortrait() |
Wale Ogunwale | 508ff55 | 2016-02-15 19:31:50 -0800 | [diff] [blame] | 1045 | || screenOrientation == SCREEN_ORIENTATION_LOCKED; |
| 1046 | } |
| 1047 | |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1048 | /** |
| 1049 | * Returns true if the activity's orientation is fixed to landscape. |
| 1050 | * @hide |
| 1051 | */ |
| 1052 | boolean isFixedOrientationLandscape() { |
Wale Ogunwale | d4b1d1e | 2017-04-10 06:35:59 -0700 | [diff] [blame] | 1053 | return isFixedOrientationLandscape(screenOrientation); |
| 1054 | } |
| 1055 | |
| 1056 | /** |
| 1057 | * Returns true if the activity's orientation is fixed to landscape. |
| 1058 | * @hide |
| 1059 | */ |
| 1060 | public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) { |
| 1061 | return orientation == SCREEN_ORIENTATION_LANDSCAPE |
| 1062 | || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE |
| 1063 | || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE |
| 1064 | || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1065 | } |
| 1066 | |
| 1067 | /** |
| 1068 | * Returns true if the activity's orientation is fixed to portrait. |
| 1069 | * @hide |
| 1070 | */ |
| 1071 | boolean isFixedOrientationPortrait() { |
Wale Ogunwale | d4b1d1e | 2017-04-10 06:35:59 -0700 | [diff] [blame] | 1072 | return isFixedOrientationPortrait(screenOrientation); |
| 1073 | } |
| 1074 | |
| 1075 | /** |
| 1076 | * Returns true if the activity's orientation is fixed to portrait. |
| 1077 | * @hide |
| 1078 | */ |
| 1079 | public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) { |
| 1080 | return orientation == SCREEN_ORIENTATION_PORTRAIT |
| 1081 | || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT |
| 1082 | || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT |
| 1083 | || orientation == SCREEN_ORIENTATION_USER_PORTRAIT; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1084 | } |
| 1085 | |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 1086 | /** |
| 1087 | * Returns true if the activity supports picture-in-picture. |
| 1088 | * @hide |
| 1089 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 1090 | @UnsupportedAppUsage |
Winson Chung | d339538 | 2016-12-13 11:49:09 -0800 | [diff] [blame] | 1091 | public boolean supportsPictureInPicture() { |
| 1092 | return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0; |
| 1093 | } |
| 1094 | |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1095 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 1096 | @UnsupportedAppUsage |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1097 | public static boolean isResizeableMode(int mode) { |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 1098 | return mode == RESIZE_MODE_RESIZEABLE |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1099 | || mode == RESIZE_MODE_FORCE_RESIZEABLE |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1100 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1101 | || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1102 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1103 | || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION; |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1104 | } |
| 1105 | |
| 1106 | /** @hide */ |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1107 | public static boolean isPreserveOrientationMode(int mode) { |
| 1108 | return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY |
| 1109 | || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY |
| 1110 | || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION; |
| 1111 | } |
| 1112 | |
| 1113 | /** @hide */ |
Wale Ogunwale | b1faf60 | 2016-01-27 09:12:31 -0800 | [diff] [blame] | 1114 | public static String resizeModeToString(int mode) { |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1115 | switch (mode) { |
| 1116 | case RESIZE_MODE_UNRESIZEABLE: |
| 1117 | return "RESIZE_MODE_UNRESIZEABLE"; |
Wale Ogunwale | 72a73e3 | 2016-10-13 12:16:39 -0700 | [diff] [blame] | 1118 | case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION: |
| 1119 | return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION"; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1120 | case RESIZE_MODE_RESIZEABLE: |
| 1121 | return "RESIZE_MODE_RESIZEABLE"; |
Wale Ogunwale | d829d36 | 2016-02-10 19:24:49 -0800 | [diff] [blame] | 1122 | case RESIZE_MODE_FORCE_RESIZEABLE: |
| 1123 | return "RESIZE_MODE_FORCE_RESIZEABLE"; |
skuhne@google.com | 322347b | 2016-12-02 12:54:03 -0800 | [diff] [blame] | 1124 | case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY: |
| 1125 | return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY"; |
| 1126 | case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY: |
| 1127 | return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY"; |
| 1128 | case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION: |
| 1129 | return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION"; |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1130 | default: |
| 1131 | return "unknown=" + mode; |
| 1132 | } |
| 1133 | } |
| 1134 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1135 | public void dump(Printer pw, String prefix) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1136 | dump(pw, prefix, DUMP_FLAG_ALL); |
| 1137 | } |
| 1138 | |
| 1139 | /** @hide */ |
Yohei Yukawa | 8f27217 | 2017-08-31 00:26:01 -0700 | [diff] [blame] | 1140 | public void dump(Printer pw, String prefix, int dumpFlags) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1141 | super.dumpFront(pw, prefix); |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1142 | if (permission != null) { |
| 1143 | pw.println(prefix + "permission=" + permission); |
| 1144 | } |
Yohei Yukawa | 8f27217 | 2017-08-31 00:26:01 -0700 | [diff] [blame] | 1145 | if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1146 | pw.println(prefix + "taskAffinity=" + taskAffinity |
| 1147 | + " targetActivity=" + targetActivity |
| 1148 | + " persistableMode=" + persistableModeToString()); |
| 1149 | } |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 1150 | if (launchMode != 0 || flags != 0 || privateFlags != 0 || theme != 0) { |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1151 | pw.println(prefix + "launchMode=" + launchMode |
| 1152 | + " flags=0x" + Integer.toHexString(flags) |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 1153 | + " privateFlags=0x" + Integer.toHexString(privateFlags) |
Dianne Hackborn | 12527f9 | 2009-11-11 17:39:50 -0800 | [diff] [blame] | 1154 | + " theme=0x" + Integer.toHexString(theme)); |
| 1155 | } |
| 1156 | if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED |
| 1157 | || configChanges != 0 || softInputMode != 0) { |
| 1158 | pw.println(prefix + "screenOrientation=" + screenOrientation |
| 1159 | + " configChanges=0x" + Integer.toHexString(configChanges) |
| 1160 | + " softInputMode=0x" + Integer.toHexString(softInputMode)); |
| 1161 | } |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1162 | if (uiOptions != 0) { |
| 1163 | pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions)); |
| 1164 | } |
Yohei Yukawa | 8f27217 | 2017-08-31 00:26:01 -0700 | [diff] [blame] | 1165 | if ((dumpFlags & DUMP_FLAG_DETAILS) != 0) { |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 1166 | pw.println(prefix + "lockTaskLaunchMode=" |
| 1167 | + lockTaskLaunchModeToString(lockTaskLaunchMode)); |
| 1168 | } |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1169 | if (windowLayout != null) { |
| 1170 | pw.println(prefix + "windowLayout=" + windowLayout.width + "|" |
| 1171 | + windowLayout.widthFraction + ", " + windowLayout.height + "|" |
| 1172 | + windowLayout.heightFraction + ", " + windowLayout.gravity); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1173 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1174 | pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode)); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1175 | if (requestedVrComponent != null) { |
| 1176 | pw.println(prefix + "requestedVrComponent=" + requestedVrComponent); |
| 1177 | } |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1178 | if (maxAspectRatio != 0) { |
| 1179 | pw.println(prefix + "maxAspectRatio=" + maxAspectRatio); |
| 1180 | } |
Adrian Roos | 917791e | 2018-11-28 16:30:44 +0100 | [diff] [blame] | 1181 | if (minAspectRatio != 0) { |
| 1182 | pw.println(prefix + "minAspectRatio=" + minAspectRatio); |
| 1183 | } |
Yohei Yukawa | 8f27217 | 2017-08-31 00:26:01 -0700 | [diff] [blame] | 1184 | super.dumpBack(pw, prefix, dumpFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1185 | } |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1186 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1187 | public String toString() { |
| 1188 | return "ActivityInfo{" |
| 1189 | + Integer.toHexString(System.identityHashCode(this)) |
| 1190 | + " " + name + "}"; |
| 1191 | } |
| 1192 | |
| 1193 | public int describeContents() { |
| 1194 | return 0; |
| 1195 | } |
| 1196 | |
| 1197 | public void writeToParcel(Parcel dest, int parcelableFlags) { |
| 1198 | super.writeToParcel(dest, parcelableFlags); |
| 1199 | dest.writeInt(theme); |
| 1200 | dest.writeInt(launchMode); |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 1201 | dest.writeInt(documentLaunchMode); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1202 | dest.writeString(permission); |
| 1203 | dest.writeString(taskAffinity); |
| 1204 | dest.writeString(targetActivity); |
Andrii Kulian | 6b9d3a1 | 2017-11-16 14:36:36 -0800 | [diff] [blame] | 1205 | dest.writeString(launchToken); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1206 | dest.writeInt(flags); |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 1207 | dest.writeInt(privateFlags); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1208 | dest.writeInt(screenOrientation); |
| 1209 | dest.writeInt(configChanges); |
| 1210 | dest.writeInt(softInputMode); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1211 | dest.writeInt(uiOptions); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 1212 | dest.writeString(parentActivityName); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1213 | dest.writeInt(persistableMode); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 1214 | dest.writeInt(maxRecents); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1215 | dest.writeInt(lockTaskLaunchMode); |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1216 | if (windowLayout != null) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1217 | dest.writeInt(1); |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1218 | dest.writeInt(windowLayout.width); |
| 1219 | dest.writeFloat(windowLayout.widthFraction); |
| 1220 | dest.writeInt(windowLayout.height); |
| 1221 | dest.writeFloat(windowLayout.heightFraction); |
| 1222 | dest.writeInt(windowLayout.gravity); |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1223 | dest.writeInt(windowLayout.minWidth); |
| 1224 | dest.writeInt(windowLayout.minHeight); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1225 | } else { |
| 1226 | dest.writeInt(0); |
| 1227 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1228 | dest.writeInt(resizeMode); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1229 | dest.writeString(requestedVrComponent); |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 1230 | dest.writeInt(rotationAnimation); |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1231 | dest.writeInt(colorMode); |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1232 | dest.writeFloat(maxAspectRatio); |
Adrian Roos | 917791e | 2018-11-28 16:30:44 +0100 | [diff] [blame] | 1233 | dest.writeFloat(minAspectRatio); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1234 | } |
| 1235 | |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 1236 | /** |
| 1237 | * Determines whether the {@link Activity} is considered translucent or floating. |
| 1238 | * @hide |
| 1239 | */ |
Wale Ogunwale | 30eab1f | 2018-05-24 18:25:25 -0700 | [diff] [blame] | 1240 | @TestApi |
Bryce Lee | 3979159 | 2017-04-26 09:29:12 -0700 | [diff] [blame] | 1241 | public static boolean isTranslucentOrFloating(TypedArray attributes) { |
| 1242 | final boolean isTranslucent = |
| 1243 | attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent, |
| 1244 | false); |
| 1245 | final boolean isSwipeToDismiss = !attributes.hasValue( |
| 1246 | com.android.internal.R.styleable.Window_windowIsTranslucent) |
| 1247 | && attributes.getBoolean( |
| 1248 | com.android.internal.R.styleable.Window_windowSwipeToDismiss, false); |
| 1249 | final boolean isFloating = |
| 1250 | attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating, |
| 1251 | false); |
| 1252 | |
| 1253 | return isFloating || isTranslucent || isSwipeToDismiss; |
| 1254 | } |
| 1255 | |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 1256 | /** |
| 1257 | * Convert the screen orientation constant to a human readable format. |
| 1258 | * @hide |
| 1259 | */ |
| 1260 | public static String screenOrientationToString(int orientation) { |
Jorim Jaggi | 484851b | 2017-09-22 16:03:27 +0200 | [diff] [blame] | 1261 | switch (orientation) { |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 1262 | case SCREEN_ORIENTATION_UNSET: |
| 1263 | return "SCREEN_ORIENTATION_UNSET"; |
| 1264 | case SCREEN_ORIENTATION_UNSPECIFIED: |
| 1265 | return "SCREEN_ORIENTATION_UNSPECIFIED"; |
| 1266 | case SCREEN_ORIENTATION_LANDSCAPE: |
| 1267 | return "SCREEN_ORIENTATION_LANDSCAPE"; |
| 1268 | case SCREEN_ORIENTATION_PORTRAIT: |
| 1269 | return "SCREEN_ORIENTATION_PORTRAIT"; |
| 1270 | case SCREEN_ORIENTATION_USER: |
| 1271 | return "SCREEN_ORIENTATION_USER"; |
| 1272 | case SCREEN_ORIENTATION_BEHIND: |
| 1273 | return "SCREEN_ORIENTATION_BEHIND"; |
| 1274 | case SCREEN_ORIENTATION_SENSOR: |
| 1275 | return "SCREEN_ORIENTATION_SENSOR"; |
| 1276 | case SCREEN_ORIENTATION_NOSENSOR: |
| 1277 | return "SCREEN_ORIENTATION_NOSENSOR"; |
| 1278 | case SCREEN_ORIENTATION_SENSOR_LANDSCAPE: |
| 1279 | return "SCREEN_ORIENTATION_SENSOR_LANDSCAPE"; |
| 1280 | case SCREEN_ORIENTATION_SENSOR_PORTRAIT: |
| 1281 | return "SCREEN_ORIENTATION_SENSOR_PORTRAIT"; |
| 1282 | case SCREEN_ORIENTATION_REVERSE_LANDSCAPE: |
| 1283 | return "SCREEN_ORIENTATION_REVERSE_LANDSCAPE"; |
| 1284 | case SCREEN_ORIENTATION_REVERSE_PORTRAIT: |
| 1285 | return "SCREEN_ORIENTATION_REVERSE_PORTRAIT"; |
| 1286 | case SCREEN_ORIENTATION_FULL_SENSOR: |
| 1287 | return "SCREEN_ORIENTATION_FULL_SENSOR"; |
| 1288 | case SCREEN_ORIENTATION_USER_LANDSCAPE: |
| 1289 | return "SCREEN_ORIENTATION_USER_LANDSCAPE"; |
| 1290 | case SCREEN_ORIENTATION_USER_PORTRAIT: |
| 1291 | return "SCREEN_ORIENTATION_USER_PORTRAIT"; |
| 1292 | case SCREEN_ORIENTATION_FULL_USER: |
| 1293 | return "SCREEN_ORIENTATION_FULL_USER"; |
| 1294 | case SCREEN_ORIENTATION_LOCKED: |
| 1295 | return "SCREEN_ORIENTATION_LOCKED"; |
| 1296 | default: |
| 1297 | return Integer.toString(orientation); |
| 1298 | } |
| 1299 | } |
| 1300 | |
Jorim Jaggi | 484851b | 2017-09-22 16:03:27 +0200 | [diff] [blame] | 1301 | /** |
| 1302 | * @hide |
| 1303 | */ |
| 1304 | public static String colorModeToString(@ColorMode int colorMode) { |
| 1305 | switch (colorMode) { |
| 1306 | case COLOR_MODE_DEFAULT: |
| 1307 | return "COLOR_MODE_DEFAULT"; |
| 1308 | case COLOR_MODE_WIDE_COLOR_GAMUT: |
| 1309 | return "COLOR_MODE_WIDE_COLOR_GAMUT"; |
| 1310 | case COLOR_MODE_HDR: |
| 1311 | return "COLOR_MODE_HDR"; |
| 1312 | default: |
| 1313 | return Integer.toString(colorMode); |
| 1314 | } |
| 1315 | } |
| 1316 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 1317 | public static final @android.annotation.NonNull Parcelable.Creator<ActivityInfo> CREATOR |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1318 | = new Parcelable.Creator<ActivityInfo>() { |
| 1319 | public ActivityInfo createFromParcel(Parcel source) { |
| 1320 | return new ActivityInfo(source); |
| 1321 | } |
| 1322 | public ActivityInfo[] newArray(int size) { |
| 1323 | return new ActivityInfo[size]; |
| 1324 | } |
| 1325 | }; |
| 1326 | |
| 1327 | private ActivityInfo(Parcel source) { |
| 1328 | super(source); |
| 1329 | theme = source.readInt(); |
| 1330 | launchMode = source.readInt(); |
Robert Carr | 3e2e011 | 2015-09-15 12:30:42 -0700 | [diff] [blame] | 1331 | documentLaunchMode = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1332 | permission = source.readString(); |
| 1333 | taskAffinity = source.readString(); |
| 1334 | targetActivity = source.readString(); |
Andrii Kulian | 6b9d3a1 | 2017-11-16 14:36:36 -0800 | [diff] [blame] | 1335 | launchToken = source.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1336 | flags = source.readInt(); |
Issei Suzuki | 74e1eb2 | 2018-12-20 17:42:52 +0100 | [diff] [blame] | 1337 | privateFlags = source.readInt(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1338 | screenOrientation = source.readInt(); |
| 1339 | configChanges = source.readInt(); |
| 1340 | softInputMode = source.readInt(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1341 | uiOptions = source.readInt(); |
Adam Powell | dd8fab2 | 2012-03-22 17:47:27 -0700 | [diff] [blame] | 1342 | parentActivityName = source.readString(); |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 1343 | persistableMode = source.readInt(); |
Craig Mautner | 8307ea7 | 2014-09-11 15:03:53 -0700 | [diff] [blame] | 1344 | maxRecents = source.readInt(); |
Craig Mautner | 15df08a | 2015-04-01 12:17:18 -0700 | [diff] [blame] | 1345 | lockTaskLaunchMode = source.readInt(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1346 | if (source.readInt() == 1) { |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1347 | windowLayout = new WindowLayout(source); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1348 | } |
Wale Ogunwale | d26176f | 2016-01-25 20:04:04 -0800 | [diff] [blame] | 1349 | resizeMode = source.readInt(); |
Ruben Brunk | f56c9f4 | 2016-04-22 18:20:55 -0700 | [diff] [blame] | 1350 | requestedVrComponent = source.readString(); |
Robert Carr | 0f5d753 | 2016-10-17 16:39:17 -0700 | [diff] [blame] | 1351 | rotationAnimation = source.readInt(); |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1352 | colorMode = source.readInt(); |
Wale Ogunwale | 55ddf8f | 2017-03-20 08:56:38 -0700 | [diff] [blame] | 1353 | maxAspectRatio = source.readFloat(); |
Adrian Roos | 917791e | 2018-11-28 16:30:44 +0100 | [diff] [blame] | 1354 | minAspectRatio = source.readFloat(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1355 | } |
| 1356 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1357 | /** |
| 1358 | * Contains information about position and size of the activity on the display. |
| 1359 | * |
| 1360 | * Used in freeform mode to set desired position when activity is first launched. |
| 1361 | * It describes how big the activity wants to be in both width and height, |
| 1362 | * the minimal allowed size, and the gravity to be applied. |
| 1363 | * |
| 1364 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1365 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1366 | * @attr ref android.R.styleable#AndroidManifestLayout_gravity |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1367 | * @attr ref android.R.styleable#AndroidManifestLayout_minWidth |
| 1368 | * @attr ref android.R.styleable#AndroidManifestLayout_minHeight |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1369 | */ |
| 1370 | public static final class WindowLayout { |
| 1371 | public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity, |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1372 | int minWidth, int minHeight) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1373 | this.width = width; |
| 1374 | this.widthFraction = widthFraction; |
| 1375 | this.height = height; |
| 1376 | this.heightFraction = heightFraction; |
| 1377 | this.gravity = gravity; |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1378 | this.minWidth = minWidth; |
| 1379 | this.minHeight = minHeight; |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1380 | } |
| 1381 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1382 | WindowLayout(Parcel source) { |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1383 | width = source.readInt(); |
| 1384 | widthFraction = source.readFloat(); |
| 1385 | height = source.readInt(); |
| 1386 | heightFraction = source.readFloat(); |
| 1387 | gravity = source.readInt(); |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1388 | minWidth = source.readInt(); |
| 1389 | minHeight = source.readInt(); |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1390 | } |
| 1391 | |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1392 | /** |
| 1393 | * Width of activity in pixels. |
| 1394 | * |
| 1395 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1396 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1397 | public final int width; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1398 | |
| 1399 | /** |
| 1400 | * Width of activity as a fraction of available display width. |
| 1401 | * If both {@link #width} and this value are set this one will be preferred. |
| 1402 | * |
| 1403 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth |
| 1404 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1405 | public final float widthFraction; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1406 | |
| 1407 | /** |
| 1408 | * Height of activity in pixels. |
| 1409 | * |
| 1410 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1411 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1412 | public final int height; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1413 | |
| 1414 | /** |
| 1415 | * Height of activity as a fraction of available display height. |
| 1416 | * If both {@link #height} and this value are set this one will be preferred. |
| 1417 | * |
| 1418 | * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight |
| 1419 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1420 | public final float heightFraction; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1421 | |
| 1422 | /** |
| 1423 | * Gravity of activity. |
| 1424 | * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM}, |
| 1425 | * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported. |
| 1426 | * |
| 1427 | * @attr ref android.R.styleable#AndroidManifestLayout_gravity |
| 1428 | */ |
Filip Gruszczynski | 848fe6b | 2015-08-19 13:32:41 -0700 | [diff] [blame] | 1429 | public final int gravity; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1430 | |
| 1431 | /** |
| 1432 | * Minimal width of activity in pixels to be able to display its content. |
| 1433 | * |
| 1434 | * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional |
| 1435 | * activities launched in the task. That is if the root activity of a task set minimal |
| 1436 | * width, then the system will set the same minimal width on all other activities in the |
| 1437 | * task. It will also ignore any other minimal width attributes of non-root activities. |
| 1438 | * |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1439 | * @attr ref android.R.styleable#AndroidManifestLayout_minWidth |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1440 | */ |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1441 | public final int minWidth; |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1442 | |
| 1443 | /** |
| 1444 | * Minimal height of activity in pixels to be able to display its content. |
| 1445 | * |
| 1446 | * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional |
| 1447 | * activities launched in the task. That is if the root activity of a task set minimal |
| 1448 | * height, then the system will set the same minimal height on all other activities in the |
| 1449 | * task. It will also ignore any other minimal height attributes of non-root activities. |
| 1450 | * |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1451 | * @attr ref android.R.styleable#AndroidManifestLayout_minHeight |
Andrii Kulian | 2e751b8 | 2016-03-16 16:59:32 -0700 | [diff] [blame] | 1452 | */ |
Andrii Kulian | f66a83d | 2016-05-17 12:17:44 -0700 | [diff] [blame] | 1453 | public final int minHeight; |
Garfield Tan | b5cc09f | 2018-09-28 10:06:52 -0700 | [diff] [blame] | 1454 | |
| 1455 | /** |
| 1456 | * Returns if this {@link WindowLayout} has specified bounds. |
| 1457 | * @hide |
| 1458 | */ |
| 1459 | public boolean hasSpecifiedSize() { |
| 1460 | return width >= 0 || height >= 0 || widthFraction >= 0 || heightFraction >= 0; |
| 1461 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1462 | } |
| 1463 | } |