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