blob: 92f4849e7d8e8840038cba3b20acdf413e14fa75 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
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 Project9066cfe2009-03-03 19:31:44 -080017package android.content.pm;
18
Tor Norbyed9273d62013-05-30 15:59:53 -070019import android.annotation.IntDef;
Todd Kennedyc05f5d12017-04-25 11:11:40 -070020import android.content.Intent;
Dianne Hackborn1d0b1772013-09-06 14:02:54 -070021import android.content.res.Configuration;
Alan Viveretteac85f902016-03-11 15:15:51 -050022import android.content.res.Configuration.NativeConfig;
Bryce Lee39791592017-04-26 09:29:12 -070023import android.content.res.TypedArray;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.os.Parcel;
25import android.os.Parcelable;
26import android.util.Printer;
27
Tor Norbyed9273d62013-05-30 15:59:53 -070028import java.lang.annotation.Retention;
29import java.lang.annotation.RetentionPolicy;
30
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031/**
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 */
37public class ActivityInfo extends ComponentInfo
38 implements Parcelable {
Robert Carr3e2e0112015-09-15 12:30:42 -070039
40 // NOTE: When adding new data members be sure to update the copy-constructor, Parcel
41 // constructor, and writeToParcel.
42
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043 /**
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 Carr3e2e0112015-09-15 12:30:42 -070048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 /**
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 Gruszczynskid2f1d942015-10-14 15:10:12 -070073 * {@link #LAUNCH_SINGLE_TOP}, {@link #LAUNCH_SINGLE_TASK}, or
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 * {@link #LAUNCH_SINGLE_INSTANCE}.
75 */
76 public int launchMode;
Craig Mautner2dac0562014-05-06 09:06:44 -070077
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 Mautnerf357c0c2014-06-09 09:23:27 -070094 * 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 Mautner2dac0562014-05-06 09:06:44 -070099 * 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 Project9066cfe2009-03-03 19:31:44 -0800113 /**
Craig Mautner43e52ed2014-06-16 17:18:52 -0700114 * 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 Mautner7f72f532014-07-21 10:07:12 -0700122 public static final int PERSIST_NEVER = 1;
Craig Mautner43e52ed2014-06-16 17:18:52 -0700123 /**
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 Mautnerffcfcaa2014-06-05 09:54:38 -0700136 * 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 Project9066cfe2009-03-03 19:31:44 -0800142 * Optional name of a permission required to be able to access this
143 * Activity. From the "permission" attribute.
144 */
145 public String permission;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 /**
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 Gruszczynskid2f1d942015-10-14 15:10:12 -0700154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 /**
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 Gruszczynskid2f1d942015-10-14 15:10:12 -0700160
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800161 /**
Todd Kennedy50d946c12017-03-17 13:55:38 -0700162 * Token used to string together multiple events within a single launch action.
163 * @hide
164 */
165 public String launchToken;
166
167 /**
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800168 * 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 Ogunwale72a73e32016-10-13 12:16:39 -0700174 * Activity didn't explicitly request to be resizeable, but we are making it resizeable because
Wale Ogunwaledf241e92016-10-13 15:14:21 -0700175 * 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 Ogunwale72a73e32016-10-13 12:16:39 -0700177 * @hide
178 */
179 public static final int RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION = 1;
180 /**
181 * Activity explicitly requested to be resizeable.
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800182 * @hide
183 */
184 public static final int RESIZE_MODE_RESIZEABLE = 2;
185 /**
Winson Chungd3395382016-12-13 11:49:09 -0800186 * 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 Ogunwaled26176f2016-01-25 20:04:04 -0800190 * @hide
Winson Chungd3395382016-12-13 11:49:09 -0800191 * @deprecated
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800192 */
Winson Chungd3395382016-12-13 11:49:09 -0800193 public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE_DEPRECATED = 3;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800194 /**
skuhne@google.com322347b2016-12-02 12:54:03 -0800195 * Activity does not support resizing, but we are forcing it to be resizeable. Only affects
Wale Ogunwaledf241e92016-10-13 15:14:21 -0700196 * certain pre-N apps where we force them to be resizeable.
Wale Ogunwaled829d362016-02-10 19:24:49 -0800197 * @hide
198 */
199 public static final int RESIZE_MODE_FORCE_RESIZEABLE = 4;
200 /**
skuhne@google.com322347b2016-12-02 12:54:03 -0800201 * 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 Ogunwaled26176f2016-01-25 20:04:04 -0800219 * Value indicating if the resizing mode the activity supports.
220 * See {@link android.R.attr#resizeableActivity}.
221 * @hide
222 */
Wale Ogunwale8f6c9252016-04-29 16:46:47 -0700223 public int resizeMode = RESIZE_MODE_RESIZEABLE;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800224
225 /**
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700226 * 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 Brunkf56c9f42016-04-22 18:20:55 -0700235 * 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 Guy48327452017-01-23 17:03:35 -0800242 * 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 Project9066cfe2009-03-03 19:31:44 -0800280 * 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 Hackbornffa42482009-09-23 22:20:11 -0700339 * 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 Hackborn327fbd22011-01-17 14:38:50 -0800345 /**
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 Ogunwale6dfdfd62015-04-15 12:01:38 -0700351 * 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 Mautner5962b122012-10-05 14:45:52 -0700354 * @hide
355 */
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700356 public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
Craig Mautner5962b122012-10-05 14:45:52 -0700357 /**
John Spurlock322d7712013-09-05 02:39:46 +0000358 * Bit in {@link #flags} corresponding to an immersive activity
Daniel Sandler613dde42010-06-21 13:46:39 -0400359 * 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 Sandler8091ca52010-06-22 13:58:46 -0400364 * {@link android.app.Notification#fullScreenIntent fullScreenIntent}
Daniel Sandler613dde42010-06-21 13:46:39 -0400365 * 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 Tate73c2aee2012-03-15 16:27:14 -0700370 *
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 Sandler613dde42010-06-21 13:46:39 -0400378 */
Craig Mautner5962b122012-10-05 14:45:52 -0700379 public static final int FLAG_IMMERSIVE = 0x0800;
Romain Guy529b60a2010-08-03 18:05:47 -0700380 /**
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700381 * 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 Hackborna4e102e2014-09-04 22:52:27 -0700384 * {@link android.R.attr#relinquishTaskIdentity} attribute.
Craig Mautner9d4e9bc2014-06-18 18:34:56 -0700385 */
386 public static final int FLAG_RELINQUISH_TASK_IDENTITY = 0x1000;
387 /**
Craig Mautner2dac0562014-05-06 09:06:44 -0700388 * 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 Hackborna4e102e2014-09-04 22:52:27 -0700390 * Corresponds to {@link android.R.attr#autoRemoveFromRecents}
Craig Mautner2dac0562014-05-06 09:06:44 -0700391 */
392 public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 0x2000;
393 /**
Dianne Hackborna4e102e2014-09-04 22:52:27 -0700394 * 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 Brunkdd18a0b2015-12-04 16:16:31 -0800400 * 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 Ogunwale6cae7652015-12-26 07:36:26 -0800405
406 /**
Wale Ogunwale6cae7652015-12-26 07:36:26 -0800407 * 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 Brunkdd18a0b2015-12-04 16:16:31 -0800414 /**
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700415 * 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 Kennedy7bc3a702016-12-08 14:54:48 -0800418 * @hide
419 */
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700420 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 Kennedy7bc3a702016-12-08 14:54:48 -0800435
436 /**
Winson Chungd3395382016-12-13 11:49:09 -0800437 * Bit in {@link #flags} indicating if the activity supports picture-in-picture mode.
438 * See {@link android.R.attr#supportsPictureInPicture}.
439 * @hide
440 */
Todd Kennedyc05f5d12017-04-25 11:11:40 -0700441 public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x400000;
chaviw59b98852017-06-13 12:05:44 -0700442
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 Chungd3395382016-12-13 11:49:09 -0800458 /**
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700459 * @hide Bit in {@link #flags}: If set, this component will only be seen
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700460 * by the system user. Only works with broadcast receivers. Set from the
461 * android.R.attr#systemUserOnly attribute.
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700462 */
Fyodor Kupolov4f5de342015-08-25 10:08:45 -0700463 public static final int FLAG_SYSTEM_USER_ONLY = 0x20000000;
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -0700464 /**
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700465 * 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 Hackbornd4ac8d72012-09-27 23:20:10 -0700468 * only relevant for ActivityInfo structures that are describing receiver
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700469 * components; it is not applied to activities.
470 */
471 public static final int FLAG_SINGLE_USER = 0x40000000;
472 /**
Craig Mautnerffd14a12014-04-23 21:38:50 -0700473 * @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 Ganovf2acc542015-11-06 09:02:00 -0800475 * this activity is launched into such a container a SecurityException will be
Craig Mautnerffd14a12014-04-23 21:38:50 -0700476 * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute.
477 */
478 public static final int FLAG_ALLOW_EMBEDDED = 0x80000000;
chaviw59b98852017-06-13 12:05:44 -0700479
Craig Mautnerffd14a12014-04-23 21:38:50 -0700480 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800481 * Options that have been set in the activity declaration in the
Daniel Sandler613dde42010-06-21 13:46:39 -0400482 * manifest.
483 * These include:
484 * {@link #FLAG_MULTIPROCESS},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 * {@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 Hackbornffa42482009-09-23 22:20:11 -0700488 * {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
Daniel Sandler613dde42010-06-21 13:46:39 -0400489 * {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
Dianne Hackborn7d19e022012-08-07 19:12:33 -0700490 * {@link #FLAG_HARDWARE_ACCELERATED}, {@link #FLAG_SINGLE_USER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800491 */
492 public int flags;
493
Tor Norbyed9273d62013-05-30 15:59:53 -0700494 /** @hide */
495 @IntDef({
Wale Ogunwale51362492016-09-08 17:49:17 -0700496 SCREEN_ORIENTATION_UNSET,
Tor Norbyed9273d62013-05-30 15:59:53 -0700497 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 Project9066cfe2009-03-03 19:31:44 -0800517 /**
Wale Ogunwale51362492016-09-08 17:49:17 -0700518 * 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 Project9066cfe2009-03-03 19:31:44 -0800527 * 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 Gruszczynskid2f1d942015-10-14 15:10:12 -0700556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 /**
Dianne Hackborne5439f22010-10-02 16:53:50 -0700558 * Constant corresponding to <code>nosensor</code> in
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800559 * the {@link android.R.attr#screenOrientation} attribute.
560 */
561 public static final int SCREEN_ORIENTATION_NOSENSOR = 5;
Dianne Hackborne5439f22010-10-02 16:53:50 -0700562
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 Project9066cfe2009-03-03 19:31:44 -0800593 /**
Dianne Hackbornb9ec1ac2013-04-10 17:34:25 -0700594 * 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 Project9066cfe2009-03-03 19:31:44 -0800618 * 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 Gruszczynskid2f1d942015-10-14 15:10:12 -0700621 * {@link #SCREEN_ORIENTATION_LANDSCAPE},
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 * {@link #SCREEN_ORIENTATION_PORTRAIT},
623 * {@link #SCREEN_ORIENTATION_USER},
624 * {@link #SCREEN_ORIENTATION_BEHIND},
625 * {@link #SCREEN_ORIENTATION_SENSOR},
Dianne Hackborne5439f22010-10-02 16:53:50 -0700626 * {@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 Hackbornb9ec1ac2013-04-10 17:34:25 -0700631 * {@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 Project9066cfe2009-03-03 19:31:44 -0800636 */
Tor Norbyed9273d62013-05-30 15:59:53 -0700637 @ScreenOrientation
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 public int screenOrientation = SCREEN_ORIENTATION_UNSPECIFIED;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700639
Alan Viveretteac85f902016-03-11 15:15:51 -0500640 /** @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 Guy48327452017-01-23 17:03:35 -0800657 CONFIG_COLOR_MODE,
Alan Viveretteac85f902016-03-11 15:15:51 -0500658 CONFIG_FONT_SCALE,
659 })
660 @Retention(RetentionPolicy.SOURCE)
661 public @interface Config {}
662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800663 /**
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 Hackborn93e462b2009-09-15 22:50:40 -0700695 * 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 Project9066cfe2009-03-03 19:31:44 -0800698 * 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 Hackborn723738c2009-06-25 19:48:04 -0700715 * 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 Haamel27b28b32010-02-09 23:09:17 +0100721 * can itself handle the ui mode. Set from the
722 * {@link android.R.attr#configChanges} attribute.
Tobias Haamel27b28b32010-02-09 23:09:17 +0100723 */
724 public static final int CONFIG_UI_MODE = 0x0200;
725 /**
726 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700727 * can itself handle the screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700728 * {@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 Hackbornebff8f92011-05-12 18:07:47 -0700735 */
736 public static final int CONFIG_SCREEN_SIZE = 0x0400;
737 /**
738 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn69cb8752011-05-19 18:13:32 -0700739 * can itself handle the smallest screen size. Set from the
Dianne Hackborne6676352011-06-01 16:51:20 -0700740 * {@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 Hackborn69cb8752011-05-19 18:13:32 -0700747 */
748 public static final int CONFIG_SMALLEST_SCREEN_SIZE = 0x0800;
749 /**
750 * Bit in {@link #configChanges} that indicates that the activity
Dianne Hackborn908aecc2012-07-31 16:37:34 -0700751 * 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 Meglio5f797992012-06-15 20:16:41 -0700757 * 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 Guyc9ba5592017-01-18 16:34:42 -0800763 * 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 Guy48327452017-01-23 17:03:35 -0800766 public static final int CONFIG_COLOR_MODE = 0x4000;
Romain Guyc9ba5592017-01-18 16:34:42 -0800767 /**
768 * Bit in {@link #configChanges} that indicates that the activity
MÃ¥rten Kongstad49a4a1d2017-01-12 08:36:37 +0100769 * 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 Project9066cfe2009-03-03 19:31:44 -0800777 * can itself handle changes to the font scaling factor. Set from the
778 * {@link android.R.attr#configChanges} attribute. This is
Fabrice Di Megliodc25d252013-04-09 18:04:29 -0700779 * not a core resource configuration, but a higher-level value, so its
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800780 * constant starts at the high bits.
781 */
782 public static final int CONFIG_FONT_SCALE = 0x40000000;
Wale Ogunwale822e5122017-07-26 06:02:24 -0700783 /**
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 Gruszczynskid2f1d942015-10-14 15:10:12 -0700790
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700791 /** @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 Hackborn1d0b1772013-09-06 14:02:54 -0700797 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 Guy48327452017-01-23 17:03:35 -0800811 Configuration.NATIVE_CONFIG_COLOR_MODE, // COLOR_MODE
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700812 };
Alan Viverettec1d52792015-05-05 09:49:03 -0700813
814 /**
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700815 * Convert Java change bits to native.
Alan Viverettec1d52792015-05-05 09:49:03 -0700816 *
817 * @hide
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700818 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500819 public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700820 int output = 0;
Alan Viverettec1d52792015-05-05 09:49:03 -0700821 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
822 if ((input & (1 << i)) != 0) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700823 output |= CONFIG_NATIVE_BITS[i];
824 }
825 }
826 return output;
827 }
828
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 /**
Alan Viverettec1d52792015-05-05 09:49:03 -0700830 * Convert native change bits to Java.
831 *
832 * @hide
833 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500834 public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) {
Alan Viverettec1d52792015-05-05 09:49:03 -0700835 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 Hackborne6676352011-06-01 16:51:20 -0700845 * @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 Project9066cfe2009-03-03 19:31:44 -0800860 * 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 Hackborn723738c2009-06-25 19:48:04 -0700865 * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500866 * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT},
Romain Guyc9ba5592017-01-18 16:34:42 -0800867 * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION} and
Romain Guy48327452017-01-23 17:03:35 -0800868 * {@link #CONFIG_COLOR_MODE}.
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500869 * Set from the {@link android.R.attr#configChanges} attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800870 */
871 public int configChanges;
Craig Mautner15df08a2015-04-01 12:17:18 -0700872
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 /**
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 Yukawa22dac1c2017-02-12 16:54:16 -0800881 @android.view.WindowManager.LayoutParams.SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 public int softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700883
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 Maine797ed62011-09-22 16:17:45 -0700892 * 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 Powell269248d2011-08-02 10:26:54 -0700897 */
898 public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
899
Adam Powelldd8fab22012-03-22 17:47:27 -0700900 /**
901 * If defined, the activity named here is the logical parent of this activity.
902 */
903 public String parentActivityName;
904
Robert Carr0f5d7532016-10-17 16:39:17 -0700905 /**
906 * Screen rotation animation desired by the activity, with values as defined
907 * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}.
Robert Carrc0149bf2017-05-01 15:22:22 -0700908 *
909 * -1 means to use the system default.
910 *
Robert Carr0f5d7532016-10-17 16:39:17 -0700911 * @hide
912 */
Robert Carrc0149bf2017-05-01 15:22:22 -0700913 public int rotationAnimation = -1;
Robert Carr0f5d7532016-10-17 16:39:17 -0700914
Craig Mautner15df08a2015-04-01 12:17:18 -0700915 /** @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 Kulian2e751b82016-03-16 16:59:32 -0700946 /**
947 * Information about desired position and size of activity on the display when
948 * it is first started.
949 */
950 public WindowLayout windowLayout;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700951
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800952 public ActivityInfo() {
953 }
954
955 public ActivityInfo(ActivityInfo orig) {
956 super(orig);
957 theme = orig.theme;
958 launchMode = orig.launchMode;
Robert Carr3e2e0112015-09-15 12:30:42 -0700959 documentLaunchMode = orig.documentLaunchMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800960 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 Powell269248d2011-08-02 10:26:54 -0700967 uiOptions = orig.uiOptions;
Adam Powelldd8fab22012-03-22 17:47:27 -0700968 parentActivityName = orig.parentActivityName;
Craig Mautner8307ea72014-09-11 15:03:53 -0700969 maxRecents = orig.maxRecents;
Craig Mautner15df08a2015-04-01 12:17:18 -0700970 lockTaskLaunchMode = orig.lockTaskLaunchMode;
Andrii Kulian2e751b82016-03-16 16:59:32 -0700971 windowLayout = orig.windowLayout;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800972 resizeMode = orig.resizeMode;
Ruben Brunkf56c9f42016-04-22 18:20:55 -0700973 requestedVrComponent = orig.requestedVrComponent;
Robert Carr0f5d7532016-10-17 16:39:17 -0700974 rotationAnimation = orig.rotationAnimation;
Romain Guy48327452017-01-23 17:03:35 -0800975 colorMode = orig.colorMode;
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700976 maxAspectRatio = orig.maxAspectRatio;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 }
Craig Mautner15df08a2015-04-01 12:17:18 -0700978
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 /**
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 Mautner15df08a2015-04-01 12:17:18 -0700983 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800984 * @return The theme associated with this activity.
985 */
986 public final int getThemeResource() {
987 return theme != 0 ? theme : applicationInfo.theme;
988 }
989
Craig Mautner43e52ed2014-06-16 17:18:52 -0700990 private String persistableModeToString() {
991 switch(persistableMode) {
992 case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
Craig Mautner7f72f532014-07-21 10:07:12 -0700993 case PERSIST_NEVER: return "PERSIST_NEVER";
Craig Mautner43e52ed2014-06-16 17:18:52 -0700994 case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
995 default: return "UNKNOWN=" + persistableMode;
996 }
997 }
998
Wale Ogunwale508ff552016-02-15 19:31:50 -0800999 /**
1000 * Returns true if the activity's orientation is fixed.
1001 * @hide
1002 */
Bryce Lee39791592017-04-26 09:29:12 -07001003 public boolean isFixedOrientation() {
skuhne@google.com322347b2016-12-02 12:54:03 -08001004 return isFixedOrientationLandscape() || isFixedOrientationPortrait()
Wale Ogunwale508ff552016-02-15 19:31:50 -08001005 || screenOrientation == SCREEN_ORIENTATION_LOCKED;
1006 }
1007
skuhne@google.com322347b2016-12-02 12:54:03 -08001008 /**
Bryce Lee39791592017-04-26 09:29:12 -07001009 * 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.com322347b2016-12-02 12:54:03 -08001017 * Returns true if the activity's orientation is fixed to landscape.
1018 * @hide
1019 */
1020 boolean isFixedOrientationLandscape() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001021 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.com322347b2016-12-02 12:54:03 -08001033 }
1034
1035 /**
1036 * Returns true if the activity's orientation is fixed to portrait.
1037 * @hide
1038 */
1039 boolean isFixedOrientationPortrait() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001040 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.com322347b2016-12-02 12:54:03 -08001052 }
1053
Winson Chungd3395382016-12-13 11:49:09 -08001054 /**
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 Ogunwaled26176f2016-01-25 20:04:04 -08001062 /** @hide */
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001063 public static boolean isResizeableMode(int mode) {
Wale Ogunwaled829d362016-02-10 19:24:49 -08001064 return mode == RESIZE_MODE_RESIZEABLE
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001065 || mode == RESIZE_MODE_FORCE_RESIZEABLE
skuhne@google.com322347b2016-12-02 12:54:03 -08001066 || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
1067 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
1068 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001069 || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001070 }
1071
1072 /** @hide */
skuhne@google.com322347b2016-12-02 12:54:03 -08001073 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 Ogunwaleb1faf602016-01-27 09:12:31 -08001080 public static String resizeModeToString(int mode) {
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001081 switch (mode) {
1082 case RESIZE_MODE_UNRESIZEABLE:
1083 return "RESIZE_MODE_UNRESIZEABLE";
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001084 case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
1085 return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION";
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001086 case RESIZE_MODE_RESIZEABLE:
1087 return "RESIZE_MODE_RESIZEABLE";
Wale Ogunwaled829d362016-02-10 19:24:49 -08001088 case RESIZE_MODE_FORCE_RESIZEABLE:
1089 return "RESIZE_MODE_FORCE_RESIZEABLE";
skuhne@google.com322347b2016-12-02 12:54:03 -08001090 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 Ogunwaled26176f2016-01-25 20:04:04 -08001096 default:
1097 return "unknown=" + mode;
1098 }
1099 }
1100
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001102 dump(pw, prefix, DUMP_FLAG_ALL);
1103 }
1104
1105 /** @hide */
1106 public void dump(Printer pw, String prefix, int flags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -08001108 if (permission != null) {
1109 pw.println(prefix + "permission=" + permission);
1110 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001111 if ((flags&DUMP_FLAG_DETAILS) != 0) {
1112 pw.println(prefix + "taskAffinity=" + taskAffinity
1113 + " targetActivity=" + targetActivity
1114 + " persistableMode=" + persistableModeToString());
1115 }
Dianne Hackborn12527f92009-11-11 17:39:50 -08001116 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 Powell269248d2011-08-02 10:26:54 -07001127 if (uiOptions != 0) {
1128 pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
1129 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001130 if ((flags&DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001131 pw.println(prefix + "lockTaskLaunchMode="
1132 + lockTaskLaunchModeToString(lockTaskLaunchMode));
1133 }
Andrii Kulian2e751b82016-03-16 16:59:32 -07001134 if (windowLayout != null) {
1135 pw.println(prefix + "windowLayout=" + windowLayout.width + "|"
1136 + windowLayout.widthFraction + ", " + windowLayout.height + "|"
1137 + windowLayout.heightFraction + ", " + windowLayout.gravity);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001138 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001139 pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001140 if (requestedVrComponent != null) {
1141 pw.println(prefix + "requestedVrComponent=" + requestedVrComponent);
1142 }
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001143 if (maxAspectRatio != 0) {
1144 pw.println(prefix + "maxAspectRatio=" + maxAspectRatio);
1145 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001146 super.dumpBack(pw, prefix, flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 }
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001149 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 Carr3e2e0112015-09-15 12:30:42 -07001163 dest.writeInt(documentLaunchMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001164 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 Powell269248d2011-08-02 10:26:54 -07001171 dest.writeInt(uiOptions);
Adam Powelldd8fab22012-03-22 17:47:27 -07001172 dest.writeString(parentActivityName);
Craig Mautner43e52ed2014-06-16 17:18:52 -07001173 dest.writeInt(persistableMode);
Craig Mautner8307ea72014-09-11 15:03:53 -07001174 dest.writeInt(maxRecents);
Craig Mautner15df08a2015-04-01 12:17:18 -07001175 dest.writeInt(lockTaskLaunchMode);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001176 if (windowLayout != null) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001177 dest.writeInt(1);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001178 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 Kulianf66a83d2016-05-17 12:17:44 -07001183 dest.writeInt(windowLayout.minWidth);
1184 dest.writeInt(windowLayout.minHeight);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001185 } else {
1186 dest.writeInt(0);
1187 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001188 dest.writeInt(resizeMode);
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001189 dest.writeString(requestedVrComponent);
Robert Carr0f5d7532016-10-17 16:39:17 -07001190 dest.writeInt(rotationAnimation);
Romain Guy48327452017-01-23 17:03:35 -08001191 dest.writeInt(colorMode);
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001192 dest.writeFloat(maxAspectRatio);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 }
1194
Bryce Lee39791592017-04-26 09:29:12 -07001195 /**
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 Project9066cfe2009-03-03 19:31:44 -08001214 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 Carr3e2e0112015-09-15 12:30:42 -07001228 documentLaunchMode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 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 Powell269248d2011-08-02 10:26:54 -07001236 uiOptions = source.readInt();
Adam Powelldd8fab22012-03-22 17:47:27 -07001237 parentActivityName = source.readString();
Craig Mautner43e52ed2014-06-16 17:18:52 -07001238 persistableMode = source.readInt();
Craig Mautner8307ea72014-09-11 15:03:53 -07001239 maxRecents = source.readInt();
Craig Mautner15df08a2015-04-01 12:17:18 -07001240 lockTaskLaunchMode = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001241 if (source.readInt() == 1) {
Andrii Kulian2e751b82016-03-16 16:59:32 -07001242 windowLayout = new WindowLayout(source);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001243 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001244 resizeMode = source.readInt();
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001245 requestedVrComponent = source.readString();
Robert Carr0f5d7532016-10-17 16:39:17 -07001246 rotationAnimation = source.readInt();
Romain Guy48327452017-01-23 17:03:35 -08001247 colorMode = source.readInt();
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001248 maxAspectRatio = source.readFloat();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001249 }
1250
Andrii Kulian2e751b82016-03-16 16:59:32 -07001251 /**
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 Kulianf66a83d2016-05-17 12:17:44 -07001261 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
1262 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001263 */
1264 public static final class WindowLayout {
1265 public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity,
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001266 int minWidth, int minHeight) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001267 this.width = width;
1268 this.widthFraction = widthFraction;
1269 this.height = height;
1270 this.heightFraction = heightFraction;
1271 this.gravity = gravity;
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001272 this.minWidth = minWidth;
1273 this.minHeight = minHeight;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001274 }
1275
Andrii Kulian2e751b82016-03-16 16:59:32 -07001276 WindowLayout(Parcel source) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001277 width = source.readInt();
1278 widthFraction = source.readFloat();
1279 height = source.readInt();
1280 heightFraction = source.readFloat();
1281 gravity = source.readInt();
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001282 minWidth = source.readInt();
1283 minHeight = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001284 }
1285
Andrii Kulian2e751b82016-03-16 16:59:32 -07001286 /**
1287 * Width of activity in pixels.
1288 *
1289 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1290 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001291 public final int width;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001292
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 Gruszczynski848fe6b2015-08-19 13:32:41 -07001299 public final float widthFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001300
1301 /**
1302 * Height of activity in pixels.
1303 *
1304 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1305 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001306 public final int height;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001307
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 Gruszczynski848fe6b2015-08-19 13:32:41 -07001314 public final float heightFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001315
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 Gruszczynski848fe6b2015-08-19 13:32:41 -07001323 public final int gravity;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001324
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 Kulianf66a83d2016-05-17 12:17:44 -07001333 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
Andrii Kulian2e751b82016-03-16 16:59:32 -07001334 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001335 public final int minWidth;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001336
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 Kulianf66a83d2016-05-17 12:17:44 -07001345 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001346 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001347 public final int minHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 }
1349}