blob: ca5fa6be132352dbdb744dd2de5b78bac75dd182 [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;
Filip Gruszczynskid2f1d942015-10-14 15:10:12 -0700783
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700784 /** @hide
785 * Unfortunately the constants for config changes in native code are
786 * different from ActivityInfo. :( Here are the values we should use for the
787 * native side given the bit we have assigned in ActivityInfo.
788 */
789 public static int[] CONFIG_NATIVE_BITS = new int[] {
Dianne Hackborn1d0b1772013-09-06 14:02:54 -0700790 Configuration.NATIVE_CONFIG_MNC, // MNC
791 Configuration.NATIVE_CONFIG_MCC, // MCC
792 Configuration.NATIVE_CONFIG_LOCALE, // LOCALE
793 Configuration.NATIVE_CONFIG_TOUCHSCREEN, // TOUCH SCREEN
794 Configuration.NATIVE_CONFIG_KEYBOARD, // KEYBOARD
795 Configuration.NATIVE_CONFIG_KEYBOARD_HIDDEN, // KEYBOARD HIDDEN
796 Configuration.NATIVE_CONFIG_NAVIGATION, // NAVIGATION
797 Configuration.NATIVE_CONFIG_ORIENTATION, // ORIENTATION
798 Configuration.NATIVE_CONFIG_SCREEN_LAYOUT, // SCREEN LAYOUT
799 Configuration.NATIVE_CONFIG_UI_MODE, // UI MODE
800 Configuration.NATIVE_CONFIG_SCREEN_SIZE, // SCREEN SIZE
801 Configuration.NATIVE_CONFIG_SMALLEST_SCREEN_SIZE, // SMALLEST SCREEN SIZE
802 Configuration.NATIVE_CONFIG_DENSITY, // DENSITY
803 Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION
Romain Guy48327452017-01-23 17:03:35 -0800804 Configuration.NATIVE_CONFIG_COLOR_MODE, // COLOR_MODE
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700805 };
Alan Viverettec1d52792015-05-05 09:49:03 -0700806
807 /**
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700808 * Convert Java change bits to native.
Alan Viverettec1d52792015-05-05 09:49:03 -0700809 *
810 * @hide
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700811 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500812 public static @NativeConfig int activityInfoConfigJavaToNative(@Config int input) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700813 int output = 0;
Alan Viverettec1d52792015-05-05 09:49:03 -0700814 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
815 if ((input & (1 << i)) != 0) {
Dianne Hackbornebff8f92011-05-12 18:07:47 -0700816 output |= CONFIG_NATIVE_BITS[i];
817 }
818 }
819 return output;
820 }
821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800822 /**
Alan Viverettec1d52792015-05-05 09:49:03 -0700823 * Convert native change bits to Java.
824 *
825 * @hide
826 */
Alan Viveretteac85f902016-03-11 15:15:51 -0500827 public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) {
Alan Viverettec1d52792015-05-05 09:49:03 -0700828 int output = 0;
829 for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
830 if ((input & CONFIG_NATIVE_BITS[i]) != 0) {
831 output |= (1 << i);
832 }
833 }
834 return output;
835 }
836
837 /**
Dianne Hackborne6676352011-06-01 16:51:20 -0700838 * @hide
839 * Unfortunately some developers (OpenFeint I am looking at you) have
840 * compared the configChanges bit field against absolute values, so if we
841 * introduce a new bit they break. To deal with that, we will make sure
842 * the public field will not have a value that breaks them, and let the
843 * framework call here to get the real value.
844 */
845 public int getRealConfigChanged() {
846 return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
847 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
848 | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
849 : configChanges;
850 }
851
852 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800853 * Bit mask of kinds of configuration changes that this activity
854 * can handle itself (without being restarted by the system).
855 * Contains any combination of {@link #CONFIG_FONT_SCALE},
856 * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
857 * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700858 * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500859 * {@link #CONFIG_ORIENTATION}, {@link #CONFIG_SCREEN_LAYOUT},
Romain Guyc9ba5592017-01-18 16:34:42 -0800860 * {@link #CONFIG_DENSITY}, {@link #CONFIG_LAYOUT_DIRECTION} and
Romain Guy48327452017-01-23 17:03:35 -0800861 * {@link #CONFIG_COLOR_MODE}.
Alan Viverette28c4a0b2015-11-20 17:23:46 -0500862 * Set from the {@link android.R.attr#configChanges} attribute.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800863 */
864 public int configChanges;
Craig Mautner15df08a2015-04-01 12:17:18 -0700865
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800866 /**
867 * The desired soft input mode for this activity's main window.
868 * Set from the {@link android.R.attr#windowSoftInputMode} attribute
869 * in the activity's manifest. May be any of the same values allowed
870 * for {@link android.view.WindowManager.LayoutParams#softInputMode
871 * WindowManager.LayoutParams.softInputMode}. If 0 (unspecified),
872 * the mode from the theme will be used.
873 */
Yohei Yukawa22dac1c2017-02-12 16:54:16 -0800874 @android.view.WindowManager.LayoutParams.SoftInputModeFlags
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 public int softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700876
877 /**
878 * The desired extra UI options for this activity and its main window.
879 * Set from the {@link android.R.attr#uiOptions} attribute in the
880 * activity's manifest.
881 */
882 public int uiOptions = 0;
883
884 /**
Scott Maine797ed62011-09-22 16:17:45 -0700885 * Flag for use with {@link #uiOptions}.
886 * Indicates that the action bar should put all action items in a separate bar when
887 * the screen is narrow.
888 * <p>This value corresponds to "splitActionBarWhenNarrow" for the {@link #uiOptions} XML
889 * attribute.
Adam Powell269248d2011-08-02 10:26:54 -0700890 */
891 public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1;
892
Adam Powelldd8fab22012-03-22 17:47:27 -0700893 /**
894 * If defined, the activity named here is the logical parent of this activity.
895 */
896 public String parentActivityName;
897
Robert Carr0f5d7532016-10-17 16:39:17 -0700898 /**
899 * Screen rotation animation desired by the activity, with values as defined
900 * for {@link android.view.WindowManager.LayoutParams#rotationAnimation}.
Robert Carrc0149bf2017-05-01 15:22:22 -0700901 *
902 * -1 means to use the system default.
903 *
Robert Carr0f5d7532016-10-17 16:39:17 -0700904 * @hide
905 */
Robert Carrc0149bf2017-05-01 15:22:22 -0700906 public int rotationAnimation = -1;
Robert Carr0f5d7532016-10-17 16:39:17 -0700907
Craig Mautner15df08a2015-04-01 12:17:18 -0700908 /** @hide */
909 public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0;
910 /** @hide */
911 public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1;
912 /** @hide */
913 public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2;
914 /** @hide */
915 public static final int LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED = 3;
916
917 /** @hide */
918 public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) {
919 switch (lockTaskLaunchMode) {
920 case LOCK_TASK_LAUNCH_MODE_DEFAULT:
921 return "LOCK_TASK_LAUNCH_MODE_DEFAULT";
922 case LOCK_TASK_LAUNCH_MODE_NEVER:
923 return "LOCK_TASK_LAUNCH_MODE_NEVER";
924 case LOCK_TASK_LAUNCH_MODE_ALWAYS:
925 return "LOCK_TASK_LAUNCH_MODE_ALWAYS";
926 case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED:
927 return "LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED";
928 default:
929 return "unknown=" + lockTaskLaunchMode;
930 }
931 }
932 /**
933 * Value indicating if the activity is to be locked at startup. Takes on the values from
934 * {@link android.R.attr#lockTaskMode}.
935 * @hide
936 */
937 public int lockTaskLaunchMode;
938
Andrii Kulian2e751b82016-03-16 16:59:32 -0700939 /**
940 * Information about desired position and size of activity on the display when
941 * it is first started.
942 */
943 public WindowLayout windowLayout;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -0700944
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 public ActivityInfo() {
946 }
947
948 public ActivityInfo(ActivityInfo orig) {
949 super(orig);
950 theme = orig.theme;
951 launchMode = orig.launchMode;
Robert Carr3e2e0112015-09-15 12:30:42 -0700952 documentLaunchMode = orig.documentLaunchMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800953 permission = orig.permission;
954 taskAffinity = orig.taskAffinity;
955 targetActivity = orig.targetActivity;
956 flags = orig.flags;
957 screenOrientation = orig.screenOrientation;
958 configChanges = orig.configChanges;
959 softInputMode = orig.softInputMode;
Adam Powell269248d2011-08-02 10:26:54 -0700960 uiOptions = orig.uiOptions;
Adam Powelldd8fab22012-03-22 17:47:27 -0700961 parentActivityName = orig.parentActivityName;
Craig Mautner8307ea72014-09-11 15:03:53 -0700962 maxRecents = orig.maxRecents;
Craig Mautner15df08a2015-04-01 12:17:18 -0700963 lockTaskLaunchMode = orig.lockTaskLaunchMode;
Andrii Kulian2e751b82016-03-16 16:59:32 -0700964 windowLayout = orig.windowLayout;
Wale Ogunwaled26176f2016-01-25 20:04:04 -0800965 resizeMode = orig.resizeMode;
Ruben Brunkf56c9f42016-04-22 18:20:55 -0700966 requestedVrComponent = orig.requestedVrComponent;
Robert Carr0f5d7532016-10-17 16:39:17 -0700967 rotationAnimation = orig.rotationAnimation;
Romain Guy48327452017-01-23 17:03:35 -0800968 colorMode = orig.colorMode;
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -0700969 maxAspectRatio = orig.maxAspectRatio;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800970 }
Craig Mautner15df08a2015-04-01 12:17:18 -0700971
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 /**
973 * Return the theme resource identifier to use for this activity. If
974 * the activity defines a theme, that is used; else, the application
975 * theme is used.
Craig Mautner15df08a2015-04-01 12:17:18 -0700976 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800977 * @return The theme associated with this activity.
978 */
979 public final int getThemeResource() {
980 return theme != 0 ? theme : applicationInfo.theme;
981 }
982
Craig Mautner43e52ed2014-06-16 17:18:52 -0700983 private String persistableModeToString() {
984 switch(persistableMode) {
985 case PERSIST_ROOT_ONLY: return "PERSIST_ROOT_ONLY";
Craig Mautner7f72f532014-07-21 10:07:12 -0700986 case PERSIST_NEVER: return "PERSIST_NEVER";
Craig Mautner43e52ed2014-06-16 17:18:52 -0700987 case PERSIST_ACROSS_REBOOTS: return "PERSIST_ACROSS_REBOOTS";
988 default: return "UNKNOWN=" + persistableMode;
989 }
990 }
991
Wale Ogunwale508ff552016-02-15 19:31:50 -0800992 /**
993 * Returns true if the activity's orientation is fixed.
994 * @hide
995 */
Bryce Lee39791592017-04-26 09:29:12 -0700996 public boolean isFixedOrientation() {
skuhne@google.com322347b2016-12-02 12:54:03 -0800997 return isFixedOrientationLandscape() || isFixedOrientationPortrait()
Wale Ogunwale508ff552016-02-15 19:31:50 -0800998 || screenOrientation == SCREEN_ORIENTATION_LOCKED;
999 }
1000
skuhne@google.com322347b2016-12-02 12:54:03 -08001001 /**
Bryce Lee39791592017-04-26 09:29:12 -07001002 * Returns true if the specified orientation is considered fixed.
1003 * @hide
1004 */
1005 static public boolean isFixedOrientation(int orientation) {
1006 return isFixedOrientationLandscape(orientation) || isFixedOrientationPortrait(orientation);
1007 }
1008
1009 /**
skuhne@google.com322347b2016-12-02 12:54:03 -08001010 * Returns true if the activity's orientation is fixed to landscape.
1011 * @hide
1012 */
1013 boolean isFixedOrientationLandscape() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001014 return isFixedOrientationLandscape(screenOrientation);
1015 }
1016
1017 /**
1018 * Returns true if the activity's orientation is fixed to landscape.
1019 * @hide
1020 */
1021 public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) {
1022 return orientation == SCREEN_ORIENTATION_LANDSCAPE
1023 || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE
1024 || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE
1025 || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE;
skuhne@google.com322347b2016-12-02 12:54:03 -08001026 }
1027
1028 /**
1029 * Returns true if the activity's orientation is fixed to portrait.
1030 * @hide
1031 */
1032 boolean isFixedOrientationPortrait() {
Wale Ogunwaled4b1d1e2017-04-10 06:35:59 -07001033 return isFixedOrientationPortrait(screenOrientation);
1034 }
1035
1036 /**
1037 * Returns true if the activity's orientation is fixed to portrait.
1038 * @hide
1039 */
1040 public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) {
1041 return orientation == SCREEN_ORIENTATION_PORTRAIT
1042 || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT
1043 || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT
1044 || orientation == SCREEN_ORIENTATION_USER_PORTRAIT;
skuhne@google.com322347b2016-12-02 12:54:03 -08001045 }
1046
Winson Chungd3395382016-12-13 11:49:09 -08001047 /**
1048 * Returns true if the activity supports picture-in-picture.
1049 * @hide
1050 */
1051 public boolean supportsPictureInPicture() {
1052 return (flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0;
1053 }
1054
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001055 /** @hide */
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001056 public static boolean isResizeableMode(int mode) {
Wale Ogunwaled829d362016-02-10 19:24:49 -08001057 return mode == RESIZE_MODE_RESIZEABLE
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001058 || mode == RESIZE_MODE_FORCE_RESIZEABLE
skuhne@google.com322347b2016-12-02 12:54:03 -08001059 || mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
1060 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
1061 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001062 || mode == RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001063 }
1064
1065 /** @hide */
skuhne@google.com322347b2016-12-02 12:54:03 -08001066 public static boolean isPreserveOrientationMode(int mode) {
1067 return mode == RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY
1068 || mode == RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY
1069 || mode == RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION;
1070 }
1071
1072 /** @hide */
Wale Ogunwaleb1faf602016-01-27 09:12:31 -08001073 public static String resizeModeToString(int mode) {
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001074 switch (mode) {
1075 case RESIZE_MODE_UNRESIZEABLE:
1076 return "RESIZE_MODE_UNRESIZEABLE";
Wale Ogunwale72a73e32016-10-13 12:16:39 -07001077 case RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
1078 return "RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION";
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001079 case RESIZE_MODE_RESIZEABLE:
1080 return "RESIZE_MODE_RESIZEABLE";
Wale Ogunwaled829d362016-02-10 19:24:49 -08001081 case RESIZE_MODE_FORCE_RESIZEABLE:
1082 return "RESIZE_MODE_FORCE_RESIZEABLE";
skuhne@google.com322347b2016-12-02 12:54:03 -08001083 case RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY:
1084 return "RESIZE_MODE_FORCE_RESIZABLE_PORTRAIT_ONLY";
1085 case RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY:
1086 return "RESIZE_MODE_FORCE_RESIZABLE_LANDSCAPE_ONLY";
1087 case RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION:
1088 return "RESIZE_MODE_FORCE_RESIZABLE_PRESERVE_ORIENTATION";
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001089 default:
1090 return "unknown=" + mode;
1091 }
1092 }
1093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 public void dump(Printer pw, String prefix) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001095 dump(pw, prefix, DUMP_FLAG_ALL);
1096 }
1097
1098 /** @hide */
1099 public void dump(Printer pw, String prefix, int flags) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -08001101 if (permission != null) {
1102 pw.println(prefix + "permission=" + permission);
1103 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001104 if ((flags&DUMP_FLAG_DETAILS) != 0) {
1105 pw.println(prefix + "taskAffinity=" + taskAffinity
1106 + " targetActivity=" + targetActivity
1107 + " persistableMode=" + persistableModeToString());
1108 }
Dianne Hackborn12527f92009-11-11 17:39:50 -08001109 if (launchMode != 0 || flags != 0 || theme != 0) {
1110 pw.println(prefix + "launchMode=" + launchMode
1111 + " flags=0x" + Integer.toHexString(flags)
1112 + " theme=0x" + Integer.toHexString(theme));
1113 }
1114 if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
1115 || configChanges != 0 || softInputMode != 0) {
1116 pw.println(prefix + "screenOrientation=" + screenOrientation
1117 + " configChanges=0x" + Integer.toHexString(configChanges)
1118 + " softInputMode=0x" + Integer.toHexString(softInputMode));
1119 }
Adam Powell269248d2011-08-02 10:26:54 -07001120 if (uiOptions != 0) {
1121 pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
1122 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001123 if ((flags&DUMP_FLAG_DETAILS) != 0) {
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001124 pw.println(prefix + "lockTaskLaunchMode="
1125 + lockTaskLaunchModeToString(lockTaskLaunchMode));
1126 }
Andrii Kulian2e751b82016-03-16 16:59:32 -07001127 if (windowLayout != null) {
1128 pw.println(prefix + "windowLayout=" + windowLayout.width + "|"
1129 + windowLayout.widthFraction + ", " + windowLayout.height + "|"
1130 + windowLayout.heightFraction + ", " + windowLayout.gravity);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001131 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001132 pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001133 if (requestedVrComponent != null) {
1134 pw.println(prefix + "requestedVrComponent=" + requestedVrComponent);
1135 }
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001136 if (maxAspectRatio != 0) {
1137 pw.println(prefix + "maxAspectRatio=" + maxAspectRatio);
1138 }
Dianne Hackborn6ac42ae2015-12-08 17:22:10 -08001139 super.dumpBack(pw, prefix, flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001140 }
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 public String toString() {
1143 return "ActivityInfo{"
1144 + Integer.toHexString(System.identityHashCode(this))
1145 + " " + name + "}";
1146 }
1147
1148 public int describeContents() {
1149 return 0;
1150 }
1151
1152 public void writeToParcel(Parcel dest, int parcelableFlags) {
1153 super.writeToParcel(dest, parcelableFlags);
1154 dest.writeInt(theme);
1155 dest.writeInt(launchMode);
Robert Carr3e2e0112015-09-15 12:30:42 -07001156 dest.writeInt(documentLaunchMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 dest.writeString(permission);
1158 dest.writeString(taskAffinity);
1159 dest.writeString(targetActivity);
1160 dest.writeInt(flags);
1161 dest.writeInt(screenOrientation);
1162 dest.writeInt(configChanges);
1163 dest.writeInt(softInputMode);
Adam Powell269248d2011-08-02 10:26:54 -07001164 dest.writeInt(uiOptions);
Adam Powelldd8fab22012-03-22 17:47:27 -07001165 dest.writeString(parentActivityName);
Craig Mautner43e52ed2014-06-16 17:18:52 -07001166 dest.writeInt(persistableMode);
Craig Mautner8307ea72014-09-11 15:03:53 -07001167 dest.writeInt(maxRecents);
Craig Mautner15df08a2015-04-01 12:17:18 -07001168 dest.writeInt(lockTaskLaunchMode);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001169 if (windowLayout != null) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001170 dest.writeInt(1);
Andrii Kulian2e751b82016-03-16 16:59:32 -07001171 dest.writeInt(windowLayout.width);
1172 dest.writeFloat(windowLayout.widthFraction);
1173 dest.writeInt(windowLayout.height);
1174 dest.writeFloat(windowLayout.heightFraction);
1175 dest.writeInt(windowLayout.gravity);
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001176 dest.writeInt(windowLayout.minWidth);
1177 dest.writeInt(windowLayout.minHeight);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001178 } else {
1179 dest.writeInt(0);
1180 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001181 dest.writeInt(resizeMode);
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001182 dest.writeString(requestedVrComponent);
Robert Carr0f5d7532016-10-17 16:39:17 -07001183 dest.writeInt(rotationAnimation);
Romain Guy48327452017-01-23 17:03:35 -08001184 dest.writeInt(colorMode);
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001185 dest.writeFloat(maxAspectRatio);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 }
1187
Bryce Lee39791592017-04-26 09:29:12 -07001188 /**
1189 * Determines whether the {@link Activity} is considered translucent or floating.
1190 * @hide
1191 */
1192 public static boolean isTranslucentOrFloating(TypedArray attributes) {
1193 final boolean isTranslucent =
1194 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,
1195 false);
1196 final boolean isSwipeToDismiss = !attributes.hasValue(
1197 com.android.internal.R.styleable.Window_windowIsTranslucent)
1198 && attributes.getBoolean(
1199 com.android.internal.R.styleable.Window_windowSwipeToDismiss, false);
1200 final boolean isFloating =
1201 attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,
1202 false);
1203
1204 return isFloating || isTranslucent || isSwipeToDismiss;
1205 }
1206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001207 public static final Parcelable.Creator<ActivityInfo> CREATOR
1208 = new Parcelable.Creator<ActivityInfo>() {
1209 public ActivityInfo createFromParcel(Parcel source) {
1210 return new ActivityInfo(source);
1211 }
1212 public ActivityInfo[] newArray(int size) {
1213 return new ActivityInfo[size];
1214 }
1215 };
1216
1217 private ActivityInfo(Parcel source) {
1218 super(source);
1219 theme = source.readInt();
1220 launchMode = source.readInt();
Robert Carr3e2e0112015-09-15 12:30:42 -07001221 documentLaunchMode = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 permission = source.readString();
1223 taskAffinity = source.readString();
1224 targetActivity = source.readString();
1225 flags = source.readInt();
1226 screenOrientation = source.readInt();
1227 configChanges = source.readInt();
1228 softInputMode = source.readInt();
Adam Powell269248d2011-08-02 10:26:54 -07001229 uiOptions = source.readInt();
Adam Powelldd8fab22012-03-22 17:47:27 -07001230 parentActivityName = source.readString();
Craig Mautner43e52ed2014-06-16 17:18:52 -07001231 persistableMode = source.readInt();
Craig Mautner8307ea72014-09-11 15:03:53 -07001232 maxRecents = source.readInt();
Craig Mautner15df08a2015-04-01 12:17:18 -07001233 lockTaskLaunchMode = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001234 if (source.readInt() == 1) {
Andrii Kulian2e751b82016-03-16 16:59:32 -07001235 windowLayout = new WindowLayout(source);
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001236 }
Wale Ogunwaled26176f2016-01-25 20:04:04 -08001237 resizeMode = source.readInt();
Ruben Brunkf56c9f42016-04-22 18:20:55 -07001238 requestedVrComponent = source.readString();
Robert Carr0f5d7532016-10-17 16:39:17 -07001239 rotationAnimation = source.readInt();
Romain Guy48327452017-01-23 17:03:35 -08001240 colorMode = source.readInt();
Wale Ogunwale55ddf8f2017-03-20 08:56:38 -07001241 maxAspectRatio = source.readFloat();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001242 }
1243
Andrii Kulian2e751b82016-03-16 16:59:32 -07001244 /**
1245 * Contains information about position and size of the activity on the display.
1246 *
1247 * Used in freeform mode to set desired position when activity is first launched.
1248 * It describes how big the activity wants to be in both width and height,
1249 * the minimal allowed size, and the gravity to be applied.
1250 *
1251 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1252 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1253 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001254 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
1255 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001256 */
1257 public static final class WindowLayout {
1258 public WindowLayout(int width, float widthFraction, int height, float heightFraction, int gravity,
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001259 int minWidth, int minHeight) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001260 this.width = width;
1261 this.widthFraction = widthFraction;
1262 this.height = height;
1263 this.heightFraction = heightFraction;
1264 this.gravity = gravity;
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001265 this.minWidth = minWidth;
1266 this.minHeight = minHeight;
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001267 }
1268
Andrii Kulian2e751b82016-03-16 16:59:32 -07001269 WindowLayout(Parcel source) {
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001270 width = source.readInt();
1271 widthFraction = source.readFloat();
1272 height = source.readInt();
1273 heightFraction = source.readFloat();
1274 gravity = source.readInt();
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001275 minWidth = source.readInt();
1276 minHeight = source.readInt();
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001277 }
1278
Andrii Kulian2e751b82016-03-16 16:59:32 -07001279 /**
1280 * Width of activity in pixels.
1281 *
1282 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1283 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001284 public final int width;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001285
1286 /**
1287 * Width of activity as a fraction of available display width.
1288 * If both {@link #width} and this value are set this one will be preferred.
1289 *
1290 * @attr ref android.R.styleable#AndroidManifestLayout_defaultWidth
1291 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001292 public final float widthFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001293
1294 /**
1295 * Height of activity in pixels.
1296 *
1297 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1298 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001299 public final int height;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001300
1301 /**
1302 * Height of activity as a fraction of available display height.
1303 * If both {@link #height} and this value are set this one will be preferred.
1304 *
1305 * @attr ref android.R.styleable#AndroidManifestLayout_defaultHeight
1306 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001307 public final float heightFraction;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001308
1309 /**
1310 * Gravity of activity.
1311 * Currently {@link android.view.Gravity#TOP}, {@link android.view.Gravity#BOTTOM},
1312 * {@link android.view.Gravity#LEFT} and {@link android.view.Gravity#RIGHT} are supported.
1313 *
1314 * @attr ref android.R.styleable#AndroidManifestLayout_gravity
1315 */
Filip Gruszczynski848fe6b2015-08-19 13:32:41 -07001316 public final int gravity;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001317
1318 /**
1319 * Minimal width of activity in pixels to be able to display its content.
1320 *
1321 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1322 * activities launched in the task. That is if the root activity of a task set minimal
1323 * width, then the system will set the same minimal width on all other activities in the
1324 * task. It will also ignore any other minimal width attributes of non-root activities.
1325 *
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001326 * @attr ref android.R.styleable#AndroidManifestLayout_minWidth
Andrii Kulian2e751b82016-03-16 16:59:32 -07001327 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001328 public final int minWidth;
Andrii Kulian2e751b82016-03-16 16:59:32 -07001329
1330 /**
1331 * Minimal height of activity in pixels to be able to display its content.
1332 *
1333 * <p><strong>NOTE:</strong> A task's root activity value is applied to all additional
1334 * activities launched in the task. That is if the root activity of a task set minimal
1335 * height, then the system will set the same minimal height on all other activities in the
1336 * task. It will also ignore any other minimal height attributes of non-root activities.
1337 *
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001338 * @attr ref android.R.styleable#AndroidManifestLayout_minHeight
Andrii Kulian2e751b82016-03-16 16:59:32 -07001339 */
Andrii Kulianf66a83d2016-05-17 12:17:44 -07001340 public final int minHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001341 }
1342}